Search Results

Search found 2762 results on 111 pages for 'michael turner'.

Page 104/111 | < Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >

  • SQL Query - Count column values separately

    - by user575535
    I have a hard time getting a Query to work right. This is the DDL for my Tables CREATE TABLE Agency ( id SERIAL not null, city VARCHAR(200) not null, PRIMARY KEY(id) ); CREATE TABLE Customer ( id SERIAL not null, fullname VARCHAR(200) not null, status VARCHAR(15) not null CHECK(status IN ('new','regular','gold')), agencyID INTEGER not null REFERENCES Agency(id), PRIMARY KEY(id) ); Sample Data from the Tables AGENCY id|'city' 1 |'London' 2 |'Moscow' 3 |'Beijing' CUSTOMER id|'fullname' |'status' |agencyid 1 |'Michael Smith' |'new' |1 2 |'John Doe' |'regular'|1 3 |'Vlad Atanasov' |'new' |2 4 |'Vasili Karasev'|'regular'|2 5 |'Elena Miskova' |'gold' |2 6 |'Kim Yin Lu' |'new' |3 7 |'Hu Jintao' |'regular'|3 8 |'Wen Jiabao' |'regular'|3 I want to produce the following output, but i need to count separately for ('new','regular','gold') 'city' |new_customers|regular_customers|gold_customers 'Moscow' |1 |1 |1 'Beijing'|1 |2 |0 'London' |1 |1 |0

    Read the article

  • Fastest sort of fixed length 6 int array

    - by kriss
    Answering to another StackOverflow question (this one) I stumbled upon an interresting sub-problem. What is the fastest way to sort an array of 6 ints ? As the question is very low level (will be executed by a GPU): we can't assume libraries are available (and the call itself has it's cost), only plain C to avoid emptying instruction pipeline (that has a very high cost) we should probably minimize branches, jumps, and every other kind of control flow breaking (like those hidden behind sequence points in && or ||). room is constrained and minimizing registers and memory use is an issue, ideally in place sort is probably best. Really this question is a kind of Golf where the goal is not to minimize source length but execution speed. I call it 'Zening` code as used in the title of the book Zen of Code optimization by Michael Abrash and it's sequels.

    Read the article

  • My Android 2.1 Nexus One, rooted and unlocked and unplugged and unchained! Unfreakinbelievable!

    - by misbell
    So anyway. i fastbooted and superrooted, and all's fine in the merry old land of Oz. So yeah, now I can see /data/data.. in DDMS, both the plugin and the tool, which is great. but when I attach my phone, I still can't see the main drive. All I can see is the SD card. Using OSX, so when I use Disk Utility, I can see the machine then see the SD Card. is the problem that none of the tools I am using, except DDMS and ADB shell, know how to read that main Android drive? It's the same format as the qemu img, right? Someone HAS to come up with a tool that can do this, let me hack my phone and access the main drive via my USB connector, and mount that drive on my native file system. It just can NOT be that hard. Err, can it? All smiles! Michael

    Read the article

  • Python: Decent config file format

    - by miracle2k
    I'd like to use a configuration file format which supports key value pairs and nestable, repeatable structures, and which is as light on syntax as possible. I'm imagining something along the lines of: cachedir = /var/cache mail_to = [email protected] job { name = my-media frequency = 1 day source { from = /home/michael/Images source { } source { } } job { } I'd be happy with something using significant-whitespace as well. JSON requires too many explicit syntax rules (quoting, commas, etc.). YAML is actually pretty good, but would require the jobs to be defined as a YAML list, which I find slightly awkward to use.

    Read the article

  • Bad interpreter: No such file or directory

    - by user1497462
    I'm working through Michael Hartl's tutorial trying to learn Rails for the first time, and I've run into some issues. I recently reinstalled the whole Rails Installer because I had apparently inadvertently deleted some important files. Now, when I try running a test I get the following error: sh.exe": /c/Program Files (x86)/ruby-1.9.3/bin/bundle: "c:/Program: bad interpre ter: No such file or directory I checked my PATH and attempted to use the solution outlined here: Bundle command not found. Bad Interpreter ..but putting quotation marks around "C:\Program Files (x86)\ruby-1.9.3\bin" didn't do anything for me. I ran $ rails -v and got the following output: $ rails -v ?[31mCould not find multi_json-1.3.6 in any of the sources?[0m ?[33mRun `bundle install` to install missing gems.?[0m So then I tried running $bundle install and got the following issue again: Tom@TOM-PC /c/sample_app (updating-users) $ bundle install sh.exe": /c/Program Files (x86)/ruby-1.9.3/bin/bundle: "c:/Program: bad interpre ter: No such file or directory I'd really appreciate any help -- I've spent 5+ hours today trying to get back on track and am still at a loss. Thanks!

    Read the article

  • Debugging a release version of a DLL (with PDB file)

    - by Martin
    If I have a DLL (that was built in release-mode) and the corresponding PDB file, is it possible to debug (step-into) classes/methods contained in that DLL? If so, what are the required steps/configuration (e.g. where to put the PDB file)? Edit: If have the PDB file in the same place as the DLL (in the bin/debug directory of a simple console test application). I can see that the symbols for the DLL are loaded (in the Output window and also in the Modules window), but still I cannot step into the methods of that DLL. Could this be the result of compiler optimizations (as described by Michael in his answer)?

    Read the article

  • Search 2 Columns with 1 Input Field

    - by Norbert
    I have a db with two columns: first name and last name. The first name can have multiple words. Last name can contain hyphenated words. Is there a way to search both columns with only one input box? Database ID `First Name` `Last Name` 1 John Peter Doe 2 John Fubar 3 Michael Doe Search john peter returns id 1 john returns id 1,2 doe returns id 1,3 john doe returns id 1 peter john returns id 1 peter doe returns id 1 doe john returns id 1 I previously tried the following. Searching for John Doe: SELECT * FROM names WHERE ( `first` LIKE '%john%' OR `first` LIKE '%doe%' OR `last` LIKE '%john%' OR `last` LIKE '%doe%' ) which returns both 1 and 3

    Read the article

  • Generating unique N-valued key

    - by Bar
    Hi, StackOverflow! I want to generate unique random, N-valued key. This key can contain numbers and latin characters, i.e. A-Za-z0-9. The only solution I am thinking about is something like this (pseudocode): key = ""; smb = "ABC…abc…0123456789"; // allowed symbols for (i = 0; i < N; i++) { key += smb[rnd(0, smb.length() - 1)]; // select symbol at random position } Is there any better solution? What can you suggest? TIA, Michael.

    Read the article

  • Generic Method to find the tuples used for computation in Postgres?

    - by Rahul
    If I have a table col1 | name | pay ------+------------------+------ 1 | Steve Jobs | 1006 2 | Mike Markkula | 1007 3 | Mike Scott | 1978 4 | John Sculley | 1983 5 | Michael Spindler | 1653 The user executes a sum query which sums the pay of people getting paid more than $1500. Is there a way to also implicitly know which tuples have been used which satisfy the condition for sum ? I know you can separately write another query to just return the primary key ids which satisfy the condition. But, Is there any other way to do that in the same query ? probably rewrite the query in some way ? or... any suggestion ?

    Read the article

  • SQL Server: collect values in an aggregation temporarily and reuse in the same query

    - by Erwin Brandstetter
    How do I accumulate values in t-SQL? AFAIK there is no ARRAY type. I want to reuse the values like demonstrated in this PostgreSQL example using array_agg(). SELECT a[1] || a[i] AS foo ,a[2] || a[5] AS bar -- assuming we have >= 5 rows for simplicity FROM ( SELECT array_agg(text_col ORDER BY text_col) AS a ,count(*)::int4 AS i FROM tbl WHERE id between 10 AND 100 ) x How would I best solve this with t-SQL? Best I could come up with are two CTE and subselects: ;WITH x AS ( SELECT row_number() OVER (ORDER BY name) AS rn ,name AS a FROM #t WHERE id between 10 AND 100 ), i AS ( SELECT count(*) AS i FROM x ) SELECT (SELECT a FROM x WHERE rn = 1) + (SELECT a FROM x WHERE rn = i) AS foo ,(SELECT a FROM x WHERE rn = 2) + (SELECT a FROM x WHERE rn = 5) AS bar FROM i Test setup: CREATE TABLE #t( id INT PRIMARY KEY ,name NVARCHAR(100)) INSERT INTO #t VALUES (3 , 'John') ,(5 , 'Mary') ,(8 , 'Michael') ,(13, 'Steve') ,(21, 'Jack') ,(34, 'Pete') ,(57, 'Ami') ,(88, 'Bob') Is there a simpler way?

    Read the article

  • Git push origin master

    - by user306472
    I am new to git and recently set up a new account with github. I'm following a rails tutorial from Michael Hartl online ( http://www.railstutorial.org/book#fig:github_first_page ) and followed his instructions to set up my git which were also inline with the setup instructions at github. Anyways, the "Next Steps" section on github were: mkdir sample_app cd sample_app git init touch README git add README git commit -m 'first commit' git remote add origin [email protected]:rosdabos55/sample_app.git git push origin master I got all the way to the last instruction (git push origin master) without any problem. When I entered that last line into my terminal, however, I got this error message: "fatal: No path specified. See 'man git-pull' for valid url syntax." What might I be doing wrong?

    Read the article

  • Compile Error Using singleton - iPhone SDK

    - by mrburns05
    Since someone here is a bit hot-headed and deleted my last question ill post a new one with a title to better please his ego...Hows this Michael? Anyways, im getting this error when i compile: Undefined symbols: "_OBJC_CLASS_$_SortedItems", referenced from: __objc_classrefs__DATA@0 in SortedByNameTableDataSource.o ld: symbol(s) not found collect2: ld returned 1 exit status Basically i followed apples "TheElements" sample app to create the singleton, tableview datasource and just changed some stuff around to suit my needs - ive triple checked all my code and cannot figure out why im getting this.. If anyone can help please do, it would be much appreciated. if more of my code is needed ill post.. let me know

    Read the article

  • std::map default value for build-in type

    - by Qifa Zhao
    Recently, I was confused by the std::map operator[] function. In the MSDN library, it says: "If the argument key value is not found, then it is inserted along with the default value of the data type." I tryed to search much more exactly explanation for this issue. For example here: std::map default value In this page, Michael Anderson said that "the default value is constructed by the default constructor(zero parameter constructor)". Now my quest comes to this:"what the default value for the build-in type?". Was it compiler related? Or is there a standard for this issue by the c++ stardard committee? I did a test on visual studio 2008 for the "int" type, and found the "int" type is construted with the value 0.

    Read the article

  • Is it OK to open a DB4o file for query, insert, update multiple times?

    - by Khnle
    This is the way I am thinking of using DB4o. When I need to query, I would open the file, read and close: using (IObjectContainer db = Db4oFactory.OpenFile(Db4oFactory.NewConfiguration(), YapFileName)) { try { List<Pilot> pilots = db.Query<Pilot>().ToList<Pilot>(); } finally { try { db.Close(); } catch (Exception) { }; } } At some later time, when I need to insert, then using (IObjectContainer db = Db4oFactory.OpenFile(Db4oFactory.NewConfiguration(), YapFileName)) { try { Pilot pilot1 = new Pilot("Michael Schumacher", 100); db.Store(pilot1); } finally { try { db.Close(); } catch (Exception) { }; } } In this way, I thought I will keep the file more tidy by only having it open when needed, and have it closed most of the time. But I keep getting InvalidCastException Unable to cast object of type 'Db4objects.Db4o.Reflect.Generic.GenericObject' to type 'Pilot' What's the correct way to use DB4o?

    Read the article

  • Building XCode From Command Line Issues (Updating Entitlements file location)

    - by michaellindahl
    The first error is a warning for complier 'com.apple.compilers.gcc.4_0' I don't know if this is okay and I can just not worry about it. The second tells me that my entitlements file is no longer at that location. I know this and I thought I had correctly updated it in Xcode's info window. This project builds fine in Xcode. Michael-Lindahls-Mac:~ michaellindahl$ xcodebuild -project /Users/michaellindahl/Dropbox/Xcode/App/app.xcodeproj -alltargets 2011-01-03 11:41:51.591 xcodebuild[15162:60f] warning: compiler 'com.apple.compilers.gcc.4_0' is based on missing compiler 'com.apple.compilers.gcc.4_0' === BUILD NATIVE TARGET app OF PROJECT app WITH THE DEFAULT CONFIGURATION (Release) === Check dependencies [BEROR]CodeSign error: The entitlements file '/Users/michaellindahl/Dropbox/Xcode/deletedAppFile/Entitlements.plist' is missing ** BUILD FAILED **

    Read the article

  • Why doesn't ConcurrentQueue<T>.Count return 0 when IsEmpty == true?

    - by DanTup - Danny Tuppeny
    I was reading about the new concurrent collection classes in .NET 4 on James Michael Hare's blog, and the page talking about ConcurrentQueue<T> says: It’s still recommended, however, that for empty checks you call IsEmpty instead of comparing Count to zero. I'm curious - if there is a reason to use IsEmpty instead of comparing Count to 0, why does the class not internally check IsEmpty and return 0 before doing any of the expensive work to count? E.g.: public int Count { get { // Check IsEmpty so we can bail out quicker if (this.IsEmpty) return 0; // Rest of "expensive" counting code } } It seems strange to suggest this if it could be "fixed" so easily with no side-effects?

    Read the article

  • Using Ruby on Rails, can a polymorphic database be created in a few steps (with polymorphic associat

    - by Jian Lin
    I thought it could be created in a few steps but it can't yet: rails poly cd poly ruby script/generate scaffold animal name:string obj_type:string obj_id:integer rake:migrate ruby script/generate scaffold human name:string passportNumber:string rake:migrate ruby script/generate scaffold dog name:string registrationNumber:string rake:migrate and now change app/models/animal.rb to: class Animal < ActiveRecord::Base belongs_to :obj, :polymorphic => true end and run ruby script/server and go to http://localhost:3000 I thought on the server then if I create an Michael, Human, J123456 and then Woofie, Dog, L23456 then the database will have entries in the Dogs table and "Humen" or "Humans" table as well as in the Animals table? But only the Animals table has records, Dogs and "Humen" do not for some reason. Is there some steps missing?

    Read the article

  • C# 4.0 dynamics

    - by mehanik
    Hi. Code bellow is working well until I have class ClassSameAssembly in same assembly as class Program. But when I move class ClassSameAssembly to separate assembly I have runtime error. Is it posible to resolve it? using System; namespace ConsoleApplication2 { public static class ClassSameAssembly { public static dynamic GetValues() { return new { Name = "Michael", Age = 20 }; } } internal class Program { private static void Main(string[] args) { var d = ClassSameAssembly.GetValues(); Console.WriteLine("{0} is {1} years old", d.Name, d.Age); } } }

    Read the article

  • Reference book on Ruby on Rails social network site for novices

    - by Christopher
    Hey, so I am a novice programmer who has only worked with HTML, CSS, and a touch of Java a couple of years ago. I am looking to try to get a social network site up and running on Ruby on Rails and was looking at RailsSpace: Building a Social Networking Website with Ruby on Rails (Addison-Wesley Professional Ruby Series) - Paperback (July 30, 2007) by Michael Hartl. This was published in 2007, however, and the newer reviews say it is not very helpful. Does anyone know if there are any new publications out there that walk you through building a social network site while teaching you the code(rather than just using a out of the box program)? Thanks

    Read the article

  • How can I create numbered map markers in Google Maps V3?

    - by kaneuniversal
    I'm working on a map that has multiple markers on it. These markers use a custom icon, but I'd also like to add numbers on top. I've seen how this has been accomplished using older versions of the API. How can I do this in V3? *Note -- the "title" attribute creates a tooltip when you mouseover the marker, but I want something that will be layered on top of the custom image even when you're not hovering on top of it. Here's the documentation for the marker class, and none of these attributes seem to help: http://code.google.com/apis/maps/documentation/v3/reference.html#MarkerOptions Thank you . . . . Michael

    Read the article

  • Find the gender from a name

    - by Ramesh
    Hi guys, I recently confronted with a weird yet interesting question. The questions is as follows: Need to write a program which can give the gender as output based on the name. Example: INPUT -- John Michael Britney OUTPUT-- male male female So this is the output I expect. I tried a lot to solve, but I really was not able to crack it. I will be really thankful to this site for giving me an opportunity to share this question. Actually this is asked in a programming contest as a flyer problem, so I thought this can be programmed.

    Read the article

  • Adjust Title Helper in Ruby on Rails Tutorial 3.2 to deal with & properly

    - by memoht
    I am using the title helper from the 3.2 edition of the Ruby on Rails Tutorial by Michael Hartl and just realized a snag with the & character showing up in the title as &Amp instead. The relevant snippet of code is here Official Sample App 2nd Edition The problem. I have a School model and am using the School name on the Show view as follows: <% provide(:title, @school.name) %> If my School has a & in the name, it is being replaced with &Amp in the browser title. Ryan Bates Railscasts site has a similiar title helper that solves this issue this way but it is using content_for instead of provide. Trying to adjust the Rails Tutorial helper, but having trouble getting it work properly. Works great expect for this issue.

    Read the article

  • Facebook social reading plugin for Wordpress?

    - by Alexey
    As you know, a lot of bigger news websites have intorduced "social readers" for Facebook (e.g. https://apps.facebook.com/wpsocialreader/), which log what the user has read into the activity stream ("Michael read..."). Is it possible to integrate similar functionality into a Wordpress blog? Are the relevant API's open? Are there any plugins available? Thanks. UPD: http://trac.ahwebdev.fr/projects/facebook-awd The plugin seems to do the trick. Will have to try it out!

    Read the article

  • wp7 odata v2 dataservicestate save and restore methods tombstoning example needed

    - by MIantosca
    I am looking for an example of how to use the new DataServiceState Save and Restore methods in a WP7 application in order to tombstone a datacontext - I cannot find any examples and the approach I used resulted in an exception this saves the data context correctly PhoneApplicationService.Current.State["DataContext"] = DataServiceState.Save(this.Model.Entities); this attempts to restore it after the app is re-activated var dc = (PhoneApplicationService.Current.State["DataContext"] as DataServiceState).Restore(); but throws an exception An item could not be added to the collection. When items in a DataServiceCollection are tracked by the DataServiceContext, new items cannot be added before items have been loaded into the collection. This is the same exception I get if I try to reload a datacontext that I stored "directly" (without using the DataServiceState.Save method) in the PhoneApplicationService.Current.State. I cannot find any offical documentation on the new ODATA v2 DataServiceState class or examples. thanks Michael

    Read the article

  • How to batch retrieve documents with mongoDB?

    - by edude05
    Hello everyone, I have an application that queries data from a mongoDB using the mongoDB C# driver something like this: public void main() { foreach (int i in listOfKey) { list.add(getObjectfromDB(i); } } public myObject getObjFromDb(int primaryKey) { document query = new document(); query["primKey"] = primaryKey; document result= mongo["myDatabase"]["myCollection"].findOne(query); return parseObject(result); } On my local (development) machine to get 100 object this way takes less than a second. However, I recently moved the database to a server on the internet, and this query takes about 30 seconds to execute for the same number of object. Furthermore, looking at the mongoDB log, it seems to open about 8-10 connections to the DB to perform this query. So what I'd like to do is have the query the database for an array of primaryKeys and get them all back at once, then do the parsing in a loop afterwards, using one connection if possible. How could I optimize my query to do so? Thanks, --Michael

    Read the article

< Previous Page | 100 101 102 103 104 105 106 107 108 109 110 111  | Next Page >