Daily Archives

Articles indexed Wednesday May 26 2010

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

  • Guidelines for calling controller methods in helper modules?

    - by keruilin
    Few questions: Is it possible to call a controller method in a helper module (e.g., application helper)? If so, how does the helper handle the rendering of views? Ignore it? In what instances would you want to call a controller method from a helper? Is it bad practice? Do you have any sample code where you're calling controller methods in helper?

    Read the article

  • What's the VB.NET equivalent of this C# code for wiring up and declaring an event?

    - by Ben McCormack
    I'm working on a tutorial to build a media player in Silverlight and am trying to wire up an EventHandler to the timer.Tick event of a DispatchTimer object so that the time of the video is synced with a Slider object. The sample code is in C# and I can't for the life of me figure out the proper syntax in VB.NET with RaiseEvent and/or Handles to wire up the event. Below is the relevant C# code. I'll include comments on where I'm getting stuck. private DispatchTimer timer; public Page() { //... timer = new DispatchTimer(); timer.Interval = TimeSpan.FromMilliseconds(50); timer.Tick += new EventHandler(timer_Tick); // <== I get stuck here b/c // I can't do "timer.Tick += ..." in VB.NET } void timer_Tick(object sender, EventArgs e) { if (VideoElement.NaturalDuration.TimeSpan.TotalSeconds > 0) { sliderScrubber.Value = VideoElement.Position.TotalSeconds / VideoElement.NaturalDuration.TimeSpan.TotalSeconds; } }

    Read the article

  • Is calling of overload operator-> resolved at compile time?

    - by Brent
    when I tried to compile the code: (note: func and func2 is not typo) struct S { void func2() {} }; class O { public: inline S* operator->() const; private: S* ses; }; inline S* O::operator->() const { return ses; } int main() { O object; object->func(); return 0; } there is a compile error reported: D:\code>g++ operatorp.cpp -S -o operatorp.exe operatorp.cpp: In function `int main()': operatorp.cpp:27: error: 'struct S' has no member named 'func' it seems that invoke the overloaded function of "operator-" is done during compile time? I'd added "-S" option for compile only.

    Read the article

  • Regex & BBCode - Perfecting Nested Quote

    - by Moe
    Hey there, I'm working on some BBcode for my website. I've managed to get most of the codes working perfectly, however the [QUOTE] tag is giving me some grief. When I get something like this: [QUOTE=1] [QUOTE=2] This is a quote from someone else [/QUOTE] This is someone else quoting someone else [/QUOTE] It will return: > 1 said: [QUOTE=2]This is a quote from > someone else This is someone else quoting someone else[/QUOTE] So what is happening is the [/quote] from the nested quote is closing the quote block. The Regex I am using is: "[quote=(.*?)\](.*?)\[/quote\]'is" How can I make it so nested Quotes will appear properly? Thank you.

    Read the article

  • Add jquery link to returned text...

    - by Jerry
    Hi all I am trying to add two jquery plugins files to my application. When a user triggers my ajax event, the server will return text with a form button. The plugins (a jquery calendar) will work when the user clicks the form button inside the returned text . I believe I have to add the link inside the return text instead of the main page to let the code work, but not sure how to do this. I am giving out my code and need you experts opinions. Thanks. My main page html //required jquery plugins ...didn't work if I add them in the main application. <script type="text/javascript" src="JS/date.js"></script> <script type="text/javascript" src="JS/datePicker.js"></script> <script type="text/javascript" src="JS/selectWeek.js"></script> <div id="gameInfo"> //return text will be displayed here. </div> My returned text ...part of it.... <form> <div id=returnDiv> // the form input will be added here when a user clicks #addMatch button... </div> <tr> <td><input type="button" id="addMatch" name="addMatch" value="Add Match"/> </td> </tr> </form> My jquery $("#addMatch").live('click', function(){ //the code below will create a calender when a user click the link...I am not sure //where I should add my two jquery plugins link... $("#returnDiv").html("<td><input type='text' size='6' class='date-pick dp-applied'"+ "name='date'><a style='color:white;' class='dp-choose-date' title='Choose Date'"+ "href='#'>Date</a></td>"; return false; }); I hope I explain my question well. +1 to any reply...:D

    Read the article

  • Problem with mysql query to replace a string

    - by alex
    I've used mysql's update replace function before, but even though I think I'm following the same syntax, I can't get this to work. Here's what I'm trying to do: UPDATE contained_widgets SET preference_values = REPLACE(preference_values, '<li><a_href="/enewsletter"><span class="not-tc">eNewsletter</span></a></li>', '<li><a_href="/enewsletter"><span class="not-tc">eNewsletter</span></a></li> <li> <a_href="/projects"><span class="not-tc">Projects</span></a></li>'); Query OK, 0 rows affected (0.00 sec) Rows matched: 77 Changed: 0 Warnings: 0 I don't see what I'm missing. Any help is appreciated. I edited "a " to "a_" because the site thinks I'm posting spam links otherwise.

    Read the article

  • SQLAuthority News – Win MS Office License – Last 2 days

    - by pinaldave
    Just a note for everybody who is from India and want to win FREE Office License, participate in very easy contest here. SQLAuthority News – Virtual Launch Event for Office 2010 – Contest – Win MS Office License Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: Contest, Office2010

    Read the article

  • How to sort a list by the 2nd tuple element in python and C#

    - by user350468
    I had a list of tuples where every tuple consists of two integers and I wanted to sort by the 2nd integer. After looking in the python help I got this: sorted(myList, key=lambda x: x[1]) which is great. My question is, is there an equally succinct way of doing this in C# (the language I have to work in)? I know the obvious answer involving creating classes and specifying an anonymous delegate for the whole compare step but perhaps there is a linq oriented way as well. Thanks in advance for any suggestions.

    Read the article

  • box-sizing support in ie7

    - by lowellk
    I just discovered the "box-sizing: border-box" css property which solves a bunch of cross browser layout problems for me. The only issue I now have is that ie7 doesn't seem to support it. Is there a hack to get ie7 to support it?

    Read the article

  • designing an API wrapper for Twitter, Facebook, Youtube etc...

    - by John Stewart
    I am looking at some pointers on how to design a wrapper for these social networking sites. Ideally what I want to do is create a black box where I am able to create an interface for other libraries to call certain functions to interact with these social networking sites. I am planning on using oAuth for most of these sites, I already have this layer designed in PHP. The other layer that I need for these social sites is the ability to push and pull content. For example, the ability to pull feeds for users from each of these networks and then should I cache them on my end? how would I cache all twitter, facebook etc activity feed and be able to account for resync etc? The networks that I am looking at are: Twitter Youtube Facebook LinkedIN Vimeo Flickr I am looking for ideas on how to tackle this in php? Any suggestions, opensource systems that I can learn from?

    Read the article

  • what is the easiest way to do this function in c# ?

    - by From.ME.to.YOU
    Hello let say that we have an array [5,5] 01,02,03,04,05 06,07,08,09,10 11,12,13,14,15 16,17,18,19,20 21,22,23,24,25 the user should send 2 values to the function (start,searchFOR) for example (13,25) the function should search for that value in this way 07,08,09 12, ,14 17,18,19 if the value is n't found in this level it will goes a level higher 01,02,03,04,05 06, , , ,10 11, , , ,15 16, , , ,20 21,22,23,24,25 if the array is bigger than this and the value didn't found it will go to a level higher Thanks for your help

    Read the article

  • Rename PHP Downloaded File in File Downloader/Accelerator Applications

    - by Joe
    I have the following "download" script in PHP which basically makes an address on my website download the file for the user, eg. mysite.com/download.php?fileid=10 The question I have is, how can I send the file name to the used for the download when a user downloads the .php address with a File Downloaders/Accelerators? eg. "Content-Disposition" in this case makes the file called download.php where as I want it to be renamed to $downloadFileName as usual. // Set headers header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"".$downloadFileName."\""); header("Content-Transfer-Encoding: binary"); // Read the file from disk readfile($downloadLocation);

    Read the article

  • PHP javascript alert popup title header

    - by user329394
    Hi all i want to change javascript alert title header from displaying Internet Explorer to another name. is a way to do it? i found this site in the net : http://bytes.com/topic/javascript/answers/148721-change-title-bar-javascript-alert-box it seems no silution to it. http://stackoverflow.com/questions/1905289/how-to-edit-a-javascript-alert-box-title is it true there are no other way?? thx all.

    Read the article

  • NSDictionary: Two keys per value?

    - by Derek
    I would like to create an NSDictionary (or something similar) that has two keys per value. It will be for English/Spanish word look-up, where: each value is an array containing all the conjugated verbs in English AND Spanish. each (two) keys contains both an English infinitive (e.g. "to be", "to go") and a Spanish infinitive This way, I can look a word up regardless of language based on the values having two keys per value. Here's an example: keys: "to want" or "querer" values: ["want", "want", "wants", "want", "want", "quiero", "quieres", "quiere", "queremos", "quieren"]

    Read the article

  • Passing a string representing my format specifier into stringWithFormat and seeing issues

    - by Jeff
    If I call "[NSString stringWithFormat:@"Testing \n %@",variableString]"; I get what I would expect, which is Testing, followed by a new line, then the contents of variableString. However, if i try NSString *testString = @"Testing \n %@"; //forgive shorthand here [NSString stringWithFormat,testString,variableString] the output actually literally writes \n to the screen instead of a newline. any workaround to this? seems odd to me

    Read the article

  • MVC 1.0 Compatibility with VS 2010

    - by crisgomez
    Hi We are planning to upgrade our technology to VS 2010. But I wonder if the MVC 2.0 is working properly since it has many issues raised from software developer who used it please see here: http://aspnet.codeplex.com/releases/view/41742.I want to use MVC 1.0 in VS 2010 is it compatible?

    Read the article

  • Jquery - custom countdown

    - by matthewsteiner
    So I found this countdown at http://davidwalsh.name/jquery-countdown-plugin, I altered it a little bit: jQuery.fn.countDown = function(settings,to) { settings = jQuery.extend({ duration: 1000, startNumber: $(this).text(), endNumber: 0, callBack: function() { } }, settings); return this.each(function() { //where do we start? if(!to && to != settings.endNumber) { to = settings.startNumber; } //set the countdown to the starting number $(this).text(to); //loopage $(this).animate({ 'fontSize': settings.endFontSize },settings.duration,'',function() { if(to > settings.endNumber + 1) { $(this).text(to - 1).countDown(settings,to - 1); } else { settings.callBack(this); } }); }); }; Then I have this code: $(document).ready(function(){ $('.countdown').countDown({ callBack: function(me){ $(me).text('THIS IS THE TEXT'); } }); }); I don't mind taking everything out of the "animate" loop; I'd prefer that since nothing needs to be animated. (I don't need the font size to change). So everything's working to a point. I have a span with class countdown and whatever is in it when the page is refreshed goes down second by second. However, I need it to be formatted in M:S format. So, my two questions: 1) What can I use instead of animate to take care of the loop yet maintain the callback 2) How (where in the code should I) can I play with the time format? Thanks.

    Read the article

  • Generated images fail to load in browser

    - by notJim
    I've got a page on a webapp that has about 13 images that are generated by my application, which is written in the Kohana PHP framework. The images are actually graphs. They are cached so they are only generated once, but the first time the user visits the page, and the images all have to be generated, about half of the images don't load in the browser. Once the page has been requested once and images are cached, they all load successfully. Doing some ad-hoc testing, if I load an individual image in the browser, it takes from 450-700 ms to load with an empty cache (I checked this using Google Chrome's resource tracking feature). For reference, it takes around 90-150 ms to load a cached image. Even if the image cache is empty, I have the data and some of the application's startup tasks cached, so that after the first request, none of that data needs to be fetched. My questions are: Why are the images failing to load? It seems like the browser just decides not to download the image after a certain point, rather than waiting for them all to finish loading. What can I do to get them to load the first time, with an empty cache? Obviously one option is to decrease the load times, and I could figure out how to do that by profiling the app, but are there other options? As I mentioned, the app is in the Kohana PHP framework, and it's running on Apache. As an aside, I've solved this problem for now by fetching the page as soon as the data is available (it comes from a batch process), so that the images are always cached by the time the user sees them. That feels like a kludgey solution to me, though, and I'm curious about what's actually going on.

    Read the article

  • Open new popup window without address bars in firefox & IE

    - by Anbu
    Hi everyone, hope someone can help. just cannot get a new window to open in Firefox without address bars. IE works fine with below code Blockquote window.open('/pageaddress.html','winname',directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350); i need to make for all browser

    Read the article

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