Search Results

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

Page 7/11 | < Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >

  • How can I truncate an NSString to a set length?

    - by nevan
    I searched, but surprisingly couldn't find an answer. I have a long NSString that I want to shorten. I want the maximum length to be around 20 characters. I read somewhere that the best solution is to use substringWithRange. Is this the best way to truncate a string? NSRange stringRange = {0,20}; NSString *myString = @"This is a string, it's a very long string, it's a very long string indeed"; NSString *shortString = [myString substringWithRange:stringRange]; It seems a little delicate (crashes if the string is shorter than the maximum length). I'm also not sure if it's Unicode-safe. Is there a better way to do it? Does anyone have a nice category for this?

    Read the article

  • Bad Practice requiring file within a model?

    - by Lee Marshall
    I have built an MVC php application and was wondering, if instead of having to write out a large amount of html and set the data, could I not just have all this html (with some php) in a separate file and just require it? For example: $test = '<div> Test content <div>More content</div> </div>'; $APP->Template->setData('test', $test, FALSE); Instead could I not just use: $test = require("includes/content.php"); $APP->Template->setData('test', $test, FALSE); Would this be considered as bad practise? It just seems that by requiring files, it can shorten the length of controllers. Would be good to get anybodies advice on this matter.

    Read the article

  • Characters problem in Bit.ly

    - by Fevos
    Hello, When i try to shorten a link with "#,&" Character i got an exception. is there a way to handle them . this is a sample of code that works String shortUrl = bitly.getShortUrl("http://z"); //Works but if i add for example '&' or '%25' to the string it will produce exption : - String shortUrl = bitly.getShortUrl("http://z%26"); // Exception - String shortUrl = bitly.getShortUrl("http://z&"); // Exception the getShortUrl function form this Java class: http://github.com/finnjohnsen/BitlyAndroid/raw/master/src/com/finnjohnsen/bitlyandroid/test/BitlyAndroid.java Thanks

    Read the article

  • Default Object being modified because of LINQ Query

    - by msarchet
    I'm doing the following code to filter a list of objects before it gets sent off to be printed. Dim printList As New List(Of dispillPatient) For Each pat As dispillPatient In patList If (From meds In pat.Medication Select meds Where meds.Print = True).Count > 0 Then Dim patAdd As New dispillPatient patAdd = pat patAdd.Medication = DirectCast((From meds In pat.Medication Select meds Where meds.Print = True).ToList, List(Of dispillMedication)) printList.Add(patAdd) End If Next What is happening is patList, which is my initial list, for every dispillPatient inside of it, that specific patients Medication object (which is another list), is being shorten to the list that is returned to the patAdd object. I think this has something to do with both the way that .NET makes the copy of my pat object when I do patAdd = pat and the LINQ query that I'm using. Has anyone had a similar issue before and\or what can I do to keep my initial list from getting truncated. Thanks

    Read the article

  • For Loop Question?

    - by NextRev
    I'm programming an app for the iPhone. I'm not very good with loops just yet. How do I shorten this code into a for loop? if(CGRectContainsRect([space1 frame], [box frame])){ space1.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space2 frame], [box frame])){ space2.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space3 frame], [box frame])){ space3.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space4 frame], [box frame])){ space4.image = [UIImage imageNamed:@"box.png"]; } else if(CGRectContainsRect([space5 frame], [box frame])){ space5.image = [UIImage imageNamed:@"box.png"]; }

    Read the article

  • WPF: isolated storage file path too long

    - by user342961
    Hi, I'm deploying my WPF app with ClickOnce. When developing locally in Visual Studio, I store files in the isolated storage by calling IsolatedStorageFile.GetUserStoreForDomain(). This works just fine and the generated path is C:\Users\Frederik\AppData\Local\IsolatedStorage\phqduaro.crw\hux3pljr.cnx\StrongName.kkulk3wafjkvclxpwvxmpvslqqwckuh0\Publisher.ui0lr4tpq53mz2v2c0uqx21xze0w22gq\Files\FilerefData\-581750116 (189 chars) But when I deploy my app with ClickOnce, the generated path becomes too long, resulting in a DirectoryNotFoundException when creating the isolated storage directory. The generated path with ClickOnce is: C:\Users\Frederik\AppData\Local\Apps\2.0\Data\OQ0LNXJT.R5V\8539ABHC.ODN\exqu..tion_e07264ceafd7486e_0001.0000_b8f01b38216164a0\Data\StrongName.wy0cojdd3mpvq45404l3gxdklugoanvi\Publisher.ui0lr4tpq53mz2v2c0uqx21xze0w22gq\Files\FilerefData\-581750116 (247 chars) When I browse the folders all but the last directory of the path exists. Then when trying to create a folder at this location windows tells me I can't create a directory because the resulting path name will be too long. How can I shorten the path generated by the IsolatedStorage?

    Read the article

  • JSP/JSF conversion to ASP.NET

    - by sharru
    I have a pretty big JSF web application. I must convert the application to ASP.NET. I already converted the Java code to C# code manually and also using JCLA (Java Language Conversion Assistant from Microsoft). What is the best way to convert the JSF part to ASP.NET? Is there any tool that can help shorten the work? For example convert JSF <t:dataList> to ASP.NET datagrid, or converting panelGroup to asp:panel, etc...

    Read the article

  • Is there any way to simplify a verbose SQL INSERT INTO(..) query?

    - by Soundar Rajan
    I have a table with one id (autonumber) field and 50 other fields. The table is normalized, these are 50 material properties etc. I want to copy a record from this table into the same table - only the autoincrement id will be different. The query I am using now is INSERT INTO tableName (field1,field2,....field50) SELECT field1,field2,....field50 from tableName WHERE autoid=1234; Note that I have to type in ALL the 50 field names, twice! Is there any way to shorten this query so I don't have to type all of them? Thanks.

    Read the article

  • Populate DataTable with LINQ in C#

    - by RaYell
    I have a method in my app that populates DataTable with the data using the following code: DataTable dt = this.attachmentsDataSet.Tables["Attachments"]; foreach (Outlook.Attachment attachment in this.mailItem.Attachments) { DataRow dr = dt.NewRow(); dr["Index"] = attachment.Index; dr["DisplayName"] = String.Format( CultureInfo.InvariantCulture, "{0} ({1})", attachment.FileName, FormatSize(attachment.Size)); dr["Name"] = attachment.FileName; dr["Size"] = attachment.Size; dt.Rows.Add(dr); } I was wondering if I could achieve the same functionality using LINQ in order to shorten this code a bit. Any ideas?

    Read the article

  • mailto fails in IE where there is a long body text. Is there any way to resolve this?

    - by MedicineMan
    I am having a problem using Internet Explorer 8 (IE8) to open mailto links with long messages. After the user clicks on the link, IE changes to an about:blank page and never completes the call to outlook to create an email Here's an example: <a href="mailto:[email protected]?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111">mailto fails in IE8</a> If I shorten the list of 1's, the email is generated and can be sent. Is this a known IE issue? What are the limitations?

    Read the article

  • Renaming ICSharpCode.SharpZipLib.dll

    - by John B.
    Hi, well I am having a problem renaming the ICSharpCode.SharpZipLib.dll file to anythig else. I am trying to shorten the file name. I reference the assembly in the project, but when the program reaches the statements where I use the library. It spawns an error that it could not find the assembly or file 'ICSharpCode.SharpZipLib'. When I change the file name back to ICSharpCode.SharpZipLib.dll the application works noramally. So, is there any way to change the file name. Also, am I allowed to change it without violating the license (I am going to use it in a commercial application). Thanks.

    Read the article

  • Truncate a UTF-8 string to fit a given byte count in PHP

    - by fsb
    Say we have a UTF-8 string $s and we need to shorten it so it can be stored in N bytes. Blindly truncating it to N bytes could mess it up. But decoding it to find the character boundaries is a drag. Is there a tidy way? [Edit 20100414] In addition to S.Mark’s answer: mb_strcut(), I recently found another function to do the job: grapheme_extract($s, $n, GRAPHEME_EXTR_MAXBYTES); from the intl extension. Since intl is an ICU wrapper, I have a lot of confidence in it.

    Read the article

  • Batch number variable setter.

    - by eyefinity
    I need help with this batch file I'm working on, Basically everytime it does a task it should plus the variable %number% by one which works fine and all and then repeat over again doing a different task until its completed. This is the code which it uses to repeat I need a way of settings basically: set svn=%svn%%number% set svnlink=%svnlink%%number% set svnfolder=%svnfolder%%number% Instead I am using: if %number%==1 ( set svn=%svn1% set svnlink=%svnlink1% set svnfolder=%svnfolder1%) if %number%==2 ( set svn=%svn2% set svnlink=%svnlink2% set svnfolder=%svnfolder2%) if %number%==3 ( set svn=%svn3% set svnlink=%svnlink3% set svnfolder=%svnfolder3%) Which i really need to shorten as this goes up to number 20+ Is this possible? If you could help me, Thanks!

    Read the article

  • Minify an Entire Directory While Keeping Element/Style/Script Relationships?

    - by Jonathan Sampson
    Do any solutions currnetly exist that can minify an entire project directory? More importantly, do any solutions exist that can shorten classnames, id's, and keep them consistent throughout all documents? Something that can turn this: Index.html --- <div class="fooBar"> <!-- Code --> </div> Styles.css --- .fooBar { // Comments and Messages background-color:#000000; } Index.js --- $(".fooBar").click(function(){ /* More Comments */ alert("fooBar"); }); Into This: Index.html --- <div class="a"></div> Styles.css --- .a{background-color:#000;} Index.js --- $(".a").click(function(){alert("fooBar");});

    Read the article

  • Find any type of url, and replace "click here" text with regexp jquery

    - by Takács Zsolt
    Hi! I need a little script in jQ because I have to change the long urls to a shorten "click here" text. I want to change only the url text not the value of href's attrib like this: <a href="http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme">http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme</a> to.. <a href="http://verylongurl.ext/ohshitwhatlongisit/yaythatstoolongforme">click here</a> The script must work on any possible type of url for example: http: https: ftp: and so on... tyvm girls and guys! Regs!

    Read the article

  • Use LINQ to count the number of combinations existing in two lists

    - by Ben McCormack
    I'm trying to create a LINQ query (or queries) that count the total number of occurences of a combinations of items in one list that exist in a different list. For example, take the following lists: CartItems DiscountItems ========= ============= AAA AAA AAA BBB AAA BBB BBB CCC CCC DDD The result of the query operation should be 2 since I can find two combinations of AAA and BBB (from DiscountItems) within the contents of CartItems. My thinking in approaching the query is to join the lists together to shorten CartItems to only include items from DiscountItems. The solution would be to find the CartItem in the resulting query that occurs the least amount of times, thus indicating how many combinations of items exist in CartItems. How can this be done? Here's the query I already have, but it's not working. query results in an enumeration with 100 items, far more than I expected. Dim query = From cartItem In Cart.CartItems Group Join discountItem In DiscountGroup.DiscountItems On cartItem.SKU Equals discountItem.SKU Into Group Select SKU = cartItem.SKU, CartItems = Group Return query.Min(Function(x) x.CartItems.Sum(Function(y) y.Quantity))

    Read the article

  • Can an URL shortener pass parameters?

    - by ManniAT
    Hi, I use bit.ly to shorten my urls. My problem - paramters are not passed. Let me explain I use http://bit.ly/MYiPhoneApps which redirects (let's say) to http://iphone.pp-p.net/default.aspx Now when I try http://bit.ly/MYiPhoneApps?param=xx this param is not added to the resulting url. I know I could create an extra "short url" including a paramter - so http://bit.ly/WithParam would result in http://www.mysite.com/somepath/apage.aspx?Par1=yy and so forth. But what I want is to have a short URL directing to a page - and then I want to add a parameter to this shortened url - which shoul (of course) land at my page. Is this a shortcome of bit.ly (and others are maybe able to do it) - or does "parameter forwarding" not work with 301 redirections? Manfred

    Read the article

  • I'm asked to tune a long starting app into a short time period

    - by Jason
    Hi, I'm asked to shorten the startup period of a long starting app, however I have also to obligate to my managers to the amount of time i will reduce the startup - something like 10-20 seconds. As i'm new in my company I said I can obligate with timeframe of months (its a big server and I'm new and i plan to do lazy load + performance tuning). that answer was not accepted I was required to do some kind of a cache to hold important data in another server and then when my server starts up it would reach all its data from that cache - I find it a kind of a workaround and i don't really like it. do you like it? what do you think I should do? any suggestions? PS when i profiled the app i saw many small issues that make the startup long (like 2 minutes) it would not be a short process to fix all and to make lazy load. Any kind of suggestions would help. language - java. Thanks

    Read the article

  • How to simplify my code... 2D NSArray in Objective C...?

    - by Tattat
    self.myArray = [NSArray arrayWithObjects: [NSArray arrayWithObjects: [self d], [self generateMySecretObject],nil], [NSArray arrayWithObjects: [self generateMySecretObject], [self generateMySecretObject],nil],nil]; for (int k=0; k<[self.myArray count]; k++) { for(int s = 0; s<[[self.myArray objectAtIndex:k] count]; s++){ [[[self.myArray objectAtIndex:k] objectAtIndex:s] setAttribute:[self generateSecertAttribute]]; } } As you can see this is a simple 2*2 array, but it takes me lots of code to assign the NSArray in very first place, because I found that the NSArray can't assign the size at very beginning. Also, I want to set attribute one by one. I can't think of if my array change to 10*10. How long it could be. So, I hope you guys can give me some suggestions on shorten the code, and more readable. thz

    Read the article

  • how can I declare a value deep in an object tree using variable properties in javascript

    - by joshs
    I am trying to have a javascript object tree behave like a php associative array in the following way. var key1 = 'a'; var key2 = 'b'; var key3 = 'c'; var obj[key1][key2][key3] = 'd'; However, in javascript I believe you need to define each property/object pair individually, forming deeper leaves. Something like: var obj[key1] = {}; var obj[key1][key2] = {}; ... Is there a way to simplify or shorten this script? Thanks

    Read the article

  • mailto fails in IE with long body. any resolution?

    - by MedicineMan
    I am having a problem using Internet Explorer 8 (IE8) to open mailto links with long messages. After the user clicks on the link, IE changes to an about:blank page and never completes the call to outlook to create an email Here's an example: <a href="mailto:[email protected]?subject=123456789&amp;body=111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111">mailto fails in IE8</a> If I shorten the list of 1's, the email is generated and can be sent. Is this a known IE issue? What are the limitations?

    Read the article

  • PHP - white screen of death!

    - by Industrial
    Hi everyone, After debugging a codeigniter app that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it have taken seriously way too long time. PHP error_reporting(E_ALL) & display_errors", 1 is set as well. I even installed Xdebug in hope of getting more output, but no. My logging settings are also working, but nothing is written to the log. Is there a way to get something informative printed out instead of a complete white screen? It would certainly shorten my time spent on solving the eventual errors that causes this? Thanks a lot! Reference: http://stackoverflow.com/questions/2149321/why-does-code-igniter-give-me-a-white-page

    Read the article

  • dynamic access magic constants in php

    - by Radu
    Hello, Is there a way to shortcut this: function a($where){ echo $where; } function b(){ a(basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__); } to something like this: define("__myLocation__", ''.basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__.''); function a($where){ echo $where; } function b(){ a(__mYLocation_); } I know that this cannot be done with constants (is just an theoretical example), but I can't find a way to shorthen my code. If a use a function to get my line it will get the line where that function is not the line from where the function was called. I usualy call a function that prints directly to the log file, but in my log I need to know from where the function was called, so i use basename(__FILE__).'::'.__FUNCTION__.'()::'.__LINE__ this will print something like: index.php::b()::6 It is a lot of code when you have over 500 functions in different files. Is there a shorten or better way to do this? Thank you.

    Read the article

  • How to simplify my code... 2D array in Objective C...?

    - by Tattat
    self.myArray = [NSArray arrayWithObjects: [NSArray arrayWithObjects: [self d], [self generateMySecretObject],nil], [NSArray arrayWithObjects: [self generateMySecretObject], [self generateMySecretObject],nil],nil]; for (int k=0; k<[self.myArray count]; k++) { for(int s = 0; s<[[self.myArray objectAtIndex:k] count]; s++){ [[[self.myArray objectAtIndex:k] objectAtIndex:s] setAttribute:[self generateSecertAttribute]]; } } As you can see this is a simple 2*2 array, but it takes me lots of code to assign the NSArray in very first place, because I found that the NSArray can't assign the size at very beginning. Also, I want to set attribute one by one. I can't think of if my array change to 10*10. How long it could be. So, I hope you guys can give me some suggestions on shorten the code, and more readable. thz

    Read the article

  • Is shortening properties names worth it?

    - by raam86
    in how to node Blog rolling with node.js and mongoDB the author mentions it's a good idea to shorten proprieties names: ....oft-reported issue with mongoDB is the size of the data on the disk... each and every record stores all the field-names .... This means that it can often be more space-efficient to have properties such as 't', or 'b' rather than 'title' or 'body', however for fear of confusion I would avoid this unless truly required! I am aware of solutions of how to do it I am more intrested in when is it truly required?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >