Search Results

Search found 2682 results on 108 pages for 'michael mao'.

Page 93/108 | < Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >

  • JUnit - assertSame

    - by Michael
    Can someone tell me why assertSame() do fail when I use values 127? import static org.junit.Assert.*; ... @Test public void StationTest1() { .. assertSame(4, 4); // OK assertSame(10, 10); // OK assertSame(100, 100); // OK assertSame(127, 127); // OK assertSame(128, 128); // raises an junit.framework.AssertionFailedError! assertSame(((int) 128),((int) 128)); // also junit.framework.AssertionFailedError! } I'm using JUnit 4.8.1.

    Read the article

  • Performing a MYSQL query based off of $_GET results

    - by Michael N
    When a user clicks an item on my items page, it takes them to blank page template using $_GET to pass the item brand and model through. I'd like to perform another MYSQL query when that user clicks through to populate the blank page with the product details from my database. I'd like to retrieve the single row using the model number (unique ID) to populate the page with the information. I've tried a couple of things but am having a little difficulty. On my blank item page, I have $brand = $_GET['Brand']; $modelnumber = $_GET['ModelNumber']; $query = mysql_query("SELECT * FROM items WHERE `Model Number` = '$modelnumber'"); $results = mysql_fetch_row($query); echo $results; I think having ''s around Model Number is causing troubles, but without them, I get a Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given error. My database columns looks like Brand | Model Number | Price | Description | Image A few other things I have tried include $query = mysql_query("SELECT * FROM item WHERE Model Number = $_GET['ModelNumber']"); Which gave me a syntax error. I've also tried concatenating the $_GET which gives me a mysql_fetch_row() expects parameter 1 to be resource, boolean given error Which leads me to believe that I'm also going about displaying the results incorrectly. I'm not sure if I need to put it in a where loop like I have with my previous page which displays all items in the database because this is just displaying one.

    Read the article

  • A php namespace called default

    - by michael
    <?php namespace default gives me an unexpecected T_DEFAULT, is there any way of working around this? Can I escape the reserved word somehow? My system uses the name of the current module in my site for the namespace so it would be nice to be able to use any string as a namespace.

    Read the article

  • Outer select column value in joined subquery?

    - by Michael DePetrillo
    Is it possible to use a column value from an outer select within a joined subquery? SELECT table1.id, table2.cnt FROM table1 LEFT JOIN (SELECT COUNT(*) as `cnt` FROM table2 where table2.lt > table1.lt and table2.rt < table1.rt) as table2 ON 1; This results in "Unknown column 'table1.lt' in 'where clause'". Here is the db dump. CREATE TABLE IF NOT EXISTS `table1` ( `id` int(1) NOT NULL, `lt` int(1) NOT NULL, `rt` int(4) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE IF NOT EXISTS `table2` ( `id` int(1) NOT NULL, `lt` int(1) NOT NULL, `rt` int(4) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `table1` (`id`, `lt`, `rt`) VALUES (1, 1, 4); INSERT INTO `table2` (`id`, `lt`, `rt`) VALUES (2, 2, 3);

    Read the article

  • How to setHeight for a ViewGroup

    - by michael
    Hi, Can you please tell me how can I setHeight for a ViewGroup? I see there is a layout(l,t,r,b); But that is different form setHeight(), since I don't know where should be the top/bottom of the viewGroup. I need to set the height of the ViewGroup and return that to ListAdapter. Thank you.

    Read the article

  • Facebook application development resources

    - by Michael
    What is the most efficient way to start learning develop Facebook applications? Any web resource or book that you would recommend to start from? Any MUST READ or Bibles available for this? There are plenty of them in Amazon, but which one really worth to spend time? What kind of development technologies are used in this? Is PHP/MySQL/JS enough to jump in? Thanks

    Read the article

  • Join two results sets to make one result set in T-SQL

    - by Michael Kniskern
    What would be the best approach to combine the two results sets in one result set in T-SQL? SQL statment #1: SELECT COUNT(t.col1) as 'Number of Responses', t.col2 as 'Department' FROM table t WHERE col3 IS NOT NULL GROUP BY t.col1 ORDER BY t.col1 SQL Statment #1: SELECT COUNT(t.col1) as 'Total number of participants', t.col2 as 'Department' FROM table t GROUP BY t.col1 ORDER by t.col1 Desired result set Number of Responses | Total Number of participants | Department

    Read the article

  • PHP and use of the Num_Of_Rows() function?

    - by Michael Smith
    Below is some PHP code that i have written, the problem occurs when it gets to the use of the num_of_rows(), it just does not seem to work and i cant figure out why? <?php try { $divMon_ID = array(); $divMon_Position = array(); $divMon_Width = array(); $divMon_Div = array(); $db = new PDO('sqlite:db/EVENTS.sqlite'); $result_mon = $db->query('SELECT * FROM Monday'); $totalRows = mysql_num_rows($result_mon); //for($counter=1; $counter<=10; $counter+=1) //{ //<div id="event_1" style="position:absolute; left: 0px; top:-39px; width:100px; font-family:Arial, Helvetica, sans-serif; font-size:small; border:2px blue solid; height:93px"> //$divMon_ID[]=$row['Id']; //$divMon_Position[]=$row['Origin']; //$divMon_P[]=$row['Position']; //} } catch(PDOException $e) { print 'Exception : '.$e->getMessage(); } ? I know that it is the "$totalRows = mysql_num_rows($result_mon);" statement because when i then comment it out, the page can load. Am i using the function in the wrong way? Thanks.

    Read the article

  • Rails 2.3.8 Compound condition

    - by Michael Guantonio
    I have a rails query that I would like to run. The only problem that I am having is the query structure. Essentially the query looks like this queryList = model.find(:all, :conditions => [id = "id"]) #returns a query list #here is the issue compound = otherModel.find(:first, :select => "an_id", :conditions => ["some_other_id=? and an_id=?, some_other_id, an_id]) Where an_id is actually a list of ids in the query list. How can I write that in rails to basically associate a single id to a list that may contain ids...

    Read the article

  • SHTML - Testing

    - by Michael
    I am creating an shtml website and I am wondering how can you test the webiste in dreamweaver. Do you simply change the extentions back to html?

    Read the article

  • Downside to including headers in every source file (Objective-C)

    - by Michael Waterfall
    I'm currently including my AppDelegate.h and all of my category headers into every one of my source files using the MyApp_Prefix.pch prefix header, instead of manually #importing them only where they are used. The category methods and lots of compiler #define's in my app delegate are used in lots of places in my code. Is there any down side to this? Is it just that compilation will take longer?

    Read the article

  • SSH copying folders

    - by Michael
    I have a folder on my server that I'd like to copy to another directory. However, after I copy it and navigate to the new folder, some of the directories are RED and I can't navigate into them. I think this has something to do with them creating links instead of actually copying the folders. cp -a site2.com/httpdocs site1.com/httpdocs But then some of the sub folders from site2.com/httpdocs are setup as invalid links into site1.com/httpdocs and I cannot navigate to them nor can the webserver display them. Additionally, I have a permissions error where the copied files have their user set to site2.com but even after CHOWN I cannot get site1.com to display them.

    Read the article

  • How do I select a class element based on its id in jQuery?

    - by Michael
    I have multiple dynamically generated buttons with a class name of ".button". Each of these are given an unknown ID value used to uniquely identify them. In jQuery I must select one and alert the values. <div class="button" id="3"></div> The ID value is dynamically generated, therefore I do not know it. I'm new to jQuery but am basically looking for something like this: $(".button").attr("id").val(); How do I target one button when there are many? Thanks!

    Read the article

  • Cygwin make always processing target

    - by Michael
    However it happens only on Windows 7. On Windows XP once it built and intact, no more builds. I narrowed down the issue to one prerequisite - $(jar_target_dir). Here is part of the code # The location where the JAR file will be created. jar_target_dir := $(build_dir)/chrome # The main chrome JAR file. chrome_jar_file := $(jar_target_dir)/$(extension_name).jar # The root of the JAR sources. jar_source_root := chrome # The sources for the JAR file. jar_sources := bla #... some files, doesn't matter jar_sources_no_dir := $(subst $(jar_source_root)/,,$(jar_sources)) $(chrome_jar_file): $(jar_sources) $(jar_target_dir) @echo "Creating chrome JAR file." @cd $(jar_source_root); $(ZIP) ../$(chrome_jar_file) $(jar_sources_no_dir) @echo "Creating chrome JAR file. Done!" $(jar_target_dir): $(build_dir) echo "Creating jar target dir..." if [ ! -x $(jar_target_dir) ]; \ then \ mkdir $(jar_target_dir); \ fi $(build_dir): @if [ ! -x $(build_dir) ]; \ then \ mkdir $(build_dir); \ fi so if I just remove $(jar_target_dir) from $(chrome_jar_file) rule, it works fine.

    Read the article

  • .NET DB Query Without Allocations?

    - by Michael Covelli
    I have been given the task of re-writing some libraries written in C# so that there are no allocations once startup is completed. I just got to one project that does some DB queries over an OdbcConnection every 30 seconds. I've always just used .ExecuteReader() which creates an OdbcDataReader. Is there any pattern (like the SocketAsyncEventArgs socket pattern) that lets you re-use your own OdbcDataReader? Or some other clever way to avoid allocations? I haven't bothered to learn LINQ since all the dbs at work are Oracle based and the last I checked, there was no official Linq To Oracle provider. But if there's a way to do this in Linq, I could use one of the third-party ones.

    Read the article

  • Sidescrolling UI on iPhone

    - by Michael
    Please lead me in the right direction. I need to provide user with small text centered on the iPhone screen. User can make quick scroll left or right in order to get the next or previous text. There can be hundreds of such text pieces. The process itself is similar to Photo application sidescrolling but much simple, no zoom. As far as I can understand I need to use UIScrollView class, then call hundreds of addSubviews? Is it the optimal way or I should always keep 3 subviews and replace them on the fly? What kind of tricks should be used to achieve the "scroll and center" effect? Thanks

    Read the article

  • Continously scrolling views

    - by Michael
    How to create continuously scrolling view (by quick scroll) like in camera roll? Instead of images there should be text in the view generated dynamically. Which views/controllers I have to use? The scrolling itself can be either originated by user or each designated period of time.

    Read the article

  • Rails: How to preload a message to user

    - by Michael
    I have a Rails based prelaunch site that has some rotating background images (which are important for selling the idea of the site) that are taking too long to load, such that the users are leaving the site before they load. The only thing they're seeing is the email submission box. What's a good way to show a message to the users that the site will take some time to load but then have that message disappear after a reasonable period of time. I'm guessing a jQuery fadeOut() with a timer, but I'm not sure how long to set the timer for, because I'm not sure at what time it would start counting. Any suggestions?

    Read the article

  • Create rails record from two ids

    - by Michael Luby
    The functionality I'm trying to build allows Users to Visit a Restaurant. I have Users, Locations, and Restaurants models. Locations have many Restaurants. I've created a Visits model with user_id and restaurant_id attributes, and a visits_controller with create and destroy methods. Thing is, I can't create an actual Visit record. Any thoughts on how I can accomplish this? Or am I going about it the wrong way. Here's the code: Model: class Visit < ActiveRecord::Base attr_accessible :restaurant_id, :user_id belongs_to :user belongs_to :restaurant end View: <% @restaurants.each do |restaurant| %> <%= link_to 'Visit', location_restaurant_visits_path(current_user.id, restaurant.id), method: :create %> <% @visit = Visit.find_by_user_id_and_restaurant_id(current_user.id, restaurant.id) %> <%= @visit != nil ? "true" : "false" %> <% end %> Controller: class VisitsController < ApplicationController before_filter :find_restaurant before_filter :find_user def create @visit = Visit.create(params[:user_id => @user.id, :restaurant_id => @restaurant.id]) respond_to do |format| if @visit.save format.html { redirect_to location_restaurants_path(@location), notice: 'Visit created.' } format.json { render json: @visit, status: :created, location: @visit } else format.html { render action: "new" } format.json { render json: @visit.errors, status: :unprocessable_entity } end end end def destroy @visit = Visit.find(params[:user_id => @user.id, :restaurant_id => @restaurant.id]) @restaurant.destroy respond_to do |format| format.html { redirect_to location_restaurants_path(@restaurant.location_id), notice: 'Unvisited.' } format.json { head :no_content } end end private def find_restaurant @restaurant = Restaurant.find(params[:restaurant_id]) end def find_user @user = current_user end end

    Read the article

  • Byte manipulation in PHP

    - by Michael Angstadt
    In PHP, if you have a variable with binary data, how do you get specific bytes from the data? For example, if I have some data that is 30 bytes long, how do I get the first 8 bytes? Right now, I'm treating it like a string, using the substr() function: $data = //... $first8Bytes = substr($data, 0, 8); Is it safe to use substr with binary data? Or are there other functions that I should be using? Thanks.

    Read the article

  • linux worker script/queue (php) [closed]

    - by xetrill
    Hi, I need a binary/script (php) that does the following. Start n process of X in the background and maintain the number processes. An example: - n = 50 - initially 50 processes are started - a process exits - 49 are still running - so 1 should be started again. Please, this is urgent. Thanks! Michael

    Read the article

  • excel - generate a username from a full name field

    - by mheavers
    I'm trying to generate a username using a single name field in excel which has the person's first name and last name. I'm open to what the username would be, as long as its intuitive for the user. The name fields can be tricky, as the data looks like this: Albert Abongo (2 names) Stephen Michael Essuah Ackah (4 names) Alhaji Iddrisu Abdul-KArim (3 names) I guess my ideal usernames for these people would be aabongo sackah aabdul-karim

    Read the article

< Previous Page | 89 90 91 92 93 94 95 96 97 98 99 100  | Next Page >