Search Results

Search found 8397 results on 336 pages for 'implementation'.

Page 24/336 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • SQL Server Profiler Implementation Using C#/VB.net

    - by Asim Sajjad
    I to implement sql Server Profile in C#/VB.net application, Can any one has good example of it, I have search on google but didn't find good working example, I don't have Sql server Profiler tool on my system ans also don't have Sql Server (it is on difference system). how do I can create profiler for my own

    Read the article

  • Virtual Function Implementation

    - by Gokul
    Hi, I have kept hearing this statement. Switch..Case is Evil for code maintenance, but it provides better performance(since compiler can inline stuffs etc..). Virtual functions are very good for code maintenance, but they incur a performance penalty of two pointer indirections. Say i have a base class with 2 subclasses(X and Y) and one virtual function, so there will be two virtual tables. The object has a pointer, based on which it will choose a virtual table. So for the compiler, it is more like switch( object's function ptr ) { case 0x....: X->call(); break; case 0x....: Y->call(); }; So why should virtual function cost more, if it can get implemented this way, as the compiler can do the same in-lining and other stuff here. Or explain me, why is it decided not to implement the virtual function execution in this way? Thanks, Gokul.

    Read the article

  • Custom Tag implementation issue

    - by Appps
    I have a custom tag as follows. repeat and heading tag have doAfterBody method implemented. <csajsp:repeat reps="5"> <LI> <csajsp:heading bgColor="BLACK"> White on Black Heading </csajsp:heading> </LI> </csajsp:repeat> /* Repeat tag Class*/ public void setReps(String repeats) { System.out.println("TESTING"+repeats); //sets the reps variable. } public int doAfterBody() { System.out.println("Inside repeate tag"+reps); if (reps-- >= 1) { BodyContent body = getBodyContent(); try { JspWriter out = body.getEnclosingWriter(); System.out.println("BODY"+body.getString()); out.println(body.getString()); body.clearBody(); // Clear for next evaluation } catch(IOException ioe) { System.out.println("Error in RepeatTag: " + ioe); } return(EVAL_BODY_TAG); } else { return(SKIP_BODY); } } /* Class of Heading tag */ public int doAfterBody() { System.out.println("inside heading tag"); BodyContent body = getBodyContent(); System.out.println(body.getString()); try { JspWriter out = body.getEnclosingWriter(); out.print("NEW TEXT"); } catch(IOException ioe) { System.out.println("Error in FilterTag: " + ioe); } // SKIP_BODY means I'm done. If I wanted to evaluate // and handle the body again, I'd return EVAL_BODY_TAG. return(SKIP_BODY); } public int doEndTag() { try { JspWriter out = pageContext.getOut(); out.print("NEW TEXT 2"); } catch(IOException ioe) { System.out.println("Error in HeadingTag: " + ioe); } return(EVAL_PAGE); // Continue with rest of JSP page } The order in which SOP are printed is 1) Setter method of csajsp:repeat is called. 2) White on Black Heading is printed. ie doAfterBody of csajsp:heading tag is called. I don't know why it is not calling doAfterBody of csajsp:repeat tag. Please help me to understand this. Thanks in advance.

    Read the article

  • implementation of interp1 function of MATLAB in J2ME

    - by Jeeka
    Hi, i am looking to implement the interp1, 1-D data interpolation (table lookup), function available in MATLAB in J2ME or JAVA. here is the link http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html Is there any library available in J2ME or JAVA which has already implemented the same function ? If not can anybody help me in implementing interp1 function in J2ME or JAVA ?

    Read the article

  • dual map structure implementation?

    - by Danra
    Hey, I'm looking for a standard dual-map structure - is there one implemented in std/boost/another standard C++ library? When I say "dual-map" I mean a map which can be indexed efficiently both by the key and the "value" (it actually has two key types instead of one key type and one value type). for example: dualmap<int,string> m; m[1] = "foo"; m["bar"] = 2 int a = m["bar"]; // a = 2 Thanks, Dan

    Read the article

  • StructureMap: Wiring (generic) implementations to an implementation of another type

    - by Jeremy Frey
    If I have an interface: public interface IRepository<T> And an abstract class: public abstract class LinqToSqlRepository<T, TContext> : IRepository<T> where T : class where TContext : DataContext And a whole bunch of implementations of IRepository / LinqToSqlRepository (e.g. AccountRepository, ContactRepository, etc.), what's the best way to to use StructureMap (2.5.3) to generically wire them all up? e.g., I want this code to pass: [Test] public void ShouldWireUpAccountRepositories { var accountRepo = ObjectFactory.GetInstance<IRepository<Account>>(); Assert.IsInstanceOf<AccountRepository>(accountRepo); } Without explicitly writing this: ObjectFactory.Configure(x => x.ForRequestedType<IRepository<Account>>() .TheDefaultIsConcreteType<AccountRepository>()); In the past, we've always created a specific interface on each repository that inherited from the generic one, and used the default scanner to automatically wire all of those instances, but I'd like to be able to ask specifically for an IRepository<Account> without cluttering up the project with additional interfaces / configurations.

    Read the article

  • Pointer Implementation Details in C

    - by Will Bickford
    I would like to know architectures which violate the assumptions I've listed below. Also I would like to know if any of the assumptions are false for all architectures (i.e. if any of them are just completely wrong). sizeof(int *) == sizeof(char *) == sizeof(void *) == sizeof(func_ptr *) The in-memory representation of all pointers for a given architecture is the same regardless of the data type pointed to. The in-memory representation of a pointer is the same as an integer of the same bit length as the architecture. Multiplication and division of pointer data types are only forbidden by the compiler. NOTE: Yes I know this is nonsensical. What I mean is - is there hardware support to forbid this incorrect usage? All pointer values can be casted to a single integer. In other words, what architectures still make use of segments and offsets? Incrementing a pointer is equivalent to adding sizeof(the pointed data type) to the memory address stored by the pointer. If p is an int32* then p+1 is equal to the memory address 4 bytes after p. I'm most used to pointers being used in a contiguous, virtual memory space. For that usage, I can generally get by thinking of them as addresses on a number line. See (http://stackoverflow.com/questions/1350471/pointer-comparison/1350488#1350488).

    Read the article

  • Problem with lazy loading implementation

    - by Mehran
    Hi, I have implemented lazy loading in my program. it's done through a proxy class like: class Order { public virtual IList<Item> Items {get; set;} } class OrderProxy { public override IList<Item> Items { get { if (base.Items == null) Items = GetItems(base.OrderID); return base.Items; } set { base.Items = value; } } } the problem is that whenever i instantiate proxy class,without even touching the Items property, it tries to load Items! as you may know,i want to instantiate proxy class and return the instance to BLL instead of domain object itself. what's the problem? Does .NET CLR access(read) properties in a class, when it's instatiating the class? any other methods? Thanks

    Read the article

  • QT EventTransition implementation

    - by Thomas
    I am trying to build an QT State Maschine. I have some States, and for those States i need Transition that alter the Graphics on my gui. The Problem i having and the only reason i am asking, i am Stuck and Point 1. The compiler cant identifie the QTEventTransition. I have QT 4.6 wroking with QT Creator on Windows. The compiler does not find Header #include < QtEventTransition This is what i did i never did this bevor but i think it should be correct, I have A Header File where i have my Transitions Declareted like this: class validateBoatTransition : public QtEventTransition { public: validateBoatTransition(Widget *widget,ServerSkeleton* server); protected: bool eventTest(QEvent *e); void onTransition(QEvent *); private: Chart* ourChart; Message current; BarelySocket* myBarelySocket; }; Than i have my Cpp File where i have this: validateBoatTransition::validateBoatTransition(Widget *widget,ServerSkeleton* server) { } void validateBoatTransition::onTransition(QEvent *e) { /* My Logik should go here */ } What i want is that if the Transition is activated by an Button (clicked) it should fire this transition! I searched the net, but cant find an solution. Can i do that? I should i think. Yours Thomas

    Read the article

  • Help with simple linux shell implementation

    - by nunos
    I am implementing a simple version of a linux shell in c. I have succesfully written the parser, but I am having some trouble forking out the child process. However, I think the problem is due to arrays, pointers and such, because just started C with this project and am not still very knowledgable with them. I am getting a segmentation fault and don't know where from. Any help is greatly appreciated. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/wait.h> #include <sys/types.h> #define MAX_COMMAND_LENGTH 250 #define MAX_ARG_LENGTH 250 typedef enum {false, true} bool; typedef struct { char **arg; char *infile; char *outfile; int background; } Command_Info; int parse_cmd(char *cmd_line, Command_Info *cmd_info) { char *arg; char *args[MAX_ARG_LENGTH]; int i = 0; arg = strtok(cmd_line, " "); while (arg != NULL) { args[i] = arg; arg = strtok(NULL, " "); i++; } int num_elems = i; if (num_elems == 0) return -1; cmd_info->infile = NULL; cmd_info->outfile = NULL; cmd_info->background = 0; int iarg = 0; for (i = 0; i < num_elems-1; i++) { if (!strcmp(args[i], "<")) { if (args[i+1] != NULL) cmd_info->infile = args[++i]; else return -1; } else if (!strcmp(args[i], ">")) { if (args[i+1] != NULL) cmd_info->outfile = args[++i]; else return -1; } else cmd_info->arg[iarg++] = args[i]; } if (!strcmp(args[i], "&")) cmd_info->background = true; else cmd_info->arg[iarg++] = args[i]; cmd_info->arg[iarg] = NULL; return 0; } void print_cmd(Command_Info *cmd_info) { int i; for (i = 0; cmd_info->arg[i] != NULL; i++) printf("arg[%d]=\"%s\"\n", i, cmd_info->arg[i]); printf("arg[%d]=\"%s\"\n", i, cmd_info->arg[i]); printf("infile=\"%s\"\n", cmd_info->infile); printf("outfile=\"%s\"\n", cmd_info->outfile); printf("background=\"%d\"\n", cmd_info->background); } void get_cmd(char* str) { fgets(str, MAX_COMMAND_LENGTH, stdin); str[strlen(str)-1] = '\0'; //apaga o '\n' do fim } pid_t exec_simple(Command_Info *cmd_info) { pid_t pid = fork(); if (pid < 0) { perror("Fork Error"); return -1; } if (pid == 0) { execvp(cmd_info->arg[0], cmd_info->arg); perror(cmd_info->arg[0]); exit(1); } return pid; } int main(int argc, char* argv[]) { while (true) { char cmd_line[MAX_COMMAND_LENGTH]; Command_Info cmd_info; printf(">>> "); get_cmd(cmd_line); if ( (parse_cmd(cmd_line, &cmd_info) == -1) ) return -1; parse_cmd(cmd_line, &cmd_info); if (!strcmp(cmd_info.arg[0], "exit")) exit(0); pid_t pid = exec_simple(&cmd_info); waitpid(pid, NULL, 0); } return 0; } Thanks.

    Read the article

  • ColdFusion CFC implementation of C# Partial Class?

    - by Brian David Berman
    Does ColdFusion offer a mechanism for splitting CFCs into multiple files? I am NOT talking about extension, I am talking about splitting the SAME CFC into multiple files; the same way C# allows for "partial" classes. The reason for this is because I am using T4 to generate a bunch of CFCs and I want to be able to tag functionality onto the generated CFC by doing so in another file. I want to do this in a way that doesn't violate the Open-Closed Principle.

    Read the article

  • Webdriver PageObject Implementation using PageFactory in Java

    - by kamal
    here is what i have so far: A working Webdriver based Java class, which logs-in to the application and goes to a Home page: import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.testng.AssertJUnit; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class MLoginFFTest { private WebDriver driver; private String baseUrl; private String fileName = "screenshot.png"; @BeforeMethod public void setUp() throws Exception { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.http.phishy-userpass-length", 255); profile.setAssumeUntrustedCertificateIssuer(false); driver = new FirefoxDriver(profile); baseUrl = "https://a.b.c.d/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testAccountLogin() throws Exception { driver.get(baseUrl + "web/certLogon.jsp"); driver.findElement(By.name("logonName")).clear(); AssertJUnit.assertEquals(driver.findElement(By.name("logonName")) .getTagName(), "input"); AssertJUnit.assertEquals(driver.getTitle(), "DA Logon"); driver.findElement(By.name("logonName")).sendKeys("username"); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys("password"); driver.findElement(By.name("submit")).click(); driver.findElement(By.linkText("Account")).click(); AssertJUnit.assertEquals(driver.getTitle(), "View Account"); } @AfterMethod public void tearDown() throws Exception { File screenshot = ((TakesScreenshot) driver) .getScreenshotAs(OutputType.FILE); try { FileUtils.copyFile(screenshot, new File(fileName)); } catch (IOException e) { e.printStackTrace(); } driver.quit(); } } Now as we see there are 2 pages: 1. Login page, where i have to enter username and password, and homepage, where i would be taken, once the authentication succeeds. Now i want to implement this as PageObjects using Pagefactory: so i have : package com.example.pageobjects; import static com.example.setup.SeleniumDriver.getDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Wait; public abstract class MPage<T> { private static final String BASE_URL = "https://a.b.c.d/"; private static final int LOAD_TIMEOUT = 30; private static final int REFRESH_RATE = 2; public T openPage(Class<T> clazz) { T page = PageFactory.initElements(getDriver(), clazz); getDriver().get(BASE_URL + getPageUrl()); ExpectedCondition pageLoadCondition = ((MPage) page).getPageLoadCondition(); waitForPageToLoad(pageLoadCondition); return page; } private void waitForPageToLoad(ExpectedCondition pageLoadCondition) { Wait wait = new FluentWait(getDriver()) .withTimeout(LOAD_TIMEOUT, TimeUnit.SECONDS) .pollingEvery(REFRESH_RATE, TimeUnit.SECONDS); wait.until(pageLoadCondition); } /** * Provides condition when page can be considered as fully loaded. * * @return */ protected abstract ExpectedCondition getPageLoadCondition(); /** * Provides page relative URL/ * * @return */ public abstract String getPageUrl(); } And for login Page not sure how i would implement that, as well as the Test, which would call these pages.

    Read the article

  • jquery timer implementation

    - by Hulk
    All, Is there a jQuery timer which can start a timer for 20 minutes and display time elapsed? Please point me to a small code for it. var austDay = new getTime(); austDay = new getSeconds(austDay); var duration = 1200; duration += austDay; Thanks

    Read the article

  • MVC Implementation PHP Zend PDF generation

    - by zod
    Am using Zend framework and PHP Am going to generate a PDF using Zend . So the View is PDF.There is no PHTML. But if i dont use PHTML in view , is it a perfect MVC? if i want to be a perfect MVC shall i do the db retrieval and variable declaration and assigning in controller and use view and use all pdf functions in view phtml file will it make a perfect MVC? What is the advantage of MVC in this case? :-) can i do the include of zend pdf in phtml file or controller php file? what is the difference ?

    Read the article

  • java quaternion 3D rotation implementation

    - by MRM
    I made a method to rotate a list of points using quaternions, but all i get back as output is the same list i gave to rotate on. Maybe i did not understood corectly the math for 3d rotations or my code is not implemented the right way, could you give me a hand? This is the method i use: public static ArrayList<Float> rotation3D(ArrayList<Float> points, double angle, int x, int y, int z) { ArrayList<Float> newpoints = points; for (int i=0;i<points.size();i+=3) { float x_old = points.get(i).floatValue(); float y_old = points.get(i+1).floatValue(); float z_old = points.get(i+2).floatValue(); double[] initial = {1,0,0,0}; double[] total = new double[4]; double[] local = new double[4]; //components for local quaternion //w local[0] = Math.cos(0.5 * angle); //x local[1] = x * Math.sin(0.5 * angle); //y local[2] = y * Math.sin(0.5 * angle); //z local[3] = z * Math.sin(0.5 * angle); //components for final quaternion Q1*Q2 //w = w1w2 - x1x2 - y1y2 - z1z2 total[0] = local[0] * initial[0] - local[1] * initial[1] - local[2] * initial[2] - local[3] * initial[3]; //x = w1x2 + x1w2 + y1z2 - z1y2 total[1] = local[0] * initial[1] + local[1] * initial[0] + local[2] * initial[3] - local[3] * initial[2]; //y = w1y2 - x1z2 + y1w2 + z1x2 total[2] = local[0] * initial[2] - local[1] * initial[3] + local[2] * initial[0] + local[3] * initial[1]; //z = w1z2 + x1y2 - y1x2 + z1w2 total[3] = local[0] * initial[3] + local[1] * initial[2] - local[2] * initial[1] + local[3] * initial[0]; //new x,y,z of the 3d point using rotation matrix made from the final quaternion float x_new = (float)((1 - 2 * total[2] * total[2] - 2 * total[3] * total[3]) * x_old + (2 * total[1] * total[2] - 2 * total[0] * total[3]) * y_old + (2 * total[1] * total[3] + 2 * total[0] * total[2]) * z_old); float y_new = (float) ((2 * total[1] * total[2] + 2 * total[0] * total[3]) * x_old + (1 - 2 * total[1] * total[1] - 2 * total[3] * total[3]) * y_old + (2 * total[2] * total[3] + 2 * total[0] * total[1]) * z_old); float z_new = (float) ((2 * total[1] * total[3] - 2 * total[0] * total[2]) * x_old + (2 * total[2] * total[3] - 2 * total[0] * total[1]) * y_old + (1 - 2 * total[1] * total[1] - 2 * total[2] * total[2]) * z_old); newpoints.set(i, x_new); newpoints.set(i+1, y_new); newpoints.set(i+2, z_new); } return newpoints; } For rotation3D(points, 50, 0, 1, 0) where points is: 0.0, 0.0, -9.0; 0.0, 0.0, -11.0; 20.0, 0.0, -11.0; 20.0, 0.0, -9.0; i get back the same list.

    Read the article

  • Good learning resources for JNDI implementation (JBoss 5)

    - by iandisme
    I have been working with JavaEE/EJB3 web apps for about half a year now. Until recently, I haven't had to touch a lot of the behind-the-scenes stuff, just the meat of the code. I have been wrestling with JNDI problems, and though I've solved a couple of them, I'm pretty much just doing the whole cargo cult copy-paste routine. It would really help me to better understand JNDI; my understanding of it right now can be summarized as "it's that thing these classes sometimes do to find other classes." My question is, has anyone had success learning JNDI/EJB3/related topics from a book or online content? I've googled for it but the stuff that comes up is old or specific to a certain framework I'm not using. I'm looking for something that's either JBoss-specific or generic enough to be useful anyway.

    Read the article

  • Improve my Haskell implementation of Filter

    - by mvid
    I have recently been teaching myself Haskell, and one of my exercises was to re-implement the filter function. However, of all the exercises I have performed, my answer for this one seems to me the most ugly and long. How could I improve it? Are there any Haskell tricks I don't yet know? myfilter :: (a -> Bool) -> [a] -> [a] myfilter f (x:xs) = if f x then x : myfilter f xs else myfilter f xs myfilter _ [] = [] Thank You

    Read the article

  • Unit testing with Mocks. Test behaviour not implementation

    - by Kenny Eliasson
    Hi.. I always had a problem when unit testing classes that calls other classes, for example I have a class that creates a new user from a phone-number then saves it to the database and sends a SMS to the number provided. Like the code provided below. public class UserRegistrationProcess : IUserRegistration { private readonly IRepository _repository; private readonly ISmsService _smsService; public UserRegistrationProcess(IRepository repository, ISmsService smsService) { _repository = repository; _smsService = smsService; } public void Register(string phone) { var user = new User(phone); _repository.Save(user); _smsService.Send(phone, "Welcome", "Message!"); } } It is a really simple class but how would you go about and test it? At the moment im using Mocks but I dont really like it [Test] public void WhenRegistreringANewUser_TheNewUserIsSavedToTheDatabase() { var repository = new Mock<IRepository>(); var smsService = new Mock<ISmsService>(); var userRegistration = new UserRegistrationProcess(repository.Object, smsService.Object); var phone = "0768524440"; userRegistration.Register(phone); repository.Verify(x => x.Save(It.Is<User>(user => user.Phone == phone)), Times.Once()); } [Test] public void WhenRegistreringANewUser_ItWillSendANewSms() { var repository = new Mock<IRepository>(); var smsService = new Mock<ISmsService>(); var userRegistration = new UserRegistrationProcess(repository.Object, smsService.Object); var phone = "0768524440"; userRegistration.Register(phone); smsService.Verify(x => x.Send(phone, It.IsAny<string>(), It.IsAny<string>()), Times.Once()); } It feels like I am testing the wrong thing here? Any thoughts on how to make this better?

    Read the article

  • MVC and conditional formatting - strategies for implementation

    - by Extrakun
    Right now I am writing a simulation program which output is formatted according to certain factors. The question is in a MVC architecture, where is the conditional formatting to be taken place? What are some strategies for implement this feature? FYI, The platform I am using is rather bare-bone in its GUI/front-end execution. To change color and formatting, it requires a change to the formatting state (much like OpenGL).

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >