Search Results

Search found 115 results on 5 pages for 'vladimir bezugliy'.

Page 4/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Oracle doesn't remove cursors after closing result set

    - by Vladimir
    Note: we reuse single connection. ************************************************ public Connection connection() {                try {            if ((connection == null) || (connection.isClosed()))            {               if (connection!=null) log.severe("Connection was closed !");                connection = DriverManager.getConnection(jdbcURL, username, password);            }        } catch (SQLException e) {            log.severe("can't connect: " + e.getMessage());        }        return connection;            } ************************************************** public IngisObject[] select(String query, String idColumnName, String[] columns) { Connection con = connection(); Vector<IngisObject> objects = new Vector<IngisObject>(); try {     Statement stmt = con.createStatement();     String sql = query;     ResultSet rs =stmt.executeQuery(sql);//oracle increases cursors count here     while(rs.next()) {        IngisObject o = new IngisObject("New Result");        o.setIdColumnName(idColumnName);                    o.setDatabase(this);        for(String column: columns) o.attrs().put(column, rs.getObject(column));        objects.add(o);        }     rs.close();// oracle don't decrease cursor count here, while it's expected     stmt.close();     } catch (SQLException ex) {     System.out.println(query);     ex.printStackTrace(); }

    Read the article

  • Apache Commons Net FTPClient and listFiles()

    - by Vladimir
    Can anyone explain me what's wrong with the following code? I tried different hosts, FTPClientConfigs, it's properly accessible via firefox/filezilla... FTPClientConfig config = new FTPClientConfig(FTPClientConfig.SYST_L8); FTPClient client = new FTPClient(); client.configure(config); client.connect("c64.rulez.org"); client.login("anonymous", "anonymous"); client.enterRemotePassiveMode(); FTPFile[] files = client.listFiles(); Assert.assertTrue(files.length > 0);

    Read the article

  • Can a stateless WCF service benefit from built-in database connection pooling?

    - by vladimir
    I understand that a typical .NET application that accesses a(n SQL Server) database doesn't have to do anything in particular in order to benefit from the connection pooling. Even if an application repeatedly opens and closes database connections, they do get pooled by the framework (assuming that things such as credentials do not change from call to call). My usage scenario seems to be a bit different. When my service gets instantiated, it opens a database connection once, does some work, closes the connection and returns the result. Then it gets torn down by the WCF, and the next incoming call creates a new instance of the service. In other words, my service gets instantiated per client call, as in [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]. The service accesses an SQL Server 2008 database. I'm using .NET framework 3.5 SP1. Does the connection pooling still work in this scenario, or I need to roll my own connection pool in form of a singleton or by some other means (IInstanceContextProvider?). I would rather avoid reinventing the wheel, if possible.

    Read the article

  • What is the best free Java based bug tracker?

    - by Vladimir Dyuzhev
    For internal development team I'm looking for a bug tracker. Important requirements are: Free (must have) WAR/EAR-deployable (must have; support team prefers to have all apps deployed same way) Nice UI (nice to have) UPDATE Since I wrote this, Atlassian has introduced a $10 (ten, not ten thousand!) version of JIRA for 10 developers. I think it's as good as it can get -- best issue tracker out there with all enterprise features, for the cost of a few coffees. I have bought it for my current group out of my own pocket (to avoid bureaucracy).

    Read the article

  • Jar Store - prevent from copying

    - by Vladimir
    We are going to create Jar Store the way like App Store works, but for Java Developers. Everyone will able to submit and sell custom .jar library which solves some little problem, but solves it very good to save other developer's work time. The only undecided question is how to prevent .jar copying or publishing bought .jar to the Net.

    Read the article

  • List local printers

    - by vladimir
    hi all, i am using this routine to list the local printers installed on on a machine... var p: pointer; hpi: _PRINTER_INFO_2A; hGlobal: cardinal; dwNeeded, dwReturned: DWORD; bFlag: boolean; i: dword; begin p := nil; EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, 0, dwNeeded, dwReturned); if (dwNeeded = 0) then exit; GetMem(p,dwNeeded); if (p = nil) then exit; bFlag := EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, dwneeded, dwNeeded, dwReturned); if (not bFlag) then exit; CbLblPrinterPath.Properties.Items.Clear; for i := 0 to dwReturned - 1 do begin CbLblPrinterPath.Properties.Items.Add(TPrinterInfos(p^)[i].pPrinterName); end; FreeMem(p); TPrinterInfos(p^)[i].pPrinterName returns a 'P' for printer name. i have a PdfCreator installed as a printer. TPrinterInfos is an array of _PRINTER_INFO_2A. how can i fix this?

    Read the article

  • Seek backwards and forward in CAAnimation

    - by Vladimir
    I'm trying to create a pseudo-movie player that shows layer's CAAnimation in my application. I've found a way to pause and resume animation (described in apple tech note), but can't find if it is possible to "seek" to arbitrary part of the animation, could anyone suggest what can be done here?

    Read the article

  • How to make parts of a div element resize automatically?

    - by vladimir
    I'm trying to create a small html fragment (a div element) consisted of three parts: a label, textbox, and a button. Within that div element the label would be on the left (autosized), the button would be on the right (again, autosized) and the textbox should take up all remaining space within the parent div element. This is what I've tried (assuming I want my div to be 400 pixels wide): <div style="width:400px"> <div style="float: left">Label</div> <input style="width:100%"> <!-- doesn't work --> <button type='button' style='float: right'>Click</button> </div> The trouble is, my textbox does not get resized automatically. Add 'width=100%' to the textbox doesn't work. What would be the way to make it take up all remaining space between the label and the button? Ideally it should be done just by applying some styles, not by introducing new elements. (I guess the issue isn't related only to div element, but that just happens to be my work scenario.)

    Read the article

  • JoinColumn name not used in sql

    - by Vladimir
    Hi! I have a problem with mapping many-to-one relationship without exact foreign key constraint set in database. I use OpenJPA implementation with MySql database, but the problem is with generated sql scripts for insert and select statements. I have LegalEntity table which contains RootId column (among others). I also have Address table which has LegalEntityId column which is not nullable, and which should contain values referencing LegalEntity's "RootId" column, but without any database constraint (foreign key) set. Address entity is mapped: @Entity @Table(name="address") public class Address implements Serializable { ... @ManyToOne(fetch=FetchType.LAZY, optional=false) @JoinColumn(referencedColumnName="RootId", name="LegalEntityId", nullable=false, insertable=true, updatable=true, table="LegalEntity") public LegalEntity getLegalEntity() { return this.legalEntity; } } SELECT statement (when fetching LegalEntity's addresses) and INSERT statment are generated: SELECT t0.Id, .., t0.LEGALENTITY_ID FROM address t0 WHERE t0.LEGALENTITY_ID = ? ORDER BY t0.Id DESC [params=(int) 2] INSERT INTO address (..., LEGALENTITY_ID) VALUES (..., ?) [params=..., (int) 2] If I omit table attribute from mentioned statements are generated: SELECT t0.Id, ... FROM address t0 INNER JOIN legalentity t1 ON t0.LegalEntityId = t1.RootId WHERE t1.Id = ? ORDER BY t0.Id DESC [params=(int) 2] INSERT INTO address (...) VALUES (...) [params=...] So, LegalEntityId is not included in any of the statements. Is it possible to have relationship based on such referencing (to column other than primary key, without foreign key in database)? Is there something else missing? Thanks in advance.

    Read the article

  • Facelets charset problem

    - by Vladimir
    Hi! In my earlier post there was a problem with JSF charset handling, but also the other part of the problem was MySQL connection parameters for inserting data into db. The problem was solved. But, I migrated the same application from JSP to facelets and the same problem happened again. Characters from input fields are replaced when inserting to database (c is replaced with Ä), but data inserted into db from sql scripts with proper charset are displayed correctly. I'm still using registered filter and page templates are used with head meta tag as following: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2"> If I insert into h:form tag the following attribute: acceptcharset="iso-8859-2" I get correct characters in Firefox, but not in IE7. Is there anything else I should do to make it work? Thanks in advance.

    Read the article

  • Managed bean property value not set to null

    - by Vladimir
    Hi! I'm new to JSF, so this question might be strange. I have an inputText component's value bound to managed bean's property of type Float. I need to set property to null when inputText field is empty, not to 0 value. It's not done by default, so I added converter with the following method implemented: public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) throws ConverterException { if (StringUtils.isEmpty(arg2)) { return null; } float result = Float.parseFloat(arg2); if (result == 0) { return null; } return result; } I registered converter, and assigned it to inputText component. I logged arg2 argument, and also logged return value from getAsObject method. By my log I can see that it returns null value. But, I also log setter property on backing bean and argument is 0 value, not null as expected. To be more precise, it is setter property is called twice, once with null argument, second time with 0 value argument. It still sets backing bean value to 0. How can I set value to null? Thanks in advance.

    Read the article

  • Java Interger: what is faster comparison or subtraction?

    - by Vladimir
    I've found that java.lang.Ingteger implementation of compareTo method looks as follows: public int compareTo(Integer anotherInteger) { int thisVal = this.value; int anotherVal = anotherInteger.value; return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1)); } The question is why use comparison instead of subtraction: return thisVal - anotherVal;

    Read the article

  • Internet Explorer Automation: how to suppress Open/Save dialog?

    - by Vladimir Dyuzhev
    When controlling IE instance via MSHTML, how to suppress Open/Save dialogs for non-HTML content? I need to get data from another system and import it into our one. Due to budget constraints no development (e.g. WS) can be done on the other side for some time, so my only option for now is to do web scrapping. The remote site is ASP.NET-based, so simple HTML requests won't work -- too much JS. I wrote a simple C# application that uses MSHTML and SHDocView to control an IE instance. So far so good: I can perform login, navigate to desired page, populate required fields and do submit. Then I face a couple of problems: First is that report is opening in another window. I suspect I can attach to that window too by enumerating IE windows in the system. Second, more troublesome, is that report itself is CSV file, and triggers Open/Save dialog. I'd like to avoid it and make IE save the file into given location OR I'm fine with programmatically clicking dialog buttons too (how?) I'm actually totally non-Windows guy (unix/J2EE), and hope someone with better knowledge would give me a hint how to do those tasks. Thanks! UPDATE I've found a promising document on MSDN: http://msdn.microsoft.com/en-ca/library/aa770041.aspx Control the kinds of content that are downloaded and what the WebBrowser Control does with them once they are downloaded. For example, you can prevent videos from playing, script from running, or new windows from opening when users click on links, or prevent Microsoft ActiveX controls from downloading or executing. Slowly reading through... UPDATE 2: MADE IT WORK, SORT OF... Finally I made it work, but in an ugly way. Essentially, I register a handler "before navigate", then, in the handler, if the URL is matching my target file, I cancel the navigation, but remember the URL, and use WebClient class to access and download that temporal URL directly. I cannot copy the whole code here, it contains a lot of garbage, but here are the essential parts: Installing handler: _IE2.FileDownload += new DWebBrowserEvents2_FileDownloadEventHandler(IE2_FileDownload); _IE.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(IE_OnBeforeNavigate2); Recording URL and then cancelling download (thus preventing Save dialog to appear): public string downloadUrl; void IE_OnBeforeNavigate2(Object ob1, ref Object URL, ref Object Flags, ref Object Name, ref Object da, ref Object Head, ref bool Cancel) { Console.WriteLine("Before Navigate2 "+URL); if (URL.ToString().EndsWith(".csv")) { Console.WriteLine("CSV file"); downloadUrl = URL.ToString(); } Cancel = false; } void IE2_FileDownload(bool activeDocument, ref bool cancel) { Console.WriteLine("FileDownload, downloading "+downloadUrl+" instead"); cancel = true; } void IE_OnNewWindow2(ref Object o, ref bool cancel) { Console.WriteLine("OnNewWindow2"); _IE2 = new SHDocVw.InternetExplorer(); _IE2.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(IE_OnBeforeNavigate2); _IE2.Visible = true; o = _IE2; _IE2.FileDownload += new DWebBrowserEvents2_FileDownloadEventHandler(IE2_FileDownload); _IE2.Silent = true; cancel = false; return; } And in the calling code using the found URL for direct download: ... driver.ClickButton(".*_btnRunReport"); driver.WaitForComplete(); Thread.Sleep(10000); WebClient Client = new WebClient(); Client.DownloadFile(driver.downloadUrl, "C:\\affinity.dump"); (driver is a simple wrapper over IE instance = _IE) Hope that helps someone.

    Read the article

  • C++ Microsoft SAPI: How to set Windows text-to-speech output to a memory buffer?

    - by Vladimir
    Hi all, I have been trying to figure out how to "speak" a text into a memory buffer using Windows SAPI 5.1 but so far no success, even though it seems it should be quite simple. There is an example of streaming the synthesized speech into a .wav file, but no examples of how to stream it to a memory buffer. In the end I need to have the synthesized speech in a char* array in 16 kHz 16-bit little-endian PCM format. Currently I create a temp .wav file, redirect speech output there, then read it, but it seems to be a rather stupid solution. Anyone knows how to do that? Thanks!

    Read the article

  • Share java object between two forms using Spring IoC

    - by Vladimir
    I want to share java object between two forms using Spring IoC. It should acts like Registry: Registry.set("key", new Object()); // ... Object o = Registry.get("key"); // ... Registry.set("key", new AnotherObject()); // rewrite old object I tried this code to register bean at runtime: applicationContext.getBeanFactory().registerSingleton("key", object); but it does not allow to rewrite existing object (result code for checking and deleting existing bean is too complicated)... PS I am Java newbie, so mb I am doing it wrong and I should not use IoC at all... any help is appreciated...

    Read the article

  • MongoMapper: how do I create a model like this

    - by Vladimir R
    Suppose we have two models, Task and User. So a user can have many tasks and tasks should be able to have many users too. But, a task should also have a unique creator who is also a user. Exemple: A task in this context is like this: Task ID, Task Creator, Users who should do the task User_1 creates a task and he is then the creator. User_1 specifies User_2 and User_3 as users who should do the task. So these two last users are not creators of task. How do I create this models so that if I have a task object, I can find it's creator and users who should complete it. And how do I do, if I have a user, to find all tasks he created and all tasks he should complete. Thank you.

    Read the article

  • How to get path to the installed GIT in Python?

    - by Vladimir Prudnikov
    I need to get a path to the GIT on Max OS X 10.6 using Python 2.6.1 into script variables. I use this code for that: r = subprocess.Popen(shlex.split("which git"), stdout=subprocess.PIPE) print r.stdout.read() but the problem is that output is empty (I tried stderr too). It works fine with another commands such as pwd or ls. Can anyone help me with that?

    Read the article

  • Broken if statement

    - by Vladimir Nani
    Maybe I am crazy but how that could be? some == null is always false but debugger goes into if-statement body anyway. Any ideas? I have restarted visual studio I have cleaned every bin/obj folder It is not the case that i don`t understand that WindowsIdentity.GetCurrent() may return null. That was my first idea. var some = new object(); if (some == null) { throw new Exception("hi!"); } else { do(); } My code: private void GetCurrentWindowsIdentity() { var identity = WindowsIdentity.GetCurrent() if (identity == null) { throw new Exception(Errors.IdentityIsNullException); } try { if (CurrentAuthenticationWrapper.AuthenticationType == AuthenticationType.Windows) { CurrentLogin = _identity != null ? _identity.Name : string.Empty; } } catch (Exception ex) { ViewManager.ShowError(ex); } _identity = identity; }

    Read the article

  • Variable function name Javascript.

    - by Vladimir
    I'm sorting array: myArray.sort(comparators.some_comparator); and I have several comparator to choose from: comparators = { asc_firstname_comparator : function(o1, o2){ ... } desc_firstname_comparator : function(o1, o2){ ... } etc... } I want to write function which returns certain comparator depending on input data. It should figure out comparator from string inputs, something like this: function chooseComparator(field, order){ return "comparators."+order+"_"+field+"_comparator"; } So is it possible to pass only function name string to sort() method or I'll need to pass reference to correct comparator somehow?

    Read the article

  • Regex to replace a string in HTML but not within a link or heading

    - by Vladimir
    I am looking for a regex to replace a given string in a html page but only if the string is not a part of the tag itself or appearing as text inside a link or a heading. Examples: Looking for 'replace_me' <p>You can replace_me just fine</p> OK <a href='replace_me'>replace_me</a> no match <h3>replace_me</h3> no match <a href='/test/'><span>replace_me</span></a> no match <p style="background:url('replace_me')">replace_me<h1>replace_me</h1></p> first no match, second OK, third no match Thanks in advance!

    Read the article

  • Hibernate saveOrUpdate fails when I execute it on empty table.

    - by Vladimir
    I'm try to insert or update db record with following code: Category category = new Category(); category.setName('catName'); category.setId(1L); categoryDao.saveOrUpdate(category); When there is a category with id=1 already in database everything works. But if there is no record with id=1 I got following exception: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1: Here is my Category class setters, getters and constructors ommited for clarity: @Entity public class Category { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; @ManyToOne private Category parent; @OneToMany(fetch = FetchType.LAZY, mappedBy = "parent") private List<Category> categories = new ArrayList<Category>(); } In the console I see this hibernate query: update Category set name=?, parent_id=? where id=? So looks like hibernates tryis to update record instead of inserting new. What am I doing wrong here?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >