Daily Archives

Articles indexed Friday May 7 2010

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

  • Hibernate Subquery and DetachedCriteria

    - by dawez
    I have created a DetachedCriteria that is retrieving estates that have the isApproved and isPublished set to true. It is defined in this way: DetachedCriteria activePublishedCriteria = DetachedCriteria.forClass(Estate.class) .add(Restrictions.eq("isApproved", true)) .add(Restrictions.eq("isPublished", true)) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); I would like to reuse this criteria in some of the queries. In this case I would like to replace the isApproved and isPublished restrictions with the DetachedCriteria Criteria criteria = getSession().createCriteria(Estate.class) .createAlias("city", "c") .add(Restrictions.eq("c.id", cityID)) // the following 2 lines should be use the DetachedCriteria .add(Restrictions.eq("isApproved", true)) .add(Restrictions.eq("isPublished", true)) .setProjection(Projections.rowCount()); return (Integer) criteria.list().get(0); Is there a way to do this ? Tried to use .add.Subqueries.geAll(.... But cannot make it work properly. I could not find proper documentation on the Subqueries in Hibernate. Tips are welcomed.

    Read the article

  • Xdebug and a few remote_hosts

    - by hsz
    Hello ! I've got an apache server and I configured on it Xdebug. I set as xdebug.remote_host my IP address so it looks like: xdebug.remote_host=192.168.0.101 But I would like other computers also would be able to use Xdebug - how to set a few IP addresses from LAN ?

    Read the article

  • SQL Server stored procedure + set error message from the records of a table

    - by lucky
    Hello, My question is I have a table with the set of records. I am calling a stored procedure for some other purpose. But when ever it finds some duplicate records. It need to return as error message back to php. C1 C2 c3 abc 32 21.03.2010 def 35 04.04.2010 pqr 45 30.03.2010 abc 12 04.05.2010 xyz 56 01.03.2010 ghi 21 06.05.2010 def 47 17.02.2010 klm 93 04.03.2010 xyz 11 01.03.2010 For the above set it need to check for the records that has the same c1. The stored procedure should return as abc,def,xyz are duplicate. I tried something like this. This will not work it has more than 1 set of duplicate records. Please help me to enhance this to solve the purpose. SET @duplicate = (SELECT c1 FROM temp GROUP BY c1 HAVING count(c1) > 1) --Check for duplicate concession Nr. IF(len(@duplicate) > '1') BEGIN SET @error = @error + ' Duplicate C1 Number:- ' + @duplicate SET @errorcount = @errorcount + 1 END As this one type error I am checking for errorcount. IF @errorcount <> '0' BEGIN GOTO E_General_Error END -- If an error occurs, rollback and exit E_General_Error: PRINT 'Error' SET @error = @error IF @@error <> 0 SET @error = 'Database update failed' ROLLBACK TRANSACTION update_database RETURN END Now it is able to return Duplicate c1 number abc. If there are more than 1 problem comes. Thanks in advance!

    Read the article

  • Extjs Date Time Picker ,HighLight particular Date instead of system date

    - by vineth
    Hi, How to highlight the particular date in extjs calender(Date Time Picker) control, As default it will highlight the system date when its shows, i need to set highlight date as sql server date. since it will be different. Is there any property or override method to change the highlight date.!!! Note: Only highlight in the calender not to set that value to text box.

    Read the article

  • File upload issue

    - by Varun
    I am working on a PHP based, ticket management system. While creating a ticket, one can upload an attachment. I want to put a limit (say 10 MB) per file upload. To implement this I plan the following- 1. In php.ini set post_max_size = 10M 2.In PHP script which receives the POST- Since the file is larger than post_max_size, $_FILES[] will be empty. But I can still check the content-length header and discard the upload, if size more than 10M. While testing this I tried uploading a file of 1 GB and analysed the http traffic and this is what I found. - the entire 1 GB data is first uploaded to a to the server temporarily and discarded once the http request completes. Though I couldn't exactly find out where the file was getting saved(as it was not there in the temporary directory in the server.), but my http traffic analyzer showed that the browser did send 1 GB data to the server. - the PHP script execution started only after completion of the http request(i.e after uploading the entire 1 GB) Now I have 2 concerns: a) People may exploit my server bandwidth by trying to upload large file, which I will have to discard anyways. b) Even worse, if someone starts uploading a huge file (say 100 GB), entire 100 GB data is first uploaded to the server temporarily, that means for that period, it will consume that much of memory on my server. What's the common solution for this. Am I missing something here?

    Read the article

  • Wordpress Widget auto activate

    - by Erik Larsson
    Hello! Im new att widgets, but i have manage to write my own widget and get it to display correctly in my theme. The only problem i have now is that i want the widget to "auto activate" in the sidebar. So when the theme is installed on any wordpress installation the widget should be active so the user dosent need to drag it to the sidebar in admin. Is that possible?

    Read the article

  • Namespace and class conflict(?)

    - by dan gibson
    This is a bad title for the question, but I'm not quite sure of a better one. I have a namespace called Globals with a class X in it. I also have a class called Globals. When I try to access Globals.X.StaticMember it tries to access the class Globals.X and complains that X doesn't exist. How do I reference the namespace Globals - ie ::Globals.X.StaticMember (:: doesn't compile).

    Read the article

  • big cpu load on vmware server / linux

    - by dezfafara
    Hi, I currently using a server 2.x hosting 4 virtual machines on a linux system Today, on my physical server, I saw an enormous load average: this is the "top" of the server, illustrating my 4 virtual guests. top - 11:02:02 up 194 days, 23:09, 5 users, load average: 18.78, 12.05, 13.55 Tasks: 113 total, 4 running, 109 sleeping, 0 stopped, 0 zombie Cpu0 : 71.6%us, 19.0%sy, 0.0%ni, 8.8%id, 0.0%wa, 0.3%hi, 0.3%si, 0.0%st Cpu1 : 74.3%us, 10.4%sy, 0.0%ni, 15.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 72.5%us, 17.6%sy, 0.0%ni, 9.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu3 : 79.5%us, 4.6%sy, 0.0%ni, 16.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8178884k total, 8129980k used, 48904k free, 134904k buffers Swap: 10490436k total, 148k used, 10490288k free, 6129728k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 7312 root 6 -10 1149m 921m 559m R 97 11.5 107947:09 vmware-vmx 6995 root 6 -10 779m 687m 317m R 92 8.6 107374:31 vmware-vmx 6693 root 6 -10 880m 659m 409m S 85 8.3 76947:33 vmware-vmx 12937 root 6 -10 960m 719m 523m S 75 9.0 67219:49 vmware-vmx In bold are the cpu usage for my 4 virtuals guests These guests are running on a linux system, and the appropriate process are usually 5% - 15% of cpu I don't understang why , since a few days I have this big problem. This is the "top" on a virtual guest which is at 95% of cpu load top - 11:23:15 up 194 days, 23:13, 4 users, load average: 0.25, 0.47, 0.59 Tasks: 92 total, 2 running, 90 sleeping, 0 stopped, 0 zombie Cpu(s): 1.4%us, 7.7%sy, 0.0%ni, 90.5%id, 0.5%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 382296k total, 369732k used, 12564k free, 145156k buffers Swap: 979924k total, 13956k used, 965968k free, 86988k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3691 root 20 0 23948 1148 960 S 13.0 0.3 15339:23 vmware-guestd 3840 root 20 0 19880 584 512 S 7.7 0.2 1729:17 hald-addon-stor This virtual guest state is ok ... If anyone has any ideas .. Thanks

    Read the article

  • Mysterious newInstance method

    - by songsungkyun
    First I show some code. library: axis.jar, dom4j.jar jdk1.5, windowsXP T.java import java.io.StringWriter; import org.apache.axis.utils.StringUtils; import org.dom4j.DocumentHelper; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; public class T { public T() { System.out.println("constructor"); } public void test() { System.out.println(StringUtils.unescapeNumericChar("1")); } public String getPrettyXML(String xml) throws Exception { System.out.println("getPrettyXML"); StringWriter sw = new StringWriter(); XMLWriter writer = null; try { OutputFormat format = OutputFormat.createPrettyPrint(); org.dom4j.Document document = DocumentHelper.parseText(xml); writer = new XMLWriter(sw, format); writer.write(document); } catch (Exception e) { throw e; } finally { if (writer != null) { try { writer.close(); } catch (Exception e) { } } } return sw.toString(); } public void a() { System.out.println("a"); } public static void main(String[] args) { new T().test(); } } T2.java public class T2 { public static void main(String[] args) throws Exception { System.out.println("T2"); T t = (T) Class.forName("T").newInstance(); } } Ok, here we go... run as (Of course, I'm run at the directory where T.class, T1.class is) java T2 as you can see, not exist class path. ==console== T2 constructor OK... Now delete throw e line at the catch block on the "getPrettyXML" method of T. Ok, here we go.. run one more time without classpath java T2 You can see below... ==console== T2 Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/io/OutputFormat at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at T2.main(T2.java:5) I know that it's not very important for my life or your life. But it's so mysterisou to me, and my all curiosity. thanks.. ^^

    Read the article

  • Datagrid with fixed headers.

    - by Minal
    Hi! How to fixed datagrid header while scrolling. without using table for headers. Sample Code: <%# dgAPVender.PageSize * dgAPVender.CurrentPageIndex + Container.ItemIndex + 1 % ' ' Thanks, Minal Shah.

    Read the article

  • Drupal administration theme doesn't apply to Blocks pages (admin/build/block)

    - by hfidgen
    A site I'm creating for a customer in D6 has various images overlaying parts of the main content area. It looks very pretty and they have to be there for the general effect. The problem is, if you use this theme in the administration pages, the images get in the way of everything. My solution was to create a custom admin theme, based on the default one, which has these image areas disabled in the output template files - page.tpl.php The problem is that when you try and edit the blocks page, it uses the default theme and half the blocks admin settings are unclickable behind the images. I KNOW this is by design in Drupal, but it's annoying the hell out of me and is edging towards "bug" rather than "feature" in my mind. It also appears that there is no way of getting around it. You can edit /modules/blocks/block.admin.inc to force Drupal to show the blocks page in the chosen admin theme. BUT whichever changes you then make will not be transferred to the default theme, as Drupal treats each theme separately and each theme can have different block layouts. :x function block_admin_display($theme = NULL) { global $custom_theme; // If non-default theme configuration has been selected, set the custom theme. // $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland'); // Display admin theme $custom_theme = variable_get('admin_theme', '0'); // Fetch and sort blocks $blocks = _block_rehash(); usort($blocks, '_block_compare'); return drupal_get_form('block_admin_display_form', $blocks, $theme); } Can anyone help? the only thing I can think of is to push the $content area well below the areas where the image appear and use blocks only for content display. Thanks!

    Read the article

  • Noob question about a statement in a Java program

    - by happysoul
    I am beginner to java and was trying out this code puzzle from the book head first java which I solved as follows and got the output correct :D class DrumKit { boolean topHat=true; boolean snare=true; void playSnare() { System.out.println("bang bang ba-bang"); } void playTopHat() { System.out.println("ding ding da-ding"); } } public class DrumKitTestDriver { public static void main(String[] args) { DrumKit d =new DrumKit(); if(d.snare==true) { d.playSnare(); } d.playTopHat(); } } Output is :: bang bang ba-bang ding ding da-ding Now the problem is that in that code puzzle one code snippet is left that I did not include..it's as follows d.snare=false; Even though I did not write it , I got the output like the book. I am wondering why is there need for us to set it's value as false even when we know the code is gonna run without it too !?? I am wondering what the coder had in mind ..I mean what could be the possible future use and motive behind doing this ? I am sorry if it's a dumb question. I just wanna know why or why not to include that particular statement ? It's not like there's a loop or something that we need to come out of. Why is that statement there ?

    Read the article

  • Multiple ajax request and progress bar

    - by hunt
    Hi, In a following piece of code i am create a progress bar and showing its progress as the ajax request get processed. i am faking the progress shown here just by adding 5 in to cnt counter variable after that i made a check when counter reach to 90. at this point if the request is not executed successfully then i will pause/disable the progress bar and whenever response come i will complete the whole progress bar with 100. now the problem is i want to add multiple progress bar as i am firing multiple ajax request. so following is the code to implement only for one request and one progress bar but i want it for more than one. as global variables are used over here for checking response and timer id so i don't know how well i can handle it for multiple request var cnt=0; var res=null; function getProgress(data){ res=data; } var i =0; $('#start').click(function(){ i = setInterval(function() { if(res!=null) { clearInterval(i); $("#pb1").progressbar( "option", "value", cnt=cnt+100 ); } var value = $("#pb1").progressbar("option", "value"); if(value >=90 && res==null){ $("#pb1").progressbar("option", "disable"); } else{ $("#pb1").progressbar( "option", "value", cnt=cnt+5 ); } },2500); $.ajax({ url: 'http://localhost/beta/demo.php', success: getProgress }); }); $("#pb1").progressbar({ value: 0 , change: function(event, ui) { if(res!=null) clearInterval(i); } });

    Read the article

  • Vimeo Desktop App OAuth

    - by Barry
    Hi Guys, I'm currently having massive trouble with Vimeo's Oauth implementation and my desktop app. My program does the following correctly. 1- Requests a Unauthorized Request Token with my key and secret and returns - a Token and a Token secret. 2- Generates a URL for the user to go to using the token which then shows our application's name and allows the user to Authorize us to use his/her account. It then shows a verifier which the user returns and puts into our app. The problem is the third step and actually exchanging the tokens for the access tokens. Basically every time we try and get them we get a "Invalid / expired token - The oauth_token passed was either not valid or has expired" I looked at the documentation and there's supposed to be a callback to a server when deployed like that which gives the user an "authorized token" but as im developing a desktop app we can't do this. So I assume the token retrieved in 1 is valid for this step. (actually it seems it is: http://vimeo.com/forums/topic:22605) So I'm wondering now am I missing something here on my actual vimeo application account now? is it treating it as a web hosted app with callbacks? all the elements are there for this to work and I've used this same component to create a twitter Oauth login in exactly the same way and it was fine. Thanks in advance, Barry

    Read the article

  • use JQuery to get a list of classes

    - by John
    Hi I have a un-ordered (ul) html list. Each li item has 1 or more classes attached to it. I want to go through this ul list and get all the (distinct) classes. Then from this list create a list of checkboxes who's value matches that of the class and also who's label matches that of the class. One checkbox for each class. What is the best way to do this using JQuery? Thanks

    Read the article

  • Jquery show() not working in FF

    - by Andrea Zironda
    I have issues with FF & Jquery .show(). my website shows an embedded map from google in clicking a link.i have got a javascript function that handle this, in safari it works great.FF won't show the map. this is the js. function: function mostraPagina(nome){ if (nome='mappa'){ $('#mappa').load('contenuti/mappe/mappa_thiene.html'); $('#dark_background').show(600); $('#mappa').show(600); } } the embedded code from google maps is: <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Via+Murialdo,+4,+Thiene+italy&amp;sll=45.710686,11.475665&amp;sspn=0.002439,0.005676&amp;ie=UTF8&amp;hq=&amp;hnear=Via+Murialdo,+4,+36016+Thiene+Vicenza,+Veneto,+Italy&amp;ll=45.710222,11.475618&amp;spn=0.001219,0.002838&amp;t=h&amp;z=14&amp;output=embed"></iframe> thank you very much.

    Read the article

  • integrity Constraints on a table.

    - by Dinesh
    See this sample schema Passenger(id PK, Name) Plane(id PK, capacity, type); Flight(id PK, planeId FK(Plane), flightDate, StartLocation, destination) CREATE TABLE Reservation(PassengerId, flightId, PRIMARY KEY (passengerId, flightId), FOREIGN KEY (passengerId) REFERENCES Passenger, FOREIGN KEY (flightId) REFERENCES Flight); I need to define an integrity constraint that enforces the restriction that the number of passengers on a plane cannot exceed the plane’s capacity. I have tried and achieved so far is this. CREATE TABLE Reservation( passengerId INTEGER, flightId INTEGER, PRIMARY KEY (passengerId, flightId), FOREIGN KEY (passengerId) REFERENCES Passenger, FOREIGN KEY (flightId) REFERENCES Flight, Constraint check1 check(Not Exists(select * from Flight s, (select count(*) as totalRes from Reservation group by flightId) t where t.totalRes > s.capacity ) ) ); I am not sure i am doing in right way or not. Any suggestions?

    Read the article

  • Ordering the calling of asynchronous methods in c#

    - by Peter Kelly
    Hi, Say I have 4 classes ControllerClass MethodClass1 MethodClass2 MethodClass3 and each MethodClass has an asynchronous method DoStuff() and each has a CompletedEvent. The ControllerClass is responsible for invoking the 3 asynchronous methods on the 3 MethodClasses in a particular order. So ControllerClass invokes MethodClass1.DoStuff() and subscribes to MethodClass1.CompletedEvent. When that event is fired, ControllerClass invokes MethodClass2.DoStuff() and subscribes to MethodClass2.CompletedEvent. When that event is fired, the ControllerClass invokes MethodClass3.DoStuff() Is there a best practice for a situation like this? Is this bad design? I believe it is because I am finding it hard to unit test (a sure sign) It is not easy to change the order I have an uneasy, code-smell feeling about it What are the alternatives in a situation like this?

    Read the article

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