Search Results

Search found 785 results on 32 pages for 'warren van rooyen'.

Page 14/32 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How do I import and call unmanaged C dll with ansi string "char *" pointer string from VB.net?

    - by Warren P
    I have written my own function, which in C would be declared like this, using standard Win32 calling conventions: int Thing( char * command, char * buffer, int * BufSize); I have the following amount of VB figured out, which should import the dll and call this function, wrapping it up to make it easy to call Thing("CommandHere",GetDataBackHere): Imports Microsoft.VisualBasic Imports System.Runtime.InteropServices Imports System Imports System.Text Namespace dllInvocationSpace Public Class dllInvoker ' tried attributes but could not make it build: ' <DllImport("Thing1.dll", False, CallingConvention.Cdecl, CharSet.Ansi, "Baton", True, True, False, True)> Declare Ansi Function Thing Lib "Thing1.dll" (ByVal Command As String, ByRef Buffer As String, ByRef BufferLength As Integer) Shared Function dllCall(ByVal Command As String, ByRef Results As String) As Integer Dim Buffer As StringBuilder = New StringBuilder(65536) Dim retCode As Integer Dim bufsz As Integer bufsz = 65536 retCode = Thing(Command, Buffer, bufsz) Results = Buffer Return retCode End Function End Class End Namespace The current code doesn't build, because although I think I should be able to create a "buffer" that the C Dll can write data back into using a string builder, I haven't got it quite right. (Value of type System.Text.STringBuilder cannot be converted to 'String'). I have looked all over the newsgroups and forums and can not find an example where the C dll needs to pass between 1 and 64kbytes of data back (char *buffer, int bufferlen) to visual basic.net.

    Read the article

  • Grails Detect if a Plugin is Installed

    - by Scott Warren
    Is there a way in Grails to Detect that a plugin is installed. For example I need to know if the "Acegi" plugin is installed. If it is then I can run different Code. If the plugin is not installed (which is a viable option) then I can run different code. Thanks in Advance.

    Read the article

  • Facebook-WordPress comment/feedback integration

    - by warren
    Currently I have my Facebook profile automatically republish blog posts from a WordPress instance. What I would like to be able to do, however, is to also have comments posted to either the blog of Facebook show up on the other in the appropriate location. Is there a way to do this with the Facebook API?

    Read the article

  • Macro to improve callback registration readability

    - by Warren Seine
    I'm trying to write a macro to make a specific usage of callbacks in C++ easier. All my callbacks are member functions and will take this as first argument and a second one whose type inherits from a common base class. The usual way to go is: register_callback(boost::bind(&my_class::member_function, this, _1)); I'd love to write: register_callback(HANDLER(member_function)); Note that it will always be used within the same class. Even if typeof is considered as a bad practice, it sounds like a pretty solution to the lack of __class__ macro to get the current class name. The following code works: typedef typeof(*this) CLASS; boost::bind(& CLASS :: member_function, this, _1)(my_argument); but I can't use this code in a macro which will be given as argument to register_callback. I've tried: #define HANDLER(FUN) \ boost::bind(& typeof(*this) :: member_function, this, _1); which doesn't work for reasons I don't understand. Quoting GCC documentation: A typeof-construct can be used anywhere a typedef name could be used. My compiler is GCC 4.4, and even if I'd prefer something standard, GCC-specific solutions are accepted.

    Read the article

  • Selecting items from events, as evenly spaced as possible

    - by Matt Warren
    If I have an event that happens 15 times a second (numbered 1 - 15), but I only want to process it 3 times I can choose [1], [6] and [11],. It's important that the events I process are as evenly spaced as possible and take into account wrap-around, i.e. the events are continuous 13, 14, 15, 1, 2, 3 etc. If I want 4 items the best I can do is [1], [5], [9] & [13]. Is there a general algorithm that will calculate which events I need to process given the total number of events (total) and the number to process (processAmount).

    Read the article

  • Can I move the order of XCode, Cocoa, and User Templates around in XCode 3.1?

    - by Warren P
    I followed the other questions on StackOverflow and made custom User Templates. Instead of replacing the factory default Cocoa class template, I have to pick a new user template. The order that is shown in XCode's New File dialog box is: iPhone templates first (great if you mostly do iphone development) Second the User templates Third the default Mac OS templates. I want my user stuff first, Mac OS templates second, and I want to bury iPhone templates in third and last place. The sort is obviously not alphabetical. And you can't drag/drop reorder. (At least not in xcode 3.1.3)? From stackoverflow

    Read the article

  • How to 'insert if not exists' in MySQL?

    - by warren
    I started by googling, and found this article which talks about mutex tables. I have a table with ~14 million records. If I want to add more data in the same format, is there a way to ensure the record I want to insert does not already exist without using a pair of queries (ie, one query to check and one to insert is the result set is empty)? Does a unique constraint on a field guarantee the insert will fail if it's already there? It seems that with merely a constraint, when I issue the insert via php, the script croaks.

    Read the article

  • Delphi component you can't live without?

    - by Warren P
    Most delphi developers have a list of delphi components they wouldn't live without. Not including anything that ships with Delphi (standard VCL or included third-party software like Rave or Indy), what are the components you can't live without, be they commercial or open-source? I will refrain from adding my own answers unless this becomes a community wiki. One component name, or product name, per answer please. Please vote up on components and do not post duplicates.

    Read the article

  • Exemplars of large document-centric applications with COM/XPCOM/.NET interfaces.

    - by Warren P
    I am looking for exemplars (design examples) showing the use of interfaces (aka 'protocols' for you smalltalkers) to design a document management architecture in a large Word Processor, Spreadsheet, vector graphic or publishing package, or office-productivity (non-database) application with support for as many of the following as possible: any open source project, will be ideal, and language of implementation is unimportant since I am looking for design examples, however an object oriented language with support for "interfaces" is a must. I know at least a dozen languages, and I'm willing to study any application's source. use of "interface" could loosely be applied to either XPCOM or COM interfaces, or .NET interfaces, or even the use of pure-virtual (virtual+abstract) base-classes for OOP languages that lack the ability to declare an interface distinct from a class. I am mostly looking for a robust, thorough and flexible implementation for a document, IDocument, various document views (IDocumentView), and whatever operations make sense in that case. I am particular interested in cases where the product in question is a real-world product. For example, if anybody familiar with OpenOffice can tell me if the code contains a good sample design. I am looking for design documentation that outlines the design of the interfaces for such an application. So for example, if the openoffice spreadsheet has such an interface design, then that might be the best case, because it is a widely used real-world design, with millions of users, rather than a textbook example, which is minimal, and contrived. I know that the Mozilla platform uses XPCOM, and its design is heavily "interface" oriented, but I am looking more for a "word processor" or "spreadsheet" type of document design, rather than a web-browser. I am particularly interested in the interfaces used to access to data and meta-data such as markup (attributes like bold, and italics, and font size), and the ability to search and look up named entities within a document.

    Read the article

  • Force an object to be allocated on the heap

    - by Warren Seine
    A C++ class I'm writing uses shared_from_this() to return a valid boost::shared_ptr<>. Besides, I don't want to manage memory for this kind of object. At the moment, I'm not restricting the way the user allocates the object, which causes an error if shared_from_this() is called on a stack-allocated object. I'd like to force the object to be allocated with new and managed by a smart pointer, no matter how the user declares it. I thought it could be done through a proxy or an overloaded new operator, but I can't find a proper way of doing that. Is there a common design pattern for such usage? If it's not possible, how can I test it at compile time?

    Read the article

  • Typedef equivalence in function arguments

    - by Warren Seine
    Hi guys, The question is kind of hard to ask without an example so here it is: #include <vector> struct O { }; struct C { template <typename T> void function1(void (C::*callback)(const O*)); template <typename T> void function2(void (C::*callback)(const typename T::value_type)); void print(const O*); }; int main() { C c; c.function1< std::vector<O*> >(&C::print); // Success. c.function2< std::vector<O*> >(&C::print); // Fail. } The error that I am given is: error: no matching function for call to ‘C::function2(void (C::*)(const O*))’. Basically, the only difference between calls is that in function2, I'm more generic since I use the typedef std::vector<O*>::value_type which should resolve to O*, hence similar to function1. I'm using G++ 4.2.1 (I know it's old), but Comeau confirms I'm wrong. Why does the compilation fail?

    Read the article

  • Delphi components you can't live without

    - by Warren P
    Most Delphi developers have a list of Delphi components they wouldn't live without. Not including anything that ships with Delphi (standard VCL or included third-party software like Rave or Indy), what are the components you can't live without, be they commercial or open-source? One component or product name per answer, please. Please do not post duplicates.

    Read the article

  • does a git repository have its own local value for core.autocrlf that overrides the global one?

    - by Warren P
    As per this question, I understand that core.autocrlf=true in git will cause CRLF to LF translations. However when I type : git config core.autocrlf I see: false However, when I stage modified files that are already in the repo, I still get these warnings: Warning: CRLF will be replaced by LF in File1.X. The file will have its original line endings in your working directory. My guess is that the repo copy of the file is already set to "autocrlf=true". Questions: A. How do I query whether a file or git repo is already forcing AutoCrlf? B. How do I turn it autocrlf off?

    Read the article

  • An Array returned by a model association is not an Array?

    - by Warren
    We have a model association that looks something like this: class Example < ActiveRecord::Base has_many :others, :order => 'others.rank' end The rank column is an integer type. The details of these particular models are not really important though as we have found the same problem with other has_many associations between other models. We have also added to the Enumerable module: module Enumerable def method_missing(name) super unless name.to_s[0..7] == 'collect_' method = name.to_s[8..-1] collect{|element| element.send(method)} end end This adds a collect_id method that we can use to get an array of record ids from an array of ActiveRecord objects. So if we use a normal ActiveRecord find :all, we get a nice array which we can then use collect_id on but if we use Example.others.collect_id, we get NoMethodError: undefined method `collect_id' for #<Class:0x2aaaac0060a0> Example.others.class returns "Array" so is it lying or confused? Our solution thus far has been to use it this way: Example.others.to_a.collect_id This works but this seems a bit strange. Why would you have to do that? We are on Ruby 1.8.7 and Rails 2.3.4

    Read the article

  • How to access property in sub method after it runs?

    - by Warren
    I'm having a hard time working this one out but I think it should be pretty simple. Basically, I have this method which talks to a webservice and I need to return some data from the sub method, the "authCode". What am I doing wrong? How can I get the authCode out of the manager, or can I create a block or something to to ensure that the manager block runs first? Am I even using the right words - blocks, sub methods??? Please help :) - (NSString *)getAuthCodeEXAMPLE { __block NSString *returnString = @"nothing yet!"; NSURL *baseURL = [NSURL URLWithString:BaseURLString]; NSDictionary *parametersGetAuthCode = @{@"req": @"getauth"}; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:baseURL]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; [manager POST:APIscript parameters:parametersGetAuthCode success:^(NSURLSessionDataTask *task, id responseObject) { if ([task.response isKindOfClass:[NSHTTPURLResponse class]]) { NSHTTPURLResponse *r = (NSHTTPURLResponse *)task.response; if ([r statusCode] == 200) { self.returnedData = responseObject; NSString *authCode = [self.returnedData authcode]; NSLog(@"Authcode: %@", authCode); returnString = authCode; } } } failure:^(NSURLSessionDataTask *task, NSError *error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alertView show]; }]; //this currently returns "nothing yet!" return returnString; }

    Read the article

  • Best way to randomly select rows *per* column in SQL Server

    - by LesterDove
    A search of SO yields many results describing how to select random rows of data from a database table. My requirement is a bit different, though, in that I'd like to select individual columns from across random rows in the most efficient/random/interesting way possible. To better illustrate: I have a large Customers table, and from that I'd like to generate a bunch of fictitious demo Customer records that aren't real people. I'm thinking of just querying randomly from the Customers table, and then randomly pairing FirstNames with LastNames, Address, City, State, etc. So if this is my real Customer data (simplified): FirstName LastName State ========================== Sally Simpson SD Will Warren WI Mike Malone MN Kelly Kline KS Then I'd generate several records that look like this: FirstName LastName State ========================== Sally Warren MN Kelly Malone SD Etc. My initial approach works, but it lacks the elegance that I'm hoping the final answer will provide. (I'm particularly unhappy with the repetitiveness of the subqueries, and the fact that this solution requires a known/fixed number of fields and therefore isn't reusable.) SELECT FirstName = (SELECT TOP 1 FirstName FROM Customer ORDER BY newid()), LastName= (SELECT TOP 1 LastNameFROM Customer ORDER BY newid()), State = (SELECT TOP 1 State FROM Customer ORDER BY newid()) Thanks!

    Read the article

  • Best way to randomly select columns from random rows of SQL results.

    - by LesterDove
    A search of SO yields many results describing how to select random rows of data from a database table. My requirement is a bit different, though, in that I'd like to select individual columns from across random rows in the most efficient/random/interesting way possible. To better illustrate: I have a large Customers table, and from that I'd like to generate a bunch of fictitious demo Customer records that aren't real people. I'm thinking of just querying randomly from the Customers table, and then randomly pairing FirstNames with LastNames, Address, City, State, etc. So if this is my real Customer data (simplified): FirstName LastName State ========================== Sally Simpson SD Will Warren WI Mike Malone MN Kelly Kline KS Then I'd generate several records that look like this: FirstName LastName State ========================== Sally Warren MN Kelly Malone SD Etc. My initial approach works, but it lacks the elegance that I'm hoping the final answer will provide. (I'm particularly unhappy with the repetitiveness of the subqueries, and the fact that this solution requires a known/fixed number of fields and therefore isn't reusable.) SELECT FirstName = (SELECT TOP 1 FirstName FROM Customer ORDER BY newid()), LastName= (SELECT TOP 1 LastNameFROM Customer ORDER BY newid()), State = (SELECT TOP 1 State FROM Customer ORDER BY newid()) Thanks!

    Read the article

  • UITableView UITableViewCell not reloading on reloadData

    - by David van Dugteren
    This question has been asked a few times now, but there exists no answer on the web that has solved the problem for me yet... See the code: { const NSInteger TOP_LABEL_TAG = 1001; static NSString *CellIdentifier = @"CellIdentifier"; UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } getAQuestionToAnswer = [[QuestionsToAnswer sharedInstance] getLatestLoadedQuestion]; UILabel *topLabel; topLabel = [[[UILabel alloc] initWithFrame: CGRectMake ( 50, 18, 260, 75)] autorelease]; [cell.contentView addSubview:topLabel]; topLabel.tag = TOP_LABEL_TAG; topLabel.backgroundColor = [UIColor clearColor]; topLabel.textColor = [UIColor colorWithRed:0.25 green:0.0 blue:0.0 alpha:1.0]; topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0]; [topLabel setFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:13]]; topLabel.numberOfLines = 4; topLabel = (UILabel *)[cell viewWithTag:TOP_LABEL_TAG]; topLabel.text = [NSString stringWithFormat:@"%@", [getAQuestionToAnswer valueForKey:@"question"] ]; Some code is omitted but the basics is there, I'm updating by means of a shake gesture, the NSLog confirms that the getAQuestionToAnswer is indeed updated with a new question after the gesture. Yet at run time, no matter what I do... e.g. [self.tableview reloaddata]; nothing works. It just doesn't want to refresh.

    Read the article

  • Google Chrome: XMLHttpRequest.send() not working while doing POST.

    - by Dave Van den Eynde
    I'm working on an application that allows the user to send a file using a form (a POST request), and that executes a series of GET requests while that file is being uploaded to gather information about the state of the upload. It works fine in IE and Firefox, but not so much in Chrome and Safari. The problem is that even though send() is called on the XMLHttpRequest object, nothing is being requested as can be seen in Fiddler. To be more specific, an event handler is placed on the "submit" event of the form, that places a timeout function call on the window: window.setTimeout(startPolling, 10); and in this function "startPolling" sequence is started that keeps firing GET requests to receive status updates from a web service that returns text/json that can be used to update the UI. Is this a limitation (perhaps security-wise?) on WebKit based browsers? Is this a Chrome bug? (I'm seeing the same behaviour in Safari though).

    Read the article

  • Hide/ change width/ change position of UIButton based on device type

    - by Giles Van Gruisen
    I'm using the new in-app SMS features in my iPhone app, but obviously iPod Touches aren't able to send and receive SMS without support of a third party app. I know all well how to detect the device and how to hide a UIButton, but what I do not know is how to change the width of the others. Above are the three icons. The one on the far rights needs to be hidden on an iPod Touch, and the other two need to adjust size/ position to fill the remaining space. Any tips on programatically changing the position and width of a UIButton is greatly appreciated. Thanks!

    Read the article

  • C# Excel file OLEDB read HTML IMPORT

    - by Michel van Engelen
    Hi, I have to automate something for the finance dpt. I've got an Excel file which I want to read using OleDb: string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=A_File.xls;Extended Properties=""HTML Import;IMEX=1;"""; using (OleDbConnection connection = new OleDbConnection()) { using (DbCommand command = connection.CreateCommand()) { connection.ConnectionString = connectionString; connection.Open(); DataTable dtSchema = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); if( (null == dtSchema) || ( dtSchema.Rows.Count <= 0 ) ) { //raise exception if needed } command.CommandText = "SELECT * FROM [NameOfTheWorksheet$]"; using (DbDataReader dr = command.ExecuteReader()) { while (dr.Read()) { //do something with the data } } } } Normally the connectionstring would have an extended property "Excel 8.0", but the file can't be read that way because it seems to be an html file renamed to .xls. when I copy the data from the xls to a new xls, I can read the new xls with the E.P. set to "Excel 8.0". Yes, I can read the file by creating an instance of Excel, but I rather not.. Any idea how I can read the xls using OleDb without making manual changes to the xls or by playing with ranges in a instanciated Excel? Regards, Michel

    Read the article

  • iPhone Provisioning: What's it all about?

    - by david van brink
    Grepping around, I see that I'm not AT ALL alone in being... challenged... by the process of setting up an iPhone app, getting it to run, giving it my testers, and so on. I've gotten it to work. Somehow I emailed a copy or two to testers, and eventually got my li'l app into the store, and that was fine. But I can't say a really, deeply understand it! (And I don't do iDev every day. Even now my recollection of what I did is kind-of hazy.) I'm moderately capable of understanding things, if presented, well, you know, in a way I can understand. Can anyone point me to a crystal clear explanation of what provisioning actually is? I feel that if I understood it, the recipes to do it would be obvious. Thanks!

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >