Daily Archives

Articles indexed Friday May 21 2010

Page 12/114 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Reverse Two Consecutive Lines

    - by thebourneid
    I have this part of a code for editing cue sheets and I don't know how to reverse two consecutive lines if found: /^TITLE.*?"$/ /^PERFORMER.*?"$/ to reverse to /^PERFORMER.*?"$/ /^TITLE.*?"$/ What would it be the solution in my case? use strict; use warnings; use File::Find; use Tie::File; my $dir_target = 'test'; find(\&c, $dir_target); sub c { /\.cue$/ or return; my $fn = $File::Find::name; tie my @lines, 'Tie::File', $fn or die "could not tie file: $!"; for (my $i = 0; $i < @lines; $i++) { if ($lines[$i] =~ /^REM (DATE|GENRE|REPLAYGAIN).*?$/) { splice(@lines, $i, 3); } if ($lines[$i] =~ /^\s+REPLAYGAIN.*?$/) { splice(@lines, $i, 1); } } untie @lines; }

    Read the article

  • Should my connected web parts support IWebPartField, IWebPartRow and IWebPartData?

    - by Javaman59
    I've been writing some simple webparts, and they communicate via a custom interface type. That's working fine. I've got one ConnectionProvider, with a variety of ConnectionConsumers. I see that the OOTB SharePoint webparts provide many standard connections, apparently through IWebPartField and IWebPartRow (IWebPartData seems less supported). I've tried to add a IWebPartRow interface to a provider, and found that it's not actually useful (apparently), unless it's shareing data that the OOTB components use, such as images, urls and users. Well, that's the impression I got, anyway... I've only done a quick experiment, and found it quite difficult to implement and test. Is there any point in spending time trying to add support for the standard webpart interfaces?

    Read the article

  • MemoryStream and BitmapSource

    - by Vinjamuri
    I have a MemoryStream of 10K which was created from a bitmap of 2MB and compressed using JPEG. Since MemoryStream can’t directly be placed in System.Windows.Controls.Image for the GUI, I am using the following intermediate code to convert this back to BitmapImage and eventually System.Windows.Controls.Image. System.Windows.Controls.Image image = new System.Windows.Controls.Image(); BitmapImage imageSource = new BitmapImage(); s.SlideInformation.Thumbnail.Seek(0, SeekOrigin.Begin); imageSource.BeginInit(); imageSource.CacheOption = BitmapCacheOption.OnDemand; imageSource.CreateOptions = BitmapCreateOptions.DelayCreation; imageSource.StreamSource = s.SlideInformation.Thumbnail; imageSource.EndInit(); imageSource.Freeze(); image.Source = imageSource; ret = image.Source; My question is, when I store this in BitmapImage, the memory allocation is taking around 2MB. Is this expected? Is there any way to reduce the memory? I have around 300 thumbnails and this converstion takes around 600MB, which is very high. Appreciate your help!

    Read the article

  • PHP-GD: Dealing with Unicode characters

    - by sehugg
    I am developing a web service that renders characters using the PHP GD extension, using a user-selected TTF font. This works fine in ASCII-land, but there are a few problems: The string to be rendered comes in as UTF-8. I would like to limit the list of user-selectable fonts to be only those which can render the string properly, as some fonts only have glyphs for ASCII characters, ISO 8601, etc. In the case where some decorative characters are included, it would be fine to render the majority of characters in the selected font and render the decorative characters in Arial (or whatever font contains the extended glyphs). It does not seem like PHP-GD has support for querying the font metadata sufficiently to figure out if a character can be rendered in a given font. What is a good way to get font metrics into PHP? Is there a command-line utility that can dump in XML or other parsable format?

    Read the article

  • WPF: Binding with title and subitems

    - by John
    I am having some issues trying to learn WPF. What I am trying to do is to bind a class that has a string and an array of strings. I would like to bind the string as the title and array as the contents of an expander, but I am having difficulties. What am I missing to make this work? Any help would be appreciated, TIA. This is the code I have thus far: XAML <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <ListBox Grid.Column="0" Name="lbTopics" ItemsSource="{Binding}"> <ListBox.ItemTemplate> <DataTemplate> <Expander Header="{Binding Path=TopicName}" > <Expander.Content> <ListBox> <ListBox.ItemTemplate> <DataTemplate> <Label Content="{Binding Path=(ItemName)}" Width="120px" Height="32px" Foreground="Black" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Expander.Content> </Expander> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> C# namespace WpfApplication1 { public partial class Window1 : Window { public Window1() { InitializeComponent(); lbTopics.DataContext = new Topics(); } } public class Topics : ObservableCollection<Topic> { public Topics() { for (int i = 0; i < 10; i++) { this.Add(new Topic(i)); } } } public class Topic { public Topic(int i) { TopicName = "Topic " + i; ItemName = new List<string>(10); for (int j = 0; j < 10; j++) { ItemName.Add(i + " - Item " + j); } } public string TopicName { get; set; } public List<string> ItemName { get; set; } } }

    Read the article

  • SQL SERVER Simple Example of Snapshot Isolation ReducetheBlockingTransactions

    To learn any technology and move to a more advanced level, it is very important to understand the fundamentals of the subject first. Today, we will be talking about something which has been quite introduced a long time ago but not properly explored when it comes to the isolation level. Snapshot Isolation was introduced in [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • a whole new sellsbrothers.com

    The new sellsbrothers.com implementation has been a while in the making. In fact, I've had the final art in my hands since August of 2005. I've tried several times to sit down and rebuild my 15-year-old sellsbrothers.com completely from scratch using the latest tools. This time, I had a book contract ("Programming Data," Addison-Wesley, 2010) and I needed some real-world experience with Entity Framework 4.0 and OData, so I fired up Visual Studio 2010 a coupla months ago and went to...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How do you debug a XamlParseException?

    - by Craig Shearer
    I'm trying to use a 3rd party component in my Silverlight application and when I try to create an instance of the control, I get a XamlParseException: {System.Windows.Markup.XamlParseException: Set property 'System.Windows.FrameworkElement.Style' threw an exception. [Line: 0 Position: 0] --- System.Windows.Markup.XamlParseException: Elements in the same ResourceDictionary cannot have the same x:Key [Line: 1739 Position: 47] at MS.Internal.XcpImports.CreateFromXaml(UnmanagedMemoryStream stream, String sourceAssemblyName, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers) at System.Windows.Controls.Control.GetBuiltInStyle(IntPtr nativeTarget, IntPtr& nativeStyle) --- End of inner exception stack trace --- at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at SpellCheckerSample.StandardSpellDialog.InitializeComponent() at SpellCheckerSample.StandardSpellDialog..ctor()} How can I debug this? How do I know what file line 1739, Position 47 is in?

    Read the article

  • .NET Library to Identify Pitches

    - by Antoni
    I'd like to write a simple program(preferably in C#) to which I sing a pitch using a mic and the program identifies to which musical note that pitch corresponds. Thank you very much for your prompt responses. I clarify: I'd like a (preferably .NET) library that would identify the notes I sing. I'd like that such a library: Identifies a note when I sing(a note from the chromatic scale). Tells me how much I'm off from the closest note. I intend to use such a library to sing one note a time.

    Read the article

  • Problem of Three20: How to refresh TTLauncherItem

    - by WellBeing
    After adding TTLauncherItem into TTLauncherView, I want to change the image and title for the added TTLauncherItem? But when I changed the value of image and title, it was not working. There is no change on the view. Exit the program, and enter again, the image and title was changed. How can I refresh image and title of TTLauncherItem immediately? Thanks all~~

    Read the article

  • Develop Rails app on Mac using with TextMate Tutorial

    - by Meltemi
    I've found this a somewhat dated tutorial for developing a Rails application on Leopard with XCode. Wondering if anyone knows of a more up-to-date (ideally Mac based) tutorial that uses TextMate (or XCode if it's indeed preferred, or even just the command line). TextMate is appealing to me but wondering how to work scrips like ruby script/generate controller etc. into workflow or if switching between command-line & TextMate is standard operating procedure... If it matters were have Snow Leopard clients and Leopard Servers at our disposal. Thanks..

    Read the article

  • WinForms AcceptButton not working?

    - by Svish
    Ok, this is bugging me, and I just can't figure out what is wrong... I have made two forms. First form just has a simple button on it, which opens the other as a dialog like so: using (Form2 f = new Form2()) { if (f.ShowDialog() != DialogResult.OK) MessageBox.Show("Not OK"); else MessageBox.Show("OK"); } The second, which is that Form2, has two buttons on it. All I have done is to set the forms AcceptButton to one, and CancelButton to the other. In my head this is all that should be needed to make this work. But when I run it, I click on the button which opens up Form2. I can now click on the one set as CancelButton, and I get the "Not OK" message box. But when I click on the one set as AcceptButton, nothing happens? The InitializeComponent code of Form2 looks like this: private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(211, 13); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 0; this.button1.Text = "button1"; this.button1.UseVisualStyleBackColor = true; // // button2 // this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button2.Location = new System.Drawing.Point(130, 13); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 1; this.button2.Text = "button2"; this.button2.UseVisualStyleBackColor = true; // // Form2 // this.AcceptButton = this.button1; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.button2; this.ClientSize = new System.Drawing.Size(298, 59); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form2"; this.Text = "Form2"; this.Load += new System.EventHandler(this.Form2_Load); this.ResumeLayout(false); } I have done nothing else than add those two buttons, and set the AcceptButton and CancelButton. Why doesn't it work?

    Read the article

  • remine focus on the main activity (while switching activities)

    - by rayman
    Hi, Ive got two activities in the same application. the first one is with gui(main activity) the second one is a listener which works infinite without gui. Wierd problem occurs: i am running the second activity with a diffrent thread so i could keep on manipulate the gui.. but for some reason, the gui losing it's focus for some reason, only when i press 'home' and come back to it, then i can continune maniuplate the gui. it feels like after i launch the second activity, the gui activity(the main) is losing the focus. how come? in my mainactivity i have: setContentView(R.layout.main); and its setted as the launcher in the manifest. thanks, ray.

    Read the article

  • OpenGL-ES Texture Atlas. t axis is inverted.

    - by Feet
    I'm mapping a texture from my texture atlas to a square on a cube. For some reason, the t axis is inverted with 0 being at the top and 1 being at the bottom. Also, I have to specify the texture coordinates in clockwise order rather than counter-clockwise. I am using counter-clockwise windings. The vertices, indices and texture coordinates I'm using are below. float vertices[] = { // Front face -width, -height, depth, // 0 width, -height, depth, // 1 width, height, depth, // 2 -width, height, depth, // 3 // Back Face width, -height, -depth, // 4 -width, -height, -depth, // 5 -width, height, -depth, // 6 width, height, -depth, // 7 // Left face -width, -height, -depth, // 8 -width, -height, depth, // 9 -width, height, depth, // 10 -width, height, -depth, // 11 // Right face width, -height, depth, // 12 width, -height, -depth, // 13 width, height, -depth, // 14 width, height, depth, // 15 // Top face -width, height, depth, // 16 width, height, depth, // 17 width, height, -depth, // 18 -width, height, -depth, // 19 // Bottom face -width, -height, -depth, // 20 width, -height, -depth, // 21 width, -height, depth, // 22 -width, -height, depth, // 23 }; short indices[] = { // Front // Back 0,1,2, 0,2,3, 4,5,6, 4,6,7, // Left // Right 8,9,10, 8,10,11, 12,13,14, 12,14,15, // Top // Bottom 16,17,18, 16,18,19, 20,21,22, 20,22,23, }; float textures[] = { // Front 0.0f, 0.0f, 0.25f, 0.0f, 0.25f, 0.25f, 0.0f, 0.25f, // Back 0.25f, 0.0f, 0.50f, 0.0f, 0.50f, 0.25f, 0.25f, 0.25f, // Left 0.50f, 0.0f, 0.75f, 0.0f, 0.75f, 0.25f, 0.50f, 0.25f, // Right 0.75f, 0.0f, 1f, 0.0f, 1f, 0.25f, 0.75f, 0.25f, // Top 0.0f, 0.25f, 0.25f, 0.25f, 0.25f, 0.50f, 0.0f, 0.50f, // Bottom 0.25f, 0.25f, 0.50f, 0.25f, 0.50f, 0.50f, 0.25f, 0.50f, };

    Read the article

  • jQuery - Iframe validation - cannot get values

    - by Henry
    See demo: http://tinyurl.com/3xow97t The editor is under development. Now we check if it has an value - this works well with all form fields that have the class .required... but it does not work with the iframe. the iframe has a div with id #content. $('form .meet').focus(function() { $('iframe').each(function() { ** if($(this).contents().find('#content').val() == '') { ** $(this).addClass('warning'); } }) }); That means it should add the class .warning if the iframe is empty. But it always does, so what am i doing wrong? Does it not work, because the JS does not see the text i currently typed in? ^^ Regards Henry

    Read the article

  • Efficient persistent storage for simple id to table of values map for java

    - by wds
    I need to store some data that follows the simple pattern of mapping an "id" to a full table (with multiple rows) of several columns (i.e. some integer values [u, v, w]). The size of one of these tables would be a couple of KB. Basically what I need is to store a persistent cache of some intermediary results. This could quite easily be implemented as simple sql, but there's a couple of problems, namely I need to compress the size of this structure on disk as much as possible. (because of amount of values I'm storing) Also, it's not transactional, I just need to write once and simply read the contents of the entire table, so a relational DB isn't actually a very good fit. I was wondering if anyone had any good suggestions? For some reason I can't seem to come up with something decent atm. Especially something with an API in java would be nice.

    Read the article

  • New Bing Maps

    - by MikeParks
    Normally I don't stray too far from Programming and TFS on my blog posts but I'm just really impressed with how much Silverlight has improved Bing maps. I use to be big on MapQuest, then hopped over to Google, but now the new Bing Maps have everything I need. The two coolest features are right on the main page. All you have to do is go to http://www.bing.com/maps/explore/, enter your city and hit enter in the search box, then look in the lower left corner under the EXPLORE section. Check out the "What's nearby" and "Restaurants" links. The best part is, if you're interested in doing any Silverlight programming, they have a Bing Maps Silverlight Control Interactive SDK. I was thinking about coding something....but they've pretty much got it down :) Pretty impressive stuff.

    Read the article

  • IIS 6 ASP.NET default handler-mappings and virtual directories

    - by mlauter
    I'm having a problem with setting a default mapping in IIS 6. I want to secure *.HTML files with ASP.NET forms authentication. The problem seems to have something to do with using virtual directories to hold the html files. Here's how it's setup: sample directory tree c:/inetpub/ (nothing in here) d:/web_files/my_web_apps d:/web_files/my_web_apps/app1/ d:/web_files/my_web_apps/app2/ d:/web_files/my_web_apps/html_files/ app1 and app2 both access the same html_files directory, so html_files is set as a virtual directory in the web apps in IIS... sample web directory tree //app1/html_files/ (points to physical directory: d:/web_files/my_web_apps/html_files/) //app2/html_files/ (points to physical directory: d:/web_files/my_web_apps/html_files/) If I put a file called test.html in the root of //app1/ and then add the default mapping to the asp.net dll and setup my security on the root folder with deny="?", then accessing test.html works exactly as expected. If I'm not authenticated, it takes me to the login.aspx page, and if I am authenticated then it displays test.html. If I put the test.html file in the html_files directory I get a totally different behavior. Now the login.aspx page loads and I stuck some code in to check if I was still authenticated: <p>autheticated: <%=User.Identity.IsAuthenticated%></p> I figured it would say false because why else would it bother to load the login page? Nope, it says true - so it knows i'm authenticated, but it won't give me access to the test.html file. I've spent several hours on this and haven't been able to solve it. I'm going to spend some more time on google to see if I've missed something. Fingers crossed.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >