Search Results

Search found 483 results on 20 pages for 'appending'.

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

  • Is there an easy way to concatenate several lines of text into a string without constantly appending

    - by Marshmellow1328
    So I essentially need to do this: String text = "line1\n"; text += "line2\n"; text += "line3\n"; useString( text ); There is more involved, but that's the basic idea. Is there anything out there that might let me do something more along the lines of this though? DesiredStringThinger text = new DesiredStringThinger(); text.append( "line1" ); text.append( "line2" ); text.append( "line3" ); useString( text.toString() ); Obviously, it does not need to work exactly like that, but I think I get the basic point across. There is always the option of writing a loop which processes the text myself, but it would be nice if there is a standard Java class out there that already does something like this rather than me needing to carry a class around between applications just so I can do something so trivial. Thanks!

    Read the article

  • Creating and appending a big DOM with javascript - most optimized way?

    - by fenderplayer
    I use the following code to append a big dom on a mobile browser (webkit): 1. while(someIndex--) // someIndex ranges from 10 to possibly 1000 2. { 3. var html01 = ['<div class="test">', someVal,'</div>', 4. '<div><p>', someTxt.txt1, someTxt.txt2, '</p></div>', 5. // lots of html snippets interspersed with variables 6. // on average ~40 to 50 elements in this array 7. ].join(''); 8. var fragment = document.createDocumentFragment(), 9. div = fragment.appendChild(document.createElement('div')); 10. div.appendChild(jQuery(html01)[0]); 11. jQuery('#screen1').append(fragment); 12. } //end while loop 13. // similarly i create 'html02' till 'html15' to append in other screen divs Is there a better or faster way to do the above? Do you see any problems with the code? I am a little worried about line 10 where i wrap in jquery and then take it out.

    Read the article

  • Problem in appending a string to a already filled string builder(at the beginning by using INSERT) a

    - by Newbie
    I have a string builder like StringBuilder sb = new StringBuilder("Value1"); sb.AppendLine("Value2"); Now I have a string say string str = "value 0"; I did sb.Insert(0,str); and then string[] strArr = sb.ToString().Trim().Replace("\r", string.Empty).Split('\n'); The result I am getting as (Array size of 2 where I should get 3) [0] value 0 Value1 [1] value2 But the desired output being [0] Value 0 [1] Value1 [2] Value2 Where I am going wrong? I am using C#3.0 Please help.. It 's urgent Thanks

    Read the article

  • Add binding to fish that not auto executes the string?

    - by NES
    How do i set up a key binding in fish, so that fish understands not to execute the bindingstring after appending it to commandline but just appending it as string to commandline. I want to set up a binding that appends | less by pressing i.e. ALT + Y. It seems that by default fish understands the command to automatically execute. I.e. When i type ls on commandline and then would press ALT + Y it only should complete the command to look like this ls | less but still not executing it. i'm trying something like this bind \ey " \| less" But fish doesn't accept my syntax

    Read the article

  • Shortest Common Superstring: find shortest string that contains all given string fragments

    - by occulus
    Given some string fragments, I would like to find the shortest possible single string ("output string") that contains all the fragments. Fragments can overlap each other in the output string. Example: For the string fragments: BCDA AGF ABC The following output string contains all fragments, and was made by naive appending: BCDAAGFABC However this output string is better (shorter), as it employs overlaps: ABCDAGF ^ ABC ^ BCDA ^ AGF I'm looking for algorithms for this problem. It's not absolutely important to find the strictly shortest output string, but the shorter the better. I'm looking for an algorithm better than the obvious naive one that would try appending all permutations of the input fragments and removing overlaps (which would appear to be NP-Complete). I've started work on a solution and it's proving quite interesting; I'd like to see what other people might come up with. I'll add my work-in-progress to this question in a while.

    Read the article

  • html.erb vs erb (and haml equivalents)

    - by mathee
    I'm not sure I understand the difference between the html.erb files and erb files in the views for a Ruby on Rails application. (Similarly for haml files.) What are the dis/advantages of each (html.erb/haml or erb/haml) files? PS I'm not asking about the difference between the erb and haml files -- just appending the extension to an html file versus not appending it.

    Read the article

  • Maintenance Plan Reporting - Append To File - Clean Up?

    - by Adam J.R. Erickson
    Background: (SQL Server 2005, Standard Ed.) I have a maintenance plan running backups, taking a full backup 1/day, and t-log every 15 minutes. I have it set to create a text file report of each run, but that creates A LOT of files on the file server. These are hard to sort through, which makes them less useful. Question: There is an option in "Reporting and Logging" settings for appending all logs together, but how do you clean this out? If you're appending to the same log file every time, how should you make sure this file doesn't grow indefinitely? Is there a build-in function to clean out portions of appended logs like there is for cleaning out individual old log files?

    Read the article

  • Automatically mount a remote folder on boot

    - by Andrew
    I'm trying to mount a Windows folder on my Ubuntu machine on start up. I've tried following this page here, modifying /etc/fstab and appending sshfs#my_user@remote_host:/path/to/directory <local_mount_point> fuse user 0 0 to it, but it fails; on start up, I get an error saying that the mounting failed, and I can press S to skip or M to recover manually. I also tried following this page here, appending /usr/bin/sshfs -o idmap=user my_user@remote_host:/path/to/directory <local_mount_point> to the /etc/rc.local file, but this doesn't help either; Ubuntu just boots up normally without mounting. I have Cygwin installed on my Windows machine, and I can run everything smoothly, such as sshing without passwords, and mounting it manually. I've also tried to run the modified rc.local file $ /etc/rc.local, and it works perfectly, but I just can't seem to get the folder mounted on start up. Can someone help me?

    Read the article

  • can't send with postfix but I can whith one user

    - by CvR_XX
    I have a postfix and dovecot server but when i try to send an email i get an time -out. Im trying to send with the email [email protected]. A telnet session isn't helping much ether. I get a blank screen. Local it's working fine. My smtp service is running on treadity.com:25. The strange thing is that the logs are completely empty with any info regarding sending emails. Receiving is working alright. Another strange thing is that i've send some message's and that it worked. But that is only with one email. I can still send from that account but other emails are failing any idea's? config file: # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters #smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem #smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key #smtpd_use_tls=yes #smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache #smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem smtpd_tls_key_file=/etc/ssl/private/dovecot.pem smtpd_use_tls=yes # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters #smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem #smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key #smtpd_use_tls=yes #smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache #smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem smtpd_tls_key_file=/etc/ssl/private/dovecot.pem smtpd_use_tls=yes # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters #smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem #smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key #smtpd_use_tls=yes #smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache #smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem smtpd_tls_key_file=/etc/ssl/private/dovecot.pem smtpd_use_tls=yes smtpd_tls_auth_only = yes #Enabling SMTP for authenticated users, and handing off authentication to Dovecot smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes 1,1 Top

    Read the article

  • Using Bookmarklet to open and pass values from Parent and Child Window

    - by kunalsawlani
    Hi, Is there a way to open a window from the current page using a javascript bookmarklet, and once the the child window has finished loading, setting the value of one of the elements in its DOM to some value from the current page, say for example the currently selected text. I know that this can be done in plane javascript, and also, by appending the value to the URL, and reading it from the web service opened in the new child window. I want to know if there is any other way, as the appending URL method does not let you send text more than two thousand odd characters long. Appreciate any help I can get!

    Read the article

  • Using jQuery to gather all text nodes from a wrapped set, separated by spaces

    - by Bungle
    I'm looking for a way to gather all of the text in a jQuery wrapped set, but I need to create spaces between sibling nodes that have no text nodes between them. For example, consider this HTML: <div> <ul> <li>List item #1.</li><li>List item #2.</li><li>List item #3.</li> </ul> </div> If I simply use jQuery's text() method to gather the text content of the <div>, like such: var $div = $('div'), text = $div.text().trim(); alert(text); that produces the following text: List item #1.List item #2.List item #3. because there is no whitespace between each <li> element. What I'm actually looking for is this (note the single space between each sentence): List item #1. List item #3. List item #3. This suggest to me that I need to traverse the DOM nodes in the wrapped set, appending the text for each to a string, followed by a space. I tried the following code: var $div = $('div'), text = ''; $div.find('*').each(function() { text += $(this).text().trim() + ' '; }); alert(text); but this produced the following text: This is list item #1.This is list item #2.This is list item #3. This is list item #1. This is list item #2. This is list item #3. I assume this is because I'm iterating through every descendant of <div> and appending the text, so I'm getting the text nodes within both <ul> and each of its <li> children, leading to duplicated text. I think I could probably find/write a plain JavaScript function to recursively walk the DOM of the wrapped set, gathering and appending text nodes - but is there a simpler way to do this using jQuery? Cross-browser consistency is very important. Thanks for any help!

    Read the article

  • POST and PUT requests – is it just the convention?

    - by bckpwrld
    I've read quite a few articles on the difference between POST and PUT and in when the two should be used. But there are still few things confusing me ( hopefully questions will make some sense ): 1) We should use PUT to create resources when we want clients to specify the URI of the newly created resources and we should use POST to create resources when we let service generate the URI of the newly created resources. a) Is it just by convention that POST create request doesn't contain an URI of the newly created resource or POST create request actually can't contain the URI of the newly created resource? b) PUT has idempotent semantics and thus can be safely used for absolute updates ( ie we send entire state of the resource to the server ), but not also for relative updates ( ie we send just changes to the resource state ), since that would violate its semantics. But I assume it's still possible for PUT to send relative updates to the server, it's just that in that case the PUT update won't be idempotent? 2) I've read somewhere that we should "use POST to append a resource to a collection identified by a service-generated URI". a) What exactly does that mean? That if URIs for the resources were generated by a server ( thus the resources were created via POST ), then ALL subsequent resources should also be created via POST? Thus, in such situation no resource should be created via PUT? b) If my assumption under a) is correct, could you elaborate why we shouldn't create some resources via POST and some via PUT ( assuming server already contains a collection of resources created via POST )? REPLY: 1) Please correct me if I'm wrong, but from your post and from the link you've posted, it seems: a) The Request-URI in POST is interpreted by server as the URI of the service. Thus, it could just as easily be interpreted as an URI of a newly created resource, if server code was written to recognize Request-URI as such b) Similarly, PUT is able to send relative updates, it's just that service code is usually written such that it will complain if PUT updates are relative. 2) Usually, create has fallen into the POST camp, because of the idea of "appending to a collection." It's become the way to append a resource to a list of resources. I don't quite understand the reasoning behind the idea of "appending to a collection" and why this idea prefers POST for create. Namely, if we create 10 resources via PUT, then server will contain a collection of 10 resources and if we then create another resource, then server will append this resource to that collection ( which will now contain 11 resources )?! Uh, this is kinda confusing thank you

    Read the article

  • Routing a single request through multiple nginx backend apps

    - by Jonathan Oliver
    I wanted to get an idea if anything like the following scenario was possible: Nginx handles a request and routes it to some kind of authentication application where cookies and/or other kinds of security identifiers are interpreted and verified. The app perhaps makes a few additions to the request (appending authenticated headers). Failing authentication returns an HTTP 401. Nginx then takes the request and routes it through an authorization application which determines, based upon identity and the HTTP verb (put, delete, get, etc.) and URL in question, whether the actor/agent/user has permission to performed the intended action. Perhaps the authorization application modifies the request somewhat by appending another header, for example. Failing authorization returns 403. (Wash, rinse, repeat the proxy pattern for any number of services that want to participate in the request in some fashion.) Finally, Nginx routes the request into the actual application code where the request is inspected and the requested operations are executed according to the URL in question and where the identity of the user can be captured and understood by the application by looking at the altered HTTP request. Ideally, Nginx could do this natively or with a plugin. Any ideas? The alternative that I've considered is having Nginx hand off the initial request to the authentication application and then have this application proxy the request back through to Nginx (whether on the same box or another box). I know there are a number of applications frameworks (Django, RoR, etc.) that can do a lot of this stuff "in process", but I was trying to make things a little more generic and self contained where different applications could "hook" the HTTP pipeline of Nginx and then participate in, short circuit, and even modify the request accordingly. If Nginx can't do this, is anyone aware of other web servers that will perform in the manner described above?

    Read the article

  • MySQL command appends '@localhost' to username

    - by Mikee
    I just can't seem to figure this one out. I want to use the command line to connect to a MySQL database residing on another server. I went ahead and created the username and password for the user. I have also granted all privileges on that user for that database. When using the command: mysql -h <hostname> -u <username> -p, I get the following error: ERROR 1045 (28000): Access denied for user '<username>'@'<local_machine_hostname>' (using password: YES) The problem is that it keeps appending the current machine's hostname into the username. Obviously, that user@<local_machine_hostname> is not correct. It doesn't matter what I type. For instance, if I type: mysql -h <hostname> -u '<username>'@'<hostname>' -p It does the same, only in the error output, it says: Access denied for user '<username>@<hostname>'@'<local_machine_hostname>' Is there a setting in a configuration file which is allowing this to happen? It's really quite annoying. I need to set up a tikiwiki server, and it cannot connect because during the step where you set up mysql, it keeps appending the local machine's hostname to the mysql login name.

    Read the article

  • JS: using 'var me = this' to reference an object instead of using a global array

    - by Marco Demaio
    The example below, is just an example, I know that I don't need an object to show an alert box when user clicks on div blocks, but it's just a simple example to explain a situation that frequently happens when writing JS code. In the example below I use a globally visible array of objects to keep a reference to each new created HelloObject, in this way events called when clicking on a div block can use the reference in the arry to call the HelloObject's public function hello(). 1st have a look at the code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Test </title> <script type="text/javascript"> /***************************************************** Just a cross browser append event function, don't need to understand this one to answer my question *****************************************************/ function AppendEvent(html_element, event_name, event_function) {if(html_element) {if(html_element.attachEvent) html_element.attachEvent("on" + event_name, event_function); else if(html_element.addEventListener) html_element.addEventListener(event_name, event_function, false); }} /****************************************************** Just a test object ******************************************************/ var helloobjs = []; var HelloObject = function HelloObject(div_container) { //Adding this object in helloobjs array var id = helloobjs.length; helloobjs[id] = this; //Appending click event to show the hello window AppendEvent(div_container, 'click', function() { helloobjs[id].hello(); //THIS WORKS! }); /***************************************************/ this.hello = function() { alert('hello'); } } </script> </head><body> <div id="one">click me</div> <div id="two">click me</div> <script type="text/javascript"> var t = new HelloObject(document.getElementById('one')); var t = new HelloObject(document.getElementById('two')); </script> </body></html> In order to achive the same result I could simply replace the code //Appending click event to show the hello window AppendEvent(div_container, 'click', function() { helloobjs[id].hello(); //THIS WORKS! }); with this code: //Appending click event to show the hello window var me = this; AppendEvent(div_container, 'click', function() { me.hello(); //THIS WORKS TOO AND THE GLOBAL helloobjs ARRAY BECOMES SUPEFLOUS! }); thus would make the helloobjs array superflous. My question is: does this 2nd option in your opinion create memoy leaks on IE or strange cicular references that might lead to browsers going slow or to break??? I don't know how to explain, but coming from a background as a C/C++ coder, doing in this 2nd way sounds like a some sort of circular reference that might break memory at some point. I also read on internet about the IE closures memory leak issue http://jibbering.com/faq/faq_notes/closures.html (I don't know if it was fixed in IE7 and if yes, I hope it does not come out again in IE8). Thanks

    Read the article

  • How Can I Start an Incognito/Private Browsing Window from a Shortcut?

    - by Jason Fitzpatrick
    Sometimes you just want to pop the browser open for a quick web search without reloading all your saved tabs; read on as we show a fellow reader how to make a quick private-browsing shortcut. Dear How-To Geek, I came up with a solution to my problem, but I need your help implementing it. I typically have a ton of tabs open in my web browser and, when I need to free up system resources when gaming or using a resource intense application, I shut down the web browser. The problem arises when I find myself needing to do quick web search while the browser is shut down. I don’t want to open it up, load all the tabs, and waste the resources in doing so all for a quick Google search. The perfect solution, it would seem, is to open up one of Chrome’s Incognito windows: it loads separate, it won’t open up all the old tabs, and it’s perfect for a quick Google search. Is there a way to launch Chrome with a single Incognito window open without having to open the browser in the normal mode (and load the bazillion tabs I have sitting there)? Sincerely, Tab Crazy That’s a rather clever work around to your problem. Since you’ve already done the hard work of figuring out the solution you need, we’re more than happy to help you across the finish line. The magic you seek is available via what are known as “command line options” which allow you to add additional parameters and switches onto a command.   By appending the command the Chrome shortcut uses, we can easily tell it to launch in Incognito mode. (And, for other readers following along at home, we can do the same thing with other browsers like Firefox). First, let’s look at Chrome’s default shortcut: If you right click on it and select the properties menu, you’ll see where the shortcut points: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" If you run that shortcut, you’ll open up normal browsing mode in Chrome and your saved tabs will all load. What we need to do is use the command line switches available for Chrome and tell it that we want it to launch an Incognito window instead. Doing so is as simple as appending the end of the “Target” box’s command line entry with -incognito, like so: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -incognito We’d also recommend changing the icon to it’s easy to tell the default Chrome shortcut apart from your new Incognito shortcut. When you’re done, make sure to hit OK/Apply at the button to save the changes. You can recreate the same private-browsing-shortcut effect with other major web browsers too. Repeat shortcut editing steps we highlighted above, but change out the -incognito with -private (for Firefox and Internet Explorer) and -newprivatetab (for Opera). With just a simple command line switch applied, you can now launch a lightweight single browser window for those quick web searches without having to stop your game and load up all your saved tabs. Have a pressing tech question? Email us at [email protected] and we’ll do our best to answer it.

    Read the article

  • Using a dynamic <script> (a <script> appended to the DOM by JavaScript) to load and initialize Click

    - by Bungle
    I'm creating an HTML/JavaScript widget to be used on third-party sites. This widget is generated by a <script> that our customers will insert on their page. The <script> creates an <iframe> in the customer's domain, and then creates and inserts all of that <iframe>'s content using JavaScript. It's important that this <iframe> contain Clicky's tracking code to monitor clicks on outbound links. Unfortunately, I'm not having any luck getting Clicky to work when I append the requisite <script> elements to the <iframe> using JavaScript. I first tried simply appending the Clicky tracking code to the <iframe> after appending some test outbound links, hoping that Clicky could attach to those automatically as it does on a static page. That didn't seem to work, so my next inclination was to use the "advanced_disable" custom option and use clicky.log() on the links I want to track. Here's a link to a test page that's along those lines: http://onespot.wsj.com/static/clicky_iframe_test.html When clicking a link on that test page, the action is not logged in Clicky, and a JavaScript error appears: clicky is not defined This ("clicky") appears to be defined in http://static.getclicky.com/js, which I confirmed through the Firebug console is indeed loading before I click a test outbound link. Has anyone successfully loaded Clicky in this way? If so, could you provide some sample code, a link to a working implementation, or some feedback on what's wrong with my code? I would also be interested to know if this is even possible. Thanks very much for any help or advice!

    Read the article

  • Using Uploadify, I'm renaming uploaded files via uploadify.php, how do I get the check script to now check for this renamed file??

    - by Rob Macintosh
    I've modified my uploadify.php file to rename my uploaded files, i'm appending them with my clients company name. As you can see i'm using scriptData to set the company name, so that uploadify.php can use it. documents.php 'scriptData': { 'PHPSESSID': '<?php echo session_id();?>', 'client_company': '<?php echo $_SESSION['company'] . "-";?>' }, This all works great - but now it breaks my check.php. I'm using the default check script, but now it simply thinks the file doesn't exist, so it overwrites it. I've tried appending the client_company POST variable to the file check; check.php $fileArray = array(); foreach ($_POST as $key => $value) { if ($key != 'folder') { if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $_POST['client_company'] . $value)) { $fileArray[$key] = $value; } } } echo json_encode($fileArray); But it doesn't work :( Can anyone help?

    Read the article

  • How to append query parametr @runtime using jquery

    - by Wondering
    Hi All, Through javascript I am appending one query parameter to the page url and I am facing one strange behaiviour <div> <a href="Default3.aspx?id=2">Click me</a> </div> $(function () { window.location.href = window.location.href + "&q=" + "aa"; }); Now I am appending &q in default3.aspx and in this page the &q is getting added continuously I mean the url become http://localhost:1112/WebSite2/Default3.aspx?id=2&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa one would say just pass it like <a href="Default3.aspx?id=2&q=aa">Click me</a> but I cant do that , value of this query parameter is actually value of an html element which is in default3.aspx..I have to add it in run time. what are the ways to achieve this. Thanks.

    Read the article

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