Search Results

Search found 262 results on 11 pages for 'sujit singh'.

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

  • Parse a text file into multiple text file

    - by Vijay Kumar Singh
    I want to get multiple file by parsing a input file Through Java. The Input file contains many fasta format of thousands of protein sequence and I want to generate raw format(i.e., without any comma semicolon and without any extra symbol like "", "[", "]" etc) of each protein sequence. A fasta sequence starts form "" symbol followed by description of protein and then sequence of protein. For example ? lcl|NC_000001.10_cdsid_XP_003403591.1 [gene=LOC100652771] [protein=hypothetical protein LOC100652771] [protein_id=XP_003403591.1] [location=join(12190..12227,12595..12721,13403..13639)] MSESINFSHNLGQLLSPPRCVVMPGMPFPSIRSPELQKTTADLDHTLVSVPSVAESLHHPEITFLTAFCL PSFTRSRPLPDRQLHHCLALCPSFALPAGDGVCHGPGLQGSCYKGETQESVESRVLPGPRHRH Like above formate the input file contains 1000s of protein sequence. I have to generate thousands of raw file containing only individual protein sequence without any special symbol or gaps. I have developed the code for it in Java but out put is : Cannot open a file followed by cannot find file. Please help me to solve my problem. Regards Vijay Kumar Garg Varanasi Bharat (India) The code is /*Java code to convert FASTA format to a raw format*/ import java.io.*; import java.util.*; import java.util.regex.*; import java.io.FileInputStream; // java package for using regular expression public class Arrayren { public static void main(String args[]) throws IOException { String a[]=new String[1000]; String b[][] =new String[1000][1000]; /*open the id file*/ try { File f = new File ("input.txt"); //opening the text document containing genbank ids FileInputStream fis = new FileInputStream("input.txt"); //Reading the file contents through inputstream BufferedInputStream bis = new BufferedInputStream(fis); // Writing the contents to a buffered stream DataInputStream dis = new DataInputStream(bis); //Method for reading Java Standard data types String inputline; String line; String separator = System.getProperty("line.separator"); // reads a line till next line operator is found int i=0; while ((inputline=dis.readLine()) != null) { i++; a[i]=inputline; a[i]=a[i].replaceAll(separator,""); //replaces unwanted patterns like /n with space a[i]=a[i].trim(); // trims out if any space is available a[i]=a[i]+".txt"; //takes the file name into an array try // to handle run time error /*take the sequence in to an array*/ { BufferedReader in = new BufferedReader (new FileReader(a[i])); String inline = null; int j=0; while((inline=in.readLine()) != null) { j++; b[i][j]=inline; Pattern q=Pattern.compile(">"); //Compiling the regular expression Matcher n=q.matcher(inline); //creates the matcher for the above pattern if(n.find()) { /*appending the comment line*/ b[i][j]=b[i][j].replaceAll(">gi",""); //identify the pattern and replace it with a space b[i][j]=b[i][j].replaceAll("[a-zA-Z]",""); b[i][j]=b[i][j].replaceAll("|",""); b[i][j]=b[i][j].replaceAll("\\d{1,15}",""); b[i][j]=b[i][j].replaceAll(".",""); b[i][j]=b[i][j].replaceAll("_",""); b[i][j]=b[i][j].replaceAll("\\(",""); b[i][j]=b[i][j].replaceAll("\\)",""); } /*printing the sequence in to a text file*/ b[i][j]=b[i][j].replaceAll(separator,""); b[i][j]=b[i][j].trim(); // trims out if any space is available File create = new File(inputline+"R.txt"); try { if(!create.exists()) { create.createNewFile(); // creates a new file } else { System.out.println("file already exists"); } } catch(IOException e) // to catch the exception and print the error if cannot open a file { System.err.println("cannot create a file"); } BufferedWriter outt = new BufferedWriter(new FileWriter(inputline+"R.txt", true)); outt.write(b[i][j]); // printing the contents to a text file outt.close(); // closing the text file System.out.println(b[i][j]); } } catch(Exception e) { System.out.println("cannot open a file"); } } } catch(Exception ex) // catch the exception and prints the error if cannot find file { System.out.println("cannot find file "); } } } If you provide me correct it will be much easier to understand.

    Read the article

  • Cordova - Scrolling with a fixed header and footer (ios)

    - by Samu Singh
    Using Cordova (phonegap) & bootstrap to make a mobile application, testing on IOS for now. Getting an issue with a header and footer bar that are fixed with scrollable content in the middle. When tapping to scroll, the header/footer bar moves down or up with the content but then snaps back to place as soon as the scrolling completes. If I use -webkit-overflow-scrolling: touch; it works as expected, but it makes it really awkward to scroll through the content, and if you scroll passed the end, it only scrolls the header or footer (with elastic overflow) until you stop for a second. here's my html for the header/footer bars: <div id="headerBar"> <div class="container-fluid" style="background-color: #1569C7"> <div class="row"> <div class="col-xs-3 text-left"> <button id="logoutButton" type="button" class="btn btn-default"> Log Out </button> <button type="button" class="btn btn-default" id="restoreQuestionFeedButton"> <span class="glyphicon glyphicon-chevron-left"></span> </button> </div> <div class="col-xs-6 text-center" style="height: 55px"> <strong id="usernameText"></strong> </div> <div class="col-xs-3 text-right"> <button id="oldCreatQuestionButton" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-plus"></span> </button> </div> </div> </div> </div> <div id="footerBar"> <div class="container-fluid" style="padding: 0"> <div class="row text-center"> <button id="createQuestionButton" type="button" class="btn btn-default footerButton"> <span class="glyphicon glyphicon-plus"></span> <strong>Ask a new free question!</strong> </button> </div> </div> </div> And here is the related CSS: #headerBar { position: fixed; z-index: 100; top: 0; left: 0; width: 100%; background-color: #1569C7; } #footerBar { position: fixed; z-index: 100; bottom: 0; left: 0; width: 100%; background-color: #1569C7 !important; }

    Read the article

  • Sending URL as a parameter using javascript

    - by Prashant Singh
    I have to send a name and a link from client side to the server. I thought of using AJAX called by Javascript to do this. This is what I mean. I wished to make an ajax request to a file called abc.php with parameters :- 1. http://thumbs2.ebaystatic.com/m/m7dFgOtLUUUSpktHRspjhXw/140.jpg 2. Apple iPod touch, 3rd generation, 32GB To begin with, I encoded the URL and tried to send it. But the server says status Forbidden Any solution to this ? UPDATE :: It end up calling to http://abc.com/addToWishlist.php?rand=506075547542422&image=http://thumbs1.ebaystatic.com/m/mO64jQrMqam2jde9aKiXC9A/140.jpg&prod=Flat%20USB%20Data%20Sync%20Charging%20Charger%20Cable%20Apple%20iPhone%204G%204S%20iPod%20Touch%20Nano Javascript Code :: function addToWishlist(num) { var myurl = "addToWishlist.php"; var myurl1 = myurl; myRand = parseInt(Math.random()*999999999999999); var rand = "?rand="+myRand ; var modurl = myurl1+ rand + "&image=" + encodeURI(storeArray[num][1]) + "&prod=" + encodeURI(storeArray[num][0]); httpq2.open("GET", modurl, true); httpq2.onreadystatechange = useHttpResponseq2; httpq2.send(null); } function useHttpResponseq2() { if (httpq2.readyState == 4) { if(httpq2.status == 200) { var mytext = httpq2.responseText; document.getElementById('wish' + num).innerHTML = "Added to your wishlist."; } } } Server Code <?php include('/home/ankit/public_html/connect_db.php'); $image = $_GET['image']; $prod = $_GET['prod']; $id = $_GET['id']; echo $prod; echo $image; ?> As I mentioned, its pretty basics More Updates : On trying to send a POST request via AJAX to the server, it says :- Refused to set unsafe header "Content-length" Refused to set unsafe header "Connection"

    Read the article

  • how to reload the whole page through a button placed in a division in jsp

    - by ajeet singh
    when i tried to make web project, i placed the links on the left on one division and a bigger division on the right to load the jsp pages on clicking the links making the main page same... but when there is a need arises to load the whole page by clicking the button placed on the right division, i found that the only page is loaded on the right division jsp calling its action... please help me to sort out this problem..

    Read the article

  • How to get dynamically session object in struts2

    - by Sujeet Singh
    I am trying to get dynamically session object in struts2 application. <s:if test="%{#session['resToken'].bookingType == 1}"> resToken can be get by <s:property value="%{resToken}">.. But I can't write <s:property> within <s:if test=""> its giving me error of double quotes.. org.apache.jasper.JasperException: /WEB-INF/jsp/booking/banquet/guest-Info-View.jsp(150,40) Unterminated &lt;s:if tag

    Read the article

  • How to upload a file from app in VC++ 6 to a web server?

    - by Arvind Singh
    I have an application in VC++ 6 (not MFC) , feature requires it to upload a file to a web server on regular basis. Web server is under our control, anonymous upload scripts/page are already setup that would accept a file manually. How to program in VC++ 6 to upload? which classes to use? I understand it is much possible with smtp and ftp but how through http?

    Read the article

  • WPF,XAML: How to set the ZIndex of a particular control to the topmost.

    - by Sudhakar Singh
    how do i set any control to the topmost of the screen. For e.g. i have a textblock in a datatemplate or a hierarchichal data template..etc... now i would like to set this textblock to the topmost on mouseover. Setting the Grid.ZIndex value to 1 in the trigger for IsMouseOver doesn't work many times. In order to do that i set the ZIndex value for all the contols to -1 in the window. it worked in one scenario but doesn't work other times. If anyone can get me the details of ZIndex and how to set the control to the topmost without worrying about the other controls, it would be of great help. Note: setting the value of ZIndex to a higher value e.g. 99999 also doesn't work.

    Read the article

  • Question regarding common class

    - by Rocky Singh
    I have following two classes: public class A : System.Web.UI.WebControls.Button { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } and public class B : System.Web.UI.WebControls.TextBox { public virtual string X { get { object obj = ViewState["X"]; if (obj != null) return (string)obj; return null; } set { ViewState["X"] = value; } } protected override void OnLoad(EventArgs e) { X=2; } } As you must be seeing the class A and B have exactly the same code , my question is how can I make a common class for it and use these two classes.

    Read the article

  • Non-Git Github?

    - by Mihir Singh
    This is probably a really weird question... but is there a non-git Github? I want a place to post my projects and share my code (like Github) but I don't want to have to works with versions, commits, etc. I don't like having to create a link between my folder and my git repo and then push the changes etc. In addition, I don't want to have to have a local copy to create or add files; I can edit existing files in Github, but to create or add files, I have to do it locally and then commit and push. I'm not sure if this is the best site to ask on, but I figured someone might have the answer. Thanks in advance.

    Read the article

  • How to send html content in the Email body

    - by Shalini Singh
    Hi, i am using android code with html tag.. but in mail getting same html tag please help me how can i send html link ... the code is giving below Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"[EMAIL PROTECTED]"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Example"); context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

    Read the article

  • Google Map key in Android?

    - by Amandeep singh
    I am developing an android app in which i have to show map view i have done it once in a previous app but the key i used in the previous is not working int his app . It is just showing a pin in the application with blank screen. Do i have to use a different Map key for each project , If not Kindly help me how can i use my previous Key in this. and also I tried generating a new key but gave the the same key back . Here is the code i used public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); btn=(Button)findViewById(R.id.mapbtn); str1=getIntent().getStringExtra("LATITUDE"); str2=getIntent().getStringExtra("LONGITUDE"); mapView = (MapView)findViewById(R.id.mapView1); //View zoomView = mapView.getZoomControls(); mapView.setBuiltInZoomControls(true); //mapView.setSatellite(true); mc = mapView.getController(); btn.setOnClickListener(this); MapOverlay mapOverlay = new MapOverlay(); List<Overlay> listOfOverlays = mapView.getOverlays(); listOfOverlays.clear(); listOfOverlays.add(mapOverlay); String coordinates[] = {str1, str2}; double lat = Double.parseDouble(coordinates[0]); double lng = Double.parseDouble(coordinates[1]); p = new GeoPoint( (int) (lat * 1E6), (int) (lng * 1E6)); mc.animateTo(p); mc.setZoom(17); mapView.invalidate(); //mp.equals(o); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); Paint mPaint = new Paint(); mPaint.setDither(true); mPaint.setColor(Color.RED); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(2); //---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(p, screenPts); //---add the marker--- Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null); return true; } Thanks....

    Read the article

  • Need to open to two excel files and add numbers from them into a third file using vba.

    - by Harpyar Singh
    I have two excel files which has similar formatting and the data map each other from cell b15:h31. Row 15 is heading and so is the column B. I want to read file1 cell by cell and add that cell's content to the corresponding cell in File 2 i.e C16 in file 1 gets added to C16 in file 2, C17 in file 1 to C17 in file 2 and so on. The output goes in file 3 or anything. trying to implement through vba but of no success so far. Does anyone know how to go about it.

    Read the article

  • is rand() is perdicatable in C++

    - by singh
    Hi When i run below program i always get same values each time..Is rand is not a true random function. int main() { while(1) { getch(); cout<<rand()<<endl; } } In each run i am getting below values. 41 18467 6334 26500 19169 15724 ......

    Read the article

  • Is rand() predictable in C++

    - by singh
    When I run the below program I always get the same values each time. Is rand not a true random function? int main() { while(1) { getch(); cout<<rand()<<endl; } } In each run I am getting the below values. 41 18467 6334 26500 19169 15724 ......

    Read the article

  • To remove garbage characters from a string using regex...

    - by Harjit Singh
    Hi I want to remove characters from a string other then a-z, and A-Z. Created following function for the same and it works fine. public String stripGarbage(String s) { String good = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; String result = ""; for (int i = 0; i < s.length(); i++) { if (good.indexOf(s.charAt(i)) >= 0) { result += s.charAt(i); } } return result; } Can anyone tell me a better way to achieve the same. Probably regex may be better option. Regards Harry

    Read the article

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