Search Results

Search found 369 results on 15 pages for 'jonas anderson'.

Page 8/15 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Searching a set of data with multiple terms using Linq

    - by Cj Anderson
    I'm in the process of moving from ADO.NET to Linq. The application is a directory search program to look people up. The users are allowed to type the search criteria into a single textbox. They can separate each term with a space, or wrap a phrase in quotes such as "park place" to indicate that it is one term. Behind the scenes the data comes from a XML file that has about 90,000 records in it and is about 65 megs. I load the data into a DataTable and then use the .Select method with a SQL query to perform the searches. The query I pass is built from the search terms the user passed. I split the string from the textbox into an array using a regular expression that will split everything into a separate element that has a space in it. However if there are quotes around a phrase, that becomes it's own element in the array. I then end up with a single dimension array with x number of elements, which I iterate over to build a long query. I then build the search expression below: query = query & _ "((userid LIKE '" & tempstr & "%') OR " & _ "(nickname LIKE '" & tempstr & "%') OR " & _ "(lastname LIKE '" & tempstr & "%') OR " & _ "(firstname LIKE '" & tempstr & "%') OR " & _ "(department LIKE '" & tempstr & "%') OR " & _ "(telephoneNumber LIKE '" & tempstr & "%') OR " & _ "(email LIKE '" & tempstr & "%') OR " & _ "(Office LIKE '" & tempstr & "%'))" Each term will have a set of the above query. If there is more than one term, I put an AND in between, and build another query like above with the next term. I'm not sure how to do this in Linq. So far, I've got the XML file loading correctly. I'm able to search it with specific criteria, but I'm not sure how to best implement the search over multiple terms. 'this works but far too simple to get the job done Dim results = From c In m_DataSet...<Users> _ Where c.<userid>.Value = "XXXX" _ Select c The above code also doesn't use the LIKE operator either. So partial matches don't work. It looks like what I'd want to use is the .Startswith but that appears to be only in Linq2SQL. Any guidance would be appreciated. I'm new to Linq, so I might be missing a simple way to do this. The XML file looks like so: <?xml version="1.0" standalone="yes"?> <theusers> <Users> <userid>person1</userid> <nickname></nickname> <lastname></lastname> <firstname></firstname> <department></department> <telephoneNumber></telephoneNumber> <email></email> </Users> <Users> <userid>person2</userid> <nickname></nickname> <lastname></lastname> <firstname></firstname> <department></department> <telephoneNumber></telephoneNumber> <email></email> </Users>

    Read the article

  • How to store an object in Riak with the Java client?

    - by Jonas
    I have setup Riak on a Ubuntu machine, and it seam to work if I do riak ping. Now I would like to use the Riak Java client to store an object, but it doesn't work. I get com.basho.riak.client.response.RiakIORuntimeException when I try to store an object. What am I doing wrong? Is there a way to test if I can access riak from my java client? Do I have to create a Bucket first? how? import com.basho.riak.client.RiakClient; import com.basho.riak.client.RiakObject; import com.basho.riak.client.response.FetchResponse; public class RiakTest { public static void main(String[] args) { // connect RiakClient riak = new RiakClient("http://192.168.1.107:8098/riak"); // create object RiakObject o = new RiakObject("mybucket", "mykey", "myvalue"); // store riak.store(o); } }

    Read the article

  • Is there a way to declare a variable that implements multiple interfaces in .Net?

    - by Bryan Anderson
    Similar to this Java question. I would like to specify that a variable implements multiple interfaces. For instance private {IFirstInterface, ISecondInterface} _foo; public void SetFoo({IFirstInterface, ISecondInterface} value) { _foo = value; } Requirements: I don't have the ability to add an interface to most type that would be passed in to Foo. So I can't create a third interface that inherits from IFirstInterface and ISecondInterface. I would like to avoid making the containing class generic if possible because the type of Foo doesn't have much to do with the class and the user isn't likely to know it at compile time. I need to use foo to access methods in both interfaces at a later time. I would like to do this in a compiler safe way, i.e. no trying to cast to the interface just before trying to use it. If foo does not implement both interfaces quite a bit of functionality won't work properly. Is this possible?

    Read the article

  • SQL 2005 Express Edition - Install new instance

    - by Douglas Anderson
    Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. Executing the command in my installer is not the issue, it's more a matter of dragging around the 40 MBs of MS-SQL installer that I don't need if they have SQL Express already installed. This is what my installer currently executes: SQLEXPR32.EXE /qb ADDLOCAL=ALL INSTANCENAME=<instancename> SECURITYMODE=SQL SAPWD=<password> SQLAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 I don't need assistance with launching this command, rather the appropriate way to add a new instance of SQL 2005 Express without actually running the full installer again. I'd go into great detail about why I want to do this but I'd simply bore everyone. Suffice to say, having this ability to create a new instance without the time it takes to reinstall SQL Express etc. would greatly assist me for the deployment of my application and it's installer. If makes any difference to anyone, I'm using a combination of NSIS and Advanced Installer for this installation project.

    Read the article

  • List<T> and IEnumerable difference

    - by Jonas Elfström
    While implementing this generic merge sort, as a kind of Code Kata, I stumbled on a difference between IEnumerable and List that I need help to figure out. Here's the MergeSort public class MergeSort<T> { public IEnumerable<T> Sort(IEnumerable<T> arr) { if (arr.Count() <= 1) return arr; int middle = arr.Count() / 2; var left = arr.Take(middle).ToList(); var right = arr.Skip(middle).ToList(); return Merge(Sort(left), Sort(right)); } private static IEnumerable<T> Merge(IEnumerable<T> left, IEnumerable<T> right) { var arrSorted = new List<T>(); while (left.Count() > 0 && right.Count() > 0) { if (Comparer<T>.Default.Compare(left.First(), right.First()) < 0) { arrSorted.Add(left.First()); left=left.Skip(1); } else { arrSorted.Add(right.First()); right=right.Skip(1); } } return arrSorted.Concat(left).Concat(right); } } If I remove the .ToList() on the left and right variables it fails to sort correctly. Do you see why? Example var ints = new List<int> { 5, 8, 2, 1, 7 }; var mergeSortInt = new MergeSort<int>(); var sortedInts = mergeSortInt.Sort(ints); With .ToList() [0]: 1 [1]: 2 [2]: 5 [3]: 7 [4]: 8 Without .ToList() [0]: 1 [1]: 2 [2]: 5 [3]: 7 [4]: 2 Edit It was my stupid test that got me. I tested it like this: var sortedInts = mergeSortInt.Sort(ints); ints.Sort(); if (Enumerable.SequenceEqual(ints, sortedInts)) Console.WriteLine("ints sorts ok"); just changing the first row to var sortedInts = mergeSortInt.Sort(ints).ToList(); removes the problem (and the lazy evaluation). EDIT 2010-12-29 I thought I would figure out just how the lazy evaluation messes things up here but I just don't get it. Remove the .ToList() in the Sort method above like this var left = arr.Take(middle); var right = arr.Skip(middle); then try this var ints = new List<int> { 5, 8, 2 }; var mergeSortInt = new MergeSort<int>(); var sortedInts = mergeSortInt.Sort(ints); ints.Sort(); if (Enumerable.SequenceEqual(ints, sortedInts)) Console.WriteLine("ints sorts ok"); When debugging You can see that before ints.Sort() a sortedInts.ToList() returns [0]: 2 [1]: 5 [2]: 8 but after ints.Sort() it returns [0]: 2 [1]: 5 [2]: 5 What is really happening here?

    Read the article

  • Maven Tutorial that Covers a Complete Project Lifecycle

    - by Jonas Laufu
    Can anyone point to a maven tutorial / how-to that covers everything that is normally required during an OSS project: project creation, sources, build, test, integration in SCM, etc, deployment to one's own repository, release creation and upload? I have been able to gather all this information from ten different sources, but it is not easy to get the complete picture because every source expects a different state of existing knowledge.

    Read the article

  • ANDing javascript objects together

    - by Jonas
    I ran across this chunk of code (modified) in our application, and am confused to how it works: function someObject() { this.someProperty = {}; this.foo = { bar: { baz: function() { return "Huh?" } } }; this.getValue = function() { return (this.someProperty && this.foo.bar && this.foo.bar.baz && this.foo.bar.baz()) || null; } } function test() { var o = new someObject(); var val = o.getValue(); alert(val); } when you call the test() function, the text "Huh?" is alerted. I'm not sure how the result of getValue is returning that, I would've thought doing A && B && C && D would have returned true, rather than the value of D.

    Read the article

  • Passing youtube video id from video feed to flash

    - by Grant Anderson
    I'm working on a flash web application (Actionscript 2.0) for my honours project but am having trouble embedding youtube videos. Basically the user selects symbols which queries the youtube api with certain tags depending on the symbols chosenand a random video is then picked from the first 30 videos. I have this working using the following code: on (release) { url="http://gdata.youtube.com/feeds/api/videos?q=danger+passion&orderby=published&start-index="+random(30)+"&max-results=1&v=2" getURL(url); } but this just displays a webpage with a link to the youtube video. This is the code I'll be using as the foundations for the player: // create a MovieClip to load the player into var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1); // create a listener object for the MovieClipLoader to use var ytPlayerLoaderListener:Object = { onLoadInit: function() { // When the player clip first loads, we start an interval to // check for when the player is ready loadInterval = setInterval(checkPlayerLoaded, 250); } }; var loadInterval:Number; function checkPlayerLoaded():Void { // once the player is ready, we can subscribe to events, or in the case of // the chromeless player, we could load videos if (ytplayer.isPlayerLoaded()) { ytplayer.addEventListener("onStateChange", onPlayerStateChange); ytplayer.addEventListener("onError", onPlayerError); clearInterval(loadInterval); } } function onPlayerStateChange(newState:Number) { trace("New player state: "+ newState); } function onPlayerError(errorCode:Number) { trace("An error occurred: "+ errorCode); } // create a MovieClipLoader to handle the loading of the player var ytPlayerLoader:MovieClipLoader = new MovieClipLoader(); ytPlayerLoader.addListener(ytPlayerLoaderListener); // load the player ytPlayerLoader.loadClip("http://www.youtube.com/v/pv5zWaTEVkI", ytplayer); can anyone help me on how to get the id of the video (for example: pv5zWaTEVkI) from the feed? Or how to send a query from flash which will return the video url/id as opposed to the url of a feed. Any help would be much appreciated as my hand in rather soon. Thanks

    Read the article

  • Matlab tutorial for programmers

    - by Jonas
    I'm getting some new students soon, who will be writing Matlab code. They're new to Matlab, but they have experience coding in Java and C++. I'm going to have them go through the 'Getting Started' section of the Matlab help. In addition, I want to give a small tutorial with the goal to prevent them from making some of the most common mistakes people make when switching to Matlab ("Matlab starts counting at 1"), and show them some features that they may not be aware of when coming from other languages ("you can subtract a scalar directly from an array, and for vectors, there's bsxfun"). What are the most important things I should tell them?

    Read the article

  • JavaScript computer algebra system

    - by Jonas
    I am looking for a simple computer algebra system (cas) for JavaScript but I can't find anything with google. I only need basic functionality: simplify expressions to some canonic form. Ability to check if two expressions are the same, i.e., a(x+y) == ax+ay parse mathematical formulas. I want it to be able to read expressions like ax²+4x. solve simple equations etc. Do you know of such a library?

    Read the article

  • How can I avoid properties being reset at design-time in tightly bound user controls?

    - by David Anderson
    I have UserControl 'A' with a label, and this property: /// <summary> /// Gets or Sets the text of the control /// </summary> [ Browsable(true), EditorBrowsable(EditorBrowsableState.Always), Category("Appearance") ] public override string Text { get { return uxLabel.Text; } set { uxLabel.Text = value; } } I then have UserControl 'B' which has UserControl 'A' on it, and I set the Text Property to "My Example Label" in the designer. Then, I have my MainForm, which has UserControl 'B' on it. Each time I do a build or run, the Text property of UserControl 'A' is reset to its default value. I suppose this is because since I am doing a rebuild, it rebuilds both UserControl 'A' and 'B', thus causing the problem. How can I go about a better approach to design pattern to avoid this type of behavior when working with tightly bound controls and forms in a application?

    Read the article

  • Escape characters during paste in vim

    - by Michael Anderson
    I copy stuff from output buffers into C++ code I'm working on in vim. Often this output gets stuck into strings. And it'd be nice to be able to escape all the control characters automatically rather than going back and hand editing the pasted fragment. As an example I might copy something like this: error in file "foo.dat" And need to put it into something like this std::string expected_error = "error in file \"foo.dat\"" I'm thinking it might be possible to apply a replace function to the body of the last paste using the start and end marks of the last paste, but I'm not sure how to make it fly.

    Read the article

  • Doing will_paginate pages calculation around a record

    - by Anderson De Andrade
    I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by: page = number_of_records_before_RECORD / number_of_pages + 1 Now I want to display the first item of today's events as the first item in that page. Maybe there is a way to generate page numbers around a record with negative values to get back.

    Read the article

  • How can I control the width of JTextFields in Java Swing?

    - by Jonas
    I am trying to have several JTextFields on a single row, but I don't want them to have the same width. How can I control the width and make some of them wider than others? I want that they together take up 100% of the total width, so it would be good if I could use some kind of weigthing. I have tried with .setColumns() but it doesn't make sense. Here is my code: class Row extends JComponent { public Row() { this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); JTextField fld1 = new JTextField("First field"); JTextField fld2 = new JTextField("Second field, should be longer"); JTextField fld3 = new JTextField("Short field"); JTextField fld4 = new JTextField("Another field"); fld1.setBorder(null); fld2.setBorder(null); fld3.setBorder(null); fld4.setBorder(null); fld1.setFocusable(false); fld2.setFocusable(false); fld3.setFocusable(false); fld4.setFocusable(false); fld1.setColumns(5); // makes no sense this.add(fld1); this.add(fld2); this.add(fld3); this.add(fld4); } } this.setLayout(new GridLayout(20,0)); this.add(new Row()); this.add(new Row()); this.add(new Row());

    Read the article

  • Disturbing or politically incorrect classes

    - by Jonas B
    Please don't take this seriously! - Community wikied Satire is always fun. Try to come up with the most shocking, disturbing or politically incorrect class you can think of. (But please no racism or anything seriously offensive or anything that can't be interpeted as satire). I'll go first with my example: public class Person { public bool Female; public Person(bool female) { Female = female; } public static bool operator <(Person j1, Person j2) { if (j1.Female && !j2.Female) return true; else return false; } public static bool operator >(Person j1, Person j2) { if (!j1.Female && j2.Female) return true; else return false; } public static bool operator <=(Person j1, Person j2) { if ((j1.Female == j2.Female) || (j1.Female && !j2.Female)) return true; else return false; } public static bool operator >=(Person j1, Person j2) { if ((j1.Female == j2.Female) || (!j1.Female && j2.Female)) return true; else return false; } }

    Read the article

  • Does operator new allocate on THREAD heap?

    - by Jonas Byström
    My problem seems to be this: heap data allocated by one thread (that later dies) seems to die as well. As so: Thread X: starts Thread Y: starts Thread X: ptr = new some bytes Thread X: dies Thread Y: tries to use ptr - and crashes! So far, I've only seen this problem on Darwin (Mac OS 10.5 and 10.6), but haven't tried more other platforms than Windows and Linux (Ubuntu) where it works as expected. I've had this problem for some time, so any know-how or more information about this is highly appreciated!

    Read the article

  • How to macro-ify ant targets?

    - by Jonas Byström
    I want to be able to have different targets doing nearly the same thing, as so: ant build <- this would be a normal (default) build ant safari <- building the safari target. The targets look like this: <target name="build" depends="javac" description="GWT compile to JavaScript"> <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> <classpath> <pathelement location="src"/> <path refid="project.class.path"/> </classpath> <jvmarg value="-Xmx256M"/> <arg value="${lhs.target}"/> </java> </target> <target name="safari" depends="javac" description="GWT compile to Safari/JavaScript"> <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> <classpath> <pathelement location="src"/> <path refid="project.class.path"/> </classpath> <jvmarg value="-Xmx256M"/> <arg value="${lhs.safari.target}"/> </java> </target> (Nevermind the first thought that strikes: throw out ant! That's not an option just yet.) I tried using macrodef, but got a strange error message (even though the message didn't imply it, it think it had to do with putting a target in sequential). I don't want to do ant -Dwhatever=nevermind. Any ideas?

    Read the article

  • How can I authenticate when using the Bugzilla Perl API in a script?

    - by Allan Anderson
    Working from the Bugzilla API, I've written a quick Perl script to clone a Bugzilla Product (recreating all the Components under their new Product). The Bugzilla Perl API is quite easy to use from the command line. I could have just worked on the database directly, but I wanted a longer-term solution. Another option was the webservice, but I thought I'd try using the API directly this time. The one problem I'm running into is authenticating as my Bz admin user so I can create the new components. Looking at Bugzilla's Bugzilla.pm file, I see that they just run login() from a Bugzilla::Auth object. I'm not sure how to get the username and password in there. I suppose I could just add the script to the Bugzilla admin interface... Can any of you point me in the right direction?

    Read the article

  • EADDRNOTAVAIL when binding 127.0.0.1 on localhost?

    - by Jonas Byström
    I'm getting errno==49 (EADDRNOTAVAIL) when trying to UDP-bind() to 127.0.0.1:47346 running Mac OS X on a G5 (big endian PowerPC). Is there something preventing me from doing so? I've tried other addresses and ports (192.168.1.2 and port 47346) but with no success. Here's a gdb printout of my sockaddr_in: $1 = { sin_len = 0 '\0', sin_family = 2 '\002', sin_port = 47346, sin_addr = { s_addr = 3232235778 }, sin_zero = "???\000\000??" }

    Read the article

  • How can I write System preferences with Java? Can I invoke UAC?

    - by Jonas
    How can I write system preferences with Java, using Preferences.systemRoot()? I tried with: Preferences preferences = Preferences.systemRoot(); preferences.put("/myapplication/databasepath", pathToDatabase); But I got this error message: 2010-maj-29 19:02:50 java.util.prefs.WindowsPreferences openKey VARNING: Could not open windows registry node Software\JavaSoft\Prefs at root 0x80000002. Windows RegOpenKey(...) returned error code 5. Exception in thread "AWT-EventQueue-0" java.lang.SecurityException: Could not open windows registry node Software\JavaSoft\Prefs at root 0x80000002: Access denied at java.util.prefs.WindowsPreferences.openKey(Unknown Source) at java.util.prefs.WindowsPreferences.openKey(Unknown Source) at java.util.prefs.WindowsPreferences.openKey(Unknown Source) at java.util.prefs.WindowsPreferences.putSpi(Unknown Source) at java.util.prefs.AbstractPreferences.put(Unknown Source) at biz.accountia.pos.install.Setup$2.actionPerformed(Setup.java:43) I would like to do this, because I want to install an embedded JavaDB database, and let multiple users on the computer to use the same database with the application. How to solve this? Can I invoke UAC and do this as Administrator from Java? And if I log in as Administrator when writing, can I read the values with my Java application if I'm logged in as a User?

    Read the article

  • php nl2br limit x amount

    - by Joshua Anderson
    Hi this is fairly simple I want to know how to use nl2br(); in php, but limit the amount of <br/>'s that are allowed at one time. //For Example: A user enters hi Im a jerk and made 16 more lines. or I could make as many as i want Is there anyway to have php limit the <br/>'s to no more than x amount of numbers at at time so if we only allowed 4 <br>'s at a time the output would be hi Im a jerk I tried to make 9 lines and it made it 4

    Read the article

  • app_offline not being respected?

    - by Jonas
    I'm doing some tests with deploying an application using the app_offline.htm functionality in asp.net. I've found that if I have a working application, and I put an app_offline.htm file in the root, and then rename the \bin folder, my app_offline.htm file does not get displayed. If I rename the bin folder back to "bin", my app_offline.htm file gets displayed as expected. I had assumed/thought that the presence of app_offline would supersede anything else that happens...am I mistaken? This is on Windows 7/IIS 7.5.

    Read the article

  • Creating a REST client API using Reactive Extensions (Rx)

    - by Jonas Follesø
    I'm trying to get my head around the right use cases for Reactive Extensions (Rx). The examples that keeps coming up are UI events (drag and drop, drawing), and suggestions that Rx is suitable for asynchronous applications/operations such as web service calls. I'm working on an application where I need to write a tiny client API for a REST service. I need to call four REST end-points, three to get some reference data (Airports, Airlines, and Statuses), and the fourth is the main service that will give you flight times for a given airport. I have created classes exposing the three reference data services, and the methods look something like this: public Observable<Airport> GetAirports() public Observable<Airline> GetAirlines() public Observable<Status> GetStatuses() public Observable<Flights> GetFlights(string airport) In my GetFlights method I want each Flight to hold a reference the Airport it's departing from, and the Airline operating the flight. To do that I need the data from GetAirports and GetAirlines to be available. My initial thinking was something like this: Write a Rx Query that will Subscribe on the three reference services (Airports, Airlines and Statuses) Add results into a Dictionary (airline code and Airline object) When all three GetAirports, GetAirlines and GetStatuses are complete, then return the GetFlights IObservable. Is this a reasonable scenario for Rx? I'm developing on the Windows Phone 7, so I'm not sure if there are major differences in the Rx implementations across the different platforms.

    Read the article

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