Search Results

Search found 382 results on 16 pages for 'rep movsd'.

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

  • Difference b/w putting condition in JOIN clause versus WHERE clause

    - by user244953
    Suppose I have 3 tables. Sales Rep Rep Code First Name Last Name Phone Email Sales Team Orders Order Number Rep Code Customer Number Order Date Order Status Customer Customer Number Name Address Phone Number I want to get a detailed report of Sales for 2010. I would be doing a join. I am interested in knowing which of the following is more efficient and why ? SELECT O.OrderNum, R.Name, C.Name FROM Order O INNER JOIN Rep R ON O.RepCode = R.RepCode INNER JOIN Customer C ON O.CustomerNumber = C.CustomerNumber WHERE O.OrderDate >= '01/01/2010' OR SELECT O.OrderNum, R.Name, C.Name FROM Order O INNER JOIN Rep R ON (O.RepCode = R.RepCode AND O.OrderDate >= '01/01/2010') INNER JOIN Customer C ON O.CustomerNumber = C.CustomerNumber

    Read the article

  • after .htaccess url rewrite, css lost, and cannot perform logoff in some of the url rewrited page

    - by Patrick
    Here is my working .htaccess Options +FollowSymlinks RewriteEngine on #rep.php RewriteRule ^all,all.html$ rep.php?repID=all&repName=all RewriteRule ^([A-Z]+),([A-Za-z\sA-Za-z]+)\.html$ rep.php?repID=$1&repName=$2 #rep.php with page numbers RewriteRule ^([A-Za-z]+),([A-Za-z\sA-Za-z]+),([0-9]+)\.html$ rep.php?repID=$1repName=$2&page=$3 #quotedetails.php RewriteRule ^(Q[0-9]+)\.html$ quotedetails.php?quoteID=$1 RewriteRule ^index.html$ index.php RewriteRule ^addquote.html$ addquote.php RewriteRule ^search.html$ search.php RewriteRule ^viewall.html$ viewall.php RewriteRule ^howto.html$ howto.php above code works, but if i change the rewrite url style to repID/repName/page.html, all the CSS will be lost, how to fix this issue? another issue is, i have a login panel (modified from Cool login system), in some of the rewrited url like all, all.html or repID, repName.html or quoteID.html, when I click log out button, its not working and not redirect me to the index.html. in other pages(addquote.html, viewall.html, howto.html, search.html..), it works fine and redirect me to the index.htm after i click the logout button.

    Read the article

  • SQL Analysis Services - Dimension attributes with a "many" cardinality

    - by MonkeyBrother
    I am creating a cube with the following tables: Customer CustomerID, Name Customer Rep CustomerID, RepID Rep RepID, Name The important thing here is that there is a many to many relationship between Reps and Customers. I want to be able to ask the question "How much sales for customers working with rep 'A'?" In the data source view i set up the relationships between both customerid columns and both repid columns. I set up the rep attribute in the dimension builder and when I try to build the cube I get this error: Errors in the high-level relationship engine. the 'Rep' table that is required for a join cannot be reached based on the relationships in the data source view.

    Read the article

  • MS Access Premiere Products Exercise

    - by rynwtts
    I am working with Microsoft Access, Premiere Products Exercises for a college course. I can't seem to get past a specific question. We are working with DBDL and E-R Diagrams. The question is here. Indicate the changes you need to make to the design of the Premiere Products database to support the following situation. A customer is not necessarily represented by a single sales rep but can be represented by several sales reps. when a customer places an order, the sales rep who gets the commission on the order must be one of the collection of sales reps who represents the customer. In the database already each customer is represented by a sales rep. Which yields a one to one relationship. I need to enable a customer to have several sales reps, and make it so that only those sales rep will be eligible for commission upon each order.

    Read the article

  • Great Customer Service Example

    - by MightyZot
    A few days ago I wrote about what I consider a poor customer service interaction with TiVo, a company that I have been faithful to for the past 12 years or so. In that post I talked about how they helped me, but I felt like I was doing something wrong at the end of the call – when in reality I was just following through with an offer that TiVo made possible through my cable company. Today I had a wonderful customer service interaction with American Express, another company that I have been loyal to for many years.(I am a Gold Card member.) I like my Amex card because I can use it for big purchases and it forces me to pay them off at the end of the month. Well, the reality is that I’m not always so good at doing that, so sometimes my payments are over a couple of months.  :) A few days ago I received an email from “American Express” fraud detection. The email stated that I should call a toll free number and have the last four digits of my card handy. I grew up during the BBS era with some creative and somewhat mischievous friends. I’ve learned to be extremely cautious with regard to my online life! So, I did what you would expect…I sent them a nice reply that said “Go screw yourself.” For the past couple of days someone has been trying to call me and I assumed it was the same prankster trying to get the last four digits of my card. The last caller left a message indicating that they were from American Express and they wanted to talk to me about my card. After looking up their customer service numbers on the www.americanexpress.com web site, I called and was put through to the fraud detection group. The rep explained that there were some charges on my wife’s card that did not fit our purchase profile. She went through each charge and, for the most part, they looked like charges my wife may have made. My wife had asked to use the card for some Christmas shopping during the same timeframe as the charges. The American Express rep very politely explained that these looked out of character to her. She continued through the charges. She listed a charge for $160 – at this point my adrenaline started kicking in. My wife said she was going to charge about $25 or $30 dollars, not $160. Next, the rep listed a charge for over $1200. Uh oh!! Now I know that my account has been compromised. I informed the rep that we definitely did not make those charges. She replied with, “that’s ok Mr Pope, we declined those charges as well as some others.” We went through the pending charges and there were a couple more that were questionable. The rep very patiently waited while I called my wife on my office phone to verify the charges. Sure enough, my wife had not ordered anything from Netflix or purchased anything with Yahoo Wallet! “No problem Mr Pope, we will remove those charges as well.” “We are going to cancel your wife’s card and send her a new one. She will receive it by 7pm tomorrow via Federal Express. Please watch your statements over the next couple of months. If you notice anything fishy, give us a call and we will take care of it for you.” (Wow, I’m thinking to myself!) “Is there anything else I can help you with Mr Pope?” “Nope, thank you very much for catching this so early and declining those charges!”, I said smiling. Apparently she could hear me smiling on the other end of the phone line because she replied with “keep smiling Mr Pope and have a good rest of your week.” Now THAT’s customer service!  Thank you American Express!!! I shall remain an ever faithful customer. Interesting…

    Read the article

  • Problem: adding feature in MOSS 2007

    - by Anoop
    Hi All, I have added a menu item in 'Actions' menu of a document library as follows(Using features: explained in MSDN How to: Add Actions to the User Interface: http://msdn.microsoft.com/en-us/library/ms473643.aspx): feature.xml as follows: <?xml version="1.0" encoding="utf-8" ?> <Feature Id="51DEF381-F853-4991-B8DC-EBFB485BACDA" Title="Import From REP" Description="This example shows how you can customize various areas inside Windows SharePoint Services." Version="1.0.0.0" Scope="Site" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="ImportFromREP.xml" /> </ElementManifests> </Feature> ImportFromREP.xml is as follows: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Document Library Toolbar Actions Menu Dropdown --> <CustomAction Id="ImportFromREP" RegistrationType="List" RegistrationId = "101" GroupId="ActionsMenu" Rights="AddListItems" Location="Microsoft.SharePoint.StandardMenu" Sequence="1000" Title="Import From REP"> <UrlAction Url="/_layouts/ImportFromREP.aspx?ActionsMenu"/> </CustomAction> </Elements> I have successfully installed and activated the feature. Normal case: Now if i login with the user having atleast 'Contribute' permission on the document library, i am able to see the menu item 'Import From REP' (in 'Actions' menu)in root folder as well as in all subfolders. Problem case: If user is having view rights on the document library but add/delete rights on a perticular subfolder(say 'subfolder') inside the document library: Menu item 'Import From REP' is not visible on root folder level as well as 'Upload' menu is also not visible. which is o.k. because user does not have AddListItems right on root folder but it is also not visible in 'subfolder' while 'Upload' menu is visible as user has add/delete rights on the 'subfolder'. did i mention a wrong value of attribute Rights(Rights="AddListItems") in the xml file?? If so, what should be the correct value? What should i do to simulate the behaviour of 'Upload' menu??(i.e. when 'Upload' menu is visible, 'Import From REP' menu is visible and when 'Upload' menu is not visible 'Import From REP' menu is also not visible. ) Thanks in advance Anoop

    Read the article

  • Classes, methods, and polymorphism in Python

    - by Morlock
    I made a module prototype for building complex timer schedules in python. The classe prototypes permit to have Timer objects, each with their waiting times, Repeat objects that group Timer and other Repeat objects, and a Schedule class, just for holding a whole construction or Timers and Repeat instances. The construction can be as complex as needed and needs to be flexible. Each of these three classes has a .run() method, permitting to go through the whole schedule. Whatever the Class, the .run() method either runs a timer, a repeat group for a certain number of iterations, or a schedule. Is this polymorphism-oriented approach sound or silly? What are other appropriate approaches I should consider to build such a versatile utility that permits to put all building blocks together in as complex a way as desired with simplicity? Thanks! Here is the module code: ##################### ## Importing modules from time import time, sleep ##################### ## Class definitions class Timer: """ Timer object with duration. """ def __init__(self, duration): self.duration = duration def run(self): print "Waiting for %i seconds" % self.duration wait(self.duration) chime() class Repeat: """ Repeat grouped objects for a certain number of repetitions. """ def __init__(self, objects=[], rep=1): self.rep = rep self.objects = objects def run(self): print "Repeating group for %i times" % self.rep for i in xrange(self.rep): for group in self.objects: group.run() class Schedule: """ Groups of timers and repetitions. Maybe redundant with class Repeat. """ def __init__(self, schedule=[]): self.schedule = schedule def run(self): for group in self.schedule: group.run() ######################## ## Function definitions def wait(duration): """ Wait a certain number of seconds. """ time_end = time() + float(duration) #uncoment for minutes# * 60 time_diff = time_end - time() while time_diff > 0: sleep(1) time_diff = time_end - time() def chime(): print "Ding!"

    Read the article

  • How to join data frames in R (inner, outer, left, right)?

    - by Dan Goldstein
    Given two data frames df1 = data.frame(CustomerId=c(1:6),Product=c(rep("Toaster",3),rep("Radio",3))) df2 = data.frame(CustomerId=c(2,4,6),State=c(rep("Alabama",2),rep("Ohio",1))) > df1 CustomerId Product 1 Toaster 2 Toaster 3 Toaster 4 Radio 5 Radio 6 Radio > df2 CustomerId State 2 Alabama 4 Alabama 6 Ohio How can I do database style, i.e., sql style, joins? That is, how do I get: An inner join of df1 and df1 An outer join of df1 and df2 A left outer join of df1 and df2 A right outer join of df1 and df2 P.S. IKT-JARQ (I Know This - Just Adding R Questions) Extra credit: How can I do a sql style select statement?

    Read the article

  • Seeding repository Rhino Mocks

    - by ahsteele
    I am embarking upon my first journey of test driven development in C#. To get started I'm using MSTest and Rhino.Mocks. I am attempting to write my first unit tests against my ICustomerRepository. It seems tedious to new up a Customer for each test method. In ruby-on-rails I'd create a seed file and load the customer for each test. It seems logical that I could put this boiler plate Customer into a property of the test class but then I would run the risk of it being modified. What are my options for simplifying this code? [TestMethod] public class CustomerTests : TestClassBase { [TestMethod] public void CanGetCustomerById() { // arrange var customer = new Customer() { CustId = 5, DifId = "55", CustLookupName = "The Dude", LoginList = new[] { new Login { LoginCustId = 5, LoginName = "tdude" } } }; var repository = Stub<ICustomerRepository>(); // act repository.Stub(rep => rep.GetById(5)).Return(customer); // assert Assert.AreEqual(customer, repository.GetById(5)); } [TestMethod] public void CanGetCustomerByDifId() { // arrange var customer = new Customer() { CustId = 5, DifId = "55", CustLookupName = "The Dude", LoginList = new[] { new Login { LoginCustId = 5, LoginName = "tdude" } } }; var repository = Stub<ICustomerRepository>(); // act repository.Stub(rep => rep.GetCustomerByDifID("55")).Return(customer); // assert Assert.AreEqual(customer, repository.GetCustomerByDifID("55")); } [TestMethod] public void CanGetCustomerByLogin() { // arrange var customer = new Customer() { CustId = 5, DifId = "55", CustLookupName = "The Dude", LoginList = new[] { new Login { LoginCustId = 5, LoginName = "tdude" } } }; var repository = Stub<ICustomerRepository>(); // act repository.Stub(rep => rep.GetCustomerByLogin("tdude")).Return(customer); // assert Assert.AreEqual(customer, repository.GetCustomerByLogin("tdude")); } } Test Base Class public class TestClassBase { protected T Stub<T>() where T : class { return MockRepository.GenerateStub<T>(); } } ICustomerRepository and IRepository public interface ICustomerRepository : IRepository<Customer> { IList<Customer> FindCustomers(string q); Customer GetCustomerByDifID(string difId); Customer GetCustomerByLogin(string loginName); } public interface IRepository<T> { void Save(T entity); void Save(List<T> entity); bool Save(T entity, out string message); void Delete(T entity); T GetById(int id); ICollection<T> FindAll(); }

    Read the article

  • Value get changed even though I'm not using reference

    - by atch
    In code: struct Rep { const char* my_data_; Rep* my_left_; Rep* my_right_; Rep(const char*); }; typedef Rep& list; ostream& operator<<(ostream& out, const list& a_list) { int count = 0; list tmp = a_list;//----->HERE I'M CREATING A LOCAL COPY for (;tmp.my_right_;tmp = *tmp.my_right_) { out << "Object no: " << ++count << " has name: " << tmp.my_data_; //tmp = *tmp.my_right_; } return out;//------>HERE a_list is changed } I've thought that if I'll create local copy to a_list object I'll be operating on completely separate object. Why isn't so? Thanks.

    Read the article

  • Calculating a Sample Covariance Matrix for Groups with plyr

    - by John A. Ramey
    I'm going to use the sample code from http://gettinggeneticsdone.blogspot.com/2009/11/split-apply-and-combine-in-r-using-plyr.html for this example. So, first, let's copy their example data: mydata=data.frame(X1=rnorm(30), X2=rnorm(30,5,2), SNP1=c(rep("AA",10), rep("Aa",10), rep("aa",10)), SNP2=c(rep("BB",10), rep("Bb",10), rep("bb",10))) I am going to ignore SNP2 in this example and just pretend the values in SNP1 denote group membership. So then, I may want some summary statistics about each group in SNP1: "AA", "Aa", "aa". Then if I want to calculate the means for each variable, it makes sense (modifying their code slightly) to use: > ddply(mydata, c("SNP1"), function(df) data.frame(meanX1=mean(df$X1), meanX2=mean(df$X2))) SNP1 meanX1 meanX2 1 aa 0.05178028 4.812302 2 Aa 0.30586206 4.820739 3 AA -0.26862500 4.856006 But what if I want the sample covariance matrix for each group? Ideally, I would like a 3D array, where the I have the covariance matrix for each group, and the third dimension denotes the corresponding group. I tried a modified version of the previous code and got the following results that have convinced me that I'm doing something wrong. > daply(mydata, c("SNP1"), function(df) cov(cbind(df$X1, df$X2))) , , = 1 SNP1 1 2 aa 1.4961210 -0.9496134 Aa 0.8833190 -0.1640711 AA 0.9942357 -0.9955837 , , = 2 SNP1 1 2 aa -0.9496134 2.881515 Aa -0.1640711 2.466105 AA -0.9955837 4.938320 I was thinking that the dim() of the 3rd dimension would be 3, but instead, it is 2. Really this is a sliced up version of the covariance matrix for each group. If we manually compute the sample covariance matrix for aa, we get: [,1] [,2] [1,] 1.4961210 -0.9496134 [2,] -0.9496134 2.8815146 Using plyr, the following gives me what I want in list() form: > dlply(mydata, c("SNP1"), function(df) cov(cbind(df$X1, df$X2))) $aa [,1] [,2] [1,] 1.4961210 -0.9496134 [2,] -0.9496134 2.8815146 $Aa [,1] [,2] [1,] 0.8833190 -0.1640711 [2,] -0.1640711 2.4661046 $AA [,1] [,2] [1,] 0.9942357 -0.9955837 [2,] -0.9955837 4.9383196 attr(,"split_type") [1] "data.frame" attr(,"split_labels") SNP1 1 aa 2 Aa 3 AA But like I said earlier, I would really like this in a 3D array. Any thoughts on where I went wrong with daply() or suggestions? Of course, I could typecast the list from dlply() to a 3D array, but I'd rather not do this because I will be repeating this process many times in a simulation. As a side note, I found one method (http://www.mail-archive.com/[email protected]/msg86328.html) that provides the sample covariance matrix for each group, but the outputted object is bloated. Thanks in advance.

    Read the article

  • How do I use this indirect relationship?

    - by tyjkenn
    I'm working on incorporating a reputation system into my site, similar to SO. Here is how it is structured: User hasMany Project User hasMany Answer Project hasMany Rating Answer hasMany Rating Rating belongsTo Project where Rating.parent_type = Project Rating belongsTo Answer where Rating.parent_type = Answer Rating's value field will be a number between 1 and 5. The user should gain +10 for every 5-star review, +5 for every 4-star review, and +1 for every 3-star review. The way I currently have it set up is this: a recalcRep($id) action in the UsersController (along with other actions in other controllers, when necessary) calls the calcRep($id) method inside the User model, which is supposed to calculate the reputation of a user with an id of $id. public function calcRep($id) { $rep = 0; $data = $this->Rating->find('all'); //does not work, because it is not directly associated foreach($data as $rating) { if(($rating['Rating']['parent_type'] == 'Project' && $rating['Project']['user_id']==$id) or ($rating['Rating']['parent_type'] == 'Answer' && $rating['Answer']['user_id']==$id)) { if($rating['Rating']['value']==5) { $rep += 10; } else if($rating['Rating']['value']==4) { $rep += 5; } else if($rating['Rating']['value']==3) { $rep += 2; } } } $data['User']['reputation'] = $rep; $this->save($data); } I may be approaching this in completely the wrong way, but I can't figure out how to find all the ratings that belong to any of the children of a specific user.

    Read the article

  • Need to identify the component's selectedItem

    - by theband
    I am creating a lot of dynamic flex components like RadioButton, Combo Box, CheckBox. if(type=="mx.controls.CheckBox"){ //if(rep.currentIndex<5){ for each(j in x){ k=createNewInstanceOfClass(rep.currentItem.type); k.id="radioGroup"+rep.currentItem; k.label=j.linkname; k.data=j.linkname; linkPanel[rep.currentIndex].addChild(DisplayObject(k)); } When i click on Submit finally i need to get all the selected Values in each question. All the components are dynamically created at runtime.

    Read the article

  • Downloading multimedia content in java from php pages

    - by jmcejuela
    The url: http://www.teamliquid.net/replay/download.php?replay=1830 is a download link to a .rep file. My question is: how to download this content in java knowing the name of the original rep file in order to save it with a defined prefix, like path/_.rep //I was trying to run wget from java but I don't see how to get the original file's name.

    Read the article

  • Perl replace slash in variable

    - by cc96ai
    How can I replace the slash inside the variable? $string = 'a\cc\ee'; $re = 'a\\cc'; $rep = "Work"; #doesnt work in variable $string =~ s/$re/$rep/og; print $string."\n"; #work with String $string =~ s/a\\cc/$rep/og; print $string."\n"; output: a\cc\ee Work\ee

    Read the article

  • Using data.table to aggregate

    - by dayne
    After multiple suggestions from SO users, I am finally trying to convert my code over to using data.tables. library(data.table) DT <- data.table(plate = paste0("plate",rep(1:2,each=5)), id = rep(c("CTRL","CTRL","ID1","ID2","ID3"),2), val = 1:10) > DT plate id val 1: plate1 CTRL 1 2: plate1 CTRL 2 3: plate1 ID1 3 4: plate1 ID2 4 5: plate1 ID3 5 6: plate2 CTRL 6 7: plate2 CTRL 7 8: plate2 ID1 8 9: plate2 ID2 9 10: plate2 ID3 10 What I would like to do is take the average of DT[,val] by plate when the id is "CTRL". I would normally aggregate the data frame, then use match to map the values back to a new column, 'ctrl'. Using the data.table package I can get: DT[id=="CTRL",ctrl:=mean(val),by=plate] > DT plate id val ctrl 1: plate1 CTRL 1 1.5 2: plate1 CTRL 2 1.5 3: plate1 ID1 3 NA 4: plate1 ID2 4 NA 5: plate1 ID3 5 NA 6: plate2 CTRL 6 6.5 7: plate2 CTRL 7 6.5 8: plate2 ID1 8 NA 9: plate2 ID2 9 NA 10: plate2 ID3 10 NA What I need is really: DT <- data.table(plate = paste0("plate",rep(1:2,each=5)), id = rep(c("CTRL","CTRL","ID1","ID2","ID3"),2), val = 1:10, ctrl = rep(c(1.5,6.5),each=5)) > DT plate id val ctrl 1: plate1 CTRL 1 1.5 2: plate1 CTRL 2 1.5 3: plate1 ID1 3 1.5 4: plate1 ID2 4 1.5 5: plate1 ID3 5 1.5 6: plate2 CTRL 6 6.5 7: plate2 CTRL 7 6.5 8: plate2 ID1 8 6.5 9: plate2 ID2 9 6.5 10: plate2 ID3 10 6.5 Eventually I would like to use much more complicated selections of the values, but I do not know how to select specific values, run some function, then map those values back to the appropriate row using data frames.

    Read the article

  • xts error - order.by requires an appropriate time-based object

    - by Samo
    I can not resolve why error in simple creation of xts object xts(rep(0, NROW(TICK.NYSE)), order.by = index(TICK.NYSE)) Error in xts(rep(0, NROW(TICK.NYSE)), order.by = index(TICK.NYSE)) : order.by requires an appropriate time-based object appeared while this was working perfectly 14 days ago when I last used the same code (since then the only difference is that TICK.NYSE grow in length since data was added since then). More details below: > Sys.getenv("TZ") [1] "EST" > tail(xts(rep(0, NROW(TICK.NYSE)), order.by = index(TICK.NYSE))) Error in xts(rep(0, NROW(TICK.NYSE)), order.by = index(TICK.NYSE)) : order.by requires an appropriate time-based object > class(index(TICK.NYSE["T09:30/T09:31"])) [1] "POSIXct" > tail(xts(rep(0, NROW(tail(TICK.NYSE))), order.by = index(tail(TICK.NYSE)))) Error in xts(rep(0, NROW(tail(TICK.NYSE))), order.by = index(tail(TICK.NYSE))) : order.by requires an appropriate time-based object > tail(TICK.NYSE) TICK-NYSE.Open TICK-NYSE.High TICK-NYSE.Low TICK-NYSE.Close 2012-03-15 14:54:00 -278 -89 -299 -89 2012-03-15 14:55:00 -89 427 -89 201 2012-03-15 14:56:00 201 318 30 234 2012-03-15 14:57:00 234 242 -222 -64 2012-03-15 14:58:00 -64 346 -82 346 2012-03-15 14:59:00 346 525 36 525 TICK-NYSE.Volume TICK-NYSE.WAP TICK-NYSE.hasGaps 2012-03-15 14:54:00 0 0 0 2012-03-15 14:55:00 0 0 0 2012-03-15 14:56:00 0 0 0 2012-03-15 14:57:00 0 0 0 2012-03-15 14:58:00 0 0 0 2012-03-15 14:59:00 0 0 0 TICK-NYSE.Count 2012-03-15 14:54:00 31 2012-03-15 14:55:00 31 2012-03-15 14:56:00 31 2012-03-15 14:57:00 31 2012-03-15 14:58:00 29 2012-03-15 14:59:00 30 > str(TICK.NYSE) An ‘xts’ object from 2011-01-18 09:30:00 to 2012-03-15 14:59:00 containing: Data: num [1:114090, 1:8] -5 -144 24 -148 -184 -77 20 121 111 -60 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr [1:8] "TICK-NYSE.Open" "TICK-NYSE.High" "TICK-NYSE.Low" "TICK-NYSE.Close" ... Indexed by objects of class: [POSIXct,POSIXt] TZ: xts Attributes: List of 4 $ from : chr "20110119 23:59:59" $ to : chr "20110124 23:59:59" $ src : chr "IB" $ updated: POSIXct[1:1], format: "2012-01-19 02:34:52" > str(index(TICK.NYSE)) Class 'POSIXct' atomic [1:114090] 1.3e+09 1.3e+09 1.3e+09 1.3e+09 1.3e+09 ... ..- attr(*, "tzone")= chr "" ..- attr(*, "tclass")= chr [1:2] "POSIXct" "POSIXt" > Sys.getenv("TZ") [1] "EST" > tail(index(TICK.NYSE)) [1] "2012-03-15 14:54:00 EST" "2012-03-15 14:55:00 EST" [3] "2012-03-15 14:56:00 EST" "2012-03-15 14:57:00 EST" [5] "2012-03-15 14:58:00 EST" "2012-03-15 14:59:00 EST" > head(index(TICK.NYSE)) [1] "2011-01-18 09:30:00 EST" "2011-01-18 09:31:00 EST" [3] "2011-01-18 09:32:00 EST" "2011-01-18 09:33:00 EST" [5] "2011-01-18 09:34:00 EST" "2011-01-18 09:35:00 EST" > Sys.info() sysname "Linux" release "3.0.0-16-generic" version "#28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012" > sessionInfo() R version 2.14.1 (2011-12-22) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 [9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lattice_0.20-0 multicore_0.1-7 [3] doSNOW_1.0.5 snow_0.3-8 [5] doRedis_1.0.4 rredis_1.6.3 [7] foreach_1.3.2 codetools_0.2-8 [9] iterators_1.0.5 PerformanceAnalytics_1.0.3.3 [11] quantstrat_0.6.1 blotter_0.8.4 [13] twsInstrument_1.3-3 FinancialInstrument_0.10.6 [15] IBrokers_0.9-6 quantmod_0.3-18 [17] TTR_0.21-0 xts_0.8-4 [19] Defaults_1.1-1 strucchange_1.4-6 [21] sandwich_2.2-8 zoo_1.7-7 [23] rj_1.0.2-5 loaded via a namespace (and not attached): [1] grid_2.14.1 tools_2.14.1 > dput(tail(TICK.NYSE)) structure(c(-385, -213, -42, -334, -233, -111, -121, 20, -14, -125, -73, 265, -583, -269, -426, -520, -443, -440, -213, -42, -334, -233, -111, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 31, 30, 30, 31, 31), class = c("xts", "zoo" ), .indexCLASS = c("POSIXct", "POSIXt"), .indexTZ = "", from = "20110119 23:59:59", to = "20110124 23:59:59", src = "IB", updated = structure(1326958492.96405, class = c("POSIXct", "POSIXt")), index = structure(c(1331927640, 1331927700, 1331927760, 1331927820, 1331927880, 1331927940), tzone = "", tclass = c("POSIXct", "POSIXt")), .Dim = c(6L, 8L), .Dimnames = list(NULL, c("TICK-NYSE.Open", "TICK-NYSE.High", "TICK-NYSE.Low", "TICK-NYSE.Close", "TICK-NYSE.Volume", "TICK-NYSE.WAP", "TICK-NYSE.hasGaps", "TICK-NYSE.Count")))

    Read the article

  • How do I replace values within a data frame with a string in R?

    - by Arturito
    short version: How do I replace values within a data frame with a string found within another data frame? longer version: I'm a biologist working with many species of bees. I have a data set with many thousands of bees. Each row has a unique bee ID # along with all the relevant info about that specimen (data of capture, GPS location, etc). The species information for each bee has not been entered because it takes a long time to ID them. When IDing, I end up with boxes of hundred of bees, all of the same species. I enter these into a separate data frame. I am trying to write code that will update the original data file with species information (family, genus, species, sex, etc) as I ID the bees. Currently, in the original data file, the species info is blank and is interpreted as NA within R. I want to have R find all unique bee ID #'s and fill in the species info, but I am having trouble figuring out how to replace the NA values with a string (e.g. "Andrenidae") Here is a simple example of what I am trying to do: rawData<-data.frame(beeID=c(1:20),family=rep(NA,20)) speciesInfo<-data.frame(beeID=seq(1,20,3),family=rep("Andrenidae",7)) rawData[rawData$beeID == 4,"family"] <- speciesInfo[speciesInfo$beeID == 4,"family"] So, I am replacing things as I want, but with a number rather than the family name (a string). What I would eventually like to do is write a little loop to add in all the species info, e.g.: for (i in speciesInfo$beeID){ rawData[rawData$beeID == i,"family"] <- speciesInfo[speciesInfo$beeID == i,"family"] } Thanks in advance for any advice! Cheers, Zak EDIT: I just noticed that the first two methods below add a new column each time, which would cause problems if I needed to add species info multiple times (which I typically do). For example: rawData<-data.frame(beeID=c(1:20),family=rep(NA,20)) Andrenidae<-data.frame(beeID=seq(1,20,3),family=rep("Andrenidae",7)) Halictidae<-data.frame(beeID=seq(1,20,3)+1,family=rep("Halictidae",7)) # using join library(plyr) rawData <- join(rawData, Andrenidae, by = "beeID", type = "left") rawData <- join(rawData, Halictidae, by = "beeID", type = "left") # using merge rawData <- merge(x=rawData,y=Andrenidae,by='beeID',all.x=T,all.y=F) rawData <- merge(x=rawData,y=Halictidae,by='beeID',all.x=T,all.y=F) Is there a way to either collapse the columns so that I have one, unified data frame? Or a way to update the rawData rather than adding a new column each time? Thanks in advance!

    Read the article

  • Filtering documents against a dictionary key in MongoDB

    - by Thomas
    I have a collection of articles in MongoDB that has the following structure: { 'category': 'Legislature', 'updated': datetime.datetime(2010, 3, 19, 15, 32, 22, 107000), 'byline': None, 'tags': { 'party': ['Peter Hoekstra', 'Virg Bernero', 'Alma Smith', 'Mike Bouchard', 'Tom George', 'Rick Snyder'], 'geography': ['Michigan', 'United States', 'North America'] }, 'headline': '2 Mich. gubernatorial candidates speak to students', 'text': [ 'BEVERLY HILLS, Mich. (AP) \u2014 Two Democratic and Republican gubernatorial candidates found common ground while speaking to private school students in suburban Detroit', "Democratic House Speaker state Rep. Andy Dillon and Republican U.S. Rep. Pete Hoekstra said Friday a more business-friendly government can help reduce Michigan's nation-leading unemployment rate.", "The candidates were invited to Detroit Country Day Upper School in Beverly Hills to offer ideas for Michigan's future.", 'Besides Dillon, the Democratic field includes Lansing Mayor Virg Bernero and state Rep. Alma Wheeler Smith. Other Republicans running are Oakland County Sheriff Mike Bouchard, Attorney General Mike Cox, state Sen. Tom George and Ann Arbor business leader Rick Snyder.', 'Former Republican U.S. Rep. Joe Schwarz is considering running as an independent.' ], 'dateline': 'BEVERLY HILLS, Mich.', 'published': datetime.datetime(2010, 3, 19, 8, 0, 31), 'keywords': "Governor's Race", '_id': ObjectId('4ba39721e0e16cb25fadbb40'), 'article_id': 'urn:publicid:ap.org:0611e36fb084458aa620c0187999db7e', 'slug': "BC-MI--Governor's Race,2nd Ld-Writethr" } If I wanted to write a query that looked for all articles that had at least 1 geography tag, how would I do that? I have tried writing db.articles.find( {'tags': 'geography'} ), but that doesn't appear to work. I've also thought about changing the search parameter to 'tags.geography', but am having a devil of a time figuring out what the search predicate would be.

    Read the article

  • How To Update EF 4 Entity In ASP.NET MVC 3?

    - by Jason Evans
    Hi there. I have 2 projects - a class library containing an EDM Entity Framework model and a seperate ASP.NET MVC project. I'm having problems with how your suppose to edit and save changes to an entity using MVC. In my controller I have: public class UserController : Controller { public ActionResult Edit(int id) { var rep = new UserRepository(); var user = rep.GetById(id); return View(user); } [HttpPost] public ActionResult Edit(User user) { var rep = new UserRepository(); rep.Update(user); return View(user); } } My UserRepository has an Update method like this: public void Update(User user) { using (var context = new PDS_FMPEntities()) { context.Users.Attach(testUser); context.ObjectStateManager.ChangeObjectState(testUser, EntityState.Modified); context.SaveChanges(); } } Now, when I click 'Save' on the edit user page, the parameter user only contains two values populated: Id, and FirstName. I take it that is due to the fact that I'm only displaying those two properties in the view. My question is this, if I'm updating the user's firstname, and then want to save it, what am I suppose to do about the other User properties which were not shown on the view, since they now contain 0 or NULL values in the user object? I've been reading a lot about using stub entities, but I'm getting nowhere fast, in that none of the examples I've seen actually work. i.e. I keep getting EntityKey related exceptions. Can someone point me to a good tutorial/example of how to update EF 4 entities using a repository class, called by an MVC front-end? Cheers. Jas.

    Read the article

  • Repeater not working fine when passed a dataprovider (array) having a single element

    - by baltusaj
    I am using a Repeater in an Accordian which does not appear to see a single element in userArray. If I add another entry to userArray then the Repeater works fine. Thoughts?? private function currUsersServiceHandler(event:ResultEvent):void{ if (event.result.currentUsers != null) { if (event.result.currentUsers.user is ArrayCollection) // if more than one elements are present { usersArray = event.result.currentUsers.user; } else if (event.result.currentUsers is ObjectProxy) { //FIXIT usersArray populate by following line has some issue usersArray = new ArrayCollection(ArrayUtil.toArray(event.result.currentUsers)); } } } <mx:HTTPService id="currUsersService" url="currUsers.xml" result="currUsersServiceHandler(event)"/> <mx:Accordion includeIn="UserList" x="10" y="10" width="554" height="242" > <mx:Repeater id="rep" dataProvider="{usersArray}"> <mx:Canvas width="100%" height="100%" label="{rep.currentItem.firstName}" > <mx:HBox> <s:Label text="{rep.currentItem.firstName}"/> <s:Label text="{rep.currentItem.lastName}"/> <mx:/HBox> </mx:Canvas> </mx:Repeater> </mx:Accordian> Edit: There is another thing I have just noticed i.e. that the accordian does show a single tab (when Array has a single element) but it's not labeled with the first name which I am setting. If I enter another user, two tabs appear and both are labeled with names I am setting. The first tab appears labeled too then.

    Read the article

  • WPF Styles Button MouseOver Question.

    - by SO give me back my rep
    Hi, I am trying to make a simple mouseover effect on a button, It does change the color when mouse is over but the color is immediately changed to the default button background... how can I override this behavior? this is my code: Style myBtnStyle = new Style(); Trigger bla = new Trigger() { Property = IsMouseOverProperty, Value = true }; bla.Setters.Add(new Setter(Control.BackgroundProperty, Brushes.Black)); myBtnStyle.Triggers.Add(bla); button2.Style = myBtnStyle;

    Read the article

  • How to change Arrow Keys Behavior?

    - by SO give me back my rep
    Hi, I am doing a cool menu (sorta XMB) to give a fresh touch to my app... I add all of the elements on the menu programatically via DB. the menu is designed for easy use with arrows keys but I have encountered a major problem!!! by default when I press the arrow keys they only change the focus based on the tabindex and what I need is to change focus based on position of the controls not on their tabindex hope it is clear... see pic!!! so, Is there any way to do this?

    Read the article

  • How can I change what happens when "enter" key is pressed on a DataGridView?

    - by SO give me back my rep
    when I am editing a cell and press enter the next row is automatically selected, I want to stay with the current row... I want to happen nothing except the EndEdit. I have this: private void dtgProductos_CellEndEdit(object sender, DataGridViewCellEventArgs e) { dtgProductos[e.ColumnIndex, e.RowIndex].Selected = true; //this line is not working var index = dtgProductos.SelectedRows[0].Cells.IndexOf(dtgProductos.SelectedRows[0].Cells[e.ColumnIndex]); switch (index) { case 2: { dtgProductos.SelectedRows[0].Cells[4].Selected = true; dtgProductos.BeginEdit(true); } break; case 4: { dtgProductos.SelectedRows[0].Cells[5].Selected = true; dtgProductos.BeginEdit(true); } break; case 5: { btnAddProduct.Focus(); } break; default: break; } } so when I edit a row that is not the last one I get this error: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.

    Read the article

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