Daily Archives

Articles indexed Sunday April 18 2010

Page 7/77 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • pro/con of having single/multiple action per file in symfony?

    - by koss
    been working with symfony for a while. most tutorials describe having multiple actions in a single php file. however, i find having 1 action per php file easier to maintain. what's the pro/con of both? is this purely a developer preference in code organisation? any performance impact on either approach? what's common practice for reasonably large production applications?

    Read the article

  • DDD - Validation of unique constraint

    - by W3Max
    In DDD you should never let your entities enter an invalid state. That being said, how do you handle the validation of a unique constraint? The creation of an entity is not a real problem. But let say you have an entity that must have a unique name and there is a thousand instances of this entity type - they are not in memory but stored in a database. Now let say you want to rename an instance. You can't just use a setter... the object could enter an invalid state - you have to validate against the database. How do you handle this scenario in a web environment?

    Read the article

  • OS X not booting after upgrading LibXML2

    - by Federico
    I tried upgrading the version of LibXML2 in my machine to run some propietary software. Compiled as 32-bit (-arch i386) and restarted to see if it worked. Now when I try to boot I can only get into the spinning screen and it just sits there. Restarting in verbose mode (Cmd-V) does not show any error in the process, it just freezes after "AppleIntelCPUPowerManagement: initialization complete". I can't from any CD either (if I press c on startup it just spins the disk around and then stops in the same spinner screen). I've also reset the PRAM/NVRAM to discard any problems with that and it´s still not fixed. Any pointers of what might´ve gone wrong? (Latest gen MBP, running 10.6.3)

    Read the article

  • Parsing HTML using HtmlParser

    - by Blankman
    My html has 20 or so rows of the following HTML pattern. So the below is considered a single instance of the pattern. Each instance of this pattern represents a product. Again the below is a single instance, it spans multiple rows in the HTML table. <table> .. <!-- product starts here, this html comment is not in the real html --> <tr> <td rowspan="5" class="product" valign="top"><nobr> ????????????</td> </tr> <tr> <td class="title" ??????????>?????????</td> <td class="title" ??????????>?????????</td> <td class="title" ??????????>?????????</td> <td class="title" ??????????>?????????</td> <td class="title" ??????????>?????????</td> <td class="title" ??????????>?????????</td> </tr> <tr> <td class="data" ?????? </td> <td class="data" ?????? </td> <td class="data" ?????? </td> <td class="data" ?????? </td> <td class="data" ?????? </td> <td class="data" ?????? </td> </tr> </tr> <tr> <td colspan="5" ????????</td> </tr> <tr> <td colspan="6" width="100%">&nbsp;<hr></td> </tr> <!-- product ends here, this html comment is not in the real html --> <!-- above pattern repeats multiple times in the HTML --> .. <table> I am trying to use HtmlParser for this. Parser rowParser = new Parser(); rowParser.setInputHtml(page.getHtml()); // page object represents a html page rowParser.setEncoding("UTF-8"); NodeFilter productRowFilter = new AndFilter( new TagNameFilter("tr"), new HasChildFilter( new AndFilter( new TagNameFilter("td"), new HasAttributeFilter("class", "product"))) The above filter doesn't work, just showing you what I have so far. I need to somehow combine these filters, and use the last td to mark the end of the pattern i.e. the td with the colspan=6 and width=100% with child element hr. I have been struggling with this, and have resorted to Regex'ing but was told numerous times to NOT use regex for html parsing, so here I am! Your help is much appreciated!

    Read the article

  • Using both chunked transfer encoding and gzip

    - by RadiantHeart
    I recently started using gzip on my site and it worked like charm on all browsers except Opera which gives an error saying it could not decompress the content due to damaged data. From what I can gather from testing and googling it might be a problem with using both gzip and chunked transfer encoding. The fact that there is no error when requesting small files like css-files also points in that direction. Is this a known issue or is there something else that I havent thought about? Someone also mentioned that it could have something to do with sending a Content-Length header. Here is a simplified version of the most relevant part of my code: $contents = ob_get_contents(); ob_end_clean(); header('Content-Encoding: '.$encoding); print("\x1f\x8b\x08\x00\x00\x00\x00\x00"); $size = strlen($contents); $contents = gzcompress($contents, 9); $contents = substr($contents, 0, $size); print($contents); exit();

    Read the article

  • Why would a variable in Scala code mysteriously become null?

    - by Alex R
    I've isolated the problem down to this: Predef.println("the value of argv1 here is " + argv(1)); var n: $ = undef; n = argv(1); Predef.println("the value of argv1 here is " + argv(1)); Predef.println("the value of n here is " + n); Predef.println("the class of n here is " + n.getClass); Here's the definition of $: class $ { println("constructed a new $ of type: " + this.getClass); def value: $ = this; def toValue: Value = { new ConstStringValue(this.toString()) }; def -(sym: Symbol): $ = { println("looked up: " + sym); this } def -(sym: $): $ = { println("looked up: " + sym); this } def update(sym: Symbol, any: Any) { println("update called: " + sym + "=" + any); } def apply(sym: Symbol) = { this } def apply(obj: $) = { this } def apply() = { this } def +(o:$) = this.toValue.div(o.toValue) def *(o:$) = this.toValue.mul(o.toValue) def >(o:$) = this.toValue.gt(o.toValue) def <(o:$) = this.toValue.lt(o.toValue) def ++() = { this } def -=(o:$) = { this } } When run, the code prints: the value of argv1 here is 10 the value of argv1 here is 10 the value of n here is null java.lang.NullPointerException at test_1_php$.include(_tmp.scala:149) at php.script.main(php.scala:57) at test_1_php.main(_tmp.scala) [...] Why would n mysteriously lose its value (or fail to take one on)?

    Read the article

  • How to enable 'Add Config Transforms' for old Visual Studio 2008 project?

    - by YeahStu
    I am working in the new Visual Studio 2010 RTM and I would like to use web.config transforms. My site is configured to use .NET 4.0 but it was formerly as Visual Studio 2008 web application project. When I right-click on my web.config file I do not see the 'Add Config Transforms' option as I should. I also tried adding creating a new web.config but I still do not see the transform option. Does anyone know how to enable web.config transforms for projects in Visual Studio 2010 that were originally created in Visual Studio 2008?

    Read the article

  • trackPageView on Google Analytics for iPhone Not Working

    - by DigitalZombieKid
    I'm trying to get Google Analytics working on an iPhone application without much luck. I've followed all the instructions on their website (google/apis/analytics/docs/tracking/mobileAppsTracking.html) and studied their sample application (google/gaformobileapps/GoogleAnalyticsIphone_0.7.tar.gz). When I run my application and go to Google Analytics' website (https://www.google.com/analytics/reporting/), the only page that is recording is /app_entry_point. I'm seeing one count in my Google Analytics detailed report once every time my app fires up. However, I have added other pages to be tracked but it's not working. Here is a sample of two pages I've added to be tracked: trackPageview:@"/calculator"; trackPageview:@"/tellafriend"; I call them from various ViewControllers in the app. In each of those view controllers I import the the GANTracker header: #import "GANTracker.h" I'll admit it: I'm an objective-c newbie. Any help you can offer is greatly appreciated! Do I need to physically dispatch them to get the trackPageview working? If so, why is the /app_entry_point page the only page that is recorded by Google Analytics?

    Read the article

  • Unresolved External symbol

    - by jay
    Hello, I am getting a linking error, and I'm not sure what its referring to. Here is the error 1Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall BinaryHeap,class std::allocator ,class Comp,class std::allocator ::insert(class Item,class std::allocator const &)" (?insert@?$BinaryHeap@V?$Item@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@V?$Comp@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@@@QAEXABV?$Item@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@@Z) referenced in function "public: void __thiscall PriorityQueue,class std::allocator ::insertItem(int,class std::basic_string,class std::allocator const &)" (?insertItem@?$PriorityQueue@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) The code is rather long, however if you want me to post it I will. thanks

    Read the article

  • Cannot get Google Analytics API to register page views on iPhone

    - by Sebastien
    I would like to gather usage statistics for my iPhone app using Google Analytics so I'm trying to configure it using the following tutorial: http://code.google.com/intl/fr-FR/apis/analytics/docs/tracking/mobileAppsTracking.html I think I did everything they indicate in the documentation, and I get no error on the iPhone side, but I don't see any visits in Google Analytics. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ [self initGoogleAnalytics]; //... } -(void)initGoogleAnalytics{ [[GANTracker sharedTracker] startTrackerWithAccountID:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"GoogleAnalyticsCode"] dispatchPeriod:-1 delegate:nil NSError *error; if(![[GANTracker sharedTracker] trackPageview:@"/home" withError:&error]){ NSLog(@"%@", [error localizedDescription], nil); } [[GANTracker sharedTracker] dispatch]; } Any idea why this is not working?

    Read the article

  • Installing Epic (Eclipse Plugin) in Pulse Explorer

    - by The Daemons Advocate
    I'm trying to install EPIC using the Pulse Explorer for Eclipse (as I'm rather fond of sharing profiles :). When I go to install the plugin under my account, I get asked for a login into http://e-p-i-c.sf.net. However, the Epic's team documentation doesn't mention anything about a login. Here's what I've done: Gone into Pulse and created a new profile based on Eclipse Classic. Navigated to Software, added the EPIC software site to list of public sites, and chosen to install it. Added Pulse item to profile. Run the installer. The error shows up while it's all downloading/installing. Login boxes start to appear for epic related components, and I don't have credentials to put in so all I can do is hit cancel. If I hit cancel, the process fails at the end with the generic error message: "an unexpected error occurred preparing to install and/or launch the selected profile". Bundles that are failing to download are: org.epic.debug org.epic.doc org.epic.lib org.epic.perleditor org.epic.regxp org.epic.source The component that's exploding is called: org.eclipse.equinox.internal.p2.repository.Credentials$LoginCancelledException I've had the same effect on Pulse 0.5.x and 0.6.x. No clue where to go from here. Might contact the EPIC and Pulse teams and ask them, but thought that I'd get a better response from here. I'm somewhat sure I'm doing something wrong.

    Read the article

  • Automatic .NET code, nhibernate session, and LINQ datacontext clean-up?

    - by AverageJoe719
    Hi all, in my goal to adopt better coding practices I have a few questions in general about automatic handling of code. I have heard different answers both from online and talking with other developers/programmers at my work. I am not sure if I should have split them into 3 questions, but they all seem sort of related: 1) How does .NET handle instances of classes and other code things that take up memory? I recently found out about using the factory pattern for certain things like service classes so that they are only instantiated once in the entire application, but then I was told that '.NET handles a lot of that stuff automatically when mentioning it.' 2) How does Nhibernate's session handle automatic clean-up of un-used things? I've seen some say that it is great at handling things automatically and you should just use a session factory and that's it, no need to close it. But I have also read and seem many examples where people close the hibernate session. 3) How does LINQ's datacontext handle this? Most of the time I never .disposed my datacontext's and the app didn't see to take a performance hit (though I am not running anything super intensively), but it seems like most people recommend disposing of your datacontext after you are done with it. However, I have seen many many code examples where the dispose method is never called. Also in general I found it kind of annoying that you couldn't access even one-deep child related objects after disposing of the datacontext unless you explicity also grabbed them in the query. Thanks all. I am loving this site so far, I kind of get lost and spend hours just reading things on here. =)

    Read the article

  • AVAudioPlayer via Speakers

    - by Mark
    I got the following code: - (id)init { if (self = [super init]) { UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory); UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride); [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil]; } return self; } But somehow the sound does not want to come out of the speakers, can someone see what I am doing wrong? The code I use for playing is: AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFilePathURL error:nil]; [player prepareToPlay]; [player setVolume:1.0]; [player play];

    Read the article

  • Installed Apache. Bash: 'service httpd status' does nothing,

    - by Josh
    I just installed Apache 2 on CentOS5 from source (httpd-2.2.15.tar.gz) using: ./configure --prefix=/usr/local/apache make make install /usr/local/apache/bin/apachectl start I have verified that httpd is running in ps, and verified it is serving the default htdocs page. However, Apache is not found in 'service --status-all' and is not found in '/etc/init.d', so I cannot run 'service httpd status' or '/etc/init.d/httpd start', and other commands. Any ideas what I am missing?

    Read the article

  • AJAX based remote Online text editor

    - by dassouki
    I'm looking to install an online text editor on my server, that I can link to svn. I would like to have some form of syntax highlighting, keyboard shortcuts, and perhaps some text complete. Languages, python, php, sql, and C++ are a minimum ... any suggestions?

    Read the article

  • NSImage from website URL

    - by happyCoding25
    Hello, I need to create an NSImage from a url and then set it to an image view in my application. I tried some code I found online but it didn't work. If anyone knows how to do this any help would be great. Thanks

    Read the article

  • Python Tkinter - Edit external object within event handler?

    - by M3RPHY
    Hey all, As the title says, I'm grabbing the cursor location within a motion triggered event handler in Tkinter. I'd like to update an existing label widget with the location, however I cannot for the life of me figure out how to edit the label's text field (or any external object for that matter) within the event handler. From what I understand, event is the only argument passed to the handler, which means I can't pass the label object. How do I access objects outside of the handler? Apologize for the noobish question as I'm a C programmer new to Python. Thanks!

    Read the article

  • How do I find out what the windows constants like WM_MOUSEMOVE and WM_MOUSEDOWN are if I'm using C#?

    - by Siracuse
    I'm writing some code that uses some unmanaged calls into user32 functions such as SetWindowsHookEx, etc. This requires me to use lots of constants that I'm not sure what their value is. For example, if I want to set the hook as a low-level mouse hook I need to know that WM_MOUSE_LL = 14. Where can I look these up? I need to know what WM_MOUSEMOVE, WM_MOUSEDOWN, and more are. When I'm dealing with interop code, what is the easiest way for me to find these? Is it possible for me to import them into C# so they will be defined?

    Read the article

  • Facebook Connect application page Errors while loading page from application

    - by Lily
    Hi I am getting this error from my Facebook Application profile page Errors while loading page from application The URL is not valid. Please try again later. We appreciate your patience as the developers of SocialAnalysis and Facebook resolve this issue. Thanks! The application page is http://www.facebook.com/apps/application.php?id=333786146530 and when I try to go to the application, it gives me that error

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >