Search Results

Search found 1323 results on 53 pages for 'eric ness'.

Page 38/53 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Assign multiple css classes to a table element in Rails

    - by Eric K
    I'm trying to style a table row using both cycle and a helper, like shown: <tr class= <%= cycle("list-line-odd #{row_class(item)}", "list-line-even #{row_class(item)}")%> > However, when I do this, the resulting HTML is: <tr class = "list-line-odd" lowest-price> with the return from the helper method not enclosed in the quotes, and therefore not recognized. Here's the helper I'm using: def row_class(item) if item.highest_price > 0 and item.lowest_price > 0 and item.highest_price != item.lowest_price if item.current_price >= item.highest_price "highest-price" elsif item.current_price <= item.lowest_price "lowest-price" end end end I must be missing something obvious, but I just can't figure out how to wrap both the result of cycle and the helper method return in the same set of quotes. Any help would be greatly appreciated!

    Read the article

  • MySQL : delete from table that is used in the where clause

    - by Eric
    I am writing a small script to synchronize 2 MySQL tables ( t1 to be 'mirrored' to t2 ) In a step I would like to delete rows inside t2 that has been delete in t1 with the same id. I tried this query : delete from t2 where t2.id in ( select t2.id left join t1 on (t1.id=t2.id) where t1.id is null ) But Mysql forbid me to use t2 in the same time in the delete and in the select (sound logical by the way) Of course, I can split the query into 2 queries : first select IDs, then delete rows with these IDs. My question : do you have a cleaner way to delete row from t2 that does not exist anymore in t1 ? with one query only ?

    Read the article

  • How can I catch a change event from an HTML text field when a user clicks on a link after editing?

    - by Eric the Red
    Our webapp has a form with fields and values that change depending on values entered. Each time there is a change event on one of the form elements, we use an expensive AJAX call to update other elements on the page. This works great for selects, radio buttons and checkboxes. The issue comes in when a user adds content to a text field, and then clicks a link without taking the focus from the text field. The browser moves to a new page, and the contents of the text field are never saved. Is there an easy way to code around this? The AJAX call is too expensive to call with each key press. Here's an example of my Prototype code at the moment: $$('.productOption input.text').invoke('observe', 'change', saveChangeEvent);

    Read the article

  • Does JavaScript have an equivalent to Perl's DESTROY method?

    - by Eric Strom
    Is there any method that is called or event that is dispatched right before an Element is cleaned up by the JavaScript garbage collector? In Perl I would write: package MyObj; sub new {bless {}} sub DESTROY {print "cleaning up @_\n"} and then later: { my $obj = MyObj->new; # do something with obj } # scope ends, and assuming there are no external references to $obj, # the DESTROY method will be called before the object's memory is freed My target platform is Firefox (and I have no need to support other browsers), so if there is only a Firefox specific way of doing this, that is fine. And a little background: I am writing the Perl module XUL::Gui which serves as a bridge between Perl and Firefox, and I am currently working on plugging a few memory leaks related to DOM Elements sticking around forever, even after they are gone and no more references remain on the Perl side. So I am looking for ways to either figure out when JavaScript Elements will be destroyed, or a way to force JavaScript to cleanup an object.

    Read the article

  • Adding fields until screen is full

    - by Eric
    For the sake of this question, let us suppose that I want a row of buttons. I want to put as many buttons in that row as I can fit on the screen, but no more. In other words, as long as a prospective button will not be cut off or have its text shortened, add it. It seems that I should be able to do something like: HorizontalFieldManager hfm = new HorizontalFieldManager(); int remainingWidth = Display.getWidth(); int i =0; while(true) { ButtonField bf = new ButtonField("B " + i); remainingWidth -= bf.getWidth(); if(remainingWidth<0) break; hfm.add(bf); i++; } add(hfm); But this doesn't work. bf.getWidth() is always 0. I suspect that this is because the button has not yet been laid out when I query for the width. So, perhaps I could just make sure the buttons are always the same size. But this won't work for a few reasons: Different BB platforms have different looks for buttons and text that will fit on a button on a Curve won't fit on a button on a Storm. 3rd party themes may change the look of buttons, so I can't even count on buttons being a certain size on a certain platform. Is there no way for me to actually check the remaining space before adding a button? It feels like a fairly useful feature; am I just missing something?

    Read the article

  • SVN export just the changed files from tags

    - by Eric
    Does anyone know how to export only the changed files from two tags using svn? Lets say I have tag 1.0 and then later fix bugs in the trunk. Next I am ready for a new patch release so I tag it 1.1. Now I want to export the changed files between tag 1.0 and 1.1. Is this possible?

    Read the article

  • Cannot get MEDIA_URL from Django widget's template

    - by Eric
    Hi folks, I am a new Djangoer, and figuring out how to build custom widget, my problem is cannot get the MEDIA_URL in my widget's template, while the form use MySelectWidget able to get the MEDIA_URL itself. # #plus_sign.html # <a href="" class="" id="id_{{ field }}"> <img src="{{ MEDIA_URL }}images/plus_sign.gif" width="10" height="10" alt="Add"/> </a> *^ cannot load the {{ MEDIA_URL}} to this widget's template, and therefore I can't load the .gif image properly. :(* # #custom_widgets.py # from django import forms class MySelectMultiple(forms.SelectMultiple): def render(self, name, *args, **kwargs): html = super(MySelectMultiple, self).render(name, *args, **kwargs) plus = render_to_string("plus_sign.html", {'field': name}) return html+plus # #forms.py # from django import forms from myapp.custom_widgets.py import MySelectMultiple class MyForm(forms.ModelForm): contacts = forms.ModelMultipleChoiceField(Contact.objects, required=False, widget=MySelectMultiple) # #views.py # def AddContacts(request): if request.method == 'POST': form = MyForm(request.POST) if form.is_valid(): cd = form.cleaned_data new = form.save() return HttpResponseRedirect('/addedContact/') else: form = MyForm() return render_to_response('shop/my_form.html', {'form': form}, context_instance=RequestContext(request)) # #my_form.html # {% extends "base.html" %} {% block content %} {{ form.contacts }} {% endblock %} Please let me know how can I load the widget's image properly. Thank you so much for all responses.

    Read the article

  • AppEngine GeoPt Data Upload

    - by Eric Landry
    I'm writing a GAE app in Java and only using Python for the data upload. I'm trying to import a CSV file that looks like this: POSTAL_CODE_ID,PostalCode,City,Province,ProvinceCode,CityType,Latitude,Longitude 1,A0E2Z0,Monkstown,Newfoundland,NL,D,47.150300000000001,-55.299500000000002 I was able to import this file in my datastore if I import Latitude and Longitude as floats, but I'm having trouble figuring out how to import lat and lng as a GeoPt. Here is my loader.py file: import datetime from google.appengine.ext import db from google.appengine.tools import bulkloader class PostalCode(db.Model): id = db.IntegerProperty() postal_code = db.PostalAddressProperty() city = db.StringProperty() province = db.StringProperty() province_code = db.StringProperty() city_type = db.StringProperty() lat = db.FloatProperty() lng = db.FloatProperty() class PostalCodeLoader(bulkloader.Loader): def __init__(self): bulkloader.Loader.__init__(self, 'PostalCode', [('id', int), ('postal_code', str), ('city', str), ('province', str), ('province_code', str), ('city_type', str), ('lat', float), ('lng', float) ]) loaders = [PostalCodeLoader] I think that the two db.FloatProperty() lines should be replaced with a db.GeoPtProperty(), but that's where my trail ends. I'm very new to Python so any help would be greatly appreciated.

    Read the article

  • Character encoding issues in MySQL

    - by Eric
    In my database we have fields where the data is not readable. I now know why it happened but I don't know how to fix it. I found a way to get the info back from the database: SELECT id, name FROM projects WHERE LENGTH(name) != CHAR_LENGTH(name); One of the rows returned shows: id | name ------------------------- 1008 | Cajón el Diablo This should be: id | name ------------------------- 1008 | Cajón el Diablo Can somebody help me figure out how to fix this problem? How can I convert this using SQL? Is SQL not good? If not, how about Python?

    Read the article

  • On Linux, how do I run a GUI app from a terminal shell under a different login?

    - by Eric
    Here's the deal. I logged into a Linux box (CentOS, but that shouldn't matter) as user A. I had to build a program as user B, so I started up a terminal shell, logged into that shell as B, and built it. When I try to run the app, I get this message: "connect to ":0.0" refused by server" Most likely because the current X Windows session is owned by user A, and as B, I don't have permissions to access A's stuff. Is there a correct way to solve this. Any incorrect ways?

    Read the article

  • How can I modify the value of a string defined in a struct?

    - by Eric
    Hi, I have the following code in c++: #define TAM 4000 #define NUMPAGS 512 struct pagina { bitset<12> direccion; char operacion; char permiso; string *dato; int numero; }; void crearPagina(pagina* pag[], int pos, int dir) { pagina * paginas = (pagina*)malloc(sizeof(char) * TAM); paginas -> direccion = bitset<12> (dir); paginas -> operacion = 'n'; paginas -> permiso = 'n'; string **tempDato = &paginas -> dato; char *temp = " "; **tempDato = temp; paginas -> numero = 0; pag[pos] = paginas; } I want to modify the value of the variable called "string *dato" in the struct pagina but, everytime I want to assing a new value, the compiler throws a segmentation fault. In this case I'm using a pointer to string, but I have also tried with a string. In a few words I want to do the following: pagina - dato = "test"; Any idea? Thanks in advance!!!

    Read the article

  • Many users, many cpus, no delays. Good for cloud?

    - by Eric
    I wish to set up a CPU-intensive time-important query service for users on the internet. A usage scenario is described below. Is cloud computing the right way to go for such an implementation? If so, what cloud vendor(s) cater to this type of application? I ask specifically, in terms of: 1) pricing 2) latency resulting from: - slow CPUs, instance creations, JIT compiles, etc.. - internal management and communication of processes inside the cloud (e.g. a queuing process and a calculation process) - communication between cloud and end user 3) ease of deployment A usage scenario I am expecting is: - A typical user sends a query (XML of size around 1K) once every 30 seconds on average. - Each query requires a numerical computation of average time 0.2 sec and max time 1 sec on a 1 GHz Pentium. The computation requires no data other than the query itself and is performed by the same piece of code each time. - The delay a user experiences between sending a query and receiving a response should be on average no more than 2 seconds and in general no more than 5 seconds. - A background save to a DB of the response should occur (not time critical) - There can be up to 30000 simultaneous users - i.e., on average 1000 queries a second, each requiring an average 0.2 sec calculation, so that would necessitate around 200 CPUs. Currently I'm look at GAE Java (for quicker deployment and less IT hassle) and EC2 (Speed and price optimization) as options. Where can I learn more about the right way to set ups such a system? past threads, different blogs, books, etc.. BTW, if my terminology is wrong or confusing, please let me know. I'd greatly appreciate any help.

    Read the article

  • FreeText Query is slow - includes TOP and Order By

    - by Eric P
    The Product table has 700K records in it. The query: SELECT TOP 1 ID, Name FROM Product WHERE contains(Name, '"White Dress"') ORDER BY DateMadeNew desc takes about 1 minute to run. There is an non-clustered index on DateMadeNew and FreeText index on Name. If I remove TOP 1 or Order By - it takes less then 1 second to run. Here is the link to execution plan. http://screencast.com/t/ZDczMzg5N Looks like FullTextMatch has over 400K executions. Why is this happening? How can it be made faster?

    Read the article

  • Libraries for making a voice chat application

    - by Eric
    My development team is going to build a voice chat application. Our plan is to use a pre-made library just for this purpose, but we haven't found any good one after days of searching the internet, so I thought I would consider a question here! So the question is: What library / project do you recommend? We are deadly serious with this, so it needs to be a good working one. Preferable an open-source one as well. We have been looking at some XMPP libraries and projects, but none seems to be up-to-date, tested and well-documented.

    Read the article

  • Why are my JavaScript variables not persisting across functions?

    - by Eric Belair
    I have the following JavaScript in my HTML page referencing an HTML form on the page: <script type="text/javascript"> <!-- var myForm = document.myForm; function validateForm() { if (myForm.myInput == "") alert("Please input some text."); return false; } myForm.submit(); } function showFormInput() { myForm.reset(); document.getElementById('myInput').style.display = 'inline'; } //--> </script> ... <form name="myForm" id="myForm" action="..." method="post"> <input id="myInput" name="myInput" type="text" value="" style="display:none;" /> </form> Both functions are throwing an exception when trying to access the variable myForm, saying that "myForm is null or not an object". Why is this occurring?

    Read the article

  • SASS color array

    - by Eric Holmes
    I am trying to write a loop that will cycle through colors and condense the amount of code in my scss file. Here is a simple example of what I have: $color1: blue; $color2: red; $color3: white; $color4: black; .color1-bg { background-color: $color1; } .color2-bg { background-color: $color2; } .color1-border { border-color: $color1; } .color2-border { border-color: $color2; } And so on. I am looking for a way to make the equivalent of a foreach loop, and cycle through an 'array' of colours by index. Something like this: @each $color in $color1, $color2, $color3, $color4 { .{$color}-bg { background-color: $color; .{$color}-border { border-color: $color; } I know the syntax is wrong, but that is my thinking process. Thanks for the help!

    Read the article

  • How to define schema for an ActiveRecord model?

    - by Eric Stanton
    I can find how to define columns only when doing migrations. However i do not need to migrate my model. I want to work with it "virtually". Does AR read columns data only from db? Any way to define columns like in DataMapper? class Post include DataMapper::Resource property :id, Serial property :title, String property :published, Boolean end Now i can play with my model without migrations/connections.

    Read the article

  • .click() callback references local variable from the calling method instead of copying by value

    - by Eric Freese
    The following jQuery Javascript code is included on an otherwise empty page. $(function() { for (var i = 0; i < 10; i++) { element = $('<div>' + i + '</div>'); element.click(function() { alert(i); }); $('body').append(element); } }); The desired behavior is that this code should generate 10 div elements numbered from 0 to 9. When you click on a div element, an alert popup will show the number of the div element you clicked on (i.e. if a user clicks on the div element labeled '4', the alert popup should show the number 4). The alert popup instead shows the number 10 regardless of which div element is clicked on. How can I modify this code to make it behave in the desired way?

    Read the article

  • Working with the IE cache from C# & WPF

    - by Eric
    I'm writing a program in C# using the WPF framework. I need to display images, and I'd like to cache them to avoid downloading them constantly. I can code my own cache, however, IE already has a caching system. I can find code to read entries out of the IE cache, however I've found nothing dealing with the issue of adding items to the cache. Is there a good way to do it, or should I just implement a separate cache?

    Read the article

  • how to protect an imported win32 dll into a .net application from memory issues

    - by Eric
    I have a c# application that needs to use a legacy win32 dll. The dll is almost its own app, it has dialogs, operations with hardware, etc. When this dll is imported and used, there are a couple of problems that occur: Dragging a dialog (not a windows system dialog, but one created by the dll) across the managed code app causes the UI to not repaint. Further it generates a system out of memory exception from various ui controls. The performance is incredibly slow. There seems to be no way to unload the dll so the memory never gets cleaned up. When we close our managed app, we get another memory exception. At the moment we import each method call as such: [DllImport("dllname.dll", EntryPoint = "MethodName", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >