Search Results

Search found 2034 results on 82 pages for 'jason bradberry'.

Page 4/82 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Accounting Style string format in ASP .NET

    - by Russ Bradberry
    I would like to know the easiest way to format a string as accounting style. I know how to format as currency using {0:c} but there are some differences in accounting style, for example, all the dollar signs will line up as well as all the decimal points, and negatives are expressed in parenthesis rather than with a "-" minus sign. You can find a good example of the way i would like it in excel if you format the cells as "accounting" with 2 decimal places. thanks in advance, russ

    Read the article

  • How Can I Check an Object to See its Type and Return A Casted Object

    - by Russ Bradberry
    I have method to which I pass an object. In this method I check it's type and depending on the type I do something with it and return a Long. I have tried every which way I can think of to do this and I always get several compiler errors telling me it expects a certain object but gets another. Can someone please explain to me what I am doing wrong and guide me in the right direction? What I have tried thus far is below: override def getInteger(obj:Object) = { if (obj.isInstanceOf[Object]) null else if (obj.isInstanceOf[Number]) (obj:Number).longValue() else if (obj.isInstanceOf[Boolean]) if (obj:Boolean) 1 else 0 else if (obj.isInstanceOf[String]) if ((obj:String).length == 0 | (obj:String) == "null") null else try { Long.parse(obj:String) } catch { case e: Exception => throw new ValueConverterException("value \"" + obj.toString() + "\" of type " + obj.getClass().getName() + " is not convertible to Long") } }

    Read the article

  • How Do I Loop Through a Date Range in Reverse?

    - by Russ Bradberry
    I have a date range that I would like to be able to loop through in reverse. Give the following, how would I accomplish this, the standard Range operator doesn't seem t be working properly. >> sd = Date.parse('2010-03-01') => Mon, 01 Mar 2010 >> ed = Date.parse('2010-03-05') => Fri, 05 Mar 2010 >> (sd..ed).to_a => [Mon, 01 Mar 2010, Tue, 02 Mar 2010, Wed, 03 Mar 2010, Thu, 04 Mar 2010, Fri, 05 Mar 2010] >> (ed..sd).to_a => [] as you can see, the range operator works properly form start to end, but not from end to start.

    Read the article

  • How Do I Convert Pipe Delimited to Comma Delimited with Escaping

    - by Russ Bradberry
    Hi, I am fairly new to scala and I have the need to convert a string that is pipe delimited to one that is comma delimited, with the values wrapped in quotes and any quotes escaped by "\" in c# i would probably do this like this string st = "\"" + oldStr.Replace("\"", "\\\\\"").Replace("|", "\",\"") + "\"" I haven't validated that actually works but that is the basic idea behind what I am trying to do. Is there a way to do this easily in scala?

    Read the article

  • How Do I Pull Info from String

    - by Russ Bradberry
    I am trying to pull dynamics from a load that I run using bash. I have gotten to a point where I get the string I want, now from this I want to pull certain information that can vary. The string that gets returned is as follows: Records: 2910 Deleted: 0 Skipped: 0 Warnings: 0 Each of the number can and will vary in length, but the overall structure will remain the same. What I want to do is be able to get these numbers and load them into some bash variables ie: RECORDS=?? DELETED=?? SKIPPED=?? WARNING=?? In regex I would do it like this: Records: (\d*?) Deleted: (\d*?) Skipped (\d*?) Warnings (\d*?) and use the 4 groups in my variables.

    Read the article

  • How do I create a random method name

    - by Russ Bradberry
    I plan on using JSONP to call an external webservice to get around the fact that I dont want to create a global function that could potentially conflict with the calling page. I thought that creating a random function name and passing it up would work. Something like this: <script src="www.foo.com/b?cb=d357534"> where cb is the callback function name, the server would return d357534({my json data}); what i want to know is how to create the random function name, im sure i could use eval but is this the best way to go about it? essentially, what i am trying to do is this: var d + Math.floor(Math.random()*1000001) = function(){...

    Read the article

  • How Do I Search Between a Date Rang Using the ActiveRecord Model?

    - by Russ Bradberry
    I am new to both Ruby and ActiveRecord. I currently have a need to modify and existing piece of code to add a date range in the select. The current piece goes like this: ReportsThirdparty.find(:all, :conditions => {:site_id=>site_id, :campaign_id=>campaign_id, :size_id=>size_id}) Now, I need to add a range, but I am not sure how to do the BETWEEN or >= or <= operators. I guess what I need is something similar to: ReportsThirdparty.find(:all, :conditions => {:site_id=>site_id, :campaign_id=>campaign_id, :size_id=>size_id, :row_date=>"BETWEEN #{start_date} AND #{end_date}") Even if this did work, I know that using interpolation here would leave me subject to SQL injection attacks.

    Read the article

  • How do I Put Several Select Statements into Different Columns

    - by Russ Bradberry
    I basically have 7 select statement that I need to have the results output into separate columns. Normally I would use a crosstab for this but I need a fast efficient way to go about this as there are over 7 billion rows in the table. I am using the vertica database system. Below is an example of my statements: SELECT COUNT(user_id) AS '1' FROM event_log_facts WHERE date_dim_id=20100101 SELECT COUNT(user_id) AS '2' FROM event_log_facts WHERE date_dim_id=20100102 SELECT COUNT(user_id) AS '3' FROM event_log_facts WHERE date_dim_id=20100103 SELECT COUNT(user_id) AS '4' FROM event_log_facts WHERE date_dim_id=20100104 SELECT COUNT(user_id) AS '5' FROM event_log_facts WHERE date_dim_id=20100105 SELECT COUNT(user_id) AS '6' FROM event_log_facts WHERE date_dim_id=20100106 SELECT COUNT(user_id) AS '7' FROM event_log_facts WHERE date_dim_id=20100107

    Read the article

  • How do I do a join in ActiveRecord after records have been returned?

    - by Russ Bradberry
    I am using ActiveRecord in Rails 3 to pull data from two different tables in two different databases. These databases can not join on each other, but I have the need to do a simple join after-the-fact. I would like to preserve the relation so that I can chain it down the line. here is a simplified version of what I am doing browsers = Browser.all # <-- this is fairly small and can reside in memory events = Event.where(:row_date=>Date.today).select(:name, :browser_id) So as you can see, I want to join browsers in on the events relation, where browser_id should equal browsers.name. events is a relation and I can still add clauses to it down the line, so I dont want to run the query on the db just yet. How would I accomplish this?

    Read the article

  • How do I select and group by a portion of a string?

    - by Russ Bradberry
    Given I have data like the following, how can I select and group by portions of a string? Version Users 1.1.1 1 1.1.23 3 1.1.45 1 2.1.24 3 2.1.12 1 2.1.45 3 3.1.10 1 3.1.23 3 What I want is to sum up the users using version 1.1.x and 2.2.x and 3.3.x etc, but I'm not sure how I can group on a partial string in a select statement. edit What the data should return like is this: Version Users 1.1.XX 5 2.1.XX 7 3.1.XX 4 There is an infinite variable number of versions, some are in this format (major, minor, build) some are just major, minor and some are just major, the only time I want to "roll up" the versions is when there is a build.

    Read the article

  • How Do I Select a `td` Element in a Row That Has a Checkbox That is Checked?

    - by Russ Bradberry
    I have a table that looks somethings like this: <table> <tr class="row even"> <td><input type="checkbox" /></td> <td class="name">foo</td> <td class="metric">22</td> </tr> ...etc What I want to do is get an array of all td.metric only in rows that have the checkbox checked. This didn't work out as expected: var ticks = $.map($("tr td input:checked td.metric"), function(v,i){ return ... });

    Read the article

  • How Do I Update a Table From Another Table Only If the Result Count is 1?

    - by Russ Bradberry
    I have a table of 2 tables in a one to many relationship. I want to run an update script that will update the table with the FK of the related table only if there is one result (because if there is multiple then we need to decide which one to use, in another method) Here is what I have so far: UPDATE import_hourly_event_reports i SET i.banner_id = b.banner_id FROM banner b JOIN plan p ON b.plan_id = p.id WHERE b.campain_id = i.campaign_id AND b.size_id = i.size_id AND p.site_id = i.site_id HAVING COUNT(b.banner_id) = 1 As you can see, the HAVING clause doesn't quite work as I'd expect it. I only want to update the row in the import table with the id of the banner from the banner table if the count is equal to 1.

    Read the article

  • Sql order by within a group by with aggregate

    - by NG
    Say I have Team/Name/Some number Cardinals Jason 8 Cardinals Chris 5 Yankees Joba 6 Cubs Carlos 6 Cardinals Chris 6 And I want Cardinals Jason 8 Cardinals Chris 11 Cubs Carlos 6 Yankees Joba 6 So, what I'm doing is grouping by team, grouping by name, summing by some number However, within cardinals I want to make sure the names are in a particular order. If I just do an "order by name desc" for example then the the whole grouping gets ignored. So how can I order within a group.

    Read the article

  • Including email, IMs, configs, etc. in documentation or notes

    - by Jason Antman
    The shop I work in is pretty laid-back. We're on a documentation kick, only because historically we've been very bad with it. We do a lot of our brainstorming in face-to-face meetings, and also do a lot of communication via IM in addition to email. While I'm usually pretty good about documentation and keeping copious lab notes, I just finished a build of a host and spent hours searching through IMs, emails, files on my workstation, etc. to pull out anything I missed in my lab notes, which formed a large amount of the basis for the internal documentation. Does anyone have any thoughts on, aside from manually saving things to a project directory, managing various data sources (especially email and IM) and tracking them on project basis? Ideally, I'd like an easy way to put copies of emails, IM logs, etc. into a project-specific directory on my workstation and then just have a cron job that syncs that up with a shared folder. This isn't really a candidate for anything more advanced, as the bulk of the data will be copies of configs, code, etc. Here are the big restrictions: Email is via a centralized Zimbra install, so nothing can happen server-side. My workstation is Linux. Aside from writing Pidgin and Thunderbird plugins that let me tag chats and emails as belonging to a project, and then copy them to the appropriate place... any thoughts? Suggestions? Thanks, Jason

    Read the article

  • CUDA: cudaMemcpy only works in emulation mode.

    - by Jason
    I am just starting to learn how to use CUDA. I am trying to run some simple example code: float *ah, *bh, *ad, *bd; ah = (float *)malloc(sizeof(float)*4); bh = (float *)malloc(sizeof(float)*4); cudaMalloc((void **) &ad, sizeof(float)*4); cudaMalloc((void **) &bd, sizeof(float)*4); ... initialize ah ... /* copy array on device */ cudaMemcpy(ad,ah,sizeof(float)*N,cudaMemcpyHostToDevice); cudaMemcpy(bd,ad,sizeof(float)*N,cudaMemcpyDeviceToDevice); cudaMemcpy(bh,bd,sizeof(float)*N,cudaMemcpyDeviceToHost); When I run in emulation mode (nvcc -deviceemu) it runs fine (and actually copies the array). But when I run it in regular mode, it runs w/o error, but never copies the data. It's as if the cudaMemcpy lines are just ignored. What am I doing wrong? Thank you very much, Jason

    Read the article

  • Article search engine in php

    - by Jason
    Hello, I am using sphinx as a search engine on my website its working perfect and I have no complain with it. The only thing it lacks is, it does not allow me to search articles whose query length is more than 15 words. I know in reality people don't use more than 3-4 words i want to use it for finding duplicate contents. I was wondering if there is any alternative solution to sphinx. I want to cope with duplicate contents. My main articles table is in innodb but I am also caching articles into MyISAM table as well for full text searching but when I search an article it takes ages to perform one search. Its not the query problem, i think mysql lacks the fulltext searching facility. Thanks Jason

    Read the article

  • MATLAB: dealing with java.lang.String

    - by Jason S
    I seem to be stuck in Kafka-land, with a java.lang.String that I can't seem to use in MATLAB functions: K>> name name = Jason K>> sprintf('%s', name) ??? Error using ==> sprintf Function is not defined for 'java.lang.String' inputs. K>> ['my name is ' name] ??? Error using ==> horzcat The following error occurred converting from char to opaque: Error using ==> horzcat Undefined function or method 'opaque' for input arguments of type 'char'. how can I get a java.lang.String to convert to a regular MATLAB character array?

    Read the article

  • Sharepoint calendar webpart change views

    - by Jason
    Hi there, I created a calendar list, and I added the calendar web part in another web part page. I noticed that i can not change the view without going to edit mode, then go to modify shared web part. But in the home page of the calendar. There is a same calendar web part with a drop down menu to change views. Also, there is a small calendar connected to the main calendar web part in the left navigation area. I don't know how to add it to my web part page. How can i make it look the same on my web part page? Thanks, Jason

    Read the article

  • Setting a cookie before Javascript Redirection

    - by Jason
    Hello, I have a Rails app where I set a set a session variable the moment a user lands on my site with the referer and the page they hit. Additionally, I have Google Optimizer sending traffic from my homepage to various landing pages. The problem is that I think Google Optimizer is sending users away before the cookie is set. Is that even possible? I believe that the cookie is set from the HTTP Header, which must have fully loaded before Google's Javascript has even loaded. Thanks, Jason

    Read the article

  • Named Blueprints with factory_girl

    - by Jason Nerer
    I am using Factory Girl but like the machinist syntax. So I wonder, if there is any way creating a named blueprint for class, so that I can have something like that: User.blueprint(:no_discount_user) do admin false hashed_password "226bc1eca359a09f5f1b96e26efeb4bb1aeae383" is_trader false name "foolish" salt "21746899800.223524289203464" end User.blueprint(:discount_user) do admin false hashed_password "226bc1eca359a09f5f1b96e26efeb4bb1aeae383" is_trader true name "deadbeef" salt "21746899800.223524289203464" discount_rate { DiscountRate.make(:rate => 20.00) } end DiscountRate.blueprint do rate {10} not_before ... not_after ... end Is there a way making factory_girl with machinist syntax acting like that? I did not find one. Help appreciated. Thx in advance Jason

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >