Daily Archives

Articles indexed Monday May 10 2010

Page 17/113 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • How do you code up a pattern matching code block in scala?

    - by egervari
    How do you code a function that takes in a block of code as a parameter that contains case statements? For instance, in my block of code, I don't want to do a match or a default case explicitly. I am looking something like this myApi { case Whatever() => // code for case 1 case SomethingElse() => // code for case 2 } And inside of my myApi(), it'll actually execute the code block and do the matches. Help?

    Read the article

  • .NET WebService IPC - Should it be done to minimise some expensive operations?

    - by Kyle
    I'm looking at a few different approaches to a problem: Client requests work, some stuff gets done, and a result (ok/error) is returned. A .NET web service definitely seems like the way to go, my only issue is that the "stuff" will involve building up and tearing down a session for each request. Does abstracting the "stuff" out to an app (which would keep a single session active, and process the request from the web service) seem like the right way to go? (and if so, what communication method) The work time is negligible, my concern is the hammering the transaction servers in question will probably get if I create/drop a session for each job. Is some form of IPC or socket based communication a feasible solution here? Thoughts/comments/experiences much appreciated. Edit: After a bit more research, it seems like hosting a WCF service in a Windows Service is probably a better way to go...

    Read the article

  • jquery get last ID of dynamic div

    - by Pjack
    Couldn't find an answer, but Im trying to get the last ID of the last div that was created on the page. The code I'm using doesn't seem to work using .last(). My syntax is probably wrong but I can't get it to show the ID. jQuery(document).ready(function() {jQuery("a.more_posts").live('click', function(event){ jQuery("div[id^='statuscontainer_']").last(); var id = parseInt(this.id.replace("statuscontainer_", "")); alert(id); }); });

    Read the article

  • How to draw QGraphicsItem in a MFC view

    - by user336969
    I'm starting using Qt in my application. My application is MFC based. I want to draw some QGraphicsItems in my currect MFC view, is it possible? You may say that it could be done by hosting QGraphicsView with QWinWidget in the MFC view, that don't work, however. Because my Canvas (MFC view) supports zooming and rotating while the QGraphicsView itself don't. When I zooming the QGraphicsItem, the QGraphicsView shows scroll bar instead of enlarging itself. Any suggestion? Thanks!

    Read the article

  • nHibernate Criteria API Projections

    - by Craig
    I have an entity that is like this public class Customer { public Customer() { Addresses = new List<Address>(); } public int CustomerId { get; set; } public string Name { get; set; } public IList<Address> Addresses { get; set; } } And I am trying to query it using the Criteria API like this. ICriteria query = m_CustomerRepository.Query() .CreateAlias("Address", "a", NHibernate.SqlCommand.JoinType.LeftOuterJoin); var result = query .SetProjection(Projections.Distinct( Projections.ProjectionList() .Add(Projections.Alias(Projections.Property("CustomerId"), "CustomerId")) .Add(Projections.Alias(Projections.Property("Name"), "Name")) .Add(Projections.Alias(Projections.Property("Addresses"), "Addresses")) )) .SetResultTransformer(new AliasToBeanResultTransformer(typeof(Customer))) .List<Customer>() as List<Customer>; When I run this query the Addresses property of the Customer object is null. Is there anyway to add a projection for this List property?

    Read the article

  • how to write barcode in html format when using tcpdf

    - by JewelThief
    I am using TCPDF to generate PDF file using following command $pdf-writeHTML($htmlcontent, true, 0, true, 0); TCPDF also provides a way to create barcode with following commands $pdf-Cell(0, 0, 'C39+', 0, 1); $pdf-write1DBarcode('Code 39', 'C39+', '', '', 80, 15, 0.4, $style, 'N'); $pdf-Ln(); I want to be able to write barcode as part of the HTML code above. Is there easy way? I can potentially call a barcode image inthe writeHTML code above, but not sure how to use above barcode function ( or any in TCPDF) which would allow me to create image and then get that image into HTML generation

    Read the article

  • c# Counter requires 2 button clicks to update

    - by marko.ivanovski.nz
    Hi, I have a problem that has been bugging me all day. In my code I have the following: private int rowCount { get { return (int)ViewState["rowCount"]; } set { ViewState["rowCount"] = value; } } and a button event protected void addRow_Click(object sender, EventArgs e) { rowCount = rowCount + 1; } Then on Page_Load I read that value and create controls accordingly. I understand the button event fires AFTER the Page_Load fires so the value isn't updated until the next postback. Real nightmare. Here's the entire code: protected void Page_Load(object sender, EventArgs e) { string xmlValue = ""; //To read a value from a database if (xmlValue.Length > 0) { if (!Page.IsPostBack) { DataSet ds = XMLToDataSet(xmlValue); Table dimensionsTable = DataSetToTable(ds); tablePanel.Controls.Add(dimensionsTable); DataTable dt = ds.Tables["Dimensions"]; rowCount = dt.Rows.Count; colCount = dt.Columns.Count; } else { tablePanel.Controls.Add(DataSetToTable(DefaultDataSet(rowCount, colCount))); } } else { if (!Page.IsPostBack) { rowCount = 2; colCount = 4; } tablePanel.Controls.Add(DataSetToTable(DefaultDataSet(rowCount, colCount))); } } protected void submit_Click(object sender, EventArgs e) { resultsLabel.Text = Server.HtmlEncode(DataSetToStringXML(TableToDataSet((Table)tablePanel.Controls[0]))); } protected void addColumn_Click(object sender, EventArgs e) { colCount = colCount + 1; } protected void addRow_Click(object sender, EventArgs e) { rowCount = rowCount + 1; } public DataSet TableToDataSet(Table table) { DataSet ds = new DataSet(); DataTable dt = new DataTable("Dimensions"); ds.Tables.Add(dt); //Add headers for (int i = 0; i < table.Rows[0].Cells.Count; i++) { DataColumn col = new DataColumn(); TextBox headerTxtBox = (TextBox)table.Rows[0].Cells[i].Controls[0]; col.ColumnName = headerTxtBox.Text; col.Caption = headerTxtBox.Text; dt.Columns.Add(col); } for (int i = 0; i < table.Rows.Count; i++) { DataRow valueRow = dt.NewRow(); for (int x = 0; x < table.Rows[i].Cells.Count; x++) { TextBox valueTextBox = (TextBox)table.Rows[i].Cells[x].Controls[0]; valueRow[x] = valueTextBox.Text; } dt.Rows.Add(valueRow); } return ds; } public Table DataSetToTable(DataSet ds) { DataTable dt = ds.Tables["Dimensions"]; Table newTable = new Table(); //Add headers TableRow headerRow = new TableRow(); for (int i = 0; i < dt.Columns.Count; i++) { TableCell headerCell = new TableCell(); TextBox headerTxtBox = new TextBox(); headerTxtBox.ID = "HeadersTxtBox" + i.ToString(); headerTxtBox.Font.Bold = true; headerTxtBox.Text = dt.Columns[i].ColumnName; headerCell.Controls.Add(headerTxtBox); headerRow.Cells.Add(headerCell); } newTable.Rows.Add(headerRow); //Add value rows for (int i = 0; i < dt.Rows.Count; i++) { TableRow valueRow = new TableRow(); for (int x = 0; x < dt.Columns.Count; x++) { TableCell valueCell = new TableCell(); TextBox valueTxtBox = new TextBox(); valueTxtBox.ID = "ValueTxtBox" + i.ToString() + i + x + x.ToString(); valueTxtBox.Text = dt.Rows[i][x].ToString(); valueCell.Controls.Add(valueTxtBox); valueRow.Cells.Add(valueCell); } newTable.Rows.Add(valueRow); } return newTable; } public DataSet DefaultDataSet(int rows, int cols) { DataSet ds = new DataSet(); DataTable dt = new DataTable("Dimensions"); ds.Tables.Add(dt); DataColumn nameCol = new DataColumn(); nameCol.Caption = "Name"; nameCol.ColumnName = "Name"; nameCol.DataType = System.Type.GetType("System.String"); dt.Columns.Add(nameCol); DataColumn widthCol = new DataColumn(); widthCol.Caption = "Width"; widthCol.ColumnName = "Width"; widthCol.DataType = System.Type.GetType("System.String"); dt.Columns.Add(widthCol); if (cols > 2) { DataColumn heightCol = new DataColumn(); heightCol.Caption = "Height"; heightCol.ColumnName = "Height"; heightCol.DataType = System.Type.GetType("System.String"); dt.Columns.Add(heightCol); } if (cols > 3) { DataColumn depthCol = new DataColumn(); depthCol.Caption = "Depth"; depthCol.ColumnName = "Depth"; depthCol.DataType = System.Type.GetType("System.String"); dt.Columns.Add(depthCol); } if (cols > 4) { int newColCount = cols - 4; for (int i = 0; i < newColCount; i++) { DataColumn newCol = new DataColumn(); newCol.Caption = "New " + i.ToString(); newCol.ColumnName = "New " + i.ToString(); newCol.DataType = System.Type.GetType("System.String"); dt.Columns.Add(newCol); } } for (int i = 0; i < rows; i++) { DataRow newRow = dt.NewRow(); newRow["Name"] = "Name " + i.ToString(); newRow["Width"] = "Width " + i.ToString(); if (cols > 2) { newRow["Height"] = "Height " + i.ToString(); } if (cols > 3) { newRow["Depth"] = "Depth " + i.ToString(); } dt.Rows.Add(newRow); } return ds; } public DataSet XMLToDataSet(string xml) { StringReader sr = new StringReader(xml); DataSet ds = new DataSet(); ds.ReadXml(sr); return ds; } public string DataSetToStringXML(DataSet ds) { XmlDocument _XMLDoc = new XmlDocument(); _XMLDoc.LoadXml(ds.GetXml()); StringWriter sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); XmlDocument xml = _XMLDoc; xml.WriteTo(xw); return sw.ToString(); } private int rowCount { get { return (int)ViewState["rowCount"]; } set { ViewState["rowCount"] = value; } } private int colCount { get { return (int)ViewState["colCount"]; } set { ViewState["colCount"] = value; } } Thanks in advance, Marko

    Read the article

  • LLBLGen Pro v2.6 designer issue

    - by Luis
    How do you delete more than one entity at the same time in the designer Entities list. it seems that the designer interface only allows the selection of 1 entity at a time.... This is frustrating, is this possible? Or even deleting all entities? Thanks Regards Luis

    Read the article

  • Giving event control back to xaml/callee to access check/uncheck

    - by dovholuk
    Hi All, I've scoured the Internet but my search-foo must not work if it's out there cause I just can't find the proper search terms to get me the answer I am looking for. So I turn to the experts here as a last resort to point me in the right direction. What I'm trying to do is create a composite control of a text box and a list box but I want to allow the control consumer to decide what to do when say the checkbox is checked/unchecked and I just can't figure it out... Maybe i'm going about it all wrong. What I've done thus far is to: create a custom control that extends ListBox expose a custom DP named "Text" (for the Text box but it's not the important part) craft the generic.xaml so that the list items have a default ItemTemplate/DataTemplate inside the DataTemplate I'm trying to set the "Checked" or "Unchecked" events expose 'wrapper' events as DPs in the custom control that would get 'set' via the template when instatiated As soon as I try something like the following (inside generic.xaml): <DataTemplate> <...> <CheckBox Checked="{TemplateBinding MyCheckedDP}"/> <...> </DataTemplate> I get runtime exceptions, the designer - vs2010 - pukes out a LONG list of errors that are all very similar and nothing I do can make it work. I went so far as to try using the VisualTreeHelper but no magic combination I could find would work nor would it allow me to traverse the tree because when the OnApplyTemplate method fires the listbox items don't exist yet and aren't in the tree. So hopefully this all makes sense but if not please let me know and I'll edit the post for clarifications. Thanks to all for any pointers or thoughts... Like I said maybe I'm heading about it in the wrong way from the start... EDIT (Request for xaml) generic.xaml datatemplate: <DataTemplate > <StackPanel Orientation="Horizontal" > <local:FilterCheckbox x:Name="chk"> <TextBlock Text="{Binding Path=Display}" /> </local:FilterCheckbox> </StackPanel> </DataTemplate> usercontrol.xaml (invocation of custom control) <local:MyControl FancyName="This is the fancy name" ItemChecked="DoThisWhenACheckboxIsChecked" <-- this is where the consumer "ties" to the checkbox events ItemsSource="{Binding Source={StaticResource someDataSource}}" />

    Read the article

  • iPhone Application Deploy without using iTunes

    - by Paulo Correia
    I want to build an application for the iPhone to be used inside a customer enterprise (very small, only 5 to 10 devices). But since they will be paying the application development, I don't want to distribute that application to the world inside the App Store in iTunes. How can I distribute this app to my customer? Should I get the Enterprise level subscription from the Apple Developer Program? Since I work as a freelancer, I think I can't subscribe to that program.

    Read the article

  • CSGL Picking 3d models

    - by Wazzz
    hi folks do any one knows a project of csgl C# opengl picking example by mouse . the thing is i want to put few 3d models in the scene and pick them by mouse . than you already for your answer

    Read the article

  • Can someone help me with this StructureMap error i'm getting?

    - by Pure.Krome
    Hi folks, I'm trying to wire up a simple ASP.NET MVC2 controller class to my own LoggingService. Code compiles fine, but I get the following runtime error :- {"StructureMap Exception Code: 202 No Default Instance defined for PluginFamily System.Type, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"} what the? mscorlib ???? Here's some sample code of my wiring up .. protected void Application_Start() { MvcHandler.DisableMvcResponseHeader = true; BootstrapStructureMap(); ControllerBuilder.Current.SetControllerFactory( new StructureMapControllerFactory()); RegisterRoutes(RouteTable.Routes); } private static void BootstrapStructureMap() { ObjectFactory.Initialize(x => x.For<ILoggingService>().Use<Log4NetLoggingService>()); } and finally the controller, simplified for this question ... public class SearchController : Controller { private readonly ILoggingService _log { get; set; } public SearchController(ILoggingService loggingService) : base(loggingService) { // Error checking removed for brevity. _log = loggingService; _log.Tag = "SearchController"; } ... } and the structuremap factory (main method), also way simplified for this question... protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { IController result = null; if (controllerType != null) { try { result = ObjectFactory.GetInstance(controllerType) as Controller; } catch (Exception exception) { if (exception is StructureMapException) { Debug.WriteLine(ObjectFactory.WhatDoIHave()); } } } } hmm. I just don't get it. StructureMap version 2.6.1.0 ASP.NET MVC 2. Any ideas?

    Read the article

  • Programmatically copying custom content type and columns from one web to another

    - by BeraCim
    Hi all: I'm experiencing a very stubborn problem when copying custom content type and its columns from one web to another within the same site. Basically, this is the code that I have: foreach (SPField field in existingWeb.Fields) { if (!destinationWeb.Fields.ContainsField(field.Title)) { destinationWeb.Fields.AddFieldAsXml(field.SchemaXml); destinationWeb.Update(); } } foreach (SPContentType existingWebCt in destinationWeb.ContentType) { SPContentType newContentType = new SPContentType(existingWebCt.Parent, destinationWeb.ContentTypes, existingWebCt.Name); foreach (SPFieldLink fieldLink in existingWebCt.FieldLinks) { SPField sourceField = existingWebCt.Fields[fieldLink.Id]; if (destinationWeb.Fields.ContainsField(sourceField.Title)) { SPFieldLink destinationWebFieldLink = new SPFieldLink(destinationWeb.Fields[sourceField.Title]); newContentType.FieldLinks.Add(destinationWebFieldLink); } } } existingWeb and destinationWeb are 2 webs within the same site. The code runs fine. But the problem is that in the SITE Content Type screen (under site settings), when I click the custom column link in the custom content type, I got an error saying: Invalid field name {UID}. The UID is the same UID as the custom column in the existing site. I checked with my web settings after completion. I can see the custom list (which I created with an item for testing purpose), but the custom column is gone from the view (though the actual data is still there... just have to check the box to get it to display). But I think that is less important... more of fyi. I've also gotten a variety of different exceptions should I copy things wrongly. Google has failed to help me out on this one. Does anyone know what I'm missing in order to get that link to work again? Thanks.

    Read the article

  • Progressive MP4 video issues in Flash- Video stops rendering

    - by Conor
    I'm currently working on a flash project that has an intro video that plays before heading into the main app. This video is an H.264 .mp4, 1550x540, and around 10MB. The problem thats currently driving me insane is that when I test it, occasionally the video will begin playing, and then suddenly stop rendering the video frames, leaving the audio playing in the background with nothing on screen. Once the file is played through fully (based on listening to the audio), my playback complete event fires like it should, but I can't find any info of people having similar issues. Attached is a trace of the .mp4 metadata in case that helps. videoframerate : 24 audiochannels : 2 audiocodecid : mp4a audiosamplerate : 48000 trackinfo: 0: length : 608000 timescale : 24000 language : eng sampledescription: 0: sampletype : avc1 1: length : 1218560 timescale : 48000 language : eng sampledescription: 0: sampletype : mp4a duration : 25.386666666666667 width : 1540 videocodecid : avc1 seekpoints: 0: time : 0 offset : 13964 1: time : 0.333 offset : 16893 2: time : 0.667 offset : 34212 ... 73: time : 24.333 offset : 9770329 74: time : 24.667 offset : 9845709 75: time : 25 offset : 9895215 moovposition : 32 height : 540 avcprofile : 77 avclevel : 51 aacaot : 2 This has been driving me absolutely insane... any help would be much appreciated!

    Read the article

  • manu help me in the effect

    - by tismon
    http://www.zazzle.com/cr/design/pt-mug this is just a demo site. i am suppose to do something like this in PHP. can any one tell how this can be done with PHP ? what is the logic behind this ? is this possible with jquery or GD Library ? please help me.. thanks and regards tismon

    Read the article

  • Direct show video renderers suck?

    - by Daniel
    So I've been looking into the world of media playback for windows and I've started making a C# Media Player using DirectShow. I started off using the VRM-7 windowed video renderer and it was brilliant except it had a couple of small problems (multi monitors, fullscreen). But after some research I found that it's deprecated and I should be using VRM9. So I changed it to use VRM9 windowless then found out that was an old post rofl _< so finally I'm using Vista/Win7 (or XP .net 3) Enhanced Video Renderer (EVR) which is apparently the most up to date Microsoft video renderer and has all the flashy performance/quality things added to it. (tbh I haven't noticed any difference but maybe I need a blue-ray or HQ video to notice it). With using EVR everything is working fine except resizing the video. Its really laggy/choppy/teary and problem something to do with its frame queueing mechanism. To demonstrate my problem open up windows media player classic. View - Options - Playback - output Chose the "EVR" DirectShow Video renderer Now restart wmp class and play a video, while it's playing click and drag a corner to resize it. You'll notice its horribly laggy. This is the exact same problem i am having. But if you chose "EVR Custom Pres. *" or EVR Sync *" resizing works beautifully! So i tried googling around for anything about EVR resizing issues and how to fix it but i couldn't believe how little i could find. I'm guessing "Custom Pres." stands for "Custom Presenter" which sounds like they made their own. Also you'll notice on the right hand size when you swap between EVR and the other EVR's the Resizer drop down on the right greys out. So basically I wan't to know how I can fix this retarded resizing problem and is there any decent documentation out there? There is a fair bit for VMR7/9 but not much for EVR. I downloaded the DirectX SDK which apparently has samples but it was a waste of 500mb of bandwidth as it had nothing relevant. Perhaps there is some way to force it not queueing up frames if that is the problem? If you want code say the word and I'll paste some in. But it's really quite simple and nothing much happens, i'm convinced it's a problem with the EVR renderer. EDIT: Oh and one other thing, what does VLC use? If you go into vlc options and change the renderer to anything but default, they all suck. So is it using VMR7? Or its own?

    Read the article

  • Choosing a Wiki for an academic institute

    - by abhishekgupta92
    I need to choose a Wiki. Please someone help. Following are my requirements: 1) Need good control to the access variables 2) LDAP integration support 3) User Group Support 4) Good Themes and Templates Mediawiki has the problem that it does not support Users Groups that intutively. Twiki and Foswiki have a problem that any authenticated user that has write permissions for a topic also have the write to change the particualar permissions for the topic. Else, can someone suggest me where to look for the answer. I know about the WikiMatrix

    Read the article

  • OpenVPN with MacOS X Client and same subnets in local and remote net.

    - by Daniel
    I have a homenetwork 192.168.1.0/24 with gteway 192.168.1.1 and a remote network with the same parameters. Now I want to create a OpenVPN tunnel between those networks. I have no problems with Windows, because Windows routes everything to 192.168.1.0/24 except 192.168.1.1 throught the tunnel. On MacOS X however I see the folling line in the Details window: 2010-05-10 09:13:01 WARNING: potential route subnet conflict between local LAN [192.168.1.0/255.255.255.0] and remote VPN [192.168.1.0/255.255.255.0] When I list the routes I get the following: Internet: Destination Gateway Flags Refs Use Netif Expire default 192.168.1.1 UGSc 13 3 en1 127 localhost UCS 0 0 lo0 localhost localhost UH 12 3589 lo0 169.254 link#5 UCS 0 0 en1 192.168.1 link#5 UCS 1 0 en1 192.168.1.1 0:1e:e5:f4:ec:7f UHLW 13 17 en1 1103 192.168.1.101 localhost UHS 0 0 lo0 192.168.6 192.168.6.5 UGSc 0 0 tun0 192.168.6.5 192.168.6.6 UH 1 0 tun0 My Interfaces are en1 - My local Wifi network tun0 - The tunnel interface As can be seen from the routes above there is no entry for 192.168.1.0/24 that routes the traffic through the tunnel interface. When I manually route a single IP like 192.168.1.16 over the tunnel gateway 192.168.6.6, this works. Q: How do I set up my routes in MacOS X for the same behaviour as on windows, to route everything except 192.168.1.1 through the tunnel, but leave the default gateway to be my local 192.168.1.1 ?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >