Search Results

Search found 1485 results on 60 pages for 'dan'.

Page 24/60 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Fastest way to remove non-numeric characters from a VARCHAR in SQL Server

    - by Dan Herbert
    I'm writing an import utility that is using phone numbers as a unique key within the import. I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things like dashes and parenthesis and possibly other things. I wrote a function to remove these things, the problem is that it is slow and with thousands of records in my DB and thousands of records to import at once, this process can be unacceptably slow. I've already made the phone number column an index. I tried using the script from this post: http://stackoverflow.com/questions/52315/t-sql-trim-nbsp-and-other-non-alphanumeric-characters But that didn't speed it up any. Is there a faster way to remove non-numeric characters? Something that can perform well when 10,000 to 100,000 records have to be compared. Whatever is done needs to perform fast. Update Given what people responded with, I think I'm going to have to clean the fields before I run the import utility. To answer the question of what I'm writing the import utility in, it is a C# app. I'm comparing BIGINT to BIGINT now, with no need to alter DB data and I'm still taking a performance hit with a very small set of data (about 2000 records). Could comparing BIGINT to BIGINT be slowing things down? I've optimized the code side of my app as much as I can (removed regexes, removed unneccessary DB calls). Although I can't isolate SQL as the source of the problem anymore, I still feel like it is.

    Read the article

  • Microsoft flexgrid Control : Run-time error '438' Object doesnt support this property or method

    - by Dan
    I am maintaining a legacy Microsoft Access application that is using the Microsoft Flexgrid 6.0. It recently started causing the following error: Run-time error '438' Object doesn't support this property or method People say that this error can be caused by the KB960715 security update being applied, which sets killbits on various ActiveX control methods which were deemed a security risk. But this or no other security update has been applied recently. Others say that installing Microsoft Visual Basic 6.0 Service Pack 6 Cumulative Update will update the flex grid. This requires VB6 to be installed as a prerequisite so I installed that on my PC and then the update, and retrieved the updated MsFlxGrd.ocx file(Version: 6.1.98.12) and copied to the application machine, but the error still prevails. Someone here says you can disable the killbit in the registry. But there are afew hundred nodes in the location they suggest, none of which has the same guid as the one they point out. Any ideas?

    Read the article

  • Can I use UIRefreshControl with UICollectionViewScrollDirectionHorizontal?

    - by Dan Abramov
    You can add UIRefreshControl to UICollectionView (or any UIScrollView for that matter) by adding it to collection's subviews: UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged]; [self.collectionView addSubview:refreshControl]; This doesn't work when collection view layout has UICollectionViewScrollDirectionHorizontal. I tried overriding layoutSubviews to put refresh control to the left, but it wouldn't track scrolling progress this way. Can I trick it into working with horizontal layouts?

    Read the article

  • Why are my installed fonts not available in .NET?

    - by Dan Herbert
    I'm trying to render some images with text using a font I just added to my machine and no matter what I do, I can't seem to get the font to become accessible in .NET. I tried using PrivateFontCollection.AddFontFile(filename) and PrivateFontCollection.AddMemoryFont(...) to load the font into memory. Whenever I do this, the method throws a "File Not Found" exception, which is unusual because I get this exception when loading the font from memory, where there should be no files to be "not found". Initially, I thought it may be because the font I was trying to use was in the .pfm format, so I converted the font to .otf and had the same problem. Then I tried installing the .otf font to my Windows Fonts folder so I could pull it from FontFamily.Families. Once I installed the font, it became available in Microsoft Word & Notepad2. However, when I try to load it from FontFamily.Families, it is not included in the array. I thought rebooting my machine would fix the issue but obviously there is something more complicated involved here. Is there something basic I just might have missed when installing the font in my machine (Windows Vista), or is there another way to programmatically load a font that I should be using instead? Is .otf not supported in .NET?

    Read the article

  • Synchronized Enumerator in C#

    - by Dan Bryant
    I'm putting together a custom SynchronizedCollection<T> class so that I can have a synchronized Observable collection for my WPF application. The synchronization is provided via a ReaderWriterLockSlim, which, for the most part, has been easy to apply. The case I'm having trouble with is how to provide thread-safe enumeration of the collection. I've created a custom IEnumerator<T> nested class that looks like this: private class SynchronizedEnumerator : IEnumerator<T> { private SynchronizedCollection<T> _collection; private int _currentIndex; internal SynchronizedEnumerator(SynchronizedCollection<T> collection) { _collection = collection; _collection._lock.EnterReadLock(); _currentIndex = -1; } #region IEnumerator<T> Members public T Current { get; private set;} #endregion #region IDisposable Members public void Dispose() { var collection = _collection; if (collection != null) collection._lock.ExitReadLock(); _collection = null; } #endregion #region IEnumerator Members object System.Collections.IEnumerator.Current { get { return Current; } } public bool MoveNext() { var collection = _collection; if (collection == null) throw new ObjectDisposedException("SynchronizedEnumerator"); _currentIndex++; if (_currentIndex >= collection.Count) { Current = default(T); return false; } Current = collection[_currentIndex]; return true; } public void Reset() { if (_collection == null) throw new ObjectDisposedException("SynchronizedEnumerator"); _currentIndex = -1; Current = default(T); } #endregion } My concern, however, is that if the Enumerator is not Disposed, the lock will never be released. In most use cases, this is not a problem, as foreach should properly call Dispose. It could be a problem, however, if a consumer retrieves an explicit Enumerator instance. Is my only option to document the class with a caveat implementer reminding the consumer to call Dispose if using the Enumerator explicitly or is there a way to safely release the lock during finalization? I'm thinking not, since the finalizer doesn't even run on the same thread, but I was curious if there other ways to improve this.

    Read the article

  • SHBrowseForFolder doesn't work for network selection in win7

    - by Dan
    Hi, I use SHBrowseForFolder in my code. It works well in XP. But I find it dose not run well in Windows 7 with the same code. When I click a network, it does nothing. But it can expand in XP. By the way, I have the permission to access the network of another computer and I try accessing the resource with explorer, it's OK! Can anyone tell me how to fix this problem? Thanks in advance!

    Read the article

  • CakePHP: shortcomings with indirectly associated models

    - by Dan
    I'm having some issues with dealing with indirectly associated models in cakephp. My current model setup is as follows: Deliveries hasOne License License belongsTo Delivery License hasAndBelongsToMany Product (and vice-versa) License hasAndBelongsToMany ProductOption (and vice-versa) I'm trying to save information about ALL of these models inside ONE form. The shortcomings I'm running into are the following: The form helper only seems able to see the field type one level deep. saveAll() only seems able to save records one level deep (for multiple model forms). I'm searching everywhere for the solutions to these issues, but since I'm new to CakePHP, I'm not sure what the newest methods or "correct" methods are for dealing with these issues. Any advice is much appreciated. Thank you all! EDIT: I've posted code to my failed attempt here: http://bin.cakephp.org/saved/58501

    Read the article

  • OpenCV Python HoughCircles error

    - by Dan
    Hi, I'm working on a program that detects circular shapes in images. I decided a Hough Transform would be the best, and I found one in the OpenCV library. The problem is that when I try to use it I get an error that I have no idea how to fix. Is OpenCV for Python not fully implemented? Is there a fix to the library I need for the program to work? Here's the code: import cv #cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) gray = cv.CreateImage(cv.GetSize(img), 8, 1) edges = cv.CreateImage(cv.GetSize(img), 8, 1) cv.CvtColor(img, gray, cv.CV_BGR2GRAY) cv.Canny(gray, edges, 50, 200, 3) cv.Smooth(gray, gray, cv.CV_GAUSSIAN, 9, 9) storage = cv.CreateMat(1, 2, cv.CV_32FC3) #This is the line that throws the error cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) #cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break And here is the error I'm getting: OpenCV Error: Null pinter () in unknown function, file ..\..\..\..\ocv\openc\src\cxcore\cxdatastructs.cpp, line 408 Traceback (most recent call last): File "ellipse-detect-webcam.py", line 20, in cv.HoughCircles(edges, storage, cv.CV_HOUGH_GRADIENT, 2, gray.height/4, 200, 100) cv.error Thanks in advance for the help.

    Read the article

  • Irrelevant legend information in ggplot2

    - by Dan Goldstein
    When running this code (go ahead, try it): library(ggplot2) (myDat <- data.frame(cbind(VarX=10:1, VarY=runif(10)), Descrip=sample(LETTERS[1:3], 10, replace=TRUE))) ggplot(myDat,aes(VarX,VarY,shape=Descrip,size=3)) + geom_point() ... the "size=3" statement does correctly set the point size. However it causes the legend to give birth to a little legend beneath it, entitled "3" and containing nothing but a big dot and the number 3. This does the same ggplot(myDat,aes(VarX,VarY,shape=Descrip)) + geom_point(aes(size=3)) Yes, it is funny. It would have driven me insane a couple hours ago if it weren't so funny. But now let's make it stop.

    Read the article

  • How do I get my custom WPF textbox to fill correctly?

    - by Dan Ryan
    I am trying to create a custom WPF textbox control that extends the standard textbox control but the extended textbox behaves differently when placed in control containers. Within my Window I have a stackpanel with a standard textbox and my extended textbox: <StackPanel Margin="10"> <TextBox Height="21" /> <l:SearchTextBox Search="SearchTextBox_Search" Height="21" Margin="0, 10, 0, 0" SearchMode="Delayed" HorizontalAlignment="Left" /> </StackPanel> The standard textbox stretches the length of the StackPanel whereas the custom textbox does not. How can I get the controls to behave the same? The styling for the custom textbox is shown below: <Style x:Key="{x:Type UIControls:SearchTextBox}" BasedOn="{StaticResource {x:Type TextBox}}" TargetType="{x:Type UIControls:SearchTextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type UIControls:SearchTextBox}"> <TextBox /> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • Can I query DOM Document with xpath expression from multiple threads safely?

    - by Dan
    I plan to use dom4j DOM Document as a static cache in an application where multiples threads can query the document. Taking into the account that the document itself will never change, is it safe to query it from multiple threads? I wrote the following code to test it, but I am not sure that it actually does prove that operation is safe? package test.concurrent_dom; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Node; /** * Hello world! * */ public class App extends Thread { private static final String xml = "<Session>" + "<child1 attribute1=\"attribute1value\" attribute2=\"attribute2value\">" + "ChildText1</child1>" + "<child2 attribute1=\"attribute1value\" attribute2=\"attribute2value\">" + "ChildText2</child2>" + "<child3 attribute1=\"attribute1value\" attribute2=\"attribute2value\">" + "ChildText3</child3>" + "</Session>"; private static Document document; private static Element root; public static void main( String[] args ) throws DocumentException { document = DocumentHelper.parseText(xml); root = document.getRootElement(); Thread t1 = new Thread(){ public void run(){ while(true){ try { sleep(3); } catch (InterruptedException e) { e.printStackTrace(); } Node n1 = root.selectSingleNode("/Session/child1"); if(!n1.getText().equals("ChildText1")){ System.out.println("WRONG!"); } } } }; Thread t2 = new Thread(){ public void run(){ while(true){ try { sleep(3); } catch (InterruptedException e) { e.printStackTrace(); } Node n1 = root.selectSingleNode("/Session/child2"); if(!n1.getText().equals("ChildText2")){ System.out.println("WRONG!"); } } } }; Thread t3 = new Thread(){ public void run(){ while(true){ try { sleep(3); } catch (InterruptedException e) { e.printStackTrace(); } Node n1 = root.selectSingleNode("/Session/child3"); if(!n1.getText().equals("ChildText3")){ System.out.println("WRONG!"); } } } }; t1.start(); t2.start(); t3.start(); System.out.println( "Hello World!" ); } }

    Read the article

  • Bing maps silverlight control in c#

    - by Dan Sewell
    Hello Chaps. Wondering if you could help me on this one.. Im trying to control my map with this c# code below. But for some reason its not doing anything when I call this method, and im not quite sure why?! Not sure if im using the .Equals properly? C# private void NW_zoom(object sender, ManipulationStartedEventArgs e) { GeoCoordinate abc = new GeoCoordinate(51.510, -0.1151); Map.CenterProperty.Equals(abc); var zoom = 12; Map.ZoomLevelProperty.Equals(zoom); } XMAL map control: <maps:Map ZoomLevel="10" Mode="Road" Margin="0,0,0,54" ZoomBarVisibility="Visible" ScaleVisibility="Visible" CredentialsProvider="xxxxxxx" Grid.Row="1"> <maps:Map.Center> <device:GeoCoordinate Latitude="51.510669" Longitude="-0.11512800"/> </maps:Map.Center> <maps:MapLayer x:Name="QuakeLayer" Height="726" Width="477" /> </maps:Map>

    Read the article

  • PHP splitting arrays into groups based on one field's value

    - by Dan
    I have an array containing arrays of names and other details, in alphabetical order. Each array includes the first letter associated with the name. Array ( [0] => Array ( [0] => a [1] => Alanis Morissette ) [1] => Array ( [0] => a [1] => Alesha Dixon ) [2] => Array ( [0] => a [1] => Alexandra Burke ) [3] => Array ( [0] => b [1] => Britney Spears ) [4] => Array ( [0] => b [1] => Bryan Adams ) ) I'd like to display them grouped by that first initial, eg: A - Alanis Morissette Alesha Dixon Alexandra Burke B - Britney Spears Bryan Adams etc... Is this at all possible?

    Read the article

  • Grails and Flex build process integration

    - by Dan
    I plan to use Grails and Flex in my next project. I would like to use grails command line to construct my project. This should include the flex part as well, compiling swf, executing FlexUnits etc. I would like to compile and add swf file to war when I do “grails war”. How can I accomplish this?

    Read the article

  • Visual Studio Windows Forms Designer keyboard shortcuts

    - by Dan Tao
    Extremely basic question. Are there common actions I can perform using keyboard shortcuts in the Windows Forms designer in Visual Studio (2008)? Alternately, could I add my own keyboard shortcuts (either through settings or macros)? It'd really be nice if I could, for example, set a control to dock/undock in its parent container by typing Alt+D. Or if I could set a control's name just by typing Alt+N and typing the name. Things like that. It's just kind of tedious to click on the item, scroll in the Properties grid to the property I want to change, type the new value, scroll to the next property I want to change, etc. Which is why I have a feeling this functionality is in there already, or is easily configurable, and I just don't know about it.

    Read the article

  • Remove mailmerge data source via OpenXML

    - by Dan
    I have some code that uses OpenXML to open up a docx file, find all mailmerge fields, and replace them with data (ignoring the datasource that may have been provided). I initially tested this against a document created in Office 2007 and it seemed to work great. We then created one in 2003 based off an Excel spreadsheet data source and saved it to 2007 docx format. When we open the file produced by my code, Word warns the user that it is going to execute some SQL, specifically "SELECT * from 'Sheet1$'". It has options of Yes/No. Selecting Yes requires I find the data source. Selecting No brings me to the document, which appears to be correct. I'm not sure why I'm now seeing this pop up. Perhaps it's due to a different data source for the 2003 document? My hope was that there was a way to delete all references to any datasources and that the pop-up wouldn't show. I found this, but it doesn't seem to work. Any suggestions?

    Read the article

  • NHibernate Generators

    - by Dan
    What is the best tool for generating Entity Class and/or hbm files and/or sql script for NHibernate. This list below is from http://www.hibernate.org/365.html, which is the best any why? Moregen Free, Open Source (GPL) O/R Generator that can merge into existing Visual Studio Projects. Also merges changes to generated classes. NConstruct Lite Free tool for generating NHibernate O/R mapping source code. Different databases support (Microsoft SQL Server, Oracle, Access). GENNIT NHibernate Code Generator Free/Commercial Web 2.0 code generation of NHibernate code using WYSIWYG online UML designer. GenWise Studio with NHibernate Template Commercial product; Imports your existing database and generates all XML and Classes, including factories. It can also generate a asp.net web-application for your NHibernate BO-Layer automatically. HQL Analyzer and hbm.xml GUI Editor ObjectMapper by Mats Helander is a mapping GUI with NHibernate support MyGeneration is a template-based code generator GUI. Its template library includes templates for generating mapping files and classes from a database. AndroMDA is an open-source code generation framework that uses Model Driven Architecture (MDA) to transform UML models into deployable components. It supports generation of data access layers that use NHibernate as their persistence framework. CodeSmith Template for NH NHibernate Helper Kit is a VS2005 add-in to generate classes and mapping files. NConstruct - Intelligent Software Factory Commercial product; Full .NET C# source code generation for all tiers of the information system trough simple wizard procedure. O/R mapping based on NHibernate. For both WinForms and ASP.NET 2.0.

    Read the article

  • Automatically calling OnDetaching() for Silverlight Behaviors

    - by Dan Auclair
    I am using several Blend behaviors and triggers on a silverlight control. I am wondering if there is any mechanism for automatically detaching or ensuring that OnDetaching() is called for a behavior or trigger when the control is no longer being used (i.e. removed from the visual tree). My problem is that there is a managed memory leak with the control because of one of the behaviors. The behavior subscribes to an event on some long-lived object in the OnAttached() override and should be unsubscribing to that event in the OnDetaching() override so that it can become a candidate for garbage collection. However, OnDetaching() never seems to be getting called when I remove the control from the visual tree... the only way I can get it to happen is by explicit detaching the behavior BEFORE removing the control and then it is properly garbage collected. Right now my only solution was to create a public method in the code-behind for the control that can go through and detach any known behaviors that would cause garbage collection problems. It would be up to the client code to know to call this before removing the control from the panel. I don't really like this approach, so I am looking for some automatic way of doing this that I am overlooking or a better suggestion. public void DetachBehaviors() { foreach (var behavior in Interaction.GetBehaviors(this.LayoutRoot)) { behavior.Detach(); } //... //continue detaching all known problematic behaviors.... }

    Read the article

  • TwoWay Binding to ListBox SelectedItem on more than one list box in WPF

    - by Dan Bryant
    I have a scenario where I have a globally available Properties window (similar to the Properties window in Visual Studio), which is bound to a SelectedObject property of my model. I have a number of different ways to browse and select objects, so my first attempt was to bind them to SelectedObject directly. For example: <ListBox ItemsSource="{Binding ActiveProject.Controllers}" SelectedItem="{Binding SelectedObject, Mode=TwoWay}"/> <ListBox ItemsSource="{Binding ActiveProject.Machines}" SelectedItem="{Binding SelectedObject, Mode=TwoWay}"/> This works well when I have more than one item in each list, but it fails if a list has only one item. When I select the item, SelectedObject is not updated, since the list still thinks its original item was selected. I believe this happens because the two way binding simply ignores the update from source when SelectedObject is not an object in the list, leaving the list's SelectedItem unchanged. In this way, the bindings become out of sync. Does anybody know of a way to make sure the list boxes reset their SelectedItem when the SelectedObject is not in the list? Is there a better way to do this that doesn't suffer from this problem?

    Read the article

  • UIButton doesn't listen to content mode setting?

    - by Dan Ray
    firstButton is a UIButton of type Custom. I'm programmatically putting three of them across each cell of a table, thusly: [firstButton setImage:markImage forState:UIControlStateNormal]; [firstButton setContentMode:UIViewContentModeScaleAspectFit]; [cell.contentView addSubview:firstButton]; Elsewhere, I'm telling it to clipToBounds. What I get is a crop of the center square of the image, rather than an aspect-scaled rendering of it. I've tried this lots of ways, including setting the mode property on firstButton.imageView, which also doesn't seem to work.

    Read the article

  • Java without gc - io

    - by Dan
    Hi Guys I would like to run a Java program with garbage collection switched off. Managing memory in my own code is not so difficult. However the program needs quite a lot of I/O. Is there any way (short of using JNI for all I/O operations) that I could achieve this using pure Java? Thanks Daniel

    Read the article

  • Striping Rows of a UITableView

    - by Dan Brown
    Hello, I've read posts here on SO about striping a UITableView's cells, but have not been able to work out the details. My code is: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Setup code omitted cell.textLabel.text = @"Blah Blah"; cell.detailTextLabel.text = @"Blah blah blah"; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; if ([indexPath row] % 2 == 1) { cell.contentView.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]; cell.textLabel.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:0.0]; cell.detailTextLabel.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]; cell.accessoryView.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]; } return cell; } And my result is: Any ideas why this is happening? Thanks!

    Read the article

  • JQuery UI Dialog - Ajax Update on success $(this).dialog('close');

    - by Dan
    Having issues referencing $(this) from within a the nested ajax 'success' function... I know this is a scope issue, but can't seem to find a clean way to close the dialog on a successful update. Thanks for any help. $("#dialog_support_option_form").dialog({ width: 400, height: 180, bgiframe: true, autoOpen: false, modal: true, buttons: { 'Save Support Option': function(){ $.ajax({ type: 'POST', url: "support_options/create_support_option.php", data: $(this).find('form').serialize(), success: function(data){ $("#list_support_options").html(data); $(this).dialog('close'); } }); }, 'Cancel': function(){ $(this).dialog('close'); } }, close: function(){ $(this).find('input').val(''); } });

    Read the article

  • file layout and setuptools configuration for the python bit of a multi-language library

    - by dan mackinlay
    So we're writing a full-text search framework MongoDb. MongoDB is pretty much javascript-native, so we wrote the javascript library first, and it works. Now I'm trying to write a python framework for it, which will be partially in python, but partially use those same stored javascript functions - the javascript functions are an intrinsic part of the library. On the other hand, the javascript framework does not depend on python. since they are pretty intertwined it seems like it's worthwhile keeping them in the same repository. I'm trying to work out a way of structuring the whole project to give the javascript and python frameworks equal status (maybe a ruby driver or whatever in the future?), but still allow the python library to install nicely. Currently it looks like this: (simplified a little) javascript/jstest/test1.js javascript/mongo-fulltext/search.js javascript/mongo-fulltext/util.js python/docs/indext.rst python/tests/search_test.py python/tests/__init__.py python/mongofulltextsearch/__init__.py python/mongofulltextsearch/mongo_search.py python/mongofulltextsearch/util.py python/setup.py I've skipped out a few files for simplicity, but you get the general idea; it' a pretty much standard python project... except that it depends critcally ona whole bunch of javascript which is stored in a sibling directory tree. What's the preferred setup for dealing with this kind of thing when it comes to setuptools? I can work out how to use package_data etc to install data files that live inside my python project as per the setuptools docs. The problem is if i want to use setuptools to install stuff, including the javascript files from outside the python code tree, and then also access them in a consistent way when I'm developing the python code and when it is easy_installed to someone's site. Is that supported behaviour for setuptools? Should i be using paver or distutils2 or Distribute or something? (basic distutils is not an option; the whole reason I'm doing this is to enable requirements tracking) How should i be reading the contents of those files into python scripts?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >