Search Results

Search found 45013 results on 1801 pages for 'example'.

Page 32/1801 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • problem with accessing a php page

    - by EquinoX
    So I have a info.php page which is located on the folder /var/www/nginx-default, however when I go to my ip address/info.php, it always redirects me to this site: http://www.iana.org/domains/example/ is this because I have a virtual host that I called example? Here is my config for the example website: server { listen 80; server_name www.example.com; rewrite ^/(.*) http://example.com/$1 permanent; } server { listen 80; server_name example.com; access_log /var/www/example.com/logs/access.log; error_log /var/www/example.com/logs/error.log; location / { root /var/www/example.com/public/; index index.html; } } The way I access this site is by changing my /var/hosts in my macbook so that example.com is mapped to my server IP address... however now when I do xxx.xxx.xxx.xxx/info.php.. it redirects me to that site I posted above

    Read the article

  • How did the Lunar Lander example make the image backgrounds transparent?

    - by user279112
    Hello. I'm trying to make a GUI program with the Android SDK, using their Lunar Lander example as a significant self-teaching tool in the process. I've noticed their sprites' images' backgrounds, which were at least usually pure white, did not show up in their program. I want to ask how they did that, since their site doesn't explain simple things very well. I've managed to pull that off before on another GUI SDK, wherein all I had to do was to call a function and pass it a few floats to define a certain color, and until my code told it to do otherwise, that function would make sure that that particular color in my sprites' images was totally transparent. However I've wrestled with the Lunar Lander example and getting my own program to show some custom graphics for a week or two now, and I haven't noticed any such function call in the Lunar Lander example. I tried to look for it, but I did not find anything. I've tried to Google some tutorial or other reference material, but what I've found so far is just straying off into unrelated areas and totally dodging this EXTREMELY important lesson on the SDK's basics. Any ideas? Thanks!

    Read the article

  • Worse is better. Is there an example?

    - by J.F. Sebastian
    Is there a widely-used algorithm that has time complexity worse than that of another known algorithm but it is a better choice in all practical situations (worse complexity but better otherwise)? An acceptable answer might be in a form: There are algorithms A and B that have O(N**2) and O(N) time complexity correspondingly, but B has such a big constant that it has no advantages over A for inputs less then a number of atoms in the Universe. Examples highlights from the answers: Simplex algorithm -- worst-case is exponential time -- vs. known polynomial-time algorithms for convex optimization problems. A naive median of medians algorithm -- worst-case O(N**2) vs. known O(N) algorithm. Backtracking regex engines -- worst-case exponential vs. O(N) Thompson NFA -based engines. All these examples exploit worst-case vs. average scenarios. Are there examples that do not rely on the difference between the worst case vs. average case scenario? Related: The Rise of ``Worse is Better''. (For the purpose of this question the "Worse is Better" phrase is used in a narrower (namely -- algorithmic time-complexity) sense than in the article) Python's Design Philosophy: The ABC group strived for perfection. For example, they used tree-based data structure algorithms that were proven to be optimal for asymptotically large collections (but were not so great for small collections). This example would be the answer if there were no computers capable of storing these large collections (in other words large is not large enough in this case). Coppersmith–Winograd algorithm for square matrix multiplication is a good example (it is the fastest (2008) but it is inferior to worse algorithms). Any others? From the wikipedia article: "It is not used in practice because it only provides an advantage for matrices so large that they cannot be processed by modern hardware (Robinson 2005)."

    Read the article

  • What is wrong with the JavaScript event handling in this example? (Using click() and hover() jQuery

    - by Bungle
    I'm working on a sort of proof-of-concept for a project that approximates Firebug's inspector tool. For more details, please see this related question. Here is the example page. I've only tested it in Firefox: http://troy.onespot.com/static/highlight.html The idea is that, when you're mousing over any element that can contain text, it should "highlight" with a light gray background to indicate the boundaries of that element. When you then click on the element, it should alert() a CSS selector that matches it. This is somewhat working in the example linked above. However, there's one fundamental problem. When mousing over from the top of the page to the bottom, it will pick up the paragraphs, <h1> element, etc. But, it doesn't get the <div>s that encompass those paragraphs. However, for example, if you "sneak up" on the <div> that contains the two paragraphs "The area was settled..." and "Austin was selected..." from the left - tracing down the left edge of the page and entering the <div> just between the two paragraphs (see this screenshot) - then it is picked up. I assume this has something to do with the fact that I haven't attached an event handler to the <body> element (where you're entering the <div> from if you enter from the left), but I have attached handlers to the <p>s (where you're entering from if you come from the top or bottom). There are also other issues with mousing in and out elements - background colors that "stick" and the like - that I think are also related. As indicated in the related question posted above, I suspect there is something about event bubbling that I don't understand that is causing unexpected behavior. Can anyone spot what's wrong with my code? Thanks in advance for any help!

    Read the article

  • Fluent NHibernate: Example of a one-to-many relationship on an abstract class of a table-per-subclas

    - by BigTommy79
    Hi All, I've been trying for ages to find an example (because I can't get it to work myself) of the correct mapping for a one-to-many relationship on an abstract class of a table-per-subclass implementation, in fluent nHibernate. An example below: I'm looking to map the list of Fines on the Debt abstract base class to the Fine class. if anyone knows of any tutorial or example they've come across before please let me know. Thanks, Tim public abstract class Entity { public int Id { get; set; } } public abstract class Debt : Entity { public decimal Balance { get; set; } public IList<Fine> Fines { get; set; } public Debt() { Fines = new List<Fine>(); } } public class CarLoan : Debt { } public class CreditCard : Debt { } public class LoanApplication : Entity { public IList<Debt> ExistingDebts { get; set; } public LoanApplication() { ExistingDebts = new List<Debt>(); } } public class Fine { public Int64 Cash { get; set; } }

    Read the article

  • Updating a C# 2.0 events example to be idiomatic with C# 3.5?

    - by Damien Wildfire
    I have a short events example from .NET 2.0 that I've been using as a reference point for a while. We're now upgrading to 3.5, though, and I'm not clear on the most idiomatic way to do things. How would this simple events example get updated to reflect idioms that are now available in .NET 3.5? // Args class. public class TickArgs : EventArgs { private DateTime TimeNow; public DateTime Time { set { TimeNow = value; } get { return this.TimeNow; } } } // Producer class that generates events. public class Metronome { public event TickHandler Tick; public delegate void TickHandler(Metronome m, TickArgs e); public void Start() { while (true) { System.Threading.Thread.Sleep(3000); if (Tick != null) { TickArgs t = new TickArgs(); t.Time = DateTime.Now; Tick(this, t); } } } } // Consumer class that listens for events. public class Listener { public void Subscribe(Metronome m) { m.Tick += new Metronome.TickHandler(HeardIt); } private void HeardIt(Metronome m, TickArgs e) { System.Console.WriteLine("HEARD IT AT {0}",e.Time); } } // Example. public class Test { static void Main() { Metronome m = new Metronome(); Listener l = new Listener(); l.Subscribe(m); m.Start(); } }

    Read the article

  • Line by Line explanation of "Javascript: Good Parts" example?

    - by Matrym
    I'm reading "Javascript: The Good Parts" and am totally baffled by what's really going on here. A more detailed and/or simplified explanation would be greatly appreciated. // BAD EXAMPLE // Make a function that assigns event handler functions to an array of nodes the wrong way. // When you click on a node, an alert box is supposed to display the ordinal of the node. // But it always displays the number of nodes instead. var add_the_handlers = function (nodes) { var i; for (i = 0; i < nodes.length; i += 1) { nodes[i].onclick = function (e) { alert(i); } } }; // END BAD EXAMPLE The add_the_handlers function was intended to give each handler a unique number (i). It fails because the handler functions are bound to the variable i, not the value of the variable i at the time the function was made: // BETTER EXAMPLE // Make a function that assigns event handler functions to an array of nodes the right way. // When you click on a node, an alert box will display the ordinal of the node. var add_the_handlers = function (nodes) { var i; for (i = 0; i < nodes.length; i += 1) { nodes[i].onclick = function (i) { return function (e) { alert(i); }; }(i); } }; Now, instead of assigning a function to onclick, we define a function and immediately invoke it, passing in i. That function will return an event handler function that is bound to the value of i that was passed in, not to the i defined in add_the_handlers. That returned function is assigned to onclick.

    Read the article

  • Prolog Beginner: Trivial Example that I cannot get to work.

    - by sixtyfootersdude
    I have some prolog. The lessThanTen and example predicates work as expected however the exam predicate does not work. lessThanTen(9). lessThanTen(8). lessThanTen(7). lessThanTen(6). lessThanTen(5). lessThanTen(4). lessThanTen(3). lessThanTen(2). lessThanTen(1). lessThanTen(0). example(X) :- X is 5. exam(X) :- X is lessThanTen(Y). Here is the output: % swipl ... ?- [addv1]. Warning: /.../addv1.pl:17: Singleton variables: [Y] % addv1 compiled 0.00 sec, 1,484 bytes true. ?- lessThanTen(X). X = 9 ; X = 8 ; X = 7 ; ... ?- example(X). X = 5. ?- exam(X). ERROR: is/2: Arithmetic: `lessThanTen/1' is not a function ?- exam(5). ERROR: is/2: Arithmetic: `lessThanTen/1' is not a function I am thinking that the warning I am getting is pretty key.

    Read the article

  • NGINX Configuration Error using Codex Example: Is This a Typo in Codex?

    - by jw60660
    I installed NGINX using this tutorial: C3M Digital NGINX Tuturial but after reading this article on security issues with "cut and paste" configuration tutorials: Neal Poole's article regarding security and NGINX configuration I decided to follow Poole's suggestion to use the configuration suggested in the WordPress codex: Codex on NGINX Configuration I used the Codex configuration for a multisite installation using W3 Total Cache. When attempting to start NGINX I get an error saying that the /etc/nginx/nginx.conf test failed. The error message was: "Restarting nginx: nginx: [emerg] unknown directive "//" in /etc/nginx/sites-enabled/teambrazil.com:18" When I looked at my site specific configuration at that path I noticed the rewrite rule in the server block was: rewrite ^ $scheme://teambrazil.conf$request_uri redirect; That line in the Codex example was: rewrite ^ $scheme://mysite.conf$request_uri redirect; That looked like a mistake to me, and I changed my line to: rewrite ^ $scheme://teambrazil.com$request_uri redirect; I then attempted to restart NGINX but got the same error message. My question is: is that a mistake, and is there anything more I have to do aside from restarting NGINX after making this change. As suggested by both tutorials I set up the directories: /etc/nginx/sites-enabled and /etc/nginx/sites-available and created the appropriate symbolic links using: touch /etc/nginx/sites-available/teambrazil.com ln -s /etc/nginx/sites-available/teambrazil.com /etc/nginx/sites-enabled/teambrazil.com Is there something else I need to consider after making this correction? Or was it not an error in the first place? I'm pretty stuck here. BTW, I am using Debian squeeze as an OS on Amerinoc's VPS. I'm just getting familiar with VPS administration and am pretty much a noob. Thanks very much, would appreciate any input.

    Read the article

  • Couldn't drop privileges: User is missing UID (see mail_uid setting)

    - by drecute
    I'm hoping I can use some help. I'm configuring dovecot_ldap, but I can't seem to be able to get dovecot to authenticate the ldap user. Below is my config and log info: hosts = 192.168.128.45:3268 dn = cn=Administrator,cn=Users,dc=company,dc=example,dc=com dnpass = "passwd" auth_bind = yes ldap_version = 3 base = dc=company, dc=example, dc=com user_attrs = sAMAccountName=home=/var/vmail/example.com/%$,uid=1001,gid=1001 user_filter = (&(sAMAccountName=%Ln)) pass_filter = (&(ObjectClass=person)(sAMAccountName=%u)) dovecot.conf # 2.0.19: /etc/dovecot/dovecot.conf # OS: Linux 3.2.0-33-generic x86_64 Ubuntu 12.04 LTS auth_mechanisms = plain login auth_realms = example.com auth_verbose = yes disable_plaintext_auth = no mail_access_groups = mail mail_location = mbox:~/mail:INBOX=/var/mail/%u mail_privileged_group = mail passdb { driver = pam } passdb { driver = passwd } passdb { args = /etc/dovecot/dovecot-ldap.conf.ext driver = ldap } passdb { args = scheme=CRYPT username_format=%u /etc/dovecot/users driver = passwd-file } protocols = " imap pop3" service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } } service imap-login { inet_listener imap { port = 143 } inet_listener imaps { port = 993 ssl = yes } } ssl_cert = </etc/ssl/certs/dovecot.pem ssl_key = </etc/ssl/private/dovecot.pem userdb { driver = passwd } userdb { args = /etc/dovecot/dovecot-ldap.conf.ext driver = ldap } userdb { args = username_format=%u /etc/dovecot/users driver = passwd-file } protocol imap { imap_client_workarounds = tb-extra-mailbox-sep imap_logout_format = bytes=%i/%o mail_plugins = } mail.log Nov 29 10:51:44 mail dovecot: auth-worker: pam(charyorde,10.10.1.28): pam_authenticate() failed: Authentication failure (password mismatch?) Nov 29 10:51:44 mail dovecot: auth-worker: passwd(charyorde,10.10.1.28): unknown user Nov 29 10:51:44 mail dovecot: auth: passwd(charyorde,10.10.1.28): unknown user Nov 29 10:51:44 mail dovecot: imap-login: Login: user=<charyorde>, method=PLAIN, rip=10.10.1.28, lip=10.10.1.30, mpid=1892, TLS Nov 29 10:51:44 mail dovecot: imap(charyorde): Error: user charyorde: Couldn't drop privileges: User is missing UID (see mail_uid setting) Nov 29 10:51:44 mail dovecot: imap(charyorde): Error: Internal error occurred. Refer to server log for more information. Nov 29 10:51:46 mail dovecot: auth-worker: pam(charyorde,10.10.1.28): pam_authenticate() failed: Authentication failure (password mismatch?) Nov 29 10:51:46 mail dovecot: auth-worker: passwd(charyorde,10.10.1.28): unknown user Nov 29 10:51:46 mail dovecot: auth: passwd(charyorde,10.10.1.28): unknown user Nov 29 10:51:46 mail dovecot: imap-login: Login: user=<charyorde>, method=PLAIN, rip=10.10.1.28, lip=10.10.1.30, mpid=1894, TLS Nov 29 10:51:46 mail dovecot: imap(charyorde): Error: user charyorde: Couldn't drop privileges: User is missing UID (see mail_uid setting) Nov 29 10:51:46 mail dovecot: imap(charyorde): Error: Internal error occurred. Refer to server log for more information. Nov 29 10:51:48 mail dovecot: auth-worker: pam([email protected],10.10.1.28): pam_authenticate() failed: Authentication failure (password mismatch?) Nov 29 10:51:48 mail dovecot: auth-worker: passwd([email protected],10.10.1.28): unknown user Nov 29 10:51:48 mail dovecot: auth: ldap([email protected],10.10.1.28): unknown user Nov 29 10:51:48 mail dovecot: auth: passwd-file([email protected],10.10.1.28): unknown user Nov 29 10:51:54 mail postfix/smtpd[1880]: idle timeout -- exiting Nov 29 10:51:54 mail postfix/smtpd[1879]: idle timeout -- exiting Nov 29 10:51:54 mail postfix/smtpd[1886]: proxymap stream disconnect Nov 29 10:51:54 mail postfix/smtpd[1887]: proxymap stream disconnect Nov 29 10:51:54 mail postfix/smtpd[1886]: auto_clnt_close: disconnect private/tlsmgr stream Nov 29 10:51:54 mail postfix/smtpd[1887]: auto_clnt_close: disconnect private/tlsmgr stream Nov 29 10:51:54 mail postfix/smtpd[1887]: idle timeout -- exiting Nov 29 10:51:54 mail postfix/smtpd[1886]: idle timeout -- exiting Nov 29 10:51:56 mail dovecot: auth-worker: pam([email protected],10.10.1.28): pam_authenticate() failed: Authentication failure (password mismatch?) Nov 29 10:51:56 mail dovecot: auth-worker: passwd([email protected],10.10.1.28): unknown user Nov 29 10:51:56 mail dovecot: auth: ldap([email protected],10.10.1.28): unknown user Nov 29 10:51:56 mail dovecot: auth: passwd-file([email protected],10.10.1.28): unknown user Nov 29 10:52:04 mail dovecot: auth-worker: pam([email protected],10.10.1.28): pam_authenticate() failed: Authentication failure (password mismatch?) Nov 29 10:52:04 mail dovecot: auth-worker: passwd([email protected],10.10.1.28): unknown user Nov 29 10:52:04 mail dovecot: auth: ldap([email protected],10.10.1.28): unknown user Nov 29 10:52:04 mail dovecot: auth: passwd-file([email protected],10.10.1.28): unknown user Nov 29 10:52:06 mail dovecot: imap-login: Disconnected (auth failed, 3 attempts): user=<[email protected]>, method=PLAIN, rip=10.10.1.28, lip=10.10.1.30, TLS Thank you for looking into this.

    Read the article

  • Example WCF XML-RPC client C# code against custom XML-RPC server implementation?

    - by mr.b
    I have built my own little custom XML-RPC server, and since I'd like to keep things simple, on both server and client side (server side PHP runs, by the way), what I would like to accomplish is to create a simplest possible client in C# using WCF. Let's say that Contract for service exposed via XML-RPC is as follows. [ServiceContract] public interface IContract { [OperationContract(Action="Ping")] string Ping(); // server returns back string "Pong" [OperationContract(Action="Echo")] string Echo(string message); // server echoes back whatever message is } So, there are two example methods, one without any arguments, and another with simple string argument, both returning strings (just for sake of example). Service is exposed via http. What's next? Thanks for reading! P.S. I have done my homework of googling around for samples and similar, but all that I could come up with are some blog-related samples that use existing (and very big) classes, which implement correct IContract (or IBlogger) interfaces, so that most of what I am interested is hidden below several layers of abstraction...

    Read the article

  • HelloAndroid]emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity

    - by wang813
    Hello, I am new to Android. Follow the HelloAndroid Tutorials by use Eclipse. After run HelloAndroid, the AVD 'xian_avd2' lunched, but stop there, no " Hello, Android" displayed on AVD. Looks like Waiting for HOME ('android.process.acore') to be launched... Not know how to resolve this, please help. Thanks wang813 [2010-01-29 00:12:13 - HelloAndroid]------------------------------ [2010-01-29 00:12:13 - HelloAndroid]Android Launch! [2010-01-29 00:12:13 - HelloAndroid]adb is running normally. [2010-01-29 00:12:13 - HelloAndroid]Performing com.example.helloandroid.HelloAndroid activity launch [2010-01-29 00:12:13 - HelloAndroid]Automatic Target Mode: Preferred AVD 'xian_avd2' is not available. Launching new emulator. [2010-01-29 00:12:14 - HelloAndroid]Launching a new emulator with Virtual Device 'xian_avd2' [2010-01-29 00:12:37 - HelloAndroid]New emulator found: emulator-5554 [2010-01-29 00:12:37 - HelloAndroid]Waiting for HOME ('android.process.acore') to be launched... [2010-01-29 00:13:59 - HelloAndroid]emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!

    Read the article

  • Rails - embedded polymorphic comment list + add comment form - example?

    - by odigity
    Hey, all. Working on my first Rails app. I've searched all around - read a bunch of tutorials, articles, and forum posts, watched some screencasts, and I've found a few examples that come close to what I'm trying to do (notably http://railscasts.com/episodes/154-polymorphic-association and ep 196 about nested model forms), but not exactly. I have two models (Podcast and BlogPost) that need to be commentable, and I have a Comment model that is polymorphically related to both. The railscasts above had a very similar example (ep 154), but Ryan used a full set of nested routes, so there were specific templates for adding and editing comments. What I want to do is show the list of comments right on the Podcast or BlogPost page, along with an Add Comment form at the bottom. I don't need a separate add template/route, and I don't need the ability to edit, only delete. This is a pretty common design on the web, but I can't find a Rails example specifically about this pattern. Here's my current understanding: I need routes for the create and delete actions, of course, but there are no templates associated with those. I'm also guessing that the right approach is to create a partial that can be included at the bottom of both the Podcast and BlogPost show template. The logical name for the partial seems to me to be something like _comments.html.haml. I know it's a common convention to have the object passed to the partial be named after the template, but calling the object 'comments' seems to not match my use case, since what I really need to pass is the commentable object (Podcast or BlogPost). So, I guess I'd use the locals option for the render partial call? (:commentable = @podcast). Inside the partial, I could call commentable.comments to get the comments collection, render that with a second partial (this time with the conventional use case, calling the partial _comment.html.haml), then create a form that submits to... what? REST-wise, it should be a POST to the collection, which would be /podcast|blogpost/:id/comments, and I think the helper for that is podcast_comments_path(podcast) if it were a podcast - not sure what to do though, since I'm using polymorphic comments. That would trigger the Comment.create action, which would then need to redirect back to the podcast|blogpost path /podcast|blogpost/:id. It's all a bit overwhelming, which is why I was really hoping to find a screencast or example that specifically implements this design.

    Read the article

  • Looking for a good example usage of get_or _create in Django views and raising a Form error

    - by Rik Wade
    I am looking for a good example of how to achieve the following: I would like to use get_or_create to check whether an object already exists in my database. If it does not, then it will be created. If it does exist, then I will not create the new object, but need to raise a form error to inform the user that they need to enter different data (for example, a different username). The view contains: p, created = Person.objects.get_or_create( email = registration_form.cleaned_data['email'], defaults = { 'creationDate': datetime.datetime.now(), 'dateOfBirth': datetime.date(1970,1,1) }) So 'p' will contain the existing Person if it exists, or the new Person if not. I would like to act on the boolean value in 'created' in order to skip over saving the Person and re-display the registration_form and raise an appropriate form validation error. The alternative I'm considering is doing a check in a custom Form validation method to see whether a Person exists with the data in the provided 'email' field, and just raising a validation error.

    Read the article

  • How can I send an automated reply to the sender and all recipients with Procmail?

    - by jchong
    I'd like to create a procmail recipe or Perl or shell script that will send an auto response to the original sender as well as anybody that was copied (either To: or cc:) on the original email. Example: [email protected] writes an email to [email protected] and [email protected] (in the To: field). Copies are sent via cc: to [email protected] and [email protected]. I'd like the script to send an auto response to the original sender ([email protected]) and everybody else that was sent a copy of the email ([email protected], [email protected], [email protected] and [email protected]). Thanks

    Read the article

  • What's the topmost iframe in the same domain?

    - by Jakob Stoeck
    How can I get the topmost iframe which is in the same domain, i.e. iframe level 1 example.org iframe level 2 example.org iframe level 2 example.org iframe level 3 example.org <-- would give me iframe level 1 iframe level 1 other-example.org iframe level 2 example.org iframe level 2 example.org iframe level 3 example.org <-- would give me iframe level 2 iframe level 1 other-example.org iframe level 2 example.org iframe level 2 example.org <-- would give me iframe level 2 (this) I need it because I have a website which should work in an iframe of another domain and stand-alone. In this website there are scripts which depend on window.top which shouldn't be top but the topmost iframe in the same domain.

    Read the article

  • nginx improperly forwards to https, adds two trailing slashes when rewriting

    - by Kevin
    I'm using nginx as a proxy for a django project on mod_wsgi and to serve the static content. I have two domain names for it: asdf-example.com and asdfexample.com. I want to use rewrites to redirect everything to www.asdf-example.com They're not quite working the way they should: asdf-example.com forwards to https:// www.asdf-example.com, which fails because I'm not using SSL. Though asdf-example.com/search forwards to http://.... asdfexample.com and www.asdfexample.com both forward to www.asdf-example.com//, which looks weird. My config file: server { listen 80; server_name asdf-example.com asdfexample.com; if ($host ~* ^asdf-example\.com){ rewrite ^(.*)$ http://www.asdf-example.com/$1 permanent; } if ($host ~* ^asdfexample\.com){ rewrite ^(.*)$ http://www.asdf-example.com/$1 permanent; } if ($host ~* ^www\.asdfexample\.com){ rewrite ^(.*)$ http://www.asdf-example.com/$1 permanent; } ... Thanks

    Read the article

  • Can a repeated piece of regular expression create multiple groups? Such as this example...

    - by Yousui
    Hi guys, I'm using RUBY 's regular expression to deal with text such as ${1:aaa|bbbb} ${233:aaa | bbbb | ccc ccccc } ${34: aaa | bbbb | cccccccc |d} ${343: aaa | bbbb | cccccccc |dddddd ddddddddd} ${3443:a aa|bbbb|cccccccc|d} ${353:aa a| b b b b | c c c c c c c c | dddddd} I want to get the trimed text between each pipe line. For example, for the first line of my upper example, I want to get the result aaa and bbbb, for the second line, I want aaa, bbbb and ccc ccccc. Now I have wrote a piece of regular expression and a piece of ruby code to test it: array = "${33:aaa|bbbb|cccccccc}".scan(/\$\{\s*(\d+)\s*:(\s*[^\|]+\s*)(?:\|(\s*[^\|]+\s*))+\}/) puts array Now my problem is the (?:\|(\s*[^\|]+\s*))+ part can't create multiple groups. I don't know how to solve this problem, because the number of text I need in each line is variable. Anyone can help? Great thanks.

    Read the article

  • Is there any example code explaining how to change Facebooks API existing code to make it yours?

    - by Naeim
    FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease]; dialog.delegate = self; dialog.userMessagePrompt = @"Example prompt"; dialog.attachment = @"{\"name\":\"Facebook Connect for iPhone\"," "\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\"," "\"caption\":\"Caption\",\"description\":\"Description\"," "\"media\":[{\"type\":\"image\"," "\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\"," "\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}]," "\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}"; // replace this with a friend's UID // dialog.targetId = @"999999"; [dialog show]; Is there any example code explaining how to change Facebooks API existing code to make it yours? i want to change http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg to http://img40.yfrog.com/img40/5914/%@.jpg //... , %mystring

    Read the article

  • Hide or Disable? In this example and in general...

    - by George
    I have the following set of controls. Scenario 1: If you select one of the first 3 radio buttons and click enter, focus will jump to the Passport Number text box. If the user selects "Other", the "Other, Please Specify" textbox is enabled and, for convenience, screen focus (the cursor is moved) to that textbox. Scenario 2: The "specify Other" text box is hidden until the user clicks on the Other Radio button. Upon doing so, the textbox is made visible and the cursor is placed in this textbox. Which scenario do you feel is a better approach? Perhaps you have another variation? Please state your reasoning. I would also appreciate it if you could make a generalized statement as to when hiding is better than disabling or vice versa, but I am also interested in this particular example. Thanks. Afetrthought: Perhaps, in the 2nd example, the "Please Specify" text would only appear after the user has selected the 'Other' radio button.

    Read the article

  • Match e-mail addresses not contained in HTML tag

    - by SvartalF
    I need to highlight an email addresses in text but not highlight them if contained in HTML tags, content, or attributes. For example, the string [email protected] must be converted to <a href="mailto:[email protected]">[email protected]</a> But email addresses in the string <a href="mailto:[email protected]">[email protected]</a> must not be processed. I've tried something like this regexp: (?<![":])[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}(?!") but it doesn't work properly.

    Read the article

  • How to implement CSRF protection in Ajax calls using express.js (looking for complete example)?

    - by Benjen
    I am trying to implement CSRF protection in an app built using node.js using the express.js framework. The app makes abundant use of Ajax post calls to the server. I understand that the connect framework provides CSRF middleware, but I am not sure how to implement it in the scope of client-side Ajax post requests. There are bits and pieces about this in other Questions posted here in stackoverflow, but I have yet to find a reasonably complete example of how to implement it from both the client and server sides. Does anyone have a working example they care to share?

    Read the article

  • Unit Testing Example, on a class with required fields?

    - by Mastro
    I'm new to developing Unit test and I can't find an example of how to test an existing class I have. The class has a save method which does an insert or update in the database when the user clicks Save in the UI. But the save method has required fields that need to be populated. And has other fields that do not. So how can I run this test properly? Was trying to write it out.. Give a user When user saves object Then Field1 is required then Field2 is required Then Field3 is required WhenUserSavesObject() object = new object object.field1 IsNot Nothing something like that right? And what about the other fields that are optional? How would I test the save method to make sure it takes all those values properly? Was trying to use BDD but not sure if I should try it or not. Can't find any example of classes with many properties that are needed when calling a test method.

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >