Search Results

Search found 35102 results on 1405 pages for 'text mining'.

Page 123/1405 | < Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >

  • Adding text read from a file to an array list in java

    - by user1824856
    I am having trouble putting text read from a file into an array list. My text looks like this: 438;MIA;JFK;10:55;1092;447 638;JFK;MIA;19:45;1092;447 689;ATL;DFW;12:50;732;448 etc... My code looks like this: package filesexample; import java.io.*; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.ArrayList; /** * * @author */ public class FilesExample { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { File file = new File ("/Schedule.txt"); try { Scanner scanner= new Scanner(file);; while (scanner.hasNextLine()) { String line = scanner.nextLine(); Scanner lineScanner= new Scanner(line); lineScanner.useDelimiter(";"); while(lineScanner.hasNext()){ String part = lineScanner.next(); System.out.print(part + " "); } System.out.println(); } }catch (FileNotFoundException e){ e.printStackTrace(); } } } Some help on getting started would be much appreciated thank you!

    Read the article

  • javascript created input[type="text'] doesn't post it's variable

    - by ivannovak
    hey there, I'm creating a series of input elements and for some reason their values aren't $_POSTing. Any light shed on the subject would be appreciated! My current code is as follows: javascript Afields = 1; function addAdultInput() { if (Afields != 10) { document.getElementById('adultMembers').innerHTML += "<input type='text' value='' name='adult_members_"+Afields+"' /><br />"; Afields += 1; } else { document.getElementById('adultMembers').innerHTML += "Only 10 Adult Member fields allowed."; document.getElementById('addAdultMember').disabled=true; } } HTML <form name="form1" method="post" action=""> <tr> <td class="style12" valign="top">Adult Members' Names:<br /><small>10 Max </small><input id="addAdultMember" type="button" onclick="addAdultInput()" name="add" value="Add Adult" /></td> <td id="adultMembers"> <span class="erorr">*for paid members only</span><br /> <input type='text' value='' name='adult_members_0' /><br /> </td> </tr> <input type="submit" name="Submit" value="Register"> </form>

    Read the article

  • Faster Javascript text replace

    - by Stacey
    Given the following javascript (jquery) $("#username").keyup(function () { selected.username = $("#username").val(); var url = selected.protocol + (selected.prepend == true ? selected.username : selected.url) + "/" + (selected.prepend == true ? selected.url : selected.username); $("#identifier").val(url); }); This code basically reads a textbox (username), and when it is typed into, it reconstructs the url that is being displayed in another textbox (identifier). This works fine - there are no problems with its functionality. However it feels 'slow' and 'sluggish'. Is there a cleaner/faster way to accomplish this task? Here is the HTML as requested. <fieldset class="identifier delta"> <form action="/authenticate/openid" method="post" target="_top" > <input type="text" class="openid" id="identifier" name="identifier" readonly="readonly" /> <input type='text' id='username' name='username' class="left" style='display: none;'/> <input type="submit" value="Login" style="height: 32px; padding-top: 1px; margin-right: 0px;" class="login right" /> </form> </fieldset> The identifier textbox just has a value set based on the hyperlink anchor of a button.

    Read the article

  • how to back to the first of text file

    - by Naeim
    i have a txt file which have some lines ...and my code is : string line; ifstream myfile("c:\\main.txt"); bool passport = true; while(passport==true){ int pos1=0; cout<<setw(20)<<"PassPort_Number : "; cin>>add.Id ; if (myfile.is_open()) { while(!myfile.eof()){ getline(myfile,line); pos1+=line.find(add.Id); cout<<pos1; }} if(pos1<0) passport=false; else { cout<<"PassPort Number tekrariye :d"<<endl; } } first time everything is ok but at the second time of running it doesn't enter to second while (while(!myfile.eof() ) ... what's wrong with my code? when it goes to the end of text file it doesn't back to the first of file at the next loop ... how can i back to the first of text file ?

    Read the article

  • I want to insert a text in p tag returning string tinyMCE through jquery

    - by user749884
    I want to insert a text in last p tag which is returning from tinyMCE by the following code var html = tinyMCE.activeEditor.getContent(); For this I am using the following jquery code tinyMCE.init({ mode : "textareas", theme : "advanced" }); $(document).ready(function(){ $("a[title='click_to_add']").click(function() { var html = tinyMCE.activeEditor.getContent(); html = $("#p:last").text(); alert(html); name = $(this).html(); content = html+" "+name; tinyMCE.activeEditor.setContent(content); return false; }); }); But it is not working.The HTML code is given below <div style="float:left;"> <textarea id="mail_body" name="mail_body" rows="15" cols="80" style="width:575px;"></textarea> </div> <div id="aaa"> <a href="#" id="news_user" title="click_to_add"> < name > </a> </div> Please give us a solution for this problem.

    Read the article

  • Text being printed twice in uitableview

    - by user337174
    I have created a uitableview that calculates the distance of a location in the table. I used this code in cell for row at index path. NSString *lat1 = [object valueForKey:@"Lat"]; NSLog(@"Current Spot Latitude:%@",lat1); float lat2 = [lat1 floatValue]; NSLog(@"Current Spot Latitude Float:%g", lat2); NSString *long1 = [object valueForKey:@"Lon"]; NSLog(@"Current Spot Longitude:%@",long1); float long2 = [long1 floatValue]; NSLog(@"Current Spot Longitude Float:%g", long2); //Getting current location from NSDictionary CoreDataTestAppDelegate *appDelegate = (CoreDataTestAppDelegate *) [[UIApplication sharedApplication] delegate]; NSString *locLat = [NSString stringWithFormat:appDelegate.latitude]; float locLat2 = [locLat floatValue]; NSLog(@"Lat: %g",locLat2); NSString *locLong = [NSString stringWithFormat:appDelegate.longitude]; float locLong2 = [locLong floatValue]; NSLog(@"Long: %g",locLong2); //Location of selected spot CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:lat2 longitude:long2]; //Current Location CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:locLat2 longitude:locLong2]; double distance = [loc1 getDistanceFrom: loc2] / 1600; NSMutableString* converted = [NSMutableString stringWithFormat:@"%.1f", distance]; [converted appendString: @" m"]; It works fine apart from a problem i have just discovered where the distance text is duplicated over the top of the detailed text label when you scroll beyond the height of the page. here's a screen shot of what i mean. Any ideas why its doing this?

    Read the article

  • Replacing text with variables

    - by Steve
    I have to send out letters to certain clients and I have a standard letter that I need to use. I want to replace some of the text inside the body of the message with variables. Here is my maturity_letter models.py class MaturityLetter(models.Model): default = models.BooleanField(default=False, blank=True) body = models.TextField(blank=True) footer = models.TextField(blank=True) Now the body has a value of this: Dear [primary-firstname], AN IMPORTANT REMINDER… You have a [product] that is maturing on [maturity_date] with [financial institution]. etc Now I would like to replace everything in brackets with my template variables. This is what I have in my views.py so far: context = {} if request.POST: start_form = MaturityLetterSetupForm(request.POST) if start_form.is_valid(): agent = request.session['agent'] start_date = start_form.cleaned_data['start_date'] end_date = start_form.cleaned_data['end_date'] investments = Investment.objects.all().filter(maturity_date__range=(start_date, end_date), plan__profile__agent=agent).order_by('maturity_date') inv_form = MaturityLetterInvestments(investments, request.POST) if inv_form.is_valid(): sel_inv = inv_form.cleaned_data['investments'] context['sel_inv'] = sel_inv maturity_letter = MaturityLetter.objects.get(id=1) context['mat_letter'] = maturity_letter context['inv_form'] = inv_form context['agent'] = agent context['show_report'] = True Now if I loop through the sel_inv I get access to sel_inv.maturity_date, etc but I am lost in how to replace the text. On my template, all I have so far is: {% if show_letter %} {{ mat_letter.body }} <br/> {{ mat_letter.footer }} {% endif %} Much appreciated.

    Read the article

  • Integration test for H1 text failing when it should be passing (Rspec and Capybara)

    - by rebec
    Below you can see my test for what happens when a user tries to access the page to edit a profile photo that they don't own. I've used the same test on the NEW action, where it worked fine, but it surprised me by failing when I copied it down to the EDIT action tests. I've used save_and_open_page to test what Capybara's seeing (as you can see below); the resulting page definitely has an h1 with the specified text in it. No spelling errors, and case is all the same as in the test. I've tried using both have_css and have_selector. Both fail. I'm still learning Ruby, Rails, Rspec and especially Capybara (was using webrat previously and recently switched over), and wonder if I'm misconceiving of something that's making me expect this to pass when it doesn't. Any thoughts? Thanks! describe "EDIT" do let(:user) { FactoryGirl.create(:user) } let(:different_user) { FactoryGirl.create(:user) } let(:admin_user) { FactoryGirl.create(:user, role: "admin") } let(:profile_photo1) { FactoryGirl.create(:profile_photo, user: user) } subject { page } context "when signed in as any member" do before { login different_user visit edit_user_profile_photo_path(:id => profile_photo1, :user_id => profile_photo1.user_id) save_and_open_page } # It should deny access with an Unauthorised/Forbidden message. it { should have_css('h1', text: "Unauthorised/Forbidden.") } end

    Read the article

  • inline block and middle text?

    - by user3551629
    I've made this code for navigation bar. HTML : <div class="header-nav"> <div class="header"> <img src="../Pictures/LifeFrame/2.jpg"/ width="100%" height="100px"> </div> <div class="nav" align="center"> <a href="#">Home</a> <a href="#">Gallery</a> </div> </div> CSS : .header-nav{ position:fixed; top:0; width:100%; left:0; right:0; } .nav{ height: 42px; background-color:#FF0000; } a{ display:inline-block; width:50%; height:42px; float:left; } but the text in tag a is on top not in middle. how to make the text in a tag with display inline block to middle ?

    Read the article

  • Undefined method 'size' for #<File:text.txt> (NoMethodError)

    - by user1354456
    This is the code I am running, it does fine until I get to line 15. The command I run is: ruby ex16.rb text.txt. This is a practice sample I'm writing which is meant to be a simple little text editor: filename = ARGV.first script = $0 puts "We're going to erase #{filename}." puts "if you don't want that, hit CTRL-C (^C)." puts "If you do want that, hit RETURN." print "? " STDIN.gets puts "Opening the file..." target = File.open(filename, 'w') puts "Truncating the file. Goodbye!" target.truncate(target.size) puts "Now I'm going to ask you for three lines." print "line 1: "; line1 = STDIN.gets.chomp() print "line 2: "; line2 = STDIN.gets.chomp() print "line 3: "; line3 = STDIN.gets.chomp()undefined method 'size' puts "I'm going to write these to the file." target.write(line1) target.write("\n") target.write(line2) target.write("\n") target.write(line3) target.write("\n") puts "And finally, we close it." target.close()

    Read the article

  • $(selector).text() equivalent in c# (Revised)

    - by Ian Jasper Bardoquillo
    Hi, I am trying check if the inner html of the element is empty but I wanted to do the validation on the server side, I'm treating the html as a string. Here is my code public string HasContent(string htmlString){ // this is the expected value of the htmlString // <span class="spanArea"> // <STYLE>.ExternalClass234B6D3CB6ED46EEB13945B1427AA47{;}</STYLE> // </span> // From this jquery code--------------> // if($('.spanArea').text().length>0){ // // } // <------------------ // I wanted to convert the jquery statement above into c# code. /// c# code goes here return htmlSTring; } using this line $('.spanArea').text() // what is the equivalent of this line in c# I will know if the .spanArea does really have something to display in the ui or not. I wanted to do the checking on the server side. No need to worry about how to I managed to access the DOM I have already taken cared of it. Consider the htmlString as the Html string. My question is if there is any equivalent for this jquery line in C#? Thanks in advance! :)

    Read the article

  • Hidden/best features of TextPad

    - by Binoj Antony
    I use Textpad as a text editor, so far I have found few of the features to be invaluable, please list features and keyboard shortcuts you find to be useful. CTRL + SHIFT + G : Selecting a file name and pressing this key combination will open this file in the editor. ALT + Mouse Left click + drag : This will let you select (to copy or cut) text vertically. CTRL + F5 : Find in files in subfolders. CTRL + M : To locate the matching end/begin braces. Regular expression support in find and replace. CTRL + F9 : Compare files Editable syntax hilighting Macros Abundance of free extensions Hope there are people out there who use Textpad.

    Read the article

  • Vim: Custom Folding function done, custom highlighting required

    - by sixtyfootersdude
    I have defined a function in vim to properly indent folds. Ie so they look like this: Unfolded this is text also text indented text indented text not indented text folded with default function this is text also text +-- 2 lines: indented text ---------------------------- not indented text folded with my new function this is text also text ++- 2 lines: indented text ---------------------------- not indented text The only problem is the the highlighting is still like this: folded with my new function (highlighting shown with tag) this is text also text <hi> ++- 2 lines: indented text ----------------------------</hi> not indented text I would like the highlighting to start at the ++ and not at the beginning of the line. I have looked in the vim manual but could not find anything like that. One so-so solution I found was to make the background black. highlight Folded ctermbg=black ctermfg=white cterm=bold But this make folds less visible. I have tried several variations of: syn keyword Folded lines syn region Folded ... But I don't think that this is the way that folds are selected. Can anyone offer a suggestion? By the way this is my function to indent the folds: set foldmethod=indent function! MyFoldText() let lines = 1 + v:foldend - v:foldstart let ind = indent(v:foldstart) let spaces = '' let i = 0 while i < ind let i = i+1 let spaces = spaces . ' ' endwhile let linestxt = 'lines' if lines == 1 linestxt = 'line' endif return spaces . '+' . v:folddashes . ' '. lines . ' ' . linestxt . ': ' . getline(v:foldstaendfunction endfunction au BufWinEnter,BufRead,BufNewFile * set foldtext=MyFoldText() By the way thanks to njd for helping me get this function setup.

    Read the article

  • Reconstructing Position in the Original Array from the Position in a Stripped Down Array

    - by aronchick
    I have a text file that contains a number of the following: <ID> <Time 1> --> <Time 2> <Quote (potentially multiple line> <New Line Separator> <ID> <Time 1> --> <Time 2> <Quote (potentially multiple line> <New Line Separator> <ID> <Time 1> --> <Time 2> <Quote (potentially multiple line> <New Line Separator> I have a very simple regex for stripping these out into a constant block so it's just: <Quote> <Quote> <Quote> What I'd like to do is present the quotes as a block to the user, and have them select it (using jQuery.fieldSelection) and then use the selected content to back out to the original array, so I can get timing and IDs. Because this has to go out to HTML, and the user has to be able to select the text on the screen, I can't do anything like hidden divs or hidden input fields. The only data I will have is the character range selected on screen. To be specific, this is what it looks like: 1 0:00 --> 0:05 He was bored. So bored. His great intellect, seemingly inexhaustible, was hungry for new challenges but he was the last of the great innovators 2 0:05 --> 0:10 - society's problems had all been solved. 3 0:11 --> 0:20 All seemingly unconnected disciplines had long since been found to be related in horrifically elusive and contrived ways and he had mastered them all. And this is what I'd like to present to the user for selection: He was bored. So bored. His great intellect, seemingly inexhaustible, was hungry for new challenges but he was the last of the great innovators - society's problems had all been solved. All seemingly unconnected disciplines had long since been found to be related in horrifically elusive and contrived ways and he had mastered them all. Has anyone com across something like this before? Any ideas how to take the selected text, or selection position, and go backwards to the original meta-data?

    Read the article

  • Drawing an NSAttributedString into a non-rectangular CGPath?

    - by Adrian Kosmaczewski
    I generate a rather complex NSAttributedString in my iOS 3.2 application (iPad), including formatting options of type CTParagraphStyleSetting, in particular with values for kCTParagraphStyleSpecifierMinimumLineHeight and kCTParagraphStyleSpecifierParagraphSpacing. When I try to draw this attributed string into a non-rectangular CGPath, Core Text draws it but without the line spacing defined; that is, all text appears crammed in paragraphs without line spacing. Needless to say, it does not look as pretty as if the CGPath was simply defined using a single call to CGPathAddRect()! Is there any setting I can specify (to my CTFramesetterRef or to the CTFrameRef associated to the culprit CGPath) to avoid losing all line height information? Thanks!

    Read the article

  • Fading in/Fade out text in IE

    - by tau
    I had a problem and whipped up a quick solution: fade-in and fade-out a series of quotations. My solution works just as I want it in every browser except any of the IEs. The only problem with the IEs is that the text does not fade in and fade out; the text simply pops into existence. I believe I've run into a similar problem before when trying to dynamically change the filter:alpha(opacity=xx) of an element. Any help is greatly appreciated! <html> <head> <style> .fadetext{ background:green; border:1px solid red; height:50px; width:500px; } .fadetext div{ background:yellow; } </style> <script type="text/javascript"> var CI_common = { C:function(cls,elm){ if(!elm) elm = document; if(document.getElementsByClassName){ return elm.getElementsByClassName(cls); }else{ var t = []; var o = elm.getElementsByTagName("*"); var r = new RegExp("(^|\\s)" + cls + "($|\\s)"); for(var i=0;i<o.length;i++){ if(o[i].className.match(r)) t.push(o[i]); } return t; } }, eventAdd:function(obj,evt,func){ if(obj.addEventListener){ obj.addEventListener(evt,func,false); }else if(obj.attachEvent){ obj["x" + evt + func] = func; obj[evt + func] = function(){ obj["x" + evt + func](window.event); } obj.attachEvent("on" + evt,obj[evt + func]); } } } var CI_fadetext = { init:function(){ var c = CI_common.C("fadetext"); // Simply a getElementsByClassName function for(var i=0;i<c.length;i++){ c[i].style.overflow = "hidden"; var kids = c[i].getElementsByTagName("div"); for(var j=0;j<kids.length;j++){ kids[j].style.display = "none"; kids[j].style.filter = "alpha(opacity=0)"; kids[j].style.opacity = "0"; (function(obj,index,len){ obj.fadetexttimeout = setTimeout(function(){ CI_fadetext.fade(obj,true); obj.fadeininterval = setInterval(function(){ CI_fadetext.fade(obj,true); },5000*len) },5000*index); setTimeout(function(){ CI_fadetext.fade(obj,false); obj.fadeoutinterval = setInterval(function(){ CI_fadetext.fade(obj,false); },5000*len) },5000*index+4400); })(kids[j],j,kids.length); } } }, fade:function(elm,dir){ function fade(start){ start = (dir ? start + 10 : start - 10); elm.style.filter = "alpha(opacity=" + start + ")"; elm.style.opacity = start/100; document.getElementById("output").innerHTML = elm.style.filter; if(start > 100 || start <0){ elm.style.display = (dir ? "" : "none"); elm.style.filter = "alpha(opacity=" + (dir ? 100 : 0) + ")"; elm.style.opacity = (dir ? 1 : 0); }else elm.fadetexttimeout = setTimeout(function(){fade(start);},50); } if(dir){ elm.style.display = ""; fade(0); }else fade(100); } } CI_common.eventAdd(window,"load",CI_fadetext.init); // Just a window.onload level 2 event listener </script> </head> <body> <div id="output"></div> <div class="fadetext"> <div>AAAA</div> <div>BBBB</div> <div>CCCC</div> <div>DDDD</div> <div>EEEE</div> </div> </body> </html>

    Read the article

  • OpenGL billboard interpolation issue

    - by PeanutPower
    I have a billboard quad with a texture mapped onto it. This is basically some text with transparency. The billboard floats forwards and backwards from the camera's perspective. As the billboard moves away (and appears smaller) there is an flickering effect around the edges of the text where there is a stroke border on the actual texture. I think this is because interpolation is needed as the image which is normally X pixels wide is now shown as only a % of X and some pixels need to be merged together. I guess it's doing nearest neighbour or something? Can anyone point me in the right direction for opengl settings to control this, I'm guessing there is some way of preventing this effect from happening by adjusting the method for how the texture is handled ?

    Read the article

  • OSLO, ANTLR or other parser grammar, for parsing QUERY EXPRESSION

    - by Jay Allard
    Greetings I'm working on a project that requires me to write queries in text form, then convert them to some easily processed nodes to be processed by some abiguous repository. Of everything there, the part I'm least interested is the part that converts the text to nodes. I'm hoping it's already done somewhere. Because I'm making stuff up as I go, I chose to use a LINQish expression syntax. from m in Movie select m.A, m.B I started parsing it manually and got the basics, but it's pretty cheesy. I'm looking for the better solution. I made some progress using MGrammar, but it would be nice if such a thing already existed. Does anyone know of anything that already does this? I looked for existing ANTLR templates, but no luck. Thanks for the help.

    Read the article

  • Latex editor for windows that works with unicode

    - by Anna
    Hello, I need to write Hebrew text in Latex. I am currently working on Windows with TeXnicCenter. I was pretty happy with this tool, up until the time when I needed to write Hebrew text. My regular alt-shift just won't change the language (I even downloaded the last alpha version, which was supposed to solve the problem, but it didn't). So I'm looking for another latex editor for windows that will let me write Hebrew. Please advice. Note: I know that it is possible with Lyx, but I prefer a real Latex editor.

    Read the article

  • django 'urlize' strings form tect just like twitter

    - by dana
    heyy there i want to parse a text,let's name it 'post', and 'urlize' some strings if they contain a particular character, in a particular position. my 'pseudocode' trial would look like that: def urlize(post) for string in post if string icontains ('#') url=(r'^searchn/$', searchn, name='news_searchn'), then apply url to the string return urlize(post) i want the function to return to me the post with the urlized strings, where necessary (just like twitter does). i don't understand: how can i parse a text, and search for certain strings? is there ok to make a function especially for 'urlizing' some strings? The function should return the entire post, no matter if it has such kind of strings. is there another way Django offers? Thank you

    Read the article

  • Storing a set of values in Delphi

    - by Hendriksen123
    I am trying to store a set of values in delphi, but i want to be able to address them using their name, instead of an assigned number. For example, an array of 'OldValues' would let me do OldValue[1] := InflationEdit.Text; Ideally however, i would like to have a value stored in 'Data.Inflation.OldValue' for example. For each identifier, such as Inflation, there is an OldValue, NewValue and StoredValue. There are about 12 of these identifiers. Is there some way i could store the values like this? that way i could then do something like: Data.Inflation.NewValue := Data.Inflation.OldValue; Data.Inflation.NewValue := InflationEdit.Text;

    Read the article

  • storing data in a database using edit text and button

    - by user1841444
    Hai im trying to Insert data into database using EditText and Button i have created. Im stuck at Activity part of the Code.I unbale to proceed how to write the Onclick action part for Button and EditText part Please help me. Im new to android DBAdapter.java package com.example.database1; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DBAdapter { public static final String KEY_ROWID = "_id"; public static final String KEY_ISBN = "isbn"; public static final String KEY_TITLE = "title"; public static final String KEY_PUBLISHER = "publisher"; private static final String TAG = "DBAdapter"; private static final String DATABASE_NAME = "books"; private static final String DATABASE_TABLE = "titles"; private static final int DATABASE_VERSION = 1; private static final String DATABASE_CREATE = "create table titles (_id integer primary key autoincrement, " + "isbn text not null, title text not null, " + "publisher text not null);"; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DBAdapter(Context ctx) { this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS titles"); onCreate(db); } } //---opens the database--- public DBAdapter open() throws SQLException { db = DBHelper.getWritableDatabase(); return this; } //---closes the database--- public void close() { DBHelper.close(); } //---insert a title into the database--- public long insertTitle(String isbn, String title, String publisher) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_ISBN, isbn); initialValues.put(KEY_TITLE, title); initialValues.put(KEY_PUBLISHER, publisher); return db.insert(DATABASE_TABLE, null, initialValues); } //---deletes a particular title--- public boolean deleteTitle(long rowId) { return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0; } //---retrieves all the titles--- public Cursor getAllTitles() { return db.query(DATABASE_TABLE, new String[] { KEY_ROWID, KEY_ISBN, KEY_TITLE, KEY_PUBLISHER}, null, null, null, null, null); } //---retrieves a particular title--- public Cursor getTitle(long rowId) throws SQLException { Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] { KEY_ROWID, KEY_ISBN, KEY_TITLE, KEY_PUBLISHER }, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } //---updates a title--- public boolean updateTitle(long rowId, String isbn, String title, String publisher) { ContentValues args = new ContentValues(); args.put(KEY_ISBN, isbn); args.put(KEY_TITLE, title); args.put(KEY_PUBLISHER, publisher); return db.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0; } } DatabaseActivity.java package com.example.database1; import android.os.Bundle; import android.app.Activity; import android.database.Cursor; import android.view.Menu; import android.widget.Toast; public class DatabaseActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_database); DBAdapter db=new DBAdapter(this); db.open(); } } activity_database.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/edit1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/edit2" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <EditText android:id="@+id/edit3" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/submit" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Android: Enable selection in webkit

    - by tacone
    Hello, I'am looking for a way to have a webview content selectable in the very same way as the stock browser does. user long presses the text the whole word is selected two pins appear at the word's boundary allowing the user to stretch/shrink the selection. I should note that Dolphin HD shows exactly the same text select functionality as the default browser (same icons, animation, etc), so it really should be possible. But I can't figure out how. Until now, all i found was this function, which kind of work, but doesn't allow the user to expand/shrink the selection. public void selectAndCopyText() { try { KeyEvent shiftPressEvent = new KeyEvent(0,0,KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0); shiftPressEvent.dispatch(mWebView); } catch (Exception e) { throw new AssertionError(e); } }

    Read the article

  • [AS3] htmlText not showing bold or italics font

    - by Conor
    So I have a MovieClip asset with a dynamic textfield sitting inside of it. I export my .fla as a .swc to use within Flash Builder 4, and create instances of the asset with code, populating the text dynamically from XML. My issue is that even though I have htmlText enabled, bold and italics tags don't appear to be working. I have a feeling it is because when I created the asset in Flash CS4, the text field makes you specify the font, and the subset of that to use (Regular, Bold, Oblique, etc). Is there any way to get the htmlText to render bold and italics tags properly without having to completely rethink the way I'm creating all these fields?

    Read the article

  • How do you use kate? Tips/Tricks/Workflow

    - by Roman A. Taycher
    We all seen a bunch of these? Mostly for IDE's but also for vim and emacs. Kate is (only) a text editor (an awesome one) but it has a ton of options plus a number of plugins, so its hard to know all of it well. How do use the Kate text editor? Please share your workflow and help me and others learn some of the cool tricks you use. I'll start I use the built in terminal a lot opening files quickly, and using it as an enhanced haskell repl with ghci (since ghci doesn't allow you all to just put in all kinds of haskell code). Also use split views to quickly compare files (especially different versions of the same file). Also the auto-complete maybe simple(more use for saving typing time then remembering functions) but it works really well for that. Also if You highlight something and hit a start [/{/( it puts it in between brackets rather then replacing it with a bracket(why the hell do a lot of IDEs not have this feature).

    Read the article

< Previous Page | 119 120 121 122 123 124 125 126 127 128 129 130  | Next Page >