Search Results

Search found 322 results on 13 pages for 'raymond ho'.

Page 7/13 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How to search in this activerecord example?

    - by Horace Ho
    Two models: Invoice :invoice_num string :date datetime . . :disclaimer_num integer (foreign key) Disclaimer :disclaimer_num integer :version integer :body text For each disclaimer there are multiple versions and will be kept in database. This is how I write the search (simplified): scope = Invoice.scoped({ :joins => [:disclaimer] }) scope = scope.scoped :conditions => ["Invoice.invoice_num = ?", "#{params[:num]}"] scope = scope.scoped :conditions => ["Disclaimer.body LIKE ?", "%#{params[:text]}%"] However, the above search will search again all versions of the disclaimer. How can I limit the search to only the last disclaimer (i.e. the version integer is the maximum). Please note: Invoice does not keep the version number. New disclaimers will be added to disclaimer table and keep old versions.

    Read the article

  • What are some lesser known usages of #pragma?

    - by Xavier Ho
    I've never understood the need of #pragma once when #ifndef #define #endif always works. I've seen the usage of #pragma comment to link with other files , but setting up the compiler settings was easier with an IDE. What are some other usages of #pragma that is useful, but not widely known?

    Read the article

  • Excel - referenced values via OleDB from .Net client

    - by ho
    I'm trying to read an Excel file (.xls, I think Excel 2003 compatible) via OleDB, but it fails to get the values for referenced fields. This is my current test code (please note, this is just part of the class): Private m_conn As OleDbConnection Public Sub New(ByVal fileName As String) Dim connString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;", fileName) m_conn = New OleDbConnection(connString) m_conn.Open() End Sub Public Sub GetSheet(ByVal sheet As String) Dim query As String = String.Format("SELECT * FROM [{0}]", sheet) Using cmd As OleDbCommand = m_conn.CreateCommand() cmd.CommandText = query Dim ds As New DataSet() Dim a As New OleDbDataAdapter(cmd) Using rdr As OleDbDataReader = cmd.ExecuteReader() While rdr.Read() Debug.WriteLine(rdr.Item(0).ToString()) End While End Using End Using End Sub But if the value is a reference (something like =+'MySheetName'!K37), I just get a DBNull from the call to rdr.Item(0). I can get around this by automating Excel instead, but would prefer not to have to use Excel automation so wondering if anyone knows how to do it.

    Read the article

  • Large file download for a Rails project

    - by Horace Ho
    One client project will be online two months later. One of the requirements changed is to support large files (10 to 15MB per RAW camera file, expected 1000 to 5000 files download per day) download worldwide for their customers. The process will be: there is upload screen via paperclip to the rails local public folder a hourly task to upload to web storage (S3?) update the download url from paperclip url to the web url Questions: is there a gem/plug-in for this purpose? if no, any gem/plug-in for S3 to recommend? Questions about the storage provider: is S3 recommended? or other service to recommend? The baseline is: the client's web server does not and will not have the bandwidth to handle the downloads. Thanks

    Read the article

  • Offline mode app in a (HTML5) browser possible?

    - by Horace Ho
    Is it possible to build an application inside in browser? An application means: 1 Where there is connection (online mode) between the browser and an remote application server: the application runs in typical web-based mode the application stores necessary data in offline storage, to be used in offline mode (2) the application sync/push data (captured during offline mode) back to the server when it is resumed from offline mode back to online mode 2 Where there is no connection (offline mode) between the browser and an remote application server: the application will still run (javascript?) the application will present data (which is stored offline) to user the application can accept input from user (and store/append in offline storage) Is this possible? If the answer is a yes, is there any (Ruby/Python/PHP) framework being built? Thanks

    Read the article

  • How to detect identical part(s) inside string?

    - by Horace Ho
    I try to break down the http://stackoverflow.com/questions/2711961/decoding-algorithm-wanted question into smaller questions. This is Part I. Question: two strings: s1 and s2 part of s1 is identical to part of s2 space is separator how to extract the identical part(s)? example 1: s1 = "12 November 2010 - 1 visitor" s2 = "6 July 2010 - 100 visitors" the identical parts are "2010", "-", "1" and "visitor" example 2: s1 = "Welcome, John!" s2 = "Welcome, Peter!" the identical parts are "Welcome," and "!" Python and Ruby preferred. Thanks

    Read the article

  • How to check for mip-map availability in OpenGL?

    - by Xavier Ho
    Recently I bumped into a problem where my OpenGL program would not render textures correctly on a 2-year-old Lenovo laptop with an nVidia Quadro 140 card. It runs OpenGL 2.1.2, and GLSL 1.20, but when I turned on mip-mapping, the whole screen is black, with no warnings or errors. This is my texture filter code: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); After 40 minutes of fiddling around, I found out mip-mapping was the problem. Turning it off fixed it: // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); I get a lot of aliasing, but at least the program is visible and runs fine. Finally, two questions: What's the best or standard way to check if mip-mapping is available on a machine, aside from checking OpenGL versions? If mip-mapping is not available, what's the best work-around to avoid aliasing?

    Read the article

  • SQL - Joining multiple records to one record

    - by ho
    I've got a SQL Server database with the the following tables: Client (ClientID, ClientName) SalesAgent (AgentID, AgentName) Item (ItemID, Description) Purchase (PurchaseID, ClientID, Price) PurchaseSalesAgent (PurchaseID, AgentID) Each purchase is only ever one item to one client but there can have been multiple agents involved. I want to return the following list of columns: ClientName, Description, Price, Agents Where Agents is the names of all the agents involved in the purchase. Either as a comma separated list or as multiple columns with one agent in each. I'm looking for a way that's compatible with SQL Server 2000 but I'd also be interested in if there's a better way of doing it in SQL Server 2008.

    Read the article

  • What's best Drupal deployment strategy?

    - by Horace Ho
    I am working on my first Drupal project on XAMPP in my MacBook. It's a prototype and receives positive feedback from my client. I am going to deploy the project on a Linux VPS two weeks later. Is there a better way than 're-do'ing everything on the server from scratch? install Drupal download modules (CCK, Views, Date, Calendar) create the Contents ... Thanks

    Read the article

  • I don't like Python functions that take two or more iterables. Is it a good idea?

    - by Xavier Ho
    This question came from looking at this question on Stackoverflow. def fringe8((px, py), (x1, y1, x2, y2)): Personally, it's been one of my pet peeves to see a function that takes two arguments with fixed-number iterables (like a tuple) or two or more dictionaries (Like in the Shotgun API). It's just hard to use, because of all the verbosity and double-bracketed enclosures. Wouldn't this be better: >>> class Point(object): ... def __init__(self, x, y): ... self.x = x ... self.y = y ... >>> class Rect(object): ... def __init__(self, x1, y1, x2, y2): ... self.x1 = x1 ... self.y1 = y1 ... self.x2 = x2 ... self.y2 = y2 ... >>> def fringe8(point, rect): ... # ... ... >>> >>> point = Point(2, 2) >>> rect = Rect(1, 1, 3, 3) >>> >>> fringe8(point, rect) Is there a situation where taking two or more iterable arguments is justified? Obviously the standard itertools Python library needs that, but I can't see it being pretty in maintainable, flexible code design.

    Read the article

  • What OpenGL functions are not GPU accelerated?

    - by Xavier Ho
    I was shocked when I read this (from the OpenGL wiki): glTranslate, glRotate, glScale Are these hardware accelerated? No, there are no known GPUs that execute this. The driver computes the matrix on the CPU and uploads it to the GPU. All the other matrix operations are done on the CPU as well : glPushMatrix, glPopMatrix, glLoadIdentity, glFrustum, glOrtho. This is the reason why these functions are considered deprecated in GL 3.0. You should have your own math library, build your own matrix, upload your matrix to the shader. For a very, very long time I thought most of the OpenGL functions use the GPU to do computation. I'm not sure if this is a common misconception, but after a while of thinking, this makes sense. Old OpenGL functions (2.x and older) are really not suitable for real-world applications, due to too many state switches. This makes me realise that, possibly, many OpenGL functions do not use the GPU at all. So, the question is: Which OpenGL function calls don't use the GPU? I believe knowing the answer to the above question would help me become a better programmer with OpenGL. Please do share some of your insights.

    Read the article

  • Is 'donation' considered as commerical?

    - by Horace Ho
    I want to port an open source program to iPhone, the license prohibited any commercial use of the code. I emailed the author and he sent back an email saying freeware is ok. Of course I cannot (should not) charge anything on top of the code. Still, I want to get compensation for my work on UI design, graphics and integration work. So I wonder: Is donation (via PayPal) OK for my case? Is in-app purchase OK? i.e. the program is free, the user has the option to buy addition theme graphics? Thanks

    Read the article

  • Neat way of calling InvokeRequired and Invoke

    - by ho
    I seem to remember seeing some neat way of calling InvokeRequired and Invoke to avoid repeating too much code in every event handler but I can't remember what that was. So does anyone know a neat way of writing that code? Preferably for VB.Net 2005.

    Read the article

  • SQL-wrappers (activerecord) to recommened for python?

    - by Horace Ho
    is there an activerecord (any similar SQL-wrapper) for python? which is good for: used in a server-side python script light-weight supports MySQL what I need to do: insert (filename, file size, file md5, the file itself) into (string, int, string, BLOB) columns if the same file (checksum + filename) does not exist in db thx

    Read the article

  • Which OpenGL functions are not GPU-accelerated?

    - by Xavier Ho
    I was shocked when I read this (from the OpenGL wiki): glTranslate, glRotate, glScale Are these hardware accelerated? No, there are no known GPUs that execute this. The driver computes the matrix on the CPU and uploads it to the GPU. All the other matrix operations are done on the CPU as well : glPushMatrix, glPopMatrix, glLoadIdentity, glFrustum, glOrtho. This is the reason why these functions are considered deprecated in GL 3.0. You should have your own math library, build your own matrix, upload your matrix to the shader. For a very, very long time I thought most of the OpenGL functions use the GPU to do computation. I'm not sure if this is a common misconception, but after a while of thinking, this makes sense. Old OpenGL functions (2.x and older) are really not suitable for real-world applications, due to too many state switches. This makes me realise that, possibly, many OpenGL functions do not use the GPU at all. So, the question is: Which OpenGL function calls don't use the GPU? I believe knowing the answer to the above question would help me become a better programmer with OpenGL. Please do share some of your insights.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13  | Next Page >