Search Results

Search found 1335 results on 54 pages for 'dylan smith'.

Page 14/54 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Core Data Null Relationship

    - by Dylan Copeland
    I have a to-one relationship in my data model with Core Data. I'm trying to set the value of the relationship but Core Data keeps thinking that it's nil. The "creatorUser" relationship is not optional, so when I go to save my managed object context, Core Data gives errors because it thinks the "creatorUser" is nil. Any help would be greatly advised. NSManagedObject *teamManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"DCTeam" inManagedObjectContext:_managedObjectContext]; // Creator Properties NSManagedObject *creator = [self userForID:[ticketInfo objectForKey:@"userid"]]; if (!creator) { creator = [NSEntityDescription insertNewObjectForEntityForName:@"DCUser" inManagedObjectContext:_managedObjectContext]; [creator setValue:[personInfo objectForKey:@"userid"] forKey:@"userid"]; [creator setValue:[personInfo objectForKey:@"creatorName"] forKey:@"name"]; } [teamManagedObject setValue:creator forKey:@"creatorUser"];

    Read the article

  • How can I determine file encodings on Windows / IIS ?

    - by Dylan Beattie
    From the answers to this question it appears there's a file somewhere on our server that's been saved with the wrong encoding. I've seen this happen before - most often when pasting from Word into Visual Studio, when "smart quotes" can interfere with Visual Studio's encoding settings when saving the file. Thing is - the problem I'm having involves 20-30 different script files, include files and so on (hey, that was how we kept it modular back in the day...) and I really don't want to open every one of them in Visual Studio and check the file encodings individually. Is there any way I can analyze a folder tree full of files and spit out a list of each filename along with the text encoding used to save the file? (Or - if encodings aren't clearly specified - work out what encoding Microsoft IIS thinks was used to save the file?)

    Read the article

  • How can I get all content within <td> tag using a HTML Agility Pack?

    - by Bob Dylan
    So I'm writing an application that will do a little screen scrapping. I'm using the HTML Agility Pack to load an entire HTML page into an instance of HtmlDocoument called doc. Now I want to parse that doc, looking for this: <table border="0" cellspacing="3"> <tr><td>First rows stuff</td></tr> <tr> <td> The data I want is in here <br /> and it's seperated by these annoying <br /> 's. No id's, classes, or even a single <p> tag. </p> Just a bunch of <br /> tags. </td> </tr> </table> So I just need to get the data within the 2nd row. How can I do this? Should I use a regex or something else?

    Read the article

  • DIV with text over an image on hover.

    - by Dylan Taylor
    OKay first off this is really really similiar to the http://dribbble.com homepage. In the simplest form possible. I have an image, and i'm trying to CSS it so that when i hover over the image, a DIV shows up with some text and a partially transparent background color. I have no idea how to do this..

    Read the article

  • Cocoa Touch best practice for capturing/logging/diagnosing crashes

    - by Dylan
    As I get closer to releasing my first public iPhone app I'm concerned about catching crashes in the field. I'm curious to hear how others have gone about this. I'm not sure what's possible outside of the debugger. Is all lost with an EXC_BAD_ACCESS or can I still catch it and get something useful into a log? Is the program main() the spot to put a @try/@catch?

    Read the article

  • How can I get all content within <table></table> tags using a regex?

    - by Bob Dylan
    So I'm writing an application that will do a little screen scrapping. All the pages (about 1000 or so) contain this line: <table border="0" cellspacing="3"> <tr><td>First rows stuff</td></tr> <tr> <td> The data I want is in here <br /> and it's seperated by these annoying <br /> 's. No id's, classes, or even a single <p> tag. Just a bunch of <br /> tags. </td> </tr> </table> So I just need to get the data within the 2nd row out. How can I do this? Should I use a regex or something else?

    Read the article

  • PHP if string contains URL isolate it

    - by Dylan Taylor
    In PHP, I need to be able to figure out if a string contains a URL. If there is a URL, I need to isolate it as another separate string. For example: "SESAC showin the Love! http://twitpic.com/1uk7fi" I need to be able to isolate the URL in that string into a new string. At the same time the URL needs to be kept intact in the original string. Follow? I know this is probably really simple but it's killing me.

    Read the article

  • Strange error: cannot convert from 'int' to 'ios_base::openmode'

    - by Dylan Klomparens
    I am using g++ to compile some code. I wrote the following snippet: bool WriteAccess = true; string Name = "my_file.txt"; ofstream File; ios_base::open_mode Mode = std::ios_base::in | std::ios_base::binary; if(WriteAccess) Mode |= std::ios_base::out | std::ios_base::trunc; File.open(Name.data(), Mode); And I receive these errors... any idea why? Error 1: invalid conversion from ‘int’ to ‘std::_Ios_Openmode’ Error 2: initializing argument 2 of ‘std::basic_filebuf<_CharT, _Traits* std::basic_filebuf<_CharT, _Traits::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits]’ As far as I could tell from a Google search, g++ is actually breaking the C++ standard here. Which I find quite astonishing, since they generally conform very strictly to the standard. Is this the case? Or am I doing something wrong. My reference for the standard: http://www.cplusplus.com/reference/iostream/ofstream/open/

    Read the article

  • iPhone/Obj-C - Archiving object causes lag

    - by Dylan
    Hi I have a table view, and when I delete a cell I am removing an item from an NSMutableArray, archiving that array, and removing the cell. However, when I do this, it is causing the delete button to lag after I click it. Is there any way to fix this? // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { int row = [indexPath row]; [savedGames removeObjectAtIndex:row]; [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; //this line causing lag [NSKeyedArchiver archiveRootObject:savedGames toFile:[self dataFilePath]]; } } Thanks

    Read the article

  • Customizing TabWidget in SDK 1.5, API 3

    - by Dylan McClung
    I'm aware that API 3 doesn't allow a view to be set for a tab, but I still need to modify the TextView displayed as the indicator. I'd also like to change the Drawable for the tab, but I don't see a way to do it without a custom tab view as allowed in 1.6, API 4. Working with this generic example below, is there way to retrieve the TextView and modify its properties or change the drawable? TabHost tabHost = getTabHost(); TabHost.TabSpec spec; spec = tabHost.newTabSpec("nearby") .setIndicator("Nearby Activity") .setContent(R.id.nearby_list); tabHost.addTab(spec); spec = tabHost.newTabSpec("friends") .setIndicator("Friends & Favorites") .setContent(R.id.friends_list); tabHost.addTab(spec); tabHost.setCurrentTabByTag("nearby"); Thanks for any help.

    Read the article

  • Postgresql sequences

    - by Dylan
    When I delete all records from a Postgresql table and then try to reset the sequence to start a new record with number 1 when it is inserted, i get different results : SELECT setval('tblname_id_seq', (SELECT COALESCE(MAX(id),1) FROM tblname)); This sets the current value of the sequence to 1, but the NEXT record (actually the first because there are no records yet) gets number 2! And I can't set it to 0, because the minimum value in the sequence is 1! When I use : ALTER SEQUENCE tblname_id_seq RESTART WITH 1; the first record that is inserted actually gets number 1 ! But the above code doesn't accept a SELECT as a value instead of 1. I wish to reset the sequence to number 1 when there are no records, and the first record then should start with 1. But when there ARE already records in the table, I want to reset the sequence so that the next record that is inserted will get {highest}+1 Does anyone have a clear solution for this?

    Read the article

  • MySQL : select/join on strings as fieldnames - is this possible?

    - by Dylan
    I can retrieve all column names from table 'categories' with : SELECT col.column_name FROM information_schema.columns AS col WHERE col.table_schema= database() and col.table_name = "categories" This produces a resultset like this : column_name ----------------- categoryID name description I can retrieve all values for a specific category with : SELECT * FROM categories AS c WHERE c.categoryID=12345 this results in a resultset like this: categoryID | name | description ------------------------------------------------ 12345 | test | this is a test Now I would like to get some kind of join of above selects to get a resultset that looks something like this : fieldname | value ---------------------------------------- categoryID | 12345 name | test description | this is a test Does anyone know if this is possible ? Can you do a join on strings that come from another select ?? The reason for this is that I'm writing a universal stored procedure that outputs all fields + their values from a table, without knowing what fields there are in the table. (The tablename is given in a parameter)

    Read the article

  • Rotating images with PHP reduces quality especially over about 10-20 actions

    - by Dylan Cross
    I am using this code below to rotate my jpeg images, the problem is that after around 10-20 times of rotating the image the image is dramatically lower quality, especially blue skies and such, my question is how can I keep these images the same high quality image? There must be a way. I mean, i keep the original image on the server for each image uploaded, and I don't do anything to that, so if need be it, I guess I could always come up with some way of using that over whenever possible.. But would rather not have to. $source = imagecreatefromjpeg($filename); $rotate = imagerotate($source, 90, 0); imagejpeg($rotate, $filename ,100);

    Read the article

  • Moving x,y position of all array objects every frame in actionscript 3?

    - by Dylan Gallardo
    I have my code setup so that I have an movieclip in my library a class called "block" being duplicated multiple times and added into an array like this: function makeblock(e:Event){ newblock=new block; newblock.x=10; newblock.y=10; addChild(newblock); myarray[counter] = newblock; //adds a newblock object into array counter += 1; } Then I have a loop with a currently primitive way of handling my problem: stage.addEventListener(Event.ENTER_FRAME, gameloop); function gameloop(evt:Event):void { if (moveright==true){ myarray[0].x += 5; myarray[1].x += 5; myarray[2].x += 5 -(and so on)- My question is how can I change x,y values every frame for new objects duplicated into the array, along with the previous ones that were added. Of course with a more elegant way than writing it out myself... array[0].x += 5, array[1], array[2], array[3] etc. Ideally I would like this to go up to 500 or more array objects for one array so obviously I don't want to be writing it out individually haha, I also need it to be consistent with performance so using a for loop or something to loop through the whole array and move each x += 5 wouldn't work would it? Anyway, if anyone has any ideas that'd be great!

    Read the article

  • Compiler error when using abstract types

    - by Dylan
    I'm trying to implement a "protocol helper" trait that is responsible for matching up Prompts and Responses. The eventual goal is to have an object that defines the various Prompt and Response classes as subclasses of a sealed trait, then have a class that mixes in the ProtocolSupport trait for that Protocol object. The problem is that my current approach won't compile, even though I'm fairly sure it should. Here's a distilled version of what I've got: trait Protocol { type Response type Prompt <: BasePrompt trait BasePrompt { type Data def validate(response: Response): Validated[Data] } } trait ProtocolSupport[P <: Protocol] { def foo(prompt: P#Prompt, response: P#Response) = { // compiler error prompt.validate(response) } } The compiler doesn't like the response as an argument to prompt.validate: [error] found : response.type (with underlying type P#Response) [error] required: _4.Response where val _4: P [error] prompt.validate(response) [error] ^ This isn't very helpful.. it seems to say that it wants a P.Response but that's exactly what I'm giving it, so what's the problem?

    Read the article

  • CodePlex Daily Summary for Thursday, June 30, 2011

    CodePlex Daily Summary for Thursday, June 30, 2011Popular ReleasesASP.NET Comet Ajax Library (Reverse Ajax - Server Push): Reverse Ajax Samples v1.53: 16 Comprehensive ASP.NET Ajax / Reverse Ajax / WCF / MVC / Mono samplesReactive Extensions - Extensions (Rxx): Rxx 1.1: What's NewRelated Work Items Please read the latest release notes for details about what's new. About LabsAll "Labs" downloads include the Rxx.dll assembly, so only a single download is required. To start RxxLabs.exe, right-mouse click and select Run as Administrator; otherwise, do not run the Reactive WebClient lab because it will crash the program. RxxLabs.exe requires administrator privileges for the Reactive WebClient lab to register a local HTTP port. To launch the Silverlight labs...CommonLibrary.NET: CommonLibrary.NET - 0.9.7 Final: A collection of very reusable code and components in C# 4.0 ranging from ActiveRecord, Csv, Command Line Parsing, Configuration, Holiday Calendars, Logging, Authentication, and much more. Samples in <root>\src\Lib\CommonLibrary.NET\Samples CommonLibrary.NET 0.9.7Documentation 6738 6503 New 6535 Enhancements 6759 6748 6583 6737datajs - JavaScript Library for data-centric web applications: datajs version 1.0.0: datajs is a cross-browser and UI agnostic JavaScript library that enables data-centric web applications with the following features: OData client that enables CRUD operations including batching and metadata support using both ATOM and JSON payloads. Single store abstraction that provides a common API on top of HTML5 local storage technologies. Data cache component that allows reading data ranges from a collection and storing them locally to reduce the number of network requests. Changes...Coding4Fun Tools: Coding4Fun.Phone.Toolkit v1.4.4: Fix for http://coding4fun.codeplex.com/workitem/6869 was incomplete. Back button wouldn't return app bar. Corrected now. High impact bugSiteMap Editor for Microsoft Dynamics CRM 2011: SiteMap Editor (1.0.528.279): Added keyboard shortcuts: - Cut (CTRL+X) - Copy (CTRL+C) - Paste (CTRL+V) - Delete (CTRL+D) - Move up (CTRL+UP ARROW) - Move down (CTRL+DOWN ARROW) Added ability to save/load SiteMap from/to a Xml file on disk Bug fix: - Connect to a server through the status bar was throwing error "Object Reference not set to an instance of an object" - Rename TreeNode.Name after changing TreeNode.TextMicrosoft - Domain Oriented N-Layered .NET 4.0 App Sample: V2.01 ALPHA N-Layered SampleApp .NET 4.0 and EF4.1: V2.0.01 - ALPHARequired Software (Microsoft Base Software needed for Development environment) Visual Studio 2010 RTM & .NET 4.0 RTM (Final Versions) Expression Blend 4 SQL Server 2008 R2 Express/Standard/Enterprise Unity Application Block 2.0 - Published May 5th 2010 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2D24F179-E0A6-49D7-89C4-5B67D939F91B&displaylang=en http://unity.codeplex.com/releases/view/31277 PEX & MOLES 0.94.51023.0, 29/Oct/2010 - Visual Studio 2010 Power ...Mosaic Project: Mosaic Alpha build 261: - Fixed crash when pinning applications in x64 OS - Added Hub to video widget. It shows videos from Video library (only .wmv and .avi). Can work slow if there are too much files. - Fixed some issues with scrolling - Fixed bug with html widgets - Fixed bug in Gmail widget - Added html today widget missed in previous release - Now Mosaic saves running widgets if you restarting from optionsEnhSim: EnhSim 2.4.9 BETA: 2.4.9 BETAThis release supports WoW patch 4.2 at level 85 To use this release, you must have the Microsoft Visual C++ 2010 Redistributable Package installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84 To use the GUI you must have the .NET 4.0 Framework installed. This can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992 - Added in some of th....NET Reflector Add-Ins: Reflector V7 Add-Ins: All the add-ins compiled for Reflector V7TerrariViewer: TerrariViewer v4.1 [4.0 Bug Fixes]: Version 4.1 ChangelogChanged how users will Open Player files (This change makes it much easier) This allowed me to remove the "Current player file" labels that were present Changed file control icons Added submit bug button Various Bug Fixes Fixed crashes related to clicking on buffs before a character is loaded Fixed crashes related to selecting "No Buff" when choosing a new buff Fixed crashes related to clicking on a "Max" button on the buff tab before a character is loaded Cor...AcDown????? - Anime&Comic Downloader: AcDown????? v3.0 Beta8: ??AcDown???????????????,?????????????????????。????????????????????,??Acfun、Bilibili、???、???、?????,???????????、???????。 AcDown???????????????????????????,???,???????????????????。 AcDown???????C#??,?????"Acfun?????"。 ????32??64? Windows XP/Vista/7 ????????????? ??:????????Windows XP???,?????????.NET Framework 2.0???(x86)?.NET Framework 2.0???(x64),?????"?????????"??? ??????????????,??????????: ??"AcDown?????"????????? ??v3.0 Beta8 ?? ??????????????? ???????????????(??????????) ???????...BlogEngine.NET: BlogEngine.NET 2.5: Get DotNetBlogEngine for 3 Months Free! Click Here for More Info 3 Months FREE – BlogEngine.NET Hosting – Click Here! If you want to set up and start using BlogEngine.NET right away, you should download the Web project. If you want to extend or modify BlogEngine.NET, you should download the source code. If you are upgrading from a previous version of BlogEngine.NET, please take a look at the Upgrading to BlogEngine.NET 2.5 instructions. To get started, be sure to check out our installatio...PHP Manager for IIS: PHP Manager 1.2 for IIS 7: This release contains all the functionality available in 62183 plus the following additions: Command Line Support via PowerShell - now it is possible to manage and script PHP installations on IIS by using Windows PowerShell. More information is available at Managing PHP installations with PHP Manager command line. Detection and alert when using local PHP handler - if a web site or a directory has a local copy of PHP handler mapping then the configuration changes made on upper configuration ...MiniTwitter: 1.71: MiniTwitter 1.71 ???? ?? OAuth ???????????? ????????、??????????????????? ???????????????????????SizeOnDisk: 1.0.10.0: Fix: issue 327: size format error when save settings Fix: some UI bindings trouble (sorting, refresh) Fix: user settings file deletion when corrupted Feature: TreeView virtualization (better speed with many folders) Feature: New file type DataGrid column Feature: In KByte view, show size of file < 1024B and > 0 with 3 decimal Feature: New language: Italian Task: Cleanup for speedRawr: Rawr 4.2.0: This is the Downloadable WPF version of Rawr!For web-based version see http://elitistjerks.com/rawr.php You can find the version notes at: http://rawr.codeplex.com/wikipage?title=VersionNotes Rawr AddonWe now have a Rawr Official Addon for in-game exporting and importing of character data hosted on Curse. The Addon does not perform calculations like Rawr, it simply shows your exported Rawr data in wow tooltips and lets you export your character to Rawr (including bag and bank items) like Char...N2 CMS: 2.2: * Web platform installer support available ** Nuget support available What's newDinamico Templates (beta) - an MVC3 & Razor based template pack using the template-first! development paradigm Boilerplate CSS & HTML5 Advanced theming with css comipilation (concrete, dark, roadwork, terracotta) Template-first! development style Content, news, listing, slider, image sizes, search, sitemap, globalization, youtube, google map Display Tokens - replaces text tokens with rendered content (usag...KinectNUI: Jun 25 Alpha Release: Initial public version. No installer needed, just run the EXE.Terraria World Viewer: Version 1.5: Update June 24th Made compatible with the new tiles found in Terraria 1.0.5New Projects{Adjunct} functionality for the .NET framework: A project to provide Ingots for the .NET framework.3Webee.net: 3Webee.net is the First Navigator dedicated to Web.3.0 by P2P. Developped in C# for DotNet-3.5 or Mono.net, compatible with Linux ready. Website.fr : http://3webee.net/ Download Win32 : http://3webee.net/Download/3Webee.net.beta.0.0.Win32.exe AB Donor Choose Planner: The goal of this doantion planner is to allow you to coordinate the completion of one or more Donors Choose projects. The tool gives you a portfolio view of the donations you would like to invest in by targeting your investments in a location/regional focused manner.appperu1: asdasdsaddas: ColinTestingasdfFindClone: Find clone files, find duplicate files, remove duplicate filesfirstcpapp: This is my appForecast Parser: The NOAA hosts forecast data accessible over the web. These libraries download and parse seven day hourly forecast data and encapsulates the data in an easy to use class.Future Apple Osx: Future Apple Osx, Is a free operating system to use. It was built from the ground up with the help of Cosmos. It is free to use and download. So please check it out today.Glimpse: Glimpse is a web debugger and diagnostics tool for ASP.NET and ASP.NET MVC. You can find out more at getGlimpse.comiAdm: ?? iToday ??? wince 6 R2 ?????ImagineCup Worldwide Finals Tracker: An open-source Windows Phone application that is used to track the events going on at the ImagineCup Worldwide Finals.John Owl: John OwlLAM - Local Area Messaging: A VB.NET local area chat application. Finds the lan clients and communicates through the lan with old Ms-Winsock Interop.MessyBrain: Organize your tasks in an efficient way. Assign tasks to members of your team. Create workflows for your team. Written in C# and ASP.NET MVC. Why did I start this project? Making mistakes is part of the learning process. They can be painful especially when they are made at work; there’s a cost attached to it. Why not start a project on my own? Mistakes will be less painful (only my ego will be damaged), I learn something new and there isn’t a cost attached to it. I can share the code ...Navigation Light Toolkit: Navigation Light add support for View Navigation in WPF and SilverlightRight Click Calculator: a mini calculator with numpad that opens in a dialogbox. it can combined with a textbox. bir textbox üzerinde sag tus ile açabileceginiz ufak bir hesap makinesi örnegi.Shaaps & Ladders: It's a modern software implementation of the popular classic board game Snakes & Ladders. The Bengali translation of "Snakes" pronounces "Shaaps" and thus the name of the game is such. The game is being developed on top of the Shaaps & Ladders GDK. Source for both are released.SharePoint PowerShell Scripts: Usefull PowerShell scripts written for SharePoint that helps organizations with governance.Smith Web Tools: Smith Web Tools are some useful controls to help to build web application. They are written in pure JavaScript and CSS without introducing any other JavaScript framework. At present, the Smith Calendar, Smith Editor, and Smith Dialog are available.SSAS Query Log Decoder & Analyzer: The Crisp description for the project will be "CUBE FOR CUBE". This is an end-to-end BI solution for analyzing the Query log created by SSAS Server. The Query Log data is loaded into a dimensional model and a cube is built on top of it for analysis of cube usage.takcandmansys: takcandmansysTestHG1: TestHG1TESTProjHG: TESTProjHGTestTFS1: TestTFS1TESTTFSAAA: TESTTFSAAATower: tower showTransit Feed Generator: Library for help the integration with Google Transit. This library generates the zipped file with data for Google Transit Feed, in the GTFS formatVRE Collaborator Search Kit for SharePoint 2010: VRE Collaborator Search Kit for SharePoint 2010VRE Content Archiving Kit for SharePoint 2010: VRE Content Archiving Kit for SharePoint 2010VRE Document Review Workflow Kit for SharePoint 2010: VRE Document Review Workflow Kit for SharePoint 2010 VRE Literature Review Kit for SharePoint 2010: VRE Literature Review Kit for SharePoint 2010 VRE Researcher and Project Templates for SharePoint 2010: VRE Researcher and Project Templates for SharePoint 2010 VRE RSS Feeds Kit for SharePoint 2010: VRE RSS Feeds Kit for SharePoint 2010 VRE User Administration (FBA) Kit for SharePoint 2010: VRE User Administration (FBA) Kit for SharePoint 2010 WebPart Collapser: WebPart Collapser is a lightweight, customizable jQuery plugin for SharePoint 2007 that allows visitors to expand/collapse WebParts. Through the use of cookies, the collapsed state of any webparts will be saved and collapsed each time a user visits a page. WPF Hex Editor: hex editor which is created with WPF with a xaml designed UI.Xoorscript: A proprietary scripting language created by Jared Thomson for the purpose of script defining an easy to use make system. The plans for this project are minimal for now, but if things go well I may expand it. This is low priority for me.

    Read the article

  • SQL SERVER – Shrinking Database is Bad – Increases Fragmentation – Reduces Performance

    - by pinaldave
    Earlier, I had written two articles related to Shrinking Database. I wrote about why Shrinking Database is not good. SQL SERVER – SHRINKDATABASE For Every Database in the SQL Server SQL SERVER – What the Business Says Is Not What the Business Wants I received many comments on Why Database Shrinking is bad. Today we will go over a very interesting example that I have created for the same. Here are the quick steps of the example. Create a test database Create two tables and populate with data Check the size of both the tables Size of database is very low Check the Fragmentation of one table Fragmentation will be very low Truncate another table Check the size of the table Check the fragmentation of the one table Fragmentation will be very low SHRINK Database Check the size of the table Check the fragmentation of the one table Fragmentation will be very HIGH REBUILD index on one table Check the size of the table Size of database is very HIGH Check the fragmentation of the one table Fragmentation will be very low Here is the script for the same. USE MASTER GO CREATE DATABASE ShrinkIsBed GO USE ShrinkIsBed GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Create FirstTable CREATE TABLE FirstTable (ID INT, FirstName VARCHAR(100), LastName VARCHAR(100), City VARCHAR(100)) GO -- Create Clustered Index on ID CREATE CLUSTERED INDEX [IX_FirstTable_ID] ON FirstTable ( [ID] ASC ) ON [PRIMARY] GO -- Create SecondTable CREATE TABLE SecondTable (ID INT, FirstName VARCHAR(100), LastName VARCHAR(100), City VARCHAR(100)) GO -- Create Clustered Index on ID CREATE CLUSTERED INDEX [IX_SecondTable_ID] ON SecondTable ( [ID] ASC ) ON [PRIMARY] GO -- Insert One Hundred Thousand Records INSERT INTO FirstTable (ID,FirstName,LastName,City) SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Insert One Hundred Thousand Records INSERT INTO SecondTable (ID,FirstName,LastName,City) SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO Let us check the table size and fragmentation. Now let us TRUNCATE the table and check the size and Fragmentation. USE MASTER GO CREATE DATABASE ShrinkIsBed GO USE ShrinkIsBed GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Create FirstTable CREATE TABLE FirstTable (ID INT, FirstName VARCHAR(100), LastName VARCHAR(100), City VARCHAR(100)) GO -- Create Clustered Index on ID CREATE CLUSTERED INDEX [IX_FirstTable_ID] ON FirstTable ( [ID] ASC ) ON [PRIMARY] GO -- Create SecondTable CREATE TABLE SecondTable (ID INT, FirstName VARCHAR(100), LastName VARCHAR(100), City VARCHAR(100)) GO -- Create Clustered Index on ID CREATE CLUSTERED INDEX [IX_SecondTable_ID] ON SecondTable ( [ID] ASC ) ON [PRIMARY] GO -- Insert One Hundred Thousand Records INSERT INTO FirstTable (ID,FirstName,LastName,City) SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Insert One Hundred Thousand Records INSERT INTO SecondTable (ID,FirstName,LastName,City) SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY a.name) RowID, 'Bob', CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'Smith' ELSE 'Brown' END, CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'New York' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'San Marino' WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Los Angeles' ELSE 'Houston' END FROM sys.all_objects a CROSS JOIN sys.all_objects b GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO You can clearly see that after TRUNCATE, the size of the database is not reduced and it is still the same as before TRUNCATE operation. After the Shrinking database operation, we were able to reduce the size of the database. If you notice the fragmentation, it is considerably high. The major problem with the Shrink operation is that it increases fragmentation of the database to very high value. Higher fragmentation reduces the performance of the database as reading from that particular table becomes very expensive. One of the ways to reduce the fragmentation is to rebuild index on the database. Let us rebuild the index and observe fragmentation and database size. -- Rebuild Index on FirstTable ALTER INDEX IX_SecondTable_ID ON SecondTable REBUILD GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO You can notice that after rebuilding, Fragmentation reduces to a very low value (almost same to original value); however the database size increases way higher than the original. Before rebuilding, the size of the database was 5 MB, and after rebuilding, it is around 20 MB. Regular rebuilding the index is rebuild in the same user database where the index is placed. This usually increases the size of the database. Look at irony of the Shrinking database. One person shrinks the database to gain space (thinking it will help performance), which leads to increase in fragmentation (reducing performance). To reduce the fragmentation, one rebuilds index, which leads to size of the database to increase way more than the original size of the database (before shrinking). Well, by Shrinking, one did not gain what he was looking for usually. Rebuild indexing is not the best suggestion as that will create database grow again. I have always remembered the excellent post from Paul Randal regarding Shrinking the database is bad. I suggest every one to read that for accuracy and interesting conversation. Let us run following script where we Shrink the database and REORGANIZE. -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO -- Shrink the Database DBCC SHRINKDATABASE (ShrinkIsBed); GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO -- Rebuild Index on FirstTable ALTER INDEX IX_SecondTable_ID ON SecondTable REORGANIZE GO -- Name of the Database and Size SELECT name, (size*8) Size_KB FROM sys.database_files GO -- Check Fragmentations in the database SELECT avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID('SecondTable'), NULL, NULL, 'LIMITED') GO You can see that REORGANIZE does not increase the size of the database or remove the fragmentation. Again, I no way suggest that REORGANIZE is the solution over here. This is purely observation using demo. Read the blog post of Paul Randal. Following script will clean up the database -- Clean up USE MASTER GO ALTER DATABASE ShrinkIsBed SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO DROP DATABASE ShrinkIsBed GO There are few valid cases of the Shrinking database as well, but that is not covered in this blog post. We will cover that area some other time in future. Additionally, one can rebuild index in the tempdb as well, and we will also talk about the same in future. Brent has written a good summary blog post as well. Are you Shrinking your database? Well, when are you going to stop Shrinking it? Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Index, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >