Search Results

Search found 1107 results on 45 pages for 'jonathan chan'.

Page 35/45 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Help with this reg. exp. in PHP

    - by Jonathan
    Hi, i don't know about regular expressions, I asked here for one that: gets either anything up to the first parenthesis/colon or the first word inside the first parenthesis. This was the answer: preg_match('/(?:^[^(:]+|(?<=^\\()[^\\s)]+)/', $var, $match); I need an improvement, I need to get either anything up to the first parenthesis/colon/quotation marks or the first word inside the first parenthesis. So if I have something like: $var = 'story "The Town in Hell"s Backyard'; // I get this: $match = 'story'; $var = "screenplay (based on)"; // I get this: $match = 'screenplay'; $var = "(play)"; // I get this: $match = 'play'; $var = "original screen"; // I get this: $match = 'original screen'; Thanks!

    Read the article

  • HTTP Compression problems on IIS7

    - by Jonathan Wood
    I've spent quite a bit of time on this but seem to be going nowhere. I have a large page that I really want to speed up. The obvious place to start seems to be HTTP compression, but I just can't seem to get it to work for me. After considerable searching, I've tried several variations of the code below. It kind of works, but after refreshing the browser, the results seem to fall apart. They were turning to garbage when the page used caching. If I turn off caching, then the page seems right but I lose my CSS formatting (stored in a separate file) and get an error that an included JS file contains invalid characters. Most of the resources I've found on the Web were either very old or focused on accessing IIS directly. My page is running on a shared hosting account and I do not have direct access to IIS7, which it's running on. protected void Application_BeginRequest(object sender, EventArgs e) { // Implement HTTP compression if (Request["HTTP_X_MICROSOFTAJAX"] == null) // Avoid compressing AJAX calls { // Retrieve accepted encodings string encodings = Request.Headers.Get("Accept-Encoding"); if (encodings != null) { // Verify support for or gzip (deflate takes preference) encodings = encodings.ToLower(); if (encodings.Contains("gzip") || encodings == "*") { Response.Filter = new GZipStream(Response.Filter, CompressionMode.Compress); Response.AppendHeader("Content-Encoding", "gzip"); Response.Cache.VaryByHeaders["Accept-encoding"] = true; } else if (encodings.Contains("deflate")) { Response.Filter = new DeflateStream(Response.Filter, CompressionMode.Compress); Response.AppendHeader("Content-Encoding", "deflate"); Response.Cache.VaryByHeaders["Accept-encoding"] = true; } } } } Is anyone having better success with this?

    Read the article

  • Retain cycle on `self` with blocks

    - by Jonathan Sterling
    I'm afraid this question is pretty basic, but I think it's relevant to a lot of Objective-C programmers who are getting into blocks. What I've heard is that since blocks capture local variables referenced within them as const copies, using self within a block can result in a retain cycle, should that block be copied. So, we are supposed to use __block to force the block to deal directly with self instead of having it copied. __block typeof(self) bself = self; [someObject messageWithBlock:^{ [bself doSomething]; }]; instead of just [someObject messageWithBlock:^{ [self doSomething]; }]; What I'd like to know is the following: if this is true, is there a way that I can avoid the ugliness (aside from using GC)?

    Read the article

  • phpmyadmin and the database

    - by Jonathan
    Not sure I fully understand what phpmyadmin does. I created a database in phpmyadmin, and would now like to start accessing the data in it from php. However I have no idea where the database is? Should I export in the phpmyadmin software? I tried that but it came up with a .sql file which can be opened in notepad and contains the SQL statements used to create the datbase and the one table inside. Basically that doesn't look like a database to me.

    Read the article

  • Google Chrome Application Mode: Possible to isolate multiple instances?

    - by Jonathan Eunice
    I want to run multiple Google Chrome application windows logged into the same web site (Twitter.com, say), each with different credentials. Is this possible? If so, how? My initial testing shows that multiple Chrome app windows are not sufficiently isolated to do this. Logging into the second account logs me into the second account in both windows, suggesting that they are sharing information just as two Chrome tabs might.

    Read the article

  • Should I aim for fewer HTTP requests or more cacheable CSS files?

    - by Jonathan Hanson
    We're being told that fewer HTTP requests per page load is a Good Thing. The extreme form of that for CSS would be to have a single, unique CSS file per page, with any shared site-wide styles duplicated in each file. But there's a trade off there. If you have separate shared global CSS files, they can be cached once when the front page is loaded and then re-used on multiple pages, thereby reducing the necessary size of the page-specific CSS files. So which is better in real-world practice? Shorter CSS files through multiple discrete CSS files that are cacheable, or fewer HTTP requests through fewer-but-larger CSS files?

    Read the article

  • Implementing Tagging using Core Data on the iPhone

    - by Jonathan Penn
    I have an application that uses CoreData and I'm trying to figure out the best way to implement tagging and filtering by tag. For my purposes, if I was doing this in raw SQLite I would only need three tables, tags, item_tags and of course my items table. Then filtering would be as simple as joining between the three tables where only items are related to the given tags. Quite straightforward. But, is there a way to do this in CoreData and utilizing NSFetchedResultsController? It doesn't seem that NSPredicate give you the ability to filter through joins. NSPredicate's aren't full SQL anyway so I'm probably barking up the wrong tree there. I'm trying to avoid reimplementing my app using SQLite without CoreData since I'm enjoying the performance CoreData gives me in other areas. Yes, I did consider (and built a test implementation) diving into the raw SQLite that CoreData generates, but that's not future proof and I want to avoid that, too. Has anyone else tried to tackle tagging/filtering with CoreData in a UITableView with NSFetchedResultsController

    Read the article

  • if string is alphabetically greater than other string in objective

    - by Jonathan
    I'm trying to use an if statement to work out which of 2 strings comes first alphabetically. Like with numbers and greater and less than: if (1 < 2) { just with strings: if(@"ahello" < @"bhello") { Or would I have to have a string containing all the letters and then check the index of the first char in each string and see which index is greater, and the index that is less than the other comes first in the alphabet and then if they are equal move on to the next char and repeat?

    Read the article

  • jQuery validation plugin for two fields

    - by jonathan p
    I am using the Jquery Validation plug-in, however i need to add a "custom rule", i have 2 date fields and i need to ensure that the end date is not less than the start date. My problem is how to pass the two fields in as elements. As i understand u set up a custom function something like this : function customValidationMethod(value, element, params){ } But can't see how i could use it with two fields, if anyone has any ideas it would be greatly appreciated.

    Read the article

  • PHP not working under IIS on WIndows 7

    - by Jonathan Allen
    I recently installed PHP on IIS/Windows 7, but it isn't working. I am getting the entire source file in the browser window. FastCGI Settings shows c:\Program Files (x86)\PHP\php-cgi.exe Handler Mappings has Request Path: *.php Modue: FastCgiModule Executable: C:\Program Files (x86)\PHP\php-cgi.exe Request Restrictions: File or Folder, All verbs, Script Access

    Read the article

  • Is the google docs embeddable previewer out of beta and will it have an have an API?

    - by Jonathan Hendler
    https://docs.google.com/viewer is awesome, but there are some customizations I need to make, and documentation would be helpful. Discovered here http://googlesystem.blogspot.com... . Haven't seen any public documentation that would help. http://code.google.com/apis/documents/overview.html covers the Google docs - where the above is more a clone of the Google Books previewer http://books.google.com/books .

    Read the article

  • Strange behaviour with fputs and a loop.

    - by Jonathan
    When running the following code I get no output but I cannot work out why. # include <stdio.h> int main() { fputs("hello", stdout); while (1); return 0; } Without the while loop it works perfectly but as soon as I add it in I get no output. Surely it should output before starting the loop? Is it just on my system? Do I have to flush some sort of buffer or something? Thanks in advance.

    Read the article

  • Oracle: What does `(+)` do in a WHERE clause?

    - by Jonathan Lonowski
    Found the following in an Oracle-based application that we're migrating (generalized): SELECT Table1.Category1, Table1.Category2, count(*) as Total, count(Tab2.Stat) AS Stat FROM Table1, Table2 WHERE (Table1.PrimaryKey = Table2.ForeignKey(+)) GROUP BY Table1.Category1, Table1.Category2 What does (+) do in a WHERE clause? I've never seen it used like that before.

    Read the article

  • release viewcontroller after presenting modally

    - by Jonathan
    I was watching CS193P Stanford course on Itunes, and in one of the lectures a demo was given and There it was said you could present the viewcontroller modally and then release it. Roughly like this (I know this isn't perfect but I'm on my PC atm) [self.view presentcontentmodally:myVC] [myVC release]; However this seems to produce problems. If I put a NSLog(@"%d", [myVC retainCount]) between those two lines then it returns 2 implying it is ok to release. However when I dismiss the myVC the app crashes. Nothing in the NSlog and the debugger won't show where it stopped. But I used malloc-history or something that some blog said would help. And found that it was the myVC. So should I be releasing myVC? (also when the modalVC has been dissmissed should the app's memory usuage go back to before the modalVC was presented?)

    Read the article

  • Are there any platforms where using structure copy on an fd_set (for select() or pselect()) causes p

    - by Jonathan Leffler
    The select() and pselect() system calls modify their arguments (the 'struct fd_set *' arguments), so the input value tells the system which file descriptors to check and the return values tell the programmer which file descriptors are currently usable. If you are going to call them repeatedly for the same set of file descriptors, you need to ensure that you have a fresh copy of the descriptors for each call. The obvious way to do that is to use a structure copy: struct fd_set ref_set_rd; struct fd_set ref_set_wr; struct fd_set ref_set_er; ... ...code to set the reference fd_set_xx values... ... while (!done) { struct fd_set act_set_rd = ref_set_rd; struct fd_set act_set_wr = ref_set_wr; struct fd_set act_set_er = ref_set_er; int bits_set = select(max_fd, &act_set_rd, &act_set_wr, &act_set_er, &timeout); if (bits_set > 0) { ...process the output values of act_set_xx... } } My question: Are there any platforms where it is not safe to do a structure copy of the struct fd_set values as shown? I'm concerned lest there be hidden memory allocation or anything unexpected like that. (There are macros/functions FD_SET(), FD_CLR(), FD_ZERO() and FD_ISSET() to mask the internals from the application.) I can see that MacOS X (Darwin) is safe; other BSD-based systems are likely to be safe, therefore. You can help by documenting other systems that you know are safe in your answers. (I do have minor concerns about how well the struct fd_set would work with more than 8192 open file descriptors - the default maximum number of open files is only 256, but the maximum number is 'unlimited'. Also, since the structures are 1 KB, the copying code is not dreadfully efficient, but then running through a list of file descriptors to recreate the input mask on each cycle is not necessarily efficient either. Maybe you can't do select() when you have that many file descriptors open, though that is when you are most likely to need the functionality.) There's a related SO question - asking about 'poll() vs select()' which addresses a different set of issues from this question.

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >