Search Results

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

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

  • C# Delegate under the hood question.

    - by Ted
    Hi Guys I was doing some digging around into delegate variance after reading the following tquestion in SO. "delegate-createdelegate-and-generics-error-binding-to-target-method" (sorry not allowed to post more than one hyperlink as a newbie here!) I found a very nice bit of code from Barry kelly at https://www.blogger.com/comment.g?blogID=8184237816669520763&postID=2109708553230166434 Here it is (in a sugared-up form :-) using System; namespace ConsoleApplication4 { internal class Base { } internal class Derived : Base { } internal delegate void baseClassDelegate(Base b); internal delegate void derivedClassDelegate(Derived d); internal class App { private static void Foo1(Base b) { Console.WriteLine("Foo 1"); } private static void Foo2(Derived b) { Console.WriteLine("Foo 2"); } private static T CastDelegate<T>(Delegate src) where T : class { return (T) (object) Delegate.CreateDelegate( typeof (T), src.Target, src.Method, true); // throw on fail } private static void Main() { baseClassDelegate a = Foo1; // works fine derivedClassDelegate b = Foo2; // works fine b = a.Invoke; // the easy way to assign delegate using variance, adds layer of indirection though b(new Derived()); b = CastDelegate<derivedClassDelegate>(a); // the hard way, avoids indirection b(new Derived()); } } } I understand all of it except this one (what looks very simple) line. b = a.Invoke; // the easy way to assign delegate using variance, adds layer of indirection though Can anyone tell me: how it is possible to call invoke without passing the param required by the static function. When is going on under the hood when you assign the return value from calling invoke What does Barry mean by extra indirection (in his comment)

    Read the article

  • rubyCAS-client serviceValidation uri questions.

    - by ted-gehling
    php code works with this url but the rubyCAS-Client gem's `validate_service_ticket()' seems to call an SSL Validation on this url which returns an error message. 'OpenSSL::SSL::SSLError in CassersController#index' ||'SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed' ---enviroment.rb--- require 'casclient' require 'casclient/frameworks/rails/filter' CASClient::Frameworks::Rails::Filter.configure( :cas_base_url => "https://auth.foo.com", :validate_url => "https://auth.foo.com/serviceValidate" ) ---casser_controller.rb--- class CassersController < ApplicationController require 'casclient' require 'casclient/frameworks/rails/filter' before_filter CASClient::Frameworks::Rails::Filter def index @username = session[:cas_user] end end Possibly just another requirement I need to make or a config file that needs changed, but any help about this error would be appreciated.

    Read the article

  • How to get parameter values for dm_exec_sql_text

    - by Ted Elliott
    I'm running the following statement to see what queries are executing in sql server: select * from sys.dm_exec_requests r cross apply sys.dm_exec_sql_text(r.sql_handle) where r.database_id = DB_ID('<dbname>') The sql text that comes back is parameterized: (@Parm0 int) select * from foo where foo_id = @Parm0 Is there any way to get the values for the parameters that the statement is using? Say by joining to another table perhaps?

    Read the article

  • How to use Google's Closure to compile JavaScript

    - by Ted
    Google just released Closure, which is a compiler to minify JavaScript. On the product site, it says "The Closure Compiler has also been integrated with Page Speed". How do I use Page Speed to compile my web pages JavaScript with Closure? (Or, is there a web site that I can simply paste in my JavaScript to have closure minify it?

    Read the article

  • Quitting an application - is that frowned upon?

    - by Ted
    Moving on in my attempt to learn Android I just read the following: Question: Does the user have a choice to kill the application unless we put a menu option in to kill it? If no such option exists, how does the user terminate the application? Answert (Romain Guy): The user doesn't, the system handles this automatically. That's what the activity lifecycle (especially onPause/onStop/onDestroy) is for. No matter what you do, do not put a "quit" or "exit" application button. It is useless with Android's application model. This is also contrary to how core applications work. Hehe, for every step I take in the Android world I run into some sort of problem =( Apparently, you cannot quit an application in Android (but Android can very well totally destroy your app whenever it feels like it). Whats up with that? I am starting to think that its impossible to write an app that functions as a "normal app" - that the user can quit the app when he/she decides to do so. That is not something that should be relied upon the OS to do. The application I am trying to create is not an application for the Android Market. It is not an application for "wide use" by the general public, it is a business app that is going to be used in a very narrow business field. I was actually really looking forward to developing for the Android-platform, since it addresses a lot of issues that exist in Windows Mobile and .NET. However, the last week has been somewhat of a turnoff for me... I hope I dont have to abandon Android, but it doesnt look very good right now =( Is there a way for me to really quit the application?

    Read the article

  • Using TCP Acks to measure latency to a server?

    - by Ted Graham
    I am trying to measure latency to a server that I don't control. This is in a colocated environment, so the latency is on the order of 500 us (.5 ms). I understand that Cisco gear frequently deprioritizes ICMP traffic, making ping times unreliable. Is there a way for me to tell if this is the case on the gear I am traversing? Can I use TCP acknowledgements to determine the minimum latency to the remote server? To do this, I would somehow need to force the remote server to send a TCP ack immediately on receiving my data.

    Read the article

  • Windows Mobile Development on MacBook Pro?

    - by Ted Nichols
    I am a frequent Windows Mobile application developer in need of a new development laptop. I am considering a MacBook or Macbook Pro running either Fusion from VMWare or Parallels Desktop. This will give me the option to port my applications to the iPhone depending on what MS does with WM 6.5 and 7. Has anybody tried doing Windows Mobile development using Microsoft Windows Mobile Device Center (or ActiveSync) and VS2008 on the MacBook Pro using one of these virtual machines? Does the device emulator work properly? What about debugging a Windows Mobile device over a USB cable? In general, do most USB drivers (non HID) designed for Windows work under these virtual machines? Thanks.

    Read the article

  • Ubuntu Equivalent of Unix Command cp -n

    - by Ted Karmel
    A software I need to install on my Ubuntu Hardy has a MAKE file which includes the command cp -n. However, I get an error stating the -n is an invalid option. The command will work on a Mac terminal but I need it to work on Ubuntu. Does anyone know the equivalent command for Ubuntu? Thanks.

    Read the article

  • Trouble when changing pixel data with alpha on png on iphone --okay on simulator

    - by Ted
    I'm trying to change the color of the pixels (lighten or darken) without changing the value of the alpha channel using CGDataProviderCopyData. I leave every 4th databyte untouched. It work fine of the iphone simulator, however on the real thing the alpha goes white as I increase the values of the other pixels. I've tried changing just the first byte, or the second, or the third. Does anybody have any idea what is going on? The basic code is borrowed from Jorge. I like this simple approach --I'm new to this. But I want to make it work with png images with some transparency. here is most of the code by Jorge : CFDataRef CopyImagePixels(CGImageRef inImage){ return CGDataProviderCopyData(CGImageGetDataProvider(inImage)); } CGImageRef img=originalImage.CGImage; CFDataRef dataref=CopyImagePixels(img); UInt8 *data=(UInt8 *)CFDataGetBytePtr(dataref); int length=CFDataGetLength(dataref); for(int index=0;index255){ data[index+i]=255; }else{ data[index+i]+=value; } } } } size_t width=CGImageGetWidth(img); size_t height=CGImageGetHeight(img); size_t bitsPerComponent=CGImageGetBitsPerComponent(img); size_t bitsPerPixel=CGImageGetBitsPerPixel(img); size_t bytesPerRow=CGImageGetBytesPerRow(img); CGColorSpaceRef colorspace=CGImageGetColorSpace(img); CGBitmapInfo bitmapInfo=CGImageGetBitmapInfo(img); CGImageAlphaInfo alphaInfo = kCGBitmapAlphaInfoMask(img); NSLog(@"bitmapinfo: %d",bitmapInfo); CFDataRef newData=CFDataCreate(NULL,data,length); CGDataProviderRef provider=CGDataProviderCreateWithCFData(newData); CGImageRef newImg=CGImageCreate(width,height,bitsPerComponent,bitsPerPixel,bytesPerRow,colorspace,bitmapInfo,provider,NULL,true,kCGRenderingIntentDefault); [iv setImage:[UIImage imageWithCGImage:newImg]]; CGImageRelease(newImg); CGDataProviderRelease(provider);

    Read the article

  • $.ajax not loading data data everytime from server

    - by Ted
    I have written a simple jQuery.ajax function which loads a user control from the server on click of a button. The first time I click the button, it goes to the server and gets me the user control. But each subsequent click of the same button does not goes to the server to fetch me the user control. Since my user control fetches data from db, I need to reload the user control everytime i hit the button. But if anyhow I get my user control to unload from the page, and re-click the button, it goes to the server and fetches me the user control. Here's the code: $("#btnLoad").click(function() { if ($(this).attr("value") == "Load Control") { $.ajax({ url: "AJAXHandler.ashx", data: { "lt": "loadcontrol" }, dataType: "html", success: function(data) { content.html(data); } }); $(this).attr("value", "Unload Control"); } else { $.ajax({ url: "AJAXHandler.ashx", data: { "lt": "unloadcontrol" }, dataType: "html", success: function(data) { content.html(data); } }); $(this).attr("value", "Load Control"); } }); Please let me know if there is any other way I can get my user control loaded from server everytime I click the button.

    Read the article

  • Assembly Load and loading the "sub-modules" dependencies - "cannot find the file specified"

    - by Ted
    There are several questions out there that ask the same question. However the answers they received I cannot understand, so here goes: Similar questions: http://stackoverflow.com/questions/1874277/dynamically-load-assembly-and-manually-force-path-to-get-referenced-assemblies ; http://stackoverflow.com/questions/22012/loading-assemblies-and-its-dependencies-closed The question in short: I need to figure out how dependencies, ie References in my modules can be loaded dynamically. Right now I am getting "The system cannot find the file specified" on Assemblies referenced in my so called modules. I cannot really get how to use the AssemblyResolve event... The longer version I have one application, MODULECONTROLLER, that loads separate modules. These "separate modules" are located in well-known subdirectories, like appBinDir\Modules\Module1 appBinDir\Modules\Module2 Each directory contains all the DLLs that exists in the bin-directory of those projects after a build. So the MODULECONTROLLER loads all the DLLs contained in those folders using this code: byte[] bytes = File.ReadAllBytes(dllFileFullPath); Assembly assembly = null; assembly = Assembly.Load(bytes); I am, as you can see, loading the byte[]-array (so I dont lock the DLL-files). Now, in for example MODULE1, I have a static reference called MyGreatXmlProtocol. The MyGreatXmlProtocol.dll then also exists in the directory appBinDir\Modules\Module1 and is loaded using the above code When code in the MODULE1 tries to use this MyGreatXmlProtocol, I get: Could not load file or assembly 'MyGreatXmlProtocol, Version=1.0.3797.26527, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. So, in a post (like this one) they say that To my understanding reflection will load the main assembly and then search the GAC for the referenced assemblies, if it cannot find it there, you can then incorparate an assemblyResolve event: First; is it really needed to use the AssemblyResolve-event to make this work? Shouldnt my different MODULEs themself load their DLLs, as they are statically referenced? Second; if AssemblyResolve is the way to go - how do I use it? I have attached a handler to the Event but I never get anything on MyGreatXmlProctol... === EDIT === CODE regarding the AssemblyResolve-event handler: public GUI() { InitializeComponent(); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); ... } // Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { Console.WriteLine(args.Name); return null; } Hope I wasnt too fuzzy =) Thx

    Read the article

  • Programatically Drop an External Div in JSTree

    - by Ted Mosbey
    I have a grid (slickgrid) which creates and destroys rows on the fly. I know jstree uses .jstree-draggable to find the external drag targets, but applying them to the grid rows doesn't work - such that I've thought of using the grid drag, and on finish of the grid drag I want to call the jstree "drag_finish": function (data) jQuery.jstree._reference($("#Tree")).dnd_finish(); The problem is that there is some null data. How would I Programatically Drop an External Div? How does jstree apply the .jstree-draggable targets? I could add the .jstree-draggable class to the grid drag helper, but it doesnt seem to fire when dropped on the tree although it clearly has the class. Any guidance would be greatly appreciated. Regards.

    Read the article

  • Inconsistent MySQL COLLATE errors across databases

    - by Teflon Ted
    I have two physically-separate MySQL databases on which I have to run a single query. The query has a section of SQL that looks like this: and foo_table.bar_column like concat('%', rules.pattern, '%') COLLATE utf8_general_ci It runs fine on database A but on database B I get this error: ERROR 1253 (42000): COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1' If I remove the collation it runs fine on database B but on database A I get this error: ERROR 1267 (HY000): Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation 'like' Is there a version of the query that will run on both databases? Or, is there a configuration I can change on either database to make the query happy in both places? Update: Database A is version 5.1.38, Database B is version 5.1.34

    Read the article

  • Error 424 from Twitter API

    - by Ted
    I'm experitmenting with the Twitter API (OAuth). I have a test bed that can tweet from my dev box, but fails in production. I get a status code of 424 returned when trying to tweet. I can't spot the difference between my live environment and my dev environment so really need to understand what a '424' is, but can find no documentation relating to it.

    Read the article

  • When to draw/layout child controls in UserControl

    - by Ted Elliott
    I have a list-type UserControl (like a ListBox). The items inside the control are another complex UserControl containing a few other controls (ComboBox, TextBox, etc). I'm wondering what the preferred or best method would be to override to draw/layout the child controls. I basically want to trigger this method any time the list changes. I originally had a RedrawItems method that I just called whenever I needed to redraw which added or removed Controls from the Controls collection. But it was getting triggered too early in the lifecycle of the code from some of the designer code. Now I've switched to overriding OnLayout and doing my stuff there. I call PerformLayout when I want to trigger a redraw, such as when the DataSource property changes or when it fires a changed event. Is OnLayout the best place for this? Here is the code: [ComplexBindingProperties("DataSource")] public partial class CustomList : UserControl { private object _dataSource; private CustomListItem _newRow; public CustomList() { InitializeComponent(); } protected override void OnCreateControl() { base.OnCreateControl(); _newRow = new CustomListItem(); Controls.Add(_newRow); } public object DataSource { get { return _dataSource; } set { bool register = _dataSource != value; if (_dataSource != null && _dataSource != value) { UnregisterDataSource(_dataSource); } _dataSource = value; if (_dataSource != null) RegisterDataSource(_dataSource); PerformLayout(); } } public CustomListItem ItemTemplate { get { return _newRow; } } protected override void OnLayout(LayoutEventArgs e) { base.OnLayout(e); int ctrlCount = this.Controls.AsEnumerable().OfType<CustomListItem>().Count(); ctrlCount--; // subtract 1 for the add row var ds = this.DataSource as System.Collections.IList; int itemCount = ds == null? 0 : ds.Count; int maxCount = Math.Max(ctrlCount,itemCount); if (maxCount == 0) return; this.SuspendLayout(); // temporarily remove the template Controls.RemoveAt(Controls.Count-1); for (int i = 0; i < maxCount; i++) { CustomListItem item; if (i >= itemCount) { Controls.RemoveAt(i); } else { if (i >= ctrlCount) { item = ItemTemplate.Copy(); this.Controls.Add(item); item.Location = new Point(0, item.Height * i); item.TabIndex = i + 1; item.ViewMode = true; } else { item = (CustomListItem) Controls[i]; } item.Data = ds[i]; } } this.Controls.Add(ItemTemplate); ItemTemplate.Location = new Point(0, ItemTemplate.Height * maxCount); ItemTemplate.TabIndex = maxCount + 1; this.ResumeLayout(true); } private void RegisterDataSource(object dataSource) { IBindingList ds = dataSource as IBindingList; if (ds != null) { ds.ListChanged += new ListChangedEventHandler(DataSource_ListChanged); } } void DataSource_ListChanged(object sender, ListChangedEventArgs e) { switch (e.ListChangedType) { case ListChangedType.ItemAdded: PerformLayout(); break; case ListChangedType.ItemChanged: break; case ListChangedType.ItemDeleted: PerformLayout(); break; case ListChangedType.ItemMoved: PerformLayout(); break; case ListChangedType.Reset: PerformLayout(); break; default: break; } } private void UnregisterDataSource(object dataSource) { IBindingList ds = dataSource as IBindingList; if (ds != null) { ds.ListChanged -= new ListChangedEventHandler(DataSource_ListChanged); } } }

    Read the article

  • Erlang: HTTP GET Parameters with Inets

    - by Ted Karmel
    The following post indicates how to make a simple get http request with Erlang's inets. exploring erlang's http client Sometimes, URLs have GET parameters: http://example.net/item?parameter1=12&parameter2=1431&parameter3=8765 Besides including the parameters in the URL itself, is there a way to create variables and then send them with the request? Example appreciated.

    Read the article

  • Erlang : Handling HTTP Requests and Responses

    - by Ted Karmel
    What is the best erlang library for processing http requests and responses from within an erlang application? I have taken a look at inets but as a standalone application, it seems more like a replacement for curl. I would like to access external APIs from within the erlang application so would need to parse responses and be able to make subsequent requests with cookies generated from the response.

    Read the article

  • Scrollbars in ScrollView not showing after custom child view changes size

    - by Ted Hopp
    I have a ScrollView containing a client that is a vertical LinearLayout. The client, in turn, contains custom views that change height dynamically as a background thread does some work. The problem I'm having is that the ScrollView's vertical scroll bar is not updating correctly in Android 1.5. The most common problem occurs when the initial total height of the client is less than the viewport and grows. Initially there is no scroll bar, and it does not show up when the client grows until I actually scroll the window with a touch gesture or other UI action. After that, the scroll bar shows up. However, the thumb does not update as the height continues to change from the background thread. If I scroll the view again through the UI, the thumb immediately corrects itself. My code for updating the height from the background thread is: post(mLayoutRequestor); postInvalidate(); (mLayoutRequestor is a Runnable that just calls requestLayout().) This is done after I've recorded the new height in a variable mHeight. My onMeasure() method calls setMeasuredDimension with a height computed like this: private int measureHeight(int measureSpec) { int result; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize(measureSpec); if (specMode == MeasureSpec.EXACTLY) { result = specSize; } else { result = mHeight; if (specMode == MeasureSpec.AT_MOST && result > specSize) result = specSize; } return result; } Am I supposed to be calling something else besides requestLayout() to get the scroll bar to update correctly?

    Read the article

  • Render similar data in C# by grouping

    - by Ted
    I am trying to create some dynamic html out of some data from db. My data returned from db is: ApplicationName URL AppName1 URL1 AppName2 URL1 AppName2 URL2 AppName1 URL2 I want that all URL's for a single application should be rendered under one heading of ApplicationName. Like: AppName1 URL1 URL2 AppName2 URL1 URL2 Can anyone help me in the code for this?

    Read the article

  • jQuery to store data for sessions

    - by Ted
    I am trying to use jQuery AJAX. What my requirement is, i wish to load user names from DB in dataset, convert it to JSON format and store it in memory or using jQuery data for use while a user is browsing my site, i.e for a session. This way I can use autocomplete or my own code to display data to user. Can anyone help me design such a scenario?

    Read the article

  • What are possible/good ways to prototype iPhone applications?

    - by Ted Johnson
    This is intentionally left broad. If you wanted to show users what iPhone/mobile applications could to for them. The more interactive the better, but it must be quick to build as you can't code up every idea. Let us assume real-time games are out of scope. Throw out ideas or state which approach would be best. Here are some of my ideas, what are yours? Hack a app that loads mostly web or image content, but has hyperlinks to get around in. This would mean static data. Build screens which look great but can only be navigated in a story board type fashion. Load the web version or equivalent on the iPhone and say: now image the buttons and navigation is better. A paper based prototype. Flash or video walk through running on the phone. String existing iPhone apps and web pages together with minimal glue just to convey the idea. Can anyone share prototyping methods for other mobile devices? Ex: The palm prototype was just a block of wood and note pad that was carried around.

    Read the article

  • Assembly Load and loading the "sub-modules" dependencies - "cannot fild the file specified"

    - by Ted
    There are several questions out there that ask the same question. However the answers they received I cannot understand, so here goes: Similar questions: http://stackoverflow.com/questions/1874277/dynamically-load-assembly-and-manually-force-path-to-get-referenced-assemblies ; http://stackoverflow.com/questions/22012/loading-assemblies-and-its-dependencies-closed The question in short: I need to figure out how dependencies, ie References in my modules can be loaded dynamically. Right now I am getting "The system cannot find the file specified" on Assemblies referenced in my so called modules. I cannot really get how to use the AssemblyResolve event... The longer version I have one application, MODULECONTROLLER, that loads separate modules. These "separate modules" are located in well-known subdirectories, like appBinDir\Modules\Module1 appBinDir\Modules\Module2 Each directory contains all the DLLs that exists in the bin-directory of those projects after a build. So the MODULECONTROLLER loads all the DLLs contained in those folders using this code: byte[] bytes = File.ReadAllBytes(dllFileFullPath); Assembly assembly = null; assembly = Assembly.Load(bytes); I am, as you can see, loading the byte[]-array (so I dont lock the DLL-files). Now, in for example MODULE1, I have a static reference called MyGreatXmlProtocol. The MyGreatXmlProtocol.dll then also exists in the directory appBinDir\Modules\Module1 and is loaded using the above code When code in the MODULE1 tries to use this MyGreatXmlProtocol, I get: Could not load file or assembly 'MyGreatXmlProtocol, Version=1.0.3797.26527, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. So, in a post (like this one) they say that To my understanding reflection will load the main assembly and then search the GAC for the referenced assemblies, if it cannot find it there, you can then incorparate an assemblyResolve event: First; is it really needed to use the AssemblyResolve-event to make this work? Shouldnt my different MODULEs themself load their DLLs, as they are statically referenced? Second; if AssemblyResolve is the way to go - how do I use it? I have attached a handler to the Event but I never get anything on MyGreatXmlProctol... === EDIT === CODE regarding the AssemblyResolve-event handler: public GUI() { InitializeComponent(); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); ... } // Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { Console.WriteLine(args.Name); return null; } Hope I wasnt too fuzzy =) Thx

    Read the article

  • Advanced queries in HBase

    - by Teflon Ted
    Given the following HBase schema scenario (from the official FAQ)... How would you design an Hbase table for many-to-many association between two entities, for example Student and Course? I would define two tables: Student: student id student data (name, address, ...) courses (use course ids as column qualifiers here) Course: course id course data (name, syllabus, ...) students (use student ids as column qualifiers here) This schema gives you fast access to the queries, show all classes for a student (student table, courses family), or all students for a class (courses table, students family). How would you satisfy the request: "Give me all the students that share at least two courses in common"? Can you build a "query" in HBase that will return that set, or do you have to retrieve all the pertinent data and crunch it yourself in code?

    Read the article

  • How can I generate a git diff of what's changed since the last time I pulled?

    - by Teflon Ted
    I'd like to script, preferably in rake, the following actions into a single command: Get the version of my local git repository. Git pull the latest code. Git diff from the version I extracted in step #1 to what is now in my local repository. In other words, I want to get the latest code form the central repository and immediately generate a diff of what's changed since the last time I pulled.

    Read the article

  • Vimperator and scripts directory on Windows 7

    - by Ted
    Just trying out Vimperator for the first time. For the life of me however, I can't figure out how to add a script (specifically for delicious bookmarks). Running Windows 7 x64. No plugin directory: C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\dgj7o1s1.default\extensions\[email protected] No plugin directory in default location: C:\Users\username\vimperator If I create the "plugin" directory, the script is still not available. Any suggestions? I'm really liking Vimperator, but when you can't figure something out, you really CAN'T figure it out.

    Read the article

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