Daily Archives

Articles indexed Friday May 7 2010

Page 14/110 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Where should I define Enums?

    - by Ciel
    Hi: I'm setting up a new app, with a Repository layer/assembly, a Services layer/assembly, and a UI assembly. So I end up with namespaces such as: App.UI App.Biz.Services App.Data.Repositories And then I have enums for the args that are used by all 3 layers. Only place that makes sense is to put them in the Cross cutting assembly. (define them in Data layer too low, as UI should have no direct ref to them, defined in Services, too high for Repository layer, which shouldn't be referencing upwards). But...which namespace in Common? Namespaces should mostly be used to define concerns, rather than Type... I've always used something like: namespace App.Common.Enums {...} but it's always felt a bit of a hack that works for me, but not well in a large org where everybody is generating Enums, and if we put them all in Enums folder it's going to make the code folder harder to understand later. Any suggestions?

    Read the article

  • Evaluating and graphing functions in Matlab

    - by thiol3
    New to programming, I am trying to graph the following Gaussian function in Matlab (should graph in 3 dimensions) but am making some mistakes somewhere. What is wrong? sigma = 1 for i = 1:20 for j = 1:20 z(i,j) = (1/(2*pi*sigma^2))*exp(-(i^2+j^2)/(2*sigma^2)); end end surf(z)

    Read the article

  • How do you adjust the frame or vertical alignment of a UIBarButtonItem contained by a UIToolbar inst

    - by akaii
    Horizontal positioning of UIBarButtonItems is no problem, I can simply pad the space with fixed/flexible space items. However, I can't seem to adjust the toolbar item vertically. UIToolbar has no alignment property, and UIBarButtonItem has no way of setting its frame. I need to do this because we're using a mix of custom icons created using initWithImage, and standard icons created with initWithBarButtonSystemItem. The custom icons aren't being centered properly (they're offset upwards, relative to the system icons, which are centered properly), so the toolbar looks awkward.

    Read the article

  • Sandbox architecture in ASP.NET?

    - by Srikanth
    Is it possible to develop a web-app in ASP.NET (framework is not a constraint), to have a sandbox architecture, and deploy widgets without disturbing the parent application? I expect both the parent application and the widget to be developed using .NET. EDIT: To elaborate, I want to have an web-app, say App1, and widgets (say wid1 and wid2). wid1 and wid2 should be like a plugin into App1, only difference is that, if I make any changes to wid1, I want to be able to deploy it without disturbing App1 or Wid2. The widgets can be something similar to a flash object, only that it needs to be developed on .net.

    Read the article

  • Any thoughts on how to create a true 'punch-out' area in a Sprite?

    - by rhtx
    I've been working on this for awhile, now. You might also call it a 'reverse mask', or an 'inverse mask'. Basically, I'm creating a view window within a display object. I need to allow objects on the stage that are under the window to be able to interact with the mouse. This is similar to a WPF question: http://stackoverflow.com/questions/740994/use-wpf-object-to-punch-hole-in-another, which has a much shorter write-up. I've got a Class called PunchOutShield, which creates a Sprite that covers the stage (or over some desired area). The Sprite's Graphics object is filled using the color and transparency of Flex's modal screen. The result is a screen that looks like the screen which appears behind a modal PopUp. PunchOutShield has a method called punch, which takes two arguments - the first is a Shape object, which defines the shape of the punch-through area; the second is a Point object, which indicates where to position the punch-through area. It took some experimenting, but I found that I can successfully create a punch-out area (i.e. - the modal screen does not display within the bounds of the given Shape). To do this, I set cacheAsBitmap to true on the Sprite that is used to create the modal screen, and also on the Shape object, which is added to the modal screen Sprite's displayList. If I set the blend mode of the Shape to ERASE, a completely transparent area is created in the modal screen. So far, great. The problem is that Shape does not subclass InteractiveObject, so there is no way to set mouseEnabled = false on it. And so, it prevents interaction between the mouse and any objects that are visible through the punch-out area. On top of that, InteractiveObject isn't available to look at, so I can't see if there is a way to borrow what it's doing to provide the mouseEnabled functionality and apply it to a subclass of Shape. I've tried using another Sprite object, rather than a Shape object, but the blending doesn't work out correctly. I'm not sure why there is a difference, but the Shape object seems to somehow combine with the parenting Sprite, allowing the ERASE blendMode to effect the desired punch-out visual appearance. It wouldn't be the end of the world if I had to draw up the screen with a series of rectangles so that the punch-out area was just simply not drawn, but that approach won't work if the punch-out area is complex. Or round. Any thoughts on this approach, or on an alternative approach?

    Read the article

  • Should I Use Anchor, Button Or Form Submit For "Follow" Feature In Rails

    - by James
    I am developing an application in Rails 3 using a nosql database. I am trying to add a "Follow" feature similar to twitter or github. In terms of markup, I have determined that there are three ways to do this. 1) Use a regular anchor. (Github Uses This Method) <a href="/users/follow?target=Joe">Follow</a> 2) Use a button. (Twitter Uses This Method) <button href="/friendships/create/">Follow</button> 3) Use a form with a submit button. (Has some advantages for me, but I haven't see anyone do it yet.) <form method="post" id="connection_new" class="connection_new" action="/users/follow"> <input type="hidden" value="60d7b563355243796dd8496e17d36329" name="target" id="target"> <input type="submit" value="Follow" name="commit" id="connection_submit"> </form> Since I want to store the user_id in the database and not the username, options 1 and 2 will force me to do a database query to get the actual user_id, whereas option 3 will allow me to store the user_id in a hidden form field so that I don't have to do any database lookups. I can just get the id from the params hash on form submission. I have successfully got each of these methods working, but I would like to know what is the best way to do this. Which way is more semantic, secure, better for spiders, etc...? Is there a reason both twitter and github don't use forms to do this? Any guidance would be appreciated. I am leaning towards using the form method since then I don't have to query the db to get the id of the user, but I am worried that there must be a reason the big guys are just using anchors or buttons for this. I am a newb so go easy on me if I am totally missing something. Thanks!

    Read the article

  • Can I use vector as index in map structure in c++?

    - by tsubasa
    I attempted to do something like this but it does not compile: class point { public: int x; int y; }; int main() { vector<point> vp1; vector<point> vp2; vector<point> vp3; map < vector<point>, int > m; m[vp1] = 1; m[vp2] = 2; m[vp3] = 3; map < vector<point>, int >::iterator it; for (it=m.begin(); it!=m.end(); it++) { cout<<m[it->first]<<endl; } return 0; }

    Read the article

  • Can java do a timer on command line?

    - by javaLearner.java
    HI I am a new java programmer (very new). What I want to do/test is (not sure if its recommendable or doable?), we know that System.out.println("Message"); will output the "Message" in command prompt. Is it possible to display the current time, without having to repeatly use the system.out.println()? Name, like instead of displaying: 10:00:01 10:00:02 10:00:03 I wand to have liek this: 10:00:0X where X will continue counting

    Read the article

  • mySQL ORDER BY ASC works, DESC does not...

    - by Ben
    I've "integrated" SMF into Wordpress by querying the forum for a list of the most recent videos from a specific forum board and displaying them on the Wordpress homepage. However when I add the ORDER BY clause, the query (which I tested on other parts of the same page successfully), breaks. To add to the mix, I am using the Auto Embed plugin to allow the videos to be played on the homepage, as well as using a jCarousel feature to rotate them. People were kind enough to help me here last time with the regexp to filter the video urls, I'm hoping for the same luck this time! Here is the entire function (remove the DESC and it works...): function SMF_getRecentVids($limit=10){ global $smf_settingsphp_d; if(file_exists($smf_settingsphp_d)) include($smf_settingsphp_d); include "AutoEmbed-1.4/AutoEmbed.class.php"; $AE = new AutoEmbed(); $connect = new wpdb($db_user,$db_passwd,$db_name,$db_server); $connect->query("SET NAMES 'UTF8'"); $sql = SELECT m.subject, m.ID_MSG, m.body, m.ID_TOPIC, m.ID_BOARD, t.ID_FIRST_MSG FROM {$db_prefix}messages AS m LEFT JOIN {$db_prefix}topics AS t ON (m.ID_TOPIC = t.ID_TOPIC) WHERE (m.ID_BOARD = 8) ORDER BY t.ID_FIRST_MSG DESC"; $vids = $connect->get_results($sql); $c = 0; $content = "imageCarousel_itemList = ["; foreach ($vids as $vid) { if ($c > $limit) continue; //extract video code from body $input = $vid->body; $regexp = "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i"; if(preg_match_all($regexp, $input, $matches)) { $AE->parseUrl($matches[0][0]); $imageURL = $AE->getImageURL(); $AE->setWidth(290); $AE->setHeight(240); $content .= "{url: '".$AE->getEmbedCode()."', title: '".$vid->subject."', caption: '', description: ''},"; } $c++; } $content .= "]"; echo $content; $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); }

    Read the article

  • using WrapCompressedRTFStream in C#

    - by Code Smack
    Hello, I am rewording this question: Csharp C# visual studio 2008 How do I use the WrapCompressedRTFStream when using DLLImport with mapi32.dll? Sample of code to import the WrapCompressedRTFStream method. (I found this, I did not figure this part out) [DllImport("Mapi32.dll", PreserveSig = true)] private static extern void WrapCompressedRTFStream( [MarshalAs(UnmanagedType.Interface)] UCOMIStream lpCompressedRTFStream, uint ulflags, [MarshalAs(UnmanagedType.Interface)] out UCOMIStream lpUncompressedRTFStream ); public const uint MAPI_MODIFY = 0x00000001; public const uint STORE_UNCOMPRESSED_RTF = 0x00008000; How do I use this in my c# application when my compressedRichText is stored in a string.

    Read the article

  • Delete file using a link

    - by user329394
    Hi all, i want to have function like delete file from database by using link instead of button. how can i do that? do i need to use href/unlink or what? Can i do like popup confirmation wther yes or no. i know how to do that, but where should i put the code? this is the part how where system will display all filename and do direct upload. Beside each files, there will be a function for 'Remove': $qry = "SELECT * FROM table1 a, table2 b WHERE b.id = '".$rs[id]."' AND a.ptkid = '".$rs[id]."' "; $sql = get_records_sql($qry); foreach($sql as $rs){ ?> <?echo '<a href="download.php?f='.$rs->faillampiran.'">'. basename($rs->faillampiran).'</a>'; ?><td><?echo '<a href=""> [Remove]</a>';?></td><? ?><br> <? } ?> thankz all

    Read the article

  • Captivate - sending completion to LMS after 2 attempts

    - by dpif
    Hi, I'm using Captivate 4, SouthRock LMS and Scorm1.2. My appsim provides the learner with 2 attempts. I've set it up to score Complete/Incomplete. The issue I have is that when the learner fails on the 2nd attempt an Incomplete is being sent to the LMS. How can I get the simulation to send a Complete on the 2nd attempt if the learner has not achieved the mastery score?

    Read the article

  • How to rewrite the following?(C#3.0)

    - by Newbie
    I am trying to write the following double sum_res = 0.0; double yhat = 0; double res = 0; int n = 0; for(int i=0;i<x.Count;i++) { yhat = inter + (slp*x[i]); res = yhat - y[i]; n++; } using lambda but somehow not able to get it work(compile time error) Enumerable.Range(0, x.Count).Select(i => { yhat = inter + (slp * x[i]); res = yhat - y[i]; sum_res += res * res; n++; }); Error: The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. Help needed. Thanks

    Read the article

  • Design pattern question: encapsulation or inheritance

    - by Matt
    Hey all, I have a question I have been toiling over for quite a while. I am building a templating engine with two main classes Template.php and Tag.php, with a bunch of extension classes like Img.php and String.php. The program works like this: A Template object creates a Tag objects. Each tag object determines which extension class (img, string, etc.) to implement. The point of the Tag class is to provide helper functions for each extension class such as wrap('div'), addClass('slideshow'), etc. Each Img or String class is used to render code specific to what is required, so $Img->render() would give something like <img src='blah.jpg' /> My Question is: Should I encapsulate all extension functionality within the Tag object like so: Tag.php function __construct($namespace, $args) { // Sort out namespace to determine which extension to call $this->extension = new $namespace($this); // Pass in Tag object so it can be used within extension return $this; // Tag object } function render() { return $this->extension->render(); } Img.php function __construct(Tag $T) { $args = $T->getArgs(); $T->addClass('img'); } function render() { return '<img src="blah.jpg" />'; } Usage: $T = new Tag("img", array(...); $T->render(); .... or should I create more of an inheritance structure because "Img is a Tag" Tag.php public static create($namespace, $args) { // Sort out namespace to determine which extension to call return new $namespace($args); } Img.php class Img extends Tag { function __construct($args) { // Determine namespace then call create tag $T = parent::__construct($namespace, $args); } function render() { return '<img src="blah.jpg" />'; } } Usage: $Img = Tag::create('img', array(...)); $Img->render(); One thing I do need is a common interface for creating custom tags, ie I can instantiate Img(...) then instantiate String(...), I do need to instantiate each extension using Tag. I know this is somewhat vague of a question, I'm hoping some of you have dealt with this in the past and can foresee certain issues with choosing each design pattern. If you have any other suggestions I would love to hear them. Thanks! Matt Mueller

    Read the article

  • iphone - Images (slide show) and audio snychronization

    - by Qaiser
    I have 20 images and some audio. I would like to show a single image at a time and change the images at (unequal) intervals. For example, I want to show image 1 for 1.44 seconds and image 2 for 1.67 seconds and so on. Can someone suggest how to go about doing this please? What I have seen are examples that show how to setup an array of images with one field that denotes total time. This causes the images to show for an equal amount of time (each). ... and that not what I am looking for ...

    Read the article

  • Is there a way to store and access a SQL CE (.sdf) database in isolated storage?

    - by phredtalkpointcom
    I have a .Net application which must store all it's local data in isolated storage. I want to start using SQL CE to store this data. I can't find any documentation on how (or even if) this is possible. Is it possible to use isolated storage to store a SQL CE database? If so, what would the connection string look like (or is there some other way you would need to open the database)?

    Read the article

  • C# development with Mono and MonoDevelop

    - by developerit
    In the past two years, I have been developing .NET from my MacBook by running Windows XP into VM Ware and more recently into Virtual Box from OS X. This way, I could install Visual Studio and be able to work seamlessly. But, this way of working has a major down side: it kills the battery of my laptop… I can easiely last for 3 hours if I stay in OS X, but can only last 45 min when XP is running. Recently, I gave MonoDevelop a try for developing Developer IT‘s tools and web site. While being way less complete then Visual Studio, it provides essentials tools when it comes to developping software. It works well with solutions and projects files created from Visual Studio, it has Intellisence (word completion), it can compile your code and can even target your .NET app to linux or unix. This tools can save me a lot of time and batteries! Although I could not only work with MonoDevelop, I find it way better than a simple text editor like Smultron. Thanks to Novell, we can now bring Microsoft technology to OS X.

    Read the article

  • Make clients to download InstallShield PreRequisites from Internet

    - by LioKig
    Hi Everyone, My installshield project uses custom prerequisites to install .Net Framework 4.0 Client Profile and Microsoft Sync Framework 2.0 client package. I want to let clients to donwload .Net Framework and Sync Framework directly from the Internet so that our installer is small. But I cant see a way to this. If you could give some advices or example, it would be most appreciated. Cheers

    Read the article

  • YUI: ensuring DOM elements and scripts are ready

    - by dound
    If I put my inline script after the DOM elements it interacts with, should I still use YUI 3's domready event? I haven't noticed any problems, and it seems like I can count on the browser loading the page sequentially. (I already use YUI().use('node', ... to make sure the YUI functions I need have been loaded since the YUI script is a separate file.) Is there a way to speed up the loading of widgets like YUI 2's calendar? I load the appropriate script in <head> element of my page. I use YUI().use('yui2-calendar', ... to make sure the Calendar widget is available. Unfortunately, this causes a short but noticeable delay when I load my page with the calendar. If I omit the YUI().use('yui2-calendar', ... code then it shows up without a noticeable delay - but I guess this could cause the Calendar to not show up at all if the YUI script doesn't load in time? With regards to #2, is it possible to reduce the visual artifact of the calendar not being present and then showing up? I've made it slightly better by specifying a height and width for the parent div so that at least the space is already allocated = minimal shifting around when it does load.

    Read the article

  • Visual Editor vs Manual code

    - by Albinoswordfish
    I'm not sure how it is using other frameworks but this questions is strictly regarding Java swing. Is it better to use a Visual Editor to place objects or to manually code the placement of the objects onto the frame (Layout managers or null layouts)? From my experience I've had a lot of trouble using Visual editors when it comes to different screen resolutions or changing the window size. Using manual code to place objects I've found that my GUIs behave a lot better with regard to the screen size issue. However when I want to change a small part of my GUI it takes a lot more work compared to using a visual editor Just wondering what people's thoughts were on this?

    Read the article

  • Silverlight? WPF? or Windows Form?

    - by Amit
    After Silverlight 4.0 has been released with new WPF, I am kind of confused with these technologies: Silverlight? WPF? Windows Form? The main motive that we want to achieve for BIG business project is following: Performance Security And platform independent** If I consider all above three points then only Silverlight is the option as I don’t want people buying emulator on MacOS for WPF or Windows Form. Now how good the Silverlight is for Business applications, I was completely against when Silverlight 2.0 was in the market but now it is Silverlight 4.0 and they have provided many new features (but still basics) that is required in any challenging business applications. Comparing Silverlight and WPF -* Silverlight and WPF are very new technology and if I'd to compare from these two then I'd prefer WPF because it can be considered stable and mature. But it is not same as Windows Form. -* If I go with Silverlight then I am sure about keep updating to the latest version of Silverlight. I remembered when we were developing software for version 2.0 then we'd to create our own framework with dynamic loading DLL, and then Navigation concept. But everything was got changed once Silverlight 3.0 came. I don't want this to be happening with this new product. -* If we go with WPF then we don't get the platform independence. Now, why not we just focus on making WPF and then move to Silverlght. As someone (Tim?) from Microsoft has said that the idea is to make Silverlight as close as WPF. But if that is the case then why XAML structure is different; I will not be convinced with by saying that .Net framework for SL is too small.. well the difference is coming from the namespace ? I was searching on this subject and found "Microsoft WPF-Silverlight Comparison Whitepaper v1.1.pdf". This guide is very good that gives you ins-outs about how can we build common apps that runs on both. But again, it is comparing Silverlight 2 and not 4. I am sure many architect/ developers/ project managers must be facing similar kind of questions in their premises and wants to initiate this discussion, if it has not been :). We've still got 2 weeks to make this decision, so I'm expecting everyone to participate, gurus?

    Read the article

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