Search Results

Search found 952 results on 39 pages for 'kundan kumar'.

Page 19/39 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • how to run/compile java code from JTextArea at Runtime? ----urgent!!! college project

    - by Lokesh Kumar
    I have a JInternalFrame painted with a BufferedImage and contained in the JDesktopPane of a JFrame.I also have a JTextArea where i want to write some java code (function) that takes the current JInternalFrame's painted BufferedImage as an input and after doing some manipulation on this input it returns another manipulated BufferedImage that paints the JInternalFrame with new manipulated Image again!!. Manipulation java code of JTextArea:- public BufferedImage customOperation(BufferedImage CurrentInputImg) { Color colOld; Color colNew; BufferedImage manipulated=new BufferedImage(CurrentInputImg.getWidth(),CurrentInputImg.getHeight(),BufferedImage.TYPE_INT_ARGB); //make all Red pixels of current image black for(int i=0;i< CurrentInputImg.getWidth();i++) { for(int j=0;j< CurrentInputImg.getHeight(),j++) { colOld=new Color(CurrentInputImg.getRGB(i,j)); colNew=new Color(0,colOld.getGreen(),colOld.getBlue(),colOld.getAlpha()); manipulated.setRGB(i,j,colNew.getRGB()); } } return manipulated; } so,how can i run/compile this JTextArea java code at runtime and get a new manipulated image for painting on JInternalFrame???????   Here is my Main class: (This class is not actual one but i have created it for u for basic interfacing containing JTextArea,JInternalFrame,Apply Button) import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.JInternalFrame; import javax.swing.JDesktopPane; import java.awt.image.*; import javax.imageio.*; import java.io.*; import java.io.File; import java.util.*; class MyCustomOperationSystem extends JFrame **{** public JInternalFrame ImageFrame; public BufferedImage CurrenFrameImage; public MyCustomOperationSystem() **{** setTitle("My Custom Image Operations"); setSize((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(),(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()); JDesktopPane desktop=new JDesktopPane(); desktop.setPreferredSize(new Dimension((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(),(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight())); try{ CurrenFrameImage=ImageIO.read(new File("c:/Lokesh.png")); }catch(Exception exp) { System.out.println("Error in Loading Image"); } ImageFrame=new JInternalFrame("Image Frame",true,true,false,true); ImageFrame.setMinimumSize(new Dimension(CurrenFrameImage.getWidth()+10,CurrenFrameImage.getHeight()+10)); ImageFrame.getContentPane().add(CreateImagePanel()); ImageFrame.setLayer(1); ImageFrame.setLocation(100,100); ImageFrame.setVisible(true); desktop.setOpaque(true); desktop.setBackground(Color.darkGray); desktop.add(ImageFrame); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add("Center",desktop); this.getContentPane().add("South",ControlPanel()); pack(); setVisible(true); **}** public JPanel CreateImagePanel(){ JPanel tempPanel=new JPanel(){ public void paintComponent(Graphics g) { g.drawImage(CurrenFrameImage,0,0,this); } }; tempPanel.setPreferredSize(new Dimension(CurrenFrameImage.getWidth(),CurrenFrameImage.getHeight())); return tempPanel; } public JPanel ControlPanel(){ JPanel controlPan=new JPanel(new FlowLayout(FlowLayout.LEFT)); JButton customOP=new JButton("Custom Operation"); customOP.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evnt){ JFrame CodeFrame=new JFrame("Write your Code Here"); JTextArea codeArea=new JTextArea("Your Java Code Here",100,70); JScrollPane codeScrollPan=new JScrollPane(codeArea,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); CodeFrame.add(codeScrollPan); CodeFrame.setVisible(true); } }); JButton Apply=new JButton("Apply Code"); Apply.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event){ // What should I do!!! Here!!!!!!!!!!!!!!! } }); controlPan.add(customOP); controlPan.add(Apply); return controlPan; } public static void main(String s[]) { new MyCustomOperationSystem(); } } Note: in above class JInternalFrame (ImageFrame) is not visible even i have declared it visible. so, ImageFrame is not visible while compiling and running above class. U have to identify this problem before running it.

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException

    - by Dheeraj kumar
    I have to read xls file in java.I used poi-3.6 to read xls file in Eclipse.But i m getting this ERROR"Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException at ReadExcel2.main(ReadExcel2.java:38)". I have added following jars 1)poi-3.6-20091214.jar 2)poi-contrib-3.6-20091214.jar 3)poi-examples-3.6-20091214.jar 4)poi-ooxml-3.6-20091214.jar 5)poi-ooxml-schemas-3.6-20091214.jar 6)poi-scratchpad-3.6-20091214.jar Below is the code which i m using: import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import java.io.FileInputStream; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.ArrayList; public class ReadExcel { public static void main(String[] args) throws Exception { // // An excel file name. You can create a file name with a full path // information. // String filename = "C:\\myExcel.xl"; // // Create an ArrayList to store the data read from excel sheet. // List sheetData = new ArrayList(); FileInputStream fis = null; try { // // Create a FileInputStream that will be use to read the excel file. // fis = new FileInputStream(filename); // // Create an excel workbook from the file system. // // HSSFWorkbook workbook = new HSSFWorkbook(fis); Workbook workbook = new XSSFWorkbook(fis); // // Get the first sheet on the workbook. // Sheet sheet = workbook.getSheetAt(0); // // When we have a sheet object in hand we can iterator on each // sheet's rows and on each row's cells. We store the data read // on an ArrayList so that we can printed the content of the excel // to the console. // Iterator rows = sheet.rowIterator(); while (rows.hasNext()) { Row row = (XSSFRow) rows.next(); Iterator cells = row.cellIterator(); List data = new ArrayList(); while (cells.hasNext()) { Cell cell = (XSSFCell) cells.next(); data.add(cell); } sheetData.add(data); } } catch (IOException e) { e.printStackTrace(); } finally { if (fis != null) { fis.close(); } } showExelData(sheetData); } private static void showExelData(List sheetData) { // // Iterates the data and print it out to the console. // for (int i = 0; i < sheetData.size(); i++) { List list = (List) sheetData.get(i); for (int j = 0; j < list.size(); j++) { Cell cell = (XSSFCell) list.get(j); System.out.print(cell.getRichStringCellValue().getString()); if (j < list.size() - 1) { System.out.print(", "); } } System.out.println(""); } } } Please help. thanks in anticipation, Regards, Dheeraj!

    Read the article

  • how to run XSL file using JavaScript / HTML file

    - by B. Kumar
    i want to run xsl file using javascript function. I wrote a javascrpt function which is working well with Firefox and Crom but it is not working on Internet Explorer function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(""); return xhttp.responseXML; } function displayResult() { xml=loadXMLDoc("NewXml.xml"); xsl=loadXMLDoc("NewFile.xsl"); // code for IE if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("example").appendChild(resultDocument); } } Please help my by modifying this code or by another code so that i can work with Internet Explorer. Thanks

    Read the article

  • unable to implement HTTP Tunneling correctly in order to enable Java rmi calls over internet(and und

    - by Lokesh Kumar
    in my previous question :-How to Setup RMI Server under(NAT/ISP) Now,i m able to start my RMI server by Installing apache Tomcat 6.0 server. i have also installed servlet programs into apache Tomcat server in order to enable HTTP tunneling. my servlet codes:- (1) [SimplifiedServletHandler.java][2] (2) [ServletForwardCommand.java][3] these servlets resides inside :- C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\examples\WEB-INF\classes\ one more thing that i hv added to my CalcultorClient.java program:- try { RMISocketFactory. setSocketFactory(new sun.rmi.transport.proxy .RMIHttpToCGISocketFactory( )); }catch (IOException ignored) { System.out.println("Error :- ignored.getMessage()"); } But,when i try to make client connect with server(under ISP/NAT) i get the following Exception :- RemoteException java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.io.IOException: HTTP request failed i don't know the correct reason behind this Exception.. but,i think that i haven't installed or invoke my servlet programs properly on server side. so,can anybody tell me the correct reason behind this error/Exception????? and if u think that it is servlet problem then tell me the correct procedure to run my serlvet program inside tomcat server.

    Read the article

  • Asp.net MVC appliction showing popup message after updating user

    - by kumar
    This is my Update Json method.. public JsonResult Update(StudentInfo e) { var cache = CacheFactory.GetCacheManager(); var Status= false; for (int i = 0; i <= cache.Count; i++) { var x = (StudentInfo )cache.GetData("a" + i); if (x != null) { Status= common.UpdateStudent(e.Student); } } return Json(Status); } this is my veiw.. <% using (Html.BeginForm("Update", "home", FormMethod.Post)) { %> <%= Html.ValidationSummary(true)%> my scripts.. <script type="text/javascript"> $(document).ready(function() { $('#btnSelectAll').click(function() { $('#btnSelect').click(function() { $('#input[type=checkbox]').attr('checked', 'checked'); }); function validate_excpt(formData, jqForm, options) { var form = jqForm[0]; return true; } // post-submit callback function showResponse(responseText, statusText, xhr, $form) { if (responseText[0].substring(0, 16) != "System.Exception") { $('#error-msg- span:last').html('<strong>Update successful.</strong>'); } else { $('#error-msg- span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48)); } $('#error-msg-').removeClass('hide'); $('#gui-stat-').html(responseText[1]); } // post-submit callback $('#exc-').ajaxForm({ target: '#error-msg-', beforeSubmit: validate_excpt, success: showResponse, dataType: 'json' }); $('.button').button(); }); $('.button').button(); $("input[id^='exc-flwup-']").datepicker({ duration: '', showTime: true, constrainInput: true, stepMinutes: 30, stepHours: 1, altTimeField: '', time24h: true, minDate: 0 }); $('#ui-timepicker-div').bgiframe(); }); </script> I am getting popupmessage when Jsonresult Update method has done..but I am seeing that user is updating perfectly.. popup window saying something like you have choosed to open if I open that I am getting string as True in the file.. is that above code I am doing something wrong?

    Read the article

  • How to design a RESTful collection resource?

    - by Suresh Kumar
    I am trying to design a "collection of items" resource. I need to support the following operations: Create the collection Remove the collection Add a single item to the collection Add multiple items to the collection Remove a single item from the collection Remove multiple items from the collection This is as far as I have gone: Create collection: ==> POST /service Host: www.myserver.com Content-Type: application/xml <collection name="items"> <item href="item1"/> <item href="item2"/> <item href="item3"/> </collection> <== 201 Created Location: http://myserver.com/service/items Content-Type: application/xml ... Remove collection: ==> DELETE /service/items <== 200 OK Removing a single item from the collection: ==> DELETE /service/items/item1 <== 200 OK However, I am finding supporting the other operations a bit tricky i.e. what methods can I use to: Add single or multiple items to the collection. (PUT doesn't seem to be right here as per HTTP 1.1 RFC Remove multiple items from the collection in one transaction. (DELETE doesn't seem to right here either)

    Read the article

  • Changing CSS Rules using JavaScript or jQuery

    - by Praveen Kumar
    Initial Research I am aware of using .css() to get and set the CSS rules of a particular element. I have seen a website with this CSS: body, table td, select { font-family: Arial Unicode MS, Arial, sans-serif; font-size: small; } I never liked Arial Unicode as a font. Well, that was my personal feel. So, I would use Chrome's Style Inspector to edit the Arial Unicode MS to Segoe UI or something which I like. Is there anyway, other than using the following to achieve the same? Case I $("body, table td, select").css("font-family", "Segoe UI"); Recursive, performance intensive. Doesn't work when things are loaded on the fly. Case II $('<style>body, table td, select {font-famnily: "Segoe UI";}</style>') .appendTo("head"); Any other better method than this? Creates a lot of <style> tags!

    Read the article

  • make desktop sms application using windows mobile 6.1

    - by Amit Kumar Jha
    hey all, I have to make a SMS sending application in .NET which uses a connected CDMA based Windows mobile 6.1 device to send sms. The problem is I have never worked on smartphone app development so don't have any idea about how should i go about it. Couldn't find anything useful on SO or elsewhere, so please guide me in the right direction. Thanks in advance to all those who reply. P.S.:I posted a similar question regarding blackberry here

    Read the article

  • what is pagecache page

    - by kumar
    /* * Each physical page in the system has a struct page associated with * it to keep track of whatever it is we are using the page for at the * moment. Note that we have no way to track which tasks are using * a page, though if it is a pagecache page, rmap structures can tell us * who is mapping it. */ include/linux/mm_types.h Here Please lemme know what is "pagecache page" means? Thanks!

    Read the article

  • reference other projects in visual studio for win32 projects

    - by Vineel Kumar Reddy
    Hi All I am working with win32 API and my language of choice is pure C and no C++. Assume I have a project A that is present in Solution S in visual studio I want to add another project B(which has some common utility functions) in to S Now I want to reference Project B in Project A... So that I can use those utility functions from Project B source code level. I dont want it be used against dll of Project B assume project B contains some math related functions and i want to call the functions from Project A or project B contains come data structures and i want to make use of them in Project A How to achieve this.... thanks in advance

    Read the article

  • View hide problem

    - by Ajeet Kumar Yadav
    Hello, I am using a Xib (tab bar controller with navigation bar). when i use navigation bar in app delegate then Xib slides little bit bellow.Actually i want a navigation bar on enter page so it is compulsory to define navigation bar in app delegate. Please help me how i solve this problem.

    Read the article

  • Read Response.write in another Page

    - by Sri Kumar
    Hello All, I have a page www.senderdomain.com/sender.aspx, from which i need to write a string to another page in other domain www.receiverdomain.com/receiver.aspx In sender.aspx i have written Response.Write("Hello"); Response.Redirect(Request.UrlReferrer.ToString()); It gets redirected to respective receiver.aspx page, but I am not sure how to get the text "Hello" in receiver.aspx page. Can any pl help on this?

    Read the article

  • Mysql Server Optimization

    - by Ish Kumar
    Hi Geeks, We are having serious MySQL(InnoDB) performance issues at a moment when we do: (10-20) insertions on TABLE1 (10-20) updates on TABLE2 Note: Both above operations happens within fraction of a second. And this occurs every few (10-15) minutes. And all online users (approx 400-600) doing read operation on join of TABLE1 & TABLE2 every 1 second. Here is our mysql configuration info: http://docs.google.com/View?id=dfrswh7c_117fmgcmb44 Issues: Lot queries wait and expire later (saw it from phpmyadmin / processes). My poor MySQL server crashes sometimes Questions Q1: Any suggestions to optimize at MySQL level? Q2: I thinking to use persistent connections at application level, is it right? Info Added Later: Database Engine: InnoDB TABLE1 : 400,000 rows (inserting 8,000 daily) & TABLE2: 8,000 rows 1 second query: SELECT b.id, b.user_id, b.description, b.debit, b.created, b.price, u.username, u.email, u.mobile FROM TABLE1 b, TABLE2 u WHERE b.credit = 0 AND b.user_id = u.id AND b.auction_id = "12345" ORDER BY b.id DESC LIMIT 10; // there are few more but they are not so critical. Indexing is good, we are using them wisely. In above query all id's are indexed And TABLE1 has frequent insertions and TABLE2 has frequent updates.

    Read the article

  • Producer Consumer Issue with Core Data

    - by Mugunth Kumar
    I've a Core Data application. In the producer thread, I pull data from a web service and store it in my object and call save. My consumer object is a table view controller that displays the same. However, the app crashes and I get NSFetchedResultsController Error: expected to find object (entity: FeedEntry; id: 0xf46f40 ; data: ) in section (null) for deletion on the console. When I debug it, everything works fine. So I understood that it's like a race issue. How is these kind of problem solved? What's the best way to design a producer-consumer app with core-data?

    Read the article

  • Expand and Collapse on buttong click

    - by kumar
    Please this is not a duplicate thread do consider this one..thanks.. function loadAllAccounts() { $('#Grid tr[role="row"] td a').each(function(row) { if ($('#CGrid tr[role="row"] td.hasClass(sgcollapsed) a')) { $(this).click(); } else if ($('#Grid tr[role="row"] td.hasClass(sgexpanded) a')) { return false; } }); } First time the grid is loading with all the user data..at very firsst row each use can exapdn the grid to see subgird using + sign,, when use clicks + sign I am expanding the row to show subgrid, above code is working at very frist time when I click expand button its expanding all the rows and collpase its colaapsing allt he rows perfectly, but user open any row to see subgrid,, after clicking the expand button opened row will closing and closing rows will be opening.. exactly its doing opposite? can anyone sujjest me what is this cause in the code? thanks

    Read the article

  • How to expand and collapse all accoutns using Jquery..

    - by kumar
    Here is my code to expand and collapse all the users on the grid.. But problem is without clicking expand buttong if I open any user..its opening fyn,, but if I click again on the expand button happening the opened subgrid is closing and closing one is opening... here is my code can anybody tell me what's the wrong with this. <script type="text/javascript"> $(document).ready(function() { $('#tmpOpen').click(function() { var value = document.getElementById("tmpOpen").value; if (value == "Expand All Accounts") { document.getElementById("tmpOpen").value = "Collapse"; loadAll(); } else { document.getElementById("tmpOpen").value = "Expand"; loadAll(); } }); function loadAll() { var o = true; $('#Grid1 tr[role="row"] td a').each(function(row) { if (o) { $(this).trigger('click'); } }); } }); </script>

    Read the article

  • How to find all the file handles by a process programmatically?

    - by kumar
    I have a process "x" which uses "system" C function to start ntpd daemon. I observed that ntpd are passed the open file descriptors of "x". ntpd holds on to the file descriptors even after original file is deleted. for ex: Some log files used by "x" are rotated out after sometime, but "ntpd" has file handle opened for these deleted files. Will it cause any problem? Alternatively I thought of setting "FD_CLOEXEC" flag for all the file descriptors before calling "system" function. But as we are running as an extension library to third process "x"( "x" loads our library based on some condition), there is no easy way to know about all the file descriptors process has opened. One way is to read /proc//fd and set "FD_CLOEXEC" for each file handle and reset it back after "system" function returns. I'm using Linux 2.16. Is there any other easy way to find all the file handlers? Thanks,

    Read the article

  • Convert mediawiki to LaTeX syntax

    - by Amit Kumar
    I need to convert mediawiki into LaTeX syntax. The formulas should stay the same, but I need to transform, for example = something = into \chapter{something}. Although this can be obtained with a bit of sed, things get a little dirty with the itemize environment, so I was wondering if a better solution can be produced. Anything that can be useful for this task ? This is the reverse of this question (graciously copied). Pandoc was the answer to that question, but probably not yet for this.

    Read the article

  • make desktop sms application using blackberry

    - by Amit Kumar Jha
    hey all, I have to make a SMS sending application in .NET, which uses the attached Blackberry handset(blackberry tour 9630 to be precise) to send SMS. I have never worked on smartphone application development, so want help in doing this. I searched SO for an answer and found one question, but its in java and i think that code would run on blackberry itself and not on desktop, correct me if i am wrong. So if someone could point me in the right direction I would be very grateful. Thanks in advance to all those who reply.

    Read the article

  • Where i am doing wrong in this?

    - by kumar
    <script type="text/javascript"> $(document).ready(function() { $('#PbtnSubmit').attr('disabled', 'disabled'); $('#PbtnCancel').attr('disabled', 'disabled'); $('#PbtnSelectAll').click(function() { $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked'); $('#PbtnSubmit').removeAttr('disabled'); $('#PbtnCancel').removeAttr('disabled'); $('fieldset').find("input,select,textarea").removeAttr('disabled'); }); $('#PbtnCancel').click(function() { $('#PricingEditExceptions input[name=PMchk]').attr('checked', false); $('#PbtnSubmit').attr('disabled', 'disabled'); $('#PbtnCancel').attr('disabled', 'disabled'); $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled', 'disabled'); $('#genericfieldset').find("input,select,textarea").removeAttr('disabled'); }); $('#PbtnSubmit').click(function() { $('#PricingEditExceptions input[name=PMchk]').each(function() { if ($("#PricingEditExceptions input:checkbox:checked").length > 0) { var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); var PMstrIDs = checked.map(function() { return $(this).val(); }).get().join(','); $('#1_exceptiontypes').attr('value', exceptiontypes) $('#1_PMstrIDs').attr('value', PMstrIDs); } else { alert("Please select atleast one exception"); return false; } }); }); function validate_excpt(formData, jqForm, options) { var form = jqForm[0]; } // post-submit callback function showResponse(responseText, statusText, xhr, $form) { if (responseText[0].substring(0, 16) != "System.Exception") { $('#error-msg-ID span:last').html('<strong>Update successful.</strong>'); } else { $('#error-msg-ID span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48)); } $('#error-msg-ID').removeClass('hide'); } $('#exc-').ajaxForm({ target: '#error-msg-ID', beforeSubmit: validate_excpt, success: showResponse, dataType: 'json' }); $('.button').button(); }); </script> This is my button.. at very first when page load I am trying Make Disabled PbtnSubmit and PbtnCancel and when we click PbtnSelectAll I am enabling back again.. but its not doing with this code. is that something I am doing worng in this? thanks

    Read the article

  • Jquery checkbox issue with IE6

    - by kumar
    this code works fine in Firefox but not in IE6.. i made changes using boolean true, false but still.. $('#PbtnSelectAll').click(function() { $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked'); $('#PbtnSubmit').show(); $('#PbtnCancel').show(); $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled',true); $('#genericfieldset').find("input,select,textarea").removeAttr('disabled'); }); the problem is i am having the view with Fieldsets.. each fieldset having the checkbox when i click onselect all buton its should select all the fieldset checkboxes..but its not doing its allwasy doing for first fieldset which is closest....other things are igonring but its working in firefox.. thanks

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >