Search Results

Search found 144 results on 6 pages for 'michal biros'.

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

  • Unit Testing Hibernate's Optimistic Locking (within Spring)

    - by Michal Bachman
    I'd like to write a unit test to verify that optimistic locking is properly set up (using Spring and Hibernate). I'd like to have the test class extend Spring's AbstractTransactionalJUnit4SpringContextTests. What I want to end up with is a method like this: @Test (expected = StaleObjectStateException.class) public void testOptimisticLocking() { A a = getCurrentSession().load(A.class, 1); a.setVersion(a.getVersion()-1); getCurrentSession().saveOrUpdate(a); getCurrentSession().flush(); fail("Optimistic locking does not work"); } This test fails. What do you recommend as a best practice? The reason I am trying to do this is that I want to transfer the version to the client (using a DTO). I want to prove that when the DTO is sent back to the server and merged with a freshly loaded entity, saving that entity will fail if it's been updated by somebody else in the meantime.

    Read the article

  • PHP will not delete from MySQL

    - by Michal Kopanski
    For some reason, JavaScript/PHP wont delete my data from MySQL! Here is the rundown of the problem. I have an array that displays all my MySQL entries in a nice format, with a button to delete the entry for each one individually. It looks like this: <?php include("login.php"); //connection to the database $dbhandle = mysql_connect($hostname, $username, $password) or die("<br/><h1>Unable to connect to MySQL, please contact support at [email protected]</h1>"); //select a database to work with $selected = mysql_select_db($dbname, $dbhandle) or die("Could not select database."); //execute the SQL query and return records if (!$result = mysql_query("SELECT `id`, `url` FROM `videos`")) echo 'mysql error: '.mysql_error(); //fetch tha data from the database while ($row = mysql_fetch_array($result)) { ?> <div class="video"><a class="<?php echo $row{'id'}; ?>" href="http://www.youtube.com/watch?v=<?php echo $row{'url'}; ?>">http://www.youtube.com/watch?v=<?php echo $row{'url'}; ?></a><a class="del" href="javascript:confirmation(<? echo $row['id']; ?>)">delete</a></div> <?php } //close the connection mysql_close($dbhandle); ?> The delete button has an href of javascript:confirmation(<? echo $row['id']; ?>) , so once you click on delete, it runs this: <script type="text/javascript"> <!-- function confirmation(ID) { var answer = confirm("Are you sure you want to delete this video?") if (answer){ alert("Entry Deleted") window.location = "delete.php?id="+ID; } else{ alert("No action taken") } } //--> </script> The JavaScript should theoretically pass the 'ID' onto the page delete.php. That page looks like this (and I think this is where the problem is): <?php include ("login.php"); mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); mysql_select_db ($dbname) or die("Unable to connect to database"); mysql_query("DELETE FROM `videos` WHERE `videos`.`id` ='.$id.'"); echo ("Video has been deleted."); ?> If there's anyone out there that may know the answer to this, I would greatly appreciate it. I am also opened to suggestions (for those who aren't sure). Thanks!

    Read the article

  • How to improve Java performance on Informix for Windows

    - by Michal Niklas
    I have problem with performance of Java UDR functions on Informix on Windows. On this server I already have some functions in C and SPL. I chose one function to write it in those 3 languages and I measured performance of this function on test table. Function calculates some kind of checksum so it does not use any db libraries etc. only string and math operations. I observed performance on 30k records with SQL like: select function(txt) from _tmp_perf_test and I changed function to 'function_c, function_spl or function_java. My performance tests showed that C function is the fastest, SPL function is about 5 times slower, where Java is 100 (one hundred!) times slower than C. I checked it few times and 1:100 ratio didn't improve. I changed Java function to simply return length of the string but even this do not help so it looks, that there is general problem with Java function invocation, because there was no difference in time between Java function that calculate checksum and Java function that returns length of the string. I increased JVM_MAX_HEAP_SIZE to 128 and it not helped too. I use IBM Informix Dynamic Server Version 11.50.TC6DE. The same test on Linux server: IBM Informix Dynamic Server Version 11.50.FC6 show more "normal" results, i.e. Java is slower from C and SPL but only 2 to 5 times. What can I do to improve Java performance on Informix server on Windows? More info about Java on servers: c:\Informix\extend\krakatoa\jre\bin>java -version java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pwi32dev-20081129a (SR9-0 )) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows Server 2003 x86-32 j9vmwi3223-20081129 (JIT enabled) J9VM - 20081126_26240_lHdSMr JIT - 20081112_1511ifx1_r8 GC - 200811_07) JCL - 20081129 [root@informix11 bin]# ./java -version java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pxa64devifx-20071025 (SR6b)) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux amd64-64 j9vmxa6423-20071005 (JIT enabled) J9VM - 20071004_14218_LHdSMr JIT - 20070820_1846ifx1_r8 GC - 200708_10) JCL - 20071025

    Read the article

  • Delphi, VirtualStringTree - classes (objects) instead of records

    - by michal
    I need to use a class instead of record for VirtualStringTree node. Should I declare it standard (but in this case - tricky) way like that: PNode = ^TNode; TNode = record obj: TMyObject; end; //.. var fNd: PNode; begin fNd:= vstTree.getNodeData(vstTree.AddChild(nil)); fNd.obj:= TMyObject.Create; //.. or should I use directly TMyObject? If so - how?! How about assigning (constructing) the object and freeing it? Thanks in advance m.

    Read the article

  • Changing system colors for a single application (Windows, .NET)

    - by Michal Czardybon
    I know I should generally avoid messing up with such system settings, but my application do already use nonstandard colors and I have no influence on that. I would like to be able to add standard .NET controls in some places, but their colors do not match. I would like to have a hack that would replace system colors for this one application. One more important thing to note is that it is a .NET application. My (incomplete) ideas so far were: To create a proxy User32.dll library with replaced GetSysColor, but it would be very tedious (731 functions to be redirected, 1 to be replaced) and I do not know how to force my application to use that particular copy. To intercept somehow invocations to GetSysColors (unfortunatelly it is somewhere in the CLR I think). To modify somehow .NET class SystemColors (in memory? is it possible?). Do you have any idea, what is the best (and complete) way to achieve this?

    Read the article

  • Is Google Analytics for Mobile available for Windows Mobile / Compact Framework

    - by Michal Drozdowicz
    Recently Google introduced an SDK for application usage tracking on mobile devices (Google Analytics for Mobile Apps). Unfortunately, it seems that it only supports IPhone and Android devices. Do you have any idea if this framework can somehow be used from Windows Mobile / Compact Framework applications or if Google is planning to release an SDK for WM? BTW, I don't mean a WM application for browsing through GA server reports, but an SDK for tracking your mobile app's usage.

    Read the article

  • DataGridRow Cells property

    - by Michal Krawiec
    I would like to get to DataGridRow Cells property. It's a table of cells in a current DataGrid. But I cannot get access direct from code nor by Reflection: var x = dataGridRow.GetType().GetProperty("Cells") //returns null Is there any way to get this table? And related question - in Watch window (VS2008) regular properties have an icon of a hand pointing on a sheet of paper. But DataGridRow.Cells has an icon of a hand pointing on a sheet of paper with a little yellow envelope in a left bottom corner - what does it mean? Thanks for replies.

    Read the article

  • PHP fails silently when php-code is within html tag

    - by Michal M
    PROBLEM UPDATED, READ BELOW For some reason my CI fails silently when loading view. Loading view is simply called from controller $this->load->view('templates/default.php'); Now. There are some functions in the loaded view that are not defined unless a proper helper is loaded as well. Normally, php would throw an error, but instead it fails silently here. I have no idea why. The template gets outputted till the line containing the undefined function. It took me long time to realise where my script is failing. Here's my setup: Windows 7 Ultimate Apache 2.2.15 PHP 5.3.2 with following error reporting settings: display_errors = On display_startup_errors = On error_reporting = E_ALL | E_STRICT CodeIgniter 1.7.2 Any ideas why would that be? UPDATE After further debugging, it turned out that PHP fails to report any errors when php code is inline with HTML and within the HTML tag. Now this is bizarre. This returns Fatal Error: <p><?php echo $bogus(); ?></p> This doesn't and fails silently: <p class="<?php echo $bogus(); ?>">paragraph</p> Why? :O UPDATE 2 Further investigation showed that if an error_log in PHP is specified, the errors are in fact reported in that file, but still not in the browser... Again, why? UPDATE 3 Actually my code should be slightly different. Checked another PHP installation on completely different machine and it confirmed the PHP bug. Reported here: http://bugs.php.net/bug.php?id=52040

    Read the article

  • Hessian on Windows Phone 7/ Silverlight ??

    - by Michal
    Hi, I'm using hessian protocol for communication betwee server (java) and various client applications. Now I started to develop Windows Phone 7 client. I downloaded hessian C# implementation but it does not compile for windows phone 7/silverlight. Does anyone managed to make it work on WP7/Silverlight? It's looks like there is many thing to be done/changed to make it work, which I'd like to avoid if it has been done by someone already. Thanks.

    Read the article

  • How to set timeout with python-mechanize?

    - by Michal Cihar
    I'm using python-mechanize to scrape some web sites, which sometime simply don't respond to requests and these requests stay open too long, so I need to limit timeout for these requests. While using urlopen method, the timeout can be set using timeout parameter, but I have not found easy way for doing it with high level API such as submit or click methods. Ideally the timeout would be set just once for whole browser class and all calls would honor that. It would be probably possible to customize this by passing custom request_class to every click and submit call, but this would just pollute the code, so I'm looking for nicer solution for setting timeout for mechanize's browser class (and no, I don't want to change default socket timeout using socket.setdefaulttimeout).

    Read the article

  • Caching generated QR Code

    - by Michal K
    I use zxing to encode a qr code and store it as a bitmap and then show it in ImageView. Since the image generation time is significant I'm planning to move it to a separate thread (AsyncTaskLoader will be fine I think). The problem is - it's an image and I know that to avoid memory leaks one should never store a strong reference to it in an Activity. So how would you do it? How to cache an image to survive config changes (phone rotation) and generally avoid generating it onCreate()? Just point me in the right direction, please.

    Read the article

  • How to transform SoapFault to SoapMessage via Interceptor in CXF?

    - by Michal Mech
    I have web-service created and configured via Spring and CXF. See beans below: <?xml version="1.0" encoding="UTF-8"?> <beans <!-- ommited -->> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <bean id="internalActService" class="package.InternalActServiceImpl" /> <jaxws:endpoint implementor="#internalActService" address="/InternalActService"> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> <jaxws:outFaultInterceptors> <bean class="package.InternalActServiceFaultOutInterceptor" /> </jaxws:outFaultInterceptors> </jaxws:endpoint> </beans> As can you see I added schema validation to my web service. But CXF throws SoapFault when request is not corresponding with schema. I want to send to the client SoapMessage instead of SoapFault, that's why I added outFaultInterceptors. My question is how to transform SoapFault to SoapMessage? I've made few tries but I don't know how to implement outFaultInterceptor.

    Read the article

  • Facebooker Session is not created when config.cache_classes = true

    - by Michal
    I am using Facebooker (along with devise & devise_facebook_connectable). The problem is that user can't sign in with Facebook Connect in production environment unless I set config.cache_classes to false (which I don't want to do in production obviously). When cache_classes = true, Facebooker::Session.current is nil. Trying to set it manually creates other problems, so I assume it's not the solution. Using Rails 2.3.8 (tried on 2.3.5 too) and Facebooker 1.0.70 (tries on 1.0.69 too) and passenger 2.2.11. Any hints?

    Read the article

  • Make Sphinx generate RST class documentation from pydoc

    - by Michal Cihar
    I'm currently migrating all existing (incomplete) documentation to Sphinx. The problem is that the documentation uses Python docstrings (the module is written in C, but it probably does not matter) and the class documentation must be converted into a form usable for Sphinx. There is sphinx.ext.autodoc, but it automatically puts current docstrings to the document. I want to generate source (RST) file based on current docstrings, which I could edit and improve manually. How would you transform docstrings into RST for Sphinx?

    Read the article

  • SQL GROUP BY - also SELECT not-constant columns

    - by Michal Kosek
    can someone please help me with this query? I have 2 tables in my database: log_visitors: -------------------- id | host_id log_access: -------------------- visitor | document | timestamp "log_access.visitor" links to "log_visitors.id" Currently, I'm using this query: SELECT log_visitors.host_id , MIM(log_access.timestamp) AS min_timestamp FROM log_access INNER JOIN log_visitors ON (log_access.visitor = log_visitors.id) GROUP BY log_visitors.host_id; to get "MIN(timestamp)" for each "host_id" in the database. HERE'S MY QUESTION: I also need to get "document" for that access with that timestamp... I can't simply add "log_access.document" into SELECT list, since it's not constant and I am not grouping by document... Any ideas?

    Read the article

  • Scala on the CLR

    - by Michal Bendowski
    The Scala homepage says that Scala 1.4 was runnable on the .NET framework - what is the status of Scala on the CLR now? Is anyone working on it? I think it would make a great GUI tool combined with GTK# and Mono...

    Read the article

  • Make Sphinx generate me rst for class documentation from pydoc

    - by Michal Cihar
    I'm currently in process of migrating existing (non complete) documentation to Sphinx. The final goal is to have all documentation in Sphinx. The problem I'm facing right now is that I have some documentation using Python docstrings (well the module is actually written in C, but it probably does not matter) and I would like to generate class documentation in form usable for Sphinx from these docstrings. I know there is sphinx.ext.autodoc, but it automatically puts current docstrings to the document. I rather want to generate source (rst) file based on current docstrings, which I could edit and improve manually. So is there some way to turn existing docstrings into rst form which Sphinx consumes?

    Read the article

  • What are the virtues of using XML comments in .NET?

    - by Michal Czardybon
    I can't understand the virtues of using XML comments. I know they can be converted into nice documentation external to the code, but the same can be achieved with the much more concise DOxygen syntax. In my opinion the XML comments are wrong, because: They obfuscate the comments and the code in general. (They are more difficult to read by humans). Less code can be viewed on a single screen, because "summary" and "/summary" take additional lines. They suggest that all method parameters have to be commented, whereas 90% of them are obvious and SHOULD be left not commented. The only problem I have with this is that my point of view seems to be in minority. Why?

    Read the article

  • How to organize makefiles / solutions etc. in multiplatform projects?

    - by Michal Czardybon
    I have a project which can be compiled with Visual Studio, GCC and with some embedded compilers. Sources are shared, but each platform requires separate makefiles, project files, solutions etc. There are two ways I can organize them: Intermixed in a single hierarchy of folders With separate folders for platform-dependent files The first solution creates some confusion about which file belongs to which platform, but the second causes some repetition of the folders structure (some compilers require each project to have a separate folder). Which do you think is better?

    Read the article

  • Problem with displaying graphs on a Qt canvas

    - by Michal Nowotka
    Let's say I'm a Qt newbie. I want a good Qt library for displaying simple graphs. I've found the quanava library. But there is a problem. When I compiled a basic example it looks like graph edges are not painted properly when moving nodes. I don't have any idea where is a bug but this code seems to be rather simple. I think this is a problem with paint method in NodeItem class. Maybe someone has already solved this problem because this library is quite popular.

    Read the article

  • Do you know of a log4net appender which rolls on date, but let's you limit the total number of files

    - by Michal Drozdowicz
    Hi, I need to define an appender for log4net in a way that I get one log file for each day, but the total number of files are limited to, let's say, 30. That is I want to keep only the logs not older then 30 days, delete the older ones. I've tried doing it with RollingFileAppender, but it seems that specifying a limit of files to keep is not supported. Do you know of an alternative solution that I could use?

    Read the article

  • Changing the color of dot depending from value on Morris js graph

    - by Michal Lipa
    Im rendering graph by morris js. Im using data from mysql database by JSON. Everything works fine, but I would like to add one more feature to the graph. (change dot color if there is something in buy action). My JSON: [{"longdate":"2014-08-20 18:20:01","price":"1620","action":"buy"},{"longdate":"2014-08-20 18:40:01","price":"1640","action":""},{"longdate":"2014-08-20 19:00:01","price":"1620","action":""}] So I would like to change dot color for values with buy action. My code for graph: $.getJSON('results.json', function(day_data) { Morris.Line({ element: 'graph', data: day_data, xkey: 'longdate', ykeys: ['price'], labels: ['Cena'], lineColors: lineColor, pointSize: 0, hoverCallback: function(index, options, content) { var date = "<b><font color='black'>Data: "+day_data[index]['longdate']+"</font></b><br>"; var param1 = "<font color='"+lineColor[0]+"'>Cena - "+day_data[index]['price']+"</font><br>"; return date+param1; }, xLabelFormat : function (x) { return changeDateFormat(x); } /*My TRIAL if(action == 'buy'){ pointSize: 4, lineColors: green, } */ }); }); So my code doesnt work, how can I make this working?

    Read the article

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