Search Results

Search found 252 results on 11 pages for 'shorten'.

Page 1/11 | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • javascript - shorten string to fit into a certain # of lines

    - by Mala
    Hi I have a string that must fit into a box, and must be at most 3 lines long. To shorten it, I plan to truncate it and end it with '...'. I could shorten it to a certain # of characters but if i make it look good with "wwwwwwwww [...] wwww" it won't look right with "iiiiiiiiiii [...] iiii". Is there some way I can shorten it by how much space the string would take up, as opposed to how many characters there are in a string without using a fixed-width font? Mala ps. Please no "simply create an image of '...' and overlay it over the end of the line" hacks or similar - I actually want to shorten the string to the appropriate length

    Read the article

  • javascript/php - shorten string to fit into a certain # of lines

    - by Mala
    Hi I have a string that must fit into a box, and must be at most 3 lines long. To shorten it, I plan to truncate it and end it with '...'. I could shorten it to a certain # of characters but if i make it look good with "wwwwwwwww [...] wwww" it won't look right with "iiiiiiiiiii [...] iiii". Is there some way I can shorten it by how much space the string would take up, as opposed to how many characters there are in a string without using a fixed-width font? Ideally I'd like to do this server-side (php) but recognize that actual character width stuff is far more likely to be feasible client-side (JS / jQuery) Mala ps. Please no "simply create an image of '...' and overlay it over the end of the line" hacks or similar - I actually want to shorten the string to the appropriate length

    Read the article

  • Shorten Zend Framework Route Definitions

    - by Sebastian Hoitz
    Hi! How can I shorten the definition of my custom routes in Zend Framework? I currently have this as definition: $route = new Zend_Controller_Router_Route( ":module/:id", array( "controller" => "index", "action" => "index" ), array("id" => "\d+") ); self::$frontController->getRouter()->addRoute('shortcutOne', $route); $route = new Zend_Controller_Router_Route( ":module/:controller/:id", array("action" => "index"), array("id" => "\d+") ); self::$frontController->getRouter()->addRoute('shortcutTwo', $route); $route = new Zend_Controller_Router_Route( ":module/:controller/:action/:id", null, array("id" => "\d+") ); self::$frontController->getRouter()->addRoute('shortcutThree', $route); Is there a way to better combine these rules? And what are your best practices in where to place these? I currently have them in my bootstrap class right after the Front Controller initialization.

    Read the article

  • jQuery: shorten string length to fit a set width.

    - by Marius
    Hello there, I have a table, and in each cell I want to place strings, but they are much wider than the cell width. To prevent line break, I would like to shorten the strings to fit the cell, and append '...' at end to indicate that the string is much longer. The table has about 40 rows and has to be done to each cell, so its important that its a quick. Should I use JS/jQuery for this? How would I do it? Thank you for your time. Kind regards, Marius

    Read the article

  • Shorten array length once element is remove in Java.

    - by lupin
    Note: Following is my homework/assignment, feel free not to answer if you will. I want to delete/remove an element from an String array(Set) basic, I'm not allowed to use Collections..etc. Now I have this: void remove(String newValue) { for ( int i = 0; i < setElements.length; i++) { if ( setElements[i] == newValue ) { setElements[i] = ""; } } } I does what I want as it remove the element from an array but it doesn't shorten the length. The following is the output, basically it remove the element indexed #1. D:\javaprojects>java SetsDemo Enter string element to be added A You entered A Set size is: 5 Member elements on index: 0 A Member elements on index: 1 b Member elements on index: 2 hello Member elements on index: 3 world Member elements on index: 4 six Set size is: 5 Member elements on index: 0 A Member elements on index: 1 Member elements on index: 2 hello Member elements on index: 3 world Member elements on index: 4 six lupin

    Read the article

  • Is it possible to shorten my main function in this code?

    - by AjiPorter
    Is it possible for me to shorten my main() by creating a class? If so, what part of my code would most likely be inside the class? Thanks again to those who'll answer. :) #include <iostream> #include <fstream> #include <string> #include <ctime> #include <cstdlib> #define SIZE 20 using namespace std; struct textFile { string word; struct textFile *next; }; textFile *head, *body, *tail, *temp; int main() { ifstream wordFile("WORDS.txt", ios::in); // file object constructor /* stores words in the file into an array */ string words[SIZE]; char pointer; int i; for(i = 0; i < SIZE; i++) { while(wordFile >> pointer) { if(!isalpha(pointer)) { pointer++; break; } words[i] = words[i] + pointer; } } /* stores the words in the array to a randomized linked list */ srand(time(NULL)); int index[SIZE] = {0}; // temporary array of index that will contain randomized indexes of array words int j = 0, ctr; // assigns indexes to array index while(j < SIZE) { i = rand() % SIZE; ctr = 0; for(int k = 0; k < SIZE; k++) { if(!i) break; else if(i == index[k]) { // checks if the random number has previously been stored as index ctr = 1; break; } } if(!ctr) { index[j] = i; // assigns the random number to the current index of array index j++; } } /* makes sure that there are no double zeros on the array */ ctr = 0; for(i = 0; i < SIZE; i++) { if(!index[i]) ctr++; } if(ctr > 1) { int temp[ctr-1]; for(j = 0; j < ctr-1; j++) { for(i = 0; i < SIZE; i++) { if(!index[i]) { int ctr2 = 0; for(int k = 0; k < ctr-1; k++) { if(i == temp[k]) ctr2 = 1; } if(!ctr2) temp[j] = i; } } } j = ctr - 1; while(j > 0) { i = rand() % SIZE; ctr = 0; for(int k = 0; k < SIZE; k++) { if(!i || i == index[k]) { ctr = 1; break; } } if(!ctr) { index[temp[j-1]] = i; j--; } } } head = tail = body = temp = NULL; for(j = 0; j < SIZE; j++) { body = (textFile*) malloc (sizeof(textFile)); body->word = words[index[j]]; if(head == NULL) { head = tail = body; } else { tail->next = body; tail = body; cout << tail->word << endl; } } temp = head; while(temp != NULL) { cout << temp->word << endl; temp = temp->next; } return 0; }

    Read the article

  • Shorten Emacs timeout of ~/.emacs read

    - by user35042
    My ~/.emacs start-up file is stored in my AFS home directory. Often when I login to a linux machine I will forget to renew my AFS credentials before attempting to edit a local (non-AFS) file with Emacs. When this happens Emacs will attempt to load ~./emacs but cannot because it is in AFS space where I do not have access. Eventually (after a minute or so) Emacs will give up trying to load ~./emacs and continue. But waiting for Emacs to timeout is annoying (typing Ctrl-Z does not seem to interrupt this timeout). I want to shorten the amount of time that Emacs waits before giving up. I have tried the suggestion at this site which says to put the following code in the site-start.el file: (with-timeout (4) (load remote-.emacs)) However, when I do that I get the error Error in init file: Symbol's value as variable is void: remote-\.emacs whenever starting Emacs. How can I shorten this timeout?

    Read the article

  • Can I shorten my directory commands in ubuntu?

    - by Spencer Cooley
    When working on a rails app I like to open all of my files through the command line like so cd my_app gedit app/views/user/show.html.erb Is there a way that I could shorten this so that I could just write something like gedit user_views/show.html.erb ? I would like the console to stay in the main directory, I just don't like having to type out app/controller/user_controler.rb every time I want to open the user controller. I know that I could just open the file with my mouse, but I feel like moving from keyboard to mouse breaks my focus a little bit. When I can just tap away at the keyboard it seems like I have a more smooth workflow.

    Read the article

  • Can I shorten my directory commands in ubuntu?

    - by Spencer Cooley
    When working on a rails app I like to open all of my files through the command line like so cd my_app gedit app/views/user/show.html.erb Is there a way that I could shorten this so that I could just write something like gedit user_views/show.html.erb ? I would like the console to stay in the main directory, I just don't like having to type out app/controller/user_controler.rb every time I want to open the user controller. I know that I could just open the file with my mouse, but I feel like moving from keyboard to mouse breaks my focus a little bit. When I can just tap away at the keyboard it seems like I have a more smooth workflow.

    Read the article

  • How to shorten DNS propagation effect

    - by Sempa
    Atm i have a domain example.com, it uses dedicated server, and it uses "ns1.example.com" and "ns2.example.com" as nameserver. Now i want to change to another dedicated server (with different IP obviously). How to shorten DNS propagation effect so that all visitors that open my domain will be pointed to the new server quickly? At this moment i am lowering the TTL value on old server (to 5 minutes) hoping that once i change the nameserver, all visitors will be pointed to new server. Am i correct? If not, can you give me suggestion?

    Read the article

  • Fail to launch application (CreateProcess error=87), can't use shorten classpath workaround

    - by Ivo Bosticky
    When I launch our application in Eclipse on Windows I receive the following error: Exception occured executing command line. Cannot run program .. : CreateProcess error=87, The parameter is incorrect I've solved this in the past by shortening the CLASSPATH. I've now come to a point where I can no longer shorten the CLASSPATH, and would like to know if there are any other workarounds. http://support.microsoft.com/kb/830473 seems to indicate that the max command prompt line length in windows xp is 8191 characters, and the only solution is to shorten folder names, reduce depth of folder trees, using parameter files, etc.

    Read the article

  • Shorten Long DNS names

    - by user32425
    Hi, Amazon gives us a very long dns names i.e. c-123-123-123-255.compute-1.amazonaws.com Is there a way to map this name into a shorter name i.e. essentially what i want to do is to modify /etc/hosts file, and map the long name into a short one, i.e. aws1 c-123-123-123-255.compute-1.amazonaws.com but because /etc/hosts file only accepts ip address mapping, then I cannot do that. Is there any other way to do this? Thanks

    Read the article

  • How would you shorten 5,000+ URLs? [closed]

    - by Tyler J Fisher
    How would you go about shortening approximately 5,000 permalinks? The links point to a remote media archiving server, and are unlikely to change. Example URLs: rtsp://foo-1.bar.com/xx/xx/xx/xx.rm http://media.foo.org/xx/xx/xx.mp4 The URLs are going to be stored in a local MySQL database, as such it's crucial that the URLs are in a manageable form (i.e bit.ly or ow.ly). There are bulk URL shortening services, but those only allow shortening of 100 links/day, which isn't technically feasible so I need to think of something else.

    Read the article

  • PowerShell - Shorten namespace names so it's easier to access types

    - by Adam Driscoll
    Is there a method of shortening PowerShell namespace references? Typing [RootNameSpace1.NameSpace2.Namepsace3+SomeEnum]::SomeValue is taxing and not a very good user expierence. I realize that you can reference System level objects without a namespace such that [Type]::GetType(... will work. Is there some manifest I could create or command I could use to shorten lengthy namespaces?

    Read the article

  • Currency Format in C# to shorten the output string

    - by james.ingham
    Hey, I currently have a Currency Format method: private string FormatCurrency(double moneyIn) { CultureInfo ci = new CultureInfo("en-GB"); return moneyIn.ToString("c", ci); } I'm looking to adapt this to shorten the string as the currency get's larger. Kind of like how stack overflow goes from 999 to 1k instead of 1000 (or 1.6k instead of 1555). I imagine that this is a relativly easy task however is there any built in function for it or would you just have to manually manipulate the string? Thanks

    Read the article

  • Language Tricks to Shorten My Java Code?

    - by yar
    I am currently rediscovering Java (working with Ruby a lot recently), and I love the compilation-time checking of everything. It makes refactoring so easy. However, I miss playing fast-and-loose with types to do an each loop. This is my worst code. Is this as short as it can be? I have a collection called looperTracks, which has instances that implement Looper. I don't want to modify that collection, but I want to iterate through its members PLUS the this (which also implements Looper). List<Looper> allLoopers = new ArrayList<Looper>(looperTracks.length + 1); for (LooperTrack track : looperTracks) { allLoopers.add(track); } allLoopers.add(this); for (Looper looper : allLoopers) { // Finally! I have a looper I'm particularly concerned about any features that are new to Java from 1.5 on that I may have missed. For this question I am not asking about JRuby nor Groovy, though I know that they would work for this. Edit: Sorry (too much Ruby!)... looperTracks is of type LooperTrack[] and LooperTrack implements Looper.

    Read the article

  • How can i shorten my code for various winform calls in MDI

    - by Shantanu Gupta
    I have a mdi where i have several line of code like the given below. Only chage is Form object which is being opened. So I want to all this work using only single function defination. When I tries to capture sender it gives me ToolStipMenuItem here. But I want its sender to be form name so that I can open its corresponding form. private void purchaseInvoiceToolStripMenuItem_Click(object sender, EventArgs e) { Forms.PurchaseInvoice purinv = new DigitalInvy.Forms.PurchaseInvoice(); purinv.Show(); } private void lederGroupsToolStripMenuItem_Click(object sender, EventArgs e) { Forms.LedgerGroup lgrp = new DigitalInvy.Forms.LedgerGroup(); lgrp.Show(); } private void voucherEntryToolStripMenuItem_Click(object sender, EventArgs e) { Forms.VoucherEntry ventry = new DigitalInvy.Forms.VoucherEntry(); ventry.Show(); } private void currencyToolStripMenuItem_Click(object sender, EventArgs e) { Forms.CurrencyMaster currency = new DigitalInvy.Forms.CurrencyMaster(); currency.Show(); } private void countryToolStripMenuItem_Click(object sender, EventArgs e) { Forms.CountryMaster country = new DigitalInvy.Forms.CountryMaster(); country.Show(); }

    Read the article

  • mod rewritten directory shorten

    - by Joseph
    I can only find mod rewrite examples/tutorials for query's, so can someone help me with this. I would like this http://website.tld/Folder1/Folder2/Folder3/Folder4/Folder5/File.exten to be transformed into http://website.tld/Folder4/File.exten Folder4 and Folder5 are multiple directories, while Folder 1-3 stay the same. Also File.exten also should be changeable in the rewrite. thanks.

    Read the article

  • How to code a URL shortener?

    - by marco92w
    I want to create a URL shortener service where you can write a long URL into an input field and the service shortens the URL to "http://www.example.org/abcdef". Instead of "abcdef" there can be any other string with six characters containing a-z, A-Z and 0-9. That makes 56 trillion possible strings. My approach: I have a database table with three columns: id, integer, auto-increment long, string, the long URL the user entered short, string, the shortened URL (or just the six characters) I would then insert the long URL into the table. Then I would select the auto-increment value for "id" and build a hash of it. This hash should then be inserted as "short". But what sort of hash should I build? Hash algorithms like MD5 create too long strings. I don't use these algorithms, I think. A self-built algorithm will work, too. My idea: For "http://www.google.de/" I get the auto-increment id 239472. Then I do the following steps: short = ''; if divisible by 2, add "a"+the result to short if divisible by 3, add "b"+the result to short ... until I have divisors for a-z and A-Z. That could be repeated until the number isn't divisible any more. Do you think this is a good approach? Do you have a better idea?

    Read the article

  • Do url shortening services shorten the id or directly the url?

    - by Tatu Meriläinen
    Assuming the urls are saved to a database where they each have id and the url saved. For example a url www.example.com (let's say with id 1000) would possibly be shortened to www.url.com/c1hd5 etc. Is the url www.example.com shortened to c1hd5 with base64 or similar or are the ids shortened? The 566 id could be shortened like this: 1 = 1, 2 = 2, ... 9 = 9, 10 = a. The 1000 id would be fE if we used every possible letter from a-Z and - _. Is it good idea to use ids from database to shorten urls?

    Read the article

  • Can I remove all-caps and shorten the disclaimer on my License?

    - by stefano palazzo
    I am using the MIT License for a particular piece of code. Now, this license has a big disclaimer in all-caps: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF... ... I've seen a normally capitalised disclaimer on the zlib license (notice that it is above the license text), and even software with no disclaimer at all (which implies, i take it, that there is indeed a guarantee?), but i'd like some sourced advice by a trusted party. I just haven't found any. GNU's License notice for other files comes with this disclaimer: This file is offered as-is, without any warranty. Short and simple. My question therefore: Are there any trusted sources indicating that a short rather than long, and a normally spelled rather than capitalised disclaimer (or even one or the other) are safely usable in all of the jurisdictions I should be concerned with? If the answer turns out to be yes: Why not simply use the short license notice that the fsf proposes for readme-files and short help documents instead of the MIT License? Is there any evidence suggesting this short 'license' will not hold up? For the purposes of this question, the software is released in the European Union, should it make any difference.

    Read the article

  • How to shorten brain context switch delay when need to use new technology\framework?

    - by gasan
    The problem is when I have to deal with a new framework\library\language it completely slows my work process, at first it's kind of shock, you're sitting on your place about a day doing nothing surfing the net, because you simply can't do anything even read docs, then, on the second day I realize that I definitely should do something and starting read about it, then I realize that I don't understand it, then I'm reading until I got feeling that I should show some results immediately and then I'm writing the code quite fast and the job doesn't seem to be difficult. Then job is done and I won't probably return to that technology\framework for a month or a year or never at all. And I will almost certainly forget almost everything about it after a month. To illustrate by checkpoints I experience: shock, long studying times, work with the new tech briefly, never use it afterwards, then I completely forget it. So what would be the solution here?

    Read the article

  • Which way should we choose to shorten backup time?

    - by facebook-100005613813158
    A company performs a full backup for its data in a daily basis for disaster recovery purposes. However, their backup process cannot be completed within the assigned backup time window. What would you recommend to this company about how to restructure its backup environment in order to minimize the backup time? We got 4 candidates, 1. Perform LAN based backup 2. Weekly full backup and daily incremental 3. Weekly full backup and daily cumulative 4. Add more ISL to increase bandwidth when comparing incremental backup with cumulative backup ,incremental backup time is surely shorter than cumulative backup time .But I don's know adding more ISL is allowed in an existing storage system,or can this operation really shorten backup time ?

    Read the article

1 2 3 4 5 6 7 8 9 10 11  | Next Page >