Search Results

Search found 12762 results on 511 pages for 'inverted index'.

Page 10/511 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • In SQL, in what situation do we want to Index a field in a table, or 2 fields in a table at the same

    - by Jian Lin
    In SQL, it is obvious that whenever we want to do a search on millions of record, say CustomerID in a Transactios table, then we want to add an index for CustomerID. Is another situation we want to add an index to a field when we need to do inner join or outer join using that field as a criteria? Such as Inner join on t1.custumerID = t2.customerID. Then if we don't have an index on customerID on both tables, we are looking at O(n^2) because we need to loop through the 2 tables sequentially. If we have index on customerID on both tables, then it becomes O( (log n) ^ 2 ) and it is much faster. Any other situation where we want to add an index to a field in a table? What about adding index for 2 fields combined in a table. That is, one index, for 2 fields together?

    Read the article

  • Python: Trying to get index of an intersection

    - by user1620716
    I have the following line of code: for i in [i for i,x in enumerate(catdate) if x == set(NNSRCfile['datetimenew']).intersection(catdate)]: print i I am trying to find the index of the intersection for the two components above. Both are lengthy lists that have several commonalities. The intersection part works perfectly; however, the for loop seems to output nothing. (ie: there is nothing that is printed). Python outputs no error, and when I run the code in IPython, I notice that i is equivalent to to the very last element in the list "catdate", instead of listing the indices of "catdate" that are equivalent to the intersection values. Any help is greatly appreciated!

    Read the article

  • Get index of nth occurrence of char in a string

    - by StickFigs
    I'm trying to make a function that returns the index of the Nth occurrence of a given char in a string. Here is my attempt: private int IndexOfNth(string str, char c, int n) { int index = str.IndexOf(c) + 1; if (index >= 0) { string temp = str.Substring(index, str.Length - index); for (int j = 1; j < n; j++) { index = temp.IndexOf(c) + 1; if (index < 0) { return -1; } temp = temp.Substring(index, temp.Length - index); } index = index + (str.Length); } return index; } This should find the first occurrence, chop off that front part of the string, find the first occurrence from the new substring, and on and on until it gets the index of the nth occurrence. However I failed to consider how the index of the final substring is going to be offset from the original actual index in the original string. How do I make this work? Also as a side question, if I want the char to be the tab character do I pass this function '\t' or what?

    Read the article

  • Returning the index number of an Arraylist in Java

    - by Daniel
    I would like my method public void showClassRoomDetails(String teacherName) to return the Arraylist index number using the teacherName. Thanks import java.util.ArrayList; public class School { private ArrayList<Classroom> classrooms; private String classRoomName; private String teacherName; public School() { classrooms = new ArrayList<Classroom>(); } public void addClassRoom(Classroom newClassRoom, String theClassRoomName) { classrooms.add(newClassRoom); classRoomName = theClassRoomName; } public void addTeacherToClassRoom(int classroomId, String TeacherName) { if (classroomId < classrooms.size() ) { classrooms.get(classroomId).setTeacherName(TeacherName); } } public void showClassRoomDetails(String teacherName) { for (Classroom classroom : this.classrooms) { if (classroom.returnTeacherName().equals(teacherName)) { System.out.println(classroom.returnClassRoomName()); System.out.println(classroom.returnTeacherName()); break; } } } }

    Read the article

  • How to index and search .doc files

    - by Jared
    I have an application that needs to have .doc files uploaded to it. These documents should then be index and the whole collection of documents should be searchable. This will run on a Windows Server, without Word installed, using IIS and SqlServer, but I'd rather not be tied to SqlServer's full text indexing. I was thinking of using Lucene.Net for the indexing part and was wondering what the best way to get the text out of the .doc files would be. I could probably extract the text by reading in the whole stream and then using a regEx to pull out any regular characters, but that seems hefty and prone to error. I saw an article on using iFilters that sounds promising, but I thought I'd put this out there since it's not something I'm familiar with. P.S. If it matters, these .doc files will have mail-merge fields in them and there's no other current alternative for the .doc format.

    Read the article

  • Google maps z-index problem in IE

    - by Bas van de Lustgraaf
    I'm loading my google maps into div class="extra" style="display: none;" /. As soon as the AJAX request is complete, the map_canvas div is placed inside the hidden div and the hidden div will be vissible with the toggleDown jquery effect. In FF it's working perfect, but in IE the Google maps (map_canvas div) is already visible before the toggleDown effect is started. I think the z-index and the relative position of the map_canvas div wich is loaded into the hidden div will place the map_canvas div on top of the hidden div. What do i have to change to make sure the map_canvas div is not on top of the hidden div? While toggleDown in FF: http:// img169.imageshack.us/img169/9274/50485429.jpg While toggleDown in IE: http://img188.imageshack.us/img188/2110/93959677.jpg

    Read the article

  • paging php error - undefined index

    - by fusion
    i've a search form with paging. when the user enters the keyword initially, it works fine and displays the required output; however, it also shows this error: Notice: Undefined index: page in C:\Users\user\Documents\Projects\Pro\search.php on line 21 Call Stack: 0.0011 372344 1. {main}() C:\Users\user\Documents\Projects\Pro\search.php:0 . .and if the user clicks on the 'next' page, it shows no output with this error thrown: Notice: Undefined index: q in C:\Users\user\Documents\Projects\Pro\search.php on line 19 Call Stack: 0.0016 372048 1. {main}() C:\Users\user\Documents\Projects\Pro\search.php:0 this is my code: <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); include 'config.php'; $search_result = ""; $search_result = trim($_GET["q"]); $page= $_GET["page"]; //Get the page number to show if($page == "") $page=1; $search_result = mysql_real_escape_string($search_result); //Check if the string is empty if ($search_result == "") { echo "<p class='error'>Search Error. Please Enter Your Search Query.</p>" ; exit(); } if ($search_result == "%" || $search_result == "_" || $search_result == "+" ) { echo "<p class='error1'>Search Error. Please Enter a Valid Search Query.</p>" ; exit(); } if(!empty($search_result)) { // the table to search $table = "thquotes"; // explode search words into an array $arraySearch = explode(" ", $search_result); // table fields to search $arrayFields = array(0 => "cQuotes"); $countSearch = count($arraySearch); $a = 0; $b = 0; $query = "SELECT cQuotes, vAuthor, cArabic, vReference FROM ".$table." WHERE ("; $countFields = count($arrayFields); while ($a < $countFields) { while ($b < $countSearch) { $query = $query."$arrayFields[$a] LIKE '%$arraySearch[$b]%'"; $b++; if ($b < $countSearch) { $query = $query." AND "; } } $b = 0; $a++; if ($a < $countFields) { $query = $query.") OR ("; } } $query = $query.")"; $result = mysql_query($query, $conn) or die ('Error: '.mysql_error()); $totalrows = mysql_num_rows($result); if($totalrows < 1) { echo '<span class="error2">No matches found for "'.$search_result.'"</span>'; } else { $limit = 3; //Number of results per page $numpages=ceil($totalrows/$limit); $query = $query." ORDER BY idQuotes LIMIT " . ($page-1)*$limit . ",$limit"; $result = mysql_query($query, $conn) or die('Error:' .mysql_error()); ?> <div class="caption">Search Results</div> <div class="center_div"> <table> <?php while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) { $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); ?> <tr> <td style="text-align:right; font-size:15px;"><?php h($row['cArabic']); ?></td> <td style="font-size:16px;"><?php echo $cQuote; ?></td> <td style="font-size:12px;"><?php h($row['vAuthor']); ?></td> <td style="font-size:12px; font-style:italic; text-align:right;"><?php h($row['vReference']); ?></td> </tr> <?php } ?> </table> </div> <?php //Create and print the Navigation bar $nav=""; if($page > 1) { $nav .= "<a href=\"search.php?page=" . ($page-1) . "&string=" .urlencode($search_result) . "\"><< Prev</a>"; } for($i = 1 ; $i <= $numpages ; $i++) { if($i == $page) { $nav .= "<B>$i</B>"; }else{ $nav .= "<a href=\"search.php?page=" . $i . "&string=" .urlencode($search_result) . "\">$i</a>"; } } if($page < $numpages) { $nav .= "<a href=\"search.php?page=" . ($page+1) . "&searchstring=" .urlencode($search_result) . "\">Next >></a>"; } echo "<br /><br />" . $nav; } } else { exit(); } ?>

    Read the article

  • Why MySQL multiple-column index is overpopulated?

    - by actual
    Consider following MySQL table: CREATE TABLE `log` ( `what` enum('add', 'edit', 'remove') CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `with` int(10) unsigned NOT NULL, KEY `with_what` (`with`,`what`) ) ENGINE=InnoDB; INSERT INTO `log` (`what`, `with`) VALUES ('add', 1), ('edit', 1), ('add', 2), ('remove', 2); As I understand, with_what index must have 2 unique entries on its first with level and 3 unique entries in what "subindex". But MySQL reports 4 unique entries for each level. In other words, number of unique elements for each level is always equal to number of rows in log table. Is that a bug, a feature or my misunderstanding?

    Read the article

  • SQL SERVER – Index Created on View not Used Often – Limitation of the View 12

    - by pinaldave
    I have previously written on the subject SQL SERVER – The Limitations of the Views – Eleven and more…. This was indeed a very popular series and I had received lots of feedback on that topic. Today we are going to discuss something very interesting as well. During my recent performance tuning seminar in Hyderabad, I presented on the subject of Views. During the seminar, one of the attendees asked a question: We create a table and create a View on the top of it. On the same view, if we create Index, when querying View, will that index be used? The answer is NOT Always! (There is only one specific condition when it will be used. We will write about that later in the next post). Let us see the test case for the same. In our script we will do following: USE tempdb GO IF EXISTS (SELECT * FROM sys.views WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[SampleView]')) DROP VIEW [dbo].[SampleView] GO IF EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'[dbo].[mySampleTable]') AND TYPE IN (N'U')) DROP TABLE [dbo].[mySampleTable] GO -- Create SampleTable CREATE TABLE mySampleTable (ID1 INT, ID2 INT, SomeData VARCHAR(100)) INSERT INTO mySampleTable (ID1,ID2,SomeData) SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY o1.name), ROW_NUMBER() OVER (ORDER BY o2.name), o2.name FROM sys.all_objects o1 CROSS JOIN sys.all_objects o2 GO -- Create View CREATE VIEW SampleView WITH SCHEMABINDING AS SELECT ID1,ID2,SomeData FROM dbo.mySampleTable GO -- Create Index on View CREATE UNIQUE CLUSTERED INDEX [IX_ViewSample] ON [dbo].[SampleView] ( ID2 ASC ) GO -- Select from view SELECT ID1,ID2,SomeData FROM SampleView GO Let us check the execution plan for the last SELECT statement. You can see from the execution plan. That even though we are querying View and the View has index, it is not really using that index. In the next post, we will see the significance of this View and where it can be helpful. Meanwhile, I encourage you to read my View series: SQL SERVER – The Limitations of the Views – Eleven and more…. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Training, SQL View, T SQL, Technology

    Read the article

  • SQL SERVER – What is Spatial Database? – Developing with SQL Server Spatial and Deep Dive into Spati

    - by pinaldave
    What is Spatial Database? A spatial database is a database that is optimized to store and query data related to objects in space, including points, lines and polygons. While typical databases can understand various numeric and character types of data, additional functionality needs to be added for databases to process spatial data types. (Source: Wikipedia) Today I will be talking about the same subject at Microsoft TechEd India. If you want to learn about how to spatial aspect of data and how to integrate them with SQL Server this is the perfect session for you. Spatial is very special concept of SQL Server and I really like how it is implemented in SQL Server. In general Performance Tuning and Query Optimization is something I always have enjoyed in my professional life. Index are my best friends and many time, by implementing and many time by removing I have improved the performance of the system. In this session, I will be talking about Index along with Spatial Data. As Spatial Database is very interesting concept, I will cover super short but very interesting 10 quick slides about this subject. I will make sure in very first 20 mins, you will understand following topics Introduction to Spatial Database One line definition Understanding Spatial Indexing Index Internals Query/Performance Tuning Query Hinting/Cost Analysis Spatial Index Catalog Views Performance Troubleshooting Finding Optimal Index using Spatial Index SP Common Errors Index Maintenance This slides decks will be followed by around 30 mins demo which will have story of geometry, geography, index internals and performance tuning. If you are interested in learning how GIS works and how SQL Server out of the box supports this wonderful tools, you will really like how the story is told. I am sure all people who attend the event will know how the Bangalore is positioned on the map of India. I will take example of Bangalore and Hyderabad and demonstrate how index can improve the performance. Well there are lots of story to tell in the session, and I will be opening this session with the beautiful script of Botticelli’s Birth of Venus created by Michael J. Swart. I will also demonstrate few real life scenario where I will be talking about Spatial Database and its usage. Do not miss this session. At the end of session there will be book awarded to best participant. My session details: Session 3: Developing with SQL Server Spatial and Deep Dive into Spatial Indexing Date: April 14, 2010 Time: 5:00pm-6:00pm Microsoft SQL Server 2008 delivers new spatial data types that enable you to consume, use, and extend location-based data through spatial-enabled applications. Attend this session to learn how to use spatial functionality in next version of SQL Server to build and optimize spatial queries. This session outlines the new geography data type to store geodetic spatial data and perform operations on it, use the new geometry data type to store planar spatial data and perform operations on it, take advantage of new spatial indexes for high performance queries, use the new spatial results tab to quickly and easily view spatial query results directly from within Management Studio, extend spatial data capabilities by building or integrating location-enabled applications through support for spatial standards and specifications and much more. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Index, SQL Optimization, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, T SQL, Technology Tagged: Spatial Database

    Read the article

  • Setting the SlideShowExtender's Index

    - by Bunch
    The AJAX SlideShowExtender is pretty useful. It does what it says and works without much fuss. There was one trick I needed it to perform that I could not find natively within the control. That was to set the slide’s current index. With a little JavaScript however I could make the control do what I wanted. The example below assumes a few things. First you already have a SlideShowExtender setup and working (or see this post). Second this SlideShowExtender is on a page all by itself so the index to set the slide to is passed in the URL. The scenario I had was this SSE was showing full images, the index was passed from another page that had a SSE showing thumbnails. JavaScript in <head> <script type="text/javascript">      function pageLoad() {          var slider = $find("sse");          var photoIndex = GetQuerystring('Index', 0);          slider._currentIndex = photoIndex - 1;          slider._slides = '';          slider.setCurrentImage();      }      function GetQuerystring(key, default_) {          if (default_ == null) default_ = '0';          key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");          var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");          var qs = regex.exec(window.location.href);          if (qs == null)              return default_;          else              return qs[1];      } </script> The GetQuerystring function is what grabs the Index value I pass from the page with the thumbnails. It does not have anything else to do with setting the slide index. The code in the pageLoad function sets the index on the slide_currentIndex line. The slider.setCurrentImage() line does pretty much what it says. I added the slider._slider = ‘’ to avoid an error (not a show stopper just a bit annoying). Control in <body> <cc1:SlideShowExtender ID="ssePhotos" runat="server" TargetControlID="imgFull" AutoPlay="false"          PreviousButtonID="btnPrev" NextButtonID="btnNext" SlideShowServicePath="PlacePhotos.asmx"           SlideShowServiceMethod="GetPlaceFullPhotos" BehaviorID="sse" ImageDescriptionLabelID="lblPictureDescription"> </cc1:SlideShowExtender> The main property to set with the SSE is the BehaviorID. This is what a JavaScript function can use to find the control rather than the control’s ID value. Technorati Tags: AJAX,ASP.Net,JavaScript

    Read the article

  • Speed up SQL Server Fulltext Index through Text Duplication of Non-Indexed Columns

    - by Alex
    1) I have the text fields FirstName, LastName, and City. They are fulltext indexed. 2) I also have the FK int fields AuthorId and EditorId, not fulltext indexed. A search on FirstName = 'abc' AND AuthorId = 1 will first search the entire fulltext index for 'abc', and then narrow the resultset for AuthorId = 1. This is bad because it is a huge waste of resources as the fulltext search will be performed on many records that won't be applicable. Unfortunately, to my knowledge, this can't be turned around (narrow by AuthorId first and then fulltext-search the subset that matches) because the FTS process is separate from SQL Server. Now my proposed solution that I seek feedback on: Does it make sense to create another computed column which will be included in the fulltext search which will identify the Author as text (e.g. AUTHORONE). That way I could get rid of the AuthorId restriction, and instead make it part of my fulltext search (a search for 'abc' would be 'abc' and 'AUTHORONE' - all executed as part of the fulltext search). Is this a good idea or not? Why?

    Read the article

  • "no inclosing instance error " while getting top term frequencies for document from Lucene index

    - by Julia
    Hello ! I am trying to get the most occurring term frequencies for every particular document in Lucene index. I am trying to set the treshold of top occuring terms that I care about, maybe 20 However, I am getting the "no inclosing instance of type DisplayTermVectors is accessible" when calling Comparator... So to this function I pass vector of every document and max top terms i would like to know protected static Collection getTopTerms(TermFreqVector tfv, int maxTerms){ String[] terms = tfv.getTerms(); int[] tFreqs = tfv.getTermFrequencies(); List result = new ArrayList(terms.length); for (int i = 0; i < tFreqs.length; i++) { TermFrq tf = new TermFrq(terms[i], tFreqs[i]); result.add(tf); } Collections.sort(result, new FreqComparator()); if(maxTerms < result.size()){ result = result.subList(0, maxTerms); } return result; } /Class for objects to hold the term/freq pairs/ static class TermFrq{ private String term; private int freq; public TermFrq(String term,int freq){ this.term = term; this.freq = freq; } public String getTerm(){ return this.term; } public int getFreq(){ return this.freq; } } /*Comparator to compare the objects by the frequency*/ class FreqComparator implements Comparator{ public int compare(Object pair1, Object pair2){ int f1 = ((TermFrq)pair1).getFreq(); int f2 = ((TermFrq)pair2).getFreq(); if(f1 > f2) return 1; else if(f1 < f2) return -1; else return 0; } } Explanations and corrections i will very much appreciate, and also if someone else had experience with term frequency extraction and did it better way, I am opened to all suggestions! Please help!!!! Thanx!

    Read the article

  • SQL SERVER – What is Fill Factor and What is the Best Value for Fill Factor

    - by pinaldave
    Working in performance tuning area, one has to know about Index and Index Maintenance. For any Index the most important property is Fill Factor. Fill factor is the value that determines the percentage of space on each leaf-level page to be filled with data. In an SQL Server, the smallest unit is a page, which is made of  Page with size 8K. Every page can store one or more rows based on the size of the row. The default value of the Fill Factor is 100, which is same as value 0. The default Fill Factor (100 or 0) will allow the SQL Server to fill the leaf-level pages of an index with the maximum numbers of the rows it can fit. There will be no or very little empty space left in the page, when the fill factor is 100. I have written following two article about Fill Factor. What is Fill factor? – Index, Fill Factor and Performance – Part 1 What is the best value for the Fill Factor? – Index, Fill Factor and Performance – Part 2 I strongly encourage read them and provide your feedback. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Index, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • SQL SERVER – Cleaning Up SQL Server Indexes – Defragmentation, Fillfactor – Video

    - by pinaldave
    Storing data non-contiguously on disk is known as fragmentation. Before learning to eliminate fragmentation, you should have a clear understanding of the types of fragmentation. When records are stored non-contiguously inside the page, then it is called internal fragmentation. When on disk, the physical storage of pages and extents is not contiguous. We can get both types of fragmentation using the DMV: sys.dm_db_index_physical_stats. Here is the generic advice for reducing the fragmentation. If avg_fragmentation_in_percent > 5% and < 30%, then use ALTER INDEX REORGANIZE: This statement is replacement for DBCC INDEXDEFRAG to reorder the leaf level pages of the index in a logical order. As this is an online operation, the index is available while the statement is running. If avg_fragmentation_in_percent > 30%, then use ALTER INDEX REBUILD: This is replacement for DBCC DBREINDEX to rebuild the index online or offline. In such case, we can also use the drop and re-create index method.(Ref: MSDN) Here is quick video which covers many of the above mentioned topics. While Vinod and I were planning about Indexing course, we had plenty of fun and learning. We often recording few of our statement and just left it aside. Afterwords we thought it will be really funny Here is funny video shot by Vinod and Myself on the same subject: Here is the link to the SQL Server Performance:  Indexing Basics. Here is the additional reading material on the same subject: SQL SERVER – Fragmentation – Detect Fragmentation and Eliminate Fragmentation SQL SERVER – 2005 – Display Fragmentation Information of Data and Indexes of Database Table SQL SERVER – De-fragmentation of Database at Operating System to Improve Performance Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Index, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology, Video

    Read the article

  • z-index issues with jQuery Tabs, Superfish Menu

    - by NightMICU
    Hi all, For the life of me I cannot get my Superfish menu to stop hiding behind my jQuery UI tabs in IE 7. I have read the documentation out there, have tried changing z-index values and tried the bgIframe plugin, although I am not sure if I am implementing it correctly (left out in my example below, using Supersubs). Here is the Javascript I am using for Superfish - using the Supersubs plugin: $(document).ready(function() { $("ul.sf-menu").supersubs({ minWidth: 12, // minimum width of sub-menus in em units maxWidth: 27, // maximum width of sub-menus in em units extraWidth: 1 // extra width can ensure lines don't sometimes turn over // due to slight rounding differences and font-family }).superfish({ delay: 1000, // one second delay on mouseout animation: {opacity:'show',height:'show'}, // fade-in and slide-down animation speed: 'medium' // faster animation speed }); }); And here is the structure of my page: <div id="page-container"> <div id="header"></div> <div id="nav-admin"> <!-- This is where Superfish goes --> </div> <div id="header-shadow"></div> <div id="content"> <div id="admin-main"> <div id="tabs"> <ul> <li><a href="#tabs-1">Tab 1</a></li> <li><a href="#tabs-2">Tab 2</a></li> </ul> <div id="tabs-1"> <!-- Content for Tab 1 --> </div> <div id="tabs-2"> <!-- Content for Tab 2 --> </div> </div> </div> </div> <div id="footer-shadow"></div> <div id="footer"> <div id="alt-nav"> <?php include $_SERVER['DOCUMENT_ROOT'] . '/includes/altnav.inc.php'; //CHANGE WHEN UPLOADED TO MATCH DOCUMENT ROOT ?> </div> </div> </div>

    Read the article

  • Returning and printing string array index in C

    - by user1781966
    I've got a function that searches through a list of names and I'm trying to get the search function to return the index of the array back to the main function and print out the starting location of the name found. Everything I've tried up to this point either crashes the program or results in strange output. Here is my search function: #include<stdio.h> #include<conio.h> #include<string.h> #define MAX_NAMELENGTH 10 #define MAX_NAMES 5 void initialize(char names[MAX_NAMES][MAX_NAMELENGTH], int Number_entrys, int i); int search(char names[MAX_NAMES][MAX_NAMELENGTH], int Number_entrys); int main() { char names[MAX_NAMES][MAX_NAMELENGTH]; int i, Number_entrys,search_result,x; printf("How many names would you like to enter to the list?\n"); scanf("%d",&Number_entrys); initialize(names,Number_entrys,i); search_result= search(names,Number_entrys); if (search_result==-1){ printf("Found no names.\n"); }else { printf("%s",search_result); } getch(); return 0; } void initialize(char names[MAX_NAMES][MAX_NAMELENGTH],int Number_entrys,int i) { if(Number_entrys>MAX_NAMES){ printf("Please choose a smaller entry\n"); }else{ for (i=0; i<Number_entrys;i++){ scanf("%s",names[i]); } } } int search(char names[MAX_NAMES][MAX_NAMELENGTH],int Number_entrys) { int x; char new_name[MAX_NAMELENGTH]; printf("Now enter a name in which you would like to search the list for\n"); scanf("%s",new_name); for(x = 0; x < Number_entrys; x++) { if ( strcmp( new_name, names[x] ) == 0 ) { return x; } } return -1; } Like I mentioned before I have tried a lot of different ways to try and fix this issue, but I cant seem to get them to work. Printing X like what I have above is just the last thing I tried, and therefor know that it doesn't work. Any suggestions on the simplest way to do this?

    Read the article

  • Displaying an inverted pyramid of asterisks

    - by onyebuoke
    I help in my for my program. I am required 2 create a inverted pyramid of stars which rows depends on the number of stars the user keys, but I've done it so it does not give an inverted pyramid, it gives a regular pyramid. #include <stdio.h> #include <conio.h> void printchars(int no_star, char space); int getNo_of_rows(void); int main(void) { int numrows, rownum; rownum=0; numrows=getNo_of_rows(); for(rownum=0;rownum<=numrows;rownum++) { printchars(numrows-rownum, ' '); printchars((2*rownum-1), '*'); printf("\n"); } _getche(); return 0; } void printchars(int no_star, char space) { int cnt; for(cnt=0;cnt<no_star;cnt++) { printf("%c",space); } } int getNo_of_rows(void) { int no_star; printf("\n Please enter the number of stars you want to print\n"); scanf("%d",&no_star); while(no_star<1) { printf("\n number incorrect, please enter correct number"); scanf("%d",&no_star); } return no_star; }

    Read the article

  • Google index vs asp.net url routing

    - by vani
    I've made the change from querystring asp.net webforms application to an url routing one. Now I'm trying to let google know that there's a new set of urls to be aware of. The G has indexed 133 out of 179 new urls sent in sitemap.xml, but the site:mistral.hr command returns the old querystring version of the links. This could partly be so because I left the functionality of the old querystring version of the site(for backwards compatibility), and haven't done any 301 redirects(nor do I know how to achieve them in my shared hosting account). The old querystring and the new url routing both point to the same Default.aspx page.

    Read the article

  • ASP.NET MVC - Views location Problem : The view 'Index' or its master was not found

    - by user326873
    Hi all, I've create an asp.net MVC 2 project, it works fine!! I've been asked to integrate the project in an existing web project in classic asp.net (I've add the folder containing the source, and not make a new project, because they have to bee in same project) I've configured my web.config file <pages pageBaseType="System.Web.UI.Page" > <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </controls> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Linq" /> <add namespace="System.Collections.Generic" /> <add namespace="SearchApp.Helpers.CheckBoxList"/> <add namespace="SearchApp.Helpers.Pager"/> </namespaces> </pages> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpModules> <!--- END MVC config section--> and my global.asax file (I'm working under IIS 5.1) : public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "SearchApp", // Route name "SearchApp/{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Search", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start(Object sender, EventArgs e) { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } The hierarchy of the project is (I can’t find how to insert Image in the post): +Project ++MVC2AppFolder +++Controller ++++SearchController.cs +++Views ++++Search +++++Index.aspx ++global.asax ++web.config as you can see the global.asax is not in the MVC App folder when I try to access the page Search/index.aspx using this url http://localhost/cstfwsrv/SearchApp/Search.aspx/Index[^] have the following error : I The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx] System.Web.Mvc.ViewResult.FindView(ControllerContext context) +253553 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +139 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10 System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251 System.Web.Mvc.<>c__DisplayClass16.<InvokeActionResultWithFilters>b__13() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +178 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314 System.Web.Mvc.Controller.ExecuteCore() +105 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677678 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 As you can see he search for the Index.aspx page under ~/Views/Search/Index.aspx , wich is under ~/MVC2AppFolder/Views/Search/Index.aspx Is there a way to set in the Route Method, or any where else, the View Path? Thanks’ in advance

    Read the article

  • Add Core Data Index to certain Attributes via migration

    - by steipete
    For performance reasons, i want to set the Indexed Attribute to some of my entities. I created a new core data model version to perform the changes. Core Data detects the changes and migrates my model to the new version, however, NO INDEXES ARE GENERATED. If I recreate the database from scratch, the indexes are there. I checked with SQLite Browser both on the iPhone and on the Simulator. The problem only occurs if a database in the prior format is already there. Is there a way to manually add the indexes? Write some sql for that? Or am I missing something? I did already some more critical migrations, no problems there. But those missing indexes are bugging me. Thanks for helping!

    Read the article

  • Spatial Index for Rectangles With Fast Insert

    - by TheCloudlessSky
    Hello, I'm looking for a data structure that provides indexing for Rectangles. I need the insert algorithm to be as fast as possible since the rectangles will be moving around the screen (think of dragging a rectangle with your mouse to a new position). I've looked into R-Trees, R+Trees, kD-Trees, Quad-Trees and B-Trees but from my understanding insert's are usually slow. I'd prefer to have inserts at sub-linear time complexity so maybe someone can prove me wrong about either of the listed data structures. I should be able to query the data structure for what rectangles are at point(x, y) or what rectangles intersect rectangle(x, y, width, height). EDIT: The reason I want insert so fast is because if you think of a rectangle being moved around the screen, they're going to have to be removed and then re-inserted. Thanks!

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >