Search Results

Search found 110 results on 5 pages for 'thierry lam'.

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

  • How do I exclude data from local table schema_migrations from being pushed to Heroku DB?

    - by Thierry Lam
    I was able to push my Ruby on Rails app with MySQL(local dev) to the Heroku server along with migrating my model with the command heroku rake db:migrate. I have also read the documentation on Database Import/Export. Is that doc referring to pushing actual data from my local dev DB to whichever Heroku's DB? Do I need to modify anything in the file database.yml to make it happen? I ran the following command: heroku db:push and I am getting the error: Sending data 2 tables, 3 records !!! Caught Server Exception | ETA: --:--:-- Taps Server Error: PGError ERROR: duplicate key value violates unique constraint "unique_schema_migrations" I have 2 tables, one I create for my app and the other schema_migrations. The total number of entries among the 2 tables is 3. I'm also printing the number of entries I have in the table I have created and it's showing 0. Any ideas what I might be missing or what I am doing wrong? EDIT: I figured out the above, Heroku's DB already have schema_migrations the moment I ran migrate. New question: Does anyone know how I can exclude data from a specific table from being pushed to Heroku DB. The table to exclude in this case will be schema_migrations. Not so good solution: I googled around and someone else was having the same issue. He suggested naming the schema_migrations table to zschema_migrations. In this way data from the other tables will be pushed properly until it fails on the last table. It's a pretty bad solution but will do for the time being. A better solution will be to use an existing Rails command which can reset a specific table from a database. I don't think Rake can do that.

    Read the article

  • Web application date time localization best practice at 201x

    - by Hieu Lam
    Hi all, I have worked for various web projects but correct date time localization have not been done and considered throroughly so I want to ask this very typical problem here and I want to hear comments from expert in this problem What is the correct strategy for storing a date/time value from client from server As I understand, because of locale and timezone so we have to do the conversion, I have heard about GMT or UTC time and after do some search it seems that UTC is more accurate ? so we will convert from client time - UTC+0 when saving and when we read the value from server to client, we convert from server time back to client time again ? However, I see in some website, at the bottom have the sentence "All times are in UTC", "All times are in GMT" and also "All times are in your local time". So maybe not all the sites do the convertion back and forth ? And in that case the user has to manually do the date/time conversion ? How to display the date/time convenient to user based on his locale and region How to provide personalization on date/time value ? I had one time depends on vbscript to do the display and the format is read from windows regional and format settings automatically. But without vbscript how can we determine a date/time pattern for a user of a specific locale. Do we have to store a mapping between a locale and pattern somewhere and do the conversion at the server side ? Although date/time conversion is needed in most case, there's situation where only date matter for example if my birthday is 2 Feb 1980, it should be the same for all locale and no conversion should be done. How can we address this issue.

    Read the article

  • WPF Window Top Won't Change.

    - by Kevin Lam
    Hi, I am using animations with my window to slide out or slide back up. But when these animations are not used. I would like to use Window.Top to set the position of the window, but I think due to animations I cannot set the top. I was wondering if anyone knows how to fix this? Thanks example. window.top is already = 33. but when is ay window.top =900; it will stay at 33.

    Read the article

  • How do you store accented characters coming from a web service into a database?

    - by Thierry Lam
    I have the following word that I fetch via a web service: André From Python, the value looks like: "Andr\u00c3\u00a9". The input is then decoded using json.loads: >>> import json >>> json.loads('{"name":"Andr\\u00c3\\u00a9"}') >>> {u'name': u'Andr\xc3\xa9'} When I store the above in a utf8 MySQL database, the data is stored like the following using Django: SomeObject.objects.create(name=u'Andr\xc3\xa9') Querying the name column from a mysql shell or displaying it in a web page gives: André The web page displays in utf8: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> My database is configured in utf8: mysql> SHOW VARIABLES LIKE 'collation%'; +----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_unicode_ci | | collation_server | utf8_unicode_ci | +----------------------+-----------------+ 3 rows in set (0.00 sec) mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) How can I retrieve the word André from a web service, store it properly in a database with no data loss and display it on a web page in its original form?

    Read the article

  • Is Django's manage.py syncdb or South used to create the test database?

    - by Thierry Lam
    With Django 1.1.1 and South 0.62, running a test from the CLI usually have the following output: Creating table some_model Installing index for my_app.SomeModel model . ----- Ran 1 test in 1s OK After upgrading to South 0.7, the output is invoking South's migration: Creating table some_model Installing index for my_app.SomeModel model Migrating... Running migrations for my_app: - Migrating forwards to 0001_initial > my_app:0001_initial - Loading initial data for my_app Migrated: - my_app . ----- Ran 1 test in 1s OK To create the test DB, has the test always used South migration in the past(before South 0.7) even if the output is not explicitly being shown?

    Read the article

  • [Simple] Beginner AJAX script not working, stuck on opening XMLHttpRequest

    - by Julian H. Lam
    Hopefully, this question isn't too juvenile to ask - but here goes: I'm trying to learn AJAX, and I'm stuck on a simple content-fetch. Here is my code: request = getHTTPObject(); function useHttpResponse() { if (request.readyState == 4) { document.getElementById("p").innerHTML = request.responseText; } } function update_p() { request.open("GET",content.html,true); request.onreadystatechange = useHttpResponse; } getHTTPObject is correctly defined, and returns a proper XMLHttpObject. As you probably guessed from the excerpt, the element I am trying to update is id'd "p". It calls the script correctly when a button is clicked, no problem there. The script seems to stop at line 8, at request.open. There's no error, and the script silently ignores anything afterward. I don't think I've missed anything, but of course, I probably did. Where did I go wrong? Thanks!

    Read the article

  • Does Django tests run slower on the mac compared to linux?

    - by Thierry Lam
    I'm currently developing my Django projects on both: Mac OS X 10.5, 32 bit Ubuntu Server 9.10 64 bits (1 CPU, 512MB RAM) Both of the above OS are using: Python 2.6.4 Django 1.1.1 MySQL 5.1 Running 12 tests for one of my application take: Mac: 57.513s Linux: 30.935s EDIT: Mac Hardware Spec: MacBook Pro 2.2 GHz Intel Core 2 Duo 3GB RAM I'm running the Ubuntu OS on the same mac above through VMware Fusion 2.0.6. You might argue that Ubuntu Server 64 bits is faster but I have observed a similar speed difference on Ubuntu 8.10 32 bits desktop edition. Even if I turn off my linux VM and other mac applications, I still experience the slowness. Has anyone else experienced this Django test speed difference across those two OS?

    Read the article

  • How do I construct a Django form with model objects in a Select widget?

    - by Thierry Lam
    Let's say I'm using the Django Site model: class Site(models.Model): name = models.CharField(max_length=50) My Site values are (key, value): 1. Stackoverflow 2. Serverfault 3. Superuser I want to construct a form with an html select widget with the above values: <select> <option value="1">Stackoverflow</option> <option value="2">Serverfault</option> <option value="3">Superuser</option> </select> I'm thinking of starting with the following code but it's incomplete: class SiteForm(forms.Form): site = forms.IntegerField(widget=forms.Select()) Any ideas how I can achieve that with Django form?

    Read the article

  • What's the best way to aggregate the boolean values of a Python dictionary?

    - by Thierry Lam
    For the following Python dictionary: dict = { 'stackoverflow': True, 'superuser': False, 'serverfault': False, 'meta': True, } I want to aggregate the boolean values above into the following boolean expression: dict['stackoverflow'] and dict['superuser'] and dict['serverfault'] and dict['meta'] The above should return me False. I'm using keys with known names above but I want it to work so that there can be an infinite number of unknown key names.

    Read the article

  • How might one detect the first run of a program?

    - by Julian H. Lam
    In my web application, users can download a .tar.gz archive containing the app files. However, because the MySQL database won't have been configured then, the user needs to run the install script located in ./install. I "catch" the user upon first run of the app by checking to see if the ./install directory exists. If so, the index.php page redirects the user to the install script. However, I was wondering if there were a more elegant way to "catch" a user upon first-run of a program. Someone on IRC suggested the web-server create a file .installed upon completion, but because the web server might not have write privileges to the web root directory, I can't rely on that. How would you go about solving this problem, or is my solution workable?

    Read the article

  • How do I collect a bunch of Django abstract models in a QuerySet?

    - by Thierry Lam
    I have the following abstract Django models: class Food(models.Model): name = models.CharField(max_length=100) class Meta: abstract = True In one of my view, I created a bunch of Food model: panino = Food(name='Panino') poutine = Food(name='Poutine') food = [panino, poutine] From the above, I'm not saving the model and storing the Food model in a regular Python list. I want to store the above food models in a QuerySet object. How can I do that without storing any data to the database?

    Read the article

  • What's the non brute force way to filter a Python dictionary?

    - by Thierry Lam
    I can filter the following dictionary like: data = { 1: {'name': 'stackoverflow', 'traffic': 'high'}, 2: {'name': 'serverfault', 'traffic': 'low'}, 3: {'name': 'superuser', 'traffic': 'low'}, 4: {'name': 'mathoverflow', 'traffic': 'low'}, } traffic = 'low' for k, v in data.items(): if v['traffic'] == traffic: print k, v Is there an alternate way to do the above filtering?

    Read the article

  • How do you check the presence of many keys in a Python dictinary?

    - by Thierry Lam
    I have the following dictionary: sites = { 'stackoverflow': 1, 'superuser': 2, 'meta': 3, 'serverfault': 4, 'mathoverflow': 5 } To check if there are more than one key available in the above dictionary, I will do something like: 'stackoverflow' in sites and 'serverfault' in sites The above is maintainable with only 2 key lookups. Is there a better way to handle checking a large number of keys in a very big dictionary?

    Read the article

  • Can jQuery's fadeIn work without AJAX?

    - by Thierry Lam
    I'm submitting a form, sometimes I have some messages that I want to show to the user. I want those messages to jQuery fadeIn after they click on the submit button. Is it possible to achieve that if the submission doesn't involve any AJAX? Here's a sample Django/Python code: # View code message = 'feedback to user' # Template <div id="messages">{{ message }}</div> The equivalent PHP code of the above might be: <?php $message = 'feedback to user'; ?> <div id="messages"><?= $message ?></div> I want #messages above to fade in after a POST. How can I achieve that?

    Read the article

  • How to get final destination URL from AJAX?

    - by Maurice Lam
    When I do an XMLHttpRequest, I always get redirected automatically to the URL (presumably by the headers of the response). For example, if I query "http://www.stackoverflow.com" I will be redirected to "http://stackoverflow.com". How can I get that final URL? (http://stackoverflow.com/ in the example) I checked in the response headers but I cannot seem to find it. (I just used the GET/POST method not HEAD).

    Read the article

  • How can I check for unused import in many Python files?

    - by Thierry Lam
    I remember when I was developing in C++ or Java, the compiler usually complains for unused methods, functions or imports. In my Django project, I have a bunch of Python files which have gone through a number of iterations. Some of those files have a few lines of import statement at the top of the page and some of those imports are not used anymore. Is there a way to locate those unused imports besides eyeballing each one of them in each file? All my imports are explicit, I don't usually write from blah import *

    Read the article

  • SQL code to insert multiple rows in ms-access table

    - by Thierry
    I'm trying to speed up my code and the bottleneck seems to be the individual insert statements to a Jet MDB from outside Access via ODBC. I need to insert 100 rows at a time and have to repeat that many times. It is possible to insert multiple rows in a table with SQL code? Here is some stuff that I tried but neither of them worked. Any suggestions? INSERT INTO tblSimulation (p, cfYear, cfLocation, Delta, Design, SigmaLoc, Sigma, SampleSize, Intercept) VALUES (0, 2, 8.3, 0, 1, 0.5, 0.2, 220, 3.4), (0, 2.4, 7.8, 0, 1, 0.5, 0.2, 220, 3.4), (0, 2.3, 5.9, 0, 1, 0.5, 0.2, 220, 3.4) INSERT INTO tblSimulation (p, cfYear, cfLocation, Delta, Design, SigmaLoc, Sigma, SampleSize, Intercept) VALUES (0, 2, 8.3, 0, 1, 0.5, 0.2, 220, 3.4) UNION (0, 2.4, 7.8, 0, 1, 0.5, 0.2, 220, 3.4) UNION (0, 2.3, 5.9, 0, 1, 0.5, 0.2, 220, 3.4)

    Read the article

  • How can i make a link to update my iPhone application?

    - by thierry
    hi, i know how to make a link to my app on the appstore with this URL itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id= but i don't want the user goes on the software page but directly in the update tab what is the link to do this? is there a link to update the app ?(if an update existing) thanks

    Read the article

  • How to apply CSS theme to only a specific jQuery-UI element?

    - by Thierry-Dimitri Roy
    I have a web site already build with my own CSS theme. I'm using jQuery UI "tabs" widget but no CSS from jQuery-UI. Now, I'm trying to add the "Date Picker" widget in one of my page. It would be great if I could reuse jQuery-UI default theme which is just fine. The problem is that the date picker theme is also applied to my tabs CSS. For example the "ui-widget" css properties is applied to both date picker and tabs elements. I can't seem to find a way to apply the css properties to only the date picker. I can't see a "super selector" that only applies to the date picker DIV. What would be the best way to handle this? [EDIT] The datepicker widget is really the problem. I cannot apply CSS style specific to it. Here is the starting code of the DIV that get pops up: <div style="position: absolute; top: 300.4px; left: 149px; display: block;" id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"><div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all"> As such, I cannot add a super selector. What would be great would be that the date picker widget supports CSS scope. But it does not. I'm stuck manually editing the jQuery CSS file. The Date Picker is currently being refactored. Hopefully the new code will address this issue.

    Read the article

  • Mapping enum to a table with hibernate annotation

    - by Thierry-Dimitri Roy
    I have a table DEAL and a table DEAL_TYPE. I would like to map this code: public class Deal { DealType type; } public enum DealType { BASE("Base"), EXTRA("Extra"); } The problem is that the data already exist in the database. And I'm having a hard time mapping the classes to the database. The database looks something like that: TABLE DEAL { Long id; Long typeId; } TABLE DEAL_TYPE { Long id; String text; } I know I could use a simple @OneToMany relationship from deal to deal type, but I would prefer to use an enum. Is this possible? I almost got it working by using a EnumType.ORDINAL type. But unfortunately, my IDs in my deal type table are not sequential, and do not start at 1. Any suggestions?

    Read the article

  • Maintenance tool for Application Database

    - by Thierry
    Hello ! Does anybody know about a good tool which help maintaining the database of an application ? I'm working on an application which uses a database (Microsoft Sql Server). When a development requires to change something in the database (e.g., structure, data migration...), we create a script (Transact-SQL script) and add it into our revision control tool (subversion - that tool also contains our code). Each script must add a line in a log table to keep a trace of all the scripts that have been ran into a database. In order to build a database for our application, one needs to run all scripts ordered by their creation date. I'm not really happy with this technique notably because it make application migration a bit hard. If we want to install a new version of the application somewhere, e.g., migrate from version 1.3 to 2.1, we must get all the scripts between these two versions. Then run them and ensure that everything is done in a transaction... For sure we could built home-made tools to help but I wonder if some tools already exists to do that kind of job.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >