Daily Archives

Articles indexed Monday April 26 2010

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

  • Are indexes good or bad for a large database?

    - by gmemon
    Hello All, I read on MySQL Performance Blog that when tables are large, it is better to scan full tables, instead of using indexes. I have a table with tens of millions of rows. When conducting queries, if I use no indexes, then queries are 24 times slower than with indexes. I know lot of things may cause this (e.g., are rows stored sequentially), but can you please give me some hints what might be happening? Or how I should start examining this issue? I want to understand when use of indexes is preferred and when it's not Thanks

    Read the article

  • Java java.util.ConcurrentModificationException error

    - by vijay
    Hi all, please can anybody help me solve this problem last so many days I could not able to solve this error. I tried using synchronized method and other ways but did not work so please help me Error java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(Unknown Source) at java.util.AbstractList$Itr.remove(Unknown Source) at JCA.startAnalysis(JCA.java:103) at PrgMain2.doPost(PrgMain2.java:235) Code public synchronized void startAnalysis() { //set Starting centroid positions - Start of Step 1 setInitialCentroids(); Iterator<DataPoint> n = mDataPoints.iterator(); //assign DataPoint to clusters loop1: while (true) { for (Cluster c : clusters) { c.addDataPoint(n.next()); if (!n.hasNext()) break loop1; } } //calculate E for all the clusters calcSWCSS(); //recalculate Cluster centroids - Start of Step 2 for (Cluster c : clusters) { c.getCentroid().calcCentroid(); } //recalculate E for all the clusters calcSWCSS(); // List copy = new ArrayList(originalList); //synchronized (c) { for (int i = 0; i < miter; i++) { //enter the loop for cluster 1 for (Cluster c : clusters) { for (Iterator<DataPoint> k = c.getDataPoints().iterator(); k.hasNext(); ) { // synchronized (k) { DataPoint dp = k.next(); System.out.println("Value of DP" +dp); //pick the first element of the first cluster //get the current Euclidean distance double tempEuDt = dp.getCurrentEuDt(); Cluster tempCluster = null; boolean matchFoundFlag = false; //call testEuclidean distance for all clusters for (Cluster d : clusters) { //if testEuclidean < currentEuclidean then if (tempEuDt > dp.testEuclideanDistance(d.getCentroid())) { tempEuDt = dp.testEuclideanDistance(d.getCentroid()); tempCluster = d; matchFoundFlag = true; } //if statement - Check whether the Last EuDt is > Present EuDt } //for variable 'd' - Looping between different Clusters for matching a Data Point. //add DataPoint to the cluster and calcSWCSS if (matchFoundFlag) { tempCluster.addDataPoint(dp); //k.notify(); // if(k.hasNext()) k.remove(); for (Cluster d : clusters) { d.getCentroid().calcCentroid(); } //for variable 'd' - Recalculating centroids for all Clusters calcSWCSS(); } //if statement - A Data Point is eligible for transfer between Clusters. // }// syn } //for variable 'k' - Looping through all Data Points of the current Cluster. }//for variable 'c' - Looping through all the Clusters. }//for variable 'i' - Number of iterations. // syn }

    Read the article

  • Fluent many-to-many: Deleting one end does not remove the entry in the relation table

    - by Kristoffer
    I have two classes (Parent, Child) that have a many-to-many relationship that only one end (Parent) knows about. My problem is that when I delete a "relation unaware" object (Child), the record in the many-to-many table is left. I want the relationship to be removed regardless of which end of it is deleted. How can I do that with Fluent NHibernate mappings, without adding a Parent property on Child? The classes: public class Parent { public Guid Id { get; set; } public IList<Child> Children { get; set; } } public class Child { public Guid Id { get; set; } // Don't want the property below: // public Parent Parent { get; set; } }

    Read the article

  • Rspec-rails doesn't seem to find my models

    - by sa125
    Hi - I'm trying out rspec, and immediately hit a wall when it doesn't seem to load db records I know exist. Here's my fairly simple spec (no tests yet). require File.expand_path(File.dirname(__FILE__) + '../spec_helper') describe SomeModel do before :each do @user1 = User.find(1) @user2 = User.find(2) end it "should do something fancy" end I get an ActiveRecord::RecordNotFound exception, saying it couldn't find User w/ ID=1 or ID=2, which I know for a fact exist. I set both test and development databases to point to the same schema in database.yml, so this shouldn't be database mixup. I also ran script/generate rspec after installing the gems (rspec, rspec-rails), and gem.config both environment.rb and test.rb. Any idea what I'm missing? thanks. EDIT Seems I was running the tests with rake spec:models, which emptied the db and thus no records were found. When I used % spec spec/models/some_model_spec.rb, everything worked as expected.

    Read the article

  • Copying subversion commit messages

    - by Falcor
    I know this isn't the BEST practice, but every once in a while when I'm merging up a huge batch up changes with the trunk (and I know my branch is current), I will simply delete the contents of the trunk and then copy the contents of my branch up, so that I don't have to deal with resolving conflicts for an hour. The problem is that I seem to lose the entire history of commit messages for each file. My branch still has the correct history of commit messages... how can I merge them up?

    Read the article

  • Can the Diamond Problem be really solved?

    - by Mecki
    A typical problem in OO programming is the diamond problem. I have parent class A with two sub-classes B and C. A has an abstract method, B and C implement it. Now I have a sub-class D, that inherits of B and C. The diamond problem is now, what implementation shall D use, the one of B or the one of C? People claim Java knows no diamond problem. I can only have multiple inheritance with interfaces and since they have no implementation, I have no diamond problem. Is this really true? I don't think so. See below: [removed vehicle example] Is a diamond problem always the cause of bad class design and something neither programmer nor compiler needs to solve, because it shouldn't exist in the first place? Update: Maybe my example was poorly chosen. See this image Of course you can make Person virtual in C++ and thus you will only have one instance of person in memory, but the real problem persists IMHO. How would you implement getDepartment() for GradTeachingFellow? Consider, he might be student in one department and teach in another one. So you can either return one department or the other one; there is no perfect solution to the problem and the fact that no implementation might be inherited (e.g. Student and Teacher could both be interfaces) doesn't seem to solve the problem to me.

    Read the article

  • C++ Recursion Issue

    - by stupidmonkey
    Hi guys, I feel a little dumb asking this, but here we go... When trying to follow the Recursion example at the following website http://www.cplusplus.com/doc/tutorial/functions2/, I ran into a road bump that has me perplexed. I altered the code slightly just to get my head around the code in the recursion example and I pretty much have my head around it, but I can't figure out why the variable 'n' increments in 'Pass B' when I have not told the program to increment 'n'. Could you please help explain this? #include <stdlib.h> #include <iostream> using namespace std; long factorial (long n) { if (n > 1) { long r(0); cout << "Pass A" << endl; cout << "n = " << n << endl; cout << "r = " << r << endl; r = n * factorial (n-1); cout << "Pass B" << endl; cout << "n = " << n << endl; cout << "r = " << r << endl; return (r); } else return (1); } int main () { long number; cout << "Please type a number: "; cin >> number; cout << number << "! = " << factorial (number) << endl; system ("pause"); return 0; }

    Read the article

  • Compiling my own PHP extension on Windows with Visual Studio 2008

    - by Mickey Shine
    I wrote a PHP extension and it could be compiled and run under linux successfully. But on windows, I met some problems. I did the compiling on windows according to http://blog.slickedit.com/?p=128 with PHP source version 5.2.10, and after the compiling it generated the dll file. But when I tried to use the dll file, it reported me the memory problems when starting Apache(Wamp server). And then I started the debugging process, it seemed that REGISTER_INI_ENTRIES() had problems. Here is the PHP extension source code, http://www.bluefly.cn/xsplit.tar.gz , and it works fine on Linux. But I also want to make it work on Windows. Sorry I am not a pro so that I hope someone can help me. Any help is appreciated and thanks in advance~

    Read the article

  • How to change the data in Telerik's RadGrid based on Calendar's selected dates?

    - by Jronny
    I was creating another usercontrol with Telerik's RadGrid and Calendar. <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <table class="style1"> <tr> <td>From</td> <td>To</td> </tr> <tr> <td><asp:Calendar ID="Calendar1" runat="server" SelectionMode="Day"></asp:Calendar></td> <td><asp:Calendar ID="Calendar2" runat="server" SelectionMode="Day"></asp:Calendar></td> </tr> <tr> <td><asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /></td> <td><asp:Button ID="btnClear" runat="server" Text="Clear" OnClick="btnClear_Click" /></td> </tr> </table> <telerik:RadGrid ID="RadGrid1" runat="server"> <MasterTableView CommandItemDisplay="Top"></MasterTableView> </telerik:RadGrid> and I am using Linq in code-behind: Entities1 entities = new Entities1(); public static object DataSource = null; protected void Page_Load(object sender, EventArgs e) { if (DataSource == null) { DataSource = (from entity in entities.nsc_moneytransaction select new { date = entity.transaction_date.Value, username = entity.username, cashbalance = entity.cash_balance }).OrderByDescending(a => a.date); } BindData(); } public void BindData() { RadGrid1.DataSource = DataSource; } protected void btnSubmit_Click(object sender, EventArgs e) { DateTime startdate = new DateTime(); DateTime enddatedate = new DateTime(); if (Calendar1.SelectedDate != null && Calendar2.SelectedDate != null) { startdate = Calendar1.SelectedDate; enddatedate = Calendar2.SelectedDate; var queryDateRange = from entity in entities.nsc_moneytransaction where DateTime.Parse(entity.transaction_date.Value.ToShortDateString()) >= DateTime.Parse(startdate.ToShortDateString()) && DateTime.Parse(entity.transaction_date.Value.ToShortDateString()) <= DateTime.Parse(enddatedate.ToShortDateString()) select new { date = entity.transaction_date.Value, username = entity.username, cashbalance = entity.cash_balance }; DataSource = queryDateRange.OrderByDescending(a => a.date); } else if (Calendar1.SelectedDate != null) { startdate = Calendar1.SelectedDate; var querySetDate = from entity in entities.nsc_moneytransaction where entity.transaction_date.Value == startdate select new { date = entity.transaction_date.Value, username = entity.username, cashbalance = entity.cash_balance }; DataSource = querySetDate.OrderByDescending(a => a.date); ; } BindData(); } protected void btnClear_Click(object sender, EventArgs e) { Calendar1.SelectedDates.Clear(); Calendar2.SelectedDates.Clear(); } The problems are, (1) when I click the submit button. the data in the RadGrid is not changed. (2) how can we check if there is nothing selected in the Calendar controls, because there is a date (01/01/0001) set even if we do not select anything from that calendar, thus Calendar1.SelectedDate != null is not enough. =( Thanks.

    Read the article

  • Jquery Datepicker not selecting the default date

    - by Chirantan
    I have my datepicker set up like this $("#scheduled_date_163").datepicker({ onSelect: function(dateText, inst) { jQuery.get("/tasks/inplace_edit?id=scheduled_date_163&class_name=Task&value=" + dateText, function(data){ $('#scheduled_date_163').html(data); $('#scheduled_date_163').removeClass('hasDatepicker'); }) } }); $('#scheduled_date_163').datepicker( "option", "defaultDate", $.datepicker.parseDate("d m y", "31 8 2009") ); As you can see the date is hardcoded. It is supposed to be replaced with some code. However, the datepicker refuses to pick the date up! It always shows me the current date. Unable to figure out why. I even tried giving the date in string and +7 etc. But today's date itself is shown as the default date. What could be causing this?

    Read the article

  • ExtJS: dynamically ajust layout after adding/removing some form fields

    - by Sergei Stolyarov
    I have form layout with some TextField elements and one HtmlEditor element. Some TextField elements are "hideable", i.e. could be hid or showed. After hiding/showing elements HtmlEditor instance break layout — there appear empty space or element doesn't end at the window border. Is it possible to tell to HtmlEditor instance use all remaining available space? Even in case when some elements are hidden/showed. I've tried to use anchor property, but it works well until some element removed from the layout. Updated Here is a sample code: var htmlEditor = new Ext.form.HtmlEditor({ anchor: '100% -54', hideLabel: true }); var fp = new Ext.form.FormPanel({ items: [{xtype: 'textfield', fieldLabel: 'zzz', mode: 'local'}, {xtype: 'textfield', fieldLabel: 'nnn', id: 'id-one', mode: 'local'}, htmlEditor] }); var w = new Ext.Window({layout: 'fit', height: 400, width: 600, tbar: [{text: 'click', handler: function() { // hide element Ext.getCmp('id-one').getEl().up('.x-form-item').setDisplayed(false); w.doLayout(); } }], items: fp }); w.show(); Execute, click toolbar button "click", one field should disappear, then look at empty space below htmleditor.

    Read the article

  • NANT: ReplaceToken, loop over all properties defined in build

    - by SharePoint Newbie
    Hi, Is it possible to loop over all the properties and replace all token which correspond to them? For example, if I have three properties defined, a,b,c, I want to replace all three tokens @a@, @b@, @c@ . I however do not want to set up the filterchain manually as properties may be added/removed later on. I can accomplish this using a custom nant task, but is ther a way to do this through a build file alone. Thanks,

    Read the article

  • Custom Map using iPhone MapKit

    - by DHamrick
    I am attempting to use MapKit to create a custom map (similar to this concept http://mapwow.com/) using an image instead of the google maps image. This is so we can include the gps functionality and the pins functionality. I have looked in the documentation and there does not appear to be a standard way of doing it. Is there a way to do this using MapKit or has someone found a way to achieve something similar?

    Read the article

  • Is testing every Anti-Virus definition before deployment feasible?

    - by Sim
    With the recent problems that McAfee customers have had over the last week there has been lots of opinion that not only should the AV vendors have better testing but customers should test AV signatures before deploying. Is this feasible? If you are doing this already do you take other measures to minimise exposure to malware while you are testing?

    Read the article

  • How to enable indexing of pages with dynamic data?

    - by mithunb
    I have a site that has certain urls that point to pages with permanent data and others that point to dynamic web pages. Google indexes both these regularly. By the time a user finds one of the dynamic content urls, the data on the page has already changed and the user does not find what he was looking for. Further, the dynamic url pages contains links to the permanent urls (which I want Google or any crawler to index). Google crawler controls (webmaster tools) cannot be made to read urls from a page but not index them. Solutions? crawling strategies *system architecture*.

    Read the article

  • Intelligent Merge of two Arrays (3-way-kindof)

    - by simon.oberhammer
    I have to Arrays, each represents a list of Stories. Two users can concurrently modify the order, add or remove Stories, and I want those changes merged. An example should make this clearer Orignial 1,2,3,4,5 UserA (mine) 3,1,2,4,5 (moved story 3 to start) UserB (theirs) 1,2,3,5,4 (moved story 5 forward) The result of the above should be Merge (result) 3,1,2,5,4 In case of conflicts, UserA should always win. I came pretty far with this simple approach. First i deleted whatever mine says i should deleted (that part of the code is not shown, it's trivial), then I iterate of mine, inserting and moving from theirs what is needed (mstories = mine, tstories = theirs): var offset = 0; for (var idx=0;idx<mstories.length;idx++) { var storyId = mstories[idx]; // new story in theirs if (mstories.indexOf(tstories[idx]) == -1) { mstories.splice(idx+1, 0, tstories[idx]); idx--; continue; } // new story in mine? if (tstories.indexOf(storyId) == -1) { tstories.splice(idx+offset, 0, storyId); offset += 1; // story moved } else if (tstories.indexOf(storyId) != idx + offset) { tstories.splice(tstories.indexOf(storyId), 1); tstories.splice(idx+offset, 0, storyId); } } It's close, but it gets confused when too many Stories are moved to the front / back with Stories in between, which the other User touched. I have an extended version which does checks on the original and is smarter - holding 2 offsets, etc - , but I feel like this is a problem that must have a) a name b) a perfect solution and i don't want to re-invent it.

    Read the article

  • The use of mod operators in ada

    - by maddy
    Hi all, Can anyone please tell me the usage of the following declarations shown below.I am a beginner in ada language.I had tried the internet but that was not clear enough. type Unsigned_4 is mod 2 ** 4; for Unsigned_4'Size use 4;

    Read the article

  • jQuery noobie can't make a checked checkbox show an alert.

    - by Kyle Sevenoaks
    I found this answer before, to fire an alert if the button is pressed but the checkbox isn't checked. Why won't this work? <input value="1" type="checkbox" name="salgsvilkar" ID="checkbox2" style="float:left;" onclick="document.getElementById('scrollwrap').style.cssText='border-color:#85c222; background-color:#E5F7C7;';" /><label for="checkbox2" class="akslabel">Salgs og leveringsvilkår er lest og akseptert</label> </span> {literal} <script type="text/javascript"> $(function() { //checkbox $("#checkbox2").click(function(){ //if this... //alert("this")... if($("#checkbox2").is(':checked')) { alert("im checked"); } }); //button $("#fullfor_btn").click(function(e){ if(!$("#checkbox2").is(':checked')) { alert("you did not check the agree to terms..."); e.preventDefault(); } }); } </script> {/literal} This on another .tpl: <label></label> <button type="submit" class="submit" name="{$method}" id="fullfor_btn" title="Fullfør bestillingen nå" value="">&nbsp;</button> What could be going wrong? The jQuery doesn't fire anything at all.

    Read the article

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