Search Results

Search found 12765 results on 511 pages for 'format'.

Page 12/511 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • NSString stringWithFormat swizzled to allow missing format numbered args

    - by coneybeare
    Based on this SO question asked a few hours ago, I have decided to implement a swizzled method that will allow me to take a formatted NSString as the format arg into stringWithFormat, and have it not break when omitting one of the numbered arg references (%1$@, %2$@) I have it working, but this is the first copy, and seeing as this method is going to be potentially called hundreds of thousands of times per app run, I need to bounce this off of some experts to see if this method has any red flags, major performance hits, or optimizations #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) @implementation NSString (UAFormatOmissions) + (id)uaStringWithFormat:(NSString *)format, ... { if (format != nil) { va_list args; va_start(args, format); // $@ is an ordered variable (%1$@, %2$@...) if ([format rangeOfString:@"$@"].location == NSNotFound) { //call apples method NSString *s = [[[NSString alloc] initWithFormat:format arguments:args] autorelease]; va_end(args); return s; } NSMutableArray *newArgs = (NSMutableArray *)[NSMutableArray arrayWithCapacity:NUMARGS(args)]; id arg = nil; int i = 1; while (arg = va_arg(args, id)) { NSString *f = (NSString *)[NSString stringWithFormat:@"%%%d\$\@", i]; i++; if ([format rangeOfString:f].location == NSNotFound) continue; else [newArgs addObject:arg]; } va_end(args); char *newArgList = (char *)malloc(sizeof(id) * [newArgs count]); [newArgs getObjects:(id *)newArgList]; NSString* result = [[[NSString alloc] initWithFormat:format arguments:newArgList] autorelease]; free(newArgList); return result; } return nil; } The basic algorithm is: search the format string for the %1$@, %2$@ variables by searching for %@ if not found, call the normal stringWithFormat and return else, loop over the args if the format has a position variable (%i$@) for position i, add the arg to the new arg array else, don't add the arg take the new arg array, convert it back into a va_list, and call initWithFormat:arguments: to get the correct string. The idea is that I would run all [NSString stringWithFormat:] calls through this method instead. This might seem unnecessary to many, but click on to the referenced SO question (first line) to see examples of why I need to do this. Ideas? Thoughts? Better implementations? Better Solutions?

    Read the article

  • How do you convert many files from .xlsx to .xls ?

    - by David Oneill
    What is a way to convert a batch of .xlsx files to .xls format? I would prefer it to be a command-line solution, but anything is better than opening each manually, and manually saving in the new format. ~~Edit~~ So is there a way to get around that error? errored: Leaking python objects bridged to UNO for reason pyuno runtime is not initialized, (the pyuno.bootstrap needs to be called before using any uno classes) python: tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || (new_prio >= __sched_fifo_min_prio && new_prio <= __sched_fifo_max_prio)' failed. Aborted

    Read the article

  • SQL SERVER – Convert Seconds to Hour : Minute : Seconds Format

    - by Pinal Dave
    Here is another question I received via email. “Hi Pinal, I have a unique requirement. We measure time spent on any webpage in measure of seconds. I recently have to build a report over it and I did few summations based on group of web pages. Now my manager wants to convert the time, which is in seconds to the format Hour : Minute : Seconds. I researched online and found a solution on stackoverflow for converting seconds to the Minute : Seconds but could not find a solution for Hour : Minute : Seconds. Would you please help?” Of course the logic is very simple. Here is the script for your need. DECLARE @TimeinSecond INT SET @TimeinSecond = 86399 -- Change the seconds SELECT RIGHT('0' + CAST(@TimeinSecond / 3600 AS VARCHAR),2) + ':' + RIGHT('0' + CAST((@TimeinSecond / 60) % 60 AS VARCHAR),2)  + ':' + RIGHT('0' + CAST(@TimeinSecond % 60 AS VARCHAR),2) Here is the screenshot of the resolution: Reference: Pinal Dave (http://blog.SQLAuthority.com)Filed under: PostADay, SQL, SQL Authority, SQL DateTime, SQL Query, SQL Server, SQL Tips and Tricks, T SQL

    Read the article

  • What's the format of Real World Performance Day?

    - by william.hardie
    A question that has cropped a lot of late is "what's the format of Real World Performance Day?" Not an unreasonable question you might think. Sure enough, a quick check of the Independent Oracle User Group's website tells us a bit about the Real World Performance Day event, but no formal agenda? This was one of the questions I posed to Tom Kyte (one of the main presenters) in our recent podcast. Tom tells us that this isn't your traditional event where one speaker follows another with loads of slides. In fact, the Real World Performance Day features Tom and fellow Oracle performance experts - Andrew Holdsworth and Graham Wood - continuously on stage throughout the day. All three will be discussing database performance challenges and solutions from development, architectural design and management perspectives. There's going to be multi-terabyte demos on show, less of the traditional slides, and more interactive debate and discussion going on. Tune-in and hear what else Tom has to say about this fairly unique event!

    Read the article

  • Only MKV format available in HandBrake

    - by Steve Ellis
    I am running Ubuntu 14.04 LTS 32 bit. I have installed HandBrake rev5474 (i686), which I believe is the latest, and the Ubuntu Restricted Extras. I am able to play DVDs via VLC but when it comes to ripping them, so that I can back them up to my Twonky media server, I have issues. I launch HandBrake and find that the only format available for me to select is MKV. When I used to run Handbrake on this machine while I was running Ubuntu 13.10 and lower I had no issues and **lots of formats (including MP4 which is what I'm really after) but since reformating and installing 14.04 I've had this issue. Any help would be much appreciated.

    Read the article

  • Only MPV format available in HandBrake

    - by Steve Ellis
    I am running Ubuntu 14.04 LTS 32 bit. I have installed HandBrake rev5474 (i686), which I believe is the latest, and the Ubuntu Restricted Extras. I am able to play DVDs via VLC but when it comes to ripping them, so that I can back them up to my Twonky media server, I have issues. I launch HandBrake and find that the only format available for me to select is MPV. When I used to run Handbrake on this machine while I was running Ubuntu 13.10 and lower I had no issues and **lots of formats (including MP4 which is what I'm really after) but since reformating and installing 14.04 I've had this issue. Any help would be much appreciated.

    Read the article

  • Markup format or script for data files?

    - by Aaron
    The game I'm designing will be mainly written in a high level scripting language (leaning towards either Lua or Squirrel) with a C++ core. In addition to scripts I'm also going to need different data files. Many data files will be for static information such as graphical assets and monster types. I'd also want to create and update data files at runtime for user information like option settings and game saves. Can I get away with using plain script files (i.e. .lua or .nut files) for my data files, or is it better to use dedicated markup formats like XML or YAML? If I use script files, loaded separately from my true scripts, then I wouldn't need an extra library to read those files. Scripting languages like Lua also have table syntax that lend themselves towards data definition. On the other hand I'd have to write my own schema check code. These languages also don't seem to support serialization "out of the box" like the markup format libraries do.

    Read the article

  • New HDD formating on Ext4 root permission

    - by Carlos Salmeron
    OK people good evening, I have this new 80Gb HDD I want to use it as a backup storage for my actual system (14.04) not a server. I formatted it with Gpart but I just can't write in it, when I search for permissions it tells me that only root users can write/create in it, log on as root user and try to change permissions, and I can't do that either. Long have I searched for an answer, looking everywhere but not to find any, is there a way to format it and use it with my user permission? Don't want it on NTFS, is there a way?, I have searched in these forums but there’s only an answer to format it in NTFS, so please. Thank you in advance.

    Read the article

  • Banshee won't sync OGG format to my iphone

    - by Daze
    I have a jailbroken iphone 3g with 16 gigs of memory and I've been putting my music on it from banshee lately and have been having almost no issue. Unfortunately, I just added a few albums to my Banshee library and tried to sync them to my iphone, but every time I try, i see a hundred or so errors saying that the device doesn't support the ogg format and there was no converter found. I'm still pretty much a newb at this stuff, so please help me and dumb down your answer. I'm running 12.04 and again, using an iphone 3g with no sim card, but it's been jailbroken and is used primarily for it's music function.

    Read the article

  • problem with .wax format

    - by Pranjal Singh
    I installed Ubuntu 10.4 onto a pc for an elderly woman. It was supposed to solve the problems she was having with windows, ie: she would constantly remove things, or try to fix problems herself. So I figured that Linux would solve those issues. However, what I didn't take into account was that she watches " http://www.shepherdschapel.com/broadband.htm " and when using Ubuntu, I can't seem to find a media player to make the files work. I am out of ideas. I tried kplayer, and it worked (sort of). The file that is downloaded from the site when you click the windows media player site one link is, .wax format. Which is an instruction file for windows media player. Is there anything I can do to make these videos work?

    Read the article

  • Good practices when writing a parser for a standard file format (such as ePub)

    - by J-F L-R
    I am considering writing an Android reader software that can read ePubs and display them. I checked the ePub standard documents. However, these contain a lot of information. So I am wondering what is the process of implementing a standard for a file format. What are the steps to get a working implementation without passing by parts of the standard? Are there any best practices? Also, is it even possible to program this alone in a reasonable time? From what I have already found out, ePub is basically a zip archive. That means I could probably use zlib to decompress it. The content is in XHTML and CSS, so I believe it should be possible to display it in a WebView. The parts that are missing are writing the code that can read the metadata and manage the non-standard XHTML extensions.

    Read the article

  • XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4

    - by danbystrom
    Beginner question. Synopsis: my water effects does something that causes the drawing of my sky sphere to throw an exeption when run in full screen. The exception is: XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4. This happens both when I start in full screen directly or switch to full screen from windowed. It does NOT happen, however, if I comment out the drawing of my water. So, what in my water effect can possibly cause the drawing of my sky sphere to choke???

    Read the article

  • How do you format arrays within parameters?

    - by joslinm
    I'm talking about something like this: echo $form->input('general_addresss', array( 'label' => 'Where will you go today?' 'format' => array('before', 'input', 'after', 'label', 'after', 'error') )); Do you start with one array parameter, then break a line? If it can't fit on a line, do you immediately break a line? After of which, do you do a set number of tabs over? What happens if an array within an array has lots of properties? Is there any particular guide you follow?

    Read the article

  • .net- open excel file, format the file and save

    - by Lock
    I have an ASP web service that uses the Crystal Reports API to download an Excel report. Now, there is a few things I do not like about the Excel report that Crystal generates: - The column widths are static (as in they are not adjusted for the content). - I can't format the header row to be bold - If I suppress a data column in the report, it comes out in the Excel spreadsheet as a blank column. I currently use PHP to open the excel file, autosize the columns, bold the heading and remove blank columns, although using the PHPExcel class for this doesn't work well when the spreadsheet is only a few 100kb in size. I am thinking if I move this activity into the .NET web service, the performance will be much better. Does anyone know an efficient way of opening a Excel file and performing the operations listed above?

    Read the article

  • Unable to execute binary file. Exec format error

    - by user2689020
    I recently heard about Breach, a Node.js based browser. I was following the instructions on http://codeforgeek.com/2014/08/download-install-breach-browser-ubuntu-14-04/ to install it but got the following error : breach-v0.3.22-alpha.6-linux-x64/__AUTO_UPDATE_BUNDLE__/exo_browser/exo_browser: cannot execute binary file: Exec format error After some googling, I found that it is because I am trying to install the 64 bit package on the 32 bit Ubuntu installation. I tried to find 32 bit package of the same but ended up with no luck. The browser is only available in 64 bit packet(as far as i know). So, My question is : Is it possible to somehow install it on the 32 bit OS or if any program available which can run 64 bit applications on the 32 bit OS. I have been googling around and found no help. Can anyone help me? I am using Ubuntu 14.04 (32 Bit). Thank You

    Read the article

  • usb ntfs pen drive and hard drive not working after connection to ubuntu

    - by lemon619
    as said in the title first of all i connected a usb key (ntfs formatted) with data in it, on ubuntu 12.04, after i disconnected it i was no more able to access the usb key neither from windows nor from ubuntu 12.04. The system asks me to format my usb key Just now i connected a hard drive ntfs formatted with data in it to ubuntu 12.04. I ejected correctly the hard drive and connected it to windows, and the system asks me to format my hard drive? same as the usb key Can someone help me please ? Would really appreciate!

    Read the article

  • Avoiding resource (localizable string) duplication with String.Format

    - by Hrvoje Prgeša
    I'm working on a application (.NET, but not relevant) where there is large potential for resource/string duplication - most of these strings are simple like: Volume: 33 Volume: 33 (dB) Volume 33 dB Volume (dB) Command - Volume: 33 (dB) where X, Y and unit are the same. Should I define a new resource for each of the string or is it preferable to use String.Format to simplify some of these, eg.: String.Format("{0}: {1}", Resource.Volume, 33) String.Format("{0}: {1} {2}", Resource.Volume, 33, Resource.dB) Resource.Volume String.Format("{0} ({1})", 33, Resource.dB) String.Format("{0} ({1})", Resource.Volume, Resource.dB) String.Format("Command - {0}: {1} {2}", Resource.Volume, 33, Resource.dB) I would also define string formats like "{0}: {1}" in the resources so there would be a possibility of reordering words... I would not use this approach selectivly and not throughout the whole application.. And how about: String.Format("{0}: {1}", Volume, Resource.Muted_Volume) // = Volume: Muted Resource.Muted_Volume String.Format("{0}: {1} (by user {2})", Volume, Resource.Muted_Volume, "xy") // = Volume: Muted (by user xy) The advantage is cutting the number of resource by the factor of 4-5. Are there any hidden dangers of using this approach? Could someone give me an example (language) where this would not work correctly?

    Read the article

  • Get just the hour of day from DateTime using either 12 or 24 hour format as defined by the current c

    - by InvisibleBacon
    .Net has the built in ToShortDateString() function for DateTime that uses the CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern format. It returns something like this for en-US: "5:00 pm". For a 24 hour culture such as de-DE it would return "17:00". What I want is a way to just return just the hour (So "5 pm" and "17" in the cases above) that works with every culture. What's the best/cleanest way to do this? Thanks!

    Read the article

  • Customise date-time format in Windows.

    - by infant programmer
    Is it possible to customize data (or date-time) format in Windows [I am using windows XP]? The current format which is followed by the OS [to show date-modified, etc.] is MM/DD/YYYY or M/D/YYYY, whereas I have been comfortable with DD/MM/YYYY or D/M/YYYY format. I am finding it hard to refer Date-modified [which I use often] of files and folders.

    Read the article

  • How to format new HDD windows XP

    - by c0mrade
    I just bought new SATA 1TB Baracuda HDD, I inserted and my windows didn't recognize it. Because I didn't have any other OS or anything to format it I used Centos i386 installation to format it. I of course disconnected my original disk from the motherboard and formatted it using CENTOS.. but now when I come back to the windows I can't format this HDD. Its recognized as RAW. What can I do to make it work?

    Read the article

  • How to format new HDD windows XP

    - by c0mrade
    I just bought new SATA 1TB Baracuda HDD, I inserted and my windows didn't recognize it. Because I didn't have any other OS or anything to format it I used Centos i386 installation to format it. I of course disconnected my original disk from the motherboard and formatted it using CENTOS.. but now when I come back to the windows I can't format this HDD. Its recognized as RAW. What can I do to make it work?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >