Search Results

Search found 193 results on 8 pages for 'twos complement'.

Page 2/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • How to use a TFileStream to read 2D matrices into dynamic array?

    - by Robert Frank
    I need to read a large (2000x2000) matrix of binary data from a file into a dynamic array with Delphi 2010. I don't know the dimensions until run-time. I've never read raw data like this, and don't know IEEE so I'm posting this to see if I'm on track. I plan to use a TFileStream to read one row at a time. I need to be able to read as many of these formats as possible: 16-bit two's complement binary integer 32-bit two's complement binary integer 64-bit two's complement binary integer IEEE single precision floating-point For 32-bit two's complement, I'm thinking something like the code below. Changing to Int64 and Int16 should be straight forward. How can I read the IEEE? Am I on the right track? Any suggestions on this code, or how to elegantly extend it for all 4 data types above? Since my post-processing will be the same after reading this data, I guess I'll have to copy the matrix into a common format when done. I have no problem just having four procedures (one for each data type) like the one below, but perhaps there's an elegant way to use RTTI or buffers and then move()'s so that the same code works for all 4 datatypes? Thanks! type TRowData = array of Int32; procedure ReadMatrix; var Matrix: array of TRowData; NumberOfRows: Cardinal; NumberOfCols: Cardinal; CurRow: Integer; begin NumberOfRows := 20; // not known until run time NumberOfCols := 100; // not known until run time SetLength(Matrix, NumberOfRows); for CurRow := 0 to NumberOfRows do begin SetLength(Matrix[CurRow], NumberOfCols); FileStream.ReadBuffer(Matrix[CurRow], NumberOfCols * SizeOf(Int32)) ); end; end;

    Read the article

  • Python structure mistake

    - by jaddy123
    I'm writing a program in which I can Reverse the sequence and Replace all As with Ts, all Cs with Gs, all Gs with Cs, and all Ts with As. the program is to read a sequence of bases and output the reverse complement sequence. I am having trouble to do it so can anyone please help me with this by having a look on my code: word = raw_input("Enter sequence: ") a = word.replace('A', 'T') b = word.replace('C', 'G') c = word.replace('G', 'C') d = word.replace('T', 'A') if a == word and b == word and c == word and d == word: print "Reverse complement sequence: ", word And I want this sort of output: Enter sequence: CGGTGATGCAAGG Reverse complement sequence: CCTTGCATCACCG Regards

    Read the article

  • What undergraduate course to choose for a mature programmer returning to study

    - by Dve
    I have been developing applications (mostly web-based) for almost 10 years now and have learnt pretty much everything I know through experience (and the internet!). I wouldn't call myself an advanced programmer, but I am quite proficient in several languages (C#, Javascript, Ruby, HTML/CSS etc) and spend a quite a bit of time working on personal projects and reading countless books & articles. I am looking to emigrate to Canada, hopefully Vancouver (im from the UK) and one way would be on a student visa, if I was going to be studying for a minimum of 2 years. Having never been to university or achieved anything higher than A-Levels I am quite tempted by this path. The thought of learning is more exciting to me now than it was 10 years ago! What would be people recommend as a good undergraduate course to take that would complement this career path? Would Math be beneficial, if so which area of Math? TL;DR What undergraduate course/area of study would complement 10 years of (mostly web-based) programming experience?

    Read the article

  • booth multiplication algorithm

    - by grassPro
    Is booth algorithm for multiplication only for multiplying 2 negative numbers (-3 * -4) or one positive and one negative number (-3 * 4) ? Whenever i multiply 2 positive numbers using booth algorithm i get a wrong result. example : 5 * 4 A = 101 000 0 // binary of 5 is 101 S = 011 000 0 // 2's complement of 5 is 011 P = 000 100 0 // binary of 4 is 100 x = 3 y = 3 m = 5 -m = 2's complement of m r = 4 After right shift of P by 1 bit 0 000 100 After right shift of P by 1 bit 0 000 010 P+S = 011 001 0 After right shift by 1 bit 0 011 001 Discarding the LSB 001100 But that comes out to be the binary of 12 . It should have been 20(010100)

    Read the article

  • Bitwise Operations -- Arithmetic Operations..

    - by RBA
    Hi, Can you please explain the below lines, with some good examples. A left arithmetic shift by n is equivalent to multiplying by 2n (provided the value does not overflow), while a right arithmetic shift by n of a two's complement value is equivalent to dividing by 2n(2 to the power n) and rounding toward negative infinity. If the binary number is treated as ones' complement, then the same right-shift operation results in division by 2n and rounding toward zero. Thankx..

    Read the article

  • How to convert Big Endian and how to flip the highest bit?

    - by Robert Frank
    I am using a TStream to read binary data (thanks to this post: http://stackoverflow.com/questions/2878180/how-to-use-a-tfilestream-to-read-2d-matrices-into-dynamic-array). My next problem is that the data is Big Endian. From my reading, the Swap() method is seemingly deprecated. How would I swap the types below? 16-bit two's complement binary integer 32-bit two's complement binary integer 64-bit two's complement binary integer IEEE single precision floating-point - Are IEEE affected by Big Endian? And, finally, since the data is unsigned, the creators of this dataset have stored the unsigned values as signed integers (excluding the IEEE). They instruct that one need only add an offset (2^15, 2^31, and 2^63) to recover the unsigned data. But, they note that flipping the most significant bit is the fastest way to do that. How does one efficiently flip the most significant bit of a 16, 32, or 64-bit integer? So, if the data on disk (16-bit) is "85 FB" - the desired result after reading the data and swapping and bit flipping would be 1531. Is there a way to accomplish the swapping and bit flipping with generics so it fits into the generic answer at the link above? Yes, kids, THIS is how scientific astronomical data is stored by NASA, ESO, and all professional astronomers. This FITS standard is considered by some to be one of the most successful standards ever created in its proliferation and flexibility!

    Read the article

  • Is it possible to implement bitwise operators using integer arithmetic?

    - by Statement
    Hello World! I am facing a rather peculiar problem. I am working on a compiler for an architecture that doesn't support bitwise operations. However, it handles signed 16 bit integer arithmetics and I was wondering if it would be possible to implement bitwise operations using only: Addition (c = a + b) Subtraction (c = a - b) Division (c = a / b) Multiplication (c = a * b) Modulus (c = a % b) Minimum (c = min(a, b)) Maximum (c = max(a, b)) Comparisons (c = (a < b), c = (a == b), c = (a <= b), et.c.) Jumps (goto, for, et.c.) The bitwise operations I want to be able to support are: Or (c = a | b) And (c = a & b) Xor (c = a ^ b) Left Shift (c = a << b) Right Shift (c = a b) (All integers are signed so this is a problem) Signed Shift (c = a b) One's Complement (a = ~b) (Already found a solution, see below) Normally the problem is the other way around; how to achieve arithmetic optimizations using bitwise hacks. However not in this case. Writable memory is very scarce on this architecture, hence the need for bitwise operations. The bitwise functions themselves should not use a lot of temporary variables. However, constant read-only data & instruction memory is abundant. A side note here also is that jumps and branches are not expensive and all data is readily cached. Jumps cost half the cycles as arithmetic (including load/store) instructions do. On other words, all of the above supported functions cost twice the cycles of a single jump. Some thoughts that might help: I figured out that you can do one's complement (negate bits) with the following code: // Bitwise one's complement b = ~a; // Arithmetic one's complement b = -1 - a; I also remember the old shift hack when dividing with a power of two so the bitwise shift can be expressed as: // Bitwise left shift b = a << 4; // Arithmetic left shift b = a * 16; // 2^4 = 16 // Signed right shift b = a >>> 4; // Arithmetic right shift b = a / 16; For the rest of the bitwise operations I am slightly clueless. I wish the architects of this architecture would have supplied bit-operations. I would also like to know if there is a fast/easy way of computing the power of two (for shift operations) without using a memory data table. A naive solution would be to jump into a field of multiplications: b = 1; switch (a) { case 15: b = b * 2; case 14: b = b * 2; // ... exploting fallthrough (instruction memory is magnitudes larger) case 2: b = b * 2; case 1: b = b * 2; } Or a Set & Jump approach: switch (a) { case 15: b = 32768; break; case 14: b = 16384; break; // ... exploiting the fact that a jump is faster than one additional mul // at the cost of doubling the instruction memory footprint. case 2: b = 4; break; case 1: b = 2; break; }

    Read the article

  • SQLAuthority News – Best Complements – DBA Survivor: Become a Rock Star DBA

    - by pinaldave
    Today’s blog post is about the biggest complement I have ever received. I am very very happy and would like to share my feelings with you. Thomas Larock (Blog | Twitter) (known as SQLRockstar) keeps the excellent ranking of the blogger in SQL Server Arena. I am big fan of this list and have been referring lots of people. I was in the msdb database since the very first day of the ranking. Two days ago, I noticed that I am promoted to Model Database. I often receive complements about my blog but this is the biggest complement I have ever received. I have taken the snapshot of the same and listed here. Thomas is a SQL Server MVP and Board of Directors for the Professional Association for SQL Server. He is the author of DBA Survivor: Become a Rock Star DBA. The book is designed to give a junior to mid-level DBA a better understanding of what skills are needed in order to survive (and thrive) in their career. This book is currently not available in India, I am waiting for someone traveling from USA to bring the copy for me. I am very eager to read the book and promise to share the book review with all of you once I am done reading. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, SQLServer, T SQL, Technology

    Read the article

  • SQLAuthority News Best Complements DBA Survivor: Become a Rock Star DBA

    Today’s blog post is about the biggest complement I have ever received. I am very very happy and would like to share my feelings with you.Thomas Larock (Blog | Twitter) (known as SQLRockstar) keeps the excellent ranking of the blogger in SQL Server Arena. I am big fan of this list and have been referring [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • « On parcourt le journal sur l'iPad, on le lit sur le papier » : êtes-vous d'accord avec cette étude de Miratech ?

    Suite à sa précédente étude : La lecture sur un iPad est plus superficielle que sur un journal, Miratech vous propose un complément sur la qualité comparée de lecture sur un iPad ou un support papier : On parcourt le journal sur l'iPad, on le lit sur le papier.. Que pensez-vous des résultats de cette étude ? Si vous êtes adepte de l'iPad, avez-vous constaté des différences dans vos habitudes de lecture en...

    Read the article

  • What is better Ubuntu Tweak or Software center?

    - by S B
    Ubuntu Tweak has served me very well over the past few release cycles, but there seems to be more and more of an overlap between Ubuntu Tweak and the Ubuntu Software Center. I wanted to know whether these two great apps are headed for a head-to-head crash (which would be a shame for the Ubuntu community) or is there some way for the two projects to complement each other, integrate and make my favorite distribution even better? Happy new year to everyone.

    Read the article

  • Analysis Services Tabular books #ssas #tabular

    - by Marco Russo (SQLBI)
    Many people are looking for books about Analysis Services Tabular. Today there are two books available and they complement each other: Microsoft SQL Server 2012 Analysis Services: The BISM Tabular Model by Marco Russo, Alberto Ferrari and Chris Webb Applied Microsoft SQL Server 2012 Analysis Services: Tabular Modeling by Teo Lachev The book I wrote with Alberto and Chris is a complete guide to create tabular models and has a good coverage about DAX, including how to use it for enriching a semantic model with calculated columns and measures and how to use it for querying a Tabular model. In my experience, DAX as a query language is a very interesting option for custom analytical applications that requires a fast calculation engine, or simply for standard reports running in Reporting Services and accessing a Tabular model. You can freely preview the table of content and read some excerpts from the book on Safari Books Online. The book is in printing and should be shipped within mid-July, so finally it will be very soon on the shelf of all the people already preordered it! The Teo Lachev’s book, covers the full spectrum of Tabular models provided by Microsoft: starting with self-service BI, you have users creating a model with PowerPivot for Excel, publishing it to PowerPivot for SharePoint and exploring data by using Power View; then, the PowerPivot for Excel model can be imported in a Tabular model and published in Analysis Services, adding more control on the model through row-level security and partitioning, for example. Teo’s book follows a step-by-step approach describing each feature that is very good for a beginner that is new to PowerPivot and/or to BISM Tabular. If you need to get the big picture and to start using the products that are part of the new Microsoft wave of BI products, the Teo’s book is for you. After you read the book from Teo, or if you already have a certain confidence with PowerPivot or BISM Tabular and you want to go deeper about internals, best practices, design patterns in just BISM Tabular, then our book is a suggested read: it contains several chapters about DAX, includes discussions about new opportunities in data model design offered by Tabular models, and also provides examples of optimizations you can obtain in DAX and best practices in data modeling and queries. It might seem strange that an author write a review of a book that might seem to compete with his one, but in reality these two books complement each other and are not alternatives. If you have any doubt, buy both: you will be not disappointed! Moreover, Amazon usually offers you a deal to buy three books, including the Visualizing Data with Microsoft Power View, another good choice for getting all the details about Power View.

    Read the article

  • What is better Ubuntu Tweak or Ubuntu Software center?

    - by S B
    Ubuntu Tweak has served me very well over the past few release cycles, but there seems to be more and more of an overlap between Ubuntu Tweak and the Ubuntu Software Center. I wanted to know whether these two great apps are headed for a head-to-head crash (which would be a shame for the Ubuntu community) or is there some way for the two projects to complement each other, integrate and make my favorite distribution even better? Happy new year to everyone.

    Read the article

  • Successful SEO Planning

    When people think of items that go hand-in-hand, they think about peanut butter and jelly; or eggs and bacon. On a more serious note, web design and SEO are the perfect complement to each other. Without one, you can not have the other.

    Read the article

  • Recorded Webcast Available: Extend SCOM to Optimize SQL Server Performance Management

    - by KKline
    Join me and Eric Brown, Quest Software senior product manager for SQL Server monitoring tools, as we discuss the server health-check capabilities of Systems Center Operations Manager (SCOM) in this previously recorded webcast. We delve into techniques to maximize your SCOM investment as well as ways to complement it with deeper monitoring and diagnostics. You’ll walk away from this educational session with the skills to: Take full advantage of SCOM’s value for day-to-day SQL Server monitoring Extend...(read more)

    Read the article

  • SQL Saturday #157 - San Diego

    Southern California isn't all beach time. SQL Saturday comes to San Diego on Sept 15, 2012. Join fellow SQL Server pros for a day of learning. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL in the City - Austin 2012

    A free day of training in Austin, TX with Grant Fritchey, Steve Jones and a few others. Join us to learn about SQL Server and how you can more efficiently work in your job every day. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • Recorded Webcast Available: Extend SCOM to Optimize SQL Server Performance Management

    - by KKline
    Join me and Eric Brown, Quest Software senior product manager for SQL Server monitoring tools, as we discuss the server health-check capabilities of Systems Center Operations Manager (SCOM) in this previously recorded webcast. We delve into techniques to maximize your SCOM investment as well as ways to complement it with deeper monitoring and diagnostics. You’ll walk away from this educational session with the skills to: Take full advantage of SCOM’s value for day-to-day SQL Server monitoring Extend...(read more)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >