Search Results

Search found 63 results on 3 pages for 'clinton bosch'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Render a 3D image as a 2D vector image

    - by Clinton Blackmore
    Is there any software that will take a 3d model (in any format) and allow you to render it as a 2D vector image (preferable as either an .SVG or .PDF)? My intention is to render LEGO building instructions this way. While there are many tools that let you view them or generate nice, rasterized output, I'd really like to be able to generate vectorized output. Textures are not needed, and hidden line removal may not be needed. I could use a tool that works on any platform (although my preference is OS X, Linux, then Windows). Open source is preferred. If no one knows of a tool that does this, does anyone have a good recommendation of something to hack on and add a feature to output via Cairo?

    Read the article

  • Why doesn't Spotlight find Applications on OS X Server?

    - by Clinton Blackmore
    On our Mac OS X Server 10.5.x boxes, using spotlight (ie. the magnifying glass in the top corner) does not find applications and utilities, but it does on Mac OS X client (and so, we all use the keyboard shortcut and end up frustrated -- it either gives us nothing, or, without us realizing it until later, an application from another partition.) It isn't clear to me if we've done something strange setting up our servers, but they are all like this. Any idea what caused it and how we fix it? Everything (including Applications) are set to show up in a spotlight search in System Preferences).

    Read the article

  • Database connection timeout

    - by Clinton Bosch
    Hi I have read so many articles on the Internet about this problem but none seem to have a clear solution. Please could someone give me a definite answer as to why I am getting database timeouts. The app is a GWT app that is being hosted on a Tomcat 5.5 server. I use spring and the session factory is created in the applicationContext.xml as follows <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${connection.dialect}</prop> <prop key="hibernate.connection.username">${connection.username}</prop> <prop key="hibernate.connection.password">${connection.password}</prop> <prop key="hibernate.connection.url">${connection.url}</prop> <prop key="hibernate.connection.driver_class">${connection.driver.class}</prop> <prop key="hibernate.show_sql">${show.sql}</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.c3p0.min_size">5</prop> <prop key="hibernate.c3p0.max_size">20</prop> <prop key="hibernate.c3p0.timeout">1800</prop> <prop key="hibernate.c3p0.max_statements">50</prop> <prop key="hibernate.c3p0.idle_test_period">300</prop> </props> </property> <property name="annotatedClasses"> <list> <value>za.co.xxxx.traintrack.server.model.Answer</value> <value>za.co.xxxx.traintrack.server.model.Company</value> <value>za.co.xxxx.traintrack.server.model.CompanyRegion</value> <value>za.co.xxxx.traintrack.server.model.Merchant</value> <value>za.co.xxxx.traintrack.server.model.Module</value> <value>za.co.xxxx.traintrack.server.model.Question</value> <value>za.co.xxxx.traintrack.server.model.User</value> <value>za.co.xxxx.traintrack.server.model.CompletedModule</value> </list> </property> </bean> <bean id="dao" class="za.co.xxxx.traintrack.server.DAO"> <property name="sessionFactory" ref="sessionFactory"/> <property name="adminUsername" value="${admin.user.name}"/> <property name="adminPassword" value="${admin.user.password}"/> <property name="godUsername" value="${god.user.name}"/> <property name="godPassword" value="${god.user.password}"/> </bean> All works fine untile the next day: INFO | jvm 1 | 2010/06/15 14:42:27 | 2010-06-15 18:42:27,804 WARN [JDBCExceptionReporter] : SQL Error: 0, SQLState: 08S01 INFO | jvm 1 | 2010/06/15 14:42:27 | 2010-06-15 18:42:27,821 ERROR [JDBCExceptionReporter] : The last packet successfully received from the server was 38729 seconds ago.The last packet sent successfully to the server was 38729 seconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. INFO | jvm 1 | 2010/06/15 14:42:27 | Jun 15, 2010 6:42:27 PM org.apache.catalina.core.ApplicationContext log INFO | jvm 1 | 2010/06/15 14:42:27 | SEVERE: Exception while dispatching incoming RPC call I have read so many different things (none of which worked), please help

    Read the article

  • Compressing xls content with apache deflate module

    - by Clinton Bosch
    I am trying to compress an excel spreadsheet being sent from my application using apache deflate module. I have added the following line to the my sites-enabled file: AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/excel But is seems to make the response data bigger??? Using firebug, without the module I downloaded the xls spreadsheet from the application and it downloaded 100Kb of data, the file size once on the filesystem was also 100Kb as expected. Once I enabled the deflate module as described above and repeated the process, the amount of data downloaded was 295Kb?? but the file was still only 100Kb once save on the filesystem. As an experiment I manually gzipped the saved xls file and it compressed to 20Kb. What am I doing wrong here? Using deflate (Firebug output): 200 OK xxxxxxx.co.za 293 KB 4.43s ParamsHeadersPostPutResponseCacheHTML Response Headers Date Tue, 03 Nov 2009 13:01:43 GMT Server Apache/2.2.4 (Ubuntu) mod_jk/1.2.23 PHP/5.2.3-1ubuntu6.4 mod_ssl/2.2.4 OpenSSL/0.9.8e Content-Disposition attachment; filename="Employee List.xls" Vary Accept-Encoding Content-Encoding gzip Content-Type application/excel Without deflate (Firebug output): 200 OK xxxxxxxx.co.za 100 KB 3.46s ParamsHeadersPostPutResponseCacheHTML Response Headers Date Tue, 03 Nov 2009 13:06:00 GMT Server Apache/2.2.4 (Ubuntu) mod_jk/1.2.23 PHP/5.2.3-1ubuntu6.4 mod_ssl/2.2.4 OpenSSL/0.9.8e Content-Disposition attachment; filename="Employee List.xls" Content-Length 102912 Content-Type application/excel

    Read the article

  • XSLT: Display unique rows of filtered XML recordset

    - by Chris G.
    I've got a recordset that I'm filtering on a particular field (i.e. Manager ="Frannklin"). Now I'd like to group the results of that filtered recordset based on another field (Client). I can't seem to get Muenchian grouping to work right. Any thoughts? TIA! CG My filter looks like this: <xsl:key name="k1" match="Row" use="@Manager"/> <xsl:param name="dvt_filterval">Frannklin</xsl:param> <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" /> <xsl:variable name="FilteredRowsAttr" select="$Rows[normalize-space(@*[name()=$FieldNameNoAtSign])=$dvt_filterval ]" /> Templates <xsl:apply-templates select="$FilteredRowsAttr[generate-id() = generate-id(key('k1',@Manager))]" mode="g1000a"> </xsl:apply-templates> <xsl:template match="Row" mode="g1000a"> Client: <xsl:value-of select="@Client"/> </xsl:template> Results I'm getting Client: Beta Client: Beta Client: Beta Client: Gamma Client: Delta Results I want Client: Beta Client: Gamma Client: Delta Sample recordset <dsQueryResponse> <Rows> <Row Manager="Smith" Client="Alpha " Project_x0020_Name="Annapolis" PM_x0023_="00123" /> <Row Manager="Ford" Client="Alpha " Project_x0020_Name="Brown" PM_x0023_="00124" /> <Row Manager="Cronkite" Client="Beta " Project_x0020_Name="Gannon" PM_x0023_="00129" /> <Row Manager="Clinton, Bill" Client="Beta " Project_x0020_Name="Harvard" PM_x0023_="00130" /> <Row Manager="Frannklin" Client="Beta " Project_x0020_Name="Irving" PM_x0023_="00131" /> <Row Manager="Frannklin" Client="Beta " Project_x0020_Name="Jakarta" PM_x0023_="00132" /> <Row Manager="Frannklin" Client="Beta " Project_x0020_Name="Vassar" PM_x0023_="00135" /> <Row Manager="Jefferson" Client="Gamma " Project_x0020_Name="Stamford" PM_x0023_="00141" /> <Row Manager="Cronkite" Client="Gamma " Project_x0020_Name="Tufts" PM_x0023_="00142" /> <Row Manager="Frannklin" Client="Gamma " Project_x0020_Name="UCLA" PM_x0023_="00143" /> <Row Manager="Jefferson" Client="Gamma " Project_x0020_Name="Villanova" PM_x0023_="00144" /> <Row Manager="Carter" Client="Delta " Project_x0020_Name="Drexel" PM_x0023_="00150" /> <Row Manager="Clinton" Client="Delta " Project_x0020_Name="Iona" PM_x0023_="00151" /> <Row Manager="Frannklin" Client="Delta " Project_x0020_Name="Temple" PM_x0023_="00152" /> <Row Manager="Ford" Client="Epsilon " Project_x0020_Name="UNC" PM_x0023_="00157" /> <Row Manager="Clinton" Client="Epsilon " Project_x0020_Name="Berkley" PM_x0023_="00158" /> </Rows> </dsQueryResponse>

    Read the article

  • Spring transactions not committing

    - by Clinton Bosch
    I am struggling to get my spring managed transactions to commit, could someone please spot what I have done wrong. All my tables are mysql InnonDB tables. My RemoteServiceServlet (GWT) is as follows: public class TrainTrackServiceImpl extends RemoteServiceServlet implements TrainTrackService { @Autowired private DAO dao; @Override public void init(ServletConfig config) throws ServletException { super.init(config); WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); AutowireCapableBeanFactory beanFactory = ctx.getAutowireCapableBeanFactory(); beanFactory.autowireBean(this); } @Transactional(propagation= Propagation.REQUIRED, rollbackFor=Exception.class) public UserDTO createUser(String firstName, String lastName, String idNumber, String cellPhone, String email, int merchantId) { User user = new User(); user.setFirstName(firstName); user.setLastName(lastName); user.setIdNumber(idNumber); user.setCellphone(cellPhone); user.setEmail(email); user.setDateCreated(new Date()); Merchant merchant = (Merchant) dao.find(Merchant.class, merchantId); if (merchant != null) { user.setMerchant(merchant); } // Save the user. dao.saveOrUpdate(user); UserDTO dto = new UserDTO(); dto.id = user.getId(); dto.firstName = user.getFirstName(); dto.lastName = user.getLastName(); return dto; } The DAO is as follows: public class DAO extends HibernateDaoSupport { private String adminUsername; private String adminPassword; private String godUsername; private String godPassword; public String getAdminUsername() { return adminUsername; } public void setAdminUsername(String adminUsername) { this.adminUsername = adminUsername; } public String getAdminPassword() { return adminPassword; } public void setAdminPassword(String adminPassword) { this.adminPassword = adminPassword; } public String getGodUsername() { return godUsername; } public void setGodUsername(String godUsername) { this.godUsername = godUsername; } public String getGodPassword() { return godPassword; } public void setGodPassword(String godPassword) { this.godPassword = godPassword; } public void saveOrUpdate(ModelObject obj) { getHibernateTemplate().saveOrUpdate(obj); } And my applicationContext.xml is as follows: <context:annotation-config/> <context:component-scan base-package="za.co.xxx.traintrack.server"/> <!-- Application properties --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>file:${user.dir}/@propertiesFile@</value> </list> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${connection.dialect}</prop> <prop key="hibernate.connection.username">${connection.username}</prop> <prop key="hibernate.connection.password">${connection.password}</prop> <prop key="hibernate.connection.url">${connection.url}</prop> <prop key="hibernate.connection.driver_class">${connection.driver.class}</prop> <prop key="hibernate.show_sql">${show.sql}</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.c3p0.min_size">5</prop> <prop key="hibernate.c3p0.max_size">20</prop> <prop key="hibernate.c3p0.timeout">300</prop> <prop key="hibernate.c3p0.max_statements">50</prop> <prop key="hibernate.c3p0.idle_test_period">60</prop> </props> </property> <property name="annotatedClasses"> <list> <value>za.co.xxx.traintrack.server.model.Answer</value> <value>za.co.xxx.traintrack.server.model.Company</value> <value>za.co.xxx.traintrack.server.model.CompanyRegion</value> <value>za.co.xxx.traintrack.server.model.Merchant</value> <value>za.co.xxx.traintrack.server.model.Module</value> <value>za.co.xxx.traintrack.server.model.Question</value> <value>za.co.xxx.traintrack.server.model.User</value> <value>za.co.xxx.traintrack.server.model.CompletedModule</value> </list> </property> </bean> <bean id="dao" class="za.co.xxx.traintrack.server.DAO"> <property name="sessionFactory" ref="sessionFactory"/> <property name="adminUsername" value="${admin.user.name}"/> <property name="adminPassword" value="${admin.user.password}"/> <property name="godUsername" value="${god.user.name}"/> <property name="godPassword" value="${god.user.password}"/> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <!-- enable the configuration of transactional behavior based on annotations --> <tx:annotation-driven transaction-manager="transactionManager"/> If I change the sessionFactory property to be autoCommit=true then my object does get persisited. <prop key="hibernate.connection.autocommit">true</prop>

    Read the article

  • Are there any good sites for blogging about programming?

    - by Jacques Bosch
    I have a few programming articles I would like to write, but I do not have a site of my own - yet ;). Is there a site that is specifically geared toward technical / programming topics, with great functionality and style? Or will I have to go with things like wordpress or blogspot? I would like a site that can track number of views and that has an intuitive commenting system. Any thoughts would be appreciated.

    Read the article

  • How to find points that intersect an envelope of a line, but not the line itself?

    - by Jacques Bosch
    I have 2 layers. A lines layer and a points layer. For any given line, how can I find the points that intersect the envelope of the line, but not the line itself, or more specifically, not the to point or from point of the line. I can obviously find all the points that intersect the line's envelope, and then do 1 by 1 tests on the found points to see if they intersect the to or from points of the line, but I was hoping there is an easier, faster way to do something of this nature.

    Read the article

  • WP7 PanoramaItem with Icon/Button next to Header

    - by Ramon Bosch
    Windows Phone 7's People hub has an "all" panorama item with "search" and a "new" buttons right next to the header/title. I can't seem to accomplish this with PanoramaItem in Visual Studio using the standard Panorama control. I don't know enough Silverlight/WPF either to be able to position something manually and control transitions/movement correctly. How can I set a button (or any object, for that matter) to go alongside the header of a wp7 PanoramaItem? Thanks!

    Read the article

  • How do I tell GWT to not compile a permutation for gears

    - by Clinton Bosch
    I have included gwt-html5-geolocation into my GWT project and was disappointed to find that it doubled up on my number of permutations compiled. Apparently if the browser does not support geolocation API then it falls back to use gears to find out your location. Is there a way to NOT compile a permutation for gears similar to the way you can tell GWT to only compile certain browser permutations? (the geolocation stuff is very much a nice-to-have and frankly if the client is running an old browser then I am happy not to get their location) Thanks

    Read the article

  • After getting the 'It worked!' page with Djangoappengine, what do I do next?

    - by Jacques Bosch
    I followed the Djangoappengine instructions. I used their django-testapp and copied the following folders in the django-testapp folder according to what I understood the instructions to say: django djangoappengine djangotoolbox I then started the dev server by running: manage.py runserver Then navigated to http://localhost:8000/ and got the "It worked!" page, which is great, but it says the following at the bottom: You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work! I am an absolute beginner with Django and App Engine and Djangoappengine and Django-nonrel, so I am pretty lost. How do I configure URLs? Or a link to the how to will help. I took a look at the Django tutorial, but am unsure how much of it is relevant to Djangoappengine and Django-nonrel as a lot of the starting steps have to do with SQL databases. Basically some direction on how to get my app running will be great. Thanx much.

    Read the article

  • Loading JNI lib on OSX?

    - by Clinton
    Background So I am attempting to load a jnilib (specifically JOGL) into java on OSX at runtime. I have been following along the relevant stackoverflow questions: Maven and the JOGL Library Loading DLL in Java - Eclipse - JNI How to make a jar file that include all jar files The end goal for me is to package platform specific JOGL files into a jar and unzip them into a temp directory and load them at start-up. I worked my problem back to simply attempting to load JOGL using hard-coded paths: File f = new File("/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/libjogl.jnilib"); System.load(f.toString()); f = new File ("/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/libjogl_awt.jnilib"); System.load(f.toString()); I get the following exception when attempting to use the JOGL API: Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path But when I specify java.library.path by adding the following JVM option: -Djava.library.path="/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/" Everything works fine. Question Is it possible use System.load (or some other variant) on OSX as a replacement for -Djava.library.path that is invoked at runtime?

    Read the article

  • How do you embed XHTML into APT file when using Maven to generate a site?

    - by Clinton
    I am using maven to generate a website for a Java project, which uses APT "Almost Plain Text" as a wiki like markup. Maven takes this and turns it into XHTML. I already have a custom template/skin that I am using for the site, but the index page will have a couple of extra custom design elements that are beyond the capabilities of APT. So how can you add xhtml to the apt file so that it gets correctly embedded in the final output? Thanks.

    Read the article

  • What ORMs work well with Scala?

    - by Clinton R. Nixon
    I'm about to write a Scala command-line application that relies on a MySQL database. I've been looking around for ORMs, and am having trouble finding one that will work well. The Lift ORM looks nice, but I'm not sure it can be decoupled from the entire Lift web framework. ActiveObjects also looks OK, but the author says that it may not work well with Scala. I'm not coming to Scala from Java, so I don't know all the options. Has anyone used an ORM with Scala, and if so, what did you use and how well did it work?

    Read the article

  • Should I use Perl or PHP or something else for this project?

    - by Clinton
    I'm about to embark on a project that will need to: Process XML Heavy text parsing of non-xml documents Insertion of data from xml and non-xml documents into a relational DB. Present processed data to user from db using webpages. The website will be subject to short periods of very heavy loads to pages (300+ visitors a minute for several minutes), but most of the time will be idle (a dozen or so visitors a minute). The ability to cache or scale to load will be very nice. I have a very strong background in Java and web services, but I do not want to use Java for this project as I'd like to diversify my skill set. Which language would you recommend and what are some pros and cons that you might recognize from your own experiences?

    Read the article

  • Add an item to the Finder/Save dialog sidebar

    - by Clinton Blackmore
    I'm working on a script where a user logs into a guest account on OS and is prompted for their network credentials in order to mount their network home folder (while they benefit from working on a local user folder). As the guest folder is deleted when users log out, I want to discourage them from saving anything there. I would like to replace the items on the Finder and Open/Save sidebar lists (such as "Desktop", username, "Documents", etc) with ones that would save into their network home folder. It is possible to do this using AppleScript or Cocoa APIs, or do I need to modify a plist and restart the Finder? [Ack. Looking into ~/Library/Preferences/com.apple.sidebars.plist, it isn't at all clear how I'd populate it.] Similar Questions: AppleScript: adding mounted folder to Finder Sidebar? suggests using fstab; this code will most likely run as a user and really, automounting at that point would be too late. How do you programmatically put folder icons on the Finder sidebar, given that you have to use a custom icon for the folder? Says there is no Cocoa API, but that you can use a carbon-style LSSharedFileList API that is only documented in a single header file. Does anyone know of some example code to add an item to the Finder sidebar?

    Read the article

  • Omit return type in C++0x

    - by Clinton
    I've recently found myself using the following macro with gcc 4.5 in C++0x mode: #define RETURN(x) -> decltype(x) { return x; } And writing functions like this: template <class T> auto f(T&& x) RETURN (( g(h(std::forward<T>(x))) )) I've been doing this to avoid the inconvenience having to effectively write the function body twice, and having keep changes in the body and the return type in sync (which in my opinion is a disaster waiting to happen). The problem is that this technique only works on one line functions. So when I have something like this (convoluted example): template <class T> auto f(T&& x) -> ... { auto y1 = f(x); auto y2 = h(y1, g1(x)); auto y3 = h(y1, g2(x)); if (y1) { ++y3; } return h2(y2, y3); } Then I have to put something horrible in the return type. Furthermore, whenever I update the function, I'll need to change the return type, and if I don't change it correctly, I'll get a compile error if I'm lucky, or a runtime bug in the worse case. Having to copy and paste changes to two locations and keep them in sync I feel is not good practice. And I can't think of a situation where I'd want an implicit cast on return instead of an explicit cast. Surely there is a way to ask the compiler to deduce this information. What is the point of the compiler keeping it a secret? I thought C++0x was designed so such duplication would not be required.

    Read the article

  • A "Trig" Calculating Class

    - by Clinton Scott
    I have been trying to create a gui that calculates trigonometric functions based off of the user's input. I have had success in the GUI part, but my class that I wrote to hold information using inheritance seems to be messed up, because when I run it gives an error saying: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor ArcTrigCalcCon in class TrigCalc.ArcTrigCalcCon cannot be applied to given types; required: double,double,double,double,double,double found: java.lang.Double,java.lang.Double,java.lang.Double reason: actual and formal argument lists differ in length at TrigCalc.TrigCalcGUI.(TrigCalcGUI.java:31) at TrigCalc.TrigCalcGUI.main(TrigCalcGUI.java:87) Java Result: 1 and says it is the object causing the problem. Below Will be my code. First I will put up my inheritance class with cosecant secant and cotangent and then my original class with the original 3 trig functions: { public ArcTrigCalcCon(double s, double cs, double t, double csc, double sc, double ct) { // Inherit from the Trig Calc class super(s, cs, t); cosecant = 1/s; secant = 1/cs; cotangent = 1/t; } public void setCsc(double csc) { cosecant = csc; } public void setSec(double sc) { secant = sc; } public void setCot(double ct) { cotangent = ct; } } Here is the first Trigonometric class: public class TrigCalcCon { public double sine; public double cosine; public double tangent; public TrigCalcCon(double s, double cs, double t) { sine = s; cosine = cs; tangent = t; } public void setSin(double s) { sine = s; } public void setCos(double cs) { cosine = cs; } public void setTan(double t) { tangent = t; } public void set(double s, double cs, double t) { sine = s; cosine = cs; tangent = t; } public double getSin() { return Math.sin(sine); } public double getCos() { return Math.cos(cosine); } public double getTan() { return Math.tan(tangent); } } and here is the demo class to run the gui: public class TrigCalcGUI extends JFrame implements ActionListener { // Instance Variables private String input; private Double s, cs, t, csc, sc, ct; private JPanel mainPanel, sinPanel, cosPanel, tanPanel, cscPanel, secPanel, cotPanel, buttonPanel, inputPanel, displayPanel; // Panel Display private JLabel sinLabel, cosLabel, tanLabel, secLabel, cscLabel, cotLabel, inputLabel; private JTextField sinTF, cosTF, tanTF, secTF, cscTF, cotTF, inputTF; //Text Fields for sin, cos, and tan, and inverse private JButton calcButton, clearButton; // Calculate and Exit Buttons // Object ArcTrigCalcCon trC = new ArcTrigCalcCon(s, cs, t); public TrigCalcGUI() { // title bar text. super("Trig Calculator"); // Corner exit button action. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create main panel to add each panel to mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(3,2)); displayPanel = new JPanel(); displayPanel.setLayout(new GridLayout(3,2)); // Assign Panel to each variable inputPanel = new JPanel(); sinPanel = new JPanel(); cosPanel = new JPanel(); tanPanel = new JPanel(); cscPanel = new JPanel(); secPanel = new JPanel(); cotPanel = new JPanel(); buttonPanel = new JPanel(); // Call each constructor buildInputPanel(); buildSinCosTanPanels(); buildCscSecCotPanels(); buildButtonPanel(); // Add each panel to content pane displayPanel.add(sinPanel); displayPanel.add(cscPanel); displayPanel.add(cosPanel); displayPanel.add(secPanel); displayPanel.add(tanPanel); displayPanel.add(cotPanel); // Add three content panes to GUI mainPanel.add(inputPanel, BorderLayout.NORTH); mainPanel.add(displayPanel, BorderLayout.CENTER); mainPanel.add(buttonPanel, BorderLayout.SOUTH); //add mainPanel this.add(mainPanel); // size of window to content this.pack(); // display window setVisible(true); } public static void main(String[] args) { new TrigCalcGUI(); } private void buildInputPanel() { inputLabel = new JLabel("Enter a Value: "); inputTF = new JTextField(5); inputPanel.add(inputLabel); inputPanel.add(inputTF); } // Building Constructor for sinPanel cosPanel, and tanPanel private void buildSinCosTanPanels() { // Set layout and border for sinPanel sinPanel.setLayout(new GridLayout(2,2)); sinPanel.setBorder(BorderFactory.createTitledBorder("Sine")); // sinTF = new JTextField(5); sinTF.setEditable(false); sinPanel.add(sinTF); // Set layout and border for cosPanel cosPanel.setLayout(new GridLayout(2,2)); cosPanel.setBorder(BorderFactory.createTitledBorder("Cosine")); cosTF = new JTextField(5); cosTF.setEditable(false); cosPanel.add(cosTF); // Set layout and border for tanPanel tanPanel.setLayout(new GridLayout(2,2)); tanPanel.setBorder(BorderFactory.createTitledBorder("Tangent")); tanTF = new JTextField(5); tanTF.setEditable(false); tanPanel.add(tanTF); } // Building Constructor for cscPanel secPanel, and cotPanel private void buildCscSecCotPanels() { // Set layout and border for cscPanel cscPanel.setLayout(new GridLayout(2,2)); cscPanel.setBorder(BorderFactory.createTitledBorder("Cosecant")); // cscTF = new JTextField(5); cscTF.setEditable(false); cscPanel.add(cscTF); // Set layout and border for secPanel secPanel.setLayout(new GridLayout(2,2)); secPanel.setBorder(BorderFactory.createTitledBorder("Secant")); secTF = new JTextField(5); secTF.setEditable(false); secPanel.add(secTF); // Set layout and border for cotPanel cotPanel.setLayout(new GridLayout(2,2)); cotPanel.setBorder(BorderFactory.createTitledBorder("Cotangent")); cotTF = new JTextField(5); cotTF.setEditable(false); cotPanel.add(cotTF); } private void buildButtonPanel() { // Create buttons and add events calcButton = new JButton("Calculate"); calcButton.addActionListener(new CalcButtonListener()); clearButton = new JButton("Clear"); clearButton.addActionListener(new ClearButtonListener()); buttonPanel.add(calcButton); buttonPanel.add(clearButton); } @Override public void actionPerformed(ActionEvent e) { } private class CalcButtonListener implements ActionListener { public void actionPerformed(ActionEvent ae) { // Declare boolean variable boolean incorrect = true; // Set input variable to input text field text input = inputTF.getText(); ImageIcon newIcon; ImageIcon frowny = new ImageIcon(TrigCalcGUI.class.getResource("/Sad_Face.png")); Image gm = frowny.getImage(); Image newFrowny = gm.getScaledInstance(100, 100, java.awt.Image.SCALE_FAST); newIcon = new ImageIcon(newFrowny); // If boolean is true, throw exception if(incorrect) { try{Double.parseDouble(input); incorrect = false;} catch(NumberFormatException nfe) { String s = "Invalid Input " + "/n Input Must Be a Numerical value." + "/nPlease Press Ok and Try Again"; JOptionPane.showMessageDialog(null, s, "Invalid", JOptionPane.ERROR_MESSAGE, newIcon); inputTF.setText(""); inputTF.requestFocus(); } } // If boolean is not true, proceed with output if (incorrect != true) { /* Set each text field's output to the String double value * of inputTF */ sinTF.setText(input); cosTF.setText(input); tanTF.setText(input); cscTF.setText(input); secTF.setText(input); cotTF.setText(input); } } } /** * Private inner class that handles the event when * the user clicks the Exit button. */ private class ClearButtonListener implements ActionListener { public void actionPerformed(ActionEvent ae) { // Clear field sinTF.setText(""); cosTF.setText(""); tanTF.setText(""); cscTF.setText(""); secTF.setText(""); cotTF.setText(""); // Clear textfield and set cursor focus to field inputTF.setText(""); inputTF.requestFocus(); } } }

    Read the article

  • Loading JNI lib on Mac OS X?

    - by Clinton
    Background So I am attempting to load a jnilib (specifically JOGL) into Java on Mac OS X at runtime. I have been following along the relevant Stack Overflow questions: Maven and the JOGL Library Loading DLL in Java - Eclipse - JNI How to make a jar file that include all jar files The end goal for me is to package platform specific JOGL files into a JAR and unzip them into a temp directory and load them at start-up. I worked my problem back to simply attempting to load JOGL using hard-coded paths: File f = new File("/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/libjogl.jnilib"); System.load(f.toString()); f = new File ("/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/libjogl_awt.jnilib"); System.load(f.toString()); I get the following exception when attempting to use the JOGL API: Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path But when I specify java.library.path by adding the following JVM option: -Djava.library.path="/var/folders/+n/+nfb8NHsHiSpEh6AHMCyvE+++TI/-Tmp-/" Everything works fine. Question Is it possible use System.load (or some other variant) on Mac OS X as a replacement for -Djava.library.path that is invoked at runtime?

    Read the article

  • Make function declarations based on function definitions

    - by Clinton Blackmore
    I've written a .cpp file with a number of functions in it, and now need to declare them in the header file. It occurred to me that I could grep the file for the class name, and get the declarations that way, and it would've worked well enough, too, had the complete function declaration before the definition -- return code, name, and parameters (but not function body) -- been on one line. It seems to me that this is something that would be generally useful, and must've been solved a number of times. I am happy to edit the output and not worried about edge cases; anything that gives me results that are right 95% of the time would be great. So, if, for example, my .cpp file had: i2cstatus_t NXTI2CDevice::writeRegisters( uint8_t start_register, // start of the register range uint8_t bytes_to_write, // number of bytes to write uint8_t* buffer = 0) // optional user-supplied buffer { ... } and a number of other similar functions, getting this back: i2cstatus_t NXTI2CDevice::writeRegisters( uint8_t start_register, // start of the register range uint8_t bytes_to_write, // number of bytes to write uint8_t* buffer = 0) for inclusion in the header file, after a little editing, would be fine. Getting this back: i2cstatus_t writeRegisters( uint8_t start_register, uint8_t bytes_to_write, uint8_t* buffer); or this: i2cstatus_t writeRegisters(uint8_t start_register, uint8_t bytes_to_write, uint8_t* buffer); would be even better.

    Read the article

  • Haskell: foldl' accumulator parameter

    - by Clinton
    I've been asking a few questions about strictness, but I think I've missed the mark before. Hopefully this is more precise. Lets say we have: n = 1000000 f z = foldl' (\(x1, x2) y -> (x1 + y, y - x2)) z [1..n] Without changing f, what should I set z = ... So that f z does not overflow the stack? (i.e. runs in constant space regardless of the size of n) Its okay if the answer requires GHC extensions. My first thought is to define: g (a1, a2) = (!a1, !a2) and then z = g (0, 0) But I don't think g is valid Haskell.

    Read the article

< Previous Page | 1 2 3  | Next Page >