Search Results

Search found 266 results on 11 pages for 'fuzzy lollipop'.

Page 9/11 | < Previous Page | 5 6 7 8 9 10 11  | Next Page >

  • Gomoku array-based AI-algorithm?

    - by Lasse V. Karlsen
    Way way back (think 20+ years) I encountered a Gomoku game source code in a magazine that I typed in for my computer and had a lot of fun with. The game was difficult to win against, but the core algorithm for the computer AI was really simply and didn't account for a lot of code. I wonder if anyone knows this algorithm and has some links to some source or theory about it. The things I remember was that it basically allocated an array that covered the entire board. Then, whenever I, or it, placed a piece, it would add a number of weights to all locations on the board that the piece would possibly impact. For instance (note that the weights are definitely wrong as I don't remember those): 1 1 1 2 2 2 3 3 3 444 1234X4321 3 3 3 2 2 2 1 1 1 Then it simply scanned the array for an open location with the lowest or highest value. Things I'm fuzzy on: Perhaps it had two arrays, one for me and one for itself and there was a min/max weighting? There might've been more to the algorithm, but at its core it was basically an array and weighted numbers Does this ring a bell with anyone at all? Anyone got anything that would help?

    Read the article

  • LINQ to Entity, using a SQL LIKE operator

    - by Mario
    I have a LINQ to ENTITY query that pulls from a table, but I need to be able to create a "fuzzy" type search. So I need to add a where clause that searches by lastname IF they add the criteria in the search box (Textbox, CAN be blank --- in which case it pulls EVERYTHING). Here is what I have so far: var query = from mem in context.Member orderby mem.LastName, mem.FirstName select new { FirstName = mem.FirstName, LastName = mem.LastName, }; That will pull everything out of the Member table that is in the Entity object. Then I have an addition to the logic: sLastName = formCollection["FuzzyLastName"].ToString(); if (!String.IsNullOrEmpty(sLastName)) query = query.Where(ln => ln.LastName.Contains(sLastName)); The problem is when the search button is pressed, nothing is returned (0 results). I have run the query against the SQL Server that I expect to happen here and it returns 6 results. This is the query I expect: SELECT mem.LastName, mem.FirstName FROM Members mem WHERE mem.LastName = 'xxx' (when xxx is entered into the textbox) Anyone see anything wrong with this?

    Read the article

  • Emacs recursive project search

    - by hekevintran
    I am switching to Emacs from TextMate. One feature of TextMate that I would really like to have in Emacs is the "Find in Project" search box that uses fuzzy matching. Emacs sort of has this with ido, but ido does not search recursively through child directories. It searches only within one directory. Is there a way to give ido a root directory and to search everything under it? Update: The questions below pertain to find-file-in-project.el from Michal Marczyk's answer. If anything in this message sounds obvious it's because I have used Emacs for less than one week. :-) As I understand it, project-local-variables lets me define things in a .emacs-project file that I keep in my project root. How do I point find-file-in-project to my project root? I am not familiar with regex syntax in Emacs Lisp. The default value for ffip-regexp is: ".*\\.\\(rb\\|js\\|css\\|yml\\|yaml\\|rhtml\\|erb\\|html\\|el\\)" I presume that I can just switch the extensions to the ones appropriate for my project. Could you explain the ffip-find-options? From the file: (defvar ffip-find-options "" "Extra options to pass to `find' when using find-file-in-project. Use this to exclude portions of your project: \"-not -regex \\".vendor.\\"\"") What does this mean exactly and how do I use it to exclude files/directories? Could you share an example .emacs-project file?

    Read the article

  • Oracle command hangs when using view for "WHERE x IN..." subquery

    - by Calvin Fisher
    I'm working on a web service that fetches data from an oracle data source in chunks and passes it back to an indexing/search tool in XML format. I'm the C#/.NET guy, and am kind of fuzzy on parts of Oracle. Our Oracle team gave us the following script to run, and it works well: SELECT ROWID, [columns] FROM [table] WHERE ROWID IN ( SELECT ROWID FROM ( SELECT ROWID FROM [table] WHERE ROWID > '[previous_batch_last_rowid]' ORDER BY ROWID ) WHERE ROWNUM <= 10000 ) ORDER BY ROWID 10,000 rows is an arbitrary but reasonable chunk size and ROWID is sufficiently unique for our purposes to use as a UID since each indexing run hits only one table at a time. Bracketed values are filled in programmatically by the web service. Now we're going to start adding views to the indexing, each of which will union a few separate tables. Since ROWID would no longer function as a unique identifier, they added a column to the views (VIEW_UNIQUE_ID) that concatenates the ROWIDs from the component tables to construct a UID for each union. But this script does not work, even though it follows the same form as the previous one: SELECT VIEW_UNIQUE_ID, [columns] FROM [view] WHERE VIEW_UNIQUE_ID IN ( SELECT VIEW_UNIQUE_ID FROM ( SELECT VIEW_UNIQUE_ID FROM [view] WHERE ROWID > '[previous_batch_last_view_unique_id]' ORDER BY VIEW_UNIQUE_ID ) WHERE ROWNUM <= 10000 ) ORDER BY VIEW_UNIQUE_ID It hangs indefinitely with no response from the Oracle server. I've waited 20+ minutes and the SQLTools dialog box indicating a running query remains the same, with no progress or updates. I've tested each subquery independently and each works fine and takes a very short amount of time (<= 1 second), so the view itself is sound. But as soon as the inner two SELECT queries are added with "WHERE VIEW_UNIQUE_ID IN...", it hangs. Why doesn't this query work for views? In what important way are they not interchangeable here?

    Read the article

  • Best Practices for Setup and Management of an Open Source Project

    - by VirtuosiMedia
    Later this year I want to release a PHP framework that I've been working on as open source. I do use source control (SVN), but it's on an extremely limited basis. I'm self-taught, I develop by myself and don't have the experience of working with large teams. I have some ideas about what can help make a project successful, but I'm fuzzy on some of the details. Since it's not yet released, I want to do everything I can to set up the right infrastructure from the beginning. What do I need to know in order to setup and manage a successful project? Some ideas that I have to make it successful (beyond marketing it): Good documentation and tutorials Automated unit tests and builds to push update to the website A clear roadmap Bug Tracking integrated with the source control A style guide to keep the code consistent along with clear A forum for the community to get support, share ideas, etc. A good example application built with the framework A blog to keep the community informed Maintaining backwards compatibility wherever possible Some of my questions: How do I setup and automate a one step submit-test-commit-generate API docs-push update to website process? How do I handle (technically) submissions from other users? How can I ensure that those submissions must be approved before being integrated? What are some of the pitfalls that can be avoided in terms of the project community? I'd prefer to have it be as friendly and helpful as possible without a lot of drama. I'd love to learn from your experience on any of these points. If you think I'm missing anything big, please share that as well. Any resources (preferably geared toward a beginner) that you could point me towards would also be greatly appreciated.

    Read the article

  • Texture2D problem

    - by Anders Karlsson
    I have a problem that is driving me crazy, I want to write a number of texts on the screen using Texture2D however I only seem to be able to write the first one. If I individually write one of the labels it works but not if I write all of them, only the first label is displayed. Let me show some code: -(void)drawText:(NSString*)theString AtX:(float)X Y:(float)Y withFont:(UIFont*)aFont { // set color glColor4f(1, 0, 0, 1.0); // Enable modes needed for drawing glEnableClientState(GL_TEXTURE_COORD_ARRAY); Texture2D* textTexture = [[Texture2D alloc] initWithString:theString dimensions:viewSize // 320x480 alignment:UITextAlignmentLeft font:aFont]; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); [textTexture drawInRect:CGRectMake(X,Y,1,1)]; glDisableClientState(GL_TEXTURE_COORD_ARRAY); [textTexture release]; } When I call this drawText once it seems to display the text properly, but if I call it a second time nothing seems to be displayed. Somebody has an idea what it could be? The states like GL_BLEND and GL_TEXTURE_2D have been enabled in the view setup function. In the Texture2D the dimensions are 512x512 as I pass the whole screen to function. If I don't pass that the text gets enlarged and fuzzy. I am a bit uncertain about that parameter. TIA for any help.

    Read the article

  • Strategies for Accessing a Application with a COM API From PHP

    - by Alan Storm
    Background: Experienced PHP developer with a mostly *nix background. I'm writing a PHP application that needs to interact with a proprietary 3rd party system. The 3rd party system is Windows only. The PHP application will be living on a separate Linux based system The 3rd party application has been described as having a "COM API" that I'll need to talk to from the PHP application. What does this look like architecturally speaking? I'm starting with the COM section of the PHP manual, but I have specific questions. Specific Questions: Can I talk directly to a COM API from a PHP application running on another server? If so, how? (what PHP extensions would I need, or what protocols/PHP functions would I be using to talk to the API) If the answer to number 2 is no, I'd assume I'd need some kind of application on the Windows machine that can talk to COM, and then a service on the windows machine I can hit with PHP. Are there prebuilt frameworks for this kind of thing? Is this all nonsense and/or did I say something exceedingly stupid? (Quite possible, as I'm a little fuzzy on what "COM" does and doesn't cover) I'm obviously not looking for a full solution here, I'm just trying to get a general idea of what is and isn't possible and what kind of things I'll want to Google for. Thanks!

    Read the article

  • Lucene stop words not removed during searching

    - by iamrohitbanga
    I have created a Lucene index with the following analyzer. public class DocSpecAnalyzer extends Analyzer { private static CharArraySet stopSet;// = new HashSet<String>(Arrays.asList());//STOP_WORDS_SET; static { stopSet = new CharArraySet(FDConstants.stopwords, true); // uncommenting this displays all the stop words // for (String s: FDConstants.stopwords) { // System.out.println(s); // } } /** * Specifies whether deprecated acronyms should be replaced with HOST type. * See {@linkplain https://issues.apache.org/jira/browse/LUCENE-1068} */ private final boolean enableStopPositionIncrements; private final Version matchVersion; public DocSpecAnalyzer(Version matchVersion) { this.matchVersion = matchVersion; enableStopPositionIncrements = StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion); } public TokenStream tokenStream(String fieldName, Reader reader) { StandardTokenizer tokenStream = new StandardTokenizer(matchVersion, reader); tokenStream.setMaxTokenLength(DEFAULT_MAX_TOKEN_LENGTH); TokenStream result = new StandardFilter(tokenStream); result = new LowerCaseFilter(result); result = new StopFilter(enableStopPositionIncrements, result, stopSet); result = new PorterStemFilter(result); return result; } /** Default maximum allowed token length */ public static final int DEFAULT_MAX_TOKEN_LENGTH = 255; } Now when I search for documents for a query containing stop words, i get hits for stop words also. As I post this problem, I found the bug. It is because of http://lucene.apache.org/java/2_9_2/api/contrib-misc/org/apache/lucene/queryParser/analyzing/AnalyzingQueryParser.html not handling stop words. Is there a substitute? Update: forgot to mention that I need to do a fuzzy search. that is why i am using an AnalyzingQueryParser.

    Read the article

  • When anyDensity=false why does getDrawingCache(true) return null?

    - by Robert Nekic
    First off, my application currently defines anyDensity=false in the manifest file. Elsewhere in the app, I'm trying to capture and display a View's DrawingCache but I'm not able to get a clear Bitmap without scaling artifacts. The code below yields a Bitmap but it has scaling artifacts and is generally fuzzy. myView.setDrawingCacheEnabled(true); Bitmap myBitmap = Bitmap.Create(myView.getDrawingCache()); myImageView.setImageBitmap(myBitmap); As I read it, the documentation for getDrawingCache says this is to be expected and to use getDrawingCache(true). Yet, both code examples below throw NullPointer exceptions because the Bitmap returned by getDrawingCache(true) is always null. myView.setDrawingCacheEnabled(true); Bitmap myBitmap = Bitmap.Create(myView.getDrawingCache(true)); myImageView.setImageBitmap(myBitmap); OR myView.buildDrawingCache(true); Bitmap myBitmap = Bitmap.Create(myView.getDrawingCache(true)); myImageView.setImageBitmap(myBitmap); myView.destroyDrawingCache(); Does anyone know how to properly capture and render the drawingCache when anyDensity=false?

    Read the article

  • JQuery & Wordpress - Hide multiple divs inside unique ID?

    - by steelfrog
    I'm trying to write a short Wordpress JQuery for Wordpress comments that would allow users to toggle specific comments on and off. This is my first script, and I'm having a tough time. Once overtly simplified, the comments are formatted like so: <li id="li-comment-<?php comment_ID() ?>"> <div class="gravatar"><img src="#" /></div> <div class="comment_poster">Username</div> <div class="comment_options">Option buttons</div> <div class="comment_content">Comment</div> </li> In the "comment_options" DIV is a series of buttons that control the individual comments (reply, quote, edit, close, etc.). The close button is what I'm trying to write this script for. I need it to toggle the "gravtar" and "comment_content" DIVs, but leave the rest in place so that it still displays the user ID and controls. However, I can't seem to figure out how to contain the action. This is what I have so far: $(document).ready(function() { $("div.trigger").click(function() { $("div.gravatar").slideToggle(); $("div.comment_content").slideToggle(); }); }); The problem with this is that it closes are the .gravatar and .comment_content on the page, not just the ones found in the same list item. If you're curious, this is the page I'm working on. Any idea how I could resolve this? Again, this is my firs time with JQuery, so I'm a little fuzzy on how it all works. Thanks!

    Read the article

  • How can I remove an "ALMOST" Duplicate using LINQ? ( OR SQL? )

    - by Atomiton
    This should be and easy one for the LINQ gurus out there. I'm doing a complex Query using UNIONS and CONTAINSTABLE in my database to return ranked results to my application. I'm getting duplicates in my returned data. This is expected. I'm using CONTAINSTABLE and CONTAINS to get all the results I need. CONTAINSTABLE is ranked by SQL and CONTAINS (which is run only on the Keywords field ) is hard-code-ranked by me. ( Sorry if that doesn't make sense ) Anyway, because the tuples aren't identical ( their rank is different ) a duplicate is returned. I figure the best way to deal with this is use LINQ. I know I'll be using the Distinct() extension method, but do I have to implement the IEqualityComparer interface? I'm a little fuzzy on how to do this. For argument's sake, say my resultset is structured like this class: class Content { ContentID int //KEY Rank int Description String } If I have a List<Content> how would I write the Distinct() method to exclude Rank? Ideally I'd like to keep the Content's highest Rank. SO, if one Content's RAnk is 112 and the other is 76. I'd like to keep the 112 rank. Hopefully I've given enough information.

    Read the article

  • Creating/Maintaining a large project-agnostic code library

    - by bufferz
    In order to reduce repetition and streamline testing/debugging, I'm trying to find the best way to develop a group of libraries that many projects can utilize. I'd like to keep individual executable relatively small, and have shared libraries for math, database, collections, graphics, etc. that were previously scattered among several projects and in many cases duplicated (bad!). This library is to be in an SVN repo and several programmers will be working on it. This library will be in constant development along with the executables that utilize it. For example, I want a code file in ProjectA to look something like the following: using MyCompany.Math.2D; //static 2D math methods using MyCompany.Math.3D; //static #D math methods using MyCompany.Comms.SQL; //static methods for doing simple SQLDB I/O using MyCompany.Graphics.BitmapOperations; //static methods that play with bitmaps So in my ProjectA solution file in VisualStudio, in order to develop/debug the MyCompany library I have to add several projects (Math, Comms, Graphics). Things get pretty cluttered and Solution files get out of date quickly between programmer SVN commits. I'm just looking for a high level approach to maintaining a large, shared code base in an SCN repository. I am fully willing to radically redesign my approach. I'm looking for that warm fuzzy feeling you get when you're design approach is spot on and development is fluid and natural. And ideas? Thanks!!

    Read the article

  • Can someone help me with m Django localization?

    - by alex
    I have a template with has text in it. It's located in /templates under my project directory. I'm trying to do Japanese now. I create a directory called "locale" in my project directory. Then, I set up this in my settings: gettext = lambda s: s LANGUAGES = ( ('de', gettext('German')), ('en', gettext('English')), ('ja', gettext('Japanese')), ) After that, I run this command: django-admin.py makemessages -l ja The only problem is, this doesn't work! In my locale/ja/LC_MESSAGES/django.po: Isn't it supposed to scan my templates with .html extension and grab all the strings? # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-05-20 22:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: settings.py:101 msgid "German" msgstr "" #: settings.py:102 msgid "English" msgstr "" #: settings.py:103 msgid "Japanese" msgstr ""

    Read the article

  • The algorithm used to generate recommendations in Google News?

    - by Siddhant
    Hi everyone. I'm study recommendation engines, and I went through the paper that defines how Google News generates recommendations to users for news items which might be of their interest, based on collaborative filtering. One interesting technique that they mention is Minhashing. I went through what it does, but I'm pretty sure that what I have is a fuzzy idea and there is a strong chance that I'm wrong. The following is what I could make out of it :- Collect a set of all news items. Define a hash function for a user. This hash function returns the index of the first item from the news items which this user viewed, in the list of all news items. Collect, say "n" number of such values, and represent a user with this list of values. Based on the similarity count between these lists, we can calculate the similarity between users as the number of common items. This reduces the number of comparisons a lot. Based on these similarity measures, group users into different clusters. This is just what I think it might be. In Step 2, instead of defining a constant hash function, it might be possible that we vary the hash function in a way that it returns the index of a different element. So one hash function could return the index of the first element from the user's list, another hash function could return the index of the second element from the user's list, and so on. So the nature of the hash function satisfying the minwise independent permutations condition, this does sound like a possible approach. Could anyone please confirm if what I think is correct? Or the minhashing portion of Google News Recommendations, functions in some other way? I'm new to internal implementations of recommendations. Any help is appreciated a lot. Thanks!

    Read the article

  • Objective-C function dispatch collisions; Or, how to achieve "namespaces"?

    - by fbrereto
    I have an application for Mac OS X that supports plugins that are intended to be loaded at the same time. Some of these plugins are built on top of a Cocoa framework that may receive updates in one plugin but not another. Given Objective-C's current method for function dispatching, any call from any plugin to a given Objective-C routine will go to the same routine every time. That means plugin A can find itself inside plugin B with a trivial Objective-C call! Obviously what we're looking for is for each plugin to interact with its own version of the framework upon which it was built. I have been reading some on Objective-C and this particular need, but haven't found a definitive solution for it yet. Update: My use of the word "framework" above is misleading: the framework is a statically-linked library, built into the plugin(s) that need it. The way Objective-C handles dispatching, however, even these statically linked pieces of disparate code will co-mingle in the Objective-C dispatcher, leading to unintended consequences. Update 2: I'm still a bit fuzzy on the answer provided here, as it doesn't seem to propose a solution as much as an unproven hypothesis.

    Read the article

  • Classification: Dealing with Abstain/Rejected Class

    - by abner.ayala
    I am asking for your input and/help on a classification problem. If anyone have any references that I can read to help me solve my problem even better. I have a classification problem of four discrete and very well separated classes. However my input is continuous and has a high frequency (50Hz), since its a real-time problem. The circles represent the clusters of the classes, the blue line the decision boundary and Class 5 equals the (neutral/resting do nothing class). This class is the rejected class. However the problem is that when I move from one class to the other I activate a lot of false positives in the transition movements, since the movement is clearly non-linear. For example, every time I move from class 5 (neutral class) to 1 I first see a lot of 3's before getting to the 1 class. Ideally, I will want my decision boundary to look like the one in the picture below where the rejected class is Class =5. Has a higher decision boundary than the others classes to avoid misclassification during transition. I am currently implementing my algorithm in Matlab using naive bayes, kNN, and SVMs optimized algorithms using Matlab. Question: What is the best/common way to handle abstain/rejected classes classes? Should I use (fuzzy logic, loss function, should I include resting cluster in the training)?

    Read the article

  • Dynamically generated PDF files working in most readers except Adobe Reader

    - by Shane
    I'm trying to dynamically generate PDFs from user input, where I basically print the user input and overlay it on an existing PDF that I did not create. It works, with one major exception. Adobe Reader doesn't read it properly, on Windows or on Linux. QuickOffice on my phone doesn't read it either. So I thought I'd trace the path of me creating the files - 1 - Original PDF of background PDF 1.2 made with Adobe Distiller with the LZW encoding. I didn't make this. 2 - PDF of background PDF 1.4 made with Ghostscript. I used pdf2ps then ps2pdf on the above to strip LZW so that the reportlab and pyPDF libraries would recognize it. Note that this file looks "fuzzy," like a bad scan, in Adobe Reader, but looks fine in other readers. 3 - PDF of user-input text formatted to be combined with background PDF 1.3 made with Reportlab from user input. Opens properly and looks good in every reader I've tried. 4 - Finished PDF PDF 1.3 made from PyPDF's mergePage() function on 2 and 3. Does not open in: Adobe Reader for Windows Adobe Reader for Linux QuickOffice for Android Opens perfectly in: Google Docs' PDF viewer on the web evince for linux ghostscript viewer for linux Foxit reader for Windows Preview for Mac Are there known issues that I should know about? I don't know exactly what "flate" is, but from the internet I gather that it's some sort of open source alternative to LZW for PDF compression? Could that be causing my problem? If so, are there any libraries I could use to fix the cause in my code?

    Read the article

  • select for update problem in jdbc

    - by kartiku
    I'm having a problem with select for update in jdbc. The table i'm trying to update is the smalldb table, i'm having problems-- i'm using select for update which does a lock on the selected row the update statement is -- String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE name = ?"; the select statement is -- rs = stmt1.executeQuery("SELECT hIx FROM libra.smalldb for update"); rs0 = stmt2.executeQuery("SELECT name,aff FROM libra.smalldb"); the second statement is because i need those fields as well. Here is the complete code -- import java.sql.*; import java.util.ArrayList; import java.util.Collections; public class Jdbcexample1 { /** * @param args */ public static void main(String[] args) { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql:///test", "root", "*****"); //String url = "jdbc:msql://200.210.220.1:1114/Demo"; //Connection conn = DriverManager.getConnection(url,"",""); Statement stmt1 = con.createStatement(); Statement stmt2 = con.createStatement(); Statement stmt3 = con.createStatement(); Statement stmt4 = con.createStatement(); ResultSet rs0; ResultSet rs; ResultSet rs1; ResultSet rs2; String name; String hIx; int hIxInt; StringBuffer sb = new StringBuffer(); String affiliationSmall; ArrayList<String> affiliation = new ArrayList<String>(); ArrayList<Float> matchValues = new ArrayList<Float>(); ArrayList<Integer> hixValues = new ArrayList<Integer>(); ArrayList<Integer> idValues = new ArrayList<Integer>(); boolean moreFlag = false; String queryString; int tmpIdx; String name1; //get the hix at that index where the similarity is maximum int tmpHidx = 0; int tmpHix = 0; int id = 0; int count; int tmpidIdx = 0; //rs = stmt.executeQuery("SELECT id FROM libra.researchint WHERE id = 910887"); // Get name, affiliation , hIx from smalldb //rs = stmt1.executeQuery("SELECT name,aff,hIx FROM libra.smalldb"); // String cursorName = "OUR_CURSOR"; // stmt1.setCursorName(cursorName); //rs = stmt1.executeQuery("SELECT name,aff,hIx FROM libra.smalldb for update"); rs = stmt1.executeQuery("SELECT hIx FROM libra.smalldb for update"); rs0 = stmt2.executeQuery("SELECT name,aff FROM libra.smalldb"); while ( rs.next() && rs0.next() ) { //String lastName = rs.getString("id"); hIx = rs.getString("hIx"); hIxInt = Integer.parseInt(hIx); //if hIx if (hIxInt==-1) continue; //name = rs.getString("name"); name = rs0.getString("name"); name1 = new String(name); System.out.println(name); //affiliationSmall = rs.getString("aff"); affiliationSmall = rs0.getString("aff"); //name = "\"" +name+ "\""; // Get matching names from large faculty table //String queryString = "SELECT id,name,hIx FROM libra.faculty WHERE name = " +name; //name = does not work names are similar but not same (in faculty and // smalldb) String query = "SELECT id,name,hIx FROM libra.faculty WHERE name like ?"; //String query = "SELECT id,name,hIx FROM libra.faculty for update of hIx WHERE name like ?"; PreparedStatement prepStmt = con.prepareStatement(query); String[] nameArr = name.split(" "); StringBuffer tmpSb = new StringBuffer(); for(int idx = 0;idx<nameArr.length;idx++) { tmpSb.append(nameArr[idx] + "%"); } name = tmpSb.toString(); prepStmt.setString(1, name); rs1 = prepStmt.executeQuery(); //Try to get matching names from faculty big db //Execute the query on faculty table //rs1 = stmt2.executeQuery(queryString); if(rs1.isClosed()) continue; count = 0; matchValues.clear(); affiliation.clear(); while(rs1.next()) { //name = rs1.getString("name"); id = Integer.parseInt(rs1.getString("id")); //idValues.add(id); tmpHix = Integer.parseInt(rs1.getString("hIx")); queryString = "SELECT aff FROM libra.affiliation WHERE id = "+id; rs2 = stmt3.executeQuery(queryString); //affiliation = rs1.getString("aff"); sb.delete(0, sb.length()); while (rs2.next()) { //Concatenate it to the same string using a stringbuffer sb.append(rs2.getString("aff")); //affiliation.add(rs2.getString("aff")); } affiliation.add(sb.toString()); count++; // if(count1) // { // moreFlag = true; // //Call fuzzy match function, store the distance values and select the // //affiliation that has the minimum distance from affiliationSmall // // //problem is here, affiliation.get Index: 2, Size: 2 // // matchValues.add(fuzzyMatch(affiliationSmall,affiliation.get(count))); // hixValues.add(tmpHix); // idValues.add(id); // } }//end of while rs1 -> faculty rs1.close(); int idx = 0; if(count>1) { moreFlag = true; //Call fuzzy match function, store the distance values and select the //affiliation that has the minimum distance from affiliationSmall //problem is here, affiliation.get Index: 2, Size: 2 matchValues.add(fuzzyMatch(affiliationSmall,affiliation.get(idx))); hixValues.add(tmpHix); idValues.add(id); idx++; } if(moreFlag) { Object obj = Collections.max(matchValues); float maxVal = Float.parseFloat(obj.toString()); //int tmpIdx = matchValues.indexOf(new Float(maxVal)); //get the index at which similarity between affiliation strings is maximum, //as returned by fuzzyMatch //int tmpIdx = matchValues.indexOf(maxVal); tmpIdx = matchValues.indexOf(maxVal); //get the hix at that index where the similarity is maximum //int tmpHidx = hixValues.get(tmpIdx); tmpHidx = hixValues.get(tmpIdx); tmpidIdx = idValues.get(tmpIdx); //update the smalldb table String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE name = ?"; //String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE current of "+cursorName; //PreparedStatement prepStmt1 = con.prepareStatement("UPDATE libra.smalldb SET hIx = ? WHERE current of "+cursorName); PreparedStatement prepStmt1 = con.prepareStatement(updateQ); //PreparedStatement prepStmt1 = con.prepareStatement(updateQ); prepStmt1.setString(2, name1); prepStmt1.setString(1, Integer.toString(tmpHidx)); prepStmt1.executeUpdate(updateQ); //prepStmt1.execute(); //stmt4.executeUpdate(updateQ); }//end of if //For matching names get the affiliation based on id from affiliation table //con.close(); //System.out.println(lastName); System.out.println(name); }//end of while rs -> smalldb rs.close(); // String updateQ = "UPDATE libra.smalldb1 SET hIx = "+Integer.toString(tmpHidx)+ "WHERE id = "+Integer.toString(tmpidIdx); // stmt4.executeUpdate(updateQ); con.close(); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); e.printStackTrace(); } } public static float fuzzyMatch(String affiliationSmall, String affiliation) { //float distance = 0; String[] temp = null; temp = affiliationSmall.split(" "); int index; //int index1 = affiliation.indexOf(affiliationSmall); int matchCount = 0; for (int idx = 0;idx<temp.length; idx++) { index = affiliation.indexOf(temp[idx]); if (index!=-1) { matchCount++; } } float tmpFloat = matchCount/temp.length; //int[] aff1= new int[affiliation1.length()]; //int[] aff2 = new int[affiliation2.length()]; return tmpFloat; } } i think it is because of the second select statement (rs0) Here is the error- Got an exception! You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.Util.getInstance(Util.java:384) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2690) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1648) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1567) at Jdbcexample1.main(Jdbcexample1.java:184)

    Read the article

  • Oracle command hangs when using view for "WHILE x IN..." subquery

    - by Calvin Fisher
    I'm working on a web service that fetches data from an oracle data source in chunks and passes it back to an indexing/search tool in XML format. I'm the C#/.NET guy, and am kind of fuzzy on parts of Oracle. Our Oracle team gave us the following script to run, and it works well: SELECT ROWID, [columns] FROM [table] WHERE ROWID IN ( SELECT ROWID FROM ( SELECT ROWID FROM [table] WHERE ROWID > '[previous_batch_last_rowid]' ORDER BY ROWID ) WHERE ROWNUM <= 10000 ) ORDER BY ROWID 10,000 rows is an arbitrary but reasonable chunk size and ROWID is sufficiently unique for our purposes to use as a UID since each indexing run hits only one table at a time. Bracketed values are filled in programmatically by the web service. Now we're going to start adding views to the indexing, each of which will union a few separate tables. Since ROWID would no longer function as a unique identifier, they added a column to the views (VIEW_UNIQUE_ID) that concatenates the ROWIDs from the component tables to construct a UID for each union. But this script does not work, even though it follows the same form as the previous one: SELECT VIEW_UNIQUE_ID, [columns] FROM [view] WHERE VIEW_UNIQUE_ID IN ( SELECT VIEW_UNIQUE_ID FROM ( SELECT VIEW_UNIQUE_ID FROM [view] WHERE ROWID > '[previous_batch_last_view_unique_id]' ORDER BY VIEW_UNIQUE_ID ) WHERE ROWNUM <= 10000 ) ORDER BY VIEW_UNIQUE_ID It hangs indefinitely with no response from the Oracle server. I've waited 20+ minutes and the SQLTools dialog box indicating a running query remains the same, with no progress or updates. I've tested each subquery independently and each works fine and takes a very short amount of time (<= 1 second), so the view itself is sound. But as soon as the inner two SELECT queries are added with "WHERE VIEW_UNIQUE_ID IN...", it hangs. Why doesn't this query work for views? In what important way are they not interchangeable here?

    Read the article

  • Lucene wildcard queries

    - by Javi
    Hello, I have this question relating to Lucene. I have a form and I get a text from it and I want to perform a full text search in several fields. Suppose I get from the input the text "textToLook". I have a Lucene Analyzer with several filters. One of them is lowerCaseFilter, so when I create the index, words will be lowercased. Imagine I want to search into two fields field1 and field2 so the lucene query would be something like this (note that 'textToLook' now is 'texttolook'): field1: texttolook* field2:texttolook* In my class I have something like this to create the query. I works when there is no wildcard. String text = "textToLook"; String[] fields = {"field1", "field2"}; //analyser is the same as the one used for indexing Analyzer analyzer = fullTextEntityManager.getSearchFactory().getAnalyzer("customAnalyzer"); MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer); org.apache.lucene.search.Query queryTextoLibre = parser.parse(text); With this code the query would be: field1: texttolook field2:texttolook but If I set text to "textToLook*" I get field1: textToLook* field2:textToLook* which won't find correctly as the indexes are in lowercase. I have read in lucene website this: " Wildcard, Prefix, and Fuzzy queries are not passed through the Analyzer, which is the component that performs operations such as stemming and lowercasing" My problem cannot be solved by setting the behaviour case insensitive cause my analyzer has other fields which for examples remove some suffixes of words. I think I can solve the problem by getting how the text would be after going through the filters of my analyzer, then I could add the "*" and then I could build the Query with MultiFieldQueryParser. So in this example I woud get "textToLower" and after being passed to to these filters I could get "texttolower". After this I could make "textotolower*". But, is there any way to get the value of my text variable after going through all my analyzer's filters? How can I get all the filters of my analyzer? Is this possible? Thanks

    Read the article

  • I'm looking for a way to evaluate reading rate in several languages

    - by i30817
    I have a software that is page oriented instead of scrollbar oriented so i can easily count the words, but i'd like a way to filter outliers and some default value for the text language (that is known). The goal is from the remaining text to calculate the remaining time. I'm not sure what is the best unit to use. WPM (words per minute) from here seems very fuzzy and human oriented. Besides i don't know how many "words" remain in the text. http://www.sfsu.edu/~testing/CalReadRate.htm So i came up with this: The user is reading the text. The total text size in characters is known. His position in the text is known. So the remaining characters to read is also known. If a language has a median word length of say 5 chars, then if i had a WPM speed for the user, i could calculate the remaining time. 3 things are needed for this: 1) A table of the median word length of the language. 2) A table of the median WPM of a median user per language. 3) Update the WPM to fit the user as data becomes available, filtering outliers. However i can't find these tables. And i'm not sure how precise it is assuming median word length.

    Read the article

  • Problems running XNA game on 64-bit Windows 7

    - by Tesserex
    I'm having problems getting my game engine to run on my brother's machine, which is running 64-bit Windows 7. I'm developing on 32-bit XP SP2. My app uses XNA, FMOD.NET, and another dll I wrote entirely in C#. Everything is targeted to x86, not AnyCPU. I've read that this is required for XNA to work because there is no 64-bit xna framework. I recompiled FMOD.NET as x86 as well and made sure to be using the 32-bit version of the native dll. So I don't see any problems there. However when he tries to run my app, it gives an error which is mysterious, but not unheard of. A FileNotFoundException with an empty file name, and the top of the stack trace is in my main form constructor. The message is The specified module could not be found. (Exception from HRESULT: 0x8007007E) I found some threads online about this error, all with very vague, mixed, and fuzzy responses that don't really help me. Most remind people to target x86. Some say check that they have all the dlls necessary. I gave my brother Microsoft.Xna.Framework.dll, but does he need to install the entire XNA redistributable package? When I take everything I sent him and stick it in a random directory, it still runs fine for me. I developed the game in VS2008, not in game studio, using XNA 3.0 and a Windows Forms control that uses XNA drawing which I found in an msdn tutorial. I would also like to avoid requiring a full installer if possible. Any insight? Please?

    Read the article

  • Effective Method to Manage and Search Through 100,000+ Objects Instantly? (C#)

    - by Kirk
    I'm writing a media player for enthusiasts with large collections (over 100,000 tracks) and one of my main goals is speed in search. I would like to allow the user to perform a Google-esque search of their entire music collection based on these factors: Song Path and File Name Items in ID3 Tag (Title, Artist, Album, etc.) Lyrics What is the best way for me to store this data and search through it? Currently I am storing each track in an object and iterating over an array of these objects checking each of their variables for string matches based on given search text. I've run into problems though where my search is not effective because it is always a phrase search and I'm not sure how to make it more fuzzy. Would an internal DB like SQLlite be faster than this? Any ideas on how I should structure this system? I also need playlist persistence, so that when they close the app and open the app their same playlist loads immediately. How should I store the playlist information so it can load quickly when the application starts? Currently I am JSON encoding the entire playlist, storing it in a text file, and reading it into the ListView at runtime, but it is getting sluggish over 20,000 tracks. Thanks!

    Read the article

  • can javascript process binary data?

    - by Johnny
    admit me describe my questions in situation-oriented way: assume IE is still the dominate web browser(the firefox have document for binary processing): the XMLHttpRequest.responseText or XMLHttpRequest.responseXML in ie desire txt or xml/xhtml/html,but what about the server response the xmlHttprequest whith MIME TYPE application/octet ? would the response string all little than 256 ?(every char of that string < 256), thanks very much for a straight answer, i have no webserver env,so i don't know how to test it out. because use txt or xml have a issue of character set encode, and i don't know how to process #[[[CDDATA node of one encoded xml(ex : utf-8,ascii,gb18030) with javascript, when i getNodeText, does the docObj return me byte or decoded char ? if it was decoded char which according to the header indicated charSet in the httpresponse , it would be all wrong. to avoid mess up with charSet ,i would like the server to response octet data and force strings data to be encoded as utf-8 but another charSet in the binary format. if the response is octal, so i guess the browser would not try to decode the response"txt" does this weird? or miss understanding the fundamental things? EDIT: I believe the question is asking this: Can Javascript safely process strings that aren't encoded in Unicode? What are the problems with trying to do so? EDIT: no no no , i means if http-header: content-type is "application/octet" , would the ie try to decoded it as (16bits Unicode | ie local setting charset ) when i get XMLHttpRequestobj.responseText use javascript ? or it(ie) just wrap every single byte of the response body as a javascript string, then every char in that string little than or equal 256 (char<=256), am i talking Mars language? sadly, if i were Marsizen,i would come as tourist without fuzzy questions. however i am in a country which share at least one property with Mars : RED

    Read the article

  • Testing a method used from an abstract class

    - by Bas
    I have to Unit Test a method (runMethod()) that uses a method from an inhereted abstract class to create a boolean. The method in the abstract class uses XmlDocuments and nodes to retrieve information. The code looks somewhat like this (and this is extremely simplified, but it states my problem) namespace AbstractTestExample { public abstract class AbstractExample { public string propertyValues; protected XmlNode propertyValuesXML; protected string getProperty(string propertyName) { XmlDocument doc = new XmlDocument(); doc.Load(new System.IO.StringReader(propertyValues)); propertyValuesXML= doc.FirstChild; XmlNode node = propertyValuesXML.SelectSingleNode(String.Format("property[name='{0}']/value", propertyName)); return node.InnerText; } } public class AbstractInheret : AbstractExample { public void runMethod() { bool addIfContains = (getProperty("AddIfContains") == null || getProperty("AddIfContains") == "True"); //Do something with boolean } } } So, the code wants to get a property from a created XmlDocument and uses it to form the result to a boolean. Now my question is, what is the best solution to make sure I have control over the booleans result behaviour. I'm using Moq for possible mocking. I know this code example is probably a bit fuzzy, but it's the best I could show. Hope you guys can help.

    Read the article

< Previous Page | 5 6 7 8 9 10 11  | Next Page >