Search Results

Search found 912 results on 37 pages for 'sarah boss'.

Page 10/37 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • DRYing out implementation of ICloneable in several classes

    - by Sarah Vessels
    I have several different classes that I want to be cloneable: GenericRow, GenericRows, ParticularRow, and ParticularRows. There is the following class hierarchy: GenericRow is the parent of ParticularRow, and GenericRows is the parent of ParticularRows. Each class implements ICloneable because I want to be able to create deep copies of instances of each. I find myself writing the exact same code for Clone() in each class: object ICloneable.Clone() { object clone; using (var stream = new MemoryStream()) { var formatter = new BinaryFormatter(); // Serialize this object formatter.Serialize(stream, this); stream.Position = 0; // Deserialize to another object clone = formatter.Deserialize(stream); } return clone; } I then provide a convenience wrapper method, for example in GenericRows: public GenericRows Clone() { return (GenericRows)((ICloneable)this).Clone(); } I am fine with the convenience wrapper methods looking about the same in each class because it's very little code and it does differ from class to class by return type, cast, etc. However, ICloneable.Clone() is identical in all four classes. Can I abstract this somehow so it is only defined in one place? My concern was that if I made some utility class/object extension method, it would not correctly make a deep copy of the particular instance I want copied. Is this a good idea anyway?

    Read the article

  • request payload versus query string parameters

    - by Sarah Sides
    I am absolutely in the dark when it comes to this request payload that I'm seeing in my Chrome browser. A Query string will have a variable attached like session:2g0SoEE but this payload has just one long string I'm guessing is in base64. I do understand that the request payload can have whatever, but how do I use it? Can I do a post with jquery and send this request payload? For example: $.post(url, {variable: "variable"}, function(data){}); When this posts it will send &variable=variable this will be found as query string parameter in the headers sent in chrome. In this game I'm playing I see another piece of info being sending in the header called a payload request. I'm a confused as to how this is read, used, made, how I can reduplicate this? Here is something similar: Chrome is caching an HTTP PUT request and How to retrieve Request Payload

    Read the article

  • How to Detect in Windows Registry if user has .Net Framework installed?

    - by Sarah Weinberger
    How do I detect in the Windows Registry if a user has .Net Framework installed? I am not looking for a .Net based solution, as the query is from InnoSetup. I know from reading another post here on Stack Overflow that .Net Framework is an inplace upgrade to 4.0. I already know how to check if a user has version 4.0 installed on the system, namely by checking the following: function FindFramework(): Boolean; var bVer4x0: Boolean; bVer4x0Client: Boolean; bVer4x0Full: Boolean; bSuccess: Boolean; iInstalled: Cardinal; begin Result := False; bVer4x0Client := False; bVer4x0Full := False; bVer4x0 := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0'); bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4 \Client', 'Install', iInstalled); if (1 = iInstalled) AND (True = bSuccess) then bVer4x0Client := True; bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4 \Full', 'Install', iInstalled); if (1 = iInstalled) AND (True = bSuccess) then bVer4x0Full := True; if (True = bVer4x0Full) then begin Result := True; end; end; I checked the registry and there is no v4.5 folder, which makes sense if .Net Framework 4.5 is an inplace upgrade. Still, the Control Panel Programs and Features includes the listing. I know that probably "issuing dotNetFx45_Full_setup.exe /q" will have no bad effect if installing on a system that already has version 4.5, but I still would like to not install the upgrade if the upgrade already exists, faster and less problems.

    Read the article

  • sql query not executing

    - by sarah
    Hi, Not able to execute a query ,i need to check if end date is greater than today in the following query Getting an error invalid query select * from table1 where user in ('a') and END_DATE >'2010-05-22' getting an error liter string does not match

    Read the article

  • Help me clean up this crazy lambda with the out keyword

    - by Sarah Vessels
    My code looks ugly, and I know there's got to be a better way of doing what I'm doing: private delegate string doStuff( PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt ); private bool tryEncryptPassword( doStuff encryptPassword, out string errorMessage ) { ...get some variables... string encryptedPassword = encryptPassword(encrypter, publicKey, privateKey, out salt); ... } This stuff so far doesn't bother me. It's how I'm calling tryEncryptPassword that looks so ugly, and has duplication because I call it from two methods: public bool method1(out string errorMessage) { string rawPassword = "foo"; return tryEncryptPassword( (PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt) => encrypter.EncryptPasswordAndDoStuff( // Overload 1 rawPassword, publicKey, privateKey, out salt ), out errorMessage ); } public bool method2(SecureString unencryptedPassword, out string errorMessage) { return tryEncryptPassword( (PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt) => encrypter.EncryptPasswordAndDoStuff( // Overload 2 unencryptedPassword, publicKey, privateKey, out salt ), out errorMessage ); } Two parts to the ugliness: I have to explicitly list all the parameter types in the lambda expression because of the single out parameter. The two overloads of EncryptPasswordAndDoStuff take all the same parameters except for the first parameter, which can either be a string or a SecureString. So method1 and method2 are pretty much identical, they just call different overloads of EncryptPasswordAndDoStuff. Any suggestions? Edit: if I apply Jeff's suggestions, I do the following call in method1: return tryEncryptPassword( (encrypter, publicKey, privateKey) => { var result = new EncryptionResult(); string salt; result.EncryptedValue = encrypter.EncryptPasswordAndDoStuff( rawPassword, publicKey, privateKey, out salt ); result.Salt = salt; return result; }, out errorMessage ); Much the same call is made in method2, just with a different first value to EncryptPasswordAndDoStuff. This is an improvement, but it still seems like a lot of duplicated code.

    Read the article

  • how to deal with pdf annotation with ipad in objective c?

    - by Sarah
    Hello, I know that it may sound a silly question but i am really very confused. I am to work with one application that is having operations like PDF loading,annotation, scrolling,zooming and other such functions. Now my question is that i am little bit confused about what template i should use as i went through Quartz 2D Programming Guide and was little bit confused whether i'll be able to apply the above shown functions with the same guideline,as it displays the pdf page on the whole screen. Or is there any other way around? Please help me..Can i use UIWebView for the same functions as i listed above? I ll be grateful if you can help me. Thank you.

    Read the article

  • should I include VB macros in source control with my project?

    - by Sarah Vessels
    For a C# project, I make use of several Visual Basic macros in Visual Studio. I was just considering that these would be of use to other developers that work on the C# project. The macros so far include removing trailing whitespace on save, organizing using directives and removing unnecessary ones, and an override for Ctrl-M Ctrl-O that expands regions. Would it be reasonable for me to include this macro code with my C# project in Subversion? I don't know if it's even possible for macros to be made available/work in Visual Studio just because you open a particular Solution file, and that might be too invasive since some of the macros override existing VS behavior.

    Read the article

  • How would you start automating my job?

    - by Jurily
    At my new job, we sell imported stuff. In order to be able to sell said stuff, currently the following things need to happen for every incoming shipment: Invoice arrives, in the form of an email attachment, Excel spreadsheet Monkey opens invoice, copy-pastes the relevant part of three columns into the relevant parts of a spreadsheet template, where extremely complex calculations happen, like =B2*550 Monkey sends this new spreadsheet to boss (email if lucky, printer otherwise), who sets the retail price Monkey opens the reply, then proceeds to input the data into the production database using a client program that is unusable on so many levels it's not even worth detailing Monkey fires up HyperTerminal, types in "AT", disconnect Monkey sends text messages and emails to customers using another part of the horrible client program, one at a time I want to change Monkey from myself to software wherever possible. I've never written anything that interfaces with email, Excel, databases or SMS before, but I'd be more than happy to learn if it saves me from this. Here's my uneducated wishlist: Monkey asks Thunderbird (mail server perhaps?) for the attachment Monkey tells Excel to dump the spreadsheet into a more Jurily-friendly format, like CSV or something Monkey parses the output, does the complex calculations // TODO: find a way to get the boss-generated prices with minimal manual labor involved Monkey connects to the database, inserts data Monkey spams costumers Is all this feasible? If yes, where do I start reading? How would you improve it? What language/framework do you think would be ideal for this? What would you do about the boss?

    Read the article

  • How to prevent hotlinking of flv files?

    - by Sarah
    How to, using PHP and/or .htaccess prevent hotlinking? There's a site, which is allowed to access the flv files located on my server, however I've noticed that there are many requests from other domains as well... Here's the actual rule: RewriteCond %{HTTP_REFERER} !^http://alloweddomain.com/.*$ [NC] RewriteRule .flv denied.php [NC,L] It's working OK except for Firefox, because FF is not sending referrer info when accessing .flv files...

    Read the article

  • Coordinating typedefs and structs in std::multiset (C++)

    - by Sarah
    I'm not a professional programmer, so please don't hesitate to state the obvious. My goal is to use a std::multiset container (typedef EventMultiSet) called currentEvents to organize a list of structs, of type Event, and to have members of class Host occasionally add new Event structs to currentEvents. The structs are supposed to be sorted by one of their members, time. I am not sure how much of what I am trying to do is legal; the g++ compiler reports (in "Host.h") "error: 'EventMultiSet' has not been declared." Here's what I'm doing: // Event.h struct Event { public: bool operator < ( const Event & rhs ) const { return ( time < rhs.time ); } double time; int eventID; int hostID; }; // Host.h ... void calcLifeHist( double, EventMultiSet * ); // produces compiler error ... void addEvent( double, int, int, EventMultiSet * ); // produces compiler error // Host.cpp #include "Event.h" ... // main.cpp #include "Event.h" ... typedef std::multiset< Event, std::less< Event > > EventMultiSet; EventMultiSet currentEvents; EventMultiSet * cePtr = &currentEvents; ... Major questions Where should I include the EventMultiSet typedef? Are my EventMultiSet pointers obviously problematic? Is the compare function within my Event struct (in theory) okay? Thank you very much in advance.

    Read the article

  • handling multiple buttons in a form in struts

    - by sarah
    Hi All, I am facing an issue while handling multiple buttons in a form using struts. I have three buttons add,delete and go .I have made forward as hidden and on click of a button i would get the name of the button. The problem is with go button on click of that i want to call a javascript and then call the action and return to the same page .

    Read the article

  • nullable type and a ReSharper warning

    - by Sarah Vessels
    I have the following code: private static LogLevel? _logLevel = null; public static LogLevel LogLevel { get { if (!_logLevel.HasValue) { _logLevel = readLogLevelFromFile(); } return _logLevel.Value; } } private static LogLevel readLogLevelFromFile() { ... } I get a ReSharper warning on the return statement about a possible System.InvalidOperationException and it suggests I check _logLevel to see if it is null first. However, readLogLevelFromFile returns LogLevel, not LogLevel?, so there is no way the return statement could be reached when _logLevel is null. Is this just an oversight by ReSharper, or am I missing something?

    Read the article

  • Getting a PasteScript error when I try to serve an existing Pylons app.

    - by Sarah
    I'm trying to serve an existing Python 2.5 Pylons application on OS X Snow Leopard. I've already installed Python 2.5 and set it as the default Python installation, installed paster, and installed the version of Pylons the app needs (0.9.6.1) as well as other eggs... but when I cd to the main folder and do "paster serve development.ini" I get the following: File "/usr/local/bin/paster", line 5, in <module> from pkg_resources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2603, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 666, in require File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 565, in resolve pkg_resources.DistributionNotFound: PasteScript==1.7.3 I definitely have done "easy_install PasteScript==1.7.3" and I still get this error. Is there something really obvious I'm missing? Help? Thanks in advance.

    Read the article

  • using yield in C# like I would in Ruby

    - by Sarah Vessels
    Besides just using yield for iterators in Ruby, I also use it to pass control briefly back to the caller before resuming control in the called method. What I want to do in C# is similar. In a test class, I want to get a connection instance, create another variable instance that uses that connection, then pass the variable to the calling method so it can be fiddled with. I then want control to return to the called method so that the connection can be disposed. I guess I'm wanting a block/closure like in Ruby. Here's the general idea: private static MyThing getThing() { using (var connection = new Connection()) { yield return new MyThing(connection); } } [TestMethod] public void MyTest1() { // call getThing(), use yielded MyThing, control returns to getThing() // for disposal } [TestMethod] public void MyTest2() { // call getThing(), use yielded MyThing, control returns to getThing() // for disposal } ... This doesn't work in C#; ReSharper tells me that the body of getThing cannot be an iterator block because MyThing is not an iterator interface type. That's definitely true, but I don't want to iterate through some list. I'm guessing I shouldn't use yield if I'm not working with iterators. Any idea how I can achieve this block/closure thing in C# so I don't have to wrap my code in MyTest1, MyTest2, ... with the code in getThing()'s body?

    Read the article

  • hql query formation

    - by sarah
    Hi I want to construt a hql query like select PLAN_ID from "GPIL_DB"."ROUTE_PLAN" where ASSIGNED_TO in ('prav','sheet') and END_DATE > todays date I am doing in this way but getting an error in setting parameters s=('a','b'); Query q = getSession().createQuery("select planId from RoutePlan where assignedTo in REG "); if(selUsers != null) { q.setParameter("REG", s); } where i am doing wrong?

    Read the article

  • scanf a byte then print it out?

    - by Sarah
    I've searched around to see if I can find this answer but I can't seem to (please let me know if I'm wrong). I am trying to use scanf to read in a byte, an unsigned int and a char in one .c file and I am trying to access this byte in a different .c file and print it out. (I have already checked to make sure I have included all the appropriate parameters everywhere) But I keep getting errors. The warnings are: database.c: In function ‘addCitizen’: database.c:23:2: warning: format ‘%hhu’ expects argument of type ‘int’, but argument 2 has type ‘byte *’ [-Wformat] database.c:24:2: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘int *’ [-Wformat] database.c:25:2: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat] where I'm scanf'ing: // Request loop while (count-- != 0) { while (1){ // Get values from the user int error = scanf ("%79s %hhu %u %c", tname, &tdist, &tyear, &tgender); addCitizen(db, tname, &tdist, &tyear, &tgender); where I'm printing: void addCitizen(Database *db, char *tname, byte *tdist, int *tyear, char *tgender){ //needs to find the right place in memory to put this stuff and then put it there printf("\nName is: %79s\n", tname); printf("District is: %hhu\n", tdist); printf("Year of birth is: %u\n", tyear); printf("Gender is:%c\n", tgender); I'm not sure where I'm going wrong?

    Read the article

  • query on display tag

    - by sarah
    Hi, I have the following code to display <display:table name="sessionScope.userList" id="userList" export="false" pagesize="1"> <display:column title="Select" style="width: 90px;"> <input type="checkbox" name="optionSelected" value=""/> </display:column> <display:column property="userName" sortable="false" title="UserName" paramId="userName" style="width: 150px; text-align:center" href="#"/> </display:table> On click of the checkbox i need to get the corresponding row value that is the username how would i get that?

    Read the article

  • how to get the image position from pdf file in objective c?

    - by Sarah
    Hello, I am doing something like extracting the pdf text in a string format so as to annotate the text and in the same process i need to find the image positions covered in the same pdf file so as to maintain its position. Now the problem is that i am not getting the exact positions of the images in the same pdf file. Is it possible to use some thing like OCR,if yes,how to use that? Can anybody help me in finding the exact position of the image in the pdf file? I need to implement some pdf reader kind of application for ipad,that's just for the knowledge. Thank you.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >