Search Results

Search found 663 results on 27 pages for 'steven mou'.

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

  • Given an array of arguments, how do I send those arguments to a particular function in Ruby?

    - by Steven Xu
    Forgive the beginner question, but say I have an array: a = [1,2,3] And a function somewhere; let's say it's an instance function: class Ilike def turtles(*args) puts args.inspect end end How do I invoke Ilike.turtles with a as if I were calling (Ilike.new).turtles(1,2,3). I'm familiar with send, but this doesn't seem to translate an array into an argument list. A parallel of what I'm looking for is the Javascript apply, which is equivalent to call but converts the array into an argument list.

    Read the article

  • Hit external url from code-behind

    - by Steven
    I have a form on my site. The user enters their e-mail and selects a location from a dropdown. I then need to post that data to an external site by hitting a url with the user's location and e-mail in the query string. I'm doing this like so: string url = "http://www.site.com/page.aspx?location=" + location.Text + "&email=" + email.Text; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); My client says that I am not hitting their server, but when going through the debugger, I'm getting a response from their server. I also tried tracking what was happening by using Firebug, and I noticed that there was no POST made to that external site. What am I doing wrong here?

    Read the article

  • mongrel not working - Ruby on Rails

    - by Steven
    I have deployed my rails app to a live server(linux) and I have successfully installed the the mongrel gems, and I can successfully start the server for my app but when i try to acceess the website on the server i get the error The server at 196.xx.xxx.xx is taking too long to respond. Is there anything i need to do to be able to access my app on the browser? Mongrel Logs ** Starting Rails with production environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM = stop. USR2 = restart. INT = stop (no restart). ** Rails signals registered. HUP = reload (without restart). It might not work well. ** Mongrel 1.1.5 available at 0.0.0.0:3001 ** Writing PID file to /home/xxxxxxx.co.za/shared/log/mongrel.pid

    Read the article

  • How do I center align horizontal <UL> menu?

    - by Steven
    I need to centre align a horizontal menu. I've tried various solutions, including the mix of inline-block / block / center-align etc., but not being successful. Can someone help me please? :) Here is my code: <div class="topmenu-design"> <!-- Top menu content: START --> <ul id="topmenu firstlevel"> <li class="firstli" id="node_id_64"><div><a href="#"><span>Om kampanjen</span></a></div></li> <li id="node_id_65"><div><a href="#"><span>Fakta om inneklima</span></a></div></li> <li class="lastli" id="node_id_66"><div><a href="#"><span>Statistikk</span></a></div></li> </ul> <!-- Top menu content: END --> </div> UPDATE I know how to center align the UL within the DIV. That can be accomplished using Sarfraz's suggestion. But the list items are still floated left within the UL. Do I smell javascript to accomplish this?

    Read the article

  • [AS 3.0] How to use the string.match method to find multiple occurrences of the same word in a strin

    - by Steven
    In Actionscript and Adobe Flex, I'm using a pattern and regexp (with the global flag) with the string.match method and it works how I'd like except when the match returns multiple occurrences of the same word in the text. In that case, all the matches for that word point only to the index for the first occurrence of that word. For example, if the text is "cat dog cat cat cow" and the pattern is a search for cat*, the match method returns an array of three occurrences of "cat", however, they all point to only the index of the first occurrence of cat when i use indexOf on a loop through the array. I'm assuming this is just how the string.match method is (although please let me know if i'm doing something wrong or missing something!). I want to find the specific indices of every occurrence of a match, even if it is of a word that was already previously matched. I'm wondering if that is just how the string.match method is and if so, if anyone has any idea what the best way to do this would be. Thanks.

    Read the article

  • Is it possible to build this type of program in PHP?

    - by Steven
    I want to build a QA program that will crawl all the pages of a site (all files under a specified domain name), and it will return all external links on the site that doesn't open in a new window (does not have the target="_blank" attribute in the href). I can make a php or javascript to open external links in new windows or to report all problem links that don't open in new windows of a single page (the same page the script is in) but what I want is for the QA tool to go and search all pages of a website and report back to me what it finds. This "spidering" is what I have no idea how to do, and am not sure if it's even possible to do with a language like PHP. If it's possible how can I go about it?

    Read the article

  • php - How do I get rid of this strange "empty delimiter" message

    - by Steven
    I have some code that uses the stristr function to extract data I need. It works, in that it gives me the results I'm looking for. BUT (you knew there was a but), it gives me this error message for every iteration of the loop: Warning: stristr() [function.stristr]: Empty delimiter in ... line 55 Like I said, the code works apart from this error. Can anyone suggest how i could amend this code to get rid of the message? Thanks in advance $data = stristr("$text", "$key"); $result = string_limit_words($data,2); print "$result<BR>";

    Read the article

  • How can I join 3 tables with mysql & php?

    - by steven
    check out the page [url]http://www.mujak.com/test/test3.php[/url] It pulls the users Post,username,xbc/xlk tags etc which is perfect... BUT since I am pulling information from a MyBB bulletin board system, its quite different. When replying, people are are allowed to change the "Thread Subject" by simplying replying and changing it. I dont want it to SHOW the changed subject title, just the original title of all posts in that thread. By default it repies with "RE:thread title". They can easily edit this and it will show up in the "Subject" cell & people wont know which thread it was posted in because they changed their thread to when replying to the post. So I just want to keep the orginial thread title when they are replying. Make sense~?? Tables:mybb_users Fields:uid,username Tables:mybb_userfields Fields:ufid Tables:mybb_posts Fields:pid,tid,replyto,subject,ufid,username,uid,message Tables:mybb_threads Fields:tid,fid,subject,uid,username,lastpost,lastposter,lastposteruid I haev tried multiple queries with no success: $result = mysql_query(" SELECT * FROM mybb_users LEFT JOIN (mybb_posts, mybb_userfields, mybb_threads) ON ( mybb_userfields.ufid=mybb_posts.uid AND mybb_threads.tid=mybb_posts.tid AND mybb_users.uid=mybb_userfields.ufid ) WHERE mybb_posts.fid=42"); $result = mysql_query(" SELECT * FROM mybb_users LEFT JOIN (mybb_posts, mybb_userfields, mybb_threads) ON ( mybb_userfields.ufid=mybb_posts.uid AND mybb_threads.tid=mybb_posts.tid AND mybb_users.uid=mybb_posts.uid ) WHERE mybb_threads.fid=42"); $result = mysql_query(" SELECT * FROM mybb_posts LEFT JOIN (mybb_userfields, mybb_threads) ON ( mybb_userfields.ufid=mybb_posts.uid AND mybb_threads.tid=mybb_posts.tid ) WHERE mybb_posts.fid=42");

    Read the article

  • Batch To Bash Conversion

    - by Steven
    I need to know this Batch Script into Bash : @echo off set /p name= Name? findstr /m "%name%" ndatabase.txt if %errorlevel%==0 ( cls echo The name is found in the database! pause >nul exit ) cls echo. echo Name not found in database. pause >nul exit I am new to the Linux Kernel, so starting off with an easy distro - Ubuntu 12.10. My problem is that I do not really know much of Bash Script, since I am very accustomed to the Batch Script format; which is obviously a bad habit for my C++.

    Read the article

  • Sources from referenced projects are not deployed to Tomcat in Eclipse

    - by Steven De Groote
    Hi, I have setup a dynamic web project in eclipse with JSF in which I trust on code from another project (framework). Therefore, I added the framework project to the build path of the website project. So far so good, Eclipse recognises every class and the project builds without errors. Problem is though that when I do "run on server" to test it on tomcat 6.0.24, the application fails. I get ClassNotFoundException on every class from the framework project. Is this a bug or is some specific configuration necessary for this?

    Read the article

  • How to remove [^a-z\s] in C++

    - by Steven
    So far I have: int SimplifyText(char chars[], int length) { //To lower for(int i=0; i<length; i++) { chars[i] = tolower(chars[i]); } This function simplifies the text in the first argument which is an array containing the number of characters as given in the second argument The requirements are: tolower all remove all non-alpha characters replace multiple whitespace by one blank. Any leading whitespace at the beginning of the array should be removed completely. The resulting number of characters should be returned as the value of the function. And the annoying part: Another array cannot appear in the function Cannot use strings, only char arrays. Cannot using G++'s extension for setting an array size using a variable. Oh and can't use regex :) I'm stuck with this, any help would be great. :)

    Read the article

  • Using unions to simplify casts

    - by Steven Lu
    I realize that what I am trying to do isn't safe. But I am just doing some testing and image processing so my focus here is on speed. Right now this code gives me the corresponding bytes for a 32-bit pixel value type. struct Pixel { unsigned char b,g,r,a; }; I wanted to check if I have a pixel that is under a certain value (e.g. r, g, b <= 0x10). I figured I wanted to just conditional-test the bit-and of the bits of the pixel with 0x00E0E0E0 (I could have wrong endianness here) to get the dark pixels. Rather than using this ugly mess (*((uint32_t*)&pixel)) to get the 32-bit unsigned int value, i figured there should be a way for me to set it up so I can just use pixel.i, while keeping the ability to reference the green byte using pixel.g. Can I do this? This won't work: struct Pixel { unsigned char b,g,r,a; }; union Pixel_u { Pixel p; uint32_t bits; }; I would need to edit my existing code to say pixel.p.g to get the green color byte. Same happens if I do this: union Pixel { unsigned char c[4]; uint32_t bits; }; This would work too but I still need to change everything to index into c, which is a bit ugly but I can make it work with a macro if i really needed to.

    Read the article

  • How to ensure structures are completly initialized (by name) in GCC?

    - by Steven Spark
    How do I ensure each and every field of my structures are initialized in GCC when using designated initializers? (I'm especially interested in function pointers.) (I'm using C not C++.) Here is an example: typedef struct { int a; int b; } foo_t; typedef struct { void (*Start)(void); void (*Stop)(void); } bar_t; foo_t fooo = { 5 }; foo_t food = { .b=4 }; bar_t baro = { NULL }; bar_t bard = { .Start = NULL }; -Wmissing-field-initializers does not help at all. It works for fooo only in GCC (mingw 4.7.3, 4.8.1), and clang does only marginally better (no warnings for food and bard). I'm sure there is a reason for not producing warnings for designated initializer (even when I explicitly ask for them) but I want/need them. I do not want to initialize structures based on order/position because that is more error prone (for example swapping Start and Stop won't even give any warning). And neither gcc nor clang will give any warning that I failed to explicitly initialize a field (when initializing by name). I also don't want to litter my code with if(x.y==NULL) lines for multiple reasons, one of which is I want compile time warnings and not runtime errors. At least splint will give me warnings on all 4 cases, but unfortunately I cannot use splint all the time (it chokes on some of the code (fails to parse some C99, GCC extensions)). Note: If I'm using a real function instead of NULL GCC will also show a warning for baro (but not bard). I searched google and stack overflow but only found related questions and have not found answer for this specific problem. The best match I have found is 'Ensure that all elements in a structure are initialized' Ensure that all elements in a structure are initialized Which asks pretty much the same question, but has no satisfying answer. Is there a better way dealing with this that I have not mentioned? (Maybe other code analysis tool? Preferably something (free) that can be integrated into Eclipse or Visual Studio...)

    Read the article

  • Keeping a window always on top -- including menus (win32)

    - by Steven Lu
    I would like to have a layered window that is always-on-top, which I can accomplish, but there are certain screen elements that still get drawn over it, such as menus (including the start menu). Is there any way to make a window or child window of my application have a high enough top-ness property that it will draw over another application's menus? Or is there something built in to windows that ensures that menus in the currently active application are always drawn on top? In fact, I don't really understand all that well how menus work. So it might not even make any sense for me to try to make my window "act like a menu" in hopes of making it cover more things.

    Read the article

  • Why doesn't Google OpenID provider work with PHP-OpenId on my server?

    - by Steven Devijver
    Hey, I'm using PHP-OpenId 2.1.3 which I've unzipped on my server here (this is the consumer example that comes with PHP-OpenId). When I enter the Google OpenId url (https://www.google.com/accounts/o8/id) and submit I get a blank screen. When I try the exact same example code on the PHP-OpenId website here with the same URL it works fine. I don't understand what I'm doing wrong. The only thing I can think of is that somehow Google does not want to work with my server. Any ideas how to make this work? Thanks

    Read the article

  • Three 1D Arrays to One 2D Array

    - by Steven
    I have a function which accepts a 2D array, but my data is in three 1D arrays. How do I create a 2D array consisting of the three arrays to pass to the subroutine? Dim Y0(32) As Double Dim Y1(32) As Double Dim Y2(32) As Double 'Code to fill arrays' 'Attempting to call:' Sub PlotYMult(YData(,) as Double)

    Read the article

  • Where can I find good collaboration tool?

    - by Steven
    I'm working on a project where I'm using mindmeister.com as a tool when brainstorming new ideas. Now I need a tool where I can define roles and what responsibilities they have, and link this to a person / persons. It would also be nice if I could add tasks with a due date for each person. Are there any open source websites which has this?

    Read the article

  • How can I cut down on this spam, and what is the point of it anyway?

    - by Steven
    I run a small, niche personal ads site. People post ads and then other people reply to them, which sends an email to the original creator of the ad telling them that someone is interested and giving them contact information for that interested person. Lately there's been some weird spam. People are receiving nonsense replies to their ads. Here is an example of one: Name: xkauwvyr Reply: vRYmbI <a href="http://rypmoxdkfblf.com/">rypmoxdkfblf</a>, url=http://pnjlwvhizwbq.com/]pnjlwvhizwbq[/url], [link=http://hmenwoujxrfv.com/]hmenwoujxrfv[/link], http://ogsekuhoyeud.com/ They vary in length and composition but they all look roughly like that. The first idea I had was to simply throw out any reply that contained the string " Also, is this spam just some ass playing a trick on my website, or is it something more malicious?

    Read the article

  • Adobe popping out of the browser

    - by Steven
    Hi, Im building a web application that displays a xfdf document. When we are testing in adobe 5 and we can't stop adobe opening outside the webpage. The user clicks the report and it should open in the browser but instead it opens in adobe it appears to work in everything but adobe 5. We have previously done this with out any problems. Any ideas? This is a snippet of the xfdf <?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"> <fields> <field name="fld_AccomAttic"> <value>0</value> </field> <field name="fld_AccomBathroom"> <value>1</value> </field> <field name="fld_AccomBedrooms"> <value>3</value> </field> <field name="fld_AccomCellars"> <value>0</value> </field> <field name="fld_AccomGarages"> <value>Off</value> </field><f href="{report name}"/></xfdf> Any help would be great Sp

    Read the article

  • Regular expression to match text that doesn't start with substring?

    - by Steven
    I have text with file names scattered throughout. The filenames appear in the text like this: |test.txt| |usr01.txt| |usr02.txt| |foo.txt| I want to match the filenames that don't start with usr. I came up with (?<=\|).*\.txt(?=\|) to match the filenames, but it doesn't exclude the ones starting with usr. Is this possible with regular expressions?

    Read the article

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