Daily Archives

Articles indexed Monday June 14 2010

Page 29/108 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Best way to search for a saturation value in a sorted list

    - by AB Kolan
    A question from Math Battle. This particular question was also asked to me in one of my job interviews. " A monkey has two coconuts. It is fooling around by throwing coconut down from the balconies of M-storey building. The monkey wants to know the lowest floor when coconut is broken. What is the minimal number of attempts needed to establish that fact? " Conditions: if a coconut is broken, you cannot reuse the same. You are left with only with the other coconut Possible approaches/strategies I can think of are Binary break ups & once you find the floor on which the coconut breaks use upcounting from the last found Binary break up lower index. Window/Slices of smaller sets of floors & use binary break up within the Window/Slice (but on the down side this would require a Slicing algorithm of it's own.) Wondering if there are any other way to do this.

    Read the article

  • WPF ContextMenu bind some property to another property of the same control

    - by bebicasoft
    I have a ContextMenu and a ColumnHeaderStyle defined in Window.Resource section witch i use-it to a DataGrid ColumnHeader. My code is something like this: <ContextMenu x:Key="cm_columnHeaderMenu"/> <Style x:Key="DefaultColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}"> <Setter Property="ContextMenu" Value="{StaticResource cm_columnHeaderMenu}" /> </Style> <DataGrid Grid.Column="2" Grid.Row="1" x:Name="dgridFiles" IsReadOnly="True" ColumnHeaderStyle="{StaticResource DefaultColumnHeaderStyle}"> I want to know if I can (and if the answer it true, then HOW I could do it) bind the ContextMenu Visibility property to same control ContextMenu Items.Count>0 property. Initially based on some other treeView control selections made there shoud be no items in the context menu, but i wish to add dinamically items in ContextMenu based on selection in treeView. This part is done, the context has those items. On some selections there are no-items, but still on the grid it appears an empty ContextMenu. So I believe the easiest part it would be to bind the Visibility to Items.Count property of the same control. Sorry if my english is not good enought, I'll try to explain better if i didnt make clear 1st time.

    Read the article

  • TFS 2008 warning when trying to add set-up project

    - by pm_2
    I have a similar problem to that mentioned here. However, mine is in TFS 2008. I get the following warning when trying to add a set-up project to an existing solution (either just create the set-up project or “add to source control”). The project that you are attempting to add to source control may cause other source control users to have difficulty opening this solution or getting newer versions of it. To avoid this problem, add the project from a location below the binding root of the other source controlled projects in the solution Continue / Cancel As with the question above, I think my folder structure is at fault. However, the current folder structure is as follows: Solution Main Project My guess is that, for some reason it’s trying to add the set-up project directly into the solution folder. So, is there a way to validate where it’s trying to add this without selecting “Continue” above? Alternatively, is there a way to force the set-up project to create in its own folder?

    Read the article

  • Is there a way to detect elements inside a parent element?

    - by Starx
    I would like to detect all the elements insides a parent element and still check if the child has child elements and detect them also. For Example: <div id="first"> <div id='second1'></div> <div id='second2'> <div id='third1'></div> <div id='third2'> <div id='fourth1'></div> <div id='fourth2'></div> </div> <div id='third3'></div> </div> <div id='second3'></div> <div id='second4'></div> </div> I want to know the list of all the id inside the #first and check each child if it has its child and keep this on going until I have complete list of all element.

    Read the article

  • Separating data from the UI code with Linq to SQL entities

    - by Sir Psycho
    If it's important to keep data access 'away' from business and presentation layers, what alternatives or approaches can I take so that my LINQ to SQL entities can stay in the data access layer? So far I seem to be simply duplicating the classes produced by sqlmetal, and passing those object around instead simply to keep the two layers appart. For example, I have a table in my DB called Books. If a user is creating a new book via the UI, the Book class generated by sqlmetal seems like a perfect fit although I'm tightly coupling my design by doing so.

    Read the article

  • How do I mirror a MySQL database?

    - by user366133
    I'm running two load balanced servers for one website, and I'd like the databases to be synchronized. Queries may be run on either of the two servers because they are both production sites, so the replication can't just work one way. It doesn't have to be in real-time, just fairly accurate so people don't notice a difference when they get switched to a different server.

    Read the article

  • How to deploy axis2 + MyBatis

    - by henry
    I am trying to do webservice (I am quite new in Webservice under java). I am using netbeans. Axis2 is having problem trying to locate the the xml configuration file for mybatis Anyone can tell me how to successfully deploy mybatis configuration. Should I manually copy the configuration under .netbeans\6.8\apache-tomcat-6.0.20_base\webapps\axis2\WEB-INF\classes or there is any other setting?

    Read the article

  • Broken console in Maven project using Netbeans

    - by Maciek Sawicki
    Hi, I have strange problem with my Neatens+Maven installation. This is the shortest code to reproduce the problem: public class App { public static void main( String[] args ) { // Create a scanner to read from keyboard Scanner scanner = new Scanner (System.in); Scanner s= new Scanner(System.in); String param= s.next(); System.out.println(param); } } When I'm running it as Maven Project inside Netbeans console seems to be broken. It just ignores my input. It's look like infinitive loop in System.out.println(param);. However this project works fine when it's compiled as "Java Aplication" project. It also works O.K. if I build and run it from cmd. System info: Os: Vista IDE: Netbeans 6.8 Maven: apache-maven-2.2.1 //edit Built program (using mavean from Netbeans) works fine. I just can't test it using Net beans. And I think I forgot to ask the question ;). So of course my first question is: how can I fix this problem? And second is: Is it any workaround for this? For example configuring Netbeans to run external commend line app instead of using built in console.

    Read the article

  • How do I mirror a MySQL database?

    - by user45745
    I'm running two load balanced servers for one website, and I'd like the databases to be synchronized. Queries may be run on either of the two servers because they are both production sites, so the replication can't just work one way. It doesn't have to be in real-time, just fairly accurate so people don't notice a difference when they get switched to a different server.

    Read the article

  • send email to single ExactTarget subscriber without TriggeredSend

    - by Max Gontar
    There is an email service ExactTarget with web service API. There are samples (in php though) for sending email to whole list instantly, or to single subscriber by triggered action. It's pretty hard to get in it's documentation, and I couldn't find explanation how to send email to a single subscriber instantly without having some triggering actions. Any help or advice will be great.

    Read the article

  • In Birt Reports - Displaying the most common string value in group.

    - by Ben
    For this example data: Index, State, Food 1, CA, Hamburger 2, NY, Lettuce 3, CA, Cheese 4, NY, Lettuce 5, NY, Cheese 6, AR, Cheese I would like to group by State and show the most common food for each state. So the result for the example should be: State, Popular Food CA, Hamburger NY, Lettuce AR, Cheese The problem is I can't find an aggregation that would return the most common string. There is the 'mode' function but it only works on integers. Am I missing Something? Thanks!

    Read the article

  • A better way of handling the below program(may be with Take/Skip/TakeWhile.. or anything better)

    - by Newbie
    I have a data table which has only one row. But it is having 44 columns. My task is to get the columns from the 4th row till the end. Henceforth, I have done the below program that suits my requirement. (kindly note that dt is the datatable) List<decimal> lstDr = new List<decimal>(); Enumerable.Range(0, dt.Columns.Count).ToList().ForEach(i => { if (i > 3) lstDr.Add(Convert.ToDecimal(dt.Rows[0][i])); } ); There is nothing harm in the program. Works fine. But I feel that there may be a better way of handimg the program may be with Skip ot Take or TakeWhile or anyother stuff. I am looking for a better solution that the one I implemented. Is it possible? I am using c#3.0 Thanks.

    Read the article

  • OutputPath ignored on projects being build by TFS 2010

    - by bovium
    I have installed TFS2010 Beta 2 with default settings and configured a CI build with a solution containing the indivial projects. My *.cspoj files could have: <OutputPath>bin\debug\</OutputPath> Or alternatively: <OutDir>bin\debug\</OutDir> When the build server is done building and running tests etc. all the assemblies are placed in the root of the build drop off folder. How do I configure the build to keep the outputpath or outdir in my projects and store the assemblies and content in the matching folder structure( builddropfolder\bin\debug\ )? I have found a number of post on this most of them relates to TFS 2008 but I have not found solutions for TFS 2010. Perhaps it is possible to solve this in the new workflow file for the buildserver?

    Read the article

  • WPF Storyboard works well, except for the first time it runs. Why?

    - by sofri
    Hi, I'm doing a Surface Application. And there I have something like a bulletin board where little cards with news on it are pinned on. On click they shall fly out of the board and scale bigger. My storyboard works well, except for the first time it runs. It's not a smooth animation then but it scales to its final size immediately and it's the same with the orientation-property. Just the center-property seems to behave correctly. This is an example for one of my Storyboards doing that: Storyboard stb = new Storyboard(); PointAnimation moveCenter = new PointAnimation(); DoubleAnimationUsingKeyFrames changeWidth = new DoubleAnimationUsingKeyFrames(); DoubleAnimationUsingKeyFrames changeHeight = new DoubleAnimationUsingKeyFrames(); DoubleAnimationUsingKeyFrames changeOrientation = new DoubleAnimationUsingKeyFrames(); moveCenter.From = News1.ActualCenter; moveCenter.To = new Point(250, 400); moveCenter.Duration = new Duration(TimeSpan.FromSeconds(1.0)); moveCenter.FillBehavior = FillBehavior.Stop; stb.Children.Add(moveCenter); Storyboard.SetTarget(moveCenter, News1); Storyboard.SetTargetProperty(moveCenter, new PropertyPath(ScatterViewItem.CenterProperty)); changeWidth.Duration = TimeSpan.FromSeconds(1); changeWidth.KeyFrames.Add(new EasingDoubleKeyFrame(266, KeyTime.FromTimeSpan(new System.TimeSpan(0, 0, 1)))); changeWidth.FillBehavior = FillBehavior.Stop; stb.Children.Add(changeWidth); Storyboard.SetTarget(changeWidth, News1); Storyboard.SetTargetProperty(changeWidth, new PropertyPath(FrameworkElement.WidthProperty)); changeHeight.Duration = TimeSpan.FromSeconds(1); changeHeight.KeyFrames.Add(new EasingDoubleKeyFrame(400, KeyTime.FromTimeSpan(new System.TimeSpan(0, 0, 1)))); changeHeight.FillBehavior = FillBehavior.Stop; stb.Children.Add(changeHeight); Storyboard.SetTarget(changeHeight, News1); Storyboard.SetTargetProperty(changeHeight, new PropertyPath(FrameworkElement.HeightProperty)); changeOrientation.Duration = TimeSpan.FromSeconds(1); changeOrientation.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(new System.TimeSpan(0, 0, 1)))); changeOrientation.FillBehavior = FillBehavior.Stop; stb.Children.Add(changeOrientation); Storyboard.SetTarget(changeOrientation, News1); Storyboard.SetTargetProperty(changeOrientation, new PropertyPath(ScatterViewItem.OrientationProperty)); stb.Begin(this); News1.Center = new Point(250, 400); News1.Orientation = 0; News1.Width = 266; News1.Height = 400; Pin1.Visibility = Visibility.Collapsed; news1IsOutside = true; Scroll1.IsEnabled = true; What's wrong with it?

    Read the article

  • Need for prefixing a function with (void)...

    - by puffadder
    Hi All, I recently came across a rather unusual coding convention wherein the call for a function returning "void" is prefixed with (void). e.g. (void) MyFunction(); Is it any different from the function call like: MyFunction(); Has it got any advantage or is it yet another needless but there coding convention of some sort?

    Read the article

  • clicking a button via javascript does not cause a post

    - by Andreas Niedermair
    hi there! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.js"></script> </head> <body> <form id="fooForm"> <script type="text/javascript"> function FooMethod() { alert('hello'); } var fooButton; var fooForm; $(document).ready(function() { InitializeVariables(); InitiliazeDialog(); InitiliazeForm(); }); function InitializeVariables() { fooButton = $('#fooButton'); fooForm = $('#fooForm'); } function InitiliazeDialog() { var dialog = $('<div/>'); dialog.css('display', 'none'); var content = $('<p/>'); var icon = $('<span/>'); icon.addClass('ui-icon ui-icon-alert'); icon.css('float', 'left'); icon.css('margin', '0px 7px 20px 0px'); content.text('do you really want to hurt me?'); icon.prependTo(content); content.appendTo(dialog); var dialogOpenMethod = function () { dialog.dialog('open'); return false; }; var dialogOpenHandlerMethod = function (event, ui) { var widget = dialog.dialog('widget'); widget.appendTo(fooForm); var overlay = widget.prev(); overlay.css('z-index', 999); overlay.appendTo(fooForm); widget.css('position', 'fixed'); widget.css('top', '50%'); widget.css('margin-top', widget.height() / 2 * -1); widget.css('left', '50%'); widget.css('margin-left', widget.width() / 2 * -1); }; var submitMethod = function () { dialog.dialog('option', 'closeOnEscape', false); var widget = dialog.dialog('widget'); var yesButton = $(':button:eq(0)', widget); var noButton = $(':button:eq(1)', widget); var closeButton = $('a.ui-dialog-titlebar-close', widget); noButton.remove(); closeButton.remove(); fooButton.unbind('click', dialogOpenMethod); fooButton.click(); }; dialog.dialog({ autoOpen: false, modal: true, buttons: { 'Ja': submitMethod, 'Nein': function () { dialog.dialog('close'); } }, open: dialogOpenHandlerMethod }); fooButton.bind('click', dialogOpenMethod); } function InitiliazeForm() { fooButton.button(); fooForm.submit(function () { alert('doing a submit'); }); } </script> <input type="submit" id="fooButton" value="submit it!" onclick="FooMethod();"></input> </form> </body> </html> what am i doing? i want a modal-confirmation: user clicks on button, confirmation "do you really want to...?", user clicks "yes", this click unbinds the original click-handler and clicks the button again (which should cause a submit). what/why is not working? indeed you need a special case. this demo won't work, unless you set modal: false. interesting to mention: the original handler (onclick="FooMethod();") is called in modal and non-modal dialog. can anybody help me out? thanks in advance! i also opened a ticket on jqueryUI for this

    Read the article

  • Offsite data storage for simple app, or a similar supported persistence mechanism?

    - by jdk
    Question Is there a usable facebook entry point to the Data Storage API that facebook lists on their app admin page for developers, or should I consider an alternate mechanism? What alternative mechanisms exist to simply persist my information offsite (away from my server app) without stuffing it into a cookie that's prone to expire? ... Background The facebook Data Store Admin tool is made available in a facebook App's Settings as seen here: (continue reading below) However when I visit the DataStoreAdmin link nothing works (i.e. clicking the buttons to define the data store types and objects does nothing - I have tried different browsers). The Wiki page for Data Store API hasn't been updated recently and the second last update says the beta Data Store was taken offline. It seems odd the link would be readily available and highly visible at the top of the App configuration area if indeed it's defunct. I was hoping some kind of key/value pair solution to remove the data calls from my own server.

    Read the article

  • Liferay - Custom Authentication Web Service

    - by Vishal G
    Hi, I want to use authentication web services that is exposed by my legacy client. But I cannot copy those user information in to liferay database. Can any one help me to write a custom authentication service OR a hook/plugin to reuse my own implementation for authentication? Regards Vishal G Pillai

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >