Search Results

Search found 1290 results on 52 pages for 'libreoffice writer'.

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

  • How to develop "Client script library" for ASP.net controls and how do these work?

    - by Niranjan Kala
    I have been working on .Net platform for 2 years and right now I am working on DevExpress controls for 6 months. All these control have client-side Events which are under some ClientScript nameSpace of particular control, Which specify ClientInstanceName, methods and properties accessible at client side. For example Button1 is ClientInstanceName and Button1.Text is a property, with methods like these: Button1.SetValue(); Button1.GetValue(); In ASP.Net Controls, buttons have the ClientClick event that fires before the Server Side Click event. I have inspected and goggled to extend client side functionality in asp.net controls. For example: create a ClientInstanceName property for controls or CheckedChanged event for CheckBox / RadioButton control. I have tried using these MSDN articles: Injecting Client-Side Script from an ASP.NET Server Control Working with Client-Side Script I got much information and ideas from these articles on how to implement/extend these. All are working in the client side. protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); string script = @"return confirm(""%%POPUP_MESSAGE%%"");"; script = script.Replace("%%POPUP_MESSAGE%%", this.PopupMessage.Replace("\"", "\\\"")); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script); } Here It is just setting up attribute to the button. but all client side interaction no control from server. Here is that I want to know: How can I implement such functionality to create methods, properties etc. on client side. For example I am creating a PopControl as in the above code snippet same behavior as like Ajax ModalPopupExtender That have OK Button related properties. Ajax Controls can be directed to perform work from server side code e.g. Popup1.show(); How can I do this with such client enabled controls implemented controls as windows do? I am learning creation of Ajax Controls but I do not want to use ScriptManager or depend on another control. Just some extension to standard controls. I am expecting for ideas and implementation methods for such functionality.

    Read the article

  • Great Programmer Productivity - Accounting for 10,000 fold difference?

    - by TheImpact
    "A great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer." - Bill Gates Say there's a "great" software engineer and an "average" software engineer on the same team. How can you account for one engineer being 10,000 times more productive? I can't quite fathom this, given they're both taking on their share of features, bugs and investigations, and consistently deliver with quality. Would my description possibly justify them to be above "average"? "great"? In a corporation like Microsoft, what % of software engineers are "average"? What % "great"?

    Read the article

  • Ubuntu Variant / Linux Distros which uses least system resources (RAM, CPU)?

    - by elegantonyx
    I have a netbook (an older Asus EEEPC 1005HA) which I want to get rid of Windoze on (I like Windows, but I don't think it works well in a netbook environment). Basically, my question is which Ubuntu variant will use the least RAM and CPU running idle, and/or the same question except when running Firefox and Libreoffice Writer, say. I am also open to suggestions of non-Ubuntu Linux distros, but since this is AskUbuntu I thought the first question would be more appropriate. I have a disk drive which I can attach to the netbook, so it doesn't have to be a Ubuntu Variant / Linux Distro which solely boots from a USB drive. I have at my disposal: DVDs, DVD writer/ disk drive, 4gb flash drive, 8 gb flash drive I was thinking either Lubuntu or Archbang / Crunchbang but I would like some help from more knowledgable people Specs: Can't boot into it right now, but I think I have either Intel Atom N270 @1.60ghz OR Intel Atom N280 @1.66ghz (single core, I think) 2gb RAM 160 GB hard drive

    Read the article

  • How to structure my java packages

    - by MightyPork
    I have a Java library, quite a huge one. I'm asking regarding Best Practices of structuring the source. For example, the logging sybsystem: Option 1: All in one package, named to sort nicely Log - static accessor LogMonitor - interface for log minotor LogMonitorBase - abstract class LogMonitorStdout - print log to console LogWriter - interface for file logger LogWriterSimple - log writer with just one log file LogWriterArchiving - log writer that handles old log files Option 2: Subpackages for Monitors and Writers, with better names Log monitors/LogMonitor monitors/BaseMonitor monitors/StdoutMonitor writers/LogWriter writers/SimpleLog writers/ArchivingLog The second maybe looks better, but perhaps it's not so practical from the java point of view (two extra packages). What do you suggest as the best practice here? A lot in one package, grouped by naming prefixes, or a lot of subpackages with better names?

    Read the article

  • What book do you recommend for the OCAJP certification (1Z0-803) and OCPJP (1Z0-804) [on hold]

    - by Muhammad Gelbana
    I find completely contradicting reviews for the VERY same book on amazon and even some book writers are rewarding people for good reviews so basically most of the reviews are totally fake ! You can even figure it out from the reviewer name, which you'll similar to the writer's name and assume that they could actually be from the same country and the reviewer is just being helpful, to the book writer of course ! I can't make my mind for which book I should buy ! I only need a book or two that covers the Java associate and professional topics very well, not just an overview, I need a material that covers everything from A to Z. Even though I've been developing in Java for around 4.5 years but I must not know a detail or two. Would someone kindly shed some light on a good book based on actual experience with the book ? THANK YOU !

    Read the article

  • OutOfMemoryError during the pdf merge

    - by Vijay
    the below code merges the pdf files and returns the combined pdf data. while this code runs, i try to combine the 100 files with each file approximately around 500kb, i get outofmemory error in the line document.close();. this code runs in the web environment, is the memory available to webspehere server is the problem? i read in an article to use freeReader method, but i cannot get how to use it my scenario. protected ByteArrayOutputStream joinPDFs(List<InputStream> pdfStreams, boolean paginate) { Document document = new Document(); ByteArrayOutputStream mergedPdfStream = new ByteArrayOutputStream(); try { //List<InputStream> pdfs = pdfStreams; List<PdfReader> readers = new ArrayList<PdfReader>(); int totalPages = 0; //Iterator<InputStream> iteratorPDFs = pdfs.iterator(); Iterator<InputStream> iteratorPDFs = pdfStreams.iterator(); // Create Readers for the pdfs. while (iteratorPDFs.hasNext()) { InputStream pdf = iteratorPDFs.next(); if (pdf == null) continue; PdfReader pdfReader = new PdfReader(pdf); readers.add(pdfReader); totalPages += pdfReader.getNumberOfPages(); } //clear this pdfStreams = null; //WeakReference ref = new WeakReference(pdfs); //ref.clear(); // Create a writer for the outputstream PdfWriter writer = PdfWriter.getInstance(document, mergedPdfStream); writer.setFullCompression(); document.open(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); PdfContentByte cb = writer.getDirectContent(); // Holds the PDF // data PdfImportedPage page; int currentPageNumber = 0; int pageOfCurrentReaderPDF = 0; Iterator<PdfReader> iteratorPDFReader = readers.iterator(); // Loop through the PDF files and add to the output. while (iteratorPDFReader.hasNext()) { PdfReader pdfReader = iteratorPDFReader.next(); // Create a new page in the target for each source page. while (pageOfCurrentReaderPDF < pdfReader.getNumberOfPages()) { pageOfCurrentReaderPDF++; document.setPageSize(pdfReader .getPageSizeWithRotation(pageOfCurrentReaderPDF)); document.newPage(); // pageOfCurrentReaderPDF++; currentPageNumber++; page = writer.getImportedPage(pdfReader, pageOfCurrentReaderPDF); cb.addTemplate(page, 0, 0); // Code for pagination. if (paginate) { cb.beginText(); cb.setFontAndSize(bf, 9); cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "" + currentPageNumber + " of " + totalPages, 520, 5, 0); cb.endText(); } } pageOfCurrentReaderPDF = 0; System.out.println("now the size is: "+pdfReader.getFileLength()); } mergedPdfStream.flush(); document.close(); mergedPdfStream.close(); return mergedPdfStream; } catch (Exception e) { e.printStackTrace(); } finally { if (document.isOpen()) document.close(); try { if (mergedPdfStream != null) mergedPdfStream.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } return mergedPdfStream; } Thanks V

    Read the article

  • Write to file depending on minSdkVersion - android

    - by Simon Rosenqvist
    Hi, I have written a filewriter for my android application. It is to function on a Galaxy Tab, so my minSdkVersion has to be at least 4, so it will fill the screen. I originally started out with SdkVersion = 2 and at that point my filewriter worked perfectly. Changing the SdkVersion to 4 introduced the problem. My filewriter doesn't work anymore! The application runs fine, but a file doesn't get created. My .java file looks like this: public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(R.layout.main); //definerer en knap kaldet button1 og sætter en listener på denne. Button button1 = (Button)findViewById(R.id.btnClickMe); button1.setOnClickListener(btnListener); //definerer en knap kaldet button2 og sætter en listener på denne. Button button2 = (Button)findViewById(R.id.btnClickMe2); button2.setOnClickListener(btnListener2); } //en variabel af typen 'long' deklæres og kaldes tid1. public long time1; private OnClickListener btnListener = new OnClickListener() { public void onClick(View v) { //Når der klikkes på button1 gemmes et tal i variablen tid1. time1 = System.currentTimeMillis(); } }; //en variabel af typen 'long' deklæres og kaldes tid2. public long time2; // en variabel af typen 'string' deklæres og kaldes tid: public String string1 = "time:"; private OnClickListener btnListener2 = new OnClickListener() { public void onClick(View v) { //Når der klikkes på button2 gemmes et tal i variablen tid2. time2 = System.currentTimeMillis(); // Herefter oprettes en fil kaldet "file.txt". try{ File file = new File(Environment.getExternalStorageDirectory(), "file.txt"); file.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(file,true)); //string1 og tid2-tid1 skrives til filen. tid2-tid1 giver den tid der går fra der er trykket på den ene knap til den anden i millisekunder. writer.write(string1 + "\t" + (time2-time1)); writer.newLine(); writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } }; } And my manifest.xml looks like this: <?xml version="1.0" encoding="utf-8"?> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> Why does my filewriter not work with minSdkVersion 2? Do i have to make a new filewriter? or what to do? Sorry for the messy code, i'm quite new to programming :)

    Read the article

  • Disable MathML output of eLyXer

    - by Gryllida
    eLyXer is a standalone LyX to HTML converter. In the resulting file, equations are formatted as MathML, and the file itself starts with an XML tag. This causes two problems: LibreOffice does not read the XML file (it can read HTML files, but not XHTML). I am unable to copy and paste the equations into a document editor such as LibreOffice with the goal of subsequent conversion into .doc, because .doc files do not support MathML. The eLyXer help page mentions an option to only use simple math, but there is no option to set math equations to output as images. And I already set Document Settings Output Math equations Format: images in LyX, which presumably is saved in the lyx document somewhere. A web search did not come up with any solutions.

    Read the article

  • Converting Powerpoint to PDF solutions?

    - by OWiz
    I asked a version of this question earlier, but I'm in need of other solutions, so this is a more pointed question. I'm in need of a server-based solution for converting ppt files to pdf files. This solution can either sit on the current web server as a console command-triggered service, it can be integrated into the C# code of the web all, or it can be it's own server. It also can't be based off of Libreoffice or Openoffice, as those two have problems converting SmartArt. I'm currently using Libreoffice. I've tried Powerpoint console commands combined with a PDF driver but I can't get that to work from C#. I've tried a .vbs script, but that briefly opens the powerpoint window.

    Read the article

  • Put Google Chrome, AVG on a flash drive

    - by duncan12
    I often install programs on others' computers such as LibreOffice, which, when they only have a dial-up connection, takes forever to download. So instead I keep it on a flash drive and install it from there. This works fine for LibreOffice. However, some programs, when you download them all you are downloading is a downloader - when you download ChromeSetup and open it, a installer window opens which actually downloads Chrome. Dial-up users then see that it will take 4 hours. Another example is AVG free antivirus - you download an installer, which when opened actually downloads AVG. However this doesn't work too well for dial-up users. How do I put the entire program of things like Chrome and AVG on a flash drive for fast installation on others' slow connections?

    Read the article

  • Ugly/Inconsistent Theming in Ubuntu Gnome 12.10

    - by Erland
    Some applications are displaying really ugly widgets and menus. I think it's a GTK issue and perhaps more particularly, only applies to GTK2 apps but I'm not sure. The numerous questions on here that deal with GTK2 v GTK3 themes do not answer my problem. Here is my situation: I'm using Ubuntu Gnome with Gnome Shell (installed using the "upgrade" instructions, rather than fresh install) with the default Adwaita theme The reason I did an upgrade instead of fresh install is because I'm on a Macbook Air and there is no mac image/iso for Ubuntu Gnome Previously, I did a fresh install of Ubuntu Gnome 12.10 and had no theming problems Now, apps like nautilus, rhythmbox, brasero, even third-party ones like Lightread look exactly as expected but other apps, including Firefox, Inkscape, GIMP, Libreoffice look awful. Some examples: Firefox with ugly location bar: http://ubuntuone.com/3e2X0JTa4CT4afC4303U9c vs nautilus location bar: http://ubuntuone.com/3TbHWWuNMcJnlpI4IpjiUO GIMP file dialogue (like Windows 95!): http://ubuntuone.com/4ioCcqq3flgO7zAWgAhfWy vs the rhythmbox file dialogue (correct): http://ubuntuone.com/2xLplCOBvQnyeqdsTGdgXq Menus in Libreoffice (very bad for usability): http://ubuntuone.com/26WTaEz4PMGmiItGeSmBjZ vs menus in rhythmbox: http://ubuntuone.com/4Ib4thMLqohsle6J5KEvuI I've been searching for a solution to this problem for some time. The logical explanation is that all the GTK3 apps are working and anything that is still using GTK2 is not. If that's the case though, why did the same installation (Ubuntu Gnome 12.10) and the same theme (Adwaita) previously work with all those GTK2 apps? Desperate for help!

    Read the article

  • Windows Server Backup fails to backup Hyper-V VM with "Access is denied"

    - by Sebastian Krysmanski
    I'm trying to use Windows Server Backup on my Windows Server 2012 box to backup my Hyper-V VMs. I created a backup job but each job ends with some "Access is denied" errors. One of my VMs (Linux Server) is backed up properly. All others (one Windows 8, one Linux) are not (or at least it seems that way from the looks of the log file below). How can I solve this problem? Here's the log I'm getting: Error in backup of D:\ during read: Error [0x80070005] Access is denied. Application backup Writer Id: {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE} Component: C435964E-C07A-4958-BA73-A04C6583280F Caption : Backup Using Saved State\Alter Server Logical Path: Error : 8078010E Error Message : Copy of the files failed. Detailed Error : 80070005 Detailed Error Message : (null) Writer Id: {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE} Component: E780F138-9676-42FB-821C-4561B9B263DC Caption : Backup Using Child Partition Snapshot\Windows 8 Logical Path: Error : 8078010E Error Message : Copy of the files failed. Detailed Error : 80070005 Detailed Error Message : (null) Writer Id: {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE} Component: Host Component Caption : Host Component Logical Path: Error : 8078010E Error Message : Copy of the files failed. Detailed Error : 80070005 Detailed Error Message : (null)

    Read the article

  • Trying to backup system state on server 2003 sp2, getting "Faulting application vssvc.exe - system state backup failed" in applciation log

    - by IT_Fixr
    Trying to backup system state on Windows Server 2003 (SP2), getting "Faulting application vssvc.exe - system state backup failed" in application log. Volume shadow copy creation: Attempt 1. "MSDEWriter" has reported an error 0x800423f2. This is part of System State. The volume shadow copy operation can be retried. "Event Log Writer" has reported an error 0x800423f2. This is part of System State. The volume shadow copy operation can be retried. "Registry Writer" has reported an error 0x800423f2. This is part of System State. The volume shadow copy operation can be retried. "COM+ REGDB Writer" has reported an error 0x800423f2. This is part of System State. The volume shadow copy operation can be retried. "Removable Storage Manager" has reported an error 0x0. This is part of System State. The backup cannot continue. Error returned while creating the volume shadow copy:800423f2 Aborting Backup.

    Read the article

  • Why does HP Update at remote system trigger RDP printing at local system?

    - by lcbrevard
    This is obscure. When connected with RDP to another system that has HP Update installed on it, either directly running the HP Update or having the notification pop up to ask if you want to run HP Update causes the local system to try to print something to peculiarly-chosen-local-printer. Case 1: Desktop Win 7 Ult system RDP connected to HP Laptop Win 7 Ult system. When HP Update runs on the laptop a dialog for XPS Writer Save As... appears on Desktop system. Even if you put in a name, nothing gets generated and the dialog repeats. And repeats. Until you (a) close the RDP connection and (b) clean out the queued entries. If the HP Update pops up the request to run the update and you are not at the desk when this happens, there can be dozens of queued requests for this bogus printing. NOTE: the XPS Writer is not selected as a default printer on either system. Case 2: (Different) HP Laptop Win 7 Ult system RDP connected to XP Pro "brand X" desktop system but with HP printer drivers installed. If the request to run HP Update notification pops on the XP system, dozens of attempts to print, in this case to a Versa Check Printer driver, are queued. Dismissing the HP request, closing RDP, and cleaning out the queue are required to stop this. NOTE: the Versa Check Writer is not selected as a default printer on either system. THE QUESTION: What the heck is going on here? Some kind of scripting or COM activity that is misdirected?

    Read the article

  • Messing with Encoding and XslCompiledTransform

    - by Josemalive
    Hello, im messing with the encodings. For one hand i have a url that is responding me in UTF-8 (im pretty sure thanks to firebug plugin). Im opening the url reading the content in UTF-8 using the following code: StreamReader reader = new StreamReader(response.GetResponseStream(),System.Text.Encoding.UTF8); For other hand i have a transformation xslt sheet with the following code: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> <br/> hello </xsl:copy> </xsl:template> </xsl:stylesheet> This xslt sheet is saved in UTF-8 format too. I use the following code to mix the xml with the xslt: StringWriter writer = new StringWriter(); XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(HttpContext.Current.Server.MapPath("xslt\\xsltsheet.xslt"); XmlWriterSettings xmlsettings = new XmlWriterSettings(); xmlsettings.Encoding = System.Text.Encoding.UTF8; transformer.Transform(xmlreader, null, writer); return writer; Then after all im render in the webbrowser the content of this writer and im getting the following error: The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. Switch from current encoding to specified encoding not supported. Error processing resource 'http://localhost:2541/Results.... <?xml version="1.0" encoding="utf-16"?> Im wondering where is finding the UTF-16 encoding take in count that: All my files are saved as UTF-8 The response from the server is in UTF-8 The way of read the xslt sheet is configured as UTF-8. Any help would be appreciated. Thanks in advance. Best Regards. Jose.

    Read the article

  • Fatal error: Uncaught exception 'Exception' in PHPExcel classes

    - by Chakrapani
    Can any one please let me know, why this following error has been thrown from PHPExcel classes Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file /var/www/mydomain/myexcel.xlsx.' in /var/www/mydomain/Classes/PHPExcel/Writer /Excel2007.php:400 Stack trace: #0 /var/www/mydomain/myexcel.php(173): PHPExcel_Writer_Excel2007->save('/var/www/mydomain...') #1 {main} thrown in /var/www/mydomain/Classes/PHPExcel/Writer/Excel2007.php on line 400

    Read the article

  • The same class file in multiple .jar files. How bad is this?

    - by Kannan Goundan
    I have a library that writes data in either a text or binary format. It has the following three components: common data structures text writer (depends on 1) binary writer (depends on 1) The obvious way to distribute this is as 3 .jar files, so that users can include only what they need. However, the "common data structures" component is really just two small classes so I'm considering creating only two .jar files and including the common .class files in both. My question: What are the potential problems with doing this?

    Read the article

  • Getting ClassCastException with JSF 1.2 Custom Component and BEA 10.3

    - by Tobi
    Im getting a ClassCastException if i use Attributes in my Custom Headline Tag. Without Attributes rendering works fine. Calling <t:headline value="test" /> gives a ClassCastException even before a Method in my HeadlineComponent or HeadlineTag-Class is called. <t:headline /> works fine. I'm using MyFaces-1.2, on BEA 10.3 default.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@ taglib prefix="t" uri="http://www.tobi.de/taglibrary" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Tobi Test</title> </head> <body> <f:view> <t:headline value="test" /> </f:view> </body> </html> HeadlineComponent.java package tobi.web.component.headline; import java.io.IOException; import javax.el.ValueExpression; import javax.faces.component.UIOutput; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; public class HeadlineComponent extends UIOutput { private String value; private Integer size; @Override public Object saveState(FacesContext context) { Object values[] = new Object[3]; values[0] = super.saveState(context); values[1] = value; values[2] = size; return ((Object)(values)); } @Override public void restoreState(FacesContext context, Object state) { Object values[] = (Object[])state; super.restoreState(context, values[0]); value = (String)values[1]; size = (Integer)values[2]; } @Override public void encodeBegin(FacesContext context) throws IOException { // Wenn keine Groesse angegeben wurde default 3 String htmlTag = (size == null) ? "h3" : "h"+getSize().toString(); ResponseWriter writer = context.getResponseWriter(); writer.startElement(htmlTag, this); if(value == null) { writer.write(""); } else { writer.write(value); } writer.endElement(htmlTag); writer.flush(); } public String getValue() { if(value != null) { return value; } ValueExpression ve = getValueExpression("value"); if(ve != null) { return (String)ve.getValue(getFacesContext().getELContext()); } return null; } public void setValue(String value) { this.value = value; } public Integer getSize() { if(size != null) { return size; } ValueExpression ve = getValueExpression("size"); if(ve != null) { return (Integer)ve.getValue(getFacesContext().getELContext()); } return null; } public void setSize(Integer size) { if(size>6) size = 6; if(size<1) size = 1; this.size = size; } } HeadlineTag.java package tobi.web.component.headline; import javax.el.ValueExpression; import javax.faces.component.UIComponent; import javax.faces.webapp.UIComponentELTag; public class HeadlineTag extends UIComponentELTag { private ValueExpression value; private ValueExpression size; @Override public String getComponentType() { return "tobi.headline"; } @Override public String getRendererType() { // null, da wir hier keinen eigenen Render benutzen return null; } protected void setProperties(UIComponent component) { super.setProperties(component); HeadlineComponent headline = (HeadlineComponent)component; if(value != null) { if(value.isLiteralText()) { headline.getAttributes().put("value", value.getExpressionString()); } else { headline.setValueExpression("value", value); } } if(size != null) { if(size.isLiteralText()) { headline.getAttributes().put("size", size.getExpressionString()); } else { headline.setValueExpression("size", size); } } } @Override public void release() { super.release(); this.value = null; this.size = null; } public ValueExpression getValue() { return value; } public void setValue(ValueExpression value) { this.value = value; } public ValueExpression getSize() { return size; } public void setSize(ValueExpression size) { this.size = size; } } taglibrary.tld <?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> <description>Tobi Webclient Taglibrary</description> <tlib-version>1.0</tlib-version> <short-name>tobi-taglibrary</short-name> <uri>http://www.tobi.de/taglibrary</uri> <tag> <description>Eine Überschrift im HTML-Stil</description> <name>headline</name> <tag-class>tobi.web.component.headline.HeadlineTag</tag-class> <body-content>empty</body-content> <attribute> <description>Der Text der Überschrift</description> <name>value</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <description>Die Größe der Überschrift nach HTML (h1 - h6)</description> <name>size</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> </taglib> faces-config.xml <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> <component> <description>Erzeugt eine Überschrift nach HTML-Stil</description> <display-name>headline</display-name> <component-type>tobi.headline</component-type> <component-class>tobi.web.component.headline.HeadlineComponent</component-class> <attribute> <attribute-name>value</attribute-name> <attribute-class>java.lang.String</attribute-class> </attribute> <attribute> <attribute-name>size</attribute-name> <attribute-class>java.lang.Integer</attribute-class> <default-value>3</default-value> </attribute> </component> </faces-config>

    Read the article

  • Lucene: Wildcards are missing from index

    - by Eleasar
    Hi - i am building a search index that contains special names - containing ! and ? and & and + and ... I have to tread the following searches different: me & you me + you But whatever i do (did try with queryparser escaping before indexing, escaped it manually, tried different indexers...) - if i check the search index with Luke they do not show up (question marks and @-symbols and the like show up) The logic behind is that i am doing partial searches for a live suggestion (and the fields are not that large) so i split it up into "m" and "me" and "+" and "y" and "yo" and "you" and then index it (that way it is way faster than a wildcard query search (and the index size is not a big problem). So what i would need is to also have this special wildcard characters be inserted into the index. This is my code: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Lucene.Net.Analysis; using Lucene.Net.Util; namespace AnalyzerSpike { public class CustomAnalyzer : Analyzer { public override TokenStream TokenStream(string fieldName, TextReader reader) { return new ASCIIFoldingFilter(new LowerCaseFilter(new CustomCharTokenizer(reader))); } } public class CustomCharTokenizer : CharTokenizer { public CustomCharTokenizer(TextReader input) : base(input) { } public CustomCharTokenizer(AttributeSource source, TextReader input) : base(source, input) { } public CustomCharTokenizer(AttributeFactory factory, TextReader input) : base(factory, input) { } protected override bool IsTokenChar(char c) { return c != ' '; } } } The code to create the index: private void InitIndex(string path, Analyzer analyzer) { var writer = new IndexWriter(path, analyzer, true); //some multiline textbox that contains one item per line: var all = new List<string>(txtAllAvailable.Text.Replace("\r","").Split('\n')); foreach (var item in all) { writer.AddDocument(GetDocument(item)); } writer.Optimize(); writer.Close(); } private static Document GetDocument(string name) { var doc = new Document(); doc.Add(new Field( "name", DeNormalizeName(name), Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field( "raw_name", name, Field.Store.YES, Field.Index.NOT_ANALYZED)); return doc; } (Code is with Lucene.net in version 1.9.x (EDIT: sorry - was 2.9.x) but is compatible with Lucene from Java) Thx

    Read the article

  • Problem with GwtUpload on GAE

    - by weesilmania
    I'm using GwtUpload to upload images on GAE. The problem is that the images seem to get much bigger when I move them into a blob. I've noticed the same for simple text fields and in that case I've realised that some weirdo characters are being appended to the end of the field values (encoding right?). Can anyone help? public class ImageUploadServlet extends AppEngineUploadAction { /** * Maintain a list with received files and their content types */ Hashtable<String, File> receivedFiles = new Hashtable<String, File>(); Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>(); private Objectify objfy; public ImageUploadServlet() { ObjectifyService.register(Thumbnail.class); objfy = ObjectifyService.begin(); System.out.println("ImageUploadServlet init"); } /** * Override executeAction to save the received files in a custom place and * delete this items from session. */ @Override public String executeAction(HttpServletRequest request, List<FileItem> sessionFiles) throws UploadActionException { Thumbnail t = new Thumbnail(); for (FileItem item : sessionFiles) { //CacheableFileItem item = (CacheableFileItem)fItem; if (false == item.isFormField()) { System.out.println("the name 1st:" + item.getFieldName()); try { // You can also specify the temporary folder InputStream imgStream = item.getInputStream(); Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream)); t.setMainImage(imageBlob); System.out.println("blob: " + t.getMainImage()); } catch (Exception e) { throw new UploadActionException(e.getMessage()); } } else { System.out.println("the name 2nd:" + item.getFieldName()); String name = item.getFieldName(); String value; try { InputStream is = item.getInputStream(); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer,"UTF-8"); value = writer.toString(); writer.close(); System.out.println("parm name: " + name); System.out.println("parm value: " + value + " **" + value.length()); System.out.println(item.getContentType()); if (name.equals("thumb-name")) { t.setName(value); } } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Error"); e.printStackTrace(); } } removeSessionFileItems(request); } objfy.put(t); return null; } As an example the size of the image is 20kb, and the lib has some debugging that confirms that this is the case when it's uploading the file but the blob ends up being over 1 MB. Wes

    Read the article

  • Cannot run public class in one .java from another

    - by DIOS
    I have created a basic program that takes whatever is input into two textfields and exports them to a file. I would now like to encrypt that file, and alredy have the encryptor. The problem is that I cannot call it. Here is my code for the encryptor: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.*; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.spec.SecretKeySpec; public class FileEncryptor { private String algo; private File file; public FileEncryptor(String algo,String path) { this.algo=algo; //setting algo this.file=new File(path); //settong file } public void encrypt() throws Exception{ //opening streams FileInputStream fis =new FileInputStream(file); file=new File(file.getAbsolutePath()); FileOutputStream fos =new FileOutputStream(file); //generating key byte k[] = "HignDlPs".getBytes(); SecretKeySpec key = new SecretKeySpec(k,algo.split("/")[0]); //creating and initialising cipher and cipher streams Cipher encrypt = Cipher.getInstance(algo); encrypt.init(Cipher.ENCRYPT_MODE, key); CipherOutputStream cout=new CipherOutputStream(fos, encrypt); byte[] buf = new byte[1024]; int read; while((read=fis.read(buf))!=-1) //reading data cout.write(buf,0,read); //writing encrypted data //closing streams fis.close(); cout.flush(); cout.close(); } public static void main (String[] args)throws Exception { new FileEncryptor("DES/ECB/PKCS5Padding","C:\\Users\\*******\\Desktop\\newtext").encrypt();//encrypts the current file. } } Here is the section of my file creator that is failing to call this: FileWriter fWriter = null; BufferedWriter writer = null; try{ fWriter = new FileWriter("C:\\Users\\*******\\Desktop\\newtext"); writer = new BufferedWriter(fWriter); writer.write(Data); writer.close(); f.dispose(); FileEncryptor encr = new FileEncryptor(); //problem lies here. encr.encrypt //public void that does the encryption. new complete(); //different .java that is working fine.

    Read the article

  • how to add xml namespces

    - by Scott Kramer
    Hi: This feed (snippit of it) needs to look exactly like this: <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd"> what do I add to this C# code to add that extra xmlns, xsi junk: writer.WriteStartDocument(); writer.WriteStartElement("AmazonEnvelope"); this feed is rejected without it-- Thanks!!

    Read the article

  • delphi vs c# post returns different strings - utf problem?

    - by argh
    I'm posting two forms - one in c# and one in delphi. But the result string seems to be different: c# returns: ¤@@1@@@@1@@@@1@@xsm˱Â0Ð... delphi returns: #$1E'@@1@@@@1@@@@1@@x'#$009C... and sice both are compressed streams I'm getting errors while trying to decompress it... The C# is 'correct' - ie. extracts. I'm not an expert on delphi - I just need to convert some piece of code from c# to delphi. c# code: string GetData(Hashtable aParam, string ServerURL) { string Result = ""; WebRequest Request = HttpWebRequest.Create(ServerURL); Request.Method = "POST"; Request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; UTF8Encoding encUTF8 = new System.Text.UTF8Encoding(false); StreamWriter writer = new StreamWriter(Request.GetRequestStream(), encUTF8); foreach (DictionaryEntry element in aParam) { writer.Write(element.Key + "=" + element.Value + "&"); } writer.Close(); writer.Dispose(); WebResponse Response = Request.GetResponse(); StreamReader Reader = new StreamReader(Response.GetResponseStream(), System.Text.Encoding.Default); Result = Reader.ReadToEnd(); Reader.Close(); Response.Close(); Reader.Dispose(); return Result; } delphi code: function GetData(aParam:TStringList; ServerURL:string):string; var req: TIdHTTP; res: string; begin req := TIdHTTP.Create(); with req do begin Request.ContentType := 'application/x-www-form-urlencoded; charset=UTF-8'; Request.Method := 'POST'; Request.CharSet := 'utf-8'; Request.AcceptCharSet := 'utf-8'; res := Post(ServerURL, aParam); end; Result := res; req.Free; end; -edit- I'm using delphi 2010

    Read the article

  • Is it possible to add an attribute to HtmlTextWriter WriteBreak

    - by skyfoot
    Hi, Is it possible to add a class to a br tag when using the HtmlTextWriter.WriteBreak method? writer.AddAttribute(HtmlTextWriterAttribute.Class, "className"); writer.WriteBreak(); I need an xHtml compliant html output and therefore the WriteBreak is perfect as it writes <br /> I want to add a class to the br so that I have <br class="className" />

    Read the article

  • Scala: can't write setter without getter?

    - by IttayD
    This works: class ButtonCountObserver { private var cnt = 0 // private field def count = cnt // reader method def count_=(newCount: Int) = cnt = newCount // writer method // ... } val b = new ButtonCountObserver b.count = 0 But this doesn't class ButtonCountObserver { private var cnt = 0 // private field def count_=(newCount: Int) = cnt = newCount // writer method // ... } val b = new ButtonCountObserver b.count = 0 I get: error: value count is not a member of ButtonCountObserver Is it possible to create a setter (with the syntactic sugar) without a getter?

    Read the article

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