Daily Archives

Articles indexed Monday May 3 2010

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

  • Posting source code in blogger- fails with C# containers

    - by Lirik
    I tried the solutions that are posted in this related SO question and for the most part the code snippets are working, but there are some cases that are still getting garbled by Blogger when it publishes the blog. In particular, declaring generic containers seems to be most troublesome. Please see the code examples on my blog and in particular the section where I define the dictionary (http://mlai-lirik.blogspot.com/). I want to display this: static Dictionary<int, List<Delegate>> _delegate = new Dictionary<int,List<Delegate>>(); But blogger publishes this: static Dictionary<int, list=""><delegate>> _delegate = new Dictionary<int, list=""><delegate>>(); And it caps the end of my code section with this: </delegate></delegate></int,></delegate></int,> Apparently blogger thinks that the <int and <delegate> portion of the dictionary are some sort of HTML tags and it automatically attempts to close them at the end of the code snippet. Does anybody know how to get around this problem?

    Read the article

  • Returning a users lat lng as a string iPhone

    - by Joshmattvander
    Is there a way to return the users location as a string from a model? I have a model thats job is to download same JSON data from a web service. When sending in my request I need to add ?lat=LAT_HERE&lng=LNG_HERE to the end of the string. I have seen tons of examples using the map or constantly updating a label. But I cant find out how to explicitly return the lat and lng values. Im only 2 days into iPhone dev so go easy on me :)

    Read the article

  • Multiple forms using Rails & jQuery & AJAX

    - by biggie8199
    I have multiple coupons on a page and I'm trying to get comments to work on each coupon. So for each coupon i have a comments form. Im using jQuery + Ajax to accomplish this. Here's what my code looks like. Coupon Page <p>Comments:</p> <% form_for(@comment) do |f| %> <%= f.label :body %><br /><%= f.text_field :body, :size => "24" %> <%= f.hidden_field :coupon_id, :value => coupon.id %> <%= f.submit "Save" %> <% end %> Application.js jQuery.ajaxSetup({ 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} }) jQuery.fn.submitWithAjax = function() { this.submit(function() { $.post(this.action, $(this).serialize(), null, "script"); return false; }) return this; }; $(document).ready(function() { $("#new_comment").submitWithAjax(); }) I tried changing the jQuery selector to a class $(".new_comment").submitWithAjax(); Thinking that would work, now all the submit buttons work, however it posts only the first form on the page. What can I change to make it so ajax submits the correct form and not the first one?

    Read the article

  • PHP Form POST to external URL with Redirect to another URL

    - by Marlon
    So, what I am trying to accomplish is have a self-posting PHP form, POST to an external page (using CURL) which in turn redirects to another page. Currently, what is happening is that once I click "Submit" on the form (in contact.php) it will POST to itself (as it is a self-posting form). The script then prepares the POST using CURL and performs the post. The external page does its processing and then, the external page is supposed to redirect back to another page, in a referring domain. However, what happens instead, is that it seems like the contact.php page loads the HTML from the page the external page redirected to, and then, the contact.php's HTML loads after that, ON THE SAME PAGE. The effect, is what looks like two separate pages rendered as one page. Naturally, I just want to perform the POST and have the browser render the page it is supposed to redirect to as specified by the external page. Here is the code I have so far: <?php if(isset($_POST['submit'])) { doCURLPost(); } function doCURLPost() { $emailid = "2, 4"; $hotel = $_POST['hotel']; //you will need to setup an array of fields to post with //then create the post string $data = array ( "recipient" => $emailid, "subject" => "Hotel Contact Form", "redirect" => "http://www.localhost.com/thanx.htm", "Will be staying in hotel: " => $_POST['hotel'], "Name" => $_POST['Name'], "Phone" => $_POST['Phone'], "Comments" => $_POST['Comments']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.externallink.com/external.aspx"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Referer: http://www.localhost.com/contact.php")); $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); } ?>

    Read the article

  • jQuery scrollTop() doesn't seem to work in Safari or Chrome (Windows)

    - by Pointy
    I've got a simple setup to allow a "help"-style window to be loaded and scrolled to a particular point on the page. More or less the code looks like this: var target = /* code */; target.offsetParent().scrollTop(target.offset().top - fudgeValue); The target of the scroll and the fudge value are determined by a couple of hints dropped on the page, and I'm having no problems with that part of this mechanism anywhere. In Firefox and IE8, the above code works exactly like I want: the scrolled box (in this case, the page body) correctly scrolls the contained stuff to the right point in the window when it's told to do so. In Chrome and Safari, however, the call to scrollTop() apparently does nothing at all. All the numbers are OK, and the target refers to the right thing (and the offsetParent() is indeed the body element), but nothing at all happens. As far as I can tell from googling around, this is supposed to work. Is there something funny about the renderer under Safari and Chrome? This is jQuery 1.3.2 if that matters. Test page: http://gutfullofbeer.net/scrolltop.html

    Read the article

  • SQL SERVER – SHRINKFILE and TRUNCATE Log File in SQL Server 2008

    - by pinaldave
    Note: Please read the complete post before taking any actions. This blog post would discuss SHRINKFILE and TRUNCATE Log File. The script mentioned in the email received from reader contains the following questionable code: “Hi Pinal, If you could remember, I and my manager met you at TechEd in Bangalore. We just upgraded to SQL Server 2008. One of our jobs failed as it was using the following code. The error was: Msg 155, Level 15, State 1, Line 1 ‘TRUNCATE_ONLY’ is not a recognized BACKUP option. The code was: DBCC SHRINKFILE(TestDBLog, 1) BACKUP LOG TestDB WITH TRUNCATE_ONLY DBCC SHRINKFILE(TestDBLog, 1) GO I have modified that code to subsequent code and it works fine. But, are there other suggestions you have at the moment? USE [master] GO ALTER DATABASE [TestDb] SET RECOVERY SIMPLE WITH NO_WAIT DBCC SHRINKFILE(TestDbLog, 1) ALTER DATABASE [TestDb] SET RECOVERY FULL WITH NO_WAIT GO Configuration of our server and system is as follows: [Removed not relevant data]“ An email like this that suddenly pops out in early morning is alarming email. Because I am a dead, busy mind, so I had only one min to reply. I wrote down quickly the following note. (As I said, it was a single-minute email so it is not completely accurate). Here is that quick email shared with all of you. “Hi Mr. DBA [removed the name] Thanks for your email. I suggest you stop this practice. There are many issues included here, but I would list two major issues: 1) From the setting database to simple recovery, shrinking the file and once again setting in full recovery, you are in fact losing your valuable log data and will be not able to restore point in time. Not only that, you will also not able to use subsequent log files. 2) Shrinking file or database adds fragmentation. There are a lot of things you can do. First, start taking proper log backup using following command instead of truncating them and losing them frequently. BACKUP LOG [TestDb] TO  DISK = N'C:\Backup\TestDb.bak' GO Remove the code of SHRINKING the file. If you are taking proper log backups, your log file usually (again usually, special cases are excluded) do not grow very big. There are so many things to add here, but you can call me on my [phone number]. Before you call me, I suggest for accuracy you read Paul Randel‘s two posts here and here and Brent Ozar‘s Post here. Kind Regards, Pinal Dave” I guess this post is very much clear to you. Please leave your comments here. As mentioned, this is a very huge subject; I have just touched a tip of the ice-berg and have tried to point to authentic knowledge. Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Backup and Restore, SQL Data Storage, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Diamond square algorithm.

    - by Gabriel A. Zorrilla
    I'm trying to write the Diamond-Square algorithm in Java to generate a random map but can't figure out the implementation... Anyone with some Java code (or other language) so i can check how the loop is made would be greatly appreciated! Thanks!

    Read the article

  • Vim with split frame of buffers or file listing

    - by casualcoder
    Similar in appearance to Vim as a note taking platform (SO), I would like a pane with a list of open buffers that can be used as a jump to list. This is one feature in many IDEs and other advanced editors that is missing. Having a dozen buffers or so open becomes confusing as to which buffer is where.

    Read the article

  • Changing a url depending on what link chosen (HTML) no asp.

    - by Ozaki
    TLDR I need to change a javascript variable on the same page after clicking a link (can be from a different page) so that the getjson request pulls different data without having to duplicate on html pages. I am using some getJSON requests with Jquery, to make calls to populate my pages. I want to be able to (in plain HTML / javascript) when the user clicks say "link 1" or "link 2" to open the same page (say page.html) but change the get request url to "link 1" or "link 2". Page.html var url = ??; $.getJSON(url, function(data){} link 1 var url = host/link1 <a href="page.html">link1</a> link2 var url = host/link2 <a href="page.html">link2</a> So I call the same page but am able to populate it with different content. Purposely staying away from asp. Was thinking maybe of inserting the content into a div after page load so the url can be set or something along those lines. Any ideas how I might go about this?

    Read the article

  • Rails: Helpers and Models - where to organize code

    - by Sam
    More and more I'm putting all of my code in models and helpers concerning MVC. However, sometimes I'm not sure where to organize code. Should it go into the model or should it go into a helper. What are the benefits of each. Is one faster or are they the same. I've heard something about all models getting cached so it seems then like that would be a better place to put most of my code. For example here is a scenario that works in a model or in helper: def status if self.purchased "Purcahsed" elsif self.confirmed "Confirmed" elsif self.reserved "Reserved" else "Pending" end end I don't need to save this status as in the database because there are boolean fields for purchased, and confirmed, and reserved. So why put this in a model or why put it into a helper? So I'm not sure of the best practice or benefits gained on putting code into a model or into helper if it can be in both.

    Read the article

  • iPhone keyboard doesn't appear when entering a UITextField

    - by Norm
    This has to be some kind of newbie blunder that I just can’t see, and I’d be grateful for hints as to what to check or where to look. I've followed an iPhone tutorial that has a UITextField, making sure I connected the IBOutlet for the text field, and it seems to compile properly (no errors or warnings). But when I run it under the simulator, and click in the field, I don’t get the keyboard, so I can’t enter anything into the field. I’ve tried searching the site for similar questions, and all I’ve found is a few questions where the developer is trying to set up some complex UI with multiple controllers, and one that seemed to be the same issue, but the original poster simply said that he solved it by starting a new project and porting the code over. I’d like to find an actual solution, so I don’t have to try randomly rebuilding projects when this issue comes up again. Thanks!

    Read the article

  • What is the best way to automated (integration) test with java with OpenId4Java against real OpenIdP

    - by mP
    I would like to do a bit more than manually test my openid glue code which happens to use the openid4java library. My goals would be to be able to run it within my IDE with a bunch of tests using Junit or similar. Selenium & tomcat I was thinking of using selenium and a tomcat but thats not exactly a nice approach as this is a bit heavy and not really lightweight. httpunit A solution with http-unit is incomplete because it doesnt really fit with the redirect to my openid provider, authenticate and redirect back. Perhaps i am wrong but this looks like it could get quite involved just to make sure this works. Mocks My last solution is to mock everything and assume thats its accurate and works. If google or yahoo ever change in some way, then ill have to verify manually. The approach is simple but with a major flaw.

    Read the article

  • storing crontab php outputs in a log file

    - by vick
    * * * * * php /home/admin/public_html/domain.com/public/cron/route.php &>> /home/admin/public_html/domain.com/log/cron.log I have that cron running every minute. I want to store the errors that occur in route.php in cron.log This works wonderfully when I run : php /home/admin/public_html/domain.com/public/cron/route.php &>> /home/admin/public_html/domain.com/log/cron.log through the command line manually. But when crontab runs it no errors gets stored in cron.log the cron.log is owned by admin:admin and the permissions are set to 777 just to be sure. anyone?

    Read the article

  • Can I use REG_EXPAND_SZ for the locations of shell folders instead of REG_SZ

    - by Jherico
    I'm working on re-arranging a number of the shell folders in windows 7 to utilize Dropbox to keep a set of machines in sync. I'd like to create a .reg file which I can use to update the locations of these folders rather than manually changing them from the UI, but I don't want to rely on the path to the home folder being the same each time. So my question is, is it possible to replace the REG_SZ values in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders with REG_EXPAND_SZ values specifying an offset from %HOME% instead of an exact path?

    Read the article

  • F# for C#/Haskell programmer

    - by Maciej Piechotka
    What is recommended tutorial of F# for Haskell programmer? F# seems to borrow a lot from Haskell but there are little traps which makes hard to write. Generally I need walkthrough the F# which would not explain what is the difference between mutable data and immutable (Haskell is much more strict in this area) etc. I know C# a little so I know more or less what .Net is about as well.

    Read the article

  • I can't get router and switches configured properly for my home office network

    - by BernicusMaximus
    Networking Gurus, I recently built a new detached garage, with an office above. As such I had it tied into my existing home ethernet wiring. The ethernet signal is coming into the garage just fine, but I can not get my network configured the way I want because of problems trying to link the various router/switch devices. Please see the following links for the network diagrams: Home Network So basically, I can't my future state to work. I'm not sure if I'm using incompatible switches or what, but I tried the future state with some 4 port switches from best buy and had no luck. I resorted to setting up the Current State so I could operate. What I am looking for is help on how best to get my future state to work. Is this possible with my current configuration, and if not, what should I do? Any help is appreciated. Thanks, Bernie

    Read the article

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