Search Results

Search found 13889 results on 556 pages for 'results'.

Page 53/556 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • unix How to compare two files and get results to third file?

    - by Martin Mocik
    I have two files 1st file is like this: www.example.com www.domain.com www.otherexample.com www.other-domain.com www.other-example.com www.exa-ample.com 2nd file is like this (numbers after ;;; are between 0-10): www.example.com;;;2 www.domain.com;;;5 www.other-domain;;;0 www.exa-ample.com;;;4 and i want compare these two files and output to third file like this: www.otherexample.com www.other-example.com Both files have large size (over 500mb)

    Read the article

  • How to cope with null results in SQL Tasks that return single rows in SSIS 2005?

    - by JSacksteder
    In a dataflow task, I can slip a rowcount into the processing flow and place the count into a variable. I can later use that variable to conditionally perform some other work if the rowcount was 0. This works well for me, but I have no corresponding strategy for sql tasks expected to return a single row. In that event, I'm returning those values into variables. If the lookup produces no rows, the sql task fails when assigning values into those variables. I can branch on that component failing, but there's a side effect of that - if I'm running the job as a SQL server agent job step, the step returns DTSER_FAILURE, causing the step to fail. I can tell the sql agent to disregard the step failure, but then I won't know if I have a legitimate error in that step. This seems harder than it should be. The only strategy I can think of is to run the same query with a count(*) aggregate and test if that returns a number 0 and if so running the query again without the count. That's ugly because I have the same query in two places that I need to keep in sync. Is there a better way?

    Read the article

  • When using Query Syntax in C# "Enumeration yielded no results". How to retrieve output

    - by Shantanu Gupta
    I have created this query to fetch some result from database. Here is my table structure. What exaclty is happening. DtMapGuestDepartment as Table 1 DtDepartment as Table 2 Are being used var dept_list= from map in DtMapGuestDepartment.AsEnumerable() where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID") join dept in DtDepartment.AsEnumerable() on map.Field<Nullable<long>>("DEPARTMENT_ID") equals dept.Field<Nullable<long>>("DEPARTMENT_ID") select dept.Field<string>("DEPARTMENT_ID"); I am performing this query on DataTables and expect it to return me a datatable. Here I want to select distinct department from Table 1 as well which will be my next quest. Please answer to that also if possible.

    Read the article

  • mocking command object in grails controller results in hasErrors() return false no matter what! Plea

    - by egervari
    I have a controller that uses a command object in a controller action. When mocking this command object in a grails' controller unit test, the hasErrors() method always returns false, even when I am purposefully violating its constraints. def save = { RegistrationForm form -> if(form.hasErrors()) { // code block never gets executed } else { // code block always gets executed } } In the test itself, I do this: mockCommandObject(RegistrationForm) def form = new RegistrationForm(emailAddress: "ken.bad@gmail", password: "secret", confirmPassword: "wrong") controller.save(form) I am purposefully giving it a bad email address, and I am making sure the password and the confirmPassword properties are different. In this case, hasErrors() should return true... but it doesn't. I don't know how my testing can be any where reliable if such a basic thing does not work :/ Here is the RegistrationForm class, so you can see the constraints I am using: class RegistrationForm { def springSecurityService String emailAddress String password String confirmPassword String getEncryptedPassword() { springSecurityService.encodePassword(password) } static constraints = { emailAddress(blank: false, email: true) password(blank: false, minSize:4, maxSize: 10) confirmPassword(blank: false, validator: { confirmPassword, form -> confirmPassword == form.password }) } }

    Read the article

  • Java resource management: please help to understand Findbugs results.

    - by java.is.for.desktop
    Hello, everyone! Findbugs bugs me about a method which opens two Closeable instances, but I can't understand why. Source public static void sourceXmlToBeautifiedXml(File input, File output) throws TransformerException, IOException, JAXBException { FileReader fileReader = new FileReader(input); FileWriter fileWriter = new FileWriter(output); try { // may throw something sourceXmlToBeautifiedXml(fileReader, fileWriter); } finally { try { fileReader.close(); } finally { fileWriter.close(); } } } Findbugs analysis Findbugs tells me Method [...] may fail to clean up java.io.Reader [...] and points to the line with FileReader fileReader = ... Question Who is wrong: me or Findbugs?

    Read the article

  • How to order results based on number of search term matches?

    - by Travis
    I am using the following tables in mysql to describe records that can have multiple searchtags associated with them: TABLE records ID title desc TABLE searchTags ID name TABLE recordSearchTags recordID searchTagID To SELECT records based on arbitrary search input, I have a statement that looks sort of like this: SELECT recordID FROM recordSearchTags LEFT JOIN searchTags ON recordSearchTags.searchTagID = searchTags.ID WHERE searchTags.name LIKE CONCAT('%','$search1','%') OR searchTags.name LIKE CONCAT('%','$search2','%') OR searchTags.name LIKE CONCAT('%','$search3','%') OR searchTags.name LIKE CONCAT('%','$search4','%'); I'd like to ORDER this resultset, so that rows that match with more search terms are displayed in front of rows that match with fewer search terms. For example, if a row matches all 4 search terms, it will be top of the list. A row that matches only 2 search terms will be somewhere in the middle. And a row that matches just one search term will be at the end. Any suggestions on what is the best way to do this? Thanks!

    Read the article

  • Is there a more efficent way to randomise a set of linq results?

    - by Matthew De'Loughry
    Hi just wondering if you could help I've produced a function to get back a random set of submission depnding on the amount passed to it, but I worry that even though it works now with a small amount of data when the a large amount is passed through it would become efficent and cause problems. Just wondering if you could suggest a more efficent way of doing the following: public List<Submission> GetRandomWinners(int id) { List<Submission> submissions = new List<Submission>(); int amount = (DbContext().Competitions .Where(s => s.CompetitionId == id).FirstOrDefault()).NumberWinners; for(int i = 1 ; i <= amount; i++) { bool added = false; while (!added) { bool found = false; var randSubmissions = DbContext().Submissions .Where(s => s.CompetitionId == id && s.CorrectAnswer).ToList(); int count = randSubmissions.Count(); int index = new Random().Next(count); foreach (var sub in submissions ) { if (sub == randSubmissions.Skip(index).FirstOrDefault()) found = true; } if (!found) { submissions.Add(randSubmissions.Skip(index).FirstOrDefault()); added = true; } } } return submissions; } As I say I have this fully working and bringing back the wanted result just I'm not liking the foreach and while checks in there and my head has just turned to mush now try to come up with the above soloution. Thanks Matt

    Read the article

  • If .net sha1 hash expects a byte array, and php sha1() wants a string, can I match the results?

    - by lynn
    I have a set of bytes I want to apply an sha1 hash to. One hash will be in .net, the other in PHP. Then I'll test to see if they match. In .net, you can create a byte array and use sha.ComputeHash(). byte[] data = new byte[DATA_SIZE]; byte[] result; SHA1 sha = new SHA1CryptoServiceProvider(); // This is one implementation of the abstract class SHA1. result = sha.ComputeHash(data); In PHP, you call sha1($string). I can't do anything about the .net side of the code, but how can I get the same hash out of PHP that .net will generate? Please note: I am ONLY able to work on the PHP side of this. The .net stuff is fixed and can't be modified. Thanks!

    Read the article

  • Shortcut to create automatic properties using Visual Studio 2008/2010 or Resharper 5

    - by Piers Myers
    I have a class that contains a load of properties that contain results of some calculations e.g: public class Results { public double Result1 { get; set; } public double Result2 { get; set; } } In a different class I am doing calculations to populate the above properties, e.g: public class Calc { private Results Calc() { Results res = new Results(); res.Result1 = ... some calculation res.Result2 = ... some other calculation res.Result3 = ... // not yet defined in 'Results' class return res; } } When I am writing the Calc class, 'Result3' will be highlighted in red as it is not yet defined in the 'Results' class. Currently I am using the Resharper ALT-Enter shortcut, selecting "Create Property 'Result3'" which will create the following code int the 'Results' class: public double Result3 { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } Which I need to manually change to: public double Result3 { get; set; } Then I use the CTRL-Shift-Backspace shortcut to take me back to the 'Calc' class. How can I easily create automatic properties in the 'Results' class if they are not yet defined directly from the 'Calc' class?

    Read the article

  • Different results coming out of an init method than those expected. Why does this happen and how can

    - by Mark Reid
    When I run this method the two properties I have are set to (NULL) when I try and access them outside of the if statement. But they are set to 0 and NO if I check them inside the for loop. -(id) init { NSLog(@"Jumping into the init method!"); if (self = [super init]) { NSLog(@"Running the init method extras"); accumulator = 0; NSLog(@"self.accumulator is %g", accumulator); decimal = NO; } NSLog(@"Calc after init is: %@ and %@", self.accumulator, self.decimal); return self; } Any suggestions as to why what comes out is different from what's done in the for loop?

    Read the article

  • How can I organize many results in a selectbox?

    - by zeckdude
    I have a select box that is part of a form. It is currently querying the addresses table and displaying the addresses into the select box. I plan on having up to 100 addresses. I'm looking for a solution where I can show all the states if the user clicks on the select box. Then if the user hovers over a state it will show all the addresses for that specific state. Then if the user clicks on an address, it will show that as the picked option in the select box. This is like a dropdown menu within a select box. Does anyone know where I can find a solution as this?

    Read the article

  • Help with IF THEN breaking when comparing results from MYSQL query.

    - by roydukkey
    I'm have a problem with an invite system. The if statement seems to break. It shows the message "Fail" but the UPDATE statement still executes. Why do both the THEN and the ELSE excute? $dbConn = new dbConn(); // Check if POST user_username and user_hash are matching and valid; both are hidden for fields $sql = "SELECT user_username " . "FROM table_users " . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"])." " . "AND user_hash='".mysql_real_escape_string($_POST["user_hash"])."' " . "AND user_enabled=0;"; $objUser = $dbConn->query($sql); // If result contains 1 or more rows if( mysql_num_rows($objUser) != NULL ){ $objUser = mysql_fetch_assoc($objUser); $ssnUser->login( $objUser["user_username"] ); $sql = "UPDATE table_users SET " . "user_enabled=1, " . "user_first_name='".mysql_real_escape_string($_POST["user_first_name"])."', " . "user_last_name='".mysql_real_escape_string($_POST["user_last_name"])."', " . "user_password='".mysql_real_escape_string( md5($_POST["user_password"]) )."' " . "WHERE user_id=".mysql_real_escape_string($_POST["user_id"]).";"; $dbConn->query($sql); echo "Success"; header( "Refresh: 5; url=/account/?action=domains" ); } else { echo "Fail"; } This dbConn Class is as follows: class dbConn{ var $username = "xxxx_admin"; var $password = "xxxxxxxx"; var $server = "localhost"; var $database = "xxxx"; var $objConn; function __construct(){ $conn = mysql_connect( $this->server, $this->username, $this->password, true ); if( !$conn ){ die("Could not connect: ".mysql_error() ); } else { $this->objConn = $conn; } unset($conn); } function __destruct(){ mysql_close( $this->objConn ); unset( $this ); } function query( $query, $db = false ){ mysql_select_db( $db != false ? $db : $this->database, $this->objConn ); $result = mysql_query( $query ); unset($query,$db); return $result; } }

    Read the article

  • Need to speed up the results of this SQL statement. Any advice?

    - by jeffself
    I've got the following SQL Statement that needs some major speed up. The problem is I need to search on two fields, where each of them is calling several sub-selects. Is there a way to join the two fields together so I call the sub-selects only once? SELECT billyr, billno, propacct, vinid, taxpaid, duedate, datepif, propdesc FROM trcdba.billspaid WHERE date(datepif) > '01/06/2009' AND date(datepif) <= '01/06/2010' AND custno in (select custno from cwdba.txpytaxid where taxpayerno in (select taxpayerno from cwdba.txpyaccts where accountno in (select accountno from rtadba.reasacct where controlno = 1234567))) OR custno2 in (select custno from cwdba.txpytaxid where taxpayerno in (select taxpayerno from cwdba.txpyaccts where accountno in (select accountno from rtadba.reasacct where controlno = 1234567)))

    Read the article

  • Help with mysql sum and group query and managing results for jquery graph.

    - by Scarface
    I have a system I am trying to design that will retrieve information from a database, so that it can be plotted in a jquery graph. I need to retrieve the information and somehow put it in the necessary coordinates format (for example two coordinates var d = [[1269417600000, 10],[1269504000000, 15]];). My table that I am selecting from is a table that stores user votes with fields: points_id (1=vote up, 2=vote down), user_id, timestamp, topic_id What I need to do is select all the votes and somehow group them into respective days and then sum the difference between 1 votes and 2 votes for each day. I then need to somehow display the data in the appropriate plotting format shown earlier. For example April 1, 4 votes. The data needs to be separated by commas, except the last plot entry, so I am not sure how to approach that. I showed an example below of the kind of thing I need but it is not correct, echo "var d=["; $query=mysql_query( "SELECT *, SUM(IF(points_id = \"1\", 1,0))-SUM(IF([points_id = \"2\", 1,0)) AS 'total' FROM points LEFT JOIN topic ON topic.topic_id=points.topic_id WHERE topic.creator='$user' GROUP by timestamp HAVING certain time interval" ); while ($row=mysql_fetch_assoc($query)){ $timestamp=$row['timestamp']; $votes=$row['total']; echo "[$timestamp,$vote],"; } echo "];";

    Read the article

  • How to remove caracters like (), ' * [] form a grep results with grep, awk or sed?

    - by easyyu
    For example if I made a file with grep that give me a next result: 16 Jan 07:18:42 (name1), xx.210.49.xx), 16 Jan 07:19:14 (name2), xx.210.xx.24), 16 Jan 07:19:17 (name3), xx.140.xxx.79), 16 Jan 07:19:44 (name4), xx.210.49.xx), 16 Jan 07:19:56 (name5), xx.140.xxx.79), ,then how to sed awk or grep to remove all except date name and IP to look like this: 16 Jan 07:18:42 name1 xx.210.49.xx 16 Jan 07:19:14 name2 xx.210.xx.24 16 Jan 07:19:17 name3 xx.140.xxx.79 16 Jan 07:19:44 name4 xx.210.49.xx 16 Jan 07:19:56 name5 xx.140.xxx.79 My grep command look like this: grep 'double' $DAEMON | awk -F" " '{print $2" "$1" "$3" "$8" "$10}' > $DBLOG Thx.

    Read the article

  • casting BSTR as char* in a dll; different results depnding on VB/C# caller.

    - by Toby Wilson
    I have a dll function that takes BSTR parameters. These are casted as char* before being used for other things. When the dll is called from VB code this works fine. However, when it is called from C# code, only the first character is pointed to. Both of these are excel addIns for Pre-2007 and 2007+ versions of Office, which call into a faster C++ AddIn. They actually call it directly, not through Excel. The VB function declaration looks like this: Private Declare Function Test Lib "ExcelAddIn.xll" (ByVal param As String) As String The C# function declaration looks like this: [DllImport("ExcelAddIn.xll", CharSet=CharSet.Ansi)] [return:MarshalAs(UnmanagedType.BStr)] private static extern string Test([MarshalAs(UnmanagedType.BStr)] string param); When debugging the dll and watching the input BSTR values, they appear to be correct from both; just the C# one only casts the first character. Charset=CharSet.Unicode makes no difference. Any ideas anyone?

    Read the article

  • How to unit tests functions which return results asyncronously in XCode?

    - by DevDevDev
    I have something like - (void)getData:(SomeParameter*)param { // Remotely call out for data returned asynchronously // returns data via a delegate method } - (void)handleDataDelegateMethod:(NSData*)data { // Handle returned data } I want to write a unit test for this, how can I do something better than NSData* returnedData = nil; - (void)handleDataDelegateMethod:(NSData*)data { returnedData = data; } - (void)test { [obj getData:param]; while (!returnedData) { [NSThread sleep:1]; } // Make tests on returnedData }

    Read the article

  • Query about running a program through valgrind and getting false results comparing to other systems.

    - by FILIaS
    Yesterday i posted this: What's the problem with this code? [hashtable in C] and paxdiablo offered to help me. He posted a sample of code and asked me to run it through valgrind on my machine. This code normally generates: 12,4 But on my machine, i get 24,8. The doubled! I'm just curious why is that happening. Hope sb has a good explaination. I post also paxdiablo's code (for anyone who cant find it.) #include <stdio.h> #include <stdlib.h> typedef struct HashTable { int size ; struct List *head; struct List *tail; } HashTable; typedef struct List { char *number; char *name; int time; struct List *next; } List; #define size_of_table 211 HashTable *createHashTable(void) { HashTable *new_table = malloc(sizeof(*new_table)*size_of_table); //line 606 printf ("%d\n", sizeof(*new_table)); printf ("%d\n", sizeof(new_table)); if (new_table == NULL) { return NULL; } int i=0; for(i; i<size_of_table; i++) { new_table[i].size=0; new_table[i].head=NULL; new_table[i].tail=NULL; } return new_table; } int main(void) { HashTable *x = createHashTable(); free (x); return 0; }

    Read the article

  • How to use LINQ to SQL to create ranked search results?

    - by quakkels
    I am looking for a way to use l2s to return ranked result based on keywords. I would like to take a keyword and be able to search the table for that keyword using .contains(). The trick that I haven't been able to figure out is how to get a count of how many times that keyqord appears, and then .OrderByDescending() based on that count. So if i had some thing like: string keyword = "SomeKeyword"; IQueryable<Article> searchResults = from a in GenesisRepository.Article where a.Body.Contains(keyword) select a; What is the best way to order searchResults based on the number of times keyword appears in a.Body? Thanks for any help.

    Read the article

  • Unexpected results when looking at ASCII codes in C++.

    - by Columbo
    Hello, The bit of code below is extracting ASCII codes from characters. When I convert characters in the normal ASCII region I get the value I expect. When I convert £ and € from the extened region I get a load of 1's padding the INT that I'm storing the character in. e.g. the output of the below is: 45 (ascii E as expected) FFFFFF80 (extended ascii € as expected but padded with ones) It's not causing me an issue but I'm just wondering why this happens. Here's the code... unsigned int asciichar[3]; string cTextToEncode = "E€"; for (unsigned int i = 0; i < cTextToEncode.length(); i++) { asciichar[i] = (unsigned int)cTextToEncode[i]; cout << hex << asciichar[i] << "\n"; } Can anyone explain why this is? Thanks

    Read the article

  • Using FileSystemWatcher in detecting a xml file, using Linq in reading the xml file and prompt the results error "Root Element is Missing"

    - by GrayFullBuster
    My application is already working it can detect the xml file and prompt the content of the xml file but sometimes it will prompt "Root element is missing", and sometimes also it is okay but when I open the xml file, it is ok, it has contents on it. How to solve this issue. Here is the screenshot of the error: Here is the code: private void fileSystemWatcher_Created(object sender, System.IO.FileSystemEventArgs e) { string invoice = ""; using (var stream = System.IO.File.Open(e.FullPath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite)) { var doc = System.Xml.Linq.XDocument.Load(stream); var transac = from r in doc.Descendants("Transaction") select new { InvoiceNumber = r.Element("InvoiceNumber").Value, }; foreach (var i in transac) { invoice = i.InvoiceNumber; } } MessageBox.Show(invoice); fileSystemWatcher.EnableRaisingEvents = false; } The error goes here var doc = System.Xml.Linq.XDocument.Load(stream);

    Read the article

  • how to debug a query that has valid syntax, executes, but returns no results?

    - by Ty W
    So I'm writing a fairly involved query with a half dozen joins, a dependent subquery for [greatest-n-per-group] purposes, grouping, etc. It is syntactically valid, but I've clearly made at least one mistake because it returns nothing. In the past I've debugged valid queries that return nothing by removing joins, executing subqueries on their own, removing WHERE conditions, and removing grouping to see what I would get but so far this one has me stumped. Are there better tools or techniques to use for this sort of thing? This particular query is for MySQL if it matters for any platform-specific tools.

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >