Search Results

Search found 2673 results on 107 pages for 'michael maddox'.

Page 78/107 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • Changing stylesheet href with jQuery doesn't quite work

    - by Michael Itzoe
    I'm creating a web app that user will be accessing in the field, so they'd like to be able to manually toggle the styles from light to dark depending on the ambient lighting. I'm using jQuery. I added an id attribute to my stylesheet, then created a button using the toggle() event, in which I change the href attribute to the CSS file I want. The CSS file has several @import directives as I split the styles into several files for maintainability. My problem is only the main CSS file is being applied. I tried using the absolute path in the @import directives, but no luck. Is there a fix here I'm missing, or do I have to inlcude everything in a single CSS file? Edit: Apprently this is only a problem in IE8, works fine in Chrome and Firefox. Unfortunately, my client wants only IE8. Looks like this is a duplicate of this question.

    Read the article

  • Cleaning up PHP Code

    - by Michael
    Hi, I've noticed I am a very sloppy coder and do things out of the ordinary. Can you take a look at my code and give me some tips on how to code more efficiently? What can I do to improve? session_start(); /check if the token is correct/ if ($_SESSION['token'] == $_GET['custom1']){ /*connect to db*/ mysql_connect('localhost','x','x') or die(mysql_error()); mysql_select_db('x'); /*get data*/ $orderid = mysql_real_escape_string($_GET['order_id']); $amount = mysql_real_escape_string($_GET['amount']); $product = mysql_real_escape_string($_GET['product1Name']); $cc = mysql_real_escape_string($_GET['Credit_Card_Number']); $length = strlen($cc); $last = 4; $start = $length - $last; $last4 = substr($cc, $start, $last); $ipaddress = mysql_real_escape_string($_GET['ipAddress']); $accountid = $_SESSION['user_id']; $credits = mysql_real_escape_string($_GET['custom3']); /*insert history into db*/ mysql_query("INSERT into billinghistory (orderid, price, description, credits, last4, orderip, accountid) VALUES ('$orderid', '$amount', '$product', '$credits', '$last4', '$ipaddress', '$accountid')"); /*add the credits to the users account*/ mysql_query("UPDATE accounts SET credits = credits + $credits WHERE user_id = '$accountid'"); /*redirect is successful*/ header("location: index.php?x=1"); }else{ /*something messed up*/ header("location: error.php"); }

    Read the article

  • Need help to properly remove duplicates in NHibernate

    - by Michael D. Kirkpatrick
    Here is the problem I am having. I have a database with over 100 records in it. I am paging through the data to get 9 results at a time. When I added a check to see if items are active, it caused the results to start doubling up. A little background: "Product" is the actual product line "ProductSkus" are the actual products that exist in the product line When there is more then 1 ProductSku within Product, it causes a duplicate entry to be returned. See the NHibernate Query below: result = this.Session.CreateCriteria<Model.Product>() .Add(Expression.Eq("IsActive", true)) .AddOrder(new Order("Name", true)) .SetFirstResult(indexNumber).SetMaxResults(maxNumber) // This part of the query duplicates the products .CreateAlias("ProductSkus", "ProdSkus", JoinType.InnerJoin) .Add(Expression.Eq("ProdSkus.IsActive", true)) .CreateAlias("ProductToSubcategory", "ProdToSubcat") .CreateAlias("ProdToSubcat.ProductSubcategory", "ProdSubcat") .Add(Expression.Eq("ProdSubcat.ID", subCatId)) // This part takes out the duplicate products - Removes too many items... // Turns out that with .SetFirstResult(indexNumber).SetMaxResults(maxNumber) // it gets 9 records back then the duplicates are removed. // Example: // Total Records over 100 // Max = 9 // 4 Duplicates removed // Yields 5 records when there should be 9 // Why??? This line is ran in NHibernate on the data after it has been extracted from the SQL server. .SetResultTransformer(new NHibernate.Transform.DistinctRootEntityResultTransformer()) .List<Model.Product>(); I added the DistinctRootEntityResultTransformer to clean up the duplicates. The problem is that it pulls 9 records back that contains duplicates. DistinctRootEntityResultTransformer then cleans up the duplicates in the 9 records. I am basically needing a distinct statement to be ran on the SQL server to begin with. However, distinct on SQL is not going to work since NHibernate by default wants to add every field from every table in the select part of the statement. I am only using the fields that belong to the root table to begin with (Model.Product). If I can tell NHibernate to not add the fields to the joined tables into the select part of the statement along with adding Distinct, it would work. I use NHibernare Profiler to see the actual query: SELECT top 9 this_.ID as ID351_3_, this_.Name as Name351_3_, this_.Description as Descript3_351_3_, this_.IsActive as IsActive351_3_, this_.ManufacturerID as Manufact5_351_3_, prodskus1_.ID as ID373_0_, prodskus1_.Description as Descript2_373_0_, prodskus1_.PartNumber as PartNumber373_0_, prodskus1_.Price as Price373_0_, prodskus1_.IsKit as IsKit373_0_, prodskus1_.IsActive as IsActive373_0_, prodskus1_.IsFeaturedProduct as IsFeatur7_373_0_, prodskus1_.DateAdded as DateAdded373_0_, prodskus1_.Weight as Weight373_0_, prodskus1_.TimesViewed as TimesVi10_373_0_, prodskus1_.TimesOrdered as TimesOr11_373_0_, prodskus1_.ProductID as ProductID373_0_, prodskus1_.OverSizedBoxID as OverSiz13_373_0_, prodtosubc2_.ID as ID362_1_, prodtosubc2_.MasterSubcategory as MasterSu2_362_1_, prodtosubc2_.ProductID as ProductID362_1_, prodtosubc2_.ProductSubcategoryID as ProductS4_362_1_, prodsubcat3_.ID as ID352_2_, prodsubcat3_.Name as Name352_2_, prodsubcat3_.ProductCategoryID as ProductC3_352_2_, prodsubcat3_.ImageID as ImageID352_2_, prodsubcat3_.TriggerShow as TriggerS5_352_2_ FROM Product this_ inner join ProductSku prodskus1_ on this_.ID = prodskus1_.ProductID and (prodskus1_.IsActive = 1) inner join ProductToSubcategory prodtosubc2_ on this_.ID = prodtosubc2_.ProductID inner join ProductSubcategory prodsubcat3_ on prodtosubc2_.ProductSubcategoryID = prodsubcat3_.ID WHERE this_.IsActive = 1 /* @p0 */ and prodskus1_.IsActive = 1 /* @p1 */ and prodsubcat3_.ID = 3 /* @p2 */ ORDER BY this_.Name asc If I hand modify the query and run it directly on the SQL server I get the result set I want (I removed all the extra fields in the select section and added DISTINCT): SELECT DISTINCT top 9 this_.ID as ID351_3_, this_.Name as Name351_3_, this_.Description as Descript3_351_3_, this_.IsActive as IsActive351_3_, this_.ManufacturerID as Manufact5_351_3_, FROM Product this_ inner join ProductSku prodskus1_ on this_.ID = prodskus1_.ProductID and (prodskus1_.IsActive = 1) inner join ProductToSubcategory prodtosubc2_ on this_.ID = prodtosubc2_.ProductID inner join ProductSubcategory prodsubcat3_ on prodtosubc2_.ProductSubcategoryID = prodsubcat3_.ID WHERE this_.IsActive = 1 /* @p0 */ and prodskus1_.IsActive = 1 /* @p1 */ and prodsubcat3_.ID = 3 /* @p2 */ ORDER BY this_.Name asc The big question I now must ask is... What must I change in the NHibernate Query to ultimately get the exact same result? Thanks in advance.

    Read the article

  • Need help with if else statement

    - by Michael Quiles
    I'm trying to do an else statement that would tell the user that the game ended in a draw (tic tac toe game). I got it where it works if played and there's a winner it will show another form declaring the winner through an if statement but I cant figure out the its a draw portion. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing; namespace MyGame { public class Result1 { static private int[,] Winners = new int[,] { // main gameplay Ex: if x is on 0,1,2 x is the winner {0,1,2}, {3,4,5}, {6,7,8}, {0,3,6}, {1,4,7}, {2,5,8}, {0,4,8}, {2,4,6}, }; static public bool CheckWinner(Button[] myControls) { //bolean statement to check for the winner bool gameOver = false; for (int i = 0; i < 8; i++) { int a = Winners[i, 0]; int b = Winners[i, 1]; int c = Winners[i, 2]; Button b1 = myControls[a], b2 = myControls[b], b3 = myControls[c]; if (b1.Text == "" || b2.Text == "" || b3.Text == "") continue; if (b1.Text == b2.Text && b2.Text == b3.Text) { b1.BackColor = b2.BackColor = b3.BackColor = Color.LightCoral; b1.Font = b2.Font = b3.Font = new System.Drawing.Font("Microsoft Sans Serif", 32F, System.Drawing.FontStyle.Italic & System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); gameOver = true; xWinnerForm xWinnerForm = new xWinnerForm(); xWinnerForm.ShowDialog(); //only works with show not showDialog method gets overloaded (b1.Text + " is the Winner"); to get around this I added and image showing the last player } //else statement here for draw what code would I put in? } return gameOver; } } }

    Read the article

  • Hashbytes comparison in stored proceduring not matching record

    - by Michael Itzoe
    The password field in my user table (SQL Server 2008) is encrypted using HASHBYTES on insertion. I have a stored procedure with parameters for the username and plain-text password which does a SELECT using that username and the password sent through HASHBYTES, then returns the user record if it finds a match. The SP is always returning an empty recordset, but if I copy and paste just the SELECT from the SP to a new query window, it returns the matched record. There're no other statements in the SP. I'm missing something here; what is it?

    Read the article

  • How can I merge 2 branches in my local repository

    - by michael
    Hi, I have 2 branches in my hg repository: 1. default 2. new-feature I tried following this: http://mercurial.selenic.com/wiki/NamedBranches, I switch back to default by 'hg update -c default' but how can I merge my commits in 'new-feature' to 'default'. I did "hg pull new-feature", it said "repository new-feature not found"! Thank you.

    Read the article

  • jQuery i++ and i-- problems ... what on earth???

    - by michael
    Could someone please tell me what I am doing wrong? I'm not a newbie at programming but I feel like it tonight! Every time I increment the incrementing variable it throws a fit! When add one to it, it behaves fine, but if I try to add one more to it it wants to add 2 more. And then if I try to de-increment it wants to subtract from the original number that it was assigned to. I've tried: i++; i = i+1; i = i++; Nothing seems to work. It's got to be a stupid mistake. Press the buttons to increment and de-increment. http://michaelreynolds.net/iphone/ here's the code: var dayNum = 30; //---------------------------------------------------------------------- $.jQTouch({ icon: 'dailyqoteicon.png', statusBar: false, initializeTouch: 'a.touch' }); //---------------------------------------------------------------------- $(document).ready(function(){ //$(function(){}); $(function(){ $('a.touch').swipe( function(event, info){ //alert("jQTouch swipe event"); //alert(info.direction); }); }); $(function updateVerse(){ //alert("updateVerse called"); $.ajax({ type: "GET", dataType: 'JSON', data: 'day='+ dayNum, url: 'forward.php', success: function(data){ var obj = $.parseJSON(data); $("h2.quote").html(""); $("h3.reference").html(""); $("h2.quote").append(obj.quote); $("h3.reference").append(obj.reference, " ", obj.version); //$("span.version").append(obj.version); //----------------------------------- // JSON string {"id":"1","quote":"For to me, to live is Christ, and to die is gain","reference":"Philippians 1:21","version":"NKJV"} }, error: function(request, error){ alert("problem retrieving json data string"); } }); function addDayNum(){ dayNum = dayNum + 1; //dayNum = dayNum++; } function subDayNum(){ dayNum = dayNum - 1; //dayNum = dayNum--; } $("div#header a.next").tap( function(){ addDayNum(); //dayNum++;// doesn't work at all //dayNum = dayNum + 1;//doesn't work at all updateVerse(); //alert(dayNum); //alert("next clicked"); }); $("div#header a.prev").live('click', function(){ subDayNum(); //dayNum--;//doesn't work at all //dayNum = dayNum - 1;// doesn't work at all updateVerse(); //alert(dayNum); //alert("previous clicked"); }); }); });

    Read the article

  • Why does Rails with Passenger/nginx only works in development mode? No logs available

    - by Michael W.
    Hey folks, I have a serious problem with one of our webservers... after having an internal alpha-testing with a mongrel/haproxy-cluster that worked well, we wanted to use nginx with passenger for our first production server (customers will access this server). However, I can only run the rails app via development mode with passenger/nginx. The app itself runs perfect with mongrel or webrick in production mode. My biggest problem with this case is that I don't find ANY information in the nginx or rails-logs (only when I use mongrel or webrick). Permissions are correct. Passenger-status shows that the app is running, but I always get the static 500.html-error page... It would be so nice if you guys could give me a hint and help me solve the problem. I put the config at the bottom of the post... This exact config works with rails_env development;but I'd like to use the production mode ;-) Thank you very much for your help! Version: Ubuntu 8.04.2 64bit / nginx-0.7.64 (compiled and installed via passenger-2.2.11) cat /opt/nginx/conf/nginx.conf user www-data; worker_processes 4; error_log logs/error.log; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11; passenger_ruby /usr/bin/ruby1.8; passenger_log_level 3; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name <<servername>>; root /srv/app01/public; passenger_enabled on; }

    Read the article

  • How to setup libsoup for ubuntu

    - by michael
    Hi, I am trying to install libsoup for my ubuntu environment: checking for LIBSOUP... configure: error: Package requirements (libsoup-2.4 >= 2.28.2) were not met: No package 'libsoup-2.4' found I tried $ sudo apt-get install libsoup2.4-dev and now it said: checking for LIBSOUP... configure: error: Package requirements (libsoup-2.4 >= 2.28.2) were not met: Requested 'libsoup-2.4 >= 2.28.2' but version of libsoup is 2.4.1 Thanks for any suggestion in how to fix this problem.

    Read the article

  • How to develop on a branch in HG

    - by michael
    Hi, I would like to do some experimental work in a hg project. So I would like to create branch, commit to it. And if the experiment works, I can merge it back to main branch. In git, I can do $git branch experimental $git checkout experimental (edit file) $ git commit -a $ git checkout master I read http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/, it said ' hg branch feature'. But what is next? I don't follow. I appreciate if you can help. Thank you.

    Read the article

  • Table with unequal rows in XUL layout

    - by Michael
    Trying to get something similar for Firefox extension using XUL. The most difficult part is the grid with unequal number of rows. I tried <grid> but it didn't work well. Also don't want to use HTML inside of XUL. Any ideas how to build such table?

    Read the article

  • Unread email notifier, most practical approach

    - by Michael Pasqualone
    I'm in the process of writing a small php-cli script that will loop over over my personal inbox and then send me an SMS via a gateway. The question I have is: As will have the script launch via cron every 10 minutes, if there is an email sitting in my inbox that is not read before the next script launch then I will receive 2 sms. Does any one (pseudocode will do) have any idea what the best practice would be in php5 to ensure only 1 SMS is sent? What I am currently learning towards is towards storing the message ID in a sqlite DB and flagging a field whether an SMS has been sent or not - but wondering if there is an easier way?

    Read the article

  • Transfer Core Data from One Project to Another

    - by Michael
    The answer is probably a resounding 'NO' but before I start a new project from scratch, I thought I'd ask. I create many throw away projects to test ideas and code before combining all the successful bits from the scratch projects into a final version. So I have one project with the Core Data stuff worked out but I want to move it to a new project. My guess is that there is too many internal hooks and dropping in the .xcdatamodel and the sqlite db is just not going to work. I'd glad to be wrong...

    Read the article

  • Is there any real world reason to use throw ex?

    - by Michael Stum
    In C#, throw ex is almost always wrong, as it resets the stack trace. I just wonder, is there any real world use for this? The only reason I can think of is to hide internals of your closed library, but that's a really weak reason. Apart from that, I've never encountered in the real world. Edit: I do mean throw ex, as in throwing the exact same exception that was caught but with an empty stacktrace, as in doing it exactly wrong. I know that throw ex has to exist as a language construct to allow throwing a different exception (throw new DifferentException("ex as innerException", ex)) and was just wondering if there is ever a situration where a throw ex is not wrong.

    Read the article

  • XP Leveling System - PHP

    - by Michael Rich
    Rank Table ID, Primary Key RANK, The rank or level, 1 being the highest and 3 the lowest MIN_SCORE, The minimum amount of point or XP needed to reach the rank NAME, The associated name of the rank Rank Table +----+------+-----------+-------------------------+ | ID | RANK | MIN_SCORE | NAME | +----+------+-----------+-------------------------+ | 1 | 1 | 18932 | Editor-in-Chief | | 2 | 2 | 15146 | Senior Technical Writer | | 3 | 3 | 12116 | Senior Copywriter | +----+------+-----------+-------------------------+ Ranking Table ID, Primary Key FK_MEMEBER_ID, Foreign Key to member's Primary Key FK_RANK, Foreign Key to Author Rank Table's Rank column (top) SCORE, The member's current earned score or XP Ranking Table +-----+--------------+---------+-------+ | ID | FK_MEMBER_ID | FK_RANK | SCORE | +-----+--------------+---------+-------+ | 1 | 1 | 1 | 17722 | | 2 | 2 | 2 | 16257 | | 3 | 3 | 3 | 12234 | +-----+--------------+---------+-------+ In my class I have stored the ranks -- matching those in the Rank Table -- and correlating minimum scores; RANK as key and MINIMUM_SCORE as value. When a member's score (XP) is updated (up/down) I want to test that updated score against the below array to determine if their rank needs updating too. private $scores = array('3' => '12116', '2' => '15146', '1' => '18932',); Using the updated score, how could I determine the correlating rank from the above array? Everything is open to scrutiny, this is my first time creating a ranking system so I hope to get it right :)

    Read the article

  • Web Audio API and mobile browsers

    - by Michael
    I've run into a problem while implementing sound and music into an HTML game that I'm building. I'm using the Web Audio API, loading all the sound files with XMLHttpRequests and decoding them into an AudioBufferSourceNode with AudioContext.prototype.decodeAudioData(). It looks something like this: var request = new XMLHttpRequest(); request.open("GET", "soundfile.ogg", true); request.responseType = "arraybuffer"; request.onload = function() { context.decodeAudioData(request.response) } request.send(); Everything plays fine, but on mobile the decodeAudioData takes an absurdly long time for the background music. I then tried using AudioContext.prototype.createMediaElementSource() to load the music from an HTML Audio object, since they support streaming and don't have to load the whole file into memory at once. It looked something like this: var audio = new Audio('soundfile.ogg'); var source = context.createMediaElementSource(audio); var mainVolume = context.createGain(); source.connect(mainVolume); mainVolume.connect(context.destination); This loads much faster, but the audio volume isn't affected by the gain node. Works fine on desktop, so I'm assuming this is a bug/limitation of mobile Chrome (testing on Android). Is there actually no good, well-performing way to handle sound on mobile browsers or am just I doing something stupid?

    Read the article

  • Distance between hyperplanes

    - by michael dillard
    I'm trying to teach myself some machine learning, and have been using the MNIST database (http://yann.lecun.com/exdb/mnist/) do so. The author of that site wrote a paper in '98 on all different kinds of handwriting recognition techniques, available at http://yann.lecun.com/exdb/publis/pdf/lecun-98.pdf. The 10th method mentioned is a "Tangent Distance Classifier". The idea being that if you place each image in a (NxM)-dimensional vector space, you can compute the distance between two images as the distance between the hyperplanes formed by each where the hyperplane is given by taking the point, and rotating the image, rescaling the image, translating the image, etc. I can't figure out enough to fill in the missing details. I understand that most of these are indeed linear operators, so how does one use that fact to then create the hyperplane? And once we have a hyperplane, how do we take its distance with other hyperplanes?

    Read the article

  • javascript syntax

    - by Michael
    var ret = [] ,xresult = document.evaluate(exp, rootEl, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null) ,result = xresult.iterateNext(); while (result) { ret[ret.length]= result; result = xresult.iterateNext(); } can anyone explain me what is the ret = [],..,... syntax? Initializing array?

    Read the article

  • Refresh page in browser without resubmitting form

    - by Michael
    I'm an ASP.NET developer, and I usually find myself leaving the webpage that I'm working on open in my browser (Chrome is my browser of choice, but this question is relevant for any browser). My workflow typically goes like this: I write code, I rebuild my project in Visual Studio, and then I flip back to my browser with Alt-Tab and hit F5 to refresh the page. This is fine and dandy if a form hasn't been submitted since the page was opened. But if I've been clicking around on ASP.NET form controls, the page has posted form data a number of times, so hitting F5 causes the browser to (sensibly) pop up a confirmation message, e.g., "Confirm Form Resubmission: The page that you're looking for used information that you entered...". Sometimes I do want to resubmit the form, but more often than not, I just want to start over with the page (rather than resubmit form data). The way I usually get around this is to simply add some query string data to the URL so that the browser sees it as a fresh page request, e.g.: page.aspx becomes page.aspx? (or vice-versa). My question is: Is there a better way to quickly request a fresh version of a webpage (and not submit form data) in any of the major browsers? It seems like a no-brainer to me for web development, but maybe I'm missing something. What I'd love to see is something like the last item in this list: F5: refresh page Ctrl-F5: refresh page (and force cache refresh) Alt-F5: request fresh copy of the page without resubmitting the form

    Read the article

  • Javascript setInterval and `this` solution

    - by Michael
    I need to access this from my setInterval handler prefs: null, startup : function() { // init prefs ... this.retrieve_rate(); this.intervalID = setInterval(this.retrieve_rate, this.INTERVAL); }, retrieve_rate : function() { var ajax = null; ajax = new XMLHttpRequest(); ajax.open('GET', 'http://xyz.com', true); ajax.onload = function() { // access prefs here } } How can I access this.prefs in ajax.onload ?

    Read the article

  • Attempting to load a 64-bit application, how this CPU is not compatible with 64-bit mode

    - by Brandon Michael Hunter
    I have a Dell Studio 540, 64 bit OS Windows Home Premium. My CPU is supports Intel's virtualization technology, but I don't know how to enabled it on my machine. I saw that you can do it via the bios, but I didn't see this option when going through my BIOS. Is there another way to enabled this feature? Please let me know. I'm trying to installed Windows Server 2008 via Vircutal PC 2007. Thank You,

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >