Daily Archives

Articles indexed Monday April 26 2010

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

  • Formatting made easy - Silverlight 4

    - by PeterTweed
    One of the simplest tasks in business apps is displaying different types of data to be read in the format that the user expects them.  In Silverlight versions until Silverlight 4 this has meant using a Converter to format data during binding.  This involves writing code for the formatting of the data to bind, instead of simply defining the formatting to use for the data in question where you bind the data to the control.   In Silverlight 4 we find the addition of the StringFormat markup extension that allows us to do exactly this.  Of course the nice thing is the ability to use the common formatting conventions available in C# through the String.Format function.   This post will show you how to use three of the common formatting conventions - currency, a defined number of decimal places for a number and a date format.   Steps:   1. Create a new Silverlight 4 application   2. In the body of the MainPage.xaml.cs file replace the MainPage class with the following code:       public partial class MainPage : UserControl     {         public MainPage()         {             InitializeComponent();             this.Loaded += new RoutedEventHandler(MainPage_Loaded);         }           void MainPage_Loaded(object sender, RoutedEventArgs e)         {             info i = new info() { PriceValue = new Decimal(9.2567), DoubleValue = 1.2345678, DateValue = DateTime.Now };             this.DataContext = i;         }     }         public class info     {         public decimal PriceValue { get; set; }         public double DoubleValue { get; set; }         public DateTime DateValue { get; set; }     }   This code defines a class called info with different data types for the three properties.  A new instance of the class is created and bound to the DataContext of the page.   3.  In the MainPage.xaml file copy the following XAML into the LayoutRoot grid:           <Grid.RowDefinitions>             <RowDefinition Height="60*" />             <RowDefinition Height="28*" />             <RowDefinition Height="28*" />             <RowDefinition Height="30*" />             <RowDefinition Height="154*" />         </Grid.RowDefinitions>         <Grid.ColumnDefinitions>             <ColumnDefinition Width="86*" />             <ColumnDefinition Width="314*" />         </Grid.ColumnDefinitions>         <TextBlock Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock1" Text="Price Value:" VerticalAlignment="Top" />         <TextBlock Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock2" Text="Decimal Value:" VerticalAlignment="Top" />         <TextBlock Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="32,0,0,0" Name="textBlock3" Text="Date Value:" VerticalAlignment="Top" />         <TextBlock Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Name="textBlock4" Text="{Binding PriceValue, StringFormat='C'}" VerticalAlignment="Top" Margin="6,0,0,0" />         <TextBlock Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" Name="textBlock5" Text="{Binding DoubleValue, StringFormat='N3'}" VerticalAlignment="Top" />         <TextBlock Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="6,0,0,0" Name="textBlock6" Text="{Binding DateValue, StringFormat='yyyy MMM dd'}" VerticalAlignment="Top" />   This XAML defines three textblocks that use the StringFormat markup extension.  The three examples use the C for currency, N3 for a number with 3 decimal places and yyy MM dd for a date that displays year 3 letter month and 2 number date.   4. Run the application and see the data displayed with the correct formatting. It's that easy!

    Read the article

  • Wordpress Widget Redirect Page

    - by Ajith
    I already created a wordpress widget for adding some featured from admin panel.I need to redirect to another page from this widget.But,when i am try to use header() method which shows a warning some thing like header already send by output....an do on.Is there any other method to redirect from wordpress widget?Please help me

    Read the article

  • Form Input Gets 1 Word

    - by 01010011
    Hi Using Codeigniter, how do I get and display, from my controller, all of the text a user entered into a text field on a view? I only get the first word, and nothing after the spaces. Here are my form_validation rules $this->form_validation->set_rules( 'field_name','Field Name','trim|required|alpha_numeric|tolower|xss_clean'); And here is my controller public function my_method() { if ($this->input->post()) { $name = $this->input->post('search'); echo $name; } } and my view ?php echo form_open('my_controller/my_method'); ?> <?php echo form_input('search'); ?> <?php echo form_submit('submit', 'Search'); ?>

    Read the article

  • python packaging problem

    - by Apache
    hi expert, I develop code in python to scan wifi and send to the server, it's working fine when executed manually, but i packaged it via http://www.python-packager.com by uploading my .py file and they create package for me as deb file for linux, and i download it and install the package but nothing happen when i click the .exe or set it as startup application. Why does this happen? Nothing is printed in the terminal. In .py file i'm having print statement to check manually to list out the wifi scan value, data to post to the server, response from the server once send. How this can be solved? thanks

    Read the article

  • Flex Drawing Library

    - by Evgeny Nacu
    Do you know any simple drawing libraries with align support (one component to other, also align to grid) I would like to implement simple editor of wall configuration in the apartments, by the way. Or, may be, there is no such component and is better to use Graphics class?

    Read the article

  • Asp.net loading a file encounters "Access to the path … is denied" in development on Windows 7

    - by ray247
    Hi there, I have an Asp.net app that simply reads an xml file and this code used to work fine on Vista with VS2008, now I just moved to Windows 7 and I migrated the code to VS2010, I encoutered “Access to the path [path to my webapp folder] is denied". Nothing else is changed, I tried to change folder perms even though I didn't think it got anything to do with that since the same code used to work fine, but still didn't get around this problem. Could someone please shed some light on why this may be happening and how to fix it? Thanks, Ray.

    Read the article

  • No speed-up with useless printf's using OpenMP

    - by t2k32316
    I just wrote my first OpenMP program that parallelizes a simple for loop. I ran the code on my dual core machine and saw some speed up when going from 1 thread to 2 threads. However, I ran the same code on a school linux server and saw no speed-up. After trying different things, I finally realized that removing some useless printf statements caused the code to have significant speed-up. Below is the main part of the code that I parallelized: #pragma omp parallel for private(i) for(i = 2; i <= n; i++) { printf("useless statement"); prime[i-2] = is_prime(i); } I guess that the implementation of printf has significant overhead that OpenMP must be duplicating with each thread. What causes this overhead and why can OpenMP not overcome it?

    Read the article

  • XImage - how to resize?

    - by Ajan
    I've got an XImage retrieved by XShmGetImage function. How can I resize it? Is there any function in X11 libraries to perform this operation or I need to use external library?

    Read the article

  • CoverFlow- Flip when selected

    - by Suresh Varma
    Hello all... i am working on an application which uses the iPod like application in iPhone.. I have implemented the Coverflow. But the main problem now is when we select any image it must flip and then i have to display the detail of that image... and when clicked on detail it must flip again and the same image must get displayed... Working on this from a long but still no success.. Please help.. Thanx in advance.. Note: if the question is unclear or if u want any code regarding please ask i will post it over her..

    Read the article

  • using document() function in .NET XSLT generates error

    - by Simon
    I'd like to use embedded resources in my XSLT file, but while invoking 'document(...)' C# complains that "Error during loading document ..." I'd like to use defined resources in XSLT file and get them by this: "document('')//my:resources/"... How can i do that?? ex xsl: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="xslt-gruper-v1.2.xsl" exclude-result-prefixes="my"> <my:resources> <one>tryb</one> </my:resources> <xsl:variable name="res" select="document('')/*/my:resources/("/> </xsl:stylesheet> How can i get access to such structure without exceptions in C#? I'll add that during static transform via ex. Opera everything works fine.

    Read the article

  • ASPNET MVC what do you call this, a partial view? Or something else?

    - by JK
    I'm trying to google for info on a situation, but I dont know what it is called, so its hard to find results :) I have a model with say 10 fields. But only some of those are shown on a particular view, lets say 3 of them: id, name, date. What do you call this kind of view that does not display the whole model? A partial view? The problem is that because 7 fields are not sent to the view, when the Update action is called on the controller, those fields are null, and the DB gets updated with those 7 fields set to null.

    Read the article

  • Recovering/Creating NewWorld Partition on Mac G4 (PPC) after botched Debian Install

    - by Luis Espinal
    I was trying to install Debian 5.04 on a Mac G4, and in typical geek tradition, I didn't RTFM. During installation, I nuked all existing partitions, creating new to my liking. But as I learned later during the installation process, yaboot needed a NewWorld partition, so I can't boot the installation. I don't have any OSX CDs with me (this is a used G4 I purchased of craigslist) with which to create a HFS partition. I've re-run the Debian installer, which lets me create a partition that is supposed to be of type 'NewWorld', but the installer does not seem to like it or recognizes it. Any ideas how to proceed from here? Thanks.

    Read the article

  • Applying the same function to each object of an array in objective-c

    - by sagar
    Hey ! every one. I am having some query regarding Objective-c. Let's have a look to following code. NSArray *ar=[scrPDFPage subviews]; int i; for (i=0; i<[ar count]; i++) { [(UIView*)[ar objectAtIndex:i] removeFromSuperview]; } now my queries are as follows, Instead of rotating a loop, isn't there an option like, [ar applyFunctionToObjects:@selector(myFunction:)] Isn't there any option like [myView removeAllSubViews]; ( According to my knowledge, there is no option like remove all sub views, but in case you might know. ) Thanks in advance for sharing your knowledge. Sagar.

    Read the article

  • When a professional should plan to leave a job ?

    - by Indigo Praveen
    Hi All, I don't know whether this should be asked or not but I think it happens with every programmer in his/her career. The question is when should someone start for looking another job. Some guys remain in one company for 10-15-20 years, mostlay in Europe. But if we see the trend in India guys are changing their jobs only in 1-2 years. If it's happening in India then there must be something behind it. So, I want to know the impacts on someone's career of changing jobs frequently. Please share your experiences.

    Read the article

  • Idenifying the Ipaddress of the Folders in the BLuehost server.....

    - by Aruna
    Hi, we have hosted our site in Bluehost server.We are having 2 websites running by bluehost server. In our bluehost server-file manager we have 2 separate folders namely abc,xyz which is pointing to the site abc.com and xyz.com . I dont know how to find the Ipaddress of those folders. Note: We faced some prblms in abc.com and we have redirected abc.com to xyz.com. I am trying to find the IP address of abc.com and xyz.com .. How to find so in the bluehost server.

    Read the article

  • php sorting a seriously multidimensional array...

    - by BigDogsBarking
    I'm trying to sort a multidimensional object, and, after looking on php.net and around here, I get that I should write a function that I can then call via usort. I'm having some trouble with the syntax. I haven't ever written something this complicated before, and trying to figure it out feels like a mindbender... I'm working with the array posted at the end of this post. I want to filter out duplicate [n] values. But, and this is the tricky part for me, I want to keep the [n] value that has the smallest [d] value. So, if I have (and this example is simplified, the real array is at the end of this post): Array ( [7777] => Array ( [0] => Array ( [n] => '12345' [d] => 1 ) [1] => Array ( [n] => '67890' [d] => 4 ) ) [8888] => Array ( [2] => Array ( [n] => '12345' [d] => 10 ) [3] => Array ( [n] => '67890' [d] => 2 ) ) ) I want to filter out duplicate [n] values based on the [d] value, so that I wind up with this: Array ( [7777] => Array ( [0] => Array ( [n] => '12345' [d] => 1 ) ) [8888] => Array [3] => Array ( [n] => '67890' [d] => 2 ) ) ) I've tried writing different variations of the function cmp example posted on php.net, but I haven't been able to get any to work, and I think it's because I'm not altogether clear on how to traverse it using their example... I tried: function cmp($a, $b) { if($a['n'] == $b['n']) { if($a['d'] == $b['d']) { return 0; } } return ($a['n'] < $b['n']) ? -1 : 1; } But, that really did not work at all... Anyway, here's the real array I'm trying to work with... Help is greatly appreciated! Array ( [32112] => Array ( [0] => Array ( [n] => '02124' [d] => '0' ) [1] => Array ( [n] => '02124' [d] => '0.240101905123744' ) [2] => Array ( [n] => '11050' [d] => '0.441758632682761' ) [3] => Array ( [n] => '02186' [d] => '0.317514080260304' ) ) [43434] => Array ( [4] => Array ( [n] => '02124' [d] => '5.89936971664429e-05' ) [5] => Array ( [n] => '02124' [d] => '0.145859264792549' ) [6] => Array ( [n] => '11050' [d] => '0.327864593457739' ) [7] => Array ( [n] => '11050' [d] => '0.312135345168295' ) ) )

    Read the article

  • JQuery error: XML filter is applied to non-XML value (function (E, F) {return new (o.fn.init)(E, F);

    - by morpheous
    I am getting this slightly cryptic error message: XML filter is applied to non-XML value (function (E, F) {return new (o.fn.init)(E, F);}) when I run this code snippet function justDoIt(arg){ msg = arg.msg; if(arg.ok) jQuery.(".action-button").each(function(idx,el){jQuery(this).removeClass('enabled');} ); } arg is a JSON format response form the server. Anyone knows how to fix this?

    Read the article

  • Crystal Report - Report Header Section

    - by Sheetal
    Hi, I have created a Report using Crystal Report(Visual Studio 2005 and .NET Framework 2.0). In the Report Header section I have added a TextBox control to display header for the report. But when I execute the application the Text in the Report Header section is not displayed. What should I do to view the text entered in the report header section? Thanks in advance!

    Read the article

  • VS 2010 Profiling Problem with Signed Assemblies

    - by Binder
    I have a website that uses AjaxControlToolkit.dll and Log4Net.dll; When I try to run the performance profiling tool in VS 2010 on it it gives me the following warnings "AjaxControlToolkit.dll is signed and instrumenting it will invalidate its signature. If you proceed without a post-instrument event to re-sign the binary it may not load correctly". Now, if I choose the option to continue without re-signing the profiling starts but the assembly doesn't load and gives an ASP.NET exception.

    Read the article

  • How to mount a drive in Ubuntu from terminal

    - by Mirage
    hi, I want to mount a drive from terminal at start up. At start if i use ls /media then its empty but if i go to computer and then click VM drive there and after that i use ls /media then it shows VM drive . How can i mount that drive at from terminal something like mount VM or how can find the path of VM like /dev/sda or something

    Read the article

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