Daily Archives

Articles indexed Friday May 14 2010

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

  • SQL SERVER – Find Most Expensive Queries Using DMV

    - by pinaldave
    The title of this post is what I can express here for this quick blog post. I was asked in recent query tuning consultation project, if I can share my script which I use to figure out which is the most expensive queries are running on SQL Server. This script is very basic and very simple, there are many different versions are available online. This basic script does do the job which I expect to do – find out the most expensive queries on SQL Server Box. SELECT TOP 10 SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.total_logical_writes, qs.last_logical_writes, qs.total_worker_time, qs.last_worker_time, qs.total_elapsed_time/1000000 total_elapsed_time_in_S, qs.last_elapsed_time/1000000 last_elapsed_time_in_S, qs.last_execution_time, qp.query_plan FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp ORDER BY qs.total_logical_reads DESC -- logical reads -- ORDER BY qs.total_logical_writes DESC -- logical writes -- ORDER BY qs.total_worker_time DESC -- CPU time You can change the ORDER BY clause to order this table with different parameters. I invite my reader to share their scripts. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Optimization, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQLAuthority News, SQLServer, T SQL, Technology Tagged: SQL DMV

    Read the article

  • Discover the Secrets to Obtaining Website Backlinks

    You could be wondering how effective websites or web pages would be without back-links and SEO. You are correct in your assumption that websites without back-links and the Search Engine Optimizations (SEO) are not worth their name. This article provides valuable backlink information.

    Read the article

  • WPF Image change source when button is disabled

    - by Taylor
    Hi, I'm trying to show a different image when the button is disabled. Should be easy with triggers, right?! For some reason, I have not been able to get the images to switch. I've tried setting triggers on both the image and button. What is wrong with what I have below? How can I change the image source when the button is enabled/disabled? Thanks! <Button x:Name="rleft" Command="{Binding Path=Operation}" CommandParameter="{x:Static vm:Ops.OpA}"> <Button.Content> <StackPanel> <Image Width="24" Height="24" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" Source="/MyAssembly;component/images/enabled.png"> <Image.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=rleft, Path=Button.IsEnabled}" Value="False"> <Setter Property="Image.Source" Value="/MyAssembly;component/images/disabled.png" /> </DataTrigger> </Style.Triggers> </Style> </Image.Style> </Image> </StackPanel> </Button.Content> </Button>

    Read the article

  • How can I setup my Netbeans IDE for making Jave ME applications?

    - by Sergio Tapia
    Ok, I have Netbeans 6.7.1 installed with the default Java SDK. I'm using Linux Mint. Now I'm told that I have to download Java Platform Micro Edition Software Development Kit 3.0 So, should I download this? And once I download and install this in Linux, what do I have to install for Netbeans so I can create a Mobile Application? I'm fairly new to this environment so please any advice is welcome! :)

    Read the article

  • How do I use accepts_nested_attributes_for?

    - by Angela
    Editing my question for conciseness and to update what I've done: How do I model having multiple Addresses for a Company and assign a single Address to a Contact, and be able to assign them when creating or editing a Contact? I want to use nested attributes to be able to add an address at the time of creating a new contact. That address exists as its own model because I may want the option to drop-down from existing addresses rather than entering from scratch. I can't seem to get it to work. I get a undefined method `build' for nil:NilClass error Here is my model for Contacts: class Contact < ActiveRecord::Base attr_accessible :first_name, :last_name, :title, :phone, :fax, :email, :company, :date_entered, :campaign_id, :company_name, :address_id, :address_attributes belongs_to :company belongs_to :address accepts_nested_attributes_for :address end Here is my model for Address: class Address < ActiveRecord::Base attr_accessible :street1, :street2, :city, :state, :zip has_many :contacts end I would like, when creating an new contact, access all the Addresses that belong to the other Contacts that belong to the Company. So here is how I represent Company: class Company < ActiveRecord::Base attr_accessible :name, :phone, :addresses has_many :contacts has_many :addresses, :through => :contacts end Here is how I am trying to create a field in the View for _form for Contact so that, when someone creates a new Contact, they pass the address to the Address model and associate that address to the Contact: <% f.fields_for :address, @contact.address do |builder| %> <p> <%= builder.label :street1, "Street 1" %> </br> <%= builder.text_field :street1 %> <p> <% end %> When I try to Edit, the field for Street 1 is blank. And I don't know how to display the value from show.html.erb. At the bottom is my error console -- can't seem to create values in the address table: My Contacts controller is as follows: def new @contact = Contact.new @contact.address.build # Iundefined method `build' for nil:NilClass @contact.date_entered = Date.today @campaigns = Campaign.find(:all, :order => "name") if params[:campaign_id].blank? else @campaign = Campaign.find(params[:campaign_id]) @contact.campaign_id = @campaign.id end if params[:company_id].blank? else @company = Company.find(params[:company_id]) @contact.company_name = @company.name end end def create @contact = Contact.new(params[:contact]) if @contact.save flash[:notice] = "Successfully created contact." redirect_to @contact else render :action => 'new' end end def edit @contact = Contact.find(params[:id]) @campaigns = Campaign.find(:all, :order => "name") end Here is a snippet of my error console: I am POSTING the attribute, but it is not CREATING in the Address table.... Processing ContactsController#create (for 127.0.0.1 at 2010-05-12 21:16:17) [POST] Parameters: {"commit"="Submit", "authenticity_token"="d8/gx0zy0Vgg6ghfcbAYL0YtGjYIUC2b1aG+dDKjuSs=", "contact"={"company_name"="Allyforce", "title"="", "campaign_id"="2", "address_attributes"={"street1"="abc"}, "fax"="", "phone"="", "last_name"="", "date_entered"="2010-05-12", "email"="", "first_name"="abc"}} Company Load (0.0ms)[0m [0mSELECT * FROM "companies" WHERE ("companies"."name" = 'Allyforce') LIMIT 1[0m Address Create (16.0ms)[0m [0;1mINSERT INTO "addresses" ("city", "zip", "created_at", "street1", "updated_at", "street2", "state") VALUES(NULL, NULL, '2010-05-13 04:16:18', NULL, '2010-05-13 04:16:18', NULL, NULL)[0m Contact Create (0.0ms)[0m [0mINSERT INTO "contacts" ("company", "created_at", "title", "updated_at", "campaign_id", "address_id", "last_name", "phone", "fax", "company_id", "date_entered", "first_name", "email") VALUES(NULL, '2010-05-13 04:16:18', '', '2010-05-13 04:16:18', 2, 2, '', '', '', 5, '2010-05-12', 'abc', '')[0m

    Read the article

  • C# collection/string .Contains vs collection/string.IndexOf

    - by Daniel
    Is there a reason to use .Contains on a string/list instead of .IndexOf? Most code that I would write using .Contains would shortly after need the index of the item and therefore would have to do both statements. But why not both in one? if ((index = blah.IndexOf(something) = 0) // i know that Contains is true and i also have the index

    Read the article

  • Speech Recognition Grammar Rules using delphi code

    - by XBasic3000
    I need help to make ISeechRecoGrammar without using xml format. Like creating it on runtime on delphi. example: procedure TForm1.FormCreate(Sender: TObject); var AfterCmdState: ISpeechGrammarRuleState; temp : OleVariant; Grammar: ISpeechRecoGrammar; PropertiesRule: ISpeechGrammarRule; ItemRule: ISpeechGrammarRule; TopLevelRule: ISpeechGrammarRule; begin SpSharedRecoContext.EventInterests := SREAllEvents; Grammar := SpSharedRecoContext.CreateGrammar(m_GrammarId); TopLevelRule := Grammar.Rules.Add('TopLevelRule', SRATopLevel Or SRADynamic, 1); PropertiesRule := Grammar.Rules.Add('PropertiesRule', SRADynamic, 2); ItemRule := Grammar.Rules.Add('ItemRule', SRADynamic, 3); AfterCmdState := TopLevelRule.AddState; TopLevelRule.InitialState.AddWordTransition(AfterCmdState, 'test', temp, temp, '****', 0, temp, temp); Grammar.Rules.Commit; Grammar.CmdSetRuleState('TopLevelRule', SGDSActive); end; can someone reconstruct or midify this delphi code (above) to be exactly same function below(xml). <GRAMMAR LANGID="409"> <!-- "Constant" definitions --> <DEFINE> <ID NAME="RID_start" VAL="1"/> <ID NAME="PID_action" VAL="2"/> <ID NAME="PID_actionvalue" VAL="3"/> </DEFINE> <!-- Rule definitions --> <RULE NAME="start" ID="RID_start" TOPLEVEL="ACTIVE"> <P>i am</P> <RULEREF NAME="action" PROPNAME="action" PROPID="PID_action" /> <O>OK</O> </RULE> <RULE NAME="action"> <L PROPNAME="actionvalue" PROPID="PID_actionvalue"> <P VAL="1">albert</P> <P VAL="2">francis</P> <P VAL="3">alex</P> </L> </RULE> </GRAMMAR> sorry for my english...

    Read the article

  • Add the Date Filter SharePoint webpart to an ASP.Net page

    - by Javaman59
    I want to add the out-of-the-box SharePoint date filter webpart to an ASP.Net web page. I want to do it either in an ASPX... <%@ Register Assembly="<DatePickerDLL??>" Namespace="<??>" TagPrefix="DP" %> <...> <asp:WebPartManager ID="WebPartManager1" runat="server"> </asp:WebPartManager> <...> <ZoneTemplate> <DP:<DatePickerWebPart??> ID="DatePicker" runat="server" /> or programmatically, in the ASPX.CS protected void Page_Load(object sender, EventArgs e) { this.Controls.Add(<Microsoft.Something.DatePicker??> }

    Read the article

  • How can I update .RData?

    - by Stedy
    After reading this question I attempted to clean out my workspace and found that each time I opened R all the original items I had recently removed were restored. I then checked .RData and found that it had not been modified in a few weeks even though I repeatedly saved the workspace image. How often is .RData updated and how can I change when .RData is updated so that it reflects more recent changes?

    Read the article

  • List of Users and Role using Membership Provider

    - by Jemes
    I’m trying to produce a view to show a list of users and their role using the built in membership provider. My model and controller are picking up the users and roles but I’m having trouble displaying them in my view. Model public class AdminViewModel { public MembershipUserCollection Users { get; set; } public string[] Roles { get; set; } } Controller public ActionResult Admin() { AdminViewModel viewModel = new AdminViewModel { Users = MembershipService.GetAllUsers(), Roles = RoleService.GetRoles() }; return View(viewModel); } View Inherits="System.Web.Mvc.ViewPage<IEnumerable<Account.Models.AdminViewModel>>" <table> <tr> <td>UserName</td> <td>Email</td> <td>IsOnline</td> <td>CreationDate</td> <td>LastLoginDate</td> <td>LastActivityDate</td> </tr> <% foreach (var item in Model) { %> <tr> <td><%=item.UserName %></td> <td><%=item.Email %></td> <td><%=item.IsOnline %></td> <td><%=item.CreationDate %></td> <td><%=item.LastLoginDate %></td> <td><%=item.LastActivityDate %></td> <td><%=item.ROLE %></td> </tr> <% }%> </table>

    Read the article

  • Bitmap Crashing upon going back and re-entering Activity

    - by dagonal
    Hello, I'm not sure what is causing this...I have two Activities, first has a button that goes to the second. The second creates a Bitmap object, assigns it a picture from the sdcard and loads it into an ImageView. Problem is when I go into the second Activity, then press the back button, and then go back into the second Activity, it crashes. I have no clue why. I did an extensive google search but to no avail. I can post the source code if you want. Please let me know. Thanks in advance! I got this from the LogCat: "E/dalvikvm( 4869): Unable to open stack trace file '/data/anr/traces.txt': Permission denied" I'm not sure how to get the stack trace.

    Read the article

  • jQuery color plugin: onMouseOver animation causes flickering in FF3.5.5

    - by rt-uk
    I'm trying to change the background color of a div on mouseover and mouseout. Instant change to yellow on MouseOver, and slow fade on MouseOut. function hilightel(keydiv) { $('#'+keydiv).animate({ backgroundColor: '#ffffd3' },1); } function lolightel(keydiv) { $('#'+keydiv).animate({ backgroundColor: '#ffffff' },300); } < div onMouseOver=javascript:highlightel('item1'); onMouseOut=javascript:lolightel('item1'); id='item1'CONTENT< /div When the mouse moves over text within the div, though, it thinks I've moused-out and so flickers badly. Alternatives that don't work: - animateToClass doesn't support background-color so I'm using the 'color' plugin - I hear that switchClass doesn't work in Chrome - Can't use .hover because their will be dynamically named divs in the page so need a general function Thanks in advance...

    Read the article

  • maven compile fails because i have a non-maven jar

    - by pstanton
    i have a couple of internal libraries which i haven't/don't know how to add to my local maven repository. i've added them to the project's classpath but my maven-compile failes stating that it can't find the classes in the external jars (as expected): [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project proj: Compilation failure: Compilation failure: dir\src\main\java\package\MyClass.java:[8,25] package blah does not exist dir\src\main\java\package\MyClass.java:[9,25] package blah does not exist dir\src\main\java\package\MyClass.java:[21,12] cannot find symbol symbol : variable Blah location: class package.MyClass dir\src\main\java\package\MyClass.java:[28,9] cannot find symbol symbol : variable Blah location: class package.MyClass how do i tell maven about a jar i've sneakily added to my project's classpath so it can use it to compile?

    Read the article

  • My "Ah-Ha!" Moment With LINQ

    - by CompiledMonkey
    I'm currently working on a set of web services that will be consumed by iPhone and Android devices. Given how often the web services will be called in a relatively short period of time, the data access for the web services has proven to be a very important aspect of the project. In choosing the technology stack for implementation, I opted for LINQ to SQL as it was something I had dabbled with in the past and wanted to learn more about in a real environment. The query optimization happening behind...(read more)

    Read the article

  • Good text editors or viewers for large log files

    - by Kristopher Johnson
    Log files and other textual data files are often tens or hundreds of megabytes in size, and some editors choke when you try to open something so large. What are some good applications for viewing large files? Bonus points for apps that can open compressed files, search for things with regular expressions, parse output lines, etc.

    Read the article

  • alias some columns names as one field in oracle's join select query

    - by Marecky
    Hi We are developing something like a social networking website. I've got task to do 'follow me' functionality. In our website objects are users, teams, companies, channels and groups (please don't ask why there are groups and teams - it is complicated for me too, but teams are releated to user's talent) Users, teams, channels, companies and groups have all their own tables. I have a query which gets me all the follower's leaders like this select --fo.leader_id, --fo.leader_type, us.name as user_name, co.name as company_name, ch.title as channel_name, gr.name as group_name, tt.name as team_name from follow_up fo left join users us on (fo.leader_id = us.id and fo.leader_type = 'user') left join companies co on (fo.leader_id = co.user_id and fo.leader_type = 'company') left join channels ch on (fo.leader_id = ch.id and fo.leader_type = 'channel') left join groups gr on (fo.leader_id = gr.id and fo.leader_type = 'group') left join talent_teams tt on (fo.leader_id = tt.id and fo.leader_type = 'team') where follower_id = 83 I need to get all fields like: user_name, company_name, channel_name, group_name, team_name as one field in SELECT's product. I have tried to alias them all the same 'name' but Oracle numbered it. Please help :)

    Read the article

  • ASP.NET MVC AuthorizeAttribute passing values to ActionMethod?

    - by subskii
    Hi everyone I'm only a newcomer to ASP.NET MVC and am not sure how to achieve a certain task the "right way". Essentially, I store the logged in userId in HttpContext.User.Identity and have written an EnhancedAuthorizeAttribute to perform some custom authorization. In the overriden OnAuthorization method, my domain model hits the database to ensure the current user id can access the passed in routeValue "BatchCode". The prototype is: ReviewGroup GetReviewGroupFromBatchCode(string batchCode); It will return null if the user can't access the ReviewGroup and the OnAuthorization then denies access. Now, I know the decorated action method will only get executed if OnAuthorization passes, but I don't want to hit the database a second time to get the ReviewGroup again. I am thinking of storing the ReviewGroup in HttpContext.Items["reviewGroup"] and accessing this from the controller at the moment. Is this a feasible solution, or am I on the wrong path? Thanks!

    Read the article

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