Search Results

Search found 98 results on 4 pages for 'trimming'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Trimming byte array when converting byte array to string in Java/Scala

    - by prosseek
    Using ByteBuffer, I can convert a string into byte array: val x = ByteBuffer.allocate(10).put("Hello".getBytes()).array() > Array[Byte] = Array(104, 101, 108, 108, 111, 0, 0, 0, 0, 0) When converting the byte array into string, I can use new String(x). However, the string becomes hello?????, and I need to trim down the byte array before converting it into string. How can I do that? I use this code to trim down the zeros, but I wonder if there is simpler way. def byteArrayToString(x: Array[Byte]) = { val loc = x.indexOf(0) if (-1 == loc) new String(x) else if (0 == loc) "" else new String(x.slice(0,loc)) }

    Read the article

  • Trimming lists using a loop

    - by Vishal
    I have few lists like: a = [1, 2, 3, 4, 5] b = [4, 6, 5, 9, 2] c = [4, 7, 9, 1, 2] I want to trim all of them using a loop, instead of doing as below: a[-2:] b[-2:] c[-2:] I tried but got confused with pass by value or pass by reference fundamentals, looked into other questions as well but no help. Thanks

    Read the article

  • Trimming strings in Go

    - by user1263980
    I'm trying to read an entire line from the console (including whitespace), then process it. Using bufio.ReadString, the newline character is read together with the input, so I came up with the following code to trim the newline character: input,_:=src.ReadString('\n') inputFmt:=input[0:len(input)-2]+"" Is there a more idiomatic way to do this? That is, is there already a library that takes care of the ending null byte when extracting substrings for you? (Yes, I know there is already a way to read a line without the newline character in go readline -> string but I'm looking more for elegant string manipulation.)

    Read the article

  • [Integrity] of a Http Post Request from Iphone to web server

    - by gotye
    Hey everyone, I am currently building a module that makes possible to comment a news and as you probably understood, I will need to insert this new comment in my web database. I know this stuff can be very fastidous so I would like to know if someone has a method which could assure the integrity of the request by checking some of the usual important stuff liek : trimming the string encoding it ? escaping it ? and so on ... If you have some tips to achieve a good insert, do not hesitate ;) Thank you for your time, Gotye.

    Read the article

  • How does XmlSiteMapProvider check user to be in specific role?

    - by abatishchev
    I roll my own SiteMapProvider inheriting System.Web.XmlSiteMapProvider. I want to override logic of checking user to be in a role specified in siteMapNode's property roles: <siteMapNode url="Add.aspx?type=user" title="Add user" roles="admin" /> How can I do that? Which class's member does XmlSiteMapProvider call to check that if securityTrimmingEnabled="true"?

    Read the article

  • How does XmlSiteMapProvider check user to be in specified role?

    - by abatishchev
    I roll my own SiteMapProvider inheriting System.Web.XmlSiteMapProvider. I want to override logic of checking user to be in a role specified in siteMapNode's property roles: <siteMapNode url="Add.aspx?type=user" title="Add user" roles="admin" /> How can I do that? Which class's member does XmlSiteMapProvider call to check that if securityTrimmingEnabled="true"?

    Read the article

  • Automatic TRIM vs. manual TRIM

    - by Eike Cochu
    I am currently trying to find out how to trim with my new TP and was wondering about the difference of manual/online trimming. Here is my setup: ThinkPad T430s with SSD Samsung 830, 128GB and Xubuntu 12.10, here are some outputs to check if trim will work on my system (got these from here: http://wiki.ubuntuusers.de/SSD/TRIM) root@eike-tp:~# sudo hdparm -I /dev/sda | grep -i TRIM * Data Set Management TRIM supported (limit 8 blocks) First, I tried the online trimming: How to enable TRIM? my fstab with discard inserted: UUID=d6c49c17-a4f1-466c-9f7e-896c20db3bba / ext4 discard,noatime,errors=remount-ro 0 1 # swap was on /dev/sda5 during installation UUID=a0322f5f-c6c1-4896-863f-668f0638d8cf none swap sw 0 0 tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0 I tried to test if it works (but I don't get any zeroes when I try it with /dev/sda), but found out that this method is only possible with SSD type 2 and I seem to have type 3. So I don't know if it works or not. The Ubuntuwiki (first link) recommends manual trimming, so I set up a daily cronjob instead of discard: #!/bin/sh LOG=/var/log/batched_discard.log echo "*** $(date -R) ***" >> $LOG fstrim -v / >> $LOG the wiki article suggests weekly or daily. Now to my questions: How often executes the automated trim? How often is recommended? Online vs. manual trimming? Thank you for your help

    Read the article

  • Is wiper.sh working?

    - by Aleksander Blomskøld
    I'm setting up a server running Ubuntu Precise, and I'm trying to verify if SSD TRIM is working. fstrim is failing: ~ sudo fstrim -v / fstrim: /: FITRIM ioctl failed: Operation not supported So I tried wiper.sh in hdparm: wiper-3.5 sudo ./wiper.sh --verbose --commit /dev/sda1 wiper.sh: Linux SATA SSD TRIM utility, version 3.5, by Mark Lord. rootdev=/dev/sda1 fsmode2: fsmode=read-write /: fstype=ext4 freesize = 169502088 KB, reserved = 1695020 KB Preparing for online TRIM of free space on /dev/sda1 (ext4 mounted read-write at /). This operation could silently destroy your data. Are you sure (y/N)? y Creating temporary file (167807068 KB).. Syncing disks.. Beginning TRIM operations.. get_trimlist=/sbin/hdparm --fibmap WIPER_TMPFILE.11503 /dev/sda: trimming 3211263 sectors from 64 ranges succeeded trimming 3571713 sectors from 64 ranges succeeded trimming 3915776 sectors from 64 ranges succeeded (...) trimming 3657913 sectors from 60 ranges succeeded Removing temporary file.. Syncing disks.. Done. It seems to be working, but I'm wondering if it really is. Are there any cases where wiper.sh should work when fstrim isn't? Is there any way I can check if the TRIMing actually has succeeded (other than trusting the wiper.sh-log)?

    Read the article

  • Should a Trim method generally in the Data Access Layer or with in the Domain Layer?

    - by jpierson
    I'm dealing with a database that contains data with inconsistencies such as white leading and trailing white space. In general I see a lot of developers practice defensive coding by trimming almost all strings that come from the database that may have been entered by a user at some point. In my oppinoin it is better to do such formating before data is persisted so that it is done only once and then the data can be in a consistent and reliable state. Unfortunatley this is not the case however which leads me to the next best solution, using a Trim method. If I trim all data as part of my data access layer then I don't have to concern myself with defensive trimming within the business objects of my domain layer. If I instead put the trimming responsibility in my business objects, such as with set accessors of my C# properties, I should get the same net results however the trim will be operating on all values assigned to my business objects properties not just the ones that come from the inconsistent database. I guess as a somewhat philisophical question that may determine the answer I could ask "Should the domain later be responsible for defensive/coercive formatting of data?" Would it make sense to have a set accessor for a PhoneNumber property on a business object accept a unformatted or formatted string and then attempt to format it as required or should this responsibility be pushed to the presentation and data access layers leaving the domain layer more strict in the type of data that it will accept? I think this may be the more fundamental question. Update: Below are a few links that I thought I should share about the topic of data cleansing. Information service patterns, Part 3: Data cleansing pattern LINQ to SQL - Format a string before saving? How to trim values using Linq to Sql?

    Read the article

  • Silverlight Cream for June 06, 2010 -- #876

    - by Dave Campbell
    In this Issue: Brian Genisio, Michael Washington, Fons Sonnemans , Don Burnett, Xianzhong Zhu, Mike Snow, Jesse Liberty, Victor Gaudioso, David Kelley(-2-), and Matias Bonaventura . Shoutout: Anoop has a good post up: MEF or Managed Extensibility Framework and Lazy – Being Lazy with MEF, Custom Export Attributes etc Jesse Liberty's got a good post up if you are just Getting Started With Silverlight: A Path Through The Learning Material John Papa reports Updates and New Home for Sticky Plugin Tim Heuer announced Silverlight 4 Theme refresh including RIA Services templates From SilverlightCream.com: Adventures in MVVM – ViewModel Location and Creation Brian Genisio has a post up about ViewModels and how he attaches them to his views. Some discssion of MVVMLight, and other external links plus the code for the project. Simplified MEF: Dynamically Loading a Silverlight .xap Michael Washington has a good tutorial up on MEF, Silverlight, and ViewModel. In Michael's words: The goal here is to give you a quick easy win. You will be able to understand this one. You will come away with something you can use, and you will be able to tell your fellow colleagues, "MEF? yeah I'm using that, good stuff Touch Gesture Triggers for Windows Phone 7 projects in Blend 4.0 Fons Sonnemans has a post up about touch gestures for WP7 -- he's got 3 of them implemented using triggers, plus an external link to another, and the source. What the Heck is “MEF” for, and what Silverlight designers need to know about it? Don Burnett is also talking MEF... he does a good job of introducing MEF if you're not acquainted yet, plus some external information. Write Your Custom Effect Components in Silverlight 3 Xianzhong Zhu has a post up walking you through creating your own Custom Effect for Blend and Silverlight 3 ... lots of external links and the source project. Silverlight Tip of the Day #28 – Text Trimming Mike Snow's Tip #28 is about Text Trimming... what it does, and how it differs from WPF Windows Phone 7: Lists, Page Animation and oData Jesse Liberty called this a mini-tutorial, but it's not so mini... great tutorial on WP7, data, lists, and page transitions... oh, and the data is OData too... New Silveright Video Tutorial: How to Do Hit Detection Victor Gaudioso's latest video tutorial is up and he's demonstrating how to do Silverlight HitTesting via code from Andy Beaulieu Dependency Properties Made Easy Need a quick pick-up on Dependency Properties? David Kelley has a short post about them on his blog. Isolated Storage Made Easy David Kelley also has a quick post up about Isolated Storage ... going to keep an eye out for more of these quick "Made Easy" posts from David. Prism 4.0 First Drop – MVVM Matias Bonaventura has a post up about the recent Prism 4.0 drop and highlights a bunch of the features/enhancements in this... some code snippets and a linnk out to the CodePlex drop. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Rotating Oracle Database's Alert Log with ADRCI

    Many Oracle database administrators would not only like to report on (ORA-) errors but also manage the alert log itself--saving and/or trimming the alert log, aka alert log rotation. Oracle's new ADR with command interface can easily be used to help rotate Oracle's alert log.

    Read the article

  • Silverlight Cream for May 08, 2010 -- #858

    - by Dave Campbell
    In this Issue: Phil Middlemiss, Jaime Rodriguez, Senthil Kumar, Mike Snow, DaveDev, Gergely Orosz, Kirupa, Cheryl Simmons, András Velvárt, Dan Wahlin, Michael D. Brown, and Ben Rush. Shoutouts: Erik Mork and crew have their latest up: This Week In Silverlight – Where’s the Tablet? Chris Rouw has a good link post and instructions on WCF RIA services: Deploying and Configuring Silverlight 4 and WCF RIA Services From SilverlightCream.com: Quick and Easy Sscalable Rounded Bevels Phil Middlemiss duplicates some bevel-edged rectangles in Blend, and they look great. Now you don't have to import all the other PhotoShop bits to get those things looking the way you want! A transparent Windows PHONE FAQ Jaime Rodriguez combined a bunch of information into a WP7 FAQ that he's going to keep up to date, so bookmark the page. He also has links to the Training Kit, on and offline versions. Windows Phone Developer Training Kit April Refresh is now available for Download Thanks to Senthil Kumar, I found out there is an April refresh of the WP7 Training kit at Channel 9 -- go get yours now --- I'll still be here when you get back! Silverlight Tip of the Day #16 – Working with IgnoreImageCache Mike Snow's Tip of the day #16 covers IgnoreImageCache and like many other things in life, until you read Mike's post you may be surprised at how it works. DoodlePad – A fun, free, sketching application for Windows Phone 7 DaveDev has a new WP7 App up that lets you or your kids 'Doodle' on the phone... could be a note, or could be a drawing... good post with all the links you need to get this cranked up on the emulator. Printing in Silverlight: Printing Charts and Auto Scaling Gergely Orosz's latest post is a very useful one on auto-scaling charts to fit a printed page and then getting them to print. Smoothly Scrolling a ListBox Check out the smooth scrolling Kirupa has on the ListBox near the top of his post... all good stuff... you wanna know how to do that! Plus... it's dead simple and all in Blend :) http://www.sparklingclient.com/wheres-the-silverlight-tablet/ Cheryl Simmons has a great tip up at the SilverlightSDK if you haven't burned through to figure it out yet ... changing the watermark on a DatePicker control... looks great! The story of a wicked bug András Velvárt tells a story of a bug that just defied logic or being found. Read how he tracked it down and what it actually was... could save you some time. Story learned: if I have a problem that bad, I'm calling András :) Text Trimming in Silverlight 4 Dan Wahlin gives a quick run-through of what TextBox trimming is, and then by a good real example... check it out and start using it in your projects. Enterprise Patterns with WCF RIA Services Michael D. Brown has an article in MSDN Magazine on RIA Services. Great information and link-packed article, with all the source avialable for download. Building Custom Players with the Silverlight Media Framework Ben Rush has a nice long tutorial on the Silverlight Media Framework up on the MSDN Magazine site ... lots of information in there. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • How to dynamicly build up a gui

    - by InsertNickHere
    Hi there, for the app i am creating i need a lot "option menus". E.g. for the sound file trimming part it would be something like "leadingSilence" / Integer "trailingSilence" / Integer "hold" / Integer. Overall, there are a lot of options of different types (int, float, string), and im thinking about if it is a better way to manualy create a window for each option set, or to dynamicly create them. last one would be quite easy if all types were similar (so i would just add eg spinButtons) I guess but its not. At this time i mange the options with the standard .properties of jave, and there is no need to change. My question is: is there a lib which provides such functionality, or is there a "standard way" to do this? How much work would it be? How to dynamicly create the selection listeners? In could i'd love to have something like: OptionWindow trimmingOptionWindow = createWindowFromOptionSet(OptionManager.getOptions("trimming") ); trimmingOptionWindow.open(); I hope its clear what I mean :)

    Read the article

  • VMware guest eats 100% cpu

    - by chris
    I have a Windows 7 x64 guest that acts very strange - the VM is very slow and taskmgr will consume 50% (with 2 cores) or up to 99% (single) of the CPU when everything else is idle. Host is Windows 7 x64 with VMware Workstation 7.0.1 VMware tools are installed the same VM, when running on another PC with VMware Server 2.0 will work OK (CPU at ~0% when idle) I've tried (with no effects) enabled/disabled 3d selected 1 or 2 cores adjusted memory (1gb/500mb) adjusted the bios mem.hotadd = "FALSE" disabled page trimming Windows 7 x86 guests on the same machine do not have this problem.

    Read the article

  • Websites or tools similar to Ginwiz (mobile website creator)

    - by t3st
    I have a website which i want to make more mobile friendly(currently its not). While searching about this i found this awesome website Ginwiz; my website can be modified into an mobile friendly site without any additional coding. But i find two disadvantages with this website (free version) 1)We cant add our domain to it with out upgrading (i dont have enough money to pay for it) 2)We can only "Advanced edit" one page Do you know any website which is similar to Ginwiz but can use our domain address instead of theirs (in free version). Do you have any idea about any tools which can be also used to convert my website to mobile website by trimming my current website easily.

    Read the article

  • Speaking again after a long hiatus

    Gosh, it has really been long since this blog saw some action and probably need some attention (weeding, trimming, re-planting, etc) After a long hiatus, I will be speaking again at a big event in Marina Bay Sands Singapore for our Future Of Productivity Launch on the 26th May 2010, keynoted by none other than Mr CEO - Steve Ballmer himself. Incidentally, this is also to celebrate our Microsoft Singapore 20th Anniversary. Agenda is here. I will be touching base on SQL Business Intelligence (BI),...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How to create a Uri instance parsed with GenericUriParserOptions.DontCompressPath

    - by Andrew Arnott
    When the .NET System.Uri class parses strings it performs some normalization on the input, such as lower-casing the scheme and hostname. It also trims trailing periods from each path segment. This latter feature is fatal to OpenID applications because some OpenIDs (like those issued from Yahoo) include base64 encoded path segments which may end with a period. How can I disable this period-trimming behavior of the Uri class? Registering my own scheme using UriParser.Register with a parser initialized with GenericUriParserOptions.DontCompressPath avoids the period trimming, and some other operations that are also undesirable for OpenID. But I cannot register a new parser for existing schemes like HTTP and HTTPS, which I must do for OpenIDs. Another approach I tried was registering my own new scheme, and programming the custom parser to change the scheme back to the standard HTTP(s) schemes as part of parsing: public class MyUriParser : GenericUriParser { private string actualScheme; public MyUriParser(string actualScheme) : base(GenericUriParserOptions.DontCompressPath) { this.actualScheme = actualScheme.ToLowerInvariant(); } protected override string GetComponents(Uri uri, UriComponents components, UriFormat format) { string result = base.GetComponents(uri, components, format); // Substitute our actual desired scheme in the string if it's in there. if ((components & UriComponents.Scheme) != 0) { string registeredScheme = base.GetComponents(uri, UriComponents.Scheme, format); result = this.actualScheme + result.Substring(registeredScheme.Length); } return result; } } class Program { static void Main(string[] args) { UriParser.Register(new MyUriParser("http"), "httpx", 80); UriParser.Register(new MyUriParser("https"), "httpsx", 443); Uri z = new Uri("httpsx://me.yahoo.com/b./c.#adf"); var req = (HttpWebRequest)WebRequest.Create(z); req.GetResponse(); } } This actually almost works. The Uri instance reports https instead of httpsx everywhere -- except the Uri.Scheme property itself. That's a problem when you pass this Uri instance to the HttpWebRequest to send a request to this address. Apparently it checks the Scheme property and doesn't recognize it as 'https' because it just sends plaintext to the 443 port instead of SSL. I'm happy for any solution that: Preserves trailing periods in path segments in Uri.Path Includes these periods in outgoing HTTP requests. Ideally works with under ASP.NET medium trust (but not absolutely necessary).

    Read the article

  • How to maintain decimal percision in calculations

    - by Blankman
    I need to sum 2 decimal values together, then divide by 2 and convert to string. My calculation currently is trimming to 2 decimal places, but I want to keep as many decimals as I can. city.Latitude = ( (lat.North + lat.South) / 2 ).ToString(); the values for lat.North and lat.Souch are like: 55.32342322

    Read the article

  • How to maintain decimal precision in calculations

    - by Blankman
    I need to sum 2 decimal values together, then divide by 2 and convert to string. My calculation currently is trimming to 2 decimal places, but I want to keep as many decimals as I can. city.Latitude = ( (lat.North + lat.South) / 2 ).ToString(); the values for lat.North and lat.Souch are like: 55.32342322

    Read the article

  • How to get only the first row from a java.sql.ResultSet?

    - by llm
    I have a ResultSet object containing all the rows returned from an sql query. I want to be able to (in the java code, NOT force it in the SQL) to be able to take a ResultSet and transform it so that it only contains 1 (the first) row. What would be the way to acheive this? Also, is there another appropriate class (somewhere in java.sql or elsewhere) for storing just a single row rather than trimming my ResultSet? Thanks!

    Read the article

< Previous Page | 1 2 3 4  | Next Page >