Daily Archives

Articles indexed Wednesday April 14 2010

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

  • String comparison with a collation in javascript

    - by fsb
    I use jquery.autocomplete, which uses a javascript regexp to highlight substrings in the list of suggestions that match the autocomplete key string. So if the use types "Beat" and one of the autocomplete suggestions the server returns is "The Beatles" then plugin displays that suggestion as "The Beatles". I'm trying to think of ways to make this work with string matching that isn't sensitive to accents, diacriticals and the rest. So if the user typed "Huske" and the server suggested "Hüsker Dü" then this would be displayed as "Hüsker Dü". The principle is the same as string comparison with specified collations such as in MySql or ICU, or with Oracle's sorts. In SphinxSearch a charset_table works for this. A collation such as utf8_general_ci would be ideal for my purposes.

    Read the article

  • Javascript redeclared global variable overrides old value

    - by Yousuf Haider
    I ran into an interesting issue the other day and was wondering if someone could shed light on why this is happening. Here is what I am doing (for the purposes of this example I have dumbed down the example somewhat): I am creating a globally scoped variable using the square bracket notation and assigning it a value. Later I declare a var with the same name as the one I just created above. Note I am not assigning a value. Since this is a redeclaration of the same variable the old value should not be overriden as described here: http://www.w3schools.com/js/js_variables.asp //create global variable with square bracket notation window['y'] = 'old'; //redeclaration of the same variable var y; if (!y) y = 'new'; alert(y); //shows New instead of Old The problem is that the old value actually does get overriden and in the above eg. the alert shows 'new' instead of 'old'. Why ? I guess another way to state my question is how is the above code different in terms of semantics from the code below: //create global variable var y = 'old'; //redeclaration of the same variable var y; if (!y) y = 'new'; alert(y); //shows Old

    Read the article

  • I do I iterate the records in a database using LINQ when I have already built the LINQ DB code?

    - by Seth Spearman
    I asked on SO a few days ago what was the simplest quickest way to build a wrapper around a recently completed database. I took the advice and used sqlmetal to build linq classes around my database design. Now I am having two problems. One, I don't know LINQ. And, two, I have been shocked to realize how hard it is to learn. I have a book on LINQ (Linq In Action by Manning) and it has helped some but at the end of the day it is going to take me a couple of weeks to get traction and I need to make some progress on my project today. So, I am looking for some help getting started. Click HERE To see my simple database schema. Click HERE to see the vb class that was generated for the schema. My needs are simple. I have a console app. The main table is the SupplyModel table. Most of the other tables are child tables of the SupplyModel table. I want to iterate through each of Supply Model records. I want to grab the data for a supply model and then DoStuff with the data. And I also need to iterate through the child records, for each supply model, for example the NumberedInventories and DoStuff with that as well. I want to only iterate the SupplyModels that are have IDs that are in an array of strings containing the IDs. I need help doing this in VB rather than C# if possible. Thanks for your help. Seth

    Read the article

  • Error in ASP.NET MVC 2 View after Upgrading from ASP.NET 4.0 RC to RTM

    - by Chris
    In my View, I am trying to loop through a list in a LINQ object that as part of my View Model. This worked fine earlier today with the VS2010 RC and the .NET 4.0 RC. <% if (Model.User.RoleList.Count > 0 ) { %> <% foreach (var role in Model.User.RoleList) { %> <%: role.Name %><br /> <% } %> <% } else { %> <em>None</em><br /> <% } %> It used to happily spew out a list of the role names. No data or code has changed. Simply the software upgrades from RC to RTM. The error I am getting is this: \Views\Users\Details.aspx(67): error CS0012: The type 'System.Data.Linq.EntitySet`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. But System.Data.Linq IS referenced. I see it there in the references list. I tried deleting it and re-adding it but I get the same error. Any ideas?

    Read the article

  • Code Golf: Numeric Equivalent of an Excel Column-Name

    - by Vivin Paliath
    Can you figure out the numeric equivalent of an Excel column string in the shortest-possible way, using your favorite language? For example, the A column is 1, B is 2, so on and so forth. Once you hit Z, the next column becomes AA, then AB and so on. Rules: Here is some sample input and output: A: 1 B: 2 AD: 30 ABC: 731 WTF: 16074 ROFL: 326676 I don't know if the submitter is allowed to post a solution, but I have a Perl solution that clocks in at 125 characters :).

    Read the article

  • Why could cause the keypad backlights to spontaneously illuminate on my Palm Treo?

    - by LeopardSkinPillBoxHat
    I have a Palm Treo 680 smart phone. I have noticed recently that when the phone is turned off, the keypad backlights will spontaneously illuminate. This is particularly annoying because it drains the battery life of the Treo -- when I woke up this morning, the battery was completely flat and I had to plug it in to wake it up again. I suspect that this has something to do with the Energy Dimmer application (I have version 2.16 installed). I have disabled this application today to see if it makes the problem go away. Has anyone else had this problem, and do you have any solutions?

    Read the article

  • How to convert Castle Windsor fluent config to xml

    - by Jonathas Costa
    I would like to convert this fluent approach to xml: container.Register( AllTypes.FromAssemblyNamed("Company.DataAccess") .BasedOn(typeof(IReadDao<>)).WithService.FromInterface(), AllTypes.FromAssemblyNamed("Framework.DataAccess.NHibernateProvider") .BasedOn(typeof(IReadDao<>)).WithService.Base()); Is there any way of doing this, maintaining the simplicity?

    Read the article

  • What is the fastest collection in c# to implement a prioritizing queue?

    - by Nathan Smith
    I need to implement a queue for messages on a game server so it needs to as fast as possible. The queue will have a maxiumem size. I need to prioritize messages once the queue is full by working backwards and removing a lower priority message (if one exists) before adding the new message. The appliation is asynchronous so access to the queue needs to be locked. I'm currently implementing it using a LinkedList as the underlying storage but have concerns that searching and removing nodes will keep it locked for too long. Heres the basic code I have at the moment: public class ActionQueue { private LinkedList<ClientAction> _actions = new LinkedList<ClientAction>(); private int _maxSize; /// <summary> /// Initializes a new instance of the ActionQueue class. /// </summary> public ActionQueue(int maxSize) { _maxSize = maxSize; } public int Count { get { return _actions.Count; } } public void Enqueue(ClientAction action) { lock (_actions) { if (Count < _maxSize) _actions.AddLast(action); else { LinkedListNode<ClientAction> node = _actions.Last; while (node != null) { if (node.Value.Priority < action.Priority) { _actions.Remove(node); _actions.AddLast(action); break; } } } } } public ClientAction Dequeue() { ClientAction action = null; lock (_actions) { action = _actions.First.Value; _actions.RemoveFirst(); } return action; } }

    Read the article

  • JQTOUCH - Anytime loading occurs, add a loading class?

    - by nobosh
    Hi, I'm using JQTOUCH and in JQTOUCH several of the links are being loading via AJAX and then sliding in. The problem is that there is no loading indication provided to users. I'd like a way to add a Loading class with an AJAX spinner, when ever the an ajax call is loading, and have the class removed when the loading is done, and the page is displayed. Any ideas?

    Read the article

  • Problems with retrieving the correct cookie in Java

    - by Spines
    When I retrieve the cookies in my java servlet, all of the values from getPath() are null. So if a cookie with the same name is set in directory /foo, and at the root directory, I retrieve two cookies with the same exact name, but I can't differentiate them because getPath() returns null for both. I looked in firebug and saw that firefox was not sending anythign for the path. My application uses a "rememberme" cookie with the path set to "/". Everything works fine as long as there is only one cookie with name rememberme. But if somehow another cookie gets set with the same name on a different path like /foo, then my application won't know which one is the one I set for the root. How can I differentiate the cookies? Do I need to worry about a cookie existing with the same name in a subdir, or can I just assume there will be only the one I set?

    Read the article

  • Order of calls to set functions when invoking a flex component

    - by Jason
    I have a component called a TableDataViewer that contains the following pieces of data and their associated set functions: [Bindable] private var _dataSetLoader:DataSetLoader; public function get dataSetLoader():DataSetLoader {return _dataSetLoader;} public function set dataSetLoader(dataSetLoader:DataSetLoader):void { trace("setting dSL"); _dataSetLoader = dataSetLoader; } [Bindable] private var _table:Table = null; public function set table(table:Table):void { trace("setting table"); _table = table; _dataSetLoader.load(_table.definition.id, "viewData", _table.definition.id); } This component is nested in another component as follows: <ve:TableDataViewer width="100%" height="100%" paddingTop="10" dataSetLoader="{_openTable.dataSetLoader}" table="{_openTable.table}"/> Looking at the trace in the logs, the call to set table is coming before the call to set dataSetLoader. Which is a real shame because set table() needs dataSetLoader to already be set in order to call its load() function. So my question is, is there a way to enforce an order on the calls to the set functions when declaring a component?

    Read the article

  • coding an array in a class library and make a call to it C#

    - by eddy
    I'm new to C#, so this may be a basic question. What I need to do is put an array such as the one below in a class library and then make a call to it. So I'd want the aproprate picture to appear via the class and this array. I know there's a much simpler way to make certain pictures appear, but this is a requirement for the project. It's an asp.NET website in C#. string[] PictureArray; PictureArray = new string[3]; PictureArray[0] = "~/pics/grl.jpg"; PictureArray[1] = "~/pics/pop.jpg"; PictureArray[2] = "~/pics/str.jpg"; PictureArray[3] = "~/pics/unk.jpg";

    Read the article

  • Proving that the distance values extracted in Dijkstra's algorithm is non-decreasing?

    - by Gail
    I'm reviewing my old algorithms notes and have come across this proof. It was from an assignment I had and I got it correct, but I feel that the proof certainly lacks. The question is to prove that the distance values taken from the priority queue in Dijkstra's algorithm is a non-decreasing sequence. My proof goes as follows: Proof by contradiction. Fist, assume that we pull a vertex from Q with d-value 'i'. Next time, we pull a vertex with d-value 'j'. When we pulled i, we have finalised our d-value and computed the shortest-path from the start vertex, s, to i. Since we have positive edge weights, it is impossible for our d-values to shrink as we add vertices to our path. If after pulling i from Q, we pull j with a smaller d-value, we may not have a shortest path to i, since we may be able to reach i through j. However, we have already computed the shortest path to i. We did not check a possible path. We no longer have a guaranteed path. Contradiction.

    Read the article

  • CAKeyframeAnimation - Examples

    - by Brian
    I have a a menu that is a CALayer that will slide across the screen to a given point. I want the effect where the menu will go a little past the point, then a little before the point, and then land on the point. I can move the menu by applying a transform, but I was hoping to get this bouncing effect to work. I was looking into CAKeyframeAnimation, but I'm having trouble locating an example/tutorial. Any links or help would be great. Thanks.

    Read the article

  • Flip <canvas> (rotate 180deg) after being published on page.

    - by smallmeans
    I'm trying to rotate a canvas element AFTER it's been appended to the DOM. Canvas is 600x50 and this is the code at hand: var canvas = document.getElementsByTagName('canvas')[2]; var ctx = canvas.getContext('2d'); ctx.translate(300, 25); // rotate @ center ctx.rotate(angle * Math.PI/180); which isn't accomplishing the task. Am I missing something? Thanks

    Read the article

  • Announcing the Winnipeg Visual Studio.NET 2010 Launch Event!

    - by D'Arcy Lussier
    That’s right Winnipeg, we’re having our own Visual Studio.NET 2010 launch event on May 11th brought to you by your local Winnipeg .NET User Group, Anvil Digital, Imaginet, Microsoft, and Protegra! We’re excited to bring a day of sessions highlighting developer productivity, application lifecycle management, and web development using these new technologies! We’re also thrilled to have this event at the IMAX Theatre at Portage Place! The day looks like this: The event is FREE and we’re providing a continental breakfast for attendees. To register for the event, visit our registration site here. If you have any questions, please contact me through comments on this post or via email through my blog. D’Arcy

    Read the article

  • Sending data from one Protocol to another Protocol in Twisted?

    - by veb
    Hi! One of my protocols is connected to a server, and with the output of that I'd like to send it to the other protocol. I need to access the 'msg' method in ClassA from ClassB but I keep getting: exceptions.AttributeError: 'NoneType' object has no attribute 'write' Actual code: http://pastebin.com/MQPhduSY Any ideas please? :-)

    Read the article

  • Prototype/scriptaculous browser compatibility

    - by xain
    Hi, I developed a page using the latest prototype and scriptaculous versions and after cleaning it up thoroughly, the only browser where my scripts work is ... chrome! Some things don't work at all with ie7(eg BlindUp), and some validations fail with ie8 and firefox 3.5. Any success stories to contradict this ? (Any tips will be appreciated).

    Read the article

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