Search Results

Search found 493 results on 20 pages for 'jimmy yuen ho wong'.

Page 11/20 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • 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

  • 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

  • What do you call this functional language feature?

    - by Jimmy
    ok, embarrassing enough, I posted code that I need explained. Specifically, it first chains absolute value and subtraction together, then tacks on a sort, all the while not having to mention parameters and arguments at all, because of the presense of "adverbs" that can join these functions "verbs" What (non-APL-type) languages support this kind of no-arguments function composition (I have the vague idea it ties in strongly to the concepts of monad/dyad and rank, but its hard to get a particularly easy-to-understand picture just from reading Wikipedia) and what do I call this concept?

    Read the article

  • JS / JQuery character problem

    - by Jimmy Farax
    I have a code which has a character that JS is not handling properly. $(document).ready(function(){ $.getJSON("http://sjama.tumblr.com/api/read/json?callback=?", function (data){ for (var i=0; i<data.posts.length; i++){ var blog = data.posts[i]; var id = blog.id; var type = blog.type; var photo = blog.photo-url-250; if (type == "photo"){ $("#blog_holder").append('<div class="blog_item_holder"><div class="blog_item_top"><img src='+photo+'/></div><div class="blog_item_bottom">caption will go here</div></div>'); } } }); <!-- end $.getJSON }); The problem is with this line: var photo = blog.photo-url-250; after "blog." it reads the "url" part weirdly because of the dash (-) in between. What can I do to sort this problem out?

    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

  • 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

  • Nested mysql select statements

    - by Jimmy Kamau
    I have a query as below: $sult = mysql_query("select * from stories where `categ` = 'businessnews' and `stryid`='".mysql_query("SELECT * FROM comments WHERE `comto`='".mysql_query("select * from stories where `categ` ='businessnews'")." ORDER BY COUNT(comto) DESC")."' LIMIT 3") or die(mysql_error()); while($ow=mysql_fetch_array($sult)){ The code above should return the top 3 'stories' with the most comments {count(comto)}. The comments are stored in a different table from the stories. The code above does not return any values and doesn't show any errors. Could someone please help?

    Read the article

  • How to store result of drag and drop as a image

    - by Jimmy
    I want to take the screenshot of the result of drag and drop, but I don't know how to do. Actually, I found 2 javascript and using HTML5 such as html2canvas and canvas2image. I am now combining them together, but it's still meet some problem with the canvas2image. Please help me solve this problem if you have same experience, thank you a lot. Please help me, I've been stock here for days. Drag and drop code. <script> $(function() { $( "#draggable" ).draggable(); $( "#draggable2" ).draggable(); $( "#droppable" ).droppable({ hoverClass: "ui-state-active", drop: function( event, ui ) { $( this ) .addClass( "ui-state-highlight" ) .find( "p" ) .html( "Dropped!" ); } }); }); </script> Image generation code <script> window.onload = function() { function convertCanvas(strType) { if (strType == "JPEG") var oImg = Canvas2Image.saveAsJPEG(oCanvas, true); if (!oImg) { alert("Sorry, this browser is not capable of saving " + strType + " files!"); return false; } oImg.id = "canvasimage"; oImg.style.border = oCanvas.style.border; oCanvas.parentNode.replaceChild(oImg, oCanvas); } function convertHtml(strType) { $('body').html2canvas(); var queue = html2canvas.Parse(); var canvas = html2canvas.Renderer(queue,{elements:{length:1}}); var img = canvas.toDataURL(); convertCanvas(strType); window.open(img); } document.getElementById("html2canvasbtn").onclick = function() { convertHtml("JPEG"); } } </script> HTML code <body> <h3>Picture:</h3> <div id="draggable"> <img src='http://1.gravatar.com/avatar/1ea64135b09e00ab80fa7596fafbd340? s=50&d=identicon&r=R'> </div> <div id="draggable2"> <img src='http://0.gravatar.com/avatar/2647a7d4b4a7052d66d524701432273b?s=50&d=identicon&r=G'> </div> <div id="dCanvas"> <canvas id="droppable" width="500" height="500" style="border: 2px solid gray" class="ui-widget-header" /> </div> <input type="button" id="bGenImage" value="Generate Image" /> <div id="dOutput"></div> </body>

    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

  • Reading a line backwards

    - by Jimmy
    Hi, I'm using regular expression to count the total spaces in a line (first occurrence). match(/^\s*/)[0].length; However this reads it from the start to end, How can I read it from end to start. Thanks

    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

  • T-SQL generated from LINQ to SQL is missing a where clause

    - by Jimmy W
    I have extended some functionality to a DataContext object (called "CodeLookupAccessDataContext") such that the object exposes some methods to return results of LINQ to SQL queries. Here are the methods I have defined: public List<CompositeSIDMap> lookupCompositeSIDMap(int regionId, int marketId) { var sidGroupId = CompositeSIDGroupMaps.Where(x => x.RegionID.Equals(regionId) && x.MarketID.Equals(marketId)) .Select(x => x.CompositeSIDGroup); IEnumerator<int> sidGroupIdEnum = sidGroupId.GetEnumerator(); if (sidGroupIdEnum.MoveNext()) return lookupCodeInfo<CompositeSIDMap, CompositeSIDMap>(x => x.CompositeSIDGroup.Equals(sidGroupIdEnum.Current), x => x); else return null; } private List<TResult> lookupCodeInfo<T, TResult>(Func<T, bool> compLambda, Func<T, TResult> selectLambda) where T : class { System.Data.Linq.Table<T> dataTable = this.GetTable<T>(); var codeQueryResult = dataTable.Where(compLambda) .Select(selectLambda); List<TResult> codeList = new List<TResult>(); foreach (TResult row in codeQueryResult) codeList.Add(row); return codeList; } CompositeSIDGroupMap and CompositeSIDMap are both tables in our database that are represented as objects in my DataContext object. I wrote the following code to call these methods and display the T-SQL generated after calling these methods: using (CodeLookupAccessDataContext codeLookup = new CodeLookupAccessDataContext()) { codeLookup.Log = Console.Out; List<CompositeSIDMap> compList = codeLookup.lookupCompositeSIDMap(5, 3); } I got the following results in my log after invoking this code: SELECT [t0].[CompositeSIDGroup] FROM [dbo].[CompositeSIDGroupMap] AS [t0] WHERE ([t0].[RegionID] = @p0) AND ([t0].[MarketID] = @p1) -- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [5] -- @p1: Input Int (Size = 0; Prec = 0; Scale = 0) [3] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 SELECT [t0].[PK_CSM], [t0].[CompositeSIDGroup], [t0].[InputSID], [t0].[TargetSID], [t0].[StartOffset], [t0].[EndOffset], [t0].[Scale] FROM [dbo].[CompositeSIDMap] AS [t0] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 The first T-SQL statement contains a where clause as specified and returns one column as expected. However, the second statement is missing a where clause and returns all columns, even though I did specify which rows I wanted to view and which columns were of interest. Why is the second T-SQL statement generated the way it is, and what should I do to ensure that I filter out the data according to specifications via the T-SQL? Also note that I would prefer to keep lookupCodeInfo() and especially am interested in keeping it enabled to accept lambda functions for specifying which rows/columns to return.

    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

  • Ruby on Rails when create method fails, render loses local variables

    - by Jimmy
    Hey guys I have a simple create method with some validations and whenever the create method fails due to validation errors it re-renders the 'new' action. The problem is in my new action/view I have a local variable that is established in the action and passed to a partial to render some related information to what the user is creating. Now when my create action fails and I try to re-render the 'new' action I'm getting the always awesome undefined method `cover' for nil:NilClass error. What is the best way to handle re-establishing my action's local variables on a render instead of redirecting to the action again and the user losing the data they input?

    Read the article

  • How to run lengthy tasks from an ASP.NET page?

    - by Jimmy C
    I've got an ASP.NET page with a simple form. The user fills out the form with some details, uploads a document, and some processing of the file then needs to happens on the server side. My question is - what's the best approach to handling the server side processing of the files? The processing involves calling an exe. Should I use seperate threads for this? Ideally I want the user to submit the form without the web page just hanging there while the processing takes place. I've tried this code but my task never runs on the server: Action<object> action = (object obj) => { // Create a .xdu file for this job string xduFile = launcher.CreateSingleJobBatchFile(LanguagePair, SourceFileLocation); // Launch the job launcher.ProcessJob(xduFile); }; Task job = new Task(action, "test"); job.Start(); Any suggestions are appreciated.

    Read the article

  • Rails: Routing to a different controller based on request format

    - by Jimmy Cuadra
    I'm writing an app where I want all requests for HTML to be handled by the same controller action. I have some other routes that are JSON-specific. Here's what my routes look like: Blog::Application.routes.draw do constraints format: :json do resources :posts end match "(*path)" => "web#index" end The problem is that constraints is being interpreted as "this route only works with the specified format" rather than "skip this route and try the next one if the request is not in the specified format." In other words, navigating to /posts in the browser gives me a 406 Not Acceptable because the URL is constrained to the JSON format. Instead, I want it to fall through to web#index if the request is for HTML, and hit the resourceful route if the request is for JSON. How can this be achieved? (Using Rails 3.2.9.)

    Read the article

  • SQL query - choosing 'last updated' record in a group, better db design?

    - by Jimmy
    Hi, Let's say I have a MySQL database with 3 tables: table 1: Persons, with 1 column ID (int) table 2: Newsletters, with 1 column ID (int) table 3: Subscriptions, with columns Person_ID (int), Newsletter_ID (int), Subscribed (bool), Updated (Datetime) Subscriptions.Person_ID points to a Person, and Subscription.Newsletter_ID points to a Newsletter. Thus, each person may have 0 or more subscriptions to 0 or more magazines at once. The table Subscriptions will also store the entire history of each person's subscriptions to each newsletter. If a particular Person_ID-Newsletter_ID pair doesn't have a row in the Subscriptions table, then it's equivalent to that pair having a subscription status of 'false'. Here is a sample dataset Persons ID 1 2 3 Newsletters ID 4 5 6 Subscriptions Person_ID Newsletter_ID Subscribed Updated 2 4 true 2010-05-01 3 4 true 2010-05-01 3 5 true 2010-05-10 3 4 false 2010-05-15 Thus, as of 2010-05-16, Person 1 has no subscription, Person 2 has a subscription to Newsletter 4, and Person 3 has a subscription to Newsletter 5. Person 3 had a subscription to Newsletter 4 for a while, but not anymore. I'm trying to do 2 kinds of query. A query that shows everyone's active subscriptions as of query time (we can assume that updated will never be in the future -- thus, this means returning the record with the latest 'updated' value for each Person_ID-Newsletter_ID pair, as long as Subscribed is true (if the latest record for a Person_ID-Newsletter_ID pair has a Subscribed status of false, then I don't want that record returned)). A query that returns all active subscriptions for a specific newsletter - same qualification as in 1. regarding records with 'false' in the Subscribed column. I don't use SQL/databases often enough to tell if this design is good, or if the SQL queries needed would be slow on a database with, say, 1M records in the Subscriptions table. I was using the Visual query builder tool in Visual Studio 2010 but I can't even get the query to return the latest updated record for each Person_ID-Newsletter_ID pair. Is it possible to come up with SQL queries that don't involve using subqueries (presumably because they would become too slow with a larger data set)? If not, would it be a better design to have a separate Subscriptions_History table, and every time a subscription status for a Person_ID-Newsletter-ID pair is added to Subscriptions, any existing record for that pair is moved to Subscriptions_History (that way the Subscriptions table only ever contains the latest status update for any Person_ID-Newsletter_ID pair)? I'm using .net on Windows, so would it be easier (or the same, or harder) to do this kind of queries using Linq? Entity Framework? Thanks!

    Read the article

  • On C++ global operator new: why it can be replaced

    - by Jimmy
    I wrote a small program in VS2005 to test whether C++ global operator new can be overloaded. It can. #include "stdafx.h" #include "iostream" #include "iomanip" #include "string" #include "new" using namespace std; class C { public: C() { cout<<"CTOR"<<endl; } }; void * operator new(size_t size) { cout<<"my overload of global plain old new"<<endl; // try to allocate size bytes void *p = malloc(size); return (p); } int main() { C* pc1 = new C; cin.get(); return 0; } In the above, my definition of operator new is called. If I remove that function from the code, then operator new in C:\Program Files (x86)\Microsoft Visual Studio 8\VC\crt\src\new.cpp gets called. All is good. However, in my opinion, my implementations of operator new does NOT overload the new in new.cpp, it CONFLICTS with it and violates the one-definition rule. Why doesn't the compiler complain about it? Or does the standard say since operator new is so special, one-definition rule does not apply here? Thanks.

    Read the article

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