Search Results

Search found 39168 results on 1567 pages for 'running costs'.

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

  • how do i stop root from running a program

    - by joe Lovick
    I would like to prevent my root user from running certain applications that can change the permissions of files which in turn prevents normal users from running those applications again. for example, if i sudo to root, and then run thunderbird from the command prompt, it changes the permissions of files within my home dir / profile so i can no longer run it as a normal user; what i would like to do is prevent root from running thunderbird and hence stop this user error from repeating itself. any suggestions? to clarify, if i have a lot of administration to do i use "sudo -s" which gives me a root shell, its just once a year or so, i shoot myself in the foot.

    Read the article

  • MacMini (running Ubuntu 14.04) loses wlan connection when uploading larger files (several 100 mb) via ownCloud

    - by ManekenT
    I installed Ubuntu 14.04 on an old MacMini with the intention of running it as a homeserver. Additionally I installed ownCloud and tried to sync some files both from a laptop running elementaryOS and a desktop running windows 7. Syncing smaller files workes like a charm (4000 files at <10mb each) but when it comes to bigger files (1 GB ubuntu iso e.g.) the upload failes after 20-100mb. I can't ping the server anymore and the server can't ping me. It still shows up in our router as connected though. Disconnecting and reconnecting the wlan connection fixes the issue until the next attempt at syncing. Edit: I also had to install the wlan driver with this manual: https://help.ubuntu.com/community/MacBookPro8-2#Wireless

    Read the article

  • Ubuntu 12.04 Running Faster Than Normal

    - by One Zero
    I have just installed a new copy of Ubuntu 12.04 on my laptop . i have noticed that my system is running 4x to 5x faster than normal . i have just install Vmware Desktop & centos for testing something . i have noticed that i has installed in just like less than 1 minute !! My system is booting so fast that after starting my laptop i got GUI in like 10 to 13 sec & shutting down in like 2 to 3 sec & all programs ( Firefox , Chrome , etc ) running so fast that i can see .... The only change i made after installation is cat /proc/sys/vm/swappiness 1 How do I configure swappiness? The System is Dell N 5110 i7 with 8GB of RAM So my question is that what should i look for that why my system running very fast ?

    Read the article

  • Minecraft running slow after 13.10 upgrade

    - by user204279
    What to took for when Minecraft is running slow (~10 FPS) after a simple Ubuntu upgrade (from 13.04 to 13.10) without any manual change in the hardware/software graphic configuration and in the Minecraft configuration? Before the upgrade, it was running very well everytime (~60 FPS constantly). Any help? lspci | grep "VGA compatible controller" 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Whistler [Radeon HD 6730M/6770M/7690M XT] (rev ff)

    Read the article

  • Running Built-In Test Simulator with SOA Suite Healthcare 11g in PS4 and PS5

    - by Shub Lahiri, A-Team
    Background SOA Suite for Healthcare Integration pack comes with a pre-installed simulator that can be used as an external endpoint to generate inbound and outbound HL7 traffic on specified MLLP ports. This is a command-line utility that can be very handy when trying to build a complete end-to-end demo within a standalone, closed environment. The ant-based utility accepts the name of a configuration file as the command-line input argument. The format of this configuration file has changed between PS4 and PS5. In PS4, the configuration file was XML based and in PS5, it is name-value property based. The rest of this note highlights these differences and provides samples that can be used to run the first scenario from the product samples set. PS4 - Configuration File The sample configuration file for PS4 is shown below. The configuration file contains information about the following items: Directory for incoming and outgoing files for the host running SOA Suite Healthcare Polling Interval for the directory External Endpoint Logical Names External Endpoint Server Host Name and Ports Message throughput to be simulated for generating outbound messages Documents to be handled by different endpoints A copy of this file can be downloaded from here. PS5 - Configuration File The corresponding sample configuration file for PS5 is shown below. The configuration file contains similar information about the sample scenario but is not in XML format. It has name-value pairs specified in the form of a properties file. This sample file can be downloaded from here. Simulator Configuration Before running the simulator, the environment has to be set by defining the proper ANT_HOME and JAVA_HOME. The following extract is taken from a working sample shell script to set the environment: Also, as a part of setting the environment, template jndi.properties and logging.properties can be generated by using the following ant command: ant -f ant-b2bsimulator-util.xml b2bsimulator-prop Sample jndi.properties and logging.properties are shown below and can be modified, as needed. The jndi.properties contains information about connectivity to the local Weblogic Managed Server instance and the logging.properties file controls the amount of logging that can be generated from the running simulator process. Simulator Usage - Start and Stop The command syntax to launch the simulator via ant is the same in PS4 and PS5. Only the appropriate configuration file has to be supplied as the command-line argument, for example: ant -f ant-b2bsimulator-util.xml b2bsimulatorstart -Dargs="simulator1.hl7-config.xml" This will start the simulator and will keep running to provide an active external endpoint for SOA Healthcare Integration engine. To stop the simulator, a similar ant command can be used, for example: ant -f ant-b2bsimulator-util.xml b2bsimulatorstop

    Read the article

  • Cron job running successfully suddenly reports script is not found

    - by Ted B
    What might cause cron to suddenly report a file it is supposed to run is "not found," when the file hasn't been touched, and in fact, the entire system hasn't been touched since it last ran successfully? I have a cronjob schedule I define by doing sudo crontab -e In it, I have dozens of cron jobs that run successfully.. I do not have a PATH specified, and I use absolute paths to call all my scheduled scripts, setting the PATH in them as needed. I do not specify a SHELL in the crontab. All scripts identify the shell as their first line. Without me touching the system, a particular job defined in the middle of other jobs will suddenly stop running. To debug this, I added an output redirection to a log file. In that, the output clearly shows the output of the script successfully running time after time for weeks, and then suddenly the following appears: /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found /bin/sh: /home/iupress/bin/sync-email_images: not found If I do the ls command, copying and pasting that exact path from the error message, it clearly reports the file is still there (no surprise). Yet the log continues to report that file is "not found" until I take action. I can run the script manually and it runs just fine. If I do sudo crontab -e and save the file, the job runs on the next scheduled time, putting its output in the log, no longer reporting the script is "not found". It seems to me the contents of the script trying to be run are irrelevant since cron doesn't even process the file because it is "not found". I have a job scheduled below the one that is encountering this problem that I know is continuing to run, because I have its output mailed to me. So I know cron is running and continues to run at least one other job, even after it suddenly reports this job's script is "not found". All my lines end with a newline. I had no periods in the crontab until I added the redirection to a log file. I have now added a PATH specification, but left the absolute paths in the jobs. Unfortunately, I have no idea if and when this problem will occur. It will likely be weeks from now. By the way, I am running a script to syncronize the clock, and I see the time is exactly what it should be.

    Read the article

  • Web browser crashed whilst EasyApache was running

    - by Silver89
    I was building and updating my server using EasyApache when the web browser crashed, the browser then restarted and I think tried to run another of the EasyApache build which failed .. possibly due to the previous one still running? My question is would the first one still be running in the background but I just can't view it anymore? Is there anyway to check that the first one built and finished okay?

    Read the article

  • Is Job Running?

    - by Derek D.
    The following SQL Server script works to determine if a particular job is currently running. This feature is nice to have if you do not want jobs to step over one another. I frequently will use this script as the first step of the job. If it is currently running, then the [...]

    Read the article

  • Running multiple versions of Firefox [migrated]

    - by redconservatory
    I've been reading this: http://support.mozilla.org/en-US/questions/797010#answer-193690 But it looks like it only applies to running multiple versions of Firefox when it's Firefox 4. I need to run Firefox but it seems like a lot of my clients are still running versions of Firefox 3 (is this an operating system issue? Doesn't Firefox auto-update?) so I need to run 3 plus the latest version to troubleshoot some css issues...

    Read the article

  • Is Running programs by address common?

    - by dgood1
    I have read some of the things posted here and I keep reading about people running stuff like /foldername/executable -cmd NAME (was reading about a programmer using Eclipse, so he was testing something he made) I don't see things like that when I run things here (Ubuntu 12.04) because of the launcher and the Ubuntu button at the very top. That and Eclipse indigo has a button for running and testing things it makes. Just asking how and why it's common? (assuming it's the Terminal[Ctrl+alt+T] but I'm not sure)

    Read the article

  • How To Attach Visual Studio 2010 To IIS Process Running On Windows 7

    - by Gopinath
    Debugging ASP.NET application hosted on IIS 7 running of Windows 7 using Visual Studio 2010 is a bit different from debugging applications hosted on IIS running on Windows XP. The key differences are Visual Studio 2010 demands for administrator mode and IIS runs under the process name w3wp.exe instead of aspnet_wp.exe. Here are the detailed steps to attach Visual Studio 2010 debugger to IIS 7 on Windows 7. 1. Launch Visual Studio 2010 in Administrator mode(right click on Visual Studio Icon and choose the option Run as Administrator) 2. Open source code the site you want to debug 3. Go to Tools -> Attach to Process.; Opens up Attach to Process.  4.  In Attach to Process dialog box, check the option Show process in all sessions. 5. Search for the process w3wp.exe, and click on Attach button. 6. Accept the warning messages. That’s is you are done. Visual Studio is now attached with IIS for debugging. Happy coding. This article titled,How To Attach Visual Studio 2010 To IIS Process Running On Windows 7, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • Running & Managing Concurrent Queries in SQL Developer

    - by thatjeffsmith
    We’ve all been there – you’ve managed to write a query that takes longer than a few seconds to execute. Tuning aside, sometimes it takes longer than you want for a query to run. So what’s a SQL Developer user to do? I say, keep going! While you’re waiting for your query to finish, there’s no reason why you can’t continue on with your work. If you need to execute something else in a worksheet, there’s no reason to launch a 2nd or 3rd copy of SQL Developer. Just open an un-shared worksheet. Now while you’ve got 1 or more queries running, you can easily get yourself into a situation where you’re not sure what’s running where. Or maybe you want to cancel a query or just check how long something’s been running. Just open the Task Progress Panel If a query or task in SQL Developer takes more than 3-5 seconds, it will appear in the Task Progress panel. You can then watch the throbbers go back and forth while you sip your coffee/soda/Red Bull. Run a query, spawn a new worksheet, run another query, watch them in the Task Progress panel. Kudos and thanks to @leight0nn for helping me get the title of this post right If you’re looking for help in managing and monitoring sessions in general, check out this post.

    Read the article

  • Exclusive use of a Jini server during long-running call

    - by Matthew Flint
    I'm trying to use Jini, in a "Masters/Workers" arrangement, but the Worker jobs may be long running. In addition, each worker needs to have exclusive access to a singleton resource on that machine. As it stands, if a Worker receives another request while a previous request is running, then the new request is accepted and executed in a second thread. Are there any best-practices to ensure that a Worker accepts no further jobs until the current job is complete? Things I've considered: synchronize the job on the server, with a lock on the singleton resource. This would work, but is far from ideal. A call from a Master would block until the current Worker thread completes, even if other Workers become free in the meantime unregister the Worker from the registry while the job is running, then re-register when it completes. Might work OK, but something doesn't smell right with this idea... Of course, I'm quite happy to be told that there are more appropriate technologies than Jini... but I wouldn't want anything too heavyweight, like rolling out EJB containers all over the place.

    Read the article

  • Running multiple box2D world objects on a server

    - by CharbelAbdo
    I'm creating a multiplayer game using LibGdx (with Box2d) and Kryonet. Since this is the first time I work on multiplayer games, I read a bit about server - client implementations, and it turns out that the server should handle important tasks like collision detection, hits, characters dying etc... Based on some articles (like the excellent Gabriel Gambetta Fast paced multiplayer series), I also know that the client should work in parallel to avoid the lag while the server responds to commands. Physics wise, each game will have 2 players, and any projectiles fired. What I'm thinking of doing is the following: Create a physics world on the client When the game is signaled to start, I create the same physics world on the server (without any rendering obviously). Whenever the player issues a command (move or fire), I send the command to the server and immediately start processing it on the client. When the server receives the command, it applies it on the server's world (set velocity etc...) Each 100ms, the server sends the new state to the client which corrects what was calculated locally. Any critical action (hit, death, level up) is calculated only on the server and sent to the client. Essentially, I would have a Box2d World object running on the server for each game in progress, in sync with the worlds running on the clients. The alternative would be to do my own calculations on the server instead of relying on Box2D to do them for me, but I'm trying to avoid that. My question is: Is it wise to have, for example, 1000 instances of the World object running and executing steps on the server? Tomcat used around 750 MBytes of memory when trying it without any object added to the world. Anybody tried that before? If not, is there any alternative? Google did not help me, are there any guidelines to use when you want to have physics on both the client and the server? Thanks for any help.

    Read the article

  • bluetooth daemon not running at startup

    - by ffaxer
    I'm trying to connect a bluetooth mouse to my Xubuntu system using Blueman (v. 1.21) Problem seems to be bluetoothd not running at startup, so blueman refuses to start, only a dialog appears: "Bluez daemon is not running, blueman-manager cannot continue." On my system, bluetoothd will run only as root (sudo), so my current workaround is simply to sudo bluetoothd manually, which works fine but id like to have it run at startup so that my mouse is just working without any interaction from me, if possible. If i try to start bluetoothd as non-root it reports: Bluetooth deamon 4.91 Unable to get on D-Bus In the startup scripts i found the same bluetoothd script in all runlevels and init.d: DAEMON=/usr/sbin/bluetoothd test -f /usr/sbin/bluetoothd || exit 0 # bluetoothd normally starts up by udev rules. it needs dbus to function, log_progress_msg "bluetoothd" pkill -TERM bluetoothd || true log_progress_msg "bluetoothd" I looked in /etc/udev/rules.d/ but no reference to bluetoothd. Further i have already tried with no luck: Editing /etc/dbus-1/system.d/bluetooth.conf to include my user (essentially copying the part that was for root): I tried it while both keeping the root policy and without, still, no luck! Editing /etc/pam.d/common-session and /etc/pam.d/gdm to include the line: session optional pam_ck_connector.so In the case of common-session it was already there but with a "nox11" which i tried removing. No luck no luck. Btw, I'm confused as to which session manager I'm using, since i have both xfce4-session and gdm-session-worker running. Anyways, hope someone is savvy enough to figure it out or bring some hints, otherwise i sincerely apologize for wasting your time! I'll sign off with uname -a: Linux [mycompname] 3.0.0-9-lowlatency #12ppa1~natty1-Ubuntu SMP PREEMPT Mon Aug 22 06:52:15 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux Peace B)

    Read the article

  • opengl libraries for ubuntu running on Virtual Box

    - by vboxuser
    I am having Ubuntu 10.04 running on VirtualBox. Guest additions are installed successfully. But Guest additions do not provide the OpenGL library. To run open GL demo what needs to be installed. Some google links suggest Mesa utils. By my understanding is Mesa utils do not use vbox drivers to achieve hardware acceleration. Ubuntu 10.04 is running on VirtualBox and not on bare metal. The host comprise of Zx400 CPU with nvidia graphics driver. But this is not relevant since I would be using the vbox drivers provided by guest additions on VirtualBox. In this scenario how do I get OpenGL libraries on Ubuntu?. (Specially I am looking for solution other than Mesa, since mesa has support only for VMware and not for VirtualBox) How to get Opengl libraries which use vbox drivers for 3D hardware accleration?? As i already mentioned, ubuntu 10.04 is running on VirtualBox and not on bare metal. the host comprise of Zx400 CPU with nvidia graphics driver. but this is not relevant since i would be using the vbox drivers provided by guest additions on VirtualBox. In this scenario how to i get OpenGL libraries on Ubuntu. (Especially i am looking for solution other than Mesa, since mesa has support only for VMware and not for VirtualBox Thank you

    Read the article

  • Make a basic running sprite effect

    - by PhaDaPhunk
    I'm building my very first game with XNA and i'm trying to get my sprite to run. Everything is working fine for the first sprite. E.g : if I go right(D) my sprite is looking right , if I go left(A) my sprite is looking left and if I don't touch anything my sprite is the default one. Now what I want to do is if the sprite goes Right, i want to alternatively change sprites (left leg, right leg, left leg etc..) xCurrent is the current sprite drawn xRunRight is the first running Sprite and xRunRight1 is the one that have to exchange with xRunRight while running right. This is what I have now : protected override void Update(GameTime gameTime) { float timer = 0f; float interval = 50f; bool frame1 = false ; bool frame2 = false; bool running = false; KeyboardState FaKeyboard = Keyboard.GetState(); // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if ((FaKeyboard.IsKeyUp(Keys.A)) || (FaKeyboard.IsKeyUp(Keys.D))) { xCurrent = xDefault; } if (FaKeyboard.IsKeyDown(Keys.D)) { timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds; if (timer > interval) { if (frame1) { xCurrent = xRunRight; frame1 = false; } else { xCurrent = xRunRight1; frame1 = true; } } xPosition += xDeplacement; } Any ideas...? I've been stuck on this for a while.. Thanks in advance and let me know if you need any other part from the code.

    Read the article

  • SharePoint 2010 Licensing Costs

    - by Franklin
    Hi, We will be implementing a public-facing website in SharePoint 2010 and I have a few questions regarding licensing: Is there any (relatively) reliable pricing information available for SharePoint 2010? What about rumors? What edition of SharePoint 2010 would be appropriate for a publicly facing website (in 2007, you needed Enterprise for this, but it seems that WCM functionality is included in Standard in 2010)? What would be a reasonable number to budget for SharePoint 2010 licensing for a publicly facing website? Thanks in advance for your help!

    Read the article

  • Running TeamCity from Amazon EC2 - Cloud based scalable build and continuous Integration

    - by RoyOsherove
    I’ve been having fun playing with the amazon EC2 cloud service. I set up a server running TeamCity, and an image of a server that just runs a TeamCity agent. I also setup TeamCity  to automatically instantiate agents on EC2 and shut them down based upon availability of free agents. Here’s how I did it: The first step was setting up the teamcity server. Create an account on amazon EC2 (BTW, amazon’s sites works better in IE than it does in chrome.. who knew!?) Open the EC2 dashboard, and click “Launch Instance” . From the “Quick Start” tab I selected from the list: “Getting Started on Microsoft Windows Server 2008 (AMI Id: ami-c5e40dac)” .  it’s good enough to just run teamcity. In the instance details, I used the default (Small instance, 1.7 GB mem). You might want to choose a close availability zone based on where you are. We want to “Launch instances” so click continue. Select the default kernel, RAM disk and all. No need to enable monitoring for now (you can do that later). click continue. If you don’t have a key pair, you will be prompted to create one. Once you do, select it in the list. Now you’ll be prompted to create a security group. I named mine “TC” as in “TeamCity”. each group is a bunch of settings on which ports can be let through into and out of a hosted machine.  keep it as the default settings. We will change them later. Click continue,  review and then click “Launch”. Now you’ll be able to see the new instance in the running instances list on your site. Now, you need to install stuff on that instance (TeamCity!) . To do that, you’ll need to Remote desktop into that instance. To do that, we’ll get the admin password for that instance: Check it on the list, and click “Instance Actions” - “Get Windows Admin Password”. You might have to wait about 10 minutes or so for the password to be generated for you. Once you have the password, you will remote desktop (start-run-‘mstsc’) into the instance. It’s address is a dns address shown below the list under “Public DNS”. it looks something like: ec2-256-226-194-91.compute-1.amazonaws.com Once you’re inside the instance – you’ll need to open IE (it is in hardened mode so you’ll have to relax its security settings to download stuff). I first downloaded chrome and using chrome I downloaded TeamCity. Note that the download speed is FAST. several MBs per second. To be able to see TeamCity from the outside, you will need to open the advanced firewall settings inside the remote machine, and add incoming and outgoing rules for port 80 (HTTP). Once you do that, you should be able to see the machine from the outside. If you still can’t, see the next step. I also enabled ports 9090 since I will use this machine to create an agent image later as well. Now configure the security group (TC) to enable talking to agents: IN the EC2 dashboard click on “Security Groups” and select your group. To add a rule, click on the empty list under the ‘protocol’ header. select TCP. from and ‘to’ ports are 9090. source ip is 0.0.0.0/0 (every ip is allowed). click “Save.  Also make sure you can see “HTTP” tcp 80 in that list. if you can’t see it, add it or you won’t be able to browse to the machine’s teamcity server home page. I also set an elastic IP for the machine: so I always have the same IP for the machine instance. Allocate and set one through the”Elastic IP” link on the EC2 dashboard.   you should now have a working instance of teamcity.   Now let’s create an agent image. Repeat steps 1-9, but this time, make sure you select a machine that fits what an agent might do. I selected Instance type – Hihg-CPU medium machine,  that is much faster. On that machine, I installed what I needed (VS 2010, PostSharp etc..). downloading VS 2010 from MSDN (2 GB took less than 10 min!) Now, instead of installing teamcity, browse using the browser to the teamcity homepage (from within the remote machine). go to the Administration page, and click the upper right link “Install agents”. Install the agent on he local machine – set it to the IP or DNS of the running TeamCity server. That way you’ll be able to check their connectivity live before making this machine your official agent image to reuse. Once the agent is installed, see that the TC server can see it and use it. see steps 13-14 above if they can’t. Once it works, you can take steps to make this image your agent image to be reused. next, here is a copy-paste of several steps to take from http://confluence.jetbrains.net/display/TCD5/Setting+Up+TeamCity+for+Amazon+EC2 Configure system so that agent it is started on machine boot (and make sure TeamCity server is accessible on machine boot). Test the setup by rebooting machine and checking that the agent connects normally to the server. Prepare the Image for bundling: Remove any temporary/history information in the system. Stop the agent (under Windows stop the service but leave it in Automatic startup type) Delete content agent logs and temp directories (not necessary) Delete "<Agent Home>/conf/amazon-*" file (not necessary) Change config/buildAgent.properties to remove properties: name, serverAddress, authToken (not necessary)   Now, we need to: Make AMI from the running instance. Configure TeamCity EC2 support on TeamCity server. Making an AMI: Check the instance of the agent in the EC2 dashboard instance list, and select instance actions->Create Image (EBS AMI) you’ll see the image pending in the APIs list in the EC2 dashboard. this could take 30 minutes or more. meanwhile we can configure the could support in the teamcity server. COPY THE AMI ID to the clipboard (looks like ami-a88aa4ce) Configuring TeamCity for Cloud: In TeamCity, click on “Agents” and then on “Cloud” tab. this is where you will control your cloud agents. to configure new cloud agents based on APIs, click on the right link to the “configuration page” Create a new profile and select AMazon EC2 as cloud type. Use your AMI ID that you copied to the clipboard into the “Images” field. Select an availability zone that is the same as the one your instance is running on for best communication perf between them make sure you select the ‘TC’ security group hopefully, that should be it, and teamcity will try to instantiate new instances on demand. Note that it may take around 10 minutes for an agent to become available to teamcity from the time it’s started.

    Read the article

  • IIS.net is running on IIS 8.0 Beta!

    - by The Official Microsoft IIS Site
    Here at Microsoft we're pretty passionate about testing our own software. We often ask our customers to test the pre-release versions of our new software products, and we wouldn't ask our customers to try something that we're unwilling to do. To that end, we are pleased to announce that IIS.net is fully running on IIS 8.0 Beta. Some of you may have noticed the "Running on IIS8" button above the IIS.net menu bar; this message lets you know that you're browsing to a server...(read more)

    Read the article

  • The ugly evolution of running a background operation in the context of an ASP.NET app

    - by Jeff
    If you’re one of the two people who has followed my blog for many years, you know that I’ve been going at POP Forums now for over almost 15 years. Publishing it as an open source app has been a big help because it helps me understand how people want to use it, and having it translated to six languages is pretty sweet. Despite this warm and fuzzy group hug, there has been an ugly hack hiding in there for years. One of the things we find ourselves wanting to do is hide some kind of regular process inside of an ASP.NET application that runs periodically. The motivation for this has always been that a lot of people simply don’t have a choice, because they’re running the app on shared hosting, or don’t otherwise have access to a box that can run some kind of regular background service. In POP Forums, I “solved” this problem years ago by hiding some static timers in an HttpModule. Truthfully, this works well as long as you don’t run multiple instances of the app, which in the cloud world, is always a possibility. With the arrival of WebJobs in Azure, I’m going to solve this problem. This post isn’t about that. The other little hacky problem that I “solved” was spawning a background thread to queue emails to subscribed users of the forum. This evolved quite a bit over the years, starting with a long running page to mail users in real-time, when I had only a few hundred. By the time it got into the thousands, or tens of thousands, I needed a better way. What I did is launched a new thread that read all of the user data in, then wrote a queued email to the database (as in, the entire body of the email, every time), with the properly formatted opt-out link. It was super inefficient, but it worked. Then I moved my biggest site using it, CoasterBuzz, to an Azure Website, and it stopped working. So let’s start with the first stupid thing I was doing. The new thread was simply created with delegate code inline. As best I can tell, Azure Websites are more aggressive about garbage collection, because that thread didn’t queue even one message. When the calling server response went out of scope, so went the magic background thread. Duh, all I had to do was move the thread to a private static variable in the class. That’s the way I was able to keep stuff running from the HttpModule. (And yes, I know this is still prone to failure, particularly if the app recycles. For as infrequently as it’s used, I have not, however, experienced this.) It was still failing, but this time I wasn’t sure why. It would queue a few dozen messages, then die. Running in Azure, I had to turn on the application logging and FTP in to see what was going on. That led me to a helper method I was using as delegate to build the unsubscribe links. The idea here is that I didn’t want yet another config entry to describe the base URL, appended with the right path that would match the routing table. No, I wanted the app to figure it out for you, so I came up with this little thing: public static string FullUrlHelper(this Controller controller, string actionName, string controllerName, object routeValues = null) { var helper = new UrlHelper(controller.Request.RequestContext); var requestUrl = controller.Request.Url; if (requestUrl == null) return String.Empty; var url = requestUrl.Scheme + "://"; url += requestUrl.Host; url += (requestUrl.Port != 80 ? ":" + requestUrl.Port : ""); url += helper.Action(actionName, controllerName, routeValues); return url; } And yes, that should have been done with a string builder. This is useful for sending out the email verification messages, too. As clever as I thought I was with this, I was using a delegate in the admin controller to format these unsubscribe links for tens of thousands of users. I passed that delegate into a service class that did the email work: Func<User, string> unsubscribeLinkGenerator = user => this.FullUrlHelper("Unsubscribe", AccountController.Name, new { id = user.UserID, key = _profileService.GetUnsubscribeHash(user) }); _mailingListService.MailUsers(subject, body, htmlBody, unsubscribeLinkGenerator); Cool, right? Actually, not so much. If you look back at the helper, this delegate then will depend on the controller context to learn the routing and format for the URL. As you might have guessed, those things were turning null after a few dozen formatted links, when the original request to the admin controller went away. That this wasn’t already happening on my dedicated server is surprising, but again, I understand why the Azure environment might be eager to reclaim a thread after servicing the request. It’s already inefficient that I’m building the entire email for every user, but going back to check the routing table for the right link every time isn’t a win either. I put together a little hack to look up one generic URL, and use that as the basis for a string format. If you’re wondering why I didn’t just use the curly braces up front, it’s because they get URL formatted: var baseString = this.FullUrlHelper("Unsubscribe", AccountController.Name, new { id = "--id--", key = "--key--" }); baseString = baseString.Replace("--id--", "{0}").Replace("--key--", "{1}"); Func unsubscribeLinkGenerator = user => String.Format(baseString, user.UserID, _profileService.GetUnsubscribeHash(user)); _mailingListService.MailUsers(subject, body, htmlBody, unsubscribeLinkGenerator); And wouldn’t you know it, the new solution works just fine. It’s still kind of hacky and inefficient, but it will work until this somehow breaks too.

    Read the article

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