Daily Archives

Articles indexed Wednesday May 19 2010

Page 9/122 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Java - Custom PropertyEditorSupport to display units

    - by I82Much
    All, I'm trying to make the properties of my node have Units associated with the measure. ( I am using the JScience.org implementation of JSR 275) So for instance, public class Robot extends AbstractNode { // in kg float vehicleMass; @Override public Sheet createSheet() { Sheet s = Sheet.createDefault(); Sheet.Set set = s.createPropertiesSet(); try { PropertySupport.Reflection vehicleMassField = new PropertySupport.Reflection(this, float.class, "vehicleMass"); vehicleMassField.setValue("units", SI.KILOGRAMS); vehicleMassField.setName("vehicleMass"); set.put(vehicleMassField); PropertyEditorManager.registerEditor(float.class, UnitInPlaceEditor.class); } catch (NoSuchMethodException ex) { Exceptions.printStackTrace(ex); } s.put(set); return s; } } I want my UnitInPlaceEditor to append the units to the end of the string representation of the number, and when the field is clicked (enters edit mode) for the units to disappear and just the number becomes selected for editing. I can make the units appear, but I cannot get the units to disappear when the field enters editing mode. public class UnitsInplaceEditor extends PropertyEditorSupport implements ExPropertyEditor { private PropertyEnv pe; @Override public String getAsText() { // Append the unit by retrieving the stored value } @Override public void setAsText(String s) { // strip off the unit, parse out the number } public void attachEnv(PropertyEnv pe) { this.pe = pe; } } Here's a screenshot of the display - I like it like this.. but here's the value being edited; note the unit stays there. Basically I want one value (string) to be displayed in the field when the field is NOT being edited, and a different to be displayed when user starts editing the field. Barring that, I'd like to put a constant jlabel for the units (uneditable) to the right of the text field. Anyone know how to do this?

    Read the article

  • Queue remote calls to a Python Twisted perspective broker?

    - by agartland
    The strength of Twisted (for python) is its asynchronous framework (I think). I've written an image processing server that takes requests via Perspective Broker. It works great as long as I feed it less than a couple hundred images at a time. However, sometimes it gets spiked with hundreds of images at virtually the same time. Because it tries to process them all concurrently the server crashes. As a solution I'd like to queue up the remote_calls on the server so that it only processes ~100 images at a time. It seems like this might be something that Twisted already does, but I can't seem to find it. Any ideas on how to start implementing this? A point in the right direction? Thanks!

    Read the article

  • NoSQL vs Ehcache caching advise for speeding up read only mysql Database

    - by paddydub
    I'm building a Route Planner Webapp using Spring/Hibernate/Tomcat and a mysql database, I have a database containing read only data, such as Bus Stop Coordinates, Bus times which is never updated. I'm trying to make the app run faster, each time the application is run it will preform approx 1000 reads to the database to calculate a route. I have setup a Ehcache which greatly improves the read from database times. I'm now setting terracotta + Ehcache distributed caching to share the cache with multiple Tomcat JVMs. This seems a bit complicated. I've tried memcached but it was not performing as fast as ehcache. I'm wondering if a MongoDb or Redis would be better suited. I have no experience with nosql but I would appreciate if anyone has any ideas. What i need is quick access to the read only database.

    Read the article

  • Should the website switch language based on IP address or browser language?

    - by SuperRomia
    Geo-location has been used most by Websites to do redirection, but I have found that several IP addresses locate a country which has using several languages. Meantime, some users prefer to using the language setup in their system. For example, a person from United States goes to Japan and using the Internet connection from there to surf Website, but the Website redirects him to Japanese language. So, should I give the web user a choice to select the language detected on their browser or force them to the website detected by IP address?

    Read the article

  • Is there a way to detect when a WSS default.aspx page is updated?

    - by Alan
    That is detect when the user makes web part changes and selects to exit editing the page. I want to be able to capture a page event, then create a SharePoint task to instruct a user to translate that page to another language (note that MOSS and variations is not an option because the client wants to use the free version of SharePoint). So the customer wants essentially the same WSS site in multiple languages.

    Read the article

  • heroku complaining about my public key created by ssh-keygen2

    - by yuri
    I am trying to access my heroku app from work (windows machine). I installed cygwin on the machine and generated ssh-key as well. However, I get the below error: C:heroku keys:add "C:\cygwin\home\4541450\[email protected]" Uploading ssh public key C:\cygwin\home\4541450\[email protected] Enter your Heroku credentials. Email: [email protected] Password: Uploading ssh public key C:\cygwin\home\c54550\[email protected] ! Contents Invalid public key / Contents Invalid public key / Fingerprint can 't be blank I generated the ssh key with the command below. ssh-keygen2 "[email protected]" -t rsa ssh-keygen is not available with this cygwin.

    Read the article

  • Binding a member signal to a function

    - by the_drow
    This line of code compiles correctly without a problem: boost::bind(boost::ref(connected_), boost::dynamic_pointer_cast<session<version> >(shared_from_this()), boost::asio::placeholders::error); However when assigning it to a boost::function or as a callback like this: socket_->async_connect(connection_->remote_endpoint(), boost::bind(boost::ref(connected_), boost::dynamic_pointer_cast<session<version> >(shared_from_this()), boost::asio::placeholders::error)); I'm getting a whole bunch of incomprehensible errors (linked since it's too long to fit here). On the other hand I have succeeded binding a free signal to a boost::function like this: void print(const boost::system::error_code& error) { cout << "session connected"; } int main() { boost::signal<void(const boost::system::error_code &)> connected_; connected_.connect(boost::bind(&print, boost::asio::placeholders::error)); client<>::connection_t::socket_ptr socket_(new client<>::connection_t::socket_t(conn->service())); // shared_ptr of a tcp socket socket_->async_connect(conn->remote_endpoint(), boost::bind(boost::ref(connected_), boost::asio::placeholders::error)); conn->service().run(); // io_service.run() return 0; } This works and prints session connected correctly. What am I doing wrong here?

    Read the article

  • Implementing eval and load functions inside a scripting engine with Flex and Bison.

    - by Simone Margaritelli
    Hy guys, i'm developing a scripting engine with flex and bison and now i'm implementing the eval and load functions for this language. Just to give you an example, the syntax is like : import std.*; load( "some_script.hy" ); eval( "foo = 123;" ); println( foo ); So, in my lexer i've implemented the function : void hyb_parse_string( const char *str ){ extern int yyparse(void); YY_BUFFER_STATE prev, next; /* * Save current buffer. */ prev = YY_CURRENT_BUFFER; /* * yy_scan_string will call yy_switch_to_buffer. */ next = yy_scan_string( str ); /* * Do actual parsing (yyparse calls yylex). */ yyparse(); /* * Restore previous buffer. */ yy_switch_to_buffer(prev); } But it does not seem to work. Well, it does but when the string (loaded from a file or directly evaluated) is finished, i get a sigsegv : Program received signal SIGSEGV, Segmentation fault. 0xb7f2b801 in yylex () at src/lexer.cpp:1658 1658 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) As you may notice, the sigsegv is generated by the flex/bison code, not mine ... any hints, or at least any example on how to implement those kind of functions? PS: I've succesfully implemented the include directive, but i need eval and load to work not at parsing time but execution time (kind of PHP's include/require directives).

    Read the article

  • Fastest method for SQL Server inserts, updates, selects from C# ASP.Net 2.0+

    - by Ian
    Hi All, long time listener, first time caller. I use SPs and this isn't an SP vs code-behind "Build your SQL command" question. I'm looking for a high-throughput method for a backend app that handles many small transactions. I use SQLDataReader for most of the returns since forward only works in most cases for me. I've seen it done many ways, and used most of them myself. Methods that define and accept the stored procedure parameters as parameters themselves and build using cmd.Parameters.Add (with or without specifying the DB value type and/or length) Assembling your SP params and their values into an array or hashtable, then passing to a more abstract method that parses the collection and then runs cmd.Parameters.Add Classes that represent tables, initializing the class upon need, setting the public properties that represent the table fields, and calling methods like Save, Load, etc I'm sure there are others I've seen but can't think of at the moment as well. I'm open to all suggestions.

    Read the article

  • Personal cloud storage options

    - by rhaddan
    I'm looking for some personal cloud storage options. My biggest concern about moving to a hosted storage solution is the long-term viability of the provider. Has anyone used a cloud service that you're crazy about? I'm a Mac user, so I need to have something that will work on the Mac OS and ideally the iPhone as well.

    Read the article

  • JQuery will not set a higher scoped object in callback

    - by user344666
    Hello, I have a jquery callback function. In that function I want it to change the value of a varible that is in a higher scope, for somereason it is not doing that. Here is the code. Thanks function add() { var returnedData = { my_id: 0 }; $.post("add_event.php", { event : toSendText }, function(data) {returnedData.my_id = 5;}, "json"); if(add_page == true){ alert(returnedData.my_id); window.open('content-list.php?cal_id='); } }

    Read the article

  • UIScrollView map with pins that stay at a fixed size?

    - by OMH
    Hi, In my app, I have a ScrollView that shows a map(just a jpeg). On top of the ScrollView, I added some pins(UIImageView) So far so good. But when I zoom in, the pins also get larger. I would like the pins to stay at a fixed size, just like the pins on the google map application on the iPhone. How do I solve this? Thanks!

    Read the article

  • How do I get meaningful error messages in IIS7?

    - by Petras
    I have a classic ASP website that is crashing in IIS7. It is crashing because IIS doesn't allow file uploads greater than a certain size. I know this because files below about 200k work fine. I removed the Status Code 500 error in IIS but I still don't get a file name and the line where my code failed as I do when running locally. Instead I get: "The page cannot be displayed because an internal server error has occurred. If you are the system administrator please click here to find out more about this error." How do I get a file name and the line where my code failed? Here are my IIS settings:

    Read the article

  • I have a BHO in c++ and i need to block some keyboard controls (Ctrl-o) in a i-frame.

    - by BHOdevelopper
    I need to know of a way to prevent the user to 'open a new url' (with Ctrl-o) as soon as he has the focus on my sidebar (right-sided iframe). In fact, my sidebar offers some controls and the user should not be able to 'navigate' to other website through the sidebar. I'm using a bho in C++ using ATL(active template library), but maybe if anyone knows of a simplier way like in JS(javascript) or PHP(Hypertext Preprocessor) ? Any ideas is appreciated. Thanks.If anyone need precisions, please ask. I'll be checking for responses every single days.

    Read the article

  • IP address detection for geo-location or MAC address much secure?

    - by SuperRomia
    Recent study many websites are using geo-location technology on their Websites. I'm planning to implement one website which can be detect the web visitor more accurate. An found that Mozilla is using some kind of detect MAC address technology in their Geo-Location web service. Is it violate some privacy issue? I believe most of Geo-location service providers only offer country to city level. But the Mac address detection enable to locate the web visitors' location more correctly than using IP address detection. If detect the MAC address is not practical, which geo-location service provider is offering more accurate data to detect my Website visitor around the world?

    Read the article

  • Account for simple url rewriting in ASP.NET MVC redirect

    - by Kevin Montrose
    How would you go about redirecting in ASP.NET MVC to take into account some external URL rewriting rules. For example: What the user enters: http://www.example.com/app/route What ASP.NET MVC sees: /route What I want to redirect to: http://www.example.com/app/other_route What actually happens when I do a simple RedirectToAction: http://www.example.com/other_route (which doesn't exist, from the outside anyway) This seems like it should be simple, but I'm drawing a blank.

    Read the article

  • Trigger to update data in another DB

    - by Permana
    I have the following schema: Database: test. Table: per_login_user, Field: username (PK), password Database: wavinet. Table: login_user, Field: username (PK), password What I want to do is to create a trigger. Whenever a password field on table per_login_user in database test get updated, the same value will be copied to field password in Table login_wavinet in database wavinet I have search trough Google and find this solution: http://forums.devshed.com/ms-sql-development-95/use-trigger-to-update-data-in-another-db-149985.html But, when I run this query: CREATE TRIGGER trgPasswordUpdater ON dbo.per_login_user FOR UPDATE AS UPDATE wavinet.dbo.login_user SET password = I.password FROM inserted I INNER JOIN deleted D ON I.username = D.username WHERE wavinet.dbo.login_wavinet.password = D.password the query return error message: Msg 107, Level 16, State 3, Procedure trgPasswordUpdater, Line 4 The column prefix 'wavinet.dbo.login_wavinet' does not match with a table name or alias name used in the query.

    Read the article

  • Query.fetch(limit=2000) only moves cursor forward by 1000 entities?

    - by Liron
    Let's say I have 2500 MyModel entities in my datastore, and I run this code: query = MyModel.all() first_batch = query.fetch(2000) len(first_batch) # 2000 next_query = MyModel.all().with_cursor(query.cursor()) next_batch = next_query.fetch(2000) What do you think len(next_batch) is? 500, right? Nope - it's 1500. Apparently the query cursor never moves forward by more than 1000, even when the query itself returns more than 1000 entities. Should I do something different or is it just an App Engine bug?

    Read the article

  • How do I use jQueryUI's ui-states with JSF2's h:messages?

    - by Andrew
    It seems like it should be very simple to specify that the h:messages generated by JSF should be styled using jQueryUI's nice ui-states. But sadly I can't make it fit. It seems that the jQueryUI states require several elements (div,div,p,span) in order to make it work. So taking inspiration directly from the jQueryUI theme demo page: <!-- Highlight / Error --> <h2 class="demoHeaders">Highlight / Error</h2> <div class="ui-widget"> <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> <strong>Hey!</strong> Sample ui-state-highlight style.</p> </div> </div> <br/> <div class="ui-widget"> <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong>Alert:</strong> Sample ui-state-error style.</p> </div> </div> and trying to jam the css class details into my h:message as best I can: <div class="ui-widget"> <h:messages globalOnly="true" errorClass="ui-state-error ui-corner-all ui-icon-alert" infoClass="ui-state-highlight ui-corner-all ui-icon-info"/> </div> I don't get the icon or sufficient padding etc but the colours make it through. So, the styles are being applied but they aren't working as intended. Any idea how I can make this work?

    Read the article

  • wordpress php > div issue

    - by Philip Bateman
    Thanks in advance for you help Ive been doing this as a lovejob for friends and now im getting quotes of several hundred dollars for minor homepage variation and I'm not sure if its valid. I'm not a programmer myself, just trying hard :) Via the CafePress press75 theme, I'm trying to go from 1 / 2 / 3 column home layout, to 1-2 merged and 3, push the 2nd column data to the right and have the 1st column span as a 16:9 gallery (nextgengallery plugin installed). Is this really a complex thing from a coding perspective? The current guy talking to me is saying its going to cost $700 or 800 AUD to alter, which is rough when the template cost $85.. From this http://shocolate.com.au.previewdns.com/wp-content/uploads/2010/05/shocolatecurrent.jpg to this 'url+Shocolatelooklikethis.jpg' I was able to get the sidebar removed by taking out ‘‘ near the bottom of home.css.. Just can’t get the middle data to flow over it? This would be ideal as a result, as the system puts the latest selected blog post on the homepage, so if we can get rid of the sidebar div and have the text appear where it was, that would be ideal. Removing the sidebar from the bottom of home.php and setting the thumbnail width to say 450 gives me the result im after EXCEPT the text doesn’t fill where the sidebar is, it wraps underneath. Reference 'shocolate.com.au.previewdns.com' for current site Thank you!!! Phil (Melbourne)

    Read the article

  • what is the reason of Invalid Address specified to RtlFreeHeap

    - by carl
    the develop environment is vs2008, the language is c++, when I release the problem,at beginning it run with out problem but after several minutes it stop and show error like that : HEAP[guessModel.exe]: Invalid Address specified to RtlFreeHeap( 003E0000, 7D7C737B ). who can tell me the reason of the error. thank you very much.

    Read the article

  • Is this possible to join tables in doctrine ORM without using relations?

    - by piemesons
    Suppose there are two tables. Table X-- Columns: id x_value Table Y-- Columns: id x_id y_value Now I dont want to define relationship in doctrine classes and i want to retrieve some records using these two tables using a query like this: Select x_value from x, y where y.id="variable_z" and x.id=y.x_id; I m not able to figure out how to write query like this in doctrine orm EDIT: Table structures: Table 1: CREATE TABLE IF NOT EXISTS `image` ( `id` int(11) NOT NULL AUTO_INCREMENT, `random_name` varchar(255) NOT NULL, `user_id` int(11) NOT NULL, `community_id` int(11) NOT NULL, `published` varchar(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=259 ; Table 2: CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `city` varchar(20) DEFAULT NULL, `state` varchar(20) DEFAULT NULL, `school` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ; Query I am using: $q = new Doctrine_RawSql(); $q ->select('{u.*}, {img.*}') ->from('users u LEFT JOIN image img ON u.id = img.user_id') ->addComponent('u', 'Users u') ->addComponent('img', 'u.Image img') ->where("img.community_id='$community_id' AND img.published='y' AND u.state='$state' AND u.city='$city ->orderBy('img.id DESC') ->limit($count+12) ->execute(); Error I am getting: Fatal error: Uncaught exception 'Doctrine_Exception' with message 'Couldn't find class u' in C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php:290 Stack trace: #0 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php(240): Doctrine_Table- >initDefinition() #1 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.php(1127): Doctrine_Table->__construct('u', Object(Doctrine_Connection_Mysql), true) #2 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\RawSql.php(425): Doctrine_Connection- >getTable('u') #3 C:\xampp\htdocs\fanyer\doctrine\models\Image.php(33): Doctrine_RawSql- >addComponent('img', 'u.Image imga') #4 C:\xampp\htdocs\fanyer\community_images.php(31): Image->get_community_images_gallery_filter(4, 0, 'AL', 'ALBERTVILLE') #5 {main} thrown in C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Table.php on line 290

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >