Search Results

Search found 183 results on 8 pages for 'ashish'.

Page 4/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Detecting duplicate values in a column of a Datatable while traversing through It

    - by Ashish Gupta
    I have a Datatable with Id(guid) and Name(string) columns. I traverse through the data table and run a validation criteria on the Name (say, It should contain only letters and numbers) and then adding the corresponding Id to a List If name passes the validation. Something like below:- List<Guid> validIds=new List<Guid>(); foreach(DataRow row in DataTable1.Rows) { if(IsValid(row["Name"]) { validIds.Add((Guid)row["Id"]); } } In addition to this validation I should also check If the name is not repeating in the whole datatable (even for the case-sensitiveness), If It is repeating, I should not add the corresponding Id in the List. Things I am thinking/have thought about:- 1) I can have another List, check for the "Name" in the same, If It exists, will add the corresponding Guild 2) I cannot use HashSet as that would treat "Test" and "test" as different strings and not duplicates. 3) Take the DataTable to another one where I have the disctict names (this I havent tried and the code might be incorrect, please correct me whereever possible) DataTable dataTableWithDistinctName = new DataTable(); dataTableWithDistinctName.CaseSensitive=true CopiedDataTable=DataTable1.DefaultView.ToTable(true,"Name"); I would loop through the original datatable and check the existence of the "Name" in the CopiedDataTable, If It exists, I wont add the Id to the List. Are there any better and optimum way to achieve the same? I need to always think of performance. Although there are many related questions in SO, I didnt find a problem similar to this. If you could point me to a question similar to this, It would be helpful. Thanks

    Read the article

  • In WPF how to define a Data template in case of enum?

    - by Ashish Ashu
    I have a Enum defined as Type public Enum Type { OneType, TwoType, ThreeType }; Now I bind Type to a drop down Ribbon Control Drop Down Menu in a Ribbon Control that displays each menu with a MenuName with corresponding Image. ( I am using Syncfusion Ribbon Control ). I want that each enum type like ( OneType ) has data template defined that has Name of the menu and corrospending image. How can I define the data template of enum ? Please suggest me the solution, if this is possible !! Please also tell me if its not possible or I am thinking in the wrong direction !!

    Read the article

  • vsts load test datasource issues

    - by ashish.s
    Hello, I have a simple test using vsts load test that is using datasource. The connection string for the source is as follows <connectionStrings> <add name="MyExcelConn" connectionString="Driver={Microsoft Excel Driver (*.xls)};Dsn=Excel Files;dbq=loginusers.xls;defaultdir=.;driverid=790;maxbuffersize=4096;pagetimeout=20;ReadOnly=False" providerName="System.Data.Odbc" /> </connectionStrings> the datasource configuration is as follows and i am getting following error estError TestError 1,000 The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: ERROR [42000] [Microsoft][ODBC Excel Driver] Cannot update. Database or object is read-only. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed ERROR [42000] [Microsoft][ODBC Excel Driver] Cannot update. Database or object is read-only. I wrote a test, just to check if i could create an odbc connection would work and that works the test is as follows [TestMethod] public void TestExcelFile() { string connString = ConfigurationManager.ConnectionStrings["MyExcelConn"].ConnectionString; using (OdbcConnection con = new OdbcConnection(connString)) { con.Open(); System.Data.Odbc.OdbcCommand objCmd = new OdbcCommand("SELECT * FROM [loginusers$]"); objCmd.Connection = con; OdbcDataAdapter adapter = new OdbcDataAdapter(objCmd); DataSet ds = new DataSet(); adapter.Fill(ds); Assert.IsTrue(ds.Tables[0].Rows.Count > 1); } } any ideas ?

    Read the article

  • WPF Open Combobox popup on Focus or GotFocus

    - by ashish.magroria
    Hi, I am trying to open the combobox popup when it is focused using Style/Event Trigger I used the following code in my Combobox control Template: <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}"> <Grid > <ToggleButton Grid.Column="2" Template="{DynamicResource ComboBoxToggleButton}" x:Name="ToggleButton" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/> <ContentPresenter HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="ContentSite" VerticalAlignment="Center" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" IsHitTestVisible="False"/> <TextBox Visibility="Hidden" Template="{DynamicResource ComboBoxTextBox}" HorizontalAlignment="Left" Margin="3,3,23,3" x:Name="PART_EditableTextBox" Style="{x:Null}" VerticalAlignment="Center" Focusable="True" Background="Transparent" IsReadOnly="{TemplateBinding IsReadOnly}"/> <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide"> <Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True"> <Border x:Name="DropDownBorder" Background="{DynamicResource ShadeBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/> <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True"> <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained"/> </ScrollViewer> </Grid> </Popup> </Grid> <ControlTemplate.Triggers> **<Trigger Property="IsMouseOver" Value="True"> <Setter Property="IsOpen" Value="True" TargetName="Popup"/> </Trigger>** </ControlTemplate.Triggers> </ControlTemplate> But nothing happens with this code. So I trid the following Event trigger in ControlTemplate.Triggers <EventTrigger RoutedEvent="UIElement.GotFocus"> <BeginStoryboard> <Storyboard > <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Popup" Storyboard.TargetProperty="IsOpen" FillBehavior="HoldEnd"> <DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="True" /> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="UIElement.LostFocus"> <BeginStoryboard> <Storyboard > <BooleanAnimationUsingKeyFrames Storyboard.TargetName="Popup" Storyboard.TargetProperty="IsOpen" FillBehavior="HoldEnd"> <DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False" /> </BooleanAnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger> Now this helps open the popup on focus, but when I select any item from dropdown the pop up doesnt disappear as usual; it stays open. it closes only after I click somewhere else in the window. Can someone please suggest the proper way to do this Thanks in advance

    Read the article

  • Cross Thread Exception in PropertyChangedEvent in WPF

    - by Ashish Ashu
    I have a ListView that is binded to my custom collection. At run time , I am updating the certain properties of my entity in my custom collection in my ViewModel. At the same time , I am also doing the custom sorting in the listview. The custom sorting is applicable when I click on the any column header of the listview. For example, I am updating the current datetime on my entity on every 5 seconds and simulaneously , I am applying custom sorting based on DateTime. (The Listview is third party control). Hence I am doing two operations on my custom collection at the same time. Should I pass the dispatcher of my control in the view model and call any methods ( which updates any entity in my custom collection ) through UI dispatcher ?

    Read the article

  • data structure problems

    - by Ashish
    hey guys, please help me in finding the solution to some of these Amazon questions: given a file containing approx 10 million words, design a data structure for finding the anagrams Write a program to display the ten most frequent words in a file such that your program be efficient in all complexity measures. you have a file with millions of lines of data. Only two lines are identical; the rest are all unique. Each line is so long that it may not even fit in the memory. What is the most efficient solution for finding the identical lines?

    Read the article

  • Retrieving many huge sized EPS files and converting them to JPEG in ASP.NET application

    - by Ashish Gupta
    I have many (600) EPS files(300 KB - 1 MB) in database. In my ASP.NET application (using ASP.NET 4.0) I need to retrieve them one by one and call a web service which would convert the content to the JPEG file and update the database (JPEGContent column with the JPEG content). However, retrieving the content for 600 of them itself takes too long from the SQL management studio itself (takes 5 minutes for 10 EPS contents). So I have two issues:- 1) How to get the EPS content ( unfortunately, selecting certain number of content is not an option :-( ):- Approach 1:- foreach(var DataRow in DataTable.Rows) { // get the Id and byte[] of EPS // Call the web method to convert EPS content to JPEG which would also update the database. } or foreach(var DataRow in DataTable.Rows) { // get only the Id of EPS // Hit database to get the content of EPS // Call the web method to convert EPS content to JPEG which would also update the database. } or Any other approach? 2) Converting EPS to JPEG using a web method for 600 contents. Ofcourse, each call would be a long running operation. Would task parellel library (TPL) be a better way to achieve this? Also, is doing the entire thing in a SQL CLR function a good idea?

    Read the article

  • Get cookie expiration

    - by Ashish Rajan
    Is it possible to read cookie expiration time with php ? When I print_r($_COOKIE) it outputs: Array ( [PHPSESSID] => 0afef6bac83a7db8abd9f87b76838d7f [userId] => 1232 [userEmail] => [email protected] [firstName] => user [lastName] => user ) So I think $_COOKIE don't have the expiration time, is it possible with some other function?

    Read the article

  • Help in XPath expression

    - by Ashish Gupta
    I have an XML document which contains nodes like following:- <a class="custom">test</a> <a class="xyz"></a> I was tryng to get the nodes for which class is NOT "Custom" and I wrote an expression like following:- XmlNodeList nodeList = document.SelectNodes("//*[self::A[@class!='custom'] or self::a[@class!='custom']]"); Now, I want to get IMG tags as well and I want to add the following experession as well to the above expression:- //*[self::IMG or self::img] ...so that I get all the IMG nodes as well and any tag other than having "custom" as value in the class attribute. Any help will be appreciated. EDIT :- I tried the following and this is an invalid syntax as this returns a boolean and not any nodelist:- XmlNodeList nodeList = document.SelectNodes("//*[self::A[@class!='custom'] or self::a[@class!='custom']] && [self::IMG or self::img]");

    Read the article

  • Email mime parsing

    - by Ashish
    Hi, I was trying to find a user friendly mime parser for java that could just get rid of all that message part parsing a user have to do. see this for more info about my requirement. Until now i have not been able to find one, so i think i need to write one for myself, that should be robust enough to handle all kind of emails. (I know this is not going to be easy.) Since there are a ton of email RFC's , can somebody guide me in the right direction from where should i start.

    Read the article

  • RestKit : Not able to perform mapping using coredata

    - by Ashish Beuwria
    I'm using rest kit 0.20.3 and Xcode 5. Without core data I'm able to perform all rest kit operation, but when I've tried it with core data, I'm not even able to perform GET due to some problem. I can't figure it out. I'm new with core data. So pls help. Here is my code: AppDelegate.m @implementation CardGameAppDelegate @synthesize managedObjectContext = _managedObjectContext; @synthesize managedObjectModel = _managedObjectModel; @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RKLogConfigureByName("RestKit", RKLogLevelWarning); RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace); RKLogConfigureByName("RestKit/Network", RKLogLevelTrace); RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://192.168.1.3:3010/"]]; RKManagedObjectStore *objectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:self.managedObjectModel]; objectManager.managedObjectStore = objectStore; RKEntityMapping *playerMapping = [RKEntityMapping mappingForEntityForName:@"Player" inManagedObjectStore:objectStore]; [playerMapping addAttributeMappingsFromDictionary:@{@"id": @"playerId", @"name": @"playerName", @"age" : @"playerAge", @"created_at": @"createdAt", @"updated_at": @"updatedAt"}]; RKResponseDescriptor *responseDesc = [RKResponseDescriptor responseDescriptorWithMapping:playerMapping method:RKRequestMethodGET pathPattern:@"/players.json" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]; [objectManager addResponseDescriptor:responseDesc]; PlayersTableViewController *ptvc = (PlayersTableViewController *)self.window.rootViewController; ptvc.managedObjectContext = self.managedObjectContext; return YES; } and code for playerTableViewController.h #import <UIKit/UIKit.h> @interface PlayersTableViewController : UITableViewController <NSFetchedResultsControllerDelegate> @property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; @property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; @end and PlayerTableViewController.m get method: -(void)loadPlayers{ [[RKObjectManager sharedManager] getObjectsAtPath:@"/players.json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){ [self.refreshControl endRefreshing]; } failure:^(RKObjectRequestOperation *operation, NSError *error) { [self.refreshControl endRefreshing]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"An Error Has Occurred" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; }]; } I'm getting the following error : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to perform mapping: No `managedObjectContext` assigned. (Mapping response.URL = http://192.168.1.3:3010/players.json)'

    Read the article

  • Sql Server - INSERT INTO SELECT to avoid duplicates

    - by Ashish Gupta
    I have following two tables:- Table1 ------------- ID Name 1 A 2 B 3 C Table2 -------- ID Name 1 Z I need to insert data from Table1 to Table2 and I can use following sytax for the same:- INSERT INTO Table2(Id, Name) SELECT Id, Name FROM Table1 However, In my case duplicate Ids might exist in Table2 (In my case Its Just "1") and I dont want to copy that again as that would throw an error. I can write something like this:- IF NOT EXISTS(SELECT 1 FROM Table2 WHERE Id=1) INSERT INTO Table2 (Id, name) SELECT Id, name FROM Table1 ELSE INSERT INTO Table2 (Id, name) SELECT Id, name FROM Table1 WHERE Table1.Id<>1 Is there a better way to do this without using IF - ELSE? I want to avoid two INSERT INTO-SELECT statements based on some condition. Any help is appreciated.

    Read the article

  • How to traverse the item in the collection in a List or Observable collection?

    - by Ashish Ashu
    I have a collection that is binded to my Listview. I have provided options to user to "move up" "move down" the selected item in the list view. I have binded the selected item of the listview to my viewmodel, hence I get the item in the collection on which user want to do the operation. I have attached "move up" "move down" commands in my viewmodel. I want what is the best way to move up and down in the collection in the collection which is reflected in the list view. Please suggest.

    Read the article

  • change background color with change in mouse position

    - by Ashish Rajan
    I was wondering if it is possible to set background-color with help of mouse coordinates. What is have is: I have a DIV-A which is draggable and some other divs which are droppable. What is need is : I need to highlight other divs on my page which are droppable, whenever my DIV-A passes over them. What i have is mouse coordinates, is it possible to apply css on the bases of mouse coordinates using jquery.

    Read the article

  • Add data in bulk.

    - by Ashish Rajan
    Hi all, I need your suggestion for this. I need to add data to mysql database through the admin interface, at initial i need to add data in bulk, so i thought of using csv upload but how to add images with csv i.e. when doing single add i insert name , description and a image via a form, but how to do the same for bulk. Thanks in advance.

    Read the article

  • How to get the default syle of my Button in WPF?

    - by Ashish Ashu
    I have create a Button style under Resource folder of the main application. I have added the reference of this button syle in the App.xml of the main application. Now this style is applicable to all the buttons in the main application or any other assembly. I want if I want to override my custom style of button to the normal button style , what should I do ?? Please help !!

    Read the article

  • Hot to declare itemTemplate that has Itemsource as Enum Values in WPF?

    - by Ashish Ashu
    I have a enum let's say Enum MyEnum { FirstImage, SecondImage, ThirdImage, FourthImage }; I have binded this Enum to my combobox in XAML. While defining an combobox I have defined an ItemTemplate of combox to take Two UI element: TextBlock that show the enum value (Description) Image I have done this much in XAML. I am wondering where I can specify the Image corrosponding to each item of Enum. Is that possible through data trigger ? I really appreciate if anyone have the XAML for this scenario. Many Thanks in advance

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >