Daily Archives

Articles indexed Sunday January 9 2011

Page 19/29 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Custom Attributes on Class Members

    - by ccook
    I am using a Custom Attribute to define how a class's members are mapped to properties for posting as a form post (Payment Gateway). I have the custom attribute working just fine, and am able to get the attribute by "name", but would like to get the attribute by the member itself. For example: getFieldName("name"); vs getFieldName(obj.Name); The plan is to write a method to serialize the class with members into a postable string. Here's the test code I have at this point, where ret is a string and PropertyMapping is the custom attribute: foreach (MemberInfo i in (typeof(CustomClass)).GetMember("Name")) { foreach (object at in i.GetCustomAttributes(true)) { PropertyMapping map = at as PropertyMapping; if (map != null) { ret += map.FieldName; } } } Thanks in advance!

    Read the article

  • (C#) Label.Text = Struct.Value (Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException)

    - by Kyle
    I have an app that I'm working on that polls usage from an ISP (Download quota). I've tried threading this via 'new Thread(ThreaProc)' but that didn't work, now trying an IAsyncResult based approach which does the same thing... I've got no idea on how to rectify, please help? The need-to-know: // Global public delegate void AsyncPollData(ref POLLDATA pData); // Class scope: private POLLDATA pData; private void UpdateUsage() { AsyncPollData PollDataProc = new AsyncPollData(frmMain.PollUsage); IAsyncResult result = PollDataProc.BeginInvoke(ref pData, new AsyncCallback(UpdateDone), PollDataProc); } public void UpdateDone(IAsyncResult ar) { AsyncPollData PollDataProc = (AsyncPollData)ar.AsyncState; PollDataProc.EndInvoke(ref pData, ar); // The Exception occurs here: lblStatus.Text = pData.LastError; } public static void PollUsage(ref POLLDATA PData) { PData.LastError = "Some string"; return; }

    Read the article

  • Tracking the user function that threw the exception

    - by makerofthings7
    I've been given a large application with only one try..catch at the outer most level. This application also throws exceptions all the time, and is poorly documented. Is there any pattern I can implement that will tell me what user method is being called, the exception being thrown, and also the count of exceptions? I'm thinking of using a dictionary with reflection to get the needed information, but I'm not sure if this will work. What do you think?

    Read the article

  • How set default opened JQuery UI tab another than first

    - by user568920
    I have big web application using JQuery UI Tabs. In central JS file I have setted all tabs. Using $("#tabs").tabs; But on one page I need to have selected another tab than first. If I use $("#tabs").{ selected: add }); (name of tab is #add) Its not running, probably because Tabs are already set up. Does anyone know how to set opened another than first tab (in default state - after loading page) if tabs are already turned on? I hope, you will understand, my English is pretty terrible.

    Read the article

  • Design of std::ifstream class

    - by Nawaz
    Those of us who have seen the beauty of STL try to use it as much as possible, and also encourage others to use it wherever we see them using raw pointers and arrays. Scott Meyers have written a whole book on STL, with title Effective STL. Yet what happened to the developers of ifstream that they preferred char* over std::string. I wonder why the first parameter of ifstream::open() is of type const char*, instead of const std::string &. Please have a look at it's signature: void open(const char * filename, ios_base::openmode mode = ios_base::in ); Why this? Why not this: void open(const string & filename, ios_base::openmode mode = ios_base::in ); Is this a serious mistake with the design? Or this design is deliberate? What could be the reason? I don't see any reason why they have preferred char* over std::string. Note we could still pass char* to the latter function that takes std::string. That's not a problem! By the way, I'm aware that ifstream is a typedef, so no comment on my title.:P. It looks short that is why I used it. The actual class template is : template<class _Elem,class _Traits> class basic_ifstream;

    Read the article

  • Mercurial: can't host on BitBucket.org with an error SSH, OpenSSH?

    - by raychenon
    For a new project, I created a new repo inside the project's folder. This is the first time I see this error. Following this guide 3.6 Share the repository http://tortoisehg.bitbucket.org/manual/1.0/quick.html In destination path : https://bitbucket.org/$myaccount/$myrepo I get this: abort: cannot create new http repository [command interrupted] In command line I do the equivalent: hg push https://bitbucket.org/$myaccount/$myrepo error SSH-2.0-OpenSSH_5.3 Previously I cloned a HG project on bitbucket.org with no problem. I changed without any results in the Global Settings Proxy Host : https://bitbucket.org/$myaccount user : password :

    Read the article

  • Split a string by two characters

    - by David
    Hi, Firstable i want to match if a string has the following format: $abc #xyz or $abc .xyz. The abc and xyz mean only alphanumeric string. If it's matched then i need to extract the first $abc and the last #xyz, all that using pure javascript and maybe regex. The pattern is in the following order: Dollar Sign Unlimited alphanumeric string space a hash or point Unlimited alphanumeric string Thanks in advance for any help.

    Read the article

  • Revision Control System Recommendations

    - by Jordan Arsenault
    I've reached a point in my independent development work where I would like to start using Subversion techniques. Up to now, I've been simply making backups by exporting my current database, and zipping them together with my PHP project files. I've read some articles online and watched a video with Linus Torvalds - the general verdict seems to be that Git is in and old CVS techniques are out. I'm not currently operating under Linux, I do all PHP work out of Windows - Eclipse. Due to the fact that Eclipse runs on JVM, jumping into Linux - Eclipse will be more or less transparent - file system aside. What I would like to accomplish is being able to keep a constant revision history - But I want this to be almost entirely transparent. Also, I work in an MVC framework, and I would like to be able to release my views to Designers, and have them work from within the revision control system too. Will Egit accomplish what I need? Or is it too much overhead for a one-man workforce? What do you recommend I use so that I can keep a revision history? I also require the service to be free! Thank you all - StackOverflow ftw!

    Read the article

  • The document.body.innerHTML.replace() replaces the url in the address bar.

    - by divya
    I am trying to make an extension as part of which i want certain words in the web pages to be highlighted. The document.body.innerHTML.replace() replaces the url in the address bar as well. So the moment this code gets exwecuted the page doesnt get loaded properly.. Is there a way around this problem? onPageLoad: function(aEvent) { var doc = aEvent.originalTarget; var str="the"; var regex; var regex = new RegExp(str, "g"); doc.body.innerHTML = doc.body.innerHTML.replace(regex,'<b>'+str+'</b>'); } The listener is registered as follows in a browser.xul overlay: window.addEventListener("load", function() { myExtension.init(); }, false); var myExtension = { init: function() { var appcontent = document.getElementById("appcontent"); // browser if(appcontent) appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, false); },

    Read the article

  • Is web-browser to Excel interprocess communication possible

    - by Abiel
    Is is possible to write a browser plugin (one that requires the user to install something is OK) that would allow interprocess communication between the browser and a running instance of Excel (on Windows)? For example, suppose I want the user to be able to click something within their browser, and then have a piece of text drop into the selected cell in Excel as a result. This is certainly possible to do with a regular desktop application and Excel, but I'm not sure if it is possible with a browser, for security reasons.

    Read the article

  • url routing with strongly typed objects

    - by user510336
    hello all , I am trying to create url routing with strongly typed objects for pages but I keep getting null object on the first line so it's crashing //Getting the suitable executing Page var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath,typeof(Page)) as IProfileHandler; //Setting Page Parameters display.MemberId = Convert.ToInt32(requestContext.RouteData.Values["ID"]); //Return Page return display; public interface IProfileHandler : IHttpHandler { int MemberId { get; set; } }

    Read the article

  • Exchange 2010 domainprep messing up mailbox permissions on existing Exchange 2003 server

    - by tearman
    So our environment is basically we have an Exchange 2003 server, and we're attempting to move to Exchange 2010 gradually, and move to new hardware while we're at it. So our first step was obviously to get Exchange 2010 installed on the new box. However, after running the domainprep steps listed in http://technet.microsoft.com/en-us/library/bb125224.aspx (including PrepareLegacyExchangePermissions) our mailbox permissions get messed up. Normally, we have an AD security group for Exchange Administrators that allows anyone in that group to view all folders inside any user's mailbox. However, now, this functionality is gone and our Exchange Admins can't access anyone's mailboxes. We'd like to get this functionality back if we could. Thanks

    Read the article

  • Can't the NetworkManager applet to appear in the Gnome panel in Ubuntu

    - by Nate
    I have researched this problem extensively and I can't seem to find an answer. In Ubuntu 10.04 LTS, I want to connect to my VPN through the NetworkManager applet. I installed all the network manager packages, including the gnome client. I understand I need to add the "Notification Area" to the panel, which I have done. I checked that the NetworkManager is running: nate@nate-desktop:~$ service network-manager status network-manager start/running, process 763 In /etc/NetworkManager/nm-system-settings.conf, I have added managed=true (don't know if this matters, but I saw it suggested on one forum): nate@nate-desktop:~$ more /etc/NetworkManager/nm-system-settings.conf # This file is installed into /etc/NetworkManager, and is loaded by # NetworkManager by default. To override, specify: '--config file' # during NM startup. This can be done by appending to DAEMON_OPTS in # the file: # # /etc/default/NetworkManager # [main] plugins=ifupdown,keyfile [ifupdown] #managed=false managed=true At this point, it looks like NetworkManager is running but it's not appearing in the NotificationArea of the panel. I don't know what else to try. Any ideas?

    Read the article

  • How many connections are allowed to a Windows 7 Home Premium shared folder or printer?

    - by lcbrevard
    I have a client who runs a small business with 4 desktop systems, two of which are inexpensive [ The XP Pro system is currently being used as a file "server" for time sheets and QuickBooks data. It also shares an HP ink jet printer. The client wishes to decommission this system because (1) it's ugly [it is] and (2) it uses too much power [it does]. If we share a folder on one of the Windows 7 Home Premium systems will there be a problem connecting to it with up to 3 other computers? What about the printer sharing? I vaguely remember seeing that Windows 7 is less usable for "server" purposes and has severe restrictions on the number of clients. But I cannot seem to find those numbers. In my own network (over 12 systems) we have no problem sharing from Windows 7 Ultimate to a few other systems where needed. I am embarrassed that I cannot seem to find the answer to this in a couple of days of searching. I can do an anytime upgrade of one of these systems to Pro if that would improve the ability to share from it. I am not able to convince the client to put a "real server" into their network.

    Read the article

  • Can I use stronger power supply to charge Kindle? [closed]

    - by Bobb
    I have power supply for Kindle with output 5V 0.85A. And I have Samsung Galaxy Pad one with output of 5V 2A. My guess is that a device will consume as much current as it can but no more than max power supply current. For example if Kindle device consumes 0.6A for charging its battery then it shouldnt create more than 0.6A current using Galaxy Pad power supply. So my guess - if I charge Kindle with Galaxy Pad power supply it wont burn out. Is that right?

    Read the article

  • Run Explorer in SYSTEM account on Windows Vista or 7 using Sysinternal’s psexec tool?

    - by Rob
    Has anyone been successful at launching an instance of Windows Explorer in the SYSTEM account on Windows Vista or 7? It is possible to do this on XP, but I haven't been able to get it to completely work in Vista or 7. Trying to launch Explorer as SYSTEM into session 1 (my user session) results in Explorer exiting immediately and returning an error code of 1. I can launch Explorer as SYSTEM into session 0 with the following command: psexec -i 0 -s explorer That will create an instance of explorer running as SYSTEM with a taskbar and start menu on the hidden session 0 desktop, but won't let you open a file browser window. If you switch to the hidden session 0 desktop and try to open an Explorer window from there to browse files, the following error message appears: "The server process could not be started because the configured identity is incorrect. Check the username and password." I have set the following registry key to 1 for my user account and the SYSTEM account: \Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\SeparateProcess There has got to be a way to make this work? If it is not possible, can anyone explain why? -Rob

    Read the article

  • Mail Merge in Microsoft Word with images from Sharepoint

    - by Ian Turner
    Is there any way of doing a Mail Merge in Microsoft Word 2007 taking data, including images from a Sharepoint site? It's a bit crude, but I've managed to merge text by taking the data off the sharepoint site as an Excel sheet and then merging that. My problem is what to do with the images. I can set references to the images up in the Sharepoint site, however all I can find is a way of Mail Merging when images are in the same folder as the document you are trying to Merge and I can't find a sensible automated way to pulls these images together into one single folder.

    Read the article

  • I have my best computer ideas while sitting in church. You? [closed]

    - by Rolnik
    At the risk of posing a subjective question... Where/when are you when you come up with your best ideas? How do you enter that 'zen' state? Yes... necessarily these have to be computer ideas and not new ideas how to make waffles (unless it involves a CPU). Some kinds of ideas include: New software project; better way to organize data; What would look slick on the internet; How to break into the Coka-Cola mainframe and steal the Coke formula (just kidding) How about it. How/when do you get a load of inspiration/insight?

    Read the article

  • How string accepting interface should look like?

    - by ybungalobill
    Hello, This is a follow up of this question. Suppose I write a C++ interface that accepts or returns a const string. I can use a const char* zero-terminated string: void f(const char* str); // (1) The other way would be to use an std::string: void f(const string& str); // (2) It's also possible to write an overload and accept both: void f(const char* str); // (3) void f(const string& str); Or even a template in conjunction with boost string algorithms: template<class Range> void f(const Range& str); // (4) My thoughts are: (1) is not C++ish and may be less efficient when subsequent operations may need to know the string length. (2) is bad because now f("long very long C string"); invokes a construction of std::string which involves a heap allocation. If f uses that string just to pass it to some low-level interface that expects a C-string (like fopen) then it is just a waste of resources. (3) causes code duplication. Although one f can call the other depending on what is the most efficient implementation. However we can't overload based on return type, like in case of std::exception::what() that returns a const char*. (4) doesn't work with separate compilation and may cause even larger code bloat. Choosing between (1) and (2) based on what's needed by the implementation is, well, leaking an implementation detail to the interface. The question is: what is the preffered way? Is there any single guideline I can follow? What's your experience?

    Read the article

  • Database Programming in C#, returning output from Stored Proc

    - by jpavlov
    I am working at gaining an understanding at how to interface stored procedures with applications. My example is simple, but it doesn't display my columns and rows in the command prompt, instead it display System.Data.SqlClient.SqlDataReader. How do I display the rows from my stored procudure? ----Stored Proc-- ALTER PROCEDURE dbo.SelectID AS SELECT * FROM tb_User; ----- Below is the code: using System; using System.Data.SqlClient; using System.IO; namespace ExecuteStoredProc { class Program { static void Main(string[] args) { SqlConnection cnnUserMan; SqlCommand cmmUser; //SqlDataReader drdUser; //Instantiate and open the connection cnnUserMan = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\UserDB.mdf; Integrated Security=True;Connect Timeout=30;User Instance=True"); cnnUserMan.Open(); //Instantiate and initialize command cmmUser = new SqlCommand("SelectID", cnnUserMan); cmmUser.CommandType = System.Data.CommandType.StoredProcedure; //drdUser = cmmUser.ExecuteReader(); Console.WriteLine(cmmUser.ExecuteReader()); Console.ReadLine(); } } } Thanks.

    Read the article

  • Making IE "forget" information entered in form when using back button.

    - by typoknig
    I have a page with a form where many of the fields are populated from variables passed in the URL. Those fields are disabled (NON-EDITABLE) and are only there for the user to view. The remaining fields require user input and are NOT disabled (EDITABLE). When the form is submitted a confirmation page comes up. It may be the case that the user needs to submit several of these forms where the NON-EDITABLE information is identical from form to form, so being able to go back to the form page from the confirmation page would save a lot of time. The way I want this to work is when a user presses the back button all the NON-EDITABLE fields are populated, but the EDITABLE fields are blank. This is what Firefox is doing, but IE8 is does not "forget" what has been entered in the EDITABLE fields. To disable the cache the following appears at the beginning of my page AND at the end of my page. <head> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Cache-Control" content="no-store"/> <head/> What more must I do to make IE forget what was entered in the EDITABLE fields when the back button is pressed? All of my pages are generated with PHP if that matters. EDIT: It appears to me that this is a problem of IE caching my page even though I have told it not to. Are my meta tags correct? Do I need to do something else to prevent IE from caching my page?

    Read the article

  • Load remote csv into CHCSVParser

    - by Matt
    Hey guys. I'm using Dave DeLong's CHCSVParser to parse a csv. I can parse the csv locally, but I cannot get it load a remote csv file. I have been staring at my MacBook way too long today and the answer is right in front of me. Here's my code: NSString *urlStr = [[NSString alloc] initWithFormat:@"http://www.somewhere.com/LunchSpecials.csv"]; NSURL *lunchFileURL = [NSURL URLWithString:urlStr]; NSStringEncoding encoding = 0; CHCSVParser *p = [[CHCSVParser alloc] initWithContentsOfCSVFile:[lunchFileURL path] usedEncoding:&encoding error:nil]; [p setParserDelegate:self]; [p parse]; [p release]; Thanks for any help that someone can give me.

    Read the article

  • Threaded Python port scanner

    - by Amnite
    I am having issues with a port scanner I'm editing to use threads. This is the basics for the original code: for i in range(0, 2000): s = socket(AF_INET, SOCK_STREAM) result = s.connect_ex((TargetIP, i)) if(result == 0) : c = "Port %d: OPEN\n" % (i,) s.close() This takes approx 33 minutes to complete. So I thought I'd thread it to make it run a little faster. This is my first threading project so it's nothing too extreme, but I've ran the following code for about an hour and get no exceptions yet no output. Am I just doing the threading wrong or what? import threading from socket import * import time a = 0 b = 0 c = "" d = "" def ScanLow(): global a global c for i in range(0, 1000): s = socket(AF_INET, SOCK_STREAM) result = s.connect_ex((TargetIP, i)) if(result == 0) : c = "Port %d: OPEN\n" % (i,) s.close() a += 1 def ScanHigh(): global b global d for i in range(1001, 2000): s = socket(AF_INET, SOCK_STREAM) result = s.connect_ex((TargetIP, i)) if(result == 0) : d = "Port %d: OPEN\n" % (i,) s.close() b += 1 Target = raw_input("Enter Host To Scan:") TargetIP = gethostbyname(Target) print "Start Scan On Host ", TargetIP Start = time.time() threading.Thread(target = ScanLow).start() threading.Thread(target = ScanHigh).start() e = a + b while e < 2000: f = raw_input() End = time.time() - Start print c print d print End g = raw_input()

    Read the article

  • Problem with pointer copy in C

    - by Stefano Salati
    I radically re-edited the question to explain better my application, as the xample I made up wasn't correct in many ways as you pointed out: I have one pointer to char and I want to copy it to another pointer and then add a NULL character at the end (in my real application, the first string is a const, so I cannot jsut modify it, that's why I need to copy it). I have this function, "MLSLSerialWriteBurst" which I have to fill with some code adapt to my microcontroller. tMLError MLSLSerialWriteBurst( unsigned char slaveAddr, unsigned char registerAddr, unsigned short length, const unsigned char *data ) { unsigned char *tmp_data; tmp_data = data; *(tmp_data+length) = NULL; // this function takes a tmp_data which is a char* terminated with a NULL character ('\0') if(EEPageWrite2(slaveAddr,registerAddr,tmp_data)==0) return ML_SUCCESS; else return ML_ERROR; } I see there's a problem here: tha fact that I do not initialize tmp_data, but I cannot know it's length.

    Read the article

  • JavaScript onchange, onblur, and focus weirdness in Firefox

    - by typoknig
    On my form I have a discount field that accepts a dollar amount to be taken off of the total bill (HTML generated in PHP): echo "<input id=\"discount\" class=\"text\" type=\"text\" name=\"discount\" onkeypress=\"return currency(this, event)\" onchange=\"currency_format(this)\" onfocus=\"on_focus(this)\" onblur=\"on_blur(this); calculate_bill()\"/><br/><br/>\n"; The JavaScript function calculate_bill calculates the bill and takes off the discount amount as long as the discount amount is less than the total bill: if(discount != ''){ if(discount - 0.01 > total_bill){ window.alert('Discount Cannot Be Greater Than Total Bill'); document.form.discount.focus(); } else{ total_bill -= discount; } } The problem is that even that when the discount is more than the total bill focus is not being returned to the discount field. I have tried calling the calculate_bill function with onchange but neither IE or Firefox will return focus to the discount field when I do it like that. When I call calculate_bill with onblur it works in IE, but still does not work in Firefox. I have attempted to use a confirmation box instead of an alert box as well, but that didn't work either (plus I don't want two buttons, I only an "OK" button). How can I ensure focus is returned to the discount field after a user has left that field by clicking on another field or tabbing IF the discount amount is larger than the total bill?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >