Search Results

Search found 243 results on 10 pages for 'ted wong'.

Page 6/10 | < Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >

  • Just for fun (C# and C++)...time yourself [closed]

    - by Ted
    Possible Duplicate: What is your solution to the FizzBuzz problem? OK guys this is just for fun, no flamming allowed ! I was reading the following http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html and couldn't believe the following sentence... " I've also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution." For those that can't be bothered to read the article, the background is this: ....I set out to develop questions that can identify this kind of developer and came up with a class of questions I call "FizzBuzz Questions" named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following: Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". SO I decided to test myself. I took 5 minutes in C++ and 3mins in c#! So just for fun try it and post your timings + language used! P.S NO UNIT TESTS REQUIRED, NO OUTSOURCING ALLOWED, SWITCH OFF RESHARPER! :-) P.S. If you'd like to post your source then feel free

    Read the article

  • JSTree select_node event and checkbox

    - by Ted Mosbey
    Hi there! I have a jstree in which I used the select_node event to toggle nodes(expand), and have therefore removed the toggle arrows in the tree since they look ugly and I've no need for them. Now I've added the checkbox plugin to use within the tree, but have found the select_node event is disabled when the plugin is active. How would I toggle my nodes with the checkbox plugin active, without re-adding the ugly toggle arrows? I could do it in the check/uncheck event, but I don't want to check/uncheck everytime I expand a node.

    Read the article

  • HTML tables in JTextPane showing weird "form" boxes

    - by Ted
    import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.border.EmptyBorder; import javax.swing.text.Document; import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.StyleSheet; public class htmlEditor2 extends JFrame { private JPanel contentPane; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { htmlEditor2 frame = new htmlEditor2(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public htmlEditor2() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); Foo f = new Foo(); f.setText("<html><body><table border=\"1\" width=\"985\" cellpadding=\"3\" cellspacing=\"0\" style=\"table-layout: fixed; border-collapse: collapse; border-width: 0px; border-color: #010101; \"><colgroup><col width=\"328\"></col> <col width=\"328\"></col> <col width=\"328\"></col> </colgroup><tr><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><font face=\"Arial\"><span style=\"font-size:8pt\">row 1</span></font></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><font face=\"Arial\"><span style=\"font-size:8pt\">row2</span></font></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><font face=\"Arial\"><span style=\"font-size:8pt\">row3</span></font></div></td></tr><tr><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td></tr><tr><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td><td align=\"left\" valign=\"top\" width=\"321\" style=\"border: solid #010101 1px; \"><div align=\"left\"><span style=\"font-size: 8pt;\">&nbsp;</span></div></td></tr></table><div align=\"left\">&nbsp;&nbsp;</div></body></html>"); contentPane.add(f); } class Foo extends JTextPane { public Foo() { super(); HTMLEditorKit kit = new HTMLEditorKit(); setEditorKit(kit); StyleSheet styleSheet = kit.getStyleSheet(); styleSheet.addRule(""); //in case I need to add a CSS Document doc = kit.createDefaultDocument(); setDocument(doc); } } } I would paste a nicely formatted version of the html, but I'm not sure how to do it on here... So yeah.. I just want to know how to get rid of those weird colgroup and col boxes in my table and how to make the table work normally! Thanks yall!

    Read the article

  • Enabling ProGuard in Eclipse for Android

    - by Ted Hopp
    The new documentation on ProGuard for Android says to add a line to the default.properties file in the project home directory. However, on opening this file, I read at the top: # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! Am I missing something? Also, is there a way to enable ProGuard only for a production build from Eclipse (i.e., when exporting the finished product)?

    Read the article

  • Expose JSON as queryable for jQuery

    - by Ted
    I am trying to expose some data, user names, as json format on my server. I want to use jQuery.getJSOn() method to query data. I can get my data converted to json with newtonsoft.dll on server and save it in a file. But as far as I know it is not queryable. I want something like http://search.twitter.com/search.json?callback=?&q=abc Can anyone help me out to expose my data ion the above format.

    Read the article

  • Erlang: HTTP Accept Header with Inets

    - by Ted Karmel
    I am trying to do the equivalent of the following curl command : curl -H "Accept: text/plain" http://127.0.0.1:8033/stats I tried with an Inets simple http request. But, it isn't processed. How can I specify in Inets (or some other Erlang http client for that matter) the accept header requirement?

    Read the article

  • How do C++ compilers actually pass reference parameters?

    - by T.E.D.
    This question came about as a result of some mixed-langauge programming. I had a Fortran routine I wanted to call from C++ code. Fortran passes all its parameters by reference (unless you tell it otherwise). So I thought I'd be clever (bad start right there) in my C++ code and define the Fortran routine something like this: extern "C" void FORTRAN_ROUTINE (unsigned & flag); This code worked for a while but (of course right when I needed to leave) suddenly started blowing up on a return call. Clear indication of a munged call stack. Another engineer came behind me and fixed the problem, declaring that the routine had to be deinfed in C++ as extern "C" void FORTRAN_ROUTINE (unsigned * flag); I'd accept that except for two things. One is that it seems rather counter-intuitive for the compiler to not pass reference parameters by reference, and I can find no documentation anywhere that says that. The other is that he changed a whole raft of other code in there at the same time, so it theoretically could have been another change that fixed whatever the issue was. So the question is, how does C++ actually pass reference parameters? Is it perhaps free to do copy-in, copy-out for small values or something? In other words, are reference parameters utterly useless in mixed-language programming? I'd like to know so I don't make this same code-killing mistake ever again.

    Read the article

  • Why hasn't anybody started a hosted continuous integration service?

    - by Teflon Ted
    There's a dozen services that provide hosted version control, hosted ticket tracking, hosted project management, and combinations of all of the above, there's even hosted web-based IDEs. But nobody's yet offered a hosted continuous integration service; at least that I can find. The concept seems simple enough: I register and provide the URL to my source code repository, it grabs my code and builds it via ant/rake/whatever, then runs the suite of tests and some metrics (code coverage, performance, etc.). Is there some prohibitive barrier to entry I'm not considering?

    Read the article

  • very simple delegate musing

    - by Ted
    Sometimes the simplest questions make me love C/C++ and C# more and more. Today sitting on the bus musing aout delegates I remembered reading somwhere you don't need to use the new keyword when instaniating a new delegate. For example: public static void SomeMethod(string message) { ... } ... public delegate void TestDelgate(string message); //Define a delegate ........... //create a new instance ..METHOD 1 TestDelgate t = new TestDelgate(SomeMethod); //OR another way to create a new instance ..METHOD 2 TestDelgate t = SomeMethod; //create a new instance ..METHOD 2 So todays questions are What happens under the hood in method 2. Does the compiler expand method 2 into method 1, hence writing TestDelgate t = SomeMethod; is just a shortcut for TestDelgate t = new TestDelgate(SomeMethod);, or is there another reason for the exsitence of method 2 Do you guys think method 1 or method 2 is better for readability (this is a subjective question, but I'd just like to get a unscientific feel of general opinion of stackoverflow :-))

    Read the article

  • problem linking vba modules in MS Access 2007

    - by Ted
    I am upgrading a database system from Access 2000 db to Access 2007, which communicates with several chemistry measuring devices(pH meter, scale, etc) via an RS 232 serial port. The first db consists of several modules containing vba code that enables the communications with the ports, as well as supports the code behind the forms in the second db. The user, or lab tech, navigates through the forms in the second db to interact with the lab devices, and also to generate the reports which display the info. from the devices. The reports are also part of the second db. The code works in Access 2000, but once I convert it to 2007, the code in the second db cannot find the function calls in the first db that dictate the progression from screen to screen. I have tried importing the modules into the second db, and I have tried linking them, but it still doesn't work. The error message is #438: "Object doesn't support this property or method." Any suggestions would be greatly appreciated. Here is the code for the first function that is not being called correctly: Description: ' This routine is used to return to the calling form and close the active form. ' ' Input: ' strFormCalled --- the active form ' strCallingForm --- the form that called the active form ' blnUnhideOrOpen --- whether to open or just unhide form Public Sub basReturnToCallingForm(ByVal strFormCalled As String, ByVal _ strCallingForm As Variant, Optional blnUnhideOrOpen As Boolean = True) On Error GoTo err_basReturnToCaliingForm If Not basIsBlankString(strCallingForm) And blnUnhideOrOpen Then DoCmd.OpenForm strCallingForm, acNormal Else Call basUnHideForm(strCallingForm) End If Call basCloseForm(strFormCalled) exit_basReturnToCaliingForm: Exit Sub err_basReturnToCaliingForm: Err.Raise Err.Number, "basReturnToCaliingForm", Err.Description End Sub I will post the second function shortly, but I have to go to a meeting... The second funtion that isn't 'working' is a cmdStartClick that is supposed to be called when a user initializes a pump. However, within that function, it's also sticking on a line that is supposed to progress to the next form in the db. The other thing is that the code works in Access 2002, but not in Access 2007...

    Read the article

  • In Rails, how do you functional test a Javascript response format?

    - by Teflon Ted
    If your controller action looks like this: respond_to do |format| format.html { raise 'Unsupported' } format.js # index.js.erb end and your functional test looks like this: test "javascript response..." do get :index end it will execute the HTML branch of the respond_to block. If you try this: test "javascript response..." do get 'index.js' end it executes the view (index.js.erb) withOUT running the controller action!

    Read the article

  • Problem loading RTF file into windows richTextBox

    - by Ted
    I am trying to load files into a windows (vs 2010) richTextBox but only the first line of the file is loading. I'm using: // Create an OpenFileDialog to request a file to open. OpenFileDialog openFile1 = new OpenFileDialog(); // Initialize the OpenFileDialog to look for RTF files. openFile1.DefaultExt = "*.rtf"; openFile1.Filter = "RTF Files|*.rtf"; // Determine whether the user selected a file from the OpenFileDialog. if (openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFile1.FileName.Length > 0) { // Load the contents of the file into the RichTextBox. rtbTest.LoadFile(openFile1.FileName); } The test file I'm using is .cs file saved as an rtf file. Any help appreciated please.

    Read the article

  • How might you unobtrusively enhance the jQuery Datepicker class?

    - by Teflon Ted
    You can pass special strings into jQuery's Datepicker class setDate() method like "+7" which will be translated into "7 days from today": http://docs.jquery.com/UI/Datepicker#method-setDate But you can't get that "+7" back out. When you call getDate() you get the calculated resulting date. I have a use case where I need to pull out the special string "+7" for propagation. One chunk of code is passing a special string into the Datepicker and passing the Datepicker over to another chunk of code which pulls out the date, but the latter sometimes needs to know the special string rather than the calculated date. So I need to enhance the Datepicker tool to (a) store the special code internally and (b) expose it via a method like getOriginallyPassedInDate() or some such. I'm not a jQuery/Javascript ninja so I could really use some guidance on how I might preferably-unobtrusively add the necessary functionality to the Datepicker class, the way you might monkey-patch an object in Ruby I'm guessing.

    Read the article

  • div at bottom of page.

    - by Ted
    I have a div which I am using as a footer to display some content. I have put the style as: .pageFooter{ position:absolute; bottom:0px; width:100%; height:25px; background:#e6e6e6; } This style works well when there is not content in the body of page. But when I populate the page with content, say datagrid, the div is overlaps data in datagrid. What changes should I make to the style to let the div be at the bottom always. I am using IE* to view the pages.

    Read the article

  • WPF: issue updating UI from background thread

    - by Ted Shaffer
    My code launches a background thread. The background thread makes changes and wants the UI in the main thread to update. The code that launches the thread then waits looks something like: Thread fThread = new Thread(new ThreadStart(PerformSync)); fThread.IsBackground = true; fThread.Start(); fThread.Join(); MessageBox.Show("Synchronization complete"); When the background wants to update the UI, it sets a StatusMessage and calls the code below: static StatusMessage _statusMessage; public delegate void AddStatusDelegate(); private void AddStatus() { AddStatusDelegate methodForUIThread = delegate { _statusMessageList.Add(_statusMessage); }; this.Dispatcher.BeginInvoke(methodForUIThread, System.Windows.Threading.DispatcherPriority.Send); } _statusMessageList is an ObservableCollection that is the source for a ListBox. The AddStatus method is called but the code on the main thread never executes - that is, _statusMessage is not added to _statusMessageList while the thread is executing. However, once it is complete (fThread.Join() returns), all the stacked up calls on the main thread are executed. But, if I display a message box between the calls to fThread.Start() and fThread.Join(), then the status messages are updated properly. What do I need to change so that the code in the main thread executes (UI updates) while waiting for the thread to terminate? Thanks.

    Read the article

  • NEED your opinion on .net Profile class VS session vars

    - by Ted
    To save trips to sql db in my older apps, I store *dozens of data points about the current user in an array and then store the array in a session. For example, info that might be used repeatedly during user’s session might be stored… Dim a(7) as string a(0) = “FirstName” a(1) = “LastName” a(2) = “Address” a(3) = “Address2” a(4) = “City” a(5) = “State” a(6) = “Zip” session.add(“s_a”, a) *Some apps have an array 100 in size. That is something I learned in my asp classic days. Referencing the correct index can be laborsome and I find it difficult to go back and add another data point in the array grouped with like data. For example, suppose I need to add Middle Initial to the array as a design alteration. Unless I redo the whole index mapping, I have to stick Middle Initial in the next open slot, which might be in the 50s. NOW, I am considering doing something easier to reference each time (eliminating the need to know the index of the value wanted). So I am looking to do this… session.add(“Firstname”, “FirstName”) session.add(“Lastname”, “LastName”) session.add(“Address”, “Address”) etc. BUT, before I do this, I would like some guidance. I am afraid this might be less efficient, even though easier to use. I don’t know if a new session object is created for each data point or if there is only one session object, and I am adding a name/value pair to that object? If I am adding a name/value pair to a single object, that seems like a good idea. Does anyone know? Or is there a more preferred way? Built-in Profile class? Re: Profile class I have an internal debate about scope. It seems that the .net Profile class is good for storing app-SPECIFIC user settings (i.e. style theme, object display properties, user role, etc.) The examples I give are information whose values are selected/edited by the user to customize the application experience. This information is not typically stored/edited elsewhere in the app db. But when you have data that 1) is stored already in the app db and 2) can be altered by other users (in this case: company reps may update client's status, address, etc.), then the persistence of the Profile data may be an issue. In this case, the Profile would need to be reset at the beginning and dropped like a session.abandon at the end of each user's session to prevent reloading info that had since been edited by someone. I believe this is possible, but not sure Currently, I use the session array to store both scopes, app-specific and user-specific data. If my session plan is good, I think I will create a class to set/get values from the session also. I appreciate your thoughts. I would like to know how others have handled this type of situation. Thanks.

    Read the article

  • Get consolidated results with following tables

    - by Ted
    I have a scenario. Here's my table structure is: ID LoginDate RemovalDate ---------------------------------------- 1 2009/08/01 NULL 2 2009/09/12 2010/01/02 3 2009/08/31 2009/10/29 4 2010/02/17 NULL 5 2009/10/18 2009/11/22 I want a consolidated results of how many ID's were not removed in a particular month. So the result set should be Date NotRemoved_ID -------------------------- 2009/08 2 2009/09 3 2009/10 3 [One ID got removed in 2009/10] 2010/02 2 [Two got removed in 2009/11 and 2010/01] Please help.

    Read the article

  • Offline navigation software for Android - what is out there?

    - by Ted
    Im looking for navigation software for the Android platform and I have a few requirements: Offline maps. The maps should be stored on the device/memory card so no Internet-connection is required There should be some way to interact with the application "through code"; sending route requests, getting current location perhaps, bringing app to foreground/background, etc. An API so it can be controlled from another application. No monthly fees The only one I found so far to match the above is Sygic Navigation. However, I havent yet been able to communication with the app even though they say that it can be done. Still investigating that...

    Read the article

  • How to tell which port a USB device is plugged into?

    - by Ted N
    My c# app must manage multiple USB devices which are the identical product from the same manufacturer. If the user plugs 3 of my devices in, and then unplugs one of them, I need to know which of the 3 devices was unplugged. However, when I register the devices and receive the WM_DEVICECHANGE notifications, the data returned from the DBT_DEVTYP_DEVICEINTERFACE is identical for each of the devices. If I could get the USB port info when the devices arrive or are removed it would solve my problem, but I can't find a way to do this. Any suggestions?

    Read the article

  • How to set only the first cell of a UITableView to a different color?

    - by Ted
    I use cellForRowAtIndexPath like here: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) cell = [self getCellContentView:CellIdentifier]; UILabel *lbl = (UILabel*)[cell.contentView viewWithTag:1]; for (UITableViewCell *c in [tbl visibleCells]) { // UITableViewCell *cell2 = [tbl cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]]; UILabel *lbl = (UILabel*)[c.contentView viewWithTag:1]; lbl.textColor = [UIColor redColor]; } if([tbl indexPathForCell:cell].section==0) lbl.textColor = [UIColor whiteColor]; UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1]; UILabel *lblTemp2 = (UILabel *)[cell viewWithTag:2]; //First get the dictionary object lblTemp1.text = @"test!"; lblTemp2.text = @"testing more"; NSLog(@"%@",[tbl indexPathForCell:cell]); return cell; } But is still makes some of my cells white instead of gray. How can I change only the first item in the row to white?

    Read the article

  • Android: how to have app talk to a web page, ie send gps location

    - by Ted pottel
    I'm trying to write a app, where a webpage will have a button that when press will give the GPS location of the phone. I was going to have the android app create a thread that waits on a scket connection. The issue is that 1. Getting the ip addrs of the phone 2. I was told this would really drain the battery I was also thinking about having the phone send the gps location to a webserver like evrry 10 seconds. This sort of seams like a waste of bandwidth. Is there a good way to do this?

    Read the article

  • T-SQL Query to Get SUM(COUNT())

    - by Ted
    Hi, I am planning to get a report for a table with following table structure: ID RequestDate ----------------------------- 1 2010/01/01 2 2010/02/14 3 2010/03/20 4 2010/01/07 5 2009/03/31 I want the results as: I D_Count RequestDate Sum ----------------------------------------- 2 2010/01 2 1 2010/02 3 2 2010/03 5 Pls help.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >