Search Results

Search found 10383 results on 416 pages for 'exact match'.

Page 13/416 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Printing the exact content of a text file in java

    - by Benjamin
    I want to print the content of a simple text file in java exactly the way the text appears in the text file. The print out has the same content as the text file but the format is not the same. tabs and line breaks are ignored in the print out. Any help will be very much appreciated.

    Read the article

  • Printing the exact content of a text file in java

    - by Benjamin
    I want to print the content of a simple text file in java exactly the way the text appears in the text file. The print out has the same content as the text file but the format is not the same. tabs and line breaks are ignored in the print out. Any help will be very much appreciated.

    Read the article

  • Hyphenate a random string to an exact format

    - by chrissygormley
    Hello, I am creating a random ID using the below code: from random import * import string # The characters to make up the random password chars = string.ascii_letters + string.digits def random_password(): return "".join(choice(chars) for x in range(32)) This will output something like: 60ff612332b741508bc4432e34ec1d3e I would like the format to be in this format: 60ff6123-32b7-4150-8bc4-432e34ec1d3e I was looking at the .split() method but can't see how to do this with a random id, also the hyphen's must be at these places so splitting them by a certain amount of digits is out. I'm asking is there a way to split these random id's by 8 number's then 4 etc. Thanks

    Read the article

  • Writing csv files with python with exact formatting parameters

    - by Ben Harrison
    I'm having trouble with processing some csv data files for a project. The project's programmer has moved onto greener pastures, and now I'm trying to finish the data analysis up (I did/do the statistical analysis.) The programmer suggested using python/csv reader to help break down the files, which I've had some success with, but not in a way I can use. This code is a little different from what I was trying before. I am essentially attempting to create an array. In the raw data format, the first 7 rows contain no data, and then each column contains 50 experiments, each with 4000 rows, for 200000 some rows total. What I want to do is take each column, and make it an individual csv file, with each experiment in its own column. So it would be an array of 50 columns and 4000 rows for each data type. The code here does break down the correct values, I think the logic is okay, but it is breaking down the opposite of how I want it. I want the separators without quotes (the commas and spaces) and I want the element values in quotes. Right now it is doing just the opposite for both, element values with no quotes, and the separators in quotes. I've spent several hours trying to figure out how to do this to no avail, import csv ifile = open('00_follow_maverick.csv') epistemicfile = open('00_follower_maverick_EP.csv', 'w') reader = csv.reader(ifile) colnum = 0 rownum = 0 y = 0 z = 8 for column in reader: rownum = 4000 * y + z for element in column: writer = csv.writer(epistemicfile) if y <= 50: y = y + 1 writer.writerow([element]) writer.writerow(',') rownum = x * y + z if y > 50: y = 0 z = z + 1 writer.writerow(' ') rownum = x * y + z if z >= 4008: break What is going on: I am taking each row in the raw data file in iterations of 4000, so that I can separate them with commas for the 50 experiments. When y, the experiment indicator here, reaches 50, it resets back to experiment 0, and adds 1 to z, which tells it which row to look at, by the formula of 4000 * y + z. When it completes the rows for all 50 experiments, it is finished. The problem here is that I don't know how to get python to write the actual values in quotes, and my separators outside of quotes. Any help will be most appreciated. Apologies if this seems a stupid question, I have no programming experience, this is my first attempt ever. Thank you.

    Read the article

  • Reading text files line by line, with exact offset/position reporting

    - by Benjamin Podszun
    Hi. My simple requirement: Reading a huge ( a million) line test file (For this example assume it's a CSV of some sorts) and keeping a reference to the beginning of that line for faster lookup in the future (read a line, starting at X). I tried the naive and easy way first, using a StreamWriter and accessing the underlying BaseStream.Position. Unfortunately that doesn't work as I intended: Given a file containing the following Foo Bar Baz Bla Fasel and this very simple code using (var sr = new StreamReader(@"C:\Temp\LineTest.txt")) { string line; long pos = sr.BaseStream.Position; while ((line = sr.ReadLine()) != null) { Console.Write("{0:d3} ", pos); Console.WriteLine(line); pos = sr.BaseStream.Position; } } the output is: 000 Foo 025 Bar 025 Baz 025 Bla 025 Fasel I can imagine that the stream is trying to be helpful/efficient and probably reads in (big) chunks whenever new data is necessary. For me this is bad.. The question, finally: Any way to get the (byte, char) offset while reading a file line by line without using a basic Stream and messing with \r \n \r\n and string encoding etc. manually? Not a big deal, really, I just don't like to build things that might exist already..

    Read the article

  • Exact textual representation of an IEEE "double"

    - by CyberShadow
    I need to represent an IEEE 754-1985 double (64-bit) floating point number in a human-readable textual form, with the condition that the textual form can be parsed back into exactly the same (bit-wise) number. Is this possible/practical to do without just printing the raw bytes? If yes, code to do this would be much appreciated.

    Read the article

  • Generated LinqtoSql Sql 5x slower than SAME EXACT hand-written sql

    - by JasonM
    I have a sql statement which is hardcoded in an existing VB6 app. I'm upgrading a new version in C# and using Linq To Sql. I was able to get LinqToSql to generate the same sql (before I start refactoring), but for some reason the Sql generated by LinqToSql is 5x slower than the original sql. This is running the generated Sql Directly in LinqPad. The only real difference my meager sql eyes can spot is the WITH (NOLOCK), which if I add into the LinqToSql generated sql, makes no difference. Can someone point out what I'm doing wrong here? Thanks! Existing Hard Coded Sql (5.0 Seconds) SELECT DISTINCT CH.ClaimNum, CH.AcnProvID, CH.AcnPatID, CH.TinNum, CH.Diag1, CH.GroupNum, CH.AllowedTotal FROM Claims.dbo.T_ClaimsHeader AS CH WITH (NOLOCK) WHERE CH.ContractID IN ('123A','123B','123C','123D','123E','123F','123G','123H') AND ( ( (CH.Transmited Is Null or CH.Transmited = '') AND CH.DateTransmit Is Null AND CH.EobDate Is Null AND CH.ProcessFlag IN ('Y','E') AND CH.DataSource NOT IN ('A','EC','EU') AND CH.AllowedTotal > 0 ) ) ORDER BY CH.AcnPatID, CH.ClaimNum Generated Sql from LinqToSql (27.6 Seconds) -- Region Parameters DECLARE @p0 NVarChar(4) SET @p0 = '123A' DECLARE @p1 NVarChar(4) SET @p1 = '123B' DECLARE @p2 NVarChar(4) SET @p2 = '123C' DECLARE @p3 NVarChar(4) SET @p3 = '123D' DECLARE @p4 NVarChar(4) SET @p4 = '123E' DECLARE @p5 NVarChar(4) SET @p5 = '123F' DECLARE @p6 NVarChar(4) SET @p6 = '123G' DECLARE @p7 NVarChar(4) SET @p7 = '123H' DECLARE @p8 VarChar(1) SET @p8 = '' DECLARE @p9 NVarChar(1) SET @p9 = 'Y' DECLARE @p10 NVarChar(1) SET @p10 = 'E' DECLARE @p11 NVarChar(1) SET @p11 = 'A' DECLARE @p12 NVarChar(2) SET @p12 = 'EC' DECLARE @p13 NVarChar(2) SET @p13 = 'EU' DECLARE @p14 Decimal(5,4) SET @p14 = 0 -- EndRegion SELECT DISTINCT [t0].[ClaimNum], [t0].[acnprovid] AS [AcnProvID], [t0].[acnpatid] AS [AcnPatID], [t0].[tinnum] AS [TinNum], [t0].[diag1] AS [Diag1], [t0].[GroupNum], [t0].[allowedtotal] AS [AllowedTotal] FROM [Claims].[dbo].[T_ClaimsHeader] AS [t0] WHERE ([t0].[contractid] IN (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7)) AND (([t0].[Transmited] IS NULL) OR ([t0].[Transmited] = @p8)) AND ([t0].[DATETRANSMIT] IS NULL) AND ([t0].[EOBDATE] IS NULL) AND ([t0].[PROCESSFLAG] IN (@p9, @p10)) AND (NOT ([t0].[DataSource] IN (@p11, @p12, @p13))) AND ([t0].[allowedtotal] > @p14) ORDER BY [t0].[acnpatid], [t0].[ClaimNum] New LinqToSql Code (30+ seconds... Times out ) var contractIds = T_ContractDatas.Where(x => x.EdiSubmissionGroupID == "123-01").Select(x => x.CONTRACTID).ToList(); var processFlags = new List<string> {"Y","E"}; var dataSource = new List<string> {"A","EC","EU"}; var results = (from claims in T_ClaimsHeaders where contractIds.Contains(claims.contractid) && (claims.Transmited == null || claims.Transmited == string.Empty ) && claims.DATETRANSMIT == null && claims.EOBDATE == null && processFlags.Contains(claims.PROCESSFLAG) && !dataSource.Contains(claims.DataSource) && claims.allowedtotal > 0 select new { ClaimNum = claims.ClaimNum, AcnProvID = claims.acnprovid, AcnPatID = claims.acnpatid, TinNum = claims.tinnum, Diag1 = claims.diag1, GroupNum = claims.GroupNum, AllowedTotal = claims.allowedtotal }).OrderBy(x => x.ClaimNum).OrderBy(x => x.AcnPatID).Distinct(); I'm using the list of constants above to make LinqToSql Generate IN ('xxx','xxx',etc) Otherwise it uses subqueries which are just as slow...

    Read the article

  • google search engine api not produce exact live search

    - by Bharanikumar
    Hi , The google search engine api not render the first result , Example, function google_search_api($args, $referer = 'http://localhost/test/', $endpoint = 'web'){ $url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint; if ( !array_key_exists('v', $args) ) $args['v'] = '1.0'; $url .= '?'.http_build_query($args, '', '&'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // note that the referer must be set curl_setopt($ch, CURLOPT_REFERER, $referer); $body = curl_exec($ch); curl_close($ch); //decode and return the response return json_decode($body); } $rez = google_search_api(array( 'q' = 'dl03', )); print_r($rez); the result for the above snippet little differ compare to live google search, the above snippet not render first result , that is in google live search first result not displaying the above snippet , AMy i know, what should i have to do now, Regards

    Read the article

  • CEIL is one too high for exact integer divisions

    - by Synetech
    This morning I lost a bunch of files, but because the volume they were one was both internally and externally defragmented, all of the information necessary for a 100% recovery is available; I just need to fill in the FAT where required. I wrote a program to do this and tested it on a copy of the FAT that I dumped to a file and it works perfectly except that for a few of the files (17 out of 526), the FAT chain is one single cluster too long, and thus cross-linked with the next file. Fortunately I know exactly what the problem is. I used ceil in my EOF calculation because even a single byte over will require a whole extra cluster: //Cluster is the starting cluster of the file //Size is the size (in bytes) of the file //BPC is the number of bytes per cluster //NumClust is the number of clusters in the file //EOF is the last cluster of the file’s FAT chain DWORD NumClust = ceil( (float)(Size / BPC) ) DWORD EOF = Cluster + NumClust; This algorithm works fine for everything except files whose size happens to be exactly a multiple of the cluster size, in which case they end up being one cluster too much. I thought about it for a while but am at a loss as to a way to do this. It seems like it should be simple but somehow it is surprisingly tricky. What formula would work for files of any size?

    Read the article

  • sql select with exact outcome

    - by Shiro
    Asking a simple question, just want everyone have fun to solve it. I got 2 tables. 1. Student 2. Course Student +----+--------+ | id | name | +----+--------+ | 1 | User1 | | 2 | User2 | +----+--------+ Course +----+------------+------------+ | id | student_id | course_name| +----+------------+------------+ | 1 | 1 | English | | 2 | 1 | Chinese | | 3 | 2 | English | | 4 | 2 | Japanese | +----+------------+------------+ I would like to get the result all student, who have taken English and Chinese, NOT English or Chinese. Expected result: +----+------------+------------+ | id | student_id | course_name| +----+------------+------------+ | 1 | 1 | English | | 2 | 1 | Chinese | +----+------------+------------+ What we normally do is select * from student join course on (student.id = course.student_id) WHERE course_name = 'English' OR course_name = 'Chinese' but in this result I can get User2 record which is not my expected result. I want the record only display the User take the course English+Chinese only.

    Read the article

  • what is the exact difference between PHP static class and singleton class

    - by Saif Bechan
    I have always used a Singleton class for a registry object in PHP. As all Singleton classes I think the main method looks like this: class registry { public static function singleton() { if( !isset( self::$instance ) ) { self::$instance = new registry(); } return self::$instance; } public function doSomething() { echo 'something'; } } So whenever I need something of the registry class I use a function like this: registry::singleton()->doSomethine(); Now I do not understand what the difference is between creating just a normal static function. Will it create a new object if I just use a normal static class. class registry { public static function doSomething() { echo 'something'; } } Now I can just use: registry::doSomethine(); Can someone explain to me what the function is of the singleton class. I really do not understand this.

    Read the article

  • WebClient.DownloadString() Not Producing Exact HTML

    - by Ryan Fuentes
    So here's the deal. I'm creating a spider bot for a website that scans all the product pages and records the product data. I'm using C# and the WebClient library to download the HTML string. The site I'm crawling must be specially made because the HTML that is received from WebClient.DownloadString() is different than the HTML that I get when I view the source of the HTML when visiting it on a browser. This seems intentional because the only info I can't get is the price. Does anyone know a workaround for this problem or can anyone explain what is happening? Thanks.

    Read the article

  • Find Exact difference between two dates

    - by iPhone Fun
    Hi all , I want some changes in the date comparison. In my application I am comparing two dates and getting difference as number of Days, but if there is only one day difference the system shows me 0 as a difference of days. I do use following code NSDateFormatter *date_formater=[[NSDateFormatter alloc]init]; [date_formater setDateFormat:@"MMM dd,YYYY"]; NSString *now=[NSString stringWithFormat:@"%@",[date_formater stringFromDate:[NSDate date]]]; LblTodayDate.text = [NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@",now]]; NSDate *dateofevent = [[NSUserDefaults standardUserDefaults] valueForKey:@"CeremonyDate_"]; NSDate *endDate =dateofevent; NSDate *startDate = [NSDate date]; gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; unsigned int unitFlags = NSDayCalendarUnit; NSDateComponents *components = [gregorian components:unitFlags fromDate:startDate toDate:endDate options:0]; int days = [components day]; I found some solutions that If we make the time as 00:00:00 for comparision then it will show me proper answer , I am right or wrong i don't know. Please help me to solve the issue

    Read the article

  • MySQL specifying exact order with WHERE `id` IN (...)

    - by Gray Fox
    Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause? Example: SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) to return Article with id = 4 Article with id = 2 Article with id = 5 Article with id = 9 Article with id = 3 and also SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) LIMIT 2,2 to return Article with id = 5 Article with id = 9

    Read the article

  • how do you find the exact variable of a null pointer exception

    - by OVERTONE
    I've been at this one for a bit now. I've got a null pointer exception so im guessing somethings not been initialized. AdminMessages.inbox1.setText(messageRsetArray[0]); thats my code where its targetting. but i cant find what inside it hasnt been initiazed. AdminMessages is a class which contains a JTextField called inbox1, messageRsetArray is an array which has taken variables from an array. also inbox1 is static. i coulndt get the getters and setter to work. i know its bad practice though.

    Read the article

  • Exact cin equivalent function in python

    - by gkt.pro
    Suppose user enter this string at terminal 123 456 456 //then hit enter How do I scan these three (could be more) numbers in different variables in python Could be something like this: for i in range(1,n) m[i]=#WHAT FUNCTION SHOULD I PUT HERE In c++ we can easily use cin>>m[i] inside above loop to scan the variables. If i use input() or raw_input() , they would scan whole line in single variable.

    Read the article

  • Return the exact ID using fetch_assoc

    - by Selom
    Hi, I have a small problem in my code and I need your help. Well Im using fetch_assoc to get data from database and I need to get the ID number of each of returned values. the issue is that my code only return the ID number of the last data. Here's my code: <form method="post" action="action.php"> <select name="album" style="border:1px solid #CCC; font-size:11px; padding:1px"> <?php $sql = "SELECT * FROM table"; $stmt = $dbh -> prepare($sql); $stmt -> execute(); while($row = $stmt -> fetch(PDO::FETCH_ASSOC)) { $album_ID = $row['album_ID']; $value = $row['album_name']; print "<option value ='". $value ."'>". $value. "</option>"; } ?> </select> <input type="hidden" name="album_ID" value="<?php print $album_ID?>"/> </form> I would like the hidden input type holds the selected album id, but it always holds the album id of the last data. Please help.

    Read the article

  • How to get the exact string within the brackets in mysql

    - by sreenath
    In my mysql table a field values are as follows: table name - "clients" field name - "accent" values are - "Eastern(Northern,Southern),Scottish(East Coast)" "Eastern(South,North,Southern),Scottish(East Coast)" If I give select accent from clients where accent like '%north%' if more than 100 records not in the same order. Strings with in the brackets are not in the same order means. It will give above two values. How should i get only second value? Please help me, thanks.

    Read the article

  • how to retain exact numbers that come from Access Database

    - by Shiny
    MY scenario is... I have 6,000 datas in Excel Sheet.. I try to import to Access Database.It enters the Database like this.. UNit Price 34512.00 Vat 4.00 BUt when i Retrieve to DataGridColumn it Shows vat Rate as 4(whole number).I accept zeros has no values..But I need that to be displayed in Grid as 4.0 . How to achieve this

    Read the article

  • Retrieve POST data without knowing exact number of fields

    - by James
    Hi all! I'm creating an online poll from scratch which will be held in a database. I'm working on getting a system set up so someone can create a new poll. I will be having the user fill out a simple HTML form with the Questions and Answers (there may be several answers). The user will be able to add multiple questions and multiple answers for each question. As the total number of questions and answers will be decided by the user, I need to create some clever PHP to cater for this - however many there are. When dealing with a static number of questions, it's simple. But I'm having trouble thinking of a way to get all the POST data into individual PHP variables so I can process them. I was thinking of using a foreach loop, anyone got any ideas? Sorry for the long winded description! If anyone needs anything clarified, I'd be happy to do so. My problem is that I can't get my head around how to deal with the POST values when I don't know exactly which element of the array will contain what. If things were static with a set number of questions and answers, I'd know $_POST[0] was Question1, etc Thank you! =)

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >