Search Results

Search found 8354 results on 335 pages for 'welton v3 50'.

Page 61/335 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • flex List Size not updating when itemRenderer resizes itself

    - by duder
    I've got a list with a custom itemRenderer that's just a rectangle of specific size. The list <s:List id="thelist" width="100%" dataProvider="{thelistdata}" itemRenderer="ListItem" borderVisible="true" /> Note the list's border is visible to help with debugging The itemRenderer <s:Rect id="box" width="50" height="50"> <s:fill> <s:SolidColor color="blue"/> </s:fill> </s:Rect> When the itemRenderer receives an event, it changes its size to half box.width = 25; box.height = 25; I see the itemRenderers are resizing themselves correctly, but the list itself stays the same size and the border stays where it is. Anyone knows how to fix this bug. Basically the list should refresh its size too to fit the smaller boxes.

    Read the article

  • Gui problem after rewriting to MVC

    - by trevor_nise
    I'm practicing MVC style programming. I have a Mastermind game in a single file, working with no problems (maybe apart of the fact that "Check" button is invisible at start). http://paste.pocoo.org/show/226726/ But when I've rewritten it to model, view, controller files - when I click on empty Pin (that should be updated, and repainted with new color) - noting happens. Can anybody see any problems here ? I've tried placing repaint() in different places, but it simply does not work at all :/ Main : public class Main { public static void main(String[] args){ Model model = new Model(); View view = new View("Mastermind", 400, 590, model); Controller controller = new Controller(model, view); view.setVisible(true); } } Model : import java.util.Random; public class Model{ static final int LINE = 5, SCORE = 10, OPTIONS = 20; Pin pins[][] = new Pin[21][LINE]; int combination[] = new int[LINE]; int curPin = 0; int turn = 1; Random generator = new Random(); int repaintPin; boolean pinsRepaint=false; int pinsToRepaint; boolean isUpdate = true, isPlaying = true, isRowFull = false; static final int HIT_X[] = {270,290,310,290,310}, HIT_Y[] = {506,496,496,516,516}; public Model(){ for ( int i=0; i < SCORE; i++ ){ for ( int j = 0; j < LINE; j++ ){ pins[i][j] = new Pin(20,0); pins[i][j].setPosition(j*50+30,510-i*50); pins[i+SCORE][j] = new Pin(8,0); pins[i+SCORE][j].setPosition(HIT_X[j],HIT_Y[j]-i*50); } } for ( int i=0; i < LINE; i++ ){ pins[OPTIONS][i] = new Pin( 20, i+2 ); pins[OPTIONS][i].setPosition( 370,i * 50 + 56); } } void fillHole(int color) { pins[turn-1][curPin].setColor(color+1); pinsRepaint = true; pinsToRepaint = turn; curPin = (curPin+1) % LINE; if (curPin == 0){ isRowFull = true; } pinsRepaint = false; pinsToRepaint = 0; } void check() { int junkPins[] = new int[LINE], junkCode[] = new int[LINE]; int pinCount = 0, pico = 0; for ( int i = 0; i < LINE; i++ ) { junkPins[i] = pins[turn-1][i].getColor(); junkCode[i] = combination[i]; } for ( int i = 0; i < LINE; i++ ){ if (junkPins[i]==junkCode[i]) { pins[turn+SCORE][pinCount].setColor(1); pinCount++; pico++; junkPins[i] = 98; junkCode[i] = 99; } } for ( int i = 0; i < LINE; i++ ){ for ( int j = 0; j < LINE; j++ ) if (junkPins[i]==junkCode[j]) { pins[turn+SCORE][pinCount].setColor(2); pinCount++; junkPins[i] = 98; junkCode[j] = 99; j = LINE; } } pinsRepaint = true; pinsToRepaint = turn + SCORE; pinsRepaint = false; pinsToRepaint=0; if ( pico == LINE ){ isPlaying = false; } else if ( turn >= 10 ){ isPlaying = false; } else{ curPin = 0; isRowFull = false; turn++; } } void combination() { for ( int i = 0; i < LINE; i++ ){ combination[i] = generator.nextInt(6) + 1; } } } class Pin{ private int color, X, Y, radius; public Pin(){ X = 0; Y = 0; radius = 0; color = 0; } public Pin( int r,int c ){ X = 0; Y = 0; radius = r; color = c; } public int getX(){ return X; } public int getY(){ return Y; } public int getRadius(){ return radius; } public void setRadius(int r){ radius = r; } public void setPosition( int x,int y ){ this.X = x ; this.Y = y ; } public void setColor( int c ){ color = c; } public int getColor() { return color; } } View: import java.awt.*; import javax.swing.*; public class View extends Frame{ Model model; JButton checkAnswer; private JPanel button; private static final Color COLORS[] = {Color.black, Color.white, Color.red, Color.yellow, Color.green, Color.blue, new Color(7, 254, 250)}; public View(String name, int w, int h, Model m){ model = m; setTitle( name ); setSize( w,h ); setResizable( false ); this.setLayout(new BorderLayout()); button = new JPanel(); button.setSize( new Dimension(400, 100)); button.setVisible(true); checkAnswer = new JButton("Check"); checkAnswer.setSize( new Dimension(200, 30)); button.add( checkAnswer ); this.add( button, BorderLayout.SOUTH); button.setVisible(true); } @Override public void paint( Graphics g ) { g.setColor( new Color(238, 238, 238)); g.fillRect( 0,0,400,590); for ( int i=0; i < model.pins.length; i++ ) { paintPins(model.pins[i][0],g); paintPins(model.pins[i][1],g); paintPins(model.pins[i][2],g); paintPins(model.pins[i][3],g); paintPins(model.pins[i][4],g); } } @Override public void update( Graphics g ) { if ( model.isUpdate ) { paint(g); } else { model.isUpdate = true; paintPins(model.pins[model.repaintPin-1][0],g); paintPins(model.pins[model.repaintPin-1][1],g); paintPins(model.pins[model.repaintPin-1][2],g); paintPins(model.pins[model.repaintPin-1][3],g); paintPins(model.pins[model.repaintPin-1][4],g); } } void repaintPins( int pin ) { model.repaintPin = pin; model.isUpdate = false; repaint(); } public void paintPins(Pin p, Graphics g ){ int X = p.getX(); int Y = p.getY(); int color = p.getColor(); int radius = p.getRadius(); int x = X-radius; int y = Y-radius; if (color > 0){ g.setColor( COLORS[color]); g.fillOval( x,y,2*radius,2*radius ); } else{ g.setColor( new Color(238, 238, 238) ); g.drawOval( x,y,2*radius-1,2*radius-1 ); } g.setColor( Color.black ); g.drawOval( x,y,2*radius,2*radius ); } } Controller: import java.awt.*; import java.awt.event.*; public class Controller implements MouseListener, ActionListener { private Model model; private View view; public Controller(Model m, View v){ model = m; view = v; view.addWindowListener( new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); view.addMouseListener(this); view.checkAnswer.addActionListener(this); model.combination(); } public void actionPerformed( ActionEvent e ) { if(e.getSource() == view.checkAnswer){ if(model.isRowFull){ model.check(); } } } public void mousePressed(MouseEvent e) { Point mouse = new Point(); mouse = e.getPoint(); if (model.isPlaying){ if (mouse.x > 350) { int button = 1 + (int)((mouse.y - 32) / 50); if ((button >= 1) && (button <= 5)){ model.fillHole(button); if(model.pinsRepaint){ view.repaintPins( model.pinsToRepaint ); } } } } } public void mouseClicked(MouseEvent e) {} public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }

    Read the article

  • asp.net Dynamic Data Site own MetaData

    - by loviji
    Hello, I'm searching info about configuring own MetaData in asp.NET Dynamic Site. For example. I have a table in MS Sql Server with structure shown below: CREATE TABLE [dbo].[someTable]( [id] [int] NOT NULL, [pname] [nvarchar](20) NULL, [FullName] [nvarchar](50) NULL, [age] [int] NULL) and I have Ms Sql table, sysTables and sysColumns. sysTables: ID sysTableName TableName TableDescription 1 | someTable |Persons |All Data about Persons in system sysColumns ID TableName sysColumnName ColumnName ColumnDesc ColumnType MUnit 1 |someTable | sometable_pname| Name | Persona Name(ex. John)| nvarchar(20) | null 2 |someTable | sometable_Fullname| Full Name | Persona Name(ex. John Black)| nvarchar(50) | null 3 |someTable | sometable_age| age | Person age| int | null

    Read the article

  • Scale image to completely fill bounding box

    - by Larsenal
    For instance, if I need to fill a bounding box that is 100px wide by 50px tall, the following input images would have the following behavior: 200w x 200h gets scaled down 50% and 25% gets chopped off the top and bottom. 200w x 100h gets scaled down 50% with no cropping. 100w x 200h gets is not scaled, but 75px get chopped off top and bottom. This seems like it'd be a common resizing function, but I haven't been able to track down an example of the algorithm. Will accept answer in any language including pseudo code. A link to a page with the answer is great too!

    Read the article

  • Storing year/make/model in a database?

    - by Mark
    Here's what I'm thinking (excuse the Django format): class VehicleMake(Model): name = CharField(max_length=50) class VehicleModel(Model): make = ForeignKey(VehicleMake) name = CharField(max_length=50) class VehicleYear(Model): model = ForeignKey(VehicleModel) year = PositiveIntegerField() This is going to be used in those contingent drop-down select boxes, which would visually be laid out like [- Year -][- Make -][- Model -]. So, to query the data I need I would first have to select all distinct years from the years table, sorted descending. Then I'd find all the vehicle makes that have produced a model in that year. And then all the models by that make in that year. Is this a good way to do it, or should I re-arrange the foreign keys somehow? Or use a many-to-many table for the years/models so that no year is repeated?

    Read the article

  • Effective methods for reading and writing large files in C

    - by Bertholt Stutley Johnson
    I'm writing an application that deals with very large user-generated input files. The program will copy about 95 percent of the file, effectively duplicating it and switching a few words and values in the copy, and then appending the copy (in chunks) to the original file, such that each block (consisting of between 10 and 50 lines) in the original is followed by the copied and modified block, and then the next original block, and so on. The user-generated input conforms to a certain format, and it is highly unlikely that any line in the original file is longer than 100 characters long. Which would be the better approach? a) To use one file pointer and use variables that hold the current position of how much has been read and where to write to, seeking the file pointer back and forth to read and write; or b) To use multiple file pointers, one for reading and one for writing. I am mostly concerned with the efficiency of the program, as the input files will reach up to 25,000 lines, each about 50 characters long. Thanks!

    Read the article

  • Update JProgressBar from new Thread

    - by Dacto
    How can I update the JProgressBar.setValue(int) from another thread? My secondary goal is do it in the least amount of classes possible. Here is the code I have right now: **Part of the main class....** pp.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent event) { new Thread(new Task(sd.getValue())).start(); } }); public class Task implements Runnable{ int val; public Task(int value){ this.val = value; } @Override public void run() { for (int i=0; i<=value; i++){ //Progressively increment variable i pbar.setValue(i); //Set value pbar.repaint(); //Refresh graphics try{Thread.sleep(50);} //Sleep 50 milliseconds catch (InterruptedException err){} } } } pp is a JButton and starts the new thread when the JButton is clicked. pbar is the JProgressBar object from the Main class. How can I update its value?(progress) The code above in run() cannot see the pbar.

    Read the article

  • How do you make an image opened in colorbox scrollable

    - by nicholas.alipaz
    I would like my images that I open in colorbox to be displayed fullsize with no resizing applied to them and then apply scrollbars to allow for viewing the larger images. Some of my images are quite tall and things get pixelated when resized down. Currently colorbox just resizes my images down to the size of the available height/width. Is there a way to make all images display fullsize with overflow scrollable in colorbox? I am linking directly to an image: <a href="/myimage.png" title="My Image" class="colorbox imagefield imagefield-imagelink imagefield-field_portfolio_screenshot initColorbox-processed cboxElement" rel="gallery-12"> <img src="/thumb/myimage.png" alt="image" title="My Image" class="imagecache imagecache-portfolio_screenshot_thumb" height="50" width="50"> </a>

    Read the article

  • Visual c++ opencv 2.1 contains()

    - by kaushalyjain
    how to check whether a given point is contained in a rectangle using the contains() function in Rect_ construct... Please give me the exact function and its parameters.Like when i type this Point b(2,2); Rect a(10,10,50,50); cout<< Rect_::contains(b); There is a compile error saying 1c:\users\kaushal\documents\visual studio 2008\projects\test1\test1.cpp(23) : error C2352: 'cv::Rect_<Tp::contains' : illegal call of non-static member function 1c:\opencv2.1\include\opencv\cxcore.hpp(385) : see declaration of 'cv::Rect<_Tp::contains'

    Read the article

  • Searching for Nodes with Specific Text using the Prototype Javascript Framework

    - by Alan Storm
    Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains()? If not, what would what be "The Prototype Way" to selector/filter-down a list of elements that contains a particular string. For example, using the following $$('#some_div dd a') I may get back an array of 50 or so links. I only want the links that contain the work 'home'. In jQuery I'd do this jQuery('#some_div dd a:contains('home')'); Is it possible to do something similar using Prototype? If not, is there an elegant way to filter out the array of 50 elements that gets returned.

    Read the article

  • Is this more suited for key value storage or a tree?

    - by JC
    I'm trying to figure out the best way to represent some data. It basically follows the form Manufacturer.Product.Attribute = Value. Something like: Acme.*.MinimumPrice = 100 Acme.ProductA.MinimumPrice = 50 Acme.ProductB.MinimumPrice = 60 Acme.ProductC.DefaultColor = Blue So the minimum price across all Acme products is 100 except in the case of product A and B. I want to store this data in C# and have some function where GetValue("Acme.ProductC.MinimumPrice") returns 100 but GetValue("Acme.ProductA.MinimumPrice") return 50. I'm not sure how to best represent the data. Is there a clean way to code this in C#?

    Read the article

  • Sign Up/Login system for multi-domain/multi-server

    - by David
    I'm thinking about a good solution for implementing a sign up/login system that works across different domains and servers. A working example is Olx (you can register in one domain, and your login will work in the rest of domains). The scenario is that every domain (one per country) has its own database. And there will be 2 servers (for example), each one will have the 50% of the domains (and so the 50% of databases). What would you suggest to start with? Database: MySQL 5.1 Server-side language: PHP 5.3 (I will be using Symfony 1.4, so if someone has some suggestion for this framework, it will be interesting too, although it is optional)

    Read the article

  • Scaling an image in a scroller resizes the scroller when relative dimension are set to the scroller

    - by tit
    Hi, I would like to position relatively a scroller in my application like below. When I scale the image, I resize the scroller... <s:Scroller width="50%" height="50%" > <s:Group> <mx:Image id="img" source="media/paxRomana005_150dpi.jpg" /> </s:Group> </s:Scroller> If I set absolute dimension to the scroller like below, it does not resize (behaviour I want) <s:Scroller width="400" height="400" > <s:Group> <mx:Image id="img" source="media/paxRomana005_150dpi.jpg" /> </s:Group> </s:Scroller> .. but my intention is to position the scroller relatively to other components. Any explanations/solutions? Thanks

    Read the article

  • WPF: Text wrapping not working

    - by Ben
    I've got a grid defined simply: <Grid Margin="0,5,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="50"></ColumnDefinition> <ColumnDefinition Width="48"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> Then I'm trying to bind some content like this: <TextBlock TextWrapping="Wrap" Grid.Column="3" Text="{Binding Text}"> Set up like this, the text won't wrap. It simply expands the column to fit the text. If I set the Width to a fixed amount on the last column, wrapping works as expected. The problem there is that if the user widens the window, the column stays at a fixed size. How can I get the column to size dynamically with the width of the grid, but still wrap the text within it?

    Read the article

  • Null Exception RelativeLayout

    - by theblixguy
    I am trying to remove objects from my relative layout and replace the background with another image but I get a java.lang.NullPointerException on this line: RelativeLayout ths = (RelativeLayout)findViewById(R.layout.activity_main); Below is my code: package com.ssrij.qrmag; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.view.animation.Animation.AnimationListener; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initialize animations Animation a = new TranslateAnimation(1000,0,0,0); Animation a1 = new TranslateAnimation(1000,0,0,0); Animation a2 = new TranslateAnimation(1000,0,0,0); Animation a3 = new TranslateAnimation(1000,0,0,0); // Set animation durations (ms) a.setDuration(1200); a1.setDuration(1400); a2.setDuration(1600); a3.setDuration(1800); // Get a reference to the objects we want to apply the animation to final TextView v = (TextView)findViewById(R.id.textView1); final TextView v1 = (TextView)findViewById(R.id.textView2); final TextView v2 = (TextView)findViewById(R.id.TextView3); final Button v3 = (Button)findViewById(R.id.tap_scan); // Clear existing animations, just in case... v.clearAnimation(); v1.clearAnimation(); v2.clearAnimation(); v3.clearAnimation(); // Start animating v.startAnimation(a); v1.startAnimation(a1); v2.startAnimation(a2); v3.startAnimation(a3); a1.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { v.setVisibility(View.INVISIBLE); v1.setVisibility(View.INVISIBLE); v2.setVisibility(View.INVISIBLE); v3.setVisibility(View.INVISIBLE); RelativeLayout ths = (RelativeLayout)findViewById(R.layout.activity_main); ths.setBackgroundResource(R.drawable.blurbg); } }); } public void ScanQr(View v) { // Open the QR Scan page Intent a = new Intent(MainActivity.this, ScanActivity.class); startActivity(a); } } Is there anything that I am doing wrong?

    Read the article

  • C++ Using a class template argument as a template argument for another type

    - by toefel
    Hey Everyone, I'm having this problem while writing my own HashTable. It all works, but when I try to templatize the thing, it gave me errors. I recreated the problem as follows: THIS CODE WORKS: typedef double Item; class A { public: A() { v.push_back(pair<string, Item>("hey", 5.0)); } void iterate() { for(Iterator iter = v.begin(); iter != v.end(); ++iter) cout << iter->first << ", " << iter->second << endl; } private: vector<pair<string, double> > v; typedef vector< pair<string, double> >::iterator Iterator; }; THIS CODE DOES NOT: template<typename ValueType> class B { public: B(){} void iterate() { for(Iterator iter = v.begin(); iter != v.end(); ++iter) cout << iter->first << ", " << iter->second << endl; } private: vector<pair<string, ValueType> > v; typedef vector< pair<string, ValueType> >::iterator Iterator; }; the error messages: g++ -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ..\main.cpp ..\main.cpp:50: error: type std::vector<std::pair<std::string, ValueType>, std::allocator<std::pair<std::string, ValueType> > >' is not derived from typeB' ..\main.cpp:50: error: ISO C++ forbids declaration of `iterator' with no type ..\main.cpp:50: error: expected `;' before "Iterator" ..\main.cpp: In member function `void B::iterate()': ..\main.cpp:44: error: `Iterator' was not declared in this scope ..\main.cpp:44: error: expected `;' before "iter" ..\main.cpp:44: error: `iter' was not declared in this scope Does anybody know why this is happening? Thanks!

    Read the article

  • Dynamic generated file upload control<using javascript> doesn't post?

    - by udaya
    Hai I am having a form which contains a filetype like this on submit i am calling a script function addRowToTable() { var tbl = document.getElementById('uploadTab'); var lastrow = tbl.rows.length; var iteration = lastrow; var row = tbl.insertRow(lastrow); var cell2 = row.insertCell(0); var e2 = document.createElement('input'); e2.type = 'file'; e2.name = 'ufile[]'; e2.id = 'ufile[]'; e2.size='50'; cell2.appendChild(e2); } This script generates The tr on a button click... In my view generatedsource tool i get the "" like this <tr><td><input size="50" id="ufile[]" name="ufile[]" type="file"></td></tr> when i submit the form i dont get the file name for the generated file type in my view page But i get the file name foe the one that is default What may be the problem?

    Read the article

  • R ggplot barplot; Fill based on two separate variables

    - by user1476968
    A picture says more than a thousand words. As you can see, my fill is based on the variable variable. Within each bar there is however multiple data entities (black borders) since the discrete variable complexity make them unique. What I am trying to find is something that makes each section of the bar more distinguishable than the current look. Preferable would be if it was something like shading. Here's an example (not the same dataset, since the original was imported): dat <- read.table(text = "Complexity Method Sens Spec MMC 1 L Alpha 50 20 10 2 M Alpha 40 30 80 3 H Alpha 10 10 5 4 L Beta 70 50 60 5 M Beta 49 10 80 6 H Beta 90 17 48 7 L Gamma 19 5 93 8 M Gamma 18 39 4 9 H Gamma 10 84 74", sep = "", header=T) library(ggplot2) library(reshape) short.m <- melt(dat) ggplot(short.m, aes(x=Method, y= value/100 , fill=variable)) + geom_bar(stat="identity",position="dodge", colour="black") + coord_flip()

    Read the article

  • "No database selected" even when db clearly selected

    - by Someone
    One of my webpages gets a recurring error: "No database selected", even though the DB is selected. Right about now it's a 50-50 chance whether the page will load just fine, or whether I receive this error. After one or two reloads, the page works again. I am including the exact same connection file on my other pages, and I don't have this problem. What could be the cause of this? I'm using ensim pro for webhosting. TIA.

    Read the article

  • How to impose maxlength on textArea in HTML , Javascript

    - by Rakesh Juyal
    I would like to have some functionality by which if i write <textarea maxlength="50"></textarea> <textarea maxlength="150"></textarea> <textarea maxlength="250"></textarea> it will automatically impose the maxlength on the textArea. If possible please donot provide the solution in JQuery. Note: This can be done if i do something like this: <textarea onkeypress="return imposeMaxLength(event, this, 110);" rows="4" cols="50"> function imposeMaxLength(Event, Object, MaxLen) { return (Object.value.length <= MaxLen)||(Event.keyCode == 8 ||Event.keyCode==46||(Event.keyCode>=35&&Event.keyCode<=40)) } copied from another thread But the point is I don't want to write onKeyPress and onKeyUp every time i declare a textArea.

    Read the article

  • mysql select from multiple table

    - by Loon Yew
    I have 3 tables with values like below tbl_product recID pID price colour 1 BDPLA-0001 1.23 White 2 BDPLA-0002 2.23 Black 3 BDPLA-0003 2.28 Blue tbl_product_size recID pID size stock 1 1 2.0cm 10 2 1 3.0cm 20 3 2 2.5cm 30 4 3 3.6cm 40 5 3 3.8cm 50 tbl_order_details recID pID quantity size 201 BDPLA-0001 5 2.0cm 202 BDPLA-0002 10 2.5cm tbl_product.recID = tbl_product_size.pID tbl_product.pID = tbl_order_details.pID how can i combine the tables and produce result like this pID size stock quantity price BDPLA-0001 2.0cm 10 5 1.23 BDPLA-0001 3.0cm 20 null 1.23 BDPLA-0002 2.5cm 30 10 2.23 BDPLA-0003 3.6cm 40 null 2.28 BDPLA-0003 3.8cm 50 null 2.28

    Read the article

  • Rails Habtm with a field

    - by moshimoshi
    Hello, Is that possible to have a field in a has and belongs to many table? Just like favorite: create_table :messages_users, :id => false, :force => true do |t| t.integer :message_id, :null => false t.integer :user_id, :null => false t.boolean :favorite, :null => false t.timestamps end I saw timestamps works well, thanks to ActiveRecord. But when I try to add favorite into the table and then I try: Message.first.users << User.first Then I get this error message: ActiveRecord::StatementInvalid: SQLite3::SQLException: messages_users.favorite may not be NULL: INSERT INTO "messages_users" ("created_at", "message_id", "updated_at", "user_id") VALUES ('''2010-05-27 06:07 :50.721512''', 1, '''2010-05-27 06:07:50.721512''', 1) I would like to use a habtm, I don't like has_many foo though bar association :) Is that possible? Thanks a lot.

    Read the article

  • Large number of UPDATE queries slowing down page

    - by Bryan Lewis
    I am reading and validating large fixed-width text files (range from 10-50K lines) that are submitted via our ASP.net website (coded in VB.Net). I do an initial scan of the file to check for basic issues (line length, etc). Then I import each row into a MS SQL table. Each DB rows basically consists of a record_ID (Primary, auto-incrementing) and about 50 varchar fields. After the insert is done, I run a validation function on the file that checks each field in each row based on a bunch of criteria (trimmed length, isnumeric, range checks, etc). If it finds an error in any field, it inserts a record into the Errors table, which has an error_ID, the record_ID and an error message. In addition, if the field fails in a particular way, I have to do a "reset" on that field. A reset might consist of blanking the entire field, or simply replacing the value with another value (e.g. replacing the string with a new one that has all illegals chars taken out). I have a 5,000 line test file. The upload, initial check, and import takes about 5-6 seconds. The detailed error check and insert into the Errors table takes about 5-8 seconds (this file has about 1200 errors in it). However, the "resets" part takes about 40-45 seconds for 750 fields that need to be reset. When I comment out the resets function (returning immediately without actually calling the UPDATE stored proc), the process is very fast. With the resets turned on, the pages take 50 seconds to return. My UPDATE stored proc is using some recommended code from http://sommarskog.se/dynamic_sql.html, whereby it uses CASE instead of dynamic SQL: UPDATE dbo.Records SET dbo.Records.file_ID = CASE @field_name WHEN 'file_ID' THEN @field_value ELSE file_ID END, . . (all 50 varchar field CASE statements here) . WHERE dbo.Records.record_ID = @record_ID Is there any way I can help my performance here. Can I somehow group all of these UPDATE calls into a single transaction? Should I be reworking the UPDATE query somehow? Or is it just sheer quantity of 750+ UPDATEs and things are just slow (it's a quad proc server with 8GB ram). Any suggestions appreciated.

    Read the article

  • wxpython: Updating a dict or other appropriate data type from wx.lib.sheet.CSheet object

    - by bvmou
    If I have a notebook with three spreadsheet widgets, what is the best way to have changes to the spreadsheet update a dictionary (or maybe an sqlite file?). Do all wx grid objects come with a built in dictionary related to the SetNumberRows and SetNumberCols? Basically I am looking for guidance on how to work with the user-input data from a spreadsheet widget, as in this example adapted from the tutorial on python.org: class ExSheet(wx.lib.sheet.CSheet): def __init__(self, parent): sheet.CSheet.__init__(self, parent) self.SetLabelBackgroundColour('#CCFF66') self.SetNumberRows(50) self.SetNumberCols(50) class Notebook(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM) self.sheet1 = ExSheet(nb) self.sheet2 = ExSheet(nb) self.sheet3 = ExSheet(nb) nb.AddPage(self.sheet1, "Sheet1") nb.AddPage(self.sheet2, "Sheet2") nb.AddPage(self.sheet3, "Sheet3") self.sheet1.SetFocus() self.StatusBar()

    Read the article

  • PL/SQL bulk collect into associative array with sparse key

    - by Dan
    I want to execute a SQL query inside PL/SQL and populate the results into an associative array, where one of the columns in the SQL becomes the key in the associative array. For example, say I have a table Person with columns PERSON_ID INTEGER PRIMARY KEY PERSON_NAME VARCHAR2(50) ...and values like: PERSON_ID | PERSON_NAME ------------------------ 6 | Alice 15 | Bob 1234 | Carol I want to bulk collect this table into a TABLE OF VARCHAR2(50) INDEX BY INTEGER such that the key 6 in this associative array has the value Alice and so on. Can this be done in PL/SQL? If so, how?

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >