Search Results

Search found 1411 results on 57 pages for 'openoffice writer'.

Page 36/57 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • How to get an X11 Window from a Process ID ?

    - by Adam Pierce
    Under Linux, my C++ application is using fork() and execv() to launch multiple instances of OpenOffice so as to view some powerpoint slide shows. This part works. Next I want to be able to move the OpenOffice windows to specific locations on the display. I can do that with the XMoveResizeWindow() function but I need to find the Window for each instance. I have the process ID of each instance, how can I find the X11 Window from that ? UPDATE - Thanks to Andy's suggestion, I have pulled this off. I'm posting the code here to share it with the Stack Overflow community. Unfortunately Open Office does not seem to set the _NET_WM_PID property so this doesn't ultimately solve my problem but it does answer the question. // Attempt to identify a window by name or attribute. // by Adam Pierce <[email protected]> #include <X11/Xlib.h> #include <X11/Xatom.h> #include <iostream> #include <list> using namespace std; class WindowsMatchingPid { public: WindowsMatchingPid(Display *display, Window wRoot, unsigned long pid) : _display(display) , _pid(pid) { // Get the PID property atom. _atomPID = XInternAtom(display, "_NET_WM_PID", True); if(_atomPID == None) { cout << "No such atom" << endl; return; } search(wRoot); } const list<Window> &result() const { return _result; } private: unsigned long _pid; Atom _atomPID; Display *_display; list<Window> _result; void search(Window w) { // Get the PID for the current Window. Atom type; int format; unsigned long nItems; unsigned long bytesAfter; unsigned char *propPID = 0; if(Success == XGetWindowProperty(_display, w, _atomPID, 0, 1, False, XA_CARDINAL, &type, &format, &nItems, &bytesAfter, &propPID)) { if(propPID != 0) { // If the PID matches, add this window to the result set. if(_pid == *((unsigned long *)propPID)) _result.push_back(w); XFree(propPID); } } // Recurse into child windows. Window wRoot; Window wParent; Window *wChild; unsigned nChildren; if(0 != XQueryTree(_display, w, &wRoot, &wParent, &wChild, &nChildren)) { for(unsigned i = 0; i < nChildren; i++) search(wChild[i]); } } }; int main(int argc, char **argv) { if(argc < 2) return 1; int pid = atoi(argv[1]); cout << "Searching for windows associated with PID " << pid << endl; // Start with the root window. Display *display = XOpenDisplay(0); WindowsMatchingPid match(display, XDefaultRootWindow(display), pid); // Print the result. const list<Window> &result = match.result(); for(list<Window>::const_iterator it = result.begin(); it != result.end(); it++) cout << "Window #" << (unsigned long)(*it) << endl; return 0; }

    Read the article

  • crunchbang: it takes up *how* much memory?!?!

    - by Theo Moore
    I've been trying many distros of Linux lately, trying to find something I like for my netbook. I started out with Ubuntu, and I can tell you I am a big fan. Ubuntu is now fast to install, much simpler to administer, and pretty light resource-wise. My original install was the standard 32 bit version of 9.04. I tried the netbook remix version of this release, but it was very, very slow. Even the full-blown version used only about 200mb. Much better than the almost 800 that the recommended Windows y version took. Once the newest release of Ubuntu was released, I decided to try the netbook remx of 10.04. It used even less RAM; only about 150mb. I thought I'd found my OS. I certainly settled in and prepared to use it forever. Then, someone I know suggested I try cunchbang. It is the most minimalistic UI I've ever seen, using Openbox rather than Gnome or KDE. Very slick, simple and clean. Since I am using the alpha of the most recent version (using Debian Squeeze), the apps provided for you are few...although more will be provided soon. You do have a word processor, etc., although not the OpenOffice you would normally get in Ubuntu. But the best part? 48MB. That's it. 48mb fully loaded, supporting what I can "hotel services". It's fast, boots quick, and believe it or not, I can even do Java-based development....on my netbook! Pretty slick.   More on it as I use it.

    Read the article

  • Essbase Excel Add in - S.o.D.

    - by THE
    #cross { font-size: 72pt; } sadly another long lasting friend is about to be buried in the wet, cold data void that holds past programs (... and AOL CDs). The Essbase Excel Add In is about to be de-continued (see  Doc ID 1466700.1) in January '13. The (already out) version 11.1.2.2.x of the Excel Add In must be considered the last release of this particular program (Unless the guys from Applied OLAP bring out their own version next to the openOffice Add In that they already sport). As expected, SmartView achieved parity in functionality with Release 11.1.2.1.102 and ever since then it was just a question of time when our old buddy would get the shoe. For all users out there like me that have known and worked with the Excel Add In for the last decade(s) this is a loss. SmartView may have functionality parity, and may altogether be the stronger, open technology - capable of Planning forms, connection to HFM etc. .But (from my personal point of view) it will not give the end user the same direct access to his databases, with nothing between him and his Essbase Server. Of course it was to be expected that only one of the two could survive and it was obvious that this would be SmartView, so this does not come as a surprise. Still.A minute for an old friend . . . . . . Thank you, and let us look forward! Unless you had other plans for the upcoming season, why not spend it investigating SmartView for your Essbase interaction needs. We hear that the days between Christmas and new year hold unlimited potential to test out new things. Or take it as a new year resolution: "I will switch to SmartView at the earliest possible moment".

    Read the article

  • How do you make slides for programming talks?

    - by Yuvi Masory
    I've given a few talks recently and I have not found a good way to make slides. Here are a few desirable characteristics for programming slides: They're slides. A standard emacs buffer won't do it. They have syntax highlighting for code. They support basic formatting, like font size and color and bullets. No fancy animations needed. The only animation I desire is one-by-one appearance of bullets. So far I have considered: Microsoft Office - out of the question for Linux users. OpenOffice.org - too much for my needs, code formatting/highlighting needs to be done externally and pasted in. On the plus side supports bullets, bullet-by-bullet animation, and font formatting. Emacs - Supports all the code formatting but I haven't found a slides mode that lets me transition from one chunk to another. HTML5 - I once made slides using html5rocks as a template. It supports everything, but is too hard and time-consuming the "throw together" a few slides before a minor talk. Also the html5-only features may not work on the podium computer's installed browser. Any suggestions for programs/techniques for making code-centric presentations?

    Read the article

  • Dual Booting Windows 7 and Ubuntu 12.04. Partition Sizes?

    - by John F.
    I'm about to reinstall Windows, so I thought that I'd try Ubuntu out on a partition just for fun. My question is, how large should my partitions be for each of them? I know this various depending on what you use, so i'll give you a general idea of what I have, and what I have in mind. I'm currently running: Windows 7 Professional (64bit) RAM: 4GB CPU: 2.5Ghz Quad Core processor HDD: 500GB GPU: 1GB Nvidia GeForce I have around 130GB in Steam games, and some heavier applications like Photoshop CS6, Sony Vegas Pro 11. But other Applications I use are: Chrome Skype Dxtory Fraps OpenOffice BitTorrent and other assorted smaller programs. So, I was thinking that I would give my Windows partition about 150-200GB, my Ubuntu Partition around 20GB, and the rest to shared storage. I'm not really sure if I'd need more or less on Ubuntu, because I've never used it and I'm not really sure what kind of apps i'd be using over there. This would also be a clean install, so I'd be wiping my HDD, creating the Partitions in GParted, then installing Windows with Ubuntu following that. Any critique you could give me? Maybe explanations to what the /root, /boot and /home partitions I hear are about? Thanks in advanced if you actually read this lengthy thing! Any help is appreciated. (x

    Read the article

  • Where did I write that code ?

    - by Tarun Arora
    Every been in that situation when you desperately need to find that code you checked into TFS a few days back but just can’t remember what team project, what branch, what solution or what file you checked it into. Well you are not alone… Only if there was a way to efficiently search for files and text with in TFS. It is possible… You need to get your hands on Agent Ransack… This is a stand a lone tool that does not integrate with TFS but gives you the capability to search through text files effortlessly. Agent Ransack searches through files, text or otherwise, fast and efficiently. When searching the contents of files for code, or other text, Agent Ransack displays the text found so you can quickly browse the results without having to separately open each file! Agent Ransack is free for both Personal and Commercial use and can be Download from here.   Set the Look In directory of the Ransack search tool to your TFS Workspace and type the text you would like to scan for, you can limit the search by narrowing down the filter path or the name of the file. Found text is shown with highlighted keywords so you don't need to waste time opening each file looking for the right information.         The regular expression wizard helps you build regular expressions for complex pattern matching searches         You even have the option of searching by modified, created or last accessed date          Export your results to a file for importing into other apps or for sharing with others          Agent Ransack also provides search support for popular Office formats including Office 2007 and OpenOffice Next time you are looking for that illusive line of code whether it is a method declaration, function call, or algorithm that you checked into TFS, use Agent Ransack for a quick search.

    Read the article

  • What is a good Foxit reader equivalent (or other PDF editor)?

    - by Yanick Rochon
    On Windows, I have found Foxit Reader to be quite handy when I need to highlight texts in PDF document, make annotations, etc. etc. Unfortunately, I have not yet found product as user friendly (which also does not corrupt PDF files...) and full-featured as Foxit software... Any recommendations? ** UPDATE ** I just tried the Open Office PDF import extension. It seems to work ok... If anyone used it for a while, I'd appreciate your feedback on that one. Thanks! ** UPDATE ** You can't highlight text with OpenOffice's PDF extension. Doesn't matter, I was reading this thread and found out about Xournal . As it turns out, it's in the repository. It does not natively save in PDF, but once all edits are done, the document can be exported to PDF (and overwrite the old one, just like Gimp with the native .XCE format and original PNG file, for example) I realize that this question is no longer a question in itself, but could be migrated to community wiki. However, feedbacks are still welcome! ** EDIT ** So... to close up this question, I have to say that I adopted Xournal . It is light and works pretty well, even on multi-page PDF documents. Thank you all for your answers!

    Read the article

  • iTextSharp: How to position and wrap long text?

    - by aximili
    The PDF I can produce at the moment: I want the text to fill up the space in the lower left. How can I do that? Thanks! This is my code: private static void CreatePdf4(string pdfFilename, string heading, string text, string[] photos, string emoticon) { Document document = new Document(PageSize.A4.Rotate(), 26, 36, 0, 0); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(pdfFilename, FileMode.Create)); document.Open(); // Heading Paragraph pHeading = new Paragraph(new Chunk(heading, FontFactory.GetFont(FontFactory.HELVETICA, 54, Font.NORMAL))); document.Add(pHeading); // Photo 1 Image img1 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[0])); img1.ScaleAbsolute(350, 261); img1.SetAbsolutePosition(46, 220); img1.Alignment = Image.TEXTWRAP; document.Add(img1); // Photo 2 Image img2 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[1])); img2.ScaleAbsolute(350, 261); img2.SetAbsolutePosition(438, 220); img2.Alignment = Image.TEXTWRAP; document.Add(img2); // Text //Paragraph pText = new Paragraph(new Chunk(text, FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.NORMAL))); //pText.SpacingBefore = 30; //pText.IndentationLeft = 20; //pText.IndentationRight = 366; //document.Add(pText); PdfContentByte cb = writer.DirectContent; cb.BeginText(); cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, false), 18); cb.SetTextMatrix(46, 175); cb.ShowText(text); cb.EndText(); // Photo 3 Image img3 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[2])); img3.ScaleAbsolute(113, 153); img3.SetAbsolutePosition(556, 38); document.Add(img3); // Emoticon Image imgEmo = Image.GetInstance(HttpContext.Current.Server.MapPath("/Content/images/" + emoticon)); imgEmo.ScaleToFit(80, 80); imgEmo.SetAbsolutePosition(692, 70); document.Add(imgEmo); document.Close(); }

    Read the article

  • Can I force JAXB not to convert " into &quot;, for example, when marshalling to XML?

    - by Elliot
    I have an Object that is being marshalled to XML using JAXB. One element contains a String that includes quotes ("). The resulting XML has &quot; where the " existed. Even though this is normally preferred, I need my output to match a legacy system. How do I force JAXB to NOT convert the HTML entities? -- Thank you for the replies. However, I never see the handler escape() called. Can you take a look and see what I'm doing wrong? Thanks! package org.dc.model; import java.io.IOException; import java.io.Writer; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.dc.generated.Shiporder; import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; public class PleaseWork { public void prettyPlease() throws JAXBException { Shiporder shipOrder = new Shiporder(); shipOrder.setOrderid("Order's ID"); shipOrder.setOrderperson("The woman said, \"How ya doin & stuff?\""); JAXBContext context = JAXBContext.newInstance("org.dc.generated"); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.setProperty(CharacterEscapeHandler.class.getName(), new CharacterEscapeHandler() { @Override public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { out.write("Called escape for characters = " + ch.toString()); } }); marshaller.marshal(shipOrder, System.out); } public static void main(String[] args) throws Exception { new PleaseWork().prettyPlease(); } } -- The output is this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <shiporder orderid="Order's ID"> <orderperson>The woman said, &quot;How ya doin &amp; stuff?&quot;</orderperson> </shiporder> and as you can see, the callback is never displayed. (Once I get the callback being called, I'll worry about having it actually do what I want.) --

    Read the article

  • Xuggle codec identification fail

    - by Thiago
    Hi there, I'm trying to run the following Xuggle code: public static boolean convert(String stream) throws IOException, InterruptedException { IMediaReader reader = ToolFactory.makeReader(stream + ".flv"); IMediaWriter writer = ToolFactory.makeWriter(stream + ".mp3", reader); reader.addListener(writer); while (reader.readPacket() != null) ; return true; } Where stream is the file path. But I'm getting the following exception: java.lang.IllegalArgumentException: could not find input codec id at com.xuggle.xuggler.IContainerFormat.establishOutputCodecId(IContainerFormat.java:393) at com.xuggle.xuggler.IContainerFormat.establishOutputCodecId(IContainerFormat.java:327) at com.xuggle.xuggler.IContainerFormat.establishOutputCodecId(IContainerFormat.java:300) at com.xuggle.mediatool.MediaWriter.addStreamFromContainer(MediaWriter.java:1141) at com.xuggle.mediatool.MediaWriter.getStream(MediaWriter.java:1046) at com.xuggle.mediatool.MediaWriter.encodeAudio(MediaWriter.java:837) at com.xuggle.mediatool.MediaWriter.onAudioSamples(MediaWriter.java:1448) at com.xuggle.mediatool.AMediaToolMixin.onAudioSamples(AMediaToolMixin.java:89) at com.xuggle.mediatool.MediaReader.dispatchAudioSamples(MediaReader.java:628) at com.xuggle.mediatool.MediaReader.decodeAudio(MediaReader.java:555) at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:469) at <package_name>MediaFile.convert(MediaFile.java:66) at <package_name>.MediaFileTest.shouldConvertExistingFLV(MediaFileTest.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) The unit test is the following: @Test public void shouldConvertExistingFLV() throws IOException, InterruptedException { String str = "C:\Program Files\Wowza Media Systems\Wowza Media Server 2\content\Extremists"; //"c:/temp/corneta.flv" boolean result = MediaFile.convert(str); assertTrue(result); } So, why can't he find the codec, since I'm testing for a simple flv to mp3 conversion?

    Read the article

  • WCF: WSDL-first approach: Problems with generating fault types

    - by Juri
    Hi, I'm currently in the process of creating a WCF webservice which should be compatible with WS-I Basic Profile 1.1. I'm using a wsdl-first approach (actually for the first time), defining first the xsd for the complex types, the WSDL and then using svcutil.exe for generating the according server as well as client-side interfaces/proxies. So far everything works fine. Then I decided to add a fault to my WSDL. Regenerating with svcutil succeeded, but then I noticed that my generated fault doesn't have the properties I defined in my xsd file (which is imported by my WSDL). Fault XSD definition <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://product.mycompany.com/groupsfault_v1.xsd" xmlns:tns="http://product.mycompany.com/groupsfault_v1.xsd"> <complexType name="groupsFault"> <sequence> <element name="code" type="int"/> <element name="message" type="string"/> </sequence> </complexType> </schema> Generated .Net fault object [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Xml.Serialization.XmlSchemaProviderAttribute("ExportSchema")] [System.Xml.Serialization.XmlRootAttribute(IsNullable=false)] public partial class groupFault : object, System.Xml.Serialization.IXmlSerializable { private System.Xml.XmlNode[] nodesField; private static System.Xml.XmlQualifiedName typeName = new System.Xml.XmlQualifiedName("groupFault", "http://sicp.services.siag.it/groups_v1.wsdl"); public System.Xml.XmlNode[] Nodes { get { return this.nodesField; } set { this.nodesField = value; } } public void ReadXml(System.Xml.XmlReader reader) { this.nodesField = System.Runtime.Serialization.XmlSerializableServices.ReadNodes(reader); } public void WriteXml(System.Xml.XmlWriter writer) { System.Runtime.Serialization.XmlSerializableServices.WriteNodes(writer, this.Nodes); } public System.Xml.Schema.XmlSchema GetSchema() { return null; } public static System.Xml.XmlQualifiedName ExportSchema(System.Xml.Schema.XmlSchemaSet schemas) { System.Runtime.Serialization.XmlSerializableServices.AddDefaultSchema(schemas, typeName); return typeName; } } Is this ok?? I'd expect to have an object created that contains properties for "code" and "message" s.t. you can then throw it by using something like ... throw new FaultException<groupFault>(new groupFault { code=100, message="error" }); ... (sorry for the lower-case type definitions, but this is generated code from the WSDL) Why doesn't the svcutil.exe generate those properties?? Some sources on the web suggested to add the /useSerializerForFaults option. I tried it, it doesn't work giving me an exception that the fault type is missing on the wsdl:portType declaration. Validation with several other tools succeeded however. Any help is VERY appreciated :) thx

    Read the article

  • Password protected PDF using C#

    - by balaweblog
    I am creating a pdf document using C# code in my process. I need to protect the docuemnt with some standard password like "123456" or some account number. I need to do this without any reference dlls like pdf writer. I am generating the PDF file using SQL Reporting services reports. Is there are easiest way.

    Read the article

  • Blogs / books with advise, tips and information from developers

    - by Wizzard
    Good Morning. I've been reading Joel Spolsky's (joelonsoftware) articles and they are full of good information and tips. He's a good writer and well worth reading. I am wondering what other good blogs/articles/books are out there written by similar people - really after leaders/managers/biz owners who are/were developers. Hope that makes a bit of sense ;-)

    Read the article

  • Zend Framework -> Zend_Log via application.ini => insert() on a non-object error

    - by TaMeR
    I am trying to get logging via the application.ini file going and I am getting stuck with an error. resources.log.db.writerName = "Db" resources.log.db.writerParams.db.adapter = "PDO_SQLITE" resources.log.db.writerParams.db.dbname = ROOT "/data/tmp.db3" resources.log.db.writerParams.db.table = "logs" resources.log.db.writerParams.db.columnMap.priority = "priority" resources.log.db.writerParams.db.columnMap.message = "message" Fatal error: Call to a member function insert() on a non-object in /var/www/libs/zend/library/Zend/Log/Writer/Db.php on line 137

    Read the article

  • writing a data to App_Data

    - by Alexander
    I want to write an .xml file using the following code into the App_Data/posts, why is it causing an error: Stream writer = new FileStream("..'\'App_Data'\'posts'\'" + new Guid(post_ID.ToString()).ToString() + ".xml", FileMode.Create);

    Read the article

  • List to CSV in Python

    - by Steve
    Hi, I am creating a CSV from a list of values. CSV File gets created but the csv is formed as a single column. Actually it should be multiple rows with multiple columns, instead it forms as a multiple rows with a single column. I am using the following code from random import choice import csv fileObject = csv.writer(open('Insurance.csv','w'),dialect='excel',delimiter=' ') for i in range(0,175): current_list = list(choice(master_list)) fileObject.writerows(current_list) current_list = [] Thanks

    Read the article

  • ASP.NET MVC, How to get the page content before render

    - by user361993
    In ASP.NET MVC, how to get the page content before render, we know in Web form app, we can override the method protected override void Render(HtmlTextWriter writer) to get the page content before render. but in MVC there are no event concept, so how we can get the page content. the purpose for that is to emphasize(wrap <strong> tag) the keywords before the page rendered. I'd appreciate for any advice. Thank you.

    Read the article

  • Array help Index out of range exeption was unhandled

    - by Michael Quiles
    I am trying to populate combo boxes from a text file using comma as a delimiter everything was working fine, but now when I debug I get the "Index out of range exeption was unhandled" warning. I guess I need a fresh pair of eyes to see where I went wrong, I commented on the line that gets the error //Fname = fields[1]; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Printing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace Sullivan_Payroll { public partial class xEmpForm : Form { bool complete = false; public xEmpForm() { InitializeComponent(); } private void xEmpForm_Resize(object sender, EventArgs e) { this.xCenterPanel.Left = Convert.ToInt16((this.Width - this.xCenterPanel.Width) / 2); this.xCenterPanel.Top = Convert.ToInt16((this.Height - this.xCenterPanel.Height) / 2); Refresh(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { //Exits the application this.Close(); } private void xEmpForm_FormClosing(object sender, FormClosingEventArgs e) //use this on xtrip calculator { DialogResult Response; if (complete == true) { Application.Exit(); } else { Response = MessageBox.Show("Are you sure you want to Exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (Response == DialogResult.No) { complete = false; e.Cancel = true; } else { complete = true; Application.Exit(); } } } private void xEmpForm_Load(object sender, EventArgs e) { //file sources string fileDept = "source\\Department.txt"; string fileSex = "source\\Sex.txt"; string fileStatus = "source\\Status.txt"; if (File.Exists(fileDept)) { using (System.IO.StreamReader sr = System.IO.File.OpenText(fileDept)) { string dept = ""; while ((dept = sr.ReadLine()) != null) { this.xDeptComboBox.Items.Add(dept); } } } else { MessageBox.Show("The Department file can not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (File.Exists(fileSex)) { using (System.IO.StreamReader sr = System.IO.File.OpenText(fileSex)) { string sex = ""; while ((sex = sr.ReadLine()) != null) { this.xSexComboBox.Items.Add(sex); } } } else { MessageBox.Show("The Sex file can not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (File.Exists(fileStatus)) { using (System.IO.StreamReader sr = System.IO.File.OpenText(fileStatus)) { string status = ""; while ((status = sr.ReadLine()) != null) { this.xStatusComboBox.Items.Add(status); } } } else { MessageBox.Show("The Status file can not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void xFileSaveMenuItem_Click(object sender, EventArgs e) { { const string fileNew = "source\\New Staff.txt"; string recordIn; FileStream outFile = new FileStream(fileNew, FileMode.Create, FileAccess.Write); StreamWriter writer = new StreamWriter(outFile); for (int count = 0; count <= this.xEmployeeListBox.Items.Count - 1; count++) { this.xEmployeeListBox.SelectedIndex = count; recordIn = this.xEmployeeListBox.SelectedItem.ToString(); writer.WriteLine(recordIn); } writer.Close(); outFile.Close(); this.xDeptComboBox.SelectedIndex = -1; this.xStatusComboBox.SelectedIndex = -1; this.xSexComboBox.SelectedIndex = -1; MessageBox.Show("your file is saved"); } } private void xViewFacultyMenuItem_Click(object sender, EventArgs e) { const string fileStaff = "source\\Staff.txt"; const char DELIM = ','; string Lname, Fname, Depart, Stat, Sex, Salary, cDept, cStat, cSex; double Gtotal; string recordIn; string[] fields; cDept = this.xDeptComboBox.SelectedItem.ToString(); cStat = this.xStatusComboBox.SelectedItem.ToString(); cSex = this.xSexComboBox.SelectedItem.ToString(); FileStream inFile = new FileStream(fileStaff, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(inFile); recordIn = reader.ReadLine(); while (recordIn != null) { fields = recordIn.Split(DELIM); Lname = fields[0]; Fname = fields[1]; // this is where the error appears Depart = fields[2]; Stat = fields[3]; Sex = fields[4]; Salary = fields[5]; Fname = fields[1].TrimStart(null); Depart = fields[2].TrimStart(null); Stat = fields[3].TrimStart(null); Sex = fields[4].TrimStart(null); Salary = fields[5].TrimStart(null); Gtotal = double.Parse(Salary); if (Depart == cDept && cStat == Stat && cSex == Sex) { this.xEmployeeListBox.Items.Add(recordIn); } recordIn = reader.ReadLine(); } reader.Close(); inFile.Close(); if (this.xEmployeeListBox.Items.Count >= 1) { this.xFileSaveMenuItem.Enabled = true; this.xFilePrintMenuItem.Enabled = true; this.xEditClearMenuItem.Enabled = true; } else { this.xFileSaveMenuItem.Enabled = false; this.xFilePrintMenuItem.Enabled = false; this.xEditClearMenuItem.Enabled = false; MessageBox.Show("Records not found"); } } private void xEditClearMenuItem_Click(object sender, EventArgs e) { this.xEmployeeListBox.Items.Clear(); this.xDeptComboBox.SelectedIndex = -1; this.xStatusComboBox.SelectedIndex = -1; this.xSexComboBox.SelectedIndex = -1; this.xFileSaveMenuItem.Enabled = false; this.xFilePrintMenuItem.Enabled = false; this.xEditClearMenuItem.Enabled = false; } } } Source file -- Anderson, Kristen, Accounting, Assistant, Female, 43155 Ball, Robin, Accounting, Instructor, Female, 42723 Chin, Roger, Accounting, Full, Male,59281 Coats, William, Accounting, Assistant, Male, 45371 Doepke, Cheryl, Accounting, Full, Female, 52105 Downs, Clifton, Accounting, Associate, Male, 46887 Garafano, Karen, Finance, Associate, Female, 49000 Hill, Trevor, Management, Instructor, Male, 38590 Jackson, Carole, Accounting, Instructor, Female, 38781 Jacobson, Andrew, Management, Full, Male, 56281 Lewis, Karl, Management, Associate, Male, 48387 Mack, Kevin, Management, Assistant, Male, 45000 McKaye, Susan, Management, Instructor, Female, 43979 Nelsen, Beth, Finance, Full, Female, 52339 Nelson, Dale, Accounting, Full, Male, 54578 Palermo, Sheryl, Accounting, Associate, Female, 45617 Rais, Mary, Finance, Instructor, Female, 27000 Scheib, Earl, Management, Instructor, Male, 37389 Smith, Tom, Finance, Full, Male, 57167 Smythe, Janice, Management, Associate, Female, 46887 True, David, Accounting, Full, Male, 53181 Young, Jeff, Management, Assistant, Male, 43513

    Read the article

  • Button control subclass: click event does not fire when using UpdatePanel

    - by nw
    Using suggestions from this thread, I created a ModernButton control that uses the HTML button tag instead of input. This control works great except when embedded within an UpdatePanel control. In this case, it does trigger the partial postback, but its click event does not fire. The control is defined thus: [ParseChildren(false)] [PersistChildren(true)] public class ModernButton : Button { private string _iconURL = ""; protected override string TagName { get { return "button"; } } protected override HtmlTextWriterTag TagKey { get { return HtmlTextWriterTag.Button; } } public new string Text { get { return ViewState["NewText"] as string; } set { ViewState["NewText"] = HttpUtility.HtmlDecode(value); } } public string IconURL { get { return this._iconURL; } set { this._iconURL = value.Trim(); } } protected override void OnPreRender(System.EventArgs e) { base.OnPreRender(e); LiteralControl textCtrl = new LiteralControl(this.Text); if (this._iconURL != "") { LiteralControl openDiv = new LiteralControl( string.Format( "<div style=\"background-image:url({0}); background-position:left center; background-repeat:no-repeat; line-height:16px; padding:3px 0 3px 22px;\">", ResolveClientUrl(this._iconURL) ) ); LiteralControl closeDiv = new LiteralControl("</div>"); Controls.AddAt(0, openDiv); Controls.Add(textCtrl); Controls.Add(closeDiv); } else { Controls.Add(textCtrl); } base.Text = UniqueID; } protected override void RenderContents(HtmlTextWriter writer) { RenderChildren(writer); } } I use it so: <asp:UpdatePanel runat="server" ID="uxSearchPanel" ChildrenAsTriggers="true" UpdateMode="Conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="uxSearchButton" /> </Triggers> <ContentTemplate> ... <ctrl:ModernButton ID="uxSearchButton" runat="server" Text="Search" IconURL="Icons/magnifier.png" OnClick="uxSearchButton_Click"></ctrl:ModernButton> </ContentTemplate> </asp:UpdatePanel> Which renders: <div id="uxBody_uxSearchPanel"> ... <button type="submit" name="ctl00$uxBody$uxSearchButton" value="ctl00$uxBody$uxSearchButton" id="uxBody_uxSearchButton"> <div style="background-image:url(Icons/magnifier.png); background-position:left center; background-repeat:no-repeat; line-height:16px; padding:3px 0 3px 22px;">Search</div> </button> </div> The ModernButton generates a postback in every case (whether partial or full), but the server-side click event (uxSearchButton_Click) does not fire in the partial postback scenario.

    Read the article

  • Erratic behavior with XPS editing: what could be going wrong?

    - by Ariel Arjona
    Hello folks, I'm working on a class that annotates existing XPS documents. The problem I've been having is that some annotations randomly don't make it to the finished document. The following test code is supposed to draw a rectangle on every page. On random pages the rectangle does not appear. Upon inspection of the page XML, the tags for the rectangle are missing. I run the program again and sometimes it appears on that particular page, sometimes it's then missing from some other page, sometimes from all but 1, and so on. public void TestXpsAnnotate() { var xpsFile = this.GetXpsFile(); var xpsDoc = new XpsDocument(xpsFile, FileAccess.Read); FixedDocumentSequence docSeq = xpsDoc.GetFixedDocumentSequence(); // new XPS document var newFds = new FixedDocumentSequence(); var newDocRef = new DocumentReference(); var newFixedDoc = new FixedDocument(); // get documents foreach (var docRef in docSeq.References) { FixedDocument fixedDoc = docRef.GetDocument(true); // get pages foreach (PageContent pageContent in fixedDoc.Pages) { var newPageContent = new PageContent(); newPageContent.Source = pageContent.Source; (newPageContent as IUriContext).BaseUri = ((IUriContext)pageContent).BaseUri; FixedPage fixedPage = newPageContent.GetPageRoot(true); var r = new System.Windows.Shapes.Rectangle() { Width = 300, Height = 400, Stroke = new SolidColorBrush(Colors.Red), Fill = new SolidColorBrush(Colors.Yellow), StrokeThickness = 3, }; //var r = new TextBlock(); //r.Text = "BLAH"; //r.Foreground = new SolidColorBrush(Colors.Red); var theCanvas = fixedPage.Children.Cast<UIElement>().OfType<Canvas>().First(); theCanvas.Children.Add(r); Canvas.SetLeft(r, 10); Canvas.SetTop(r, 10); fixedPage.UpdateLayout(); newFixedDoc.Pages.Add(newPageContent); } } xpsDoc.Close(); newDocRef.SetDocument(newFixedDoc); newFds.References.Add(newDocRef); string outputFile = this.GetOutputFile(); if (File.Exists(outputFile)) { File.Delete(outputFile); } var newXpsDoc = new XpsDocument(outputFile, FileAccess.ReadWrite); var writer = XpsDocument.CreateXpsDocumentWriter(newXpsDoc); writer.Write(newFds); newXpsDoc.Close(); } This code follows the examples I've seen around the internet and it seems to do what it's supposed to, when it works. Any idea what could be going wrong here?

    Read the article

  • GUI Application becomes unresponsive while http request is being done

    - by JW
    I have just made my first proper little desktop GUI application that basically wraps a GUI (php-gtk) interface around a SimpleTest Web Test case to make it act as a remote testing client. Each time the local The Web Test case runs, it sends an HTTP request to another SimpleTest case (that has an XHTML interface) sitting on my server. The application, allows me to run one local test that collates information from multiple remote tests. It just has a 'Start Test' button, 'Stop Test' button and a setting to increase/decrease the number of remote tests conducted in each HTTP Request. Each test-run takes about an hour to complete. The trouble is, most of the time the application is making http requests. Furthermore, whenever an HTTP Request is being made, the application's GUI is unresponsive. I have taken to making the application wait a few seconds (iterating through the Gtk::main_iteration ) between requests in order to give the user time to re-size the window, press the Stop button, etc. But, this makes the whole test run take a lot a longer than is necessary. <?php require_once('simpletest/web_tester.php'); class TestRemoteTestingClient extends WebTestCase { function testRunIterations() { ... $this->assertTrue($this->get($nextUrl), 'getting from pointer:'. $this->_remoteMementoPointer); $this->assertResponse(200, "checking response for " . $nextUrl ); $this->assertText('RemoteNodeGreen'); $this->doGtkIterationsForMinNSeconds($secs); ... } public function doGtkIterationsForMinNSeconds($secs) { $this->appendStatusMessage("Waiting " . $secs); $start = time(); $end = $start + $secs; while( (time() < $end) ) { $this->appendStatusMessage("Waiting " . ($end - time())); while(gtk::events_pending()) Gtk::main_iteration(); } } } Is there a way to keep the application responsive whilst, at the same time making an HTTP request? I am considering splitting the application into two, where: Test Controller Application - Acts as a settings-writer / report-reader and this writes to settings file and reads a report file. Test Runner Application - Acts as a settings-reader / report-writer and, for each iteration reads the settings file, Runs the test, then write a report. So to tell it to close down - I'd: Press the Stop Button on the 'Test Controller Application', which writes to the settings file, which is read by the 'Test Runner Application' which stops, then writes to the report file to say it stopped the 'Test Controller Application' reads the report and updates the status and so on... However, before I go ahead and split the application in two - I am wondering if there is any other obvious way to deal with, this issue. I suspect it is probably quite common and a well-trodden path. Also is there an easier way to send messages between two applications?

    Read the article

  • Alternatives to fread and fwrite for use with structured data

    - by forest58
    The book Beginning Linux Programming (3rd ed) says "Note that fread and fwrite are not recommended for use with structured data. Part of the problem is that files written with fwrite are potentially nonportable between different machines." What does that mean exactly? What calls should I use if I want to write a portable structured data reader or writer? Direct system calls?

    Read the article

  • Can a BufferedImage be written to file any format?

    - by ncoder
    Is it correct that if we have a BufferedImage object in java, we could potentially write it out in ANY format using ImageIO.write (if we have a Writer object for the same)? I tried writing a BufferedImage object into a jpg file, it outputted an empty image file however when i tried writing it in to a png file, it worked fine.

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >