Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 212/448 | < Previous Page | 208 209 210 211 212 213 214 215 216 217 218 219  | Next Page >

  • Partial generic type inference possible in C#?

    - by Lasse V. Karlsen
    I am working on rewriting my fluent interface for my IoC class library, and when I refactored some code in order to share some common functionality through a base class, I hit upon a snag. Note: This is something I want to do, not something I have to do. If I have to make do with a different syntax, I will, but if anyone has an idea on how to make my code compile the way I want it, it would be most welcome. I want some extension methods to be available for a specific base-class, and these methods should be generic, with one generic type, related to an argument to the method, but the methods should also return a specific type related to the particular descendant they're invoked upon. Better with a code example than the above description methinks. Here's a simple and complete example of what doesn't work: using System; namespace ConsoleApplication16 { public class ParameterizedRegistrationBase { } public class ConcreteTypeRegistration : ParameterizedRegistrationBase { public void SomethingConcrete() { } } public class DelegateRegistration : ParameterizedRegistrationBase { public void SomethingDelegated() { } } public static class Extensions { public static ParameterizedRegistrationBase Parameter<T>( this ParameterizedRegistrationBase p, string name, T value) { return p; } } class Program { static void Main(string[] args) { ConcreteTypeRegistration ct = new ConcreteTypeRegistration(); ct .Parameter<int>("age", 20) .SomethingConcrete(); // <-- this is not available DelegateRegistration del = new DelegateRegistration(); del .Parameter<int>("age", 20) .SomethingDelegated(); // <-- neither is this } } } If you compile this, you'll get: 'ConsoleApplication16.ParameterizedRegistrationBase' does not contain a definition for 'SomethingConcrete' and no extension method 'SomethingConcrete'... 'ConsoleApplication16.ParameterizedRegistrationBase' does not contain a definition for 'SomethingDelegated' and no extension method 'SomethingDelegated'... What I want is for the extension method (Parameter<T>) to be able to be invoked on both ConcreteTypeRegistration and DelegateRegistration, and in both cases the return type should match the type the extension was invoked on. The problem is as follows: I would like to write: ct.Parameter<string>("name", "Lasse") ^------^ notice only one generic argument but also that Parameter<T> returns an object of the same type it was invoked on, which means: ct.Parameter<string>("name", "Lasse").SomethingConcrete(); ^ ^-------+-------^ | | +---------------------------------------------+ .SomethingConcrete comes from the object in "ct" which in this case is of type ConcreteTypeRegistration Is there any way I can trick the compiler into making this leap for me? If I add two generic type arguments to the Parameter method, type inference forces me to either provide both, or none, which means this: public static TReg Parameter<TReg, T>( this TReg p, string name, T value) where TReg : ParameterizedRegistrationBase gives me this: Using the generic method 'ConsoleApplication16.Extensions.Parameter<TReg,T>(TReg, string, T)' requires 2 type arguments Using the generic method 'ConsoleApplication16.Extensions.Parameter<TReg,T>(TReg, string, T)' requires 2 type arguments Which is just as bad. I can easily restructure the classes, or even make the methods non-extension-methods by introducing them into the hierarchy, but my question is if I can avoid having to duplicate the methods for the two descendants, and in some way declare them only once, for the base class. Let me rephrase that. Is there a way to change the classes in the first code example above, so that the syntax in the Main-method can be kept, without duplicating the methods in question? The code will have to be compatible with both C# 3.0 and 4.0. Edit: The reason I'd rather not leave both generic type arguments to inference is that for some services, I want to specify a parameter value for a constructor parameter that is of one type, but pass in a value that is a descendant. For the moment, matching of specified argument values and the correct constructor to call is done using both the name and the type of the argument. Let me give an example: ServiceContainerBuilder.Register<ISomeService>(r => r .From(f => f.ConcreteType<FileService>(ct => ct .Parameter<Stream>("source", new FileStream(...))))); ^--+---^ ^---+----^ | | | +- has to be a descendant of Stream | +- has to match constructor of FileService If I leave both to type inference, the parameter type will be FileStream, not Stream.

    Read the article

  • "custom" routers for VPN - useful or waste of money?

    - by Andrew Heath
    I use VPN in China and my current service contract expires soon so I was checking what sort of plans are out there now. I found that Witopia offers a "Cloak Box", what appears to be a Linksys wireless router with allegedly hacked/custom firmware to support VPN. Aside from allowing multiple computers to share one VPN connection, is there anything else at work here to justify that price when most new routers are $100 or less these days? Or is this something targeted towards the cd-rom cupholder crowd? And yes, I've contacted them, but haven't heard back yet... EDIT I've heard back from the company - here are the details if anyone else is interested: the router is a Linksys WRT54GL running TomatoVPN custom firmware the hardware waranty is one (1) year, from Linksys/Cisco the VPN is hard-set, so any device connected to the router MUST use the VPN (Witopia blocks torrents) I've decided it's not for me, but hopefully this information will prove useful to others.

    Read the article

  • Apache repeatedly crashing in OS X 10.6.5

    - by ltackett
    I want to be using the system default Apache available through Web Sharing, not MAMP. Other questions/answers related to similar problems have not helped. Initially, I had MAMP running, but I stopped it because I thought it might be causing a conflict, that didn't work. I also had an issue with apachectl related to the 10.6.5 update, which I fixed. Apachectl reports no syntax errors and seems to be working fine to start|stop|restart apache. Here are the errors that repeat. 12/29/10 11:53:28 AM Firewall[63] httpd is listening from ::ffff:0.0.0.0:80 proto=6 12/29/10 11:53:29 AM com.apple.launchd[1] (org.apache.httpd[8618]) Exited with exit code: 1 12/29/10 11:53:29 AM com.apple.launchd[1] (org.apache.httpd) Throttling respawn: Will start in 10 seconds This is not my area of expertise, so I hope that's enough info to go by.

    Read the article

  • Windows unrecoverable error wouldn't come out of Hibernate

    - by JohnB
    Out of curiosity... I was in a rush: I put my laptop into Hibernate (I don't keep a battery in it btw) Leaned it against a box in the laundry room Smooth tile floor means bottom of laptop slide out and laptop feel flat against floor, not super hard, but it wasn't carpeting so.. Next time I booted my laptop, I received this error for the first time ever: (not an exact quote) Windows experienced an unrecoverable error and cannot come out of Hibernate. Windows is restarting now After that, my laptop seemed to operate flawlessly. What do you think happened? Jared the electronics? I'm guessing an error like this would result of some sort of hard drive trauma, but fortunately, I have discovered none so far. I scheduled Error-checking for next restart.

    Read the article

  • Dump output from REPL

    - by Ankit Soni
    I'm writing SML programs, and I'd like a way to quickly see the output from running a program in the REPL without actually running the REPL (to quickly see if a program has syntax errors - I plan to use this as a make program for .sml files in vim to view the output inside vim).. Currently, I have this: sml file.sml | echo -e "\004" So it runs the program, and then echoes Ctrl-D to exit the REPL. The problem is that its too quick to send the Ctrl-D key, so there is no output. I tried this too: sml file.sml | sleep 2 ; echo -e "\004" But that isn't doing it either. Any ideas on how I can get a dump of the output from the REPL?

    Read the article

  • good free OCR with GUI for correcting errors (for Windows)

    - by Hugh Allen
    I've used SimpleOCR, which has a nice GUI for correcting errors. Unfortunately it makes a lot of errors! (and suffers other bugs and limitations) On the other hand Tesseract is more accurate but has no GUI at all. Is there a free OCR program for Windows which has a nice GUI and a low error rate? I want it to highlight suspect words (by OCR uncertainty, not just spell checking) and show the original (bitmap) word while I'm editing the OCRed word similar to what SimpleOCR does: Open-source would be best, followed by freeware, then trial / crippleware a long way behind.

    Read the article

  • Web Application Vulnerability Scanner suggestions?

    - by Chris_K
    I'm looking for a new tool for the ol' admin toolkit and would value some suggestions. I would like to do some "automated" testing of handful of websites for XSS (cross site scripting) vulns, along with checking for SQL injection opportunities. I realize that an automated tool approach isn't necessarily the only or best solution, but I'm hoping it would give me a nice start. The sites I need to scan cover the range in stacks from PHP / MySQL to Coldfusion, with some classic ASP and ASP.NET mixed in for good measure. What tools would you use to scan for Web application vulns? (Please note I'm focusing on the web apps directly, not the servers themselves).

    Read the article

  • pthread-stubs for CentOS

    - by Rodnower
    Hello, I try to install Mesa 7.8 for CentOS 5. During installation of Mesa I required to install librdm, and during librdm (v. 2.4.19) installing I got error about missing pthread-stubs: checking for PTHREADSTUBS... configure: error: Package requirements (pthread-stubs) were not met: When I try: yum provides *pthread-stubs* I get nothing In other place I found that libxcb-devel is what I need, but yum not find this too. During searching in Google, I found rpm's for Fedora only. Any one know whether there is some packege which provides pthread-stubs for CentOS, or other, less expensive way to install Mesa? Thank you for ahead.

    Read the article

  • Missing APR on apache2 ./configure

    - by arby
    I want to build the latest stable version of apache2. I downloaded the source and put APR & APR-util in the srclib folder, then changed directories to ./srclib/apr and ran: ./configure --prefix=/usr/local/apr sudo make sudo make install This seemed to install APR ok, but when I run ./configure from the apr-util directory, I receive the error: configure: error: APR could not be located. Please use the --with-apr option. Using ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr, the error becomes: checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file. Why can't it find APR?

    Read the article

  • Use inotifywait and lftp to synchronize servers

    - by KBoek
    I have two servers: Server A (CentOS), where people can upload files to (upload root is /files) Server B (Win 2008), with FileZilla FTP Server (FTP root is C:\content) I want that whenever a file is uploaded to Server A, to any subfolder under /files, the file is automatically copied to the exact same subfolder on Server B. Thus, if a user uploads "flowers.jpg" to /files/photos/12345/ then the file must be copied over FTP to C:\content\photos\12345 So far I have this bash script, it does copy the files to server B, but all files are placed in C:\content, and not in the corresponding subfolders. Who can help me find the correct syntax? #!/bin/bash cd /files inotifywait -q -r -m -e close_write,moved_to . --format %w%f | while read FILE; do lftp -e "put $FILE; exit" -u user,password -p 2121 ftp.server-a.com done

    Read the article

  • Music but no voices on headphones

    - by TheEmeritus
    I have a laptop with Windows 7 and I have headphones for a couple of months, and only recently they started to play only the music, while the voices are there, but just very faint. I tried to connect them to another computer (PC, windows XP) and they worked fine, which made me think the problem isn't with the headphones but with the laptop. I've searched online and found a few solutions, none of the seemed to work. Such as: plugging in and out my jack until you can hear better, checking the headphones on other computers. Other relevant info: The headphones come with a mic if I right click the sound icon - sound devices. Then I dont see any 'headphones', not even if I tell it to show disabled devices. All I see is a 'speakers' icon, yet it's there even if the headphones are disconnected, and is always active. So if anyone has any idea I'd appreciate it :) Thanks!

    Read the article

  • Metacity toggle fullscreen not working under Lucid; worked with Karmic.

    - by Andy
    Hi all, I'm working on a 11" screen, so I frequently want to use applications in fullscreen. I'm no expert on GNOME, but I remember doing a search a while back, and finding out about metacity, and how to use that to allow any window to be put in fullscreen. This worked great on Karmic, but it doesn't seem to be working under Lucid. Here's what I do. Run gconf-editor. Go to /apps/metacity/window_keybindings. Change toggle_fullscreen from disabled to <Control><Shift>F. Unfortunately it doesn't work. I know that I've got the right syntax because I can see other shortcuts and use them as a template. I have no idea what's wrong, and no idea how to move forwards/debug. Any suggestions much appreciated. TIA Andy

    Read the article

  • Spoof user agent for GoGo Inflight Internet?

    - by AndyL
    Is it possible to trick the GoGo Inflight WiFi on airlines into thinking that you have a mobile device instead of a laptop? It seems like most airlines that offer in flight wireless these days use GoGo. They offer different pricing for mobile and laptops. It seems like they are checking the browser's user agent. Out of curiosity, is it possible to use a Firefox extension like this one to spoof the user-agent and allow a laptop to access the internet under a GoGo mobile plan? How would GoGo handle something like an IMAP email client, like Thunderbird. Do IMAP clients have a user-agent field as well that would normally identify whether the mail client is running on a laptop or mobile device?

    Read the article

  • How to check for duplicate files?

    - by miorel
    I have an external hard drive on which I have backed up files several times. Some files were modified between backups, others were not. Some may have been renamed. Now I'm running out of space, and I'd like to clean up duplicate files. My idea was to md5sum every file on the drive, then look for duplicates, and diff the relevant files (just in case, haha). Is this the best way to do this? What are some other methods of checking for duplicate files?

    Read the article

  • How To Perform Distributed Website Monitoring?

    - by cballou
    I would like to know how sites like the following perform distributed website monitoring (from multiple checkpoints/countries). pingdom.com, site24x7.com, uptrends.com, siteuptime.com, etc, etc. To be exact, what process would occur in checking if a given domain name went down? If the server finds that the site is down, what is the next step? Would it make a REST API request to a separate server to run the same test and report the results? I have a few theories, including: utilizing host(s) from different countries utilizing proxies from different countries I'm looking for the most proper or correct way to handle this, which can include the usage of servers from multiple countries/hosts.

    Read the article

  • Inconsistent DNS report results on different websites

    - by Saif Bechan
    I am checking my server dns setting on different websites. intodns,dnssy,dnscog, but on all the websites i get different results. Some say my mail server settings are not good, some say i have no A records for my NS records. Only on dnssy everything looks to be ok. Should i just trust the website with the best results, or what should i do? How does this sort of inconsistency occur in the first place. I am new to servers and dns, and this makes it very misleading.

    Read the article

  • iPod Touch G4 disconnects from Belkin N+ Router at random intervals

    - by leeand00
    I have an iPod Touch G4 and a Belkin N+ Router F5D8235-4 v2, and for some reason the iPod Touch disconnects from the router at random intervals. Checking the settings in the iPod, it will read that it is still connected to the router, but before I can access the internet again, I have to turn on Airplane mode and then turn it off again to get any program to work with the Internet again. I've tried upgrading the firmware in the router, but that also doesn't seem to help. I'm using the wiresless mode 802.11b&802.11g&802.11n in the 20/40MHz frequency. Is there any way of fixing this issue? It doesn't happen with any of the other devices that are connected to the router. This post has been cross-posted here

    Read the article

  • Touch Screen Ubuntu 10.04LTS

    - by WalterJ89
    I'm trying to get a touch screen working with Ubuntu 10.04LTS (64bit) -it is a serial touchsceen, connected at /dev/ttyS0 ,i know that works because I get garbage in the terminal when I enable it. -before the screen used a 3m driver (I believe) in XP. My knowledge of Linux is passive so I generally pick up something when I need it. To get this working I came accross a lot of tutorials (a lot outdated a bit), I'm still at a loss to get this work. I'm not sure where to put linux drivers (/usr/ or /dev/?) most tutorials kind of skip over that part. I have tried editing the /etc/X11/xorg.conf unsuccessfully. I'm not sure what the syntax for that is supposed to be. Thank You

    Read the article

  • Check for Apache state in Linux

    - by loulouzekiller
    Hi i have a java application that starts/stops/restart Apache and it should also check for its status, so i have looked how checking for status of apache and it appears that you have to check for the state of the service, problem is that when i use apachectl start the service httpd is still not started, is that normal ? i check for the service state by doing service httpd status . [root@lxrdcpsm ~]# service httpd status httpd is stopped [root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl start httpd (pid 20502) already running [root@lxrdcpsm ~]# service httpd status httpd is stopped [root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl stop [root@lxrdcpsm ~]# service httpd status httpd is stopped [root@lxrdcpsm ~]# /apps/apache/2.4.4/bin/apachectl start [root@lxrdcpsm ~]# service httpd status httpd is stopped [root@lxrdcpsm ~]#

    Read the article

  • Munin "Available entropy" when using address space layout randomization

    - by clawspoon
    Having just configured Munin for statistics logging on my gentoo server (hardened profile), I am noticing that my "Available entropy" is consitently in the 200-300 range. This seems way to low, so I checked it manually using the command $ cat /proc/sys/kernel/random/entropy_avail 3544 Odd. Consistently very low values in Munin and practically filled up when checking manually. After thinking about the problem for a while I came to the conclusion that the problem is probably that I'm using Adress Space Layout Randomization which is using the entropy when running commands/programs. Since Munin runs a whole slew of programs all the entropy is used up, and Munin then measures how much entropy there is, resulting in the low values. Does anyone have any experience with this? How can this be avoided?

    Read the article

  • How to copy directories using debugfs?

    - by STM
    The debugfs manpage gives the impression that the command 'rdump . .' will recursively copy all files found on the specified filesystem from the debugfs cwd to the native filesystem's cwd. Instead I seem to receive a syntax error, and no copy is initiated? These are the commands I run: cd /path/to/transfer/destination debugfs /dev/sda1 -R rdump . . My task is to copy the entire contents of a clean yet unmountable USB storage device to its host machine's HD. The host machine does not support the inode size used by the USB device's filesystem (256) and its software is not upgradeable, so my intention was to use debugfs to transfer the files. If anyone has any other suggestions for this task I'd be grateful.

    Read the article

  • Gitweb showing opposite colors for added and removed text

    - by Maddy
    Hi, I have installed gitweb in our servers. And it started showing the branches and the commit diffs. But the syntax highlighting is opposite particularly for added and removed text. Supposed added text should be in green and removed text should be red. But I am seeing an opposite one. I can hack gitweb.css to get my job done. But felt like knowing why such issue is happening? And what might be the proper fix. (if any one knows good themes for gitweb? please mention)

    Read the article

  • Why is Mac OS X 10.6 using /usr/lib to start Apache when I compiled PHP using /opt/local/lib?

    - by Anthony
    PHP 5.3.3 compiled on Mac OS X 10.6 - using /usr/lib when trying to start Apache... rather than /opt/local/lib specified when PHP was configured. Why is it trying to load from /usr/lib when I specified in my configure not to? httpd: Syntax error on line 115 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): Library not loaded: /opt/local/lib/libiconv.2.dylib\n Referenced from: /usr/libexec/apache2/libphp5.so\n Reason: Incompatible library version: libphp5.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0 The error message above refers to /opt/local/lib which when I run: otool -LD /opt/local/lib/libiconv.2.dylib Message: /opt/local/lib/libiconv.2.dylib: /opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0) It shows that the version is different than what httpd is erring out as. I have a feeling I need to recompile Apache using newer libraries, but the error message still doesn't make too much sense to me.

    Read the article

  • Original sender is not correctly identified when spam is forwarded

    - by Stephan Burlot
    I have a forwarding rule with Postfix that forwards all messages to my main email address. When a spam message is sent to one of my emails, it is forwarded but the sender is shown as being the forwarding domain, not the spammer's domain. Real example: mywebsite.com is hosted on Linode. [email protected] sends an email to [email protected] the mail is forwarded to [email protected] my email hosting (anotherwebsite.com) sees it's spam and sends a message to [email protected] and Linode reports a TOS violation. I have modified my postfix settings so I now use RBL, but if a message goes through, it may happen again. How can I prevent this to happen again? Is there some settings to change on Postfix so the original sender is correctly identified? Thanks Stephan EDIT: The steps I did to prevent this to happen again are: Add RBL checking to Postfix Add postgrey to Postfix And finally fix the MX record which was incorrect. I checked with a test email on Spamcop.net and the original sender is correctly identified.

    Read the article

  • Browsers ignoring hosts file

    - by madkris
    Until recently my browsers started to ignore my hosts file. I have Windows 7 operating system installed. 192.168.0.5 livesite.com I have tried: Clearing browser cache Issued "ipconfig /flushdns" from the command line Issued "ping livesite.com" from the command line (response was "Reply from 192.168.0.5: bytes=32 time=1ms TTL=128") Restarting unit Backing up original hosts file and making a new one Checking lmhosts.sam (everything is commented out) Connecting directly to modem using cable Checked \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath Tried it on another laptop with exactly the specs as I have Then I tried Changing entry to "127.0.0.1 livesite.com" (ping ok, browser ok) Changing entry to "192.168.0.5 livesite.com" (ping ok, browser ok but only for a sec) Issued "ipconfig /flushdns" from the command line (ping ok, browser not ok) Changing entry to "127.0.0.1 livesite.com" (ping ok, browser ok) Changing entry to "192.168.0.5 livesite.com" (ping ok, browser not ok) Issued "ipconfig /flushdns" from the command line (ping ok, browser not ok) Any idea why it worked for a moment? Or better yet anything I havent tried or some error I may have overlooked?

    Read the article

< Previous Page | 208 209 210 211 212 213 214 215 216 217 218 219  | Next Page >