Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 168/1488 | < Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >

  • Jquery - return html as a string

    - by McNabbToSkins
    I am using the Jquery Wysiwyg editor and I am trying to capture the html that makes up the content area to store in a DB. Is there anyway to get html of a element and save it as a string? My code looks like tihs <iframe id="wysiwyg_IFrame> <html> <head></head> <body> <ul> <li>This is a test</li> </ul> </body> </html> </iframe> I would either like to get a string that starts with <html>....</html> or just the body <body>...</body> does anyone know if this is possible? Thanks

    Read the article

  • How to generate a random alpha-numeric string in Java

    - by Todd
    I've been looking for a simple java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would "likely" be unique over 500K+ generation (my needs don't really require anything much more sophisticated) . Ideally I would be able to specify a length depending on my uniqueness needs. For example, a generated string of length 12 might look something like "AEYGF7K0DM1X". Answers: I like @Apocalisp and @erickson's answers equally well. The only downside to @Apocalisp's answer is it requires an apache class. Thanks to both for the help!

    Read the article

  • click buttons error

    - by sara
    I will retrieve student information (id -number- name) from a database (MySQL) as a list view, each student have 2 buttons (delete - alert ) and radio buttons Every thing is ok, but how can I make an onClickListener, for example for the delete button because I try lots of examples, I heard that I can use (custom list or get view or direct onClickListener as in my code (but it is not working ) or Simple Cursor Adapter) I do not know what to use, I looked around for examples that can help me, but in my case but I did not find any so I hope this be reference for anyone have the same problem. this is my code which I use direct onClick with Simple Adapter public class ManageSection extends ListActivity { //ProgresogressDialog pDialog; private ProgressDialog pDialog; // Creating JSON Parser object // Creating JSON Parser object JSONParser jParser = new JSONParser(); //class boolean x =true; Button delete; ArrayList<HashMap<String, String>> studentList; //url to get all products list private static String url_all_student = "http://10.0.2.2/SmsPhp/view_student_info.php"; String cl; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_student = "student"; private static final String TAG_StudentID = "StudentID"; private static final String TAG_StudentNo = "StudentNo"; private static final String TAG_FullName = "FullName"; private static final String TAG_Avatar="Avatar"; HashMap<String, String> selected_student; // course JSONArray JSONArray student = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.manage_section); studentList = new ArrayList<HashMap<String, String>>(); ListView list1 = getListView(); list1.setAdapter(getListAdapter()); list1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) { selected_student =(HashMap<String, String>) studentList.get(pos); //member of your activity. delete =(Button)view.findViewById(R.id.DeleteStudent); cl=selected_student.get(TAG_StudentID); Toast.makeText(getBaseContext(),cl,Toast.LENGTH_LONG).show(); delete.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.d("id: ",cl); Toast.makeText(getBaseContext(),cl,Toast.LENGTH_LONG).show(); } }); } }); new LoadAllstudent().execute(); } /** * Background Async Task to Load all student by making HTTP Request * */ class LoadAllstudent extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(ManageSection.this); pDialog.setMessage("Loading student. Please wait..."); pDialog.setIndeterminate(false); } /** * getting All student from u r l * */ @Override protected String doInBackground(String... args) { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); // getting JSON string from URL JSONObject json = jParser.makeHttpRequest(url_all_student, "GET", params); // Check your log cat for JSON response Log.d("All student : ", json.toString()); try { // Checking for SUCCESS TAG int success = json.getInt(TAG_SUCCESS); if (success == 1) { // student found // Getting Array of course student = json.getJSONArray(TAG_student); // looping through All courses for (int i = 0; i < student.length(); i++)//course JSONArray { JSONObject c = student.getJSONObject(i); // read first // Storing each json item in variable String StudentID = c.getString(TAG_StudentID); String StudentNo = c.getString(TAG_StudentNo); String FullName = c.getString(TAG_FullName); // String Avatar = c.getString(TAG_Avatar); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_StudentID, StudentID); map.put(TAG_StudentNo, StudentNo); map.put(TAG_FullName, FullName); // adding HashList to ArrayList studentList.add(map); } } else { x=false; } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { // dismiss the dialog after getting all products pDialog.dismiss(); if (x==false) Toast.makeText(getBaseContext(),"no student" ,Toast.LENGTH_LONG).show(); ListAdapter adapter = new SimpleAdapter( ManageSection.this, studentList, R.layout.list_student, new String[] { TAG_StudentID, TAG_StudentNo,TAG_FullName}, new int[] { R.id.StudentID, R.id.StudentNo,R.id.FullName}); setListAdapter(adapter); // Updating parsed JSON data into ListView } } } So what do you think, why doesn't the delete button work? There is no error in my log cat. What is the alternative way ?.. what should I do ?

    Read the article

  • Remove all problematic characters in an intelligent way in C#

    - by J. Pablo Fernández
    Is there any .Net library to remove all problematic characters of a string and only leave alphanumeric, hyphen and underscore (or similar subset) in an intelligent way? This is for using in URLs, file names, etc. I'm looking for something similar to stringex which can do the following: A simple prelude "simple English".to_url = "simple-english" "it's nothing at all".to_url = "its-nothing-at-all" "rock & roll".to_url = "rock-and-roll" Let's show off "$12 worth of Ruby power".to_url = "12-dollars-worth-of-ruby-power" "10% off if you act now".to_url = "10-percent-off-if-you-act-now" You don't even wanna trust Iconv for this next part "kick it en Français".to_url = "kick-it-en-francais" "rock it Español style".to_url = "rock-it-espanol-style" "tell your readers ??".to_url = "tell-your-readers-ni-hao"

    Read the article

  • Is there any way to modify a column before it is ordered in MySQL?

    - by George Edison
    I have a table with a field value which is a varchar(255). The contents of the field can be quite varied: $1.20 $2994 $56 + tax (This one can be ignored or truncated to $56 if necessary) I have a query constructed: SELECT value FROM unnamed_table ORDER BY value However, this of course uses ASCII string comparison to order the results and does not use any numerical type of comparison. Is there a way to truly order by value without changing the field type to DECIMAL or something else? In other words, can the value field be modified ('$' removed, value converted to decimal) on the fly before the results are sorted?

    Read the article

  • PHP preg_replace() pattern, string sanitization.

    - by Otar
    I have a regex email pattern and would like to strip all but pattern-matched characters from the string, in a short I want to sanitize string... I'm not a regex guru, so what I'm missing in regex? <?php $pattern = "/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i"; $email = 'contact<>@domain.com'; // wrong email $sanitized_email = preg_replace($pattern, NULL, $email); echo $sanitized_email; // Should be [email protected] ?> Pattern taken from: http://fightingforalostcause.net/misc/2006/compare-email-regex.php (the very first one...)

    Read the article

  • Capitalize Words in PHP with custom delimitor

    - by Paulie
    Hey guys, i need a method to capitalize every first letter of a word. This is what i got so far and it is working for almost every string...but it fails on this one "WELLNESS & RENOMME". // method in stringModify Class function capitalizeWords($words, $charList) { $capitalizeNext = true; for ($i = 0, $max = strlen($words); $i < $max; $i++) { if (strpos($charList, $words[$i]) !== false) { $`capitalizeNext` = true; } else if ($capitalizeNext) { $capitalizeNext = false; $words[$i] = strtoupper($words[$i]); } } return $words; } // Calling method $stringModify->capitalizeWords("WELLNESS & RENOMME", " -&"); I hope someone can help me out...i tried for 1,5 hours now and don't have a clue. Thanks in advance for any tips or hints. Greetz Paulie

    Read the article

  • Microsoft sublanguage string to locale identifier

    - by Jacob
    I can't seem to find a way to convert, or find, a local identifier from a sublanguage string. This site shows the mappings: http://msdn.microsoft.com/en-us/library/dd318693(v=VS.85).aspx I want the user to enter a sublanguage string, such as "France (FR)" and to get the local identifier from this, which in this case would be 0x0484. Or the other way around, if a user enters 0x0480 then to return French (FR). Has anyone encountered this problem before and can point me in the right direction? Otherwise I'm going to be writing a few mapping statements to hard code it and maintain future releases if anything changes. BTW, I'm coding in C++ for Windows platform. Cheers

    Read the article

  • Escape doube and single backslashes in a string in Ruby

    - by Nick Gorbikoff
    Hello. I'm trying to access a network path in my ruby script on a windows platform in a format like this. \\servername\some windows share\folder 1\folder2\ Now If I try to use this as a path, it won't work. Single backslashes are not properly escaped for this script. path = "\\servername\some windows share\folder 1\folder2\" d = Dir.new(path) I tried everything I could think of to properly escape slashes in the path. However I can't escape that single backslash - because of it's special meaning. I tried single quotes, double quotes, escaping backslash itself, using alternate quotes such as %Q{} or %q{}, using ascii to char conversion. Nothing works in a sense that I'm not doing it right. :-) Right now the temp solution is to Map a network drive N:\ pointing to that path and access it that way, but that not a solution. Does anyone have any idea how to properly escape single backslashes? Thank you

    Read the article

  • Find largest value of integer in repeating string

    - by dotancohen
    I have a script log file that looks a bit like this: 2012-9-16 Did something Did 345 things Script time: 244 seconds 2012-9-17 Did yet something Did another thing 23 times Script time: 352 seconds 2012-9-18 Did something special for 34 seconds 51 times Did nothing at all Script time: 122 seconds I would like to find the largest value of N in the lines Script time: N seconds. However, I need to keep the context, so simply removing all lines that don't contain Script time in them is not a viable solution. Currently, I am grepping for lines with Script time, then sorting those to find the highest value, then going back to the original file and searching for that value. However, if there is a more straightforward way then I would love to know. This is on Vim 7.3 on a recent CentOS. I would prefer to remain in VIM if possible. Thanks.

    Read the article

  • Search for a pattern in a list of strings - Python

    - by Holtz
    I have a list of strings containing filenames such as, file_names = ['filei.txt','filej.txt','filek.txt','file2i.txt','file2j.txt','file2k.txt','file3i.txt','file3j.txt','file3k.txt'] I then remove the .txt extension using: extension = os.path.commonprefix([n[::-1] for n in file_names])[::-1] file_names_strip = [n[:-len(extension)] for n in file_names] And then return the last character of each string in the list file_names_strip: h = [n[-1:] for n in file_names_strip] Which gives h = ['i', 'j', 'k', 'i', 'j', 'k', 'i', 'j', 'k'] How can i test for a pattern of strings in h? So if i,j,k occur sequentially it would return True and False if not. I need to know this because not all file names are formatted like they are in file_names. So: test_ijk_pattern(h) = True no_pattern = ['1','2','3','1','2','3','1','2','3'] test_ijk_pattern(no_pattern) = False

    Read the article

  • php: sort and count instances of words in a given string

    - by superUntitled
    Hello, I need help sorting and counting instances of the words in a string. Lets say I have a collection on words: happy beautiful happy lines pear gin happy lines rock happy lines pear How could I use php to count each instance of every word in the string and output it in a loop: There are $count instances of $word So that the above loop would output: There are 4 instances of happy. There are 3 instances of lines. There are 2 instances of gin.... Thank you for your genius.

    Read the article

  • Create Java method from a string?

    - by drozzy
    Is it possible in Java, to declare a method with a string instead of an identifier? For example can I do something like the following: class Car{ new Method("getFoo", { return 1+1; }); } //Use it Car car = new Car(); car.getFoo(); EDIT: I am adding a Purpose WHY I need this. In order to not hardcode method names when using Jersey and it's UriBuilder, which requires a method name: https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/core/UriBuilder.html See path() method with signature: public abstract UriBuilder path(java.lang.Class resource, java.lang.String method) throws java.lang.IllegalArgumentException I hope my question is clear, if not - let me know and I can clarify it.

    Read the article

  • get last 5 character vb.net

    - by Chocho
    i want to get the last 5 digits/strings from a strings of words. eg: "I will be going to school in 2011!" i am using visual studio.net 2008 and using vb.net. i will like to get "2011!" note, my strings changes, and the last 5 characters can be anything! any ideas. i know visual basic have Right(string, 5); this didn't work for me gave me an error. thanks

    Read the article

  • SQL Server Command Timeouts Timeout expired. The timeout period elapsed prior to completion of the o

    - by user104295
    Hi there, we've had a ASP.NET web application deployed for a number of years now.... last week we migrated to a slightly slower server to save some money. Now we're frequently getting command timeouts: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding This is understandable in that a slower server will take longer to produce results; take longer time and produce a timeout. Is there any system-wide way to get SqlClient to set a longer timeout? We cannot change the code, as it's everywhere... we're using multiple data access technologies as well. Maybe there's a default command timeout setting on a connection string? We just need to increase it by 30 seconds; we're happy to wait a bit longer for queries to return. thanks

    Read the article

  • How to parse an XML string in TDI

    - by ongle
    I am new to TDI. I have a TDI assembly line that calls a web service (ibmdi.InvokeSoapWS) which returns the result as a string in the work attribute 'xmlString'. I then have an AttributeMap that attempts to parse the xml and extract a value (the node it seeks is a few nodes deep). var parser = system.getParser('ibmdi.SOAP'); var xmlString = work.getString('xmlString'); var entity = parser.parseRequest(xmlString); task.dump(entity); The trouble is, the parsed object does not contain an accurate representation of the XML. It contains only two attributes, the first is correctly the first node following the soap body (e.g., ns0:SomeNodeReply), the second being a node inside the first (e.g., ns0:DetailCount). And as far as I can determine, both attributes are just strings so I cannot recurse into the object graph. Below is a sample soap reply: <?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <ns0:SomeNodeReply xmlns:ns0="http://xmlns.example.com/unique/default/namespace/1136581686664"> <ns0:Status> <ns0:StatusCD>000</ns0:StatusCD> <ns0:StatusDesc /> </ns0:Status> <ns0:DetailCount>1</ns0:DetailCount> <ns0:SomeDetail> <ns0:CodeA>Foo</ns0:CodeA> <ns0:CodeB>Bar</ns0:CodeB> </ns0:SomeDetail> </ns0:SomeNodeReply> </SOAP-ENV:Body> </SOAP-ENV:Envelope> And below is a sample dump of the parsed string: 19:03:23 CTGDIS003I *** Start dumping Entry 19:03:23 Operation: generic 19:03:23 Entry attributes: 19:03:23 SOAP_CALL (replace): 'ns0:SomeNodeReply' 19:03:23 ns0:DetailCount(replace): '1' 19:03:23 CTGDIS004I *** Finished dumping Entry All I really need to do is be able to parse out a value that may or may not be there, depending on the value of another node (e.g., DetailCount == 1, get CodeA otherwise return empty string). I am open to changing anything about how this works if I can extract the data into the work Entry.

    Read the article

  • Shell script for replacing string in all PHP-files, for each user

    - by Mads Skjern
    Each user has some php-files using a shared database commondb. I want to iterate over all users (in users.csv), and in their home folder (e.g. /home/joe) find all php files recursively, and replace each occurrence of "commondb" with their own databasename, e.g. "joedb" for "joe". I have tried the following: #!/bin/bash # Execute like this: # bash localize.bash users.csv OLDIFS=$IFS IFS="," while read name dummy do echo $name find /home/${name} -name '*.php' -exec sed -i '' 's/commondb/${name}db/g' "{}" \; done < $1 IFS=$OLDIFS for users.csv joe, Joe J george, George G It does not fail, but the files are unchanged. I am quite weak in bash, and I can't figure out how to debug it :/ Can my script be fixed to work?

    Read the article

  • Using jQuery to find keywords in string

    - by Nic Hubbard
    In php, I have used preg_match_all() to find keywords (using the format %keyword%) in a string, which works wonderfully and returns an array of all found keywords. What I would like to do, is do the same thing using jQuery or javascript. I have tried using the filter() function, and it kind of works. But I think I am missing something. How can I find ALL instances of the keyword in a string, using a regex? Here is what I have worked out so far: $("[id^='editableContent-']").filter(function() { alert($(this).html().match(/\%(.*?)\%/)); }); Any suggestions are welcome!

    Read the article

  • Get the entire string of a jquery DOM object

    - by Scozzard
    Hi, I have had a bit of a look around and am having some difficulty solving a wee issue I am having. I basically have a string of HTML, I convert that to a JQuery DOM object so that I can easily remove all elements that have a certain class using JQuery's .remove(). I.e., var radHtml = editor.get_html(); var jqDom = $(radHtml); $(".thickbox", jqDom).remove(); editor.set_html(jqDom.html()); The only problem is that .html() only gets the first element, not the entire DOM. In reference to my code I am basically wanting radHhtml - elements with class "thickbox" (returned as string). I was wondering if there was an easy way to do this - have some html and remove all elements (in this case divs) that have a certain class (but leaving their contents). JQuery doesnt have to used, but I would like to. Any help would be much appreicated. Thanks.

    Read the article

  • jquery to construct a string and pass it as a post argument for file

    - by user253530
    I have this js code: $("#startSearch").live("click", function(event){ $("input:checkbox[name='searchId']:checked").each(function(){ var searchId = $(this).val(); var host = ''; $.post("php/autosearch-get-host.php",{sId: searchId},function(data){ host = 'http://' + data + '/index.php'; }); //alert(host); $.getJSON(host,{searchId: $(this).val()},function(){ pagination("php/pagination.php", $('#currentPage').val(), $('#sortBy').val(), $("#sortMode").val(), "autosearch"); }); }); }); The php file php/autosearch-get-host.php returns a string with the host name. What i want is to get the host from the database, create the URL using string concatenation and pass it as an argument to another $.post. $.post should use that URL like this: $.getJSON(host,{searchId: $(this).val()},function() { pagination("php/pagination.php", $('#currentPage').val(), $('#sortBy').val(), $("#sortMode").val(), "autosearch"); });

    Read the article

  • linq to sql string property from non-null column with default

    - by Barry Fandango
    I have a LINQ to SQL class "VoucherRecord" based on a simple table. One property "Note" is a string that represents an nvarchar(255) column, which is non-nullable and has a default value of empty string (''). If I instantiate a VoucherRecord the initial value of the Note property is null. If I add it using a DataContext's InsertOnSubmit method, I get a SQL error message: Cannot insert the value NULL into column 'Note', table 'foo.bar.tblVoucher'; column does not allow nulls. INSERT fails. Why isn't the database default kicking in? What sort of query could bypass the default anyway? How do I view the generated sql for this action? Thanks for your help!

    Read the article

  • replace set of integers with respective string values

    - by Tripz
    I have a query which return the output like -- 5,4,6 Where 1 = apple, 2 = mango, 3 = banana, 4 = plum, 5 = cherry, 6 = kiwi etc. I would like to update my output as cherry,plum,kiwi instead of 5,4,6 How can I achieve that in the same select statment. I am okay to hard code the values. Please confirm May be I did explain clearly Here is the sample SELECT fruits FROM t_fruitid where id = 7 is returning me '5,6,4' as a single row Now I want to update this single row output as 'cherry,plum,kiwi' How do I do this Thanku

    Read the article

< Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >