Search Results

Search found 4651 results on 187 pages for 'john varghese'.

Page 156/187 | < Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >

  • How to make an id auto_increment from where it last left off after a record delete?

    - by Sammy
    This isn't that big of a deal but I was wondering if it can be done. Right now when I insert a new record, the id field which is auto_increment and set as primary key increases it's value by one: id | first_name | last_name ------------------------------ 1 | John | Smith 2 | Jane | Doe But if I delete record 2, the next one I insert is going to have an id of 3. Is there any way to make it have an id of 2 automatically (without having to manually insert it)?

    Read the article

  • Under what circumstances is jQuery's document.ready() not required?

    - by Phil.Wheeler
    While John Resig's recommendation is, quite rightly, to declare all events within a jquery.document.ready() function, I know that you don't actually have to put everything in there. In fact, there are cases where it may be more appropriate to deliberately put methods outside of the ready event. But what are those cases? Obviously best practice dictates that all events are declared within the ready event, so what would best practice be for declarations outside that event?

    Read the article

  • Is Bootstrap 2.1 compatible with jQuery UI?

    - by Ghopper21
    It's a known problem that the older Bootstrap didn't work out of the box with jQuery UI, as you can see from this github discussion. There are a few mashups of the two, including jQuery Bootstrap by John Seigers and jQuery UI Bootstrap by Addy Osmani. Are those mashups still necessary with the new version of Bootstrap, or can you now just use Bootstrap and jQuery UI out of the box (as is alluded to vaguely in the github discussion)?

    Read the article

  • Modify a php limit text function adding some kind of offset to it

    - by webmasters
    Maybe you guys can help: I have a variable called $bio with bio data. $bio = "Hello, I am John, I'm 25, I like fast cars and boats. I work as a blogger and I'm way cooler then the author of the question"; I search the $bio using a set of functions to search for a certain word, lets say "author" which adds a span class around that word, and I get: $bio = "Hello, I am John, I'm 25, I like fast cars and boats. I work as a blogger and I'm way cooler then the <span class=\"highlight\">author</span> of the question"; I use a function to limit the text to 85 chars: $bio = limit_text($bio,85); The problem is when there are more then 80 chars before the word "author" in $bio. When the limit_text() is applied, I won't see the highlighted word author. What I need is for the limit_text() function to work as normal, adding all the words that contain the span class highlight at the end. Something like this: *"This is the limited text to 85 chars, but there are no words with the span class highlight so I am putting to be continued ... **author**, **author2** (and all the other words that have a span class highlight around them separate by comma "* Hope you understood what I mean, if not, please comment and I'll try to explain better. Here is my limit_text() function: function limit_text($text, $length){ // Limit Text if(strlen($text) > $length) { $stringCut = substr($text, 0, $length); $text = substr($stringCut, 0, strrpos($stringCut, ' ')); } return $text; } UPDATE: $xturnons = str_replace(",", ", ", $xturnons); $xbio = str_replace(",", ", ", $xbio); $xbio = customHighlights($xbio,$toHighlight); $xturnons = customHighlights($xturnons,$toHighlight); $xbio = limit_text($xbio,85); $xturnons = limit_text($xturnons,85); The customHighlights function which adds the span class highlighted: function addRegEx($word){ // Highlight Words return "/" . $word . '[^ ,\,,.,?,\.]*/i'; } function highlight($word){ return "<span class='highlighted'>".$word[0]."</span>"; } function customHighlights($searchString,$toHighlight){ $searchFor = array_map('addRegEx',$toHighlight); $result = preg_replace_callback($searchFor,'highlight',$searchString); return $result; }

    Read the article

  • Spring MVC, REST, and HATEOAS

    - by SingleShot
    I'm struggling with the correct way to implement Spring MVC 3.x RESTful services with HATEOAS. Consider the following constraints: I don't want my domain entities polluted with web/rest constructs. I don't want my controllers polluted with view constructs. I want to support multiple views. Currently I have a nicely put together MVC app without HATEOAS. Domain entities are pure POJOs without any view or web/rest concepts embedded. For example: class User { public String getName() {...} public String setName(String name) {...} ... } My controllers are also simple. They provide routing and status, and delegate to Spring's view resolution framework. Note my application supports JSON, XML, and HTML, yet no domain entities or controllers have embedded view information: @Controller @RequestMapping("/users") class UserController { @RequestMapping public ModelAndView getAllUsers() { List<User> users = userRepository.findAll(); return new ModelAndView("users/index", "users", users); } @RequestMapping("/{id}") public ModelAndView getUser(@PathVariable Long id) { User user = userRepository.findById(id); return new ModelAndView("users/show", "user", user); } } So, now my issue - I'm not sure of a clean way to support HATEOAS. Here's an example. Let's say when the client asks for a User in JSON format, it comes out like this: { firstName: "John", lastName: "Smith" } Let's also say that when I support HATEOAS, I want the JSON to contain a simple "self" link that the client can then use to refresh the object, delete it, or something else. It might also have a "friends" link indicating how to get the user's list of friends: { firstName: "John", lastName: "Smith", links: [ { rel: "self", ref: "http://myserver/users/1" }, { rel: "friends", ref: "http://myserver/users/1/friends" } ] } Somehow I want to attach links to my object. I feel the right place to do this is in the controller layer as the controllers all know the correct URLs. Additionally, since I support multiple views, I feel like the right thing to do is somehow decorate my domain entities in the controller before they are converted to JSON/XML/whatever in Spring's view resolution framework. One way to do this might be to wrap the POJO in question with a generic Resource class that contains a list of links. Some view tweaking would be required to crunch it into the format I want, but its doable. Unfortunately nested resources could not be wrapped in this way. Other things that come to mind include adding links to the ModelAndView, and then customizing each of Spring's out-of-the-box view resolvers to stuff links into the generated JSON/XML/etc. What I don't want is to be constantly hand-crafting JSON/XML/etc. to accommodate various links as they come and go during the course of development. Thoughts?

    Read the article

  • How and what benefit i can take from included Sizzle.js along with jquery 1.4.2?

    - by metal-gear-solid
    latest jquery 1.4.2 downloaded from jquery.com comes with Sizzle.js also. How and what benefit i can take from included Sizzle.js? /*! * jQuery JavaScript Library v1.4.2 * http://jquery.com/ * * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2010, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Sat Feb 13 22:33:48 2010 -0500 */

    Read the article

  • What are the features of C#5.0 [closed]

    - by Newbie
    Well I know that there is C#4.0 in dotnet framework 2010. But recently I came across somewhere (possibly in StackOverflow, may be in some answers of Mr. John Skeet) that there is something as C# 5.0(may be in beta). If anyone knows it, could you please highlight about that. Thanks

    Read the article

  • User has many computers, computers have many attributes in different tables, best way to JOIN?

    - by krismeld
    I have a table for users: USERS: ID | NAME | ---------------- 1 | JOHN | 2 | STEVE | a table for computers: COMPUTERS: ID | USER_ID | ------------------ 13 | 1 | 14 | 1 | a table for processors: PROCESSORS: ID | NAME | --------------------------- 27 | PROCESSOR TYPE 1 | 28 | PROCESSOR TYPE 2 | and a table for harddrives: HARDDRIVES: ID | NAME | ---------------------------| 35 | HARDDRIVE TYPE 25 | 36 | HARDDRIVE TYPE 90 | Each computer can have many attributes from the different attributes tables (processors, harddrives etc), so I have intersection tables like this, to link the attributes to the computers: COMPUTER_PROCESSORS: C_ID | P_ID | --------------| 13 | 27 | 13 | 28 | 14 | 27 | COMPUTER_HARDDRIVES: C_ID | H_ID | --------------| 13 | 35 | So user JOHN, with id 1 owns computer 13 and 14. Computer 13 has processor 27 and 28, and computer 13 has harddrive 35. Computer 14 has processor 27 and no harddrive. Given a user's id, I would like to retrieve a list of that user's computers with each computers attributes. I have figured out a query that gives me a somewhat of a result: SELECT computers.id, processors.id AS p_id, processors.name AS p_name, harddrives.id AS h_id, harddrives.name AS h_name, FROM computers JOIN computer_processors ON (computer_processors.c_id = computers.id) JOIN processors ON (processors.id = computer_processors.p_id) JOIN computer_harddrives ON (computer_harddrives.c_id = computers.id) JOIN harddrives ON (harddrives.id = computer_harddrives.h_id) WHERE computers.user_id = 1 Result: ID | P_ID | P_NAME | H_ID | H_NAME | ----------------------------------------------------------- 13 | 27 | PROCESSOR TYPE 1 | 35 | HARDDRIVE TYPE 25 | 13 | 28 | PROCESSOR TYPE 2 | 35 | HARDDRIVE TYPE 25 | But this has several problems... Computer 14 doesnt show up, because it has no harddrive. Can I somehow make an OUTER JOIN to make sure that all computers show up, even if there a some attributes they don't have? Computer 13 shows up twice, with the same harddrive listet for both. When more attributes are added to a computer (like 3 blocks of ram), the number of rows returned for that computer gets pretty big, and it makes it had to sort the result out in application code. Can I somehow make a query, that groups the two returned rows together? Or a query that returns NULL in the h_name column in the second row, so that all values returned are unique? EDIT: What I would like to return is something like this: ID | P_ID | P_NAME | H_ID | H_NAME | ----------------------------------------------------------- 13 | 27 | PROCESSOR TYPE 1 | 35 | HARDDRIVE TYPE 25 | 13 | 28 | PROCESSOR TYPE 2 | 35 | NULL | 14 | 27 | PROCESSOR TYPE 1 | NULL | NULL | Or whatever result that make it easy to turn it into an array like this [13] => [P_NAME] => [0] => PROCESSOR TYPE 1 [1] => PROCESSOR TYPE 2 [H_NAME] => [0] => HARDDRIVE TYPE 25 [14] => [P_NAME] => [0] => PROCESSOR TYPE 1

    Read the article

  • jQuery live search

    - by Barbara
    I really like the search function on iA and I was wondering how they did it. I found ejohn.org/blog/jquery-livesearch/ by John Resig but I still don't how to: add the counter (128/128 - the number encreases and decreases) highlight the word I'm searching in the text

    Read the article

  • I want to copy all the files available in my TFS source server to a folder in a directory.I tried th

    - by deep
    PS> C:\Windows\System32> Get-TfsItemProperty $/MyFirstTFSProj -r ` -server xyzc011b| Where {$_.CheckinDate -gt (Get-Date).AddDays(-150)} | Copy-Item D:\john\application1 -Destination C:\Test -whatif Copy-Item : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its pr operties do not match any of the parameters that take pipeline input. At line:2 char:14 + Copy-Item <<<< D:\Deepu\SilverlightApplication5 -Destination C:\Test -w hatif

    Read the article

  • Problem with skipping empty cells while importing data from .xlsx file in asp.net c# application

    - by Eedoh
    Hi to all. I have a problem with reading .xlsx files in asp.net mvc2.0 application, using c#. Problem occurs when reading empty cell from .xlsx file. My code simply skips this cell and reads the next one. For example, if the contents of .xlsx file are: FirstName LastName Age John 36 They will be read as: FirstName LastName Age John 36 Here's the code that does the reading. private string GetValue(Cell cell, SharedStringTablePart stringTablePart) { if (cell.ChildElements.Count == 0) return string.Empty; //get cell value string value = cell.ElementAt(0).InnerText;//CellValue.InnerText; //Look up real value from shared string table if ((cell.DataType != null) && (cell.DataType == CellValues.SharedString)) value = stringTablePart.SharedStringTable.ChildElements[Int32.Parse(value)].InnerText; return value; } private DataTable ExtractExcelSheetValuesToDataTable(string xlsxFilePath, string sheetName) { DataTable dt = new DataTable(); using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(xlsxFilePath, true)) { //Access the main Workbook part, which contains data WorkbookPart workbookPart = myWorkbook.WorkbookPart; WorksheetPart worksheetPart = null; if (!string.IsNullOrEmpty(sheetName)) { Sheet ss = workbookPart.Workbook.Descendants<Sheet>().Where(s => s.Name == sheetName).SingleOrDefault<Sheet>(); worksheetPart = (WorksheetPart)workbookPart.GetPartById(ss.Id); } else { worksheetPart = workbookPart.WorksheetParts.FirstOrDefault(); } SharedStringTablePart stringTablePart = workbookPart.SharedStringTablePart; if (worksheetPart != null) { Row lastRow = worksheetPart.Worksheet.Descendants<Row>().LastOrDefault(); Row firstRow = worksheetPart.Worksheet.Descendants<Row>().FirstOrDefault(); if (firstRow != null) { foreach (Cell c in firstRow.ChildElements) { string value = GetValue(c, stringTablePart); dt.Columns.Add(value); } } if (lastRow != null) { for (int i = 2; i <= lastRow.RowIndex; i++) { DataRow dr = dt.NewRow(); bool empty = true; Row row = worksheetPart.Worksheet.Descendants<Row>().Where(r => i == r.RowIndex).FirstOrDefault(); int j = 0; if (row != null) { foreach (Cell c in row.ChildElements) { //Get cell value string value = GetValue(c, stringTablePart); if (!string.IsNullOrEmpty(value) && value != "") empty = false; dr[j] = value; j++; if (j == dt.Columns.Count) break; } if (empty) break; dt.Rows.Add(dr); } } } } } return dt; }

    Read the article

  • PHP 5 functioning returning an array- interaction without assignment?

    - by Lee
    I'm wondering if this kind of thing will ever be possible in PHP (and whether it already is and I'm just missing something...) <?php function test() { return array( 'id'=>10, 'name'=>'John' ); } echo 'Your name is: '.test()['name']; ?> I'd really like to be able to use returned arrays directly instead of first assigning them to a var... possible?

    Read the article

  • How to use length indicator in a C++ program

    - by cj
    I want to make a program in C++ that reads a file where each field will have a number before it that indicates how long it is. The problem is I read every record in object of a class; how do I make the attributes of the class dynamic? For example if the field is "john" it will read it in a 4 char array. I don't want to make an array of 1000 elements as minimum memory usage is very important.

    Read the article

  • Unfamiliar Javascript Syntax

    - by user1051643
    Long and short of the story is, whilst reading John Resig's blog (specifically http://ejohn.org/blog/javascript-trie-performance-analysis/) I came across a line which makes absolutely no sense to me whatsoever. Essentially it boils down to object = object[key] = something; (this can be found in the first code block of the article I've linked.) This has proven rather difficult to google, so if anyone can offer some insight / a good online resource for me to learn for myself, I'd much appreciate it.

    Read the article

  • Get the subdomain from a URL

    - by jb
    Getting the subdomain from a URL sounds easy at first. http://www.domain.example Scan for the first period then return whatever came after the "http://" ... Then you remember http://super.duper.domain.example Oh. So then you think, okay, find the last period, go back a word and get everything before! Then you remember http://super.duper.domain.co.uk And you're back to square one. Anyone have any great ideas besides storing a list of all TLDs? John

    Read the article

  • Problem with displaying usernames in my flash[:notice] - Agile Web Development With Rails - Chapter

    - by Lee
    I can't figure out what I'm doing wrong here. I can’t seem to get the #{@user.name} to work in my flash[:notice] Everything else works just fine I can add new users, but when I add a new user instead of saying “User John Doe was successfully created”, it says “User #{@user.name} was successfully created.” I'm at this point in the depot app: depot_p/app/controllers/users_controller.rb to work.

    Read the article

  • how do I replace certain characters in a string?

    - by user296516
    Hi guys, Suppose I have a string like this SOMETHING [1000137c] SOMETHING = John Rogers III [SOMETHING] SOMETHING ELSE and I need to turn it into this SOMETHING [1000137c] SOMETHING = John_Rogers_III [SOMETHING] SOMETHING ELSE Therefor I need to replace spaces between words after "[1000137c] SOMETHING = " and before " [". How can I do that in php? Thanks!

    Read the article

  • Unknown Column In Where Clause

    - by Corpo
    I have a simple query: SELECT u_name AS user_name FROM users WHERE user_name = "john"; I get "Unknown Column 'user_name' in where clause". Can I not refer to 'user_name' in other parts of the statement even after select 'u_name as user_name'?

    Read the article

  • Ruby javascript unescape equivalent

    - by vise
    I want to unescape the following string: '\u00020\u0002Standard\u00023\u0002Doe John\u000169\u0002\u0010\u0002Lorem\u0002\u0011\u0002Ipsum\u0002\u0014\u0002' Javascripts unescape function works ok, however how can I unescape it in ruby? Take in mind that unescape(previousString) is 0Standard3Doe John69LoremIpsum.

    Read the article

< Previous Page | 152 153 154 155 156 157 158 159 160 161 162 163  | Next Page >