Search Results

Search found 4677 results on 188 pages for 'alternative'.

Page 113/188 | < Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >

  • Case insensitive string compare in LINQ-to-SQL

    - by BlueMonkMN
    I've read that it's unwise to use ToUpper and ToLower to perform case-insensitive string comparisons, but I see no alternative when it comes to LINQ-to-SQL. The ignoreCase and CompareOptions arguments of String.Compare are ignored by LINQ-to-SQL (if you're using a case-sensitive database, you get a case-sensitive comparison even if you ask for a case-insensitive comparison). Is ToLower or ToUpper the best option here? Is one better than the other? I thought I read somewhere that ToUpper was better, but I don't know if that applies here. (I'm doing a lot of code reviews and everyone is using ToLower.) Dim s = From row In context.Table Where String.Compare(row.Name, "test", StringComparison.InvariantCultureIgnoreCase) = 0 This translates to an SQL query that simply compares row.Name with "test" and will not return "Test" and "TEST" on a case-sensitive database.

    Read the article

  • Clipboard Debugging

    - by Jake Pearson
    In the olden times of .NET 1.1, I could use the SoapFormatter to find out exactly what was getting serialized when I copied an object into the clipboard. Fast forward to 2010, and I tried to do the same trick. It turns out the SoapFormatter does not support generics. Is there an alternative way to find out exactly what binary objects are serialized into the clipboard? For example lets say I have this class: public class Foo { public List<Goo> Children; } If I send an instance of it to the clipboard, I would like to take a look at what is in the clipboard to see if it's children list was included or not. Update: I was finally able to find the over copied field with the debugger. Visual Studio did it's job.

    Read the article

  • When are you truly forced to use UUID as part of the design?

    - by Pyrolistical
    I don't really see the point of UUID. I know the probability of a collision is effectively nil, but effectively nil is not even close to impossible. Can somebody give an example where you have no choice but to use UUID? From all the uses I've seen, I can see an alternative design without UUID. Sure the design might be slightly more complicated, but at least it doesn't have a non-zero probability of failure. UUID smells like global variables to me. There are many ways global variables make for simpler design, but its just lazy design.

    Read the article

  • PHP + GD: imagetruecolortopalette not keeping transparency

    - by AlexMax
    I am using GD to output an image that is a truecolor+alpha channel PNG file using imagepng just fine. However, I would like to have the ability to also output an ie6-compatible 256-color PNG as well. According to the official documentation for imagetruecolortopalette: The code has been modified to preserve as much alpha channel information as possible in the resulting palette, in addition to preserving colors as well as possible. However, I am finding that the results of this function do not properly preserve any transparency at all. I used this firefox image with text superimposed on top of it as a test, and all the function did was give me a white background and a weird dark blue border. I know that I can't hope to preserve the full alpha channel, but surely this function would at least pick up on the transparent background. Is there something I'm missing? Are there any alternative approaches that I can take?

    Read the article

  • Implementing OFX specification with javascript

    - by John Langston
    Hey all, I am working on a personal project and need to retrieve financial data. After looking around how this is normally done it seems you can pay lots of money and license a service like Yodlee to get this data for you or you can implement a OFX client like wesabe has to communicate with financial institutions. Seeing as I don't have lots of money and wouldn't mind the challenge I decided to try to implement the ofx spec (unless one of you can suggest a cheap/free alternative!). I looked around for some ofx libraries other people have already written for use but didn't find anything that looked too great. I was wondering if anyone knew if it would be a bad idea to attempt this in Javascript (using XMLSocket from actionscript to handle the actual socket communication). If there is some really bad reason why I shouldn't do this please bring it up. If there is I'll just do it in Java but I think it would be neat to have it completely in javascript so it runs client-side. Anyways I was hoping for some helpful input, thanks.

    Read the article

  • Java and gstreamer-java initialisation error

    - by Mark
    I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA. I would like to include a check in the code, to see whether the gstreamer library has been initialised. When I have left the "Gst.init()" code out (to mimic when the library has not been initialised correctly), the application throws out the following messages: (process:21888): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function (process:21888): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed The app calls the gstreamer-java library. The error messages appear but the thread continues to run, hogging the CPU. Is there any way to catch the error or to add a check to prevent it from happening? An alternative would be to put the "Gst.init()" in the main class, but I am not sure if this would always guarantee the gstreamer library is initialised.

    Read the article

  • accessing google maps via UIWebView - illegal?

    - by Karin
    New to iPhone development. Working on first app. I'm accessing google maps via UIWebView to forward geocode an address using "http://maps.google.com/maps?q=my address". It works, although it has this quirk of requiring you to hit "Back" button and then the "Detail" button (provided by the navigation bar) to get back to the screen from whence you started. If anyone knows why it does this, I'd love to hear. My real question, however, is this a legal use of google maps? Since I intend this app for commercial use, am I violating Google's rules + regs? If it is illegal, what's my alternative? Thanks.

    Read the article

  • Display Message if Flash Doesn't Show in IE8

    - by aarontb
    Okay...so apparently with the new update in IE8, it starts up with NO add-ons. Since I cannot program a code to turn on add-ons in a browser, I need to show a message when this occurs. Much like an image has alternative text in the event the image doesn't load...how can I add a message that states: You are using Internet Explorer 8+ and need to turn on your add-ins like FLASH Player. This site is optimized for Mozilla Firefox or Google Chrome. ANy suggestions?

    Read the article

  • Understanding Thread/BeginInvoke? [beginner]

    - by Moberg
    Consider the code: class Work { public void DoStuff(string s) { Console.WriteLine(s); // .. whatever } } class Master { private readonly Work work = new Work(); public void Execute() { string hello = "hello"; // (1) is this an ugly hack ? var thread1 = new Thread(new ParameterizedThreadStart(o => this.work.DoStuff((string)o))); thread1.Start(hello); thread1.Join(); // (2) is this similar to the one above? new Action<string>(s => this.work.DoStuff(s)).BeginInvoke(hello, null, null); } } Is (1) an acceptable way of easy starting some work in a seperate thread? If not a better alternative would be much appreciated. Is (2) doing the same? I guess what I ask is if a new thread is started, or.. Hope you can help a beginner to a better understanding :) /Moberg

    Read the article

  • Generating short license keys with OpenSSL

    - by Marc Charbonneau
    I'm working on a new licensing scheme for my software, based on OpenSSL public / private key encryption. My past approach, based on this article, was to use a large private key size and encrypt an SHA1 hashed string, which I sent to the customer as a license file (the base64 encoded hash is about a paragraph in length). I know someone could still easily crack my application, but it prevented someone from making a key generator, which I think would hurt more in the long run. For various reasons I want to move away from license files and simply email a 16 character base32 string the customer can type into the application. Even using small private keys (which I understand are trivial to crack), it's hard to get the encrypted hash this small. Would there be any benefit to using the same strategy to generated an encrypted hash, but simply using the first 16 characters as a license key? If not, is there a better alternative that will create keys in the format I want?

    Read the article

  • Trying to parse xml, but xmldocument.loadxml() is trying to download?

    - by maxp
    I have a string input that i do not know whether or not is valid xml. I think the simplest aprroach is to wrap new XmlDocument().LoadXml(strINPUT); In a try/catch. The problem im facing is, sometimes strINPUT is an html file, if the header of this file contains <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""> <html xml:lang=""en-GB"" xmlns=""http://www.w3.org/1999/xhtml"" lang=""en-GB""> ...like many do, it actually tries to make a connection to the w3.org url, which i really dont want it doing. Anyone know if its possible to just parse the string without trying to be clever and checking external urls? Failing that is there an alternative to xmldocument?

    Read the article

  • What risks are there in using extracted PHP superglobals?

    - by Zephiro
    Hola usando estas funciones, que riesgo corro en tener problemas de seguridad, es necesesario usar extract() o hay alguna manera mejor de convertir las variables superglobales (array) en trozos de variables. Good, there is some risk in using the function extract in the superglobal variables as $_POS and $_GET, I work of the following way. There is risk of SQL INJECTION or there is an alternative to extract if ( get_magic_quotes_gpc() ) { $_GET = stripslashes( $_GET ); $_POST =stripslashes( $_POST ); } function vars_globals($value = '') { if (is_array ( $value )) $r = &$value; else parse_str ( $value, $r ); return $r; } $r = vars_globals( $_GET ); extract($r, EXTR_SKIP);

    Read the article

  • Build a JavaScript wrapper for a rails-generated XML API?

    - by Thor Thurn
    I am working with a large website written in Ruby on Rails. Thanks to the support for REST in Rails 2, the site's business logic is all accessible via a consistent XML API. Now I want to be able to easily write one or more JavaScript frontends to the site that interact with the generated Rails XML API. Ideally, an automated wrapper for the API could be created in JavaScript, since this would minimize the effort required in writing XML processing code for the more than 500 API functions. How, then, can I automatically generate a wrapper around a given XML API in JavaScript so that it's more pleasant to work with? I've worked with solutions of this nature for Java that generate classes and methods to wrap an API, so my current thinking is that I want something of that nature for JavaScript. I'd be open to an alternative take on the problem, though.

    Read the article

  • Useful ways for multilanguage navigation and static content on your site?

    - by vitto
    Hi, I have a big site running under Apache and PHP and in few mounths I should consider to add some different language version of it, but I'm not sure about the right way (or ways). My problem it isn't the user data, because I can use db tables with different languages (en, de, it, etc.) so I want concentrate my answer on navigation and static content. For now I can't use gettext because I don't have a dedicated server and I can't reboot it every time I want, but surely will be a future choice. So my main problems are these: In the site, I have classical XHTML elements like the menus, lists, div and various static texts in various pages (should be perferct for gettext, but I need a alternative) The other part of the sites has XHTML elements which are dynamically created via AJAX and jQuery, and here I haven't any idea of what can I do... So does exists some example I can see in some link to solve it (or some useful tecnique)?

    Read the article

  • An Efficient data structure for Sorted List

    - by holydiver
    I want to save my objects according to a key in the attributes of my object in a sorted fashion. Later on I'll access these objects sequentially from max key to min key. I'll do some search tasks as well. I consider to use either AVL tree or RB Tree. As far as i know they are nearly equivalent in theory(Both have O(logn)). But in practice which one might be better in performance in my situation. And is there a better alternative than those, considering that I'll mostly do insert and sequentially access to the ds.

    Read the article

  • AddThis Social SignIn and Django

    - by piokuc
    I am developing a Django website. I've been using django-registration for user registration so far but I would really like to allow users to login to my site using their Facebook, Twitter, Google, etc accounts. I am using addthis sharing buttons. I just noticed they introduced a social sign in solution. The idea seems great, you integrate your authentication system with their service once, and your users can login via all of the popular social networking sites. Has anybody integrated addthis social signin plugin with a django website? How can you use it along side django-registration? Are there any similar, alternative solutions?

    Read the article

  • Password reset by email without a database table

    - by jpatokal
    The normal flow for resetting a user's password by mail is this: Generate a random string and store it in a database table Email string to user User clicks on link containing string String is validated against database; if it matches, user's pw is reset However, maintaining a table and expiring old strings etc seems like a bit of an unnecessary hassle. Are there any obvious flaws in this alternative approach? Generate a MD5 hash of the user's existing password Email hash string to user User clicks on link containing string String is validated by hashing existing pw again; if it matches, user's pw is reset Note that the user's password is already stored in a hashed and salted form, and I'm just hashing it once more to get a unique but repeatable string. And yes, there is one obvious "flaw": the reset link thus generated will not expire until the user changes their password (clicks the link). I don't really see why this would be a problem though -- if the mailbox is compromised, the user is screwed anyway.

    Read the article

  • Magento Flash + XML frontend

    - by Nick Dima
    Hi guys, I'm working on a Flash frontend for a Magento powered store. This frontend will be an alternative to the HTML shop so it will sit in a subdirectory and use the same Magento installation as the main HTML site. The Flash application will get the data from dynamic XML files. It needs to get almost everything as the HTML site (categories, products, cart, etc). I want this to be a Magento module that can be installed on an already existing Magento installation. I would like to use the Block classes available in Magneto's core code as they already provide a lot of the functionality needed. What steps would you take in order to achieve this? Do you know any examples or articles related to this? Thanks!

    Read the article

  • Vim 80 column layout concerns

    - by cdleary
    I feel like the way I do 80-column indication in Vim is incorrect: set columns=80. At times I also set textwidth but I like to be able to see and anticipate line overflow with the set columns alternative. This has some unfortunate side effects -- I can't set number for fear of splitting between files that have different orders of line numbers; i.e. < 100 line files and = 100 line files will require two different set columns values because of the extra column used for the additional digit display. I also start new (g)Vim sessions instead of splitting windows vertically, which forces me to use the window manager's clipboard -- vsplits force me to do set columns every time I open or close a pane, so starting a new session is less hassle. How do you handle the 80-character indication when you want to set numbers, vertically split, etc.?

    Read the article

  • The sieve of Eratosthenes in F#

    - by IVlad
    I am interested in an implementation of the sieve of eratosthenes in purely functional F#. I am interested in an implementation of the actual sieve, not the naive functional implementation that isn't really the sieve, so not something like this: let rec PseudoSieve list = match list with | hd::tl -> hd :: (PseudoSieve <| List.filter (fun x -> x % hd <> 0) tl) | [] -> [] The second link above briefly describes an algorithm that would require the use of a multimap, which isn't available in F# as far as I know. The Haskell implementation given uses a map that supports an insertWith method, which I haven't seen available in the F# functional map. Does anyone know a way to translate the given Haskell map code to F#, or perhaps knows of alternative implementation methods or sieving algorithms that are as efficient and better suited for a functional implementation or F#?

    Read the article

  • Can 3D OpenGL game written in Python look good and run fast?

    - by praavDa
    I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). When I was planning what to do, I started wondering about switching to Python. I know that Python didn't come into existence to be a tool to write 3d games, but is it possible to write good looking games with this language? I have in mind 3d graphics, nice effects and free CPU time to power to rest of game engine? I had seen good looking java games - and too be honest, I was rather shocked when I saw level of detail achieved in Runescape HD. On the other hand, pygame.org has only 2d games, with some starting 3d projects. Are there any efficient 3d game engines for python? Is pyopengl the only alternative? Good looking games in python aren't popular or possible to achieve? I would be grateful for any information / feedback.

    Read the article

  • If terminating a hung thread is a good idea, how do I do it safely?

    - by Steve
    My Delphi program relies heavily on Outlook automation. Outlook versions prior to 2007-SP2 tend to get stuck in memory due to badly written addins and badly written Outlook code. If Outlook is stuck, calling CreateOleObject('Outlook.Application') or GetActiveObject ... doesn't return and keeps my application hanging till Outlook.exe is closed in the task manager. I've thought of a solution, but I'm unsure whether it's good practice or not. I'd start Outlook with CreateOleObject in a separate thread, wait 10 seconds in my main thread and if Outlook hangs (CreateOleObject doesn't return), offer the user to kill the Outlook.exe process from my program. But since I don't want to force the user to kill the Outlook.exe process, as an alternative I also need a way to kill the new thread in my program which keeps hanging now. Is this good practice? How can I terminate a hanging thread in Delphi without leaking memory?

    Read the article

  • How can I make a read only version of a class?

    - by Eric
    I have a class with various public properties which I allow users to edit through a property grid. For persistence this class is also serialized/deserialized to/from an XML file through DataContractSerializer. Sometimes I want to user to be able to save (serialize) changes they've made to an instance of the class. Yet at other times I don't want to allow the user to save their changes, and should instead see all the properties in the property grid as read only. I don't want to allow users to make changes that they'll never be able to save later. Similar to how MS Word will allow users to open documents that are currently opened by someone else but only as read only. My class has a boolean property that determines if the class should be read-only, but is it possible to use this property to somehow dynamically add a read-only attributes to the class properties at run-time? If not what is an alternative solution? Should I wrap my class in a read-only wrapper class?

    Read the article

  • Use Google AppEngine datastore outside of AppEngine project

    - by Holtwick
    For my little framework Pyxer I would like to to be able to use the Google AppEngine datastores also outside of AppEngine projects, because I'm now used to this ORM pattern and for little quick hacks this is nice. I can not use Google AppEngine for all of my projects because of its's limitations in file size and number of files. A great alternative would also be, if there was a project that provides an ORM with the same naming as the AppEngine datastore. I also like the GQL approach very much, since this is a nice combination of ORM and SQL patterns. Any ideas where or how I might find such a solution? Thanks.

    Read the article

  • Variadic functions and arguments assignment in C/C++

    - by Rizo
    I was wondering if in C/C++ language it is possible to pass arguments to function in key-value form. For example in python you can do: def some_function(arg0 = "default_value", arg1): # (...) value1 = "passed_value" some_function(arg1 = value1) So the alternative code in C could look like this: void some_function(char *arg0 = "default_value", char *arg1) { ; } int main() { char *value1 = "passed_value"; some_function(arg1 = value1); return(0); } So the arguments to use in some_function would be: arg0 = "default_value" arg1 = "passed_value" Any ideas?

    Read the article

< Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >