Search Results

Search found 558 results on 23 pages for 'varying'.

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

  • Getting Image size of JPEG from its binary

    - by rajeshsr
    Hi I have a lot of jpeg files with varying image size. For instance, here is the first 640 bytes as given by hexdump of an image of size 256*384(pixels): 0000000: ffd8 ffe0 0010 4a46 4946 0001 0101 0048 ......JFIF.....H 0000010: 0048 0000 ffdb 0043 0003 0202 0302 0203 .H.....C........ 0000020: 0303 0304 0303 0405 0805 0504 0405 0a07 ................ 0000030: 0706 080c 0a0c 0c0b 0a0b 0b0d 0e12 100d ................ I guess the size information mus be within these lines. But am unable to see which bytes give the sizes correctly. Can anyone help me find the fields that contains the size information?

    Read the article

  • SQL for selecting only the last item from a versioned table

    - by Jeremy
    I have a table with the following structure: CREATE TABLE items ( id serial not null, title character varying(255), version_id integer DEFAULT 1, parent_id integer, CONSTRAINT items_pkey PRIMARY KEY (id) ) So the table contains rows that looks as so: id: 1, title: "Version 1", version_id: 1, parent_id: 1 id: 2, title: "Version 2", version_id: 2, parent_id: 1 id: 3, title: "Completely different record", version_id: 1, parent_id: 3 This is the SQL code I've got for selecting out all of the records with the most recent version ids: select * from items inner join ( select parent_id, max(version_id) as version_id from items group by parent_id) as vi on items.version_id = vi.version_id and items.parent_id = vi.parent_id Is there a way to write that SQL statement so that it doesn't use a subselect?

    Read the article

  • Image processing in a multhithreaded mode using Java

    - by jadaaih
    Hi Folks, I am supposed to process images in a multithreaded mode using Java. I may having varying number of images where as my number of threads are fixed. I have to process all the images using the fixed set of threads. I am just stuck up on how to do it, I had a look ThreadExecutor and BlockingQueues etc...I am still not clear. What I am doing is, - Get the images and add them in a LinkedBlockingQueue which has runnable code of the image processor. - Create a threadpoolexecutor for which one of the arguements is the LinkedBlockingQueue earlier. - Iterate through a for loop till the queue size and do a threadpoolexecutor.execute(linkedblockingqueue.poll). - all i see is it processes only 100 images which is the minimum thread size passed in LinkedBlockingQueue size. I see I am seriously wrong in my understanding somewhere, how do I process all the images in sets of 100(threads) until they are all done? Any examples or psuedocodes would be highly helpful Thanks! J

    Read the article

  • Counting multiple entries in a MySQL database?

    - by Aaron
    Hi all, I'm trying to count multiple entries in a MySQL database, I know how to use COUNT(), but the exact syntax I want to get the results I need eludes me. The problem: Table structure: ID, CODE, AUTHOR, COUNTRY, TIMESTAMP. Code, Author and Country overlap many times in the table. I am trying to discover if there is one simple query that can be ran to return (using WHERE clause on COUNTRY) the author field, the code field, and then a final field that counts the number of times the CODE was present in the query result. So, theoretically I could end up with an array like: array('author', 'code', 'codeAppearsNTimes'); Authors also have varying codes associated with them, so I don't want the results merged. I suppose the end result would be: 'This author is associated with this code this many times'. Is this possible with MySQL? Thanks in advance.

    Read the article

  • simple regex to splice out text in ruby

    - by user141146
    I'm using ruby and I want to splice out a piece of a string that matches a regex (I think this is relatively easy, but I'm having difficulty) I have several thousand strings that look like this (to varying degrees) my_string = "adfa <b>weru</b> orua fklajdfqwieru ofaslkdfj alrjeowur woer woeriuwe <img src=\"/images/abcde_111-222-333/111-222-333.xml/blahblahblah.jpg\" />" I would like to splice out the /111-222-333.xml (the value of this changes from string to string, but suffice it to say is that I want to remove the piece between 2 forward slashes that contains something.xml. my hope was to find a match like this my_match = my_string.match(/\/.+?\.xml\//) but this actually captures "/b> orua fklajdfqwieru ofaslkdfj alrjeowur woer woeriuwe <img src=\"/images/abcde_111-222-333/111-222-333.xml/" I assumed that .+? would match what I am looking for, but it seems like it starts with the first forward slash that it finds (even though it's non-greedy) and then expands forward to the ".xml"). Any thoughts on what I'm doing wrong? TKS!!

    Read the article

  • Replace into equivalent for postgresql and then autoincrementing an int

    - by Mohamed Ikal Al-Jabir
    Okay no seriously, if a postgresql guru can help out I'm just getting started. Basically what I want is a simple table like such: CREATE TABLE schema.searches ( search_id serial NOT NULL, search_query character varying(255), search_count integer DEFAULT 1, CONSTRAINT pkey_search_id PRIMARY KEY (search_id) ) WITH ( OIDS=FALSE ); I need something like REPLACE INTO for mysql. I don't know if I have to write my own procedure or something? Basically: check if the query already exists if so, just add 1 to the count it not, add it to the db I can do this in my php code but I'd rather all that be done in postgres C engine Thanks for helping

    Read the article

  • Integration Testing an Entire *Existing* Application (w/ automatic execution of test suite)

    - by Ev
    Hi there, I have just joined a team working on an existing Java web app. I have been tasked with creating an automated integration test suite that should run when developers commit to our continuous integration server (TeamCity), which automatically deploys to our staging server - so really the tests will be run against our staging web app server. I have read a lot of stuff about automated integration testing with frameworks like Watir, Selenium and RWebSpec. I have created tests in all of these and while I prefer Watir, I am open to anything. The thing that hasn't become clear to me is how to create an entire test suite for an application, and how to have that suite execute in it's entirety upon execution of some script. I can happily create individual tests of varying complexity, but there is a gap in my knowledge about how to tie everything together into something useful. Does anyone have any advice on how to create a full test suite and have it execute automatically? Thanks!

    Read the article

  • Animation with Initial Velocity

    - by abustin
    I've been trying to solve this problem for a number of days now but I must be missing something. Known Variables: vi = Initial Velocity t = Animation Duration d = Distance The function I'm trying to create: D(t) = the current distance for a given time Using this information I want to be able to create a smooth animation curve with varying velocity (ease-in/ease-out). The animation must be able ease-in from an initial velocity. The animation must be exactly t seconds and must be travel exactly d units. The curve should lean towards the average velocity with acceleration occurring at the beginning and the end portions of the curve. I'm open to extra configuration variables. The best I've been able to come up with is something that doesn't factor in the initial velocity. I'm hoping someone smarter can help me out. ;) Thank you! p.s. I'm working with an ECMAScript variant

    Read the article

  • BULK INSERT with inconsitant number of columns

    - by aceinthehole
    I am trying to load a large amount data in SQL server from a flat file using BULK INSERT. However, my file has varying number of column, for instance the first row contains 14 and the second contains 4. That is OK, I just want to make a table with the max number of columns and load the file into it with nulls for the missing columns. I can play with it from that point. But it seems that SQL Server when reaching the end of the line and having more columns to fill for that same row in the destination table, just moves on to the next line and attempts to put the data on that line to the wrong column of the table. Is there a way to get the behavior that I am looking for? Is there a table hint that I can use the specify this? Has anyone run into this before? Here is the code BULK INSERT #t FROM '<path to file>' WITH ( DATAFILETYPE = 'char', KEEPNULLS, FIELDTERMINATOR = '#' )

    Read the article

  • Postgres column casting...

    - by Simon
    I have a query SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = 7 which doesn't work and throws ERROR: operator does not exist: character varying = integer LINE 4: FROM sq_ast WHERE assetid = 7 I can get it to work by doing SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = '7' Please note the quoting of the 7 in the WHERE clause... I am deploying an huge application and I cannot rewrite the core... similarly I don't want to risk changing the type of the column... I'm no Postgres expert... please help... Is there an option for strict casting of columns???

    Read the article

  • Variable height UIViews and labels

    - by Bob Spryn
    Ok so I'm not in a table cell at this point. (I've seen a lot of threads regarding the height of cells.) I have a detail view with a title and description at the top of the view, followed by a tableView below it. If the description is going to vary in length, how do I get the tableView to adjust with it accordingly so it always starts directly below it? I see apple doing this in the app store application. If you look at an application description (as if you were going to buy it), they have an application description, and wherever that ends a scrolling pane of screenshots follow. How do they do the varying height on the text description like that? Are they doing this all programmatically or can I use the layout controls in IB to do the same thing?

    Read the article

  • Flex - How do I get the absolute X and Y coordinate including HTML offset?

    - by Mauricio
    Hey everyone, I am calling a JS function through the ExternalInterface using Flex which requires the absolute X and Y coordinates to create a pop-up menu. The Flex application is displayed on the center of an HTML page, therefore there is an HTML X and Y offset to consider. I have tried using the LocalToGlobal and ContentToGlobal functions, but these are just giving me the X and Y coordinates relative to the Flex application, it is not considering the HTML X and Y offset of having the Flex app in the center of the page or varying different screen resolutions. Is the best approach to retrieve the HTML X and Y offset using JavaScript? Is there a Flex function I can use that provides the absolute X and Y coordinates based on the HTML page? Thanks!

    Read the article

  • Python -- what is NOT in 2.7 that IS in 3.1? So many things have been back-ported, what is NOT?

    - by StuFuller
    I've been following the saga of Python 3.x and have watched the 3.x features gradually getting back-ported to the 2.x line. Most of the libraries I use haven't been ported and some (e.g. Twisted) seem covertly or overtly hostile to 3.x to varying degrees. At any rate, there has been very little movement towards compatible versions of many of them. Expecially the larger ones. So, my question is, with all the features that have been backported, what is still available in 3.x that's NOT been back-ported? It's pretty easy to find what has been backported, but not what's left. Right now, porting to 3.x just seems like all pain, and I can't see the gain; maybe an "Only in 3.x" list would let me see the light... Thanks, Stu

    Read the article

  • Perl, efficient parsing of csv file

    - by Mike
    I'm working on a project that involves parsing a large csv formatted file in Perl and am looking to make things more efficient. My approach has been to split() the file by lines first, and then split() each line again by commas to get the fields. But this suboptimal since at least two passes on the data are required. (once to split by lines, then once again for each line). This is a very large file, so cutting processing in half would be a significant improvement to the entire application. My question is, what is the most time efficient means of parsing a large CSV file using only built in tools? note: Each line has a varying number of tokens, so we can't just ignore lines and split by commas only. Also we can assume fields will contain only alphanumeric ascii data (no special characters or other tricks). Also, i don't want to get into parallel processing, although that might work effectively.

    Read the article

  • Placement of defensive structures in a game

    - by Martin
    I am working on an AI bot for the game Defcon. The game has cities, with varying populations, and defensive structures with limited range. I'm trying to work out a good algorithm for placing defence towers. Cities with higher populations are more important to defend Losing a defence tower is a blow, so towers should be placed reasonably close together Towers and cities can only be placed on land So, with these three rules, we see that the best kind of placement is towers being placed in a ring around the largest population areas (although I don't want an algorithm just to blindly place a ring around the highest area of population, sometime there might be 2 sets of cities far apart, in which case the algorithm should make 2 circles, each one half my total towers). I'm wondering what kind of algorithms might be used for determining placement of towers?

    Read the article

  • Better algorithm for estimating download time

    - by Scott Smith
    We've all seen the download time running estimate that initially says something like "7 days", but keeps dropping wildly (e.g. "23 hours", "45 minutes", "1 min. 50 sec", etc) with each successive estimation as the chunks are downloaded. To avoid these initial (alarming) estimates, there are techniques one could try like suppressing display of the first n estimates, or waiting for the delta between estimates to drop below some threshold before you start displaying them, but these don't seem like a general, robust solution. There are corner cases involving too few samples, or samples that actually are wildly varying... I think I recall a general solution for this kind of thing in mathematics (statistics?) that reduced or eliminated these wild values. Does anyone know?

    Read the article

  • PostgreSQL - best way to return an array of key-value pairs

    - by Matt W
    I'm trying to select a number of fields, one of which needs to be an array with each element of the array containing two values. Each array item needs to contain a name (character varying) and an ID (numeric). I know how to return an array of single values (using the ARRAY keyword) but I'm unsure of how to return an array of an object which in itself contains two values. The query is something like SELECT t.field1, t.field2, ARRAY(--with each element containing two values i.e. {'TheName', 1 }) FROM MyTable t I read that one way to do this is by selecting the values into a type and then creating an array of that type. Problem is, the rest of the function is already returning a type (which means I would then have nested types - is that OK? If so, how would you read this data back in application code - i.e. with a .Net data provider like NPGSQL?) Any help is much appreciated.

    Read the article

  • Is there an application I can show a client the speed of their site via differring internet connecti

    - by Slimpickens
    I have a new client with an old website using massive amounts of tables and inline styles. Some page weigh over 3MB due to huge backgrounds and other large images. I suggested they at least compress the files to speed up the site but they're convinced it's fast. Since they have 13Mbit connection at the office everything seems fast. I'm looking for a tweak, program or web app capable of loading pages at varying speeds so they understand how it might load for slower DSL or (gasp) dialup users. Thanks for any help!

    Read the article

  • Improve a haskell script

    - by Hector Villalobos
    I'm a newbie in Haskell and I'd like some opinions about improving this script. This is a code generator and requires a command line argument to generate the sql script. ./GenCode "people name:string age:integer" Code: import Data.List import System.Environment (getArgs) create_table :: String -> String create_table str = "CREATE TABLE " ++ h (words str) where h (x:xs) = let cab = x final = xs in x ++ "( " ++ create_fields xs ++ ")" create_fields (x:xs) = takeWhile (/=':') x ++ type x ++ sig where sig | length xs > 0 = "," ++ create_fields xs | otherwise = " " ++ create_fields xs create_fields [] = "" type x | isInfixOf "string" x = " CHARACTER VARYING" | isInfixOf "integer" x = " INTEGER" | isInfixOf "date" x = " DATE" | isInfixOf "serial" x = " SERIAL" | otherwise = "" main = mainWith where mainWith = do args <- getArgs case args of [] -> putStrLn $ "You need one argument" (x:xs) -> putStrLn $ (create_table x)

    Read the article

  • SQL Server 2008 - Search Query

    - by user208662
    Hello, I am not a SQL Expert. I’m trying to elegantly solve a query problem that others have had to have had. Surprisingly, Google is not returning anything that is helping. Basically, my application has a “search” box. This search field will allow a user to search for customers in the system. I have a table called “Customer” in my SQL Server 2008 database. This table is defined as follows: Customer UserName (nvarchar) FirstName (nvarchar) LastName (nvarchar) As you can imagine, my users will enter queries of varying cases and probably mis-spell the customer’s names regularly. How do I query my customer table and return the 25 results that are closest to their query? I have no idea how to do this ranking and consider the three fields listed in my table. Thank you!

    Read the article

  • Formula for producing a CGRect for a UIScrollView, that displays a UIImage in scaled to fit way

    - by RickiG
    Hi I am loading in images with varying sizes and putting them in UIScrollViews, all the images are larger than the UIScrollView. The user can scroll and zoom as they please, but initially I would like for the image to be centered and scaled so the largest side of the image aligns with the edge of the scrollView, i.e. if the picture is in landscape I would like to size and scale it so that the left and right side goes all the way to the edge of the UIScrollVIew and vice versa I found a formula in a utility function in the Programming guide but it does not quite fit my needs. My approach is to use: CGrect initialPos = ? [self.scrollView zoomToRect:initialPos animated:YES]; I know the size of my scrollView and the size of my image, what I need to figure out is the scale and CGRect to apply to the scrollView to center and size my image. Hope someone can help out:) Thanks

    Read the article

  • Is Work Stealing always the most appropriate user-level thread scheduling algorithm?

    - by Il-Bhima
    I've been investigating different scheduling algorithms for a thread pool I am implementing. Due to the nature of the problem I am solving I can assume that the tasks being run in parallel are independent and do not spawn any new tasks. The tasks can be of varying sizes. I went immediately for the most popular scheduling algorithm "work stealing" using lock-free deques for the local job queues, and I am relatively happy with this approach. However I'm wondering whether there are any common cases where work-stealing is not the best approach. For this particular problem I have a good estimate of the size of each individual task. Work-stealing does not make use of this information and I'm wondering if there is any scheduler which will give better load-balancing than work-stealing with this information (obviously with the same efficiency). NB. This question ties up with a previous question.

    Read the article

  • Programming with midi, and tuning notes to specific frequencies

    - by froggie0106
    I am working on a project in which I need to be able to generate midi notes of varying frequencies with as much accuracy as possible. I originally tried to write my program in Java, but it turns out that the sound.midi package does not support changing the tunings of notes unless the frequencies are Equal Tempered frequencies (or at least it didn't in 1.4, and I haven't been able to find evidence that this has been fixed in recent versions). I have been trying to find a more appropriate language/library to accomplish this task, but since this is my first time programming with MIDI and my need for specific tuning functionality is essential, I have been having considerable trouble finding exactly what I need. I am looking for advice from people who have experience writing MIDI programs as to what languages are useful, especially for tuning notes to specific frequencies. Any links to websites with API docs and example code would also be extremely helpful.

    Read the article

  • Is there a high-level gestures library for iPhone development?

    - by n8gray
    The iPhone platform has a number of common gesture idioms. For example, there are taps, pinches, and swipes, each with varying number of fingers. But when you're developing an app, it's up to you to implement these things based on low-level information about the number and locations of touches. It seems like this is a prime candidate for a library. You would register a delegate, set some parameters like multi-tap interval and swipe threshold, and get calls like swipeStarted/Ended, pinchStarted/Ended, multiTap, etc. Does such a library exist?

    Read the article

  • Rails: Converting from MySQL to PostGres breaks Geokit Distance Calculations???

    - by Kevin
    I recently switched my database from MySQL to PostGres. I also use GeoKit. When I started my app up with the new database already seeded, I get the following error: PGError: ERROR: function radians(character varying) does not exist LINE 1: ...COS(0.661045389762993)*COS(-2.12957994527573)*COS(RADIANS(ti... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Anyone know why this is breaking now? I know GeoKit still works because it's still performing the geocoding in the model per ticket when the database is seeded, it just won't do the distance calculations correctly.

    Read the article

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