Daily Archives

Articles indexed Saturday March 5 2011

Page 3/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • How can I make nested string splits?

    - by Statement
    I have what seemed at first to be a trivial problem but turned out to become something I can't figure out how to easily solve. I need to be able to store lists of items in a string. Then those items in turn can be a list, or some other value that may contain my separator character. I have two different methods that unpack the two different cases but I realized I need to encode the contained value from any separator characters used with string.Split. To illustrate the problem: string[] nested = { "mary;john;carl", "dog;cat;fish", "plainValue" } string list = string.Join(";", nested); string[] unnested = list.Split(';'); // EEK! returns 7 items, expected 3! This would produce a list "mary;john;carl;dog;cat;fish;plainValue", a value I can't split to get the three original nested strings from. Indeed, instead of the three original strings, I'd get 7 strings on split and this approach thus doesn't work at all. What I want is to allow the values in my string to be encoded so I can unpack/split the contents just the way before I packed/join them. I assume I might need to go away from string.Split and string.Join and that is perfectly fine. I might just have overlooked some useful class or method. How can I allow any string values to be packed / unpacked into lists? I prefer neat, simple solutions over bulky if possible. For the curious mind, I am making extensions for PlayerPrefs in Unity3D, and I can only work with ints, floats and strings. Thus I chose strings to be my data carrier. This is why I am making this nested list of strings.

    Read the article

  • detect shutdown in window service

    - by deepu
    hi, i have a windows service that get user details and save the result into log text file. and, my problem is when i shut down or log off my system, i also would like to save the time that i down my system into that log file. but, i don't know how to do that. I checked the winproc method to detect shutdown operation but i was not able to use it on window service, on googling found it can be used with forms only. how can we detect user have clicked shutdown or log off and do some action. so,please give me some idea or suggestion on that. i have used it for logoff but on log entry is made when i logoff the system protected override void OnSessionChange(SessionChangeDescription changeDescription) { this.RequestAdditionalTime(250000); //gives a 25 second delay on Logoff if (changeDescription.Reason == SessionChangeReason.SessionLogoff) { // Add your save code here StreamWriter str = new StreamWriter("D:\\Log.txt", true); str.WriteLine("Service stoped due to " + changeDescription.Reason.ToString() + "on" + DateTime.Now.ToString()); str.Close(); } base.OnSessionChange(changeDescription); }

    Read the article

  • What libraries provide cross-platform 3D and P2P support?

    - by uckelman
    I'm trying to find a constellation of libraries which, taken together, meet the following requirements: Smooth scaling, rotation, panning (in two dimensions). I'll have a large bitmap (or SVG, in some cases), maybe up to 10000x10000 pixels, which serves as map, with some middling number of small bitmaps (or, again, possibly SVG) that can be dragged around over it. I need to be able to zoom, rotate, and pan this scene; however, the view will always be normal to (i.e., looking head-on at) the large bitmap, so I'm not really using the depth dimension. Peer-to-peer. I'd like for multiple users to be able to connect in order to share one of the scenes mentioned above, preferably peer-to-peer, without much configuration by the user. I'm intending to have a server running for cases where users are unable to connect P2P; I'd like to have the failover happen automatically, or possibly have some way of promoting clients who are capable to be servers themselves. Synchronization. Once a user has started dragging one of the small bitmaps (a piece), no other user should be able to drag that piece until the drag stops. I haven't thought of exactly how to do this---there might be a simple solution, or this kind of synchronization might be something that a library provides. Cross(ish)-platform. I need to be able to run on Linux, Windows, and Mac OS. It would be nice to also be able to run on tablets. Having mostly the same code for all platforms is a plus, but not absolutely necessary. (L)GPL compatible. I'm planning to release under the LGPL or GPL, preferably the latter, so I need libraries which have compatible licenses. I'm not set on any particular language, I'd like to use the library or libraries which make the work easiest, though my preference is to work in at most two languages for the project. (The Model could potentially be in one language and the View in another, so they could talk to each other via some protocol I define, if that would get me a better selection of libraries to use.) Can anyone offer suggestions for what to use?

    Read the article

  • Why bother to limit the types imported from a python package?

    - by Fast Fish
    When using many IDEs that support autocompletion with Python, things like this will show warnings, which I find annoying: from eventlet.green.httplib import BadStatusLine When switching to: rom eventlet.green.httplib * The warnings go away. What's the benefit to limiting imports to a specific set of types you'll use? Is the parsing faster? Reduces collisions? What other point is there? It seems the state of python IDEs and the nature of the typing system makes it hard for many IDEs to fully get right when a type import works and when it doesn't.

    Read the article

  • Could not resolve <fx:Script> to a component implementation.

    - by seref
    Hi, i created project with flexmojos maven archtype..i used flexmojos:flexbuilder and compile/run with FlashBuilder 4 everything is okay but when i try to compile project with flexmojos i got following error: [ERROR] Z:....\src\main\flex\Main.mxml:[6,-1] Could not resolve < fx:Script to a component implementation. [INFO] BUILD FAILURE my mxml: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" creationComplete="application1_creationCompleteHandler(event)"> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.FlexEvent; protected function application1_creationCompleteHandler(event:FlexEvent):void { Alert.show("success!!!!") } ]]></fx:Script> </s:Application> pom.xml like: ...... <packaging>swf</packaging> ...... <properties> <flex-sdk.version>4.1.0.16076</flex-sdk.version> <flexmojos.version>3.8</flexmojos.version> </properties> ...... <build> <sourceDirectory>src/main/flex</sourceDirectory> <testSourceDirectory>src/test/flex</testSourceDirectory> <plugins> <plugin> <groupId>org.sonatype.flexmojos</groupId> <artifactId>flexmojos-maven-plugin</artifactId> <version>${flexmojos.version}</version> <extensions>true</extensions> <dependencies> <dependency> <groupId>com.adobe.flex</groupId> <artifactId>compiler</artifactId> <version>${flex-sdk.version}</version> <type>pom</type> </dependency> </dependencies> <configuration> <compiledLocales> <locale>en_US</locale> </compiledLocales> <mergeResourceBundle>true</mergeResourceBundle> <accessible>true</accessible> <optimize>true</optimize> <targetPlayer>10.0.0</targetPlayer> <showWarnings>true</showWarnings> <linkReport>true</linkReport> </configuration> </plugin> </plugins> </build> <dependencies> <!-- Flex framework resource bundles --> <dependency> <groupId>com.adobe.flex.framework</groupId> <artifactId>flex-framework</artifactId> <version>${flex-sdk.version}</version> <type>pom</type> </dependency> <!-- Include unit test dependencies. --> <dependency> <groupId>com.adobe.flexunit</groupId> <artifactId>flexunit</artifactId> <version>4.0-rc-1</version> <type>swc</type> <scope>test</scope> </dependency> </dependencies> ....... maven output compiler config : INFO] Flex compiler configurations: -compiler.external-library-path C:\...\.m2\repository\com\adobe\flex \framework\playerglobal\4.1.0.16076\10.0\playerglobal.swc -compiler.include-libraries= -compiler.library-path C:\...\.m2\repository\com\adobe\flex\framework \datavisualization\4.1.0.16076\datavisualization-4.1.0.16076.swc C:\... \.m2\repository\com\adobe\flex\framework\flash-integration \4.1.0.16076\flash-integration-4.1.0.16076.swc C:\...\.m2\repository \com\adobe\flex\framework\flex\4.1.0.16076\flex-4.1.0.16076.swc C:\... \.m2\repository\com\adobe\flex\framework\framework \4.1.0.16076\framework-4.1.0.16076.swc C:\...\.m2\repository\com\adobe \flex\framework\osmf\4.1.0.16076\osmf-4.1.0.16076.swc C:\... \.m2\repository\com\adobe\flex\framework\rpc \4.1.0.16076\rpc-4.1.0.16076.swc C:\...\.m2\repository\com\adobe\flex \framework\spark\4.1.0.16076\spark-4.1.0.16076.swc C:\... \.m2\repository\com\adobe\flex\framework\sparkskins \4.1.0.16076\sparkskins-4.1.0.16076.swc C:\...\.m2\repository\com\adobe \flex\framework\textLayout\4.1.0.16076\textLayout-4.1.0.16076.swc C: \...\.m2\repository\com\adobe\flex\framework\utilities \4.1.0.16076\utilities-4.1.0.16076.swc C:\...\.m2\repository\com\adobe \flex\framework\datavisualization \4.1.0.16076\datavisualization-4.1.0.16076-en_US.rb.swc C:\... \.m2\repository\com\adobe\flex\framework\framework \4.1.0.16076\framework-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository \com\adobe\flex\framework\osmf\4.1.0.16076\osmf-4.1.0.16076- en_US.rb.swc C:\...\.m2\repository\com\adobe\flex\framework\rpc \4.1.0.16076\rpc-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository\com \adobe\flex\framework\spark\4.1.0.16076\spark-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository\com\adobe\flex\framework\textLayout \4.1.0.16076\textLayout-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository \com\adobe\flex\framework\flash-integration\4.1.0.16076\flash- integration-4.1.0.16076-en_US.rb.swc C:\...\.m2\repository\com\adobe \flex\framework\playerglobal\4.1.0.16076\playerglobal-4.1.0.16076- en_US.rb.swc -compiler.theme Z:\.....\target\classes\configs\themes\Spark \spark.css -compiler.accessible=true -compiler.allow-source-path-overlap=false -compiler.as3=true -compiler.debug=false -compiler.es=false -compiler.fonts.managers flash.fonts.JREFontManager flash.fonts.BatikFontManager flash.fonts.AFEFontManager flash.fonts.CFFFontManager -compiler.fonts.local-fonts-snapshot Z:\.....\target\classes \fonts.ser -compiler.keep-generated-actionscript=false -licenses.license flashbuilder4 952309948800588759250406 -licenses.license flexbuilder4.displayedStartPageAtLeastOneTime true -compiler.locale en_US -compiler.optimize=true -compiler.source-path Z:\.....\src\main\flex -compiler.strict=true -use-network=true -compiler.verbose-stacktraces=false -compiler.actionscript-file-encoding UTF-8 -target-player 10.0.0 -default-background-color 8821927 -default-frame-rate 24 -default-script-limits 1000 60 -default-size 500 375 -compiler.headless-server=false -compiler.keep-all-type-selectors=false -compiler.use-resource-bundle-metadata=true -metadata.date Fri Mar 04 14:04:37 EET 2011 -metadata.localized-title Main x-default -verify-digests=true -compiler.namespaces.namespace+=http://ns.adobe.com/mxml/2009,Z:\..... \target\classes\config-4.1.0.16076\mxml-2009-manifest.xml -compiler.namespaces.namespace+=library://ns.adobe.com/flex/spark,Z: \.....\target\classes\config-4.1.0.16076\spark-manifest.xml -compiler.namespaces.namespace+=library://ns.adobe.com/flex/mx,Z:\..... \target\classes\config-4.1.0.16076\mx-manifest.xml -compiler.namespaces.namespace+=http://www.adobe.com/2006/mxml,Z:\..... \PozitronUI\target\classes\config-4.1.0.16076\mxml-manifest.xml - static-link-runtime-shared-libraries=false -load-config= -metadata.language+=en_US any help... regards,

    Read the article

  • How to serialize a graph ?

    - by Michael
    This is an interview question: How to serialize a graph ? I saw this answer but I am not sure if this is enough. It looks like a very confusing "open question" and the candidates are probably expected to ask more questions about the requirements: what the nodes and edges are, how they are serialized themselves, is this graph weighted, directed, etc., how many nodes/edges are in the graph.What about the infrastructure ? Is it a plain file system or we should/can use a database ? So, how would you answer this question ?

    Read the article

  • Html + Css: How to create a auto-resizing rotated background?

    - by Sebastian P.R. Gingter
    Hi, image a complete black web page. On this web page is a 100% size white div that fills the whole page. I'd like to rotate this div by -7 degrees (or 7 degrees counter-clock wise). This will result in the black background being visible in triangles on the edges, just like you had placed a piece of paper on a desk and turned it a bit to the left. Actually this can be done with some css and it's working quite well (except for IE). The real problem now is: I'd like to have a normal, non-rotated div element on top of that to display the content in, so that only the background is rotated. Rotating a contained div counterwise doesn't work though, because through the two transformations the text will be blurry in all browsers. How can I realize that? Best would be a solution workiing in current Webkit browsers, FF3.5+ and IE7+. If only IE8+ I could live with that too.

    Read the article

  • stack management in CLR

    - by enableDeepak
    I understand the basic concept of stack and heap but great if any1 can solve following confusions: Is there a single stack for entire application process or for each thread starting in a project a new stack is created? Is there a single Heap for entire application process or for each thread starting in a project a new stack is created? If Stack are created for each thread, then how process manage sequential flow of threads (and hence stacks)

    Read the article

  • Code optimization - Unused methods

    - by Yochai Timmer
    How can I tell if a method will never be used ? I know that for dll files and libraries you can't really know if someone else (another project) will ever use the code. In general I assume that anything public might be used somewhere else. But what about private methods ? Is it safe to assume that if I don't see an explicit call to that method, it won't be used ? I assume that for private methods it's easier to decide. But is it safe to decide it ONLY for private methods ?

    Read the article

  • Which of these methods provides for the fastest page loading?

    - by chromedude
    I am building a database in MySQL that will be accessed by PHP scripts. I have a table that is the activity stream. This includes everything that goes on on the website (following of many different things, liking, upvoting etc.). From this activity stream I am going to run an algorithm for each user depending on their activity and display relevant activity. Should I create another table that stores the activity for each user once the algorithm has been run on the activity or should I run the algorithm on the activity table every time the user accesses the site? UPDATE:(this is what is above except rephrased hopefully in an easier to understand way) I have a database table called activity. This table creates a new row every time an action is performed by a user on the website. Every time a user logs in I am going to run an algorithm on the new rows (since the users last login) in the table (activity) that apply to them. For example if the user is following a user who upvoted a post in the activity stream that post will be displayed when the user logs in. I want the ability for the user to be able to access previous content applying to them. Would it be easiest to create another table that saved the rows that have already been run over with the algorithm except attached to individual users names? (a row can apply to multiple different users)

    Read the article

  • How do I extend the classpath used for 'grails run-app'

    - by Eric
    I have the following in my Config.groovy file: grails.config.locations = [ "classpath:env.groovy" ] Now, where exactly am I supposed to place "env.groovy" such that it is available on the CLASSPATH during grails run-app? The documentation here is sorely lacking. I am able to get it to work on the pure commandline by placing "env.groovy" in $APP_HOME/etc and then running: $ grails -classpath ./etc run-app This seems a little hackish, but I can live with it... However, I am unable to get any such configuration working when I launch run-app using the Grails eclipse plugin (STS): Unable to load specified config location classpath:env.groovy : class path resource [env.groovy] cannot be opened because it does not exist I've seen related posts here, here, here, and here but the answers have been unfulfilling. I am looking for a CLASSPATH-based solution that will work with 'run-app' in development mode (both commandline and from eclipse). I know how to set up the CLASSPATH for my deployment servlet container, so that is not an issue.

    Read the article

  • Escaping quotes twice in PHP

    - by Genadinik
    Hello, I have a complicated form where I first have to take some _GET parameters and obviously I have to do a mysql_real_escape_string() on them since I look stuff up in the database with them. Them problem for me is after the initial db lookup. When the user submits a form, I send them along as a _POST request and obviously have to do this mysql_real_escape_string call again just in case someone tries to hack my site with a faked form submission. Then the problem I have is the arguments are escaped twice and my queries begin to look strange like this: select field1 , field2 , from my_table where some_id = \'.$lookup_id.\' ... So the system seems to be adding \' and it is messing me up :) Also, in my other forms I have not seen such behavior. Any ideas on what may be causing this? One weird thing is that I tried to send unescaped parameters to the post, and the same problem happens. That is a clue, but not a sufficient one for me. :( Thanks, Alex

    Read the article

  • Sending object C from class A to class B

    - by user278618
    Hi, I can't figure out how to design classes in my system. In classA I create object selenium (it simulates user actions at website). In this ClassA I create another objects like SearchScreen, Payment_Screen and Summary_Screen. # -*- coding: utf-8 -*- from selenium import selenium import unittest, time, re class OurSiteTestCases(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 5555, "*chrome", "http://www.someaddress.com/") time.sleep(5) self.selenium.start() def test_buy_coffee(self): sel = self.selenium sel.open('/') sel.window_maximize() search_screen=SearchScreen(self.selenium) search_screen.choose('lavazza') payment_screen=PaymentScreen(self.selenium) payment_screen.fill_test_data() summary_screen=SummaryScreen(selenium) summary_screen.accept() def tearDown(self): self.selenium.stop() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main() It's example SearchScreen module: class SearchScreen: def __init__(self,selenium): self.selenium=selenium def search(self): self.selenium.click('css=button.search') I want to know if there is anything ok with a design of those classes?

    Read the article

  • How to map hash keys to methods for an encapsulated Ruby class (tableless model)?

    - by user502052
    I am using Ruby on Rails 3 and I am tryng to map a hash (key, value pairs) to an encapsulated Ruby class (tableless model) making the hash key as a class method that returns the value. In the model file I have class Users::Account #< ActiveRecord::Base def initialize(attributes = {}) @id = attributes[:id] @firstname = attributes[:firstname] @lastname = attributes[:lastname] end end def self.to_model(account) JSON.parse(account) end My hash is hash = {\"id\":2,\"firstname\":\"Name_test\",\"lastname\":\"Surname_test\"} I can make account = Users::Account.to_model(hash) that returns (debugging) --- id: 2 firstname: Name_test lastname: Surname_test That works, but if I do account.id I get this error NoMethodError in Users/accountsController#new undefined method `id' for #<Hash:0x00000104cda410> I think because <Hash:0x00000104cda410> is an hash (!) and not the class itself. Also I think that doing account = Users::Account.to_model(hash) is not the right approach. What is wrong? How can I "map" those hash keys to class methods?

    Read the article

  • Access Controller Context/ TempData from business objects

    - by thanikkal
    I am trying to build a session/tempdata provider that can be swapped. The default provider will work on top of asp.net mvc and it needed to access the .net mvc TempData from the business object class. I know the tempdata is available through the controller context, but i cant seem to find if that is exposed through HttpContext or something. I dont really want to pass the Controller context as an argument as that would dilute my interface definition since only asp.net based session provider needs this, other (using NoSQL DB etc) doesn't care about Controller Context. To clarify further, adding little more code here. my ISession interface look like this. and when this code goes to production, the session/tempdata is expected to work using NoSql db. But i also like to have another implementation that works on top of asp.net mvc session/tempdata for my dev testing etc. public interface ISession { T GetTempData<T>(string key); void PutTempData<T>(string key, T value); T GetSessiondata<T>(string key); void PutSessiondata<T>(string key, T value); }

    Read the article

  • Result of Long Positive Integers & Search and element in array..

    - by AGeek
    Hi, I have two Questions for which I cannot find answers by googling, but I find these questions very important for preparation.. Kindly explain only the logic, I will be able to code. In Search of Efficient Logic..... in terms of Memory and Time. WAP to add two long positive integers. What Data structure / data type we can use to store the numbers and result. What is the best way to search an element from an array in shortest time. Size of the array could be large enough, and any elements could be stored in the array(i.e. no range). Thanks.

    Read the article

  • Strange crashes when using MPMoviePlayerController in iPad and iPad simulator with iOS 4.2.

    - by Dave L
    I'm getting crashes when trying to play a movie using MPMoviePlayerController on the iPad and in the iPad simulator using iOS 4.2. I am building using xcode 3.2.5 and the 4.2 SDK. When running on an iPad using iOS 3.2 or in the iPad simulator 3.2, the same code works fine, but on an iPad running 4.2 or in the iPad simulator 4.2, it crashes. The crash is due to an exception for calling an unknown selector down somewhere deep in the cocoa libraries, something tries to call a selector called "setHitRectInsets:" on a UIButton object. Also, the crash happens after control has returned to the main event loop. Anybody have any idea what might be causing this? Here is the code (roughly, some extraneous stuff deleted that doesn't seem to have any effect) that is crashing: NSString *fullMovieFilename = [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:fullMovieFilename]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; moviePlayer.controlStyle = MPMovieControlStyleNone; // crash happens regardless of the setting here [moviePlayer.view setFrame:self.view.bounds]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; // crash happens whether i use fullscreen or not [moviePlayer play]; The same code also works just find if I build using Xcode 3.2.3 and the 4.0 SDK. The crash stack trace looks like this: 2011-03-04 23:08:22.017 MyApp[31610:207] -[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60 2011-03-04 23:08:22.020 MyApp[31610:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60' *** Call stack at first throw: ( 0 CoreFoundation 0x0151abe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0166f5c2 objc_exception_throw + 47 2 CoreFoundation 0x0151c6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0148c366 ___forwarding___ + 966 4 CoreFoundation 0x0148bf22 _CF_forwarding_prep_0 + 50 5 MediaPlayer 0x011b5bdb -[MPTransportControls createButtonForPart:] + 380 6 MediaPlayer 0x011b65d5 -[MPTransportControls _updateAdditions:removals:forPart:] + 110 7 MediaPlayer 0x011b4d78 -[MPTransportControls _reloadViewWithAnimation:] + 299 8 MediaPlayer 0x011b621a -[MPTransportControls setVisibleParts:] + 49 9 MediaPlayer 0x011b6e4a -[MPTransportControls initWithFrame:] + 173 10 MediaPlayer 0x011f9188 -[MPInlineTransportControls initWithFrame:] + 78 11 MediaPlayer 0x011f193a -[MPInlineVideoOverlay layoutSubviews] + 158 12 QuartzCore 0x00d6e451 -[CALayer layoutSublayers] + 181 13 QuartzCore 0x00d6e17c CALayerLayoutIfNeeded + 220 14 QuartzCore 0x00d6e088 -[CALayer layoutIfNeeded] + 111 15 MediaPlayer 0x011f130c -[MPInlineVideoOverlay setAllowsWirelessPlayback:] + 46 16 MediaPlayer 0x011f5b0d -[MPInlineVideoViewController _overlayView] + 526 17 MediaPlayer 0x011f6359 -[MPInlineVideoViewController _layoutForItemTypeAvailable] + 1350 18 Foundation 0x000e56c1 _nsnote_callback + 145 19 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 20 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 21 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 22 Foundation 0x000e75a9 -[NSNotificationCenter postNotificationName:object:] + 56 23 MediaPlayer 0x01184dd6 -[MPAVItem _updateForNaturalSizeChange] + 278 24 MediaPlayer 0x011818e4 __-[MPAVItem blockForDirectAVControllerNotificationReferencingItem:]_block_invoke_1 + 82 25 MediaPlayer 0x011899ba -[MPAVController _postMPAVControllerSizeDidChangeNotificationWithItem:] + 138 26 Foundation 0x000e56c1 _nsnote_callback + 145 27 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 28 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 29 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 30 Celestial 0x052a35b2 -[NSObject(NSObject_AVShared) postNotificationWithDescription:] + 176 31 Celestial 0x052ab214 -[AVController fpItemNotification:sender:] + 735 32 Celestial 0x052b5305 -[AVPlaybackItem fpItemNotificationInfo:] + 640 33 Celestial 0x052a3d5c -[AVObjectRegistry safeInvokeWithDescription:] + 211 34 Foundation 0x000fa9a6 __NSThreadPerformPerform + 251 35 CoreFoundation 0x014fc01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 36 CoreFoundation 0x0145a28b __CFRunLoopDoSources0 + 571 37 CoreFoundation 0x01459786 __CFRunLoopRun + 470 38 CoreFoundation 0x01459240 CFRunLoopRunSpecific + 208 39 CoreFoundation 0x01459161 CFRunLoopRunInMode + 97 40 GraphicsServices 0x01e4f268 GSEventRunModal + 217 41 GraphicsServices 0x01e4f32d GSEventRun + 115 42 UIKit 0x0038a42e UIApplicationMain + 1160 43 MyApp 0x0000837a main + 102 44 MpApp 0x00002009 start + 53 ) terminate called after throwing an instance of 'NSException' Been fighting with this for several days, and have searched the internet quite a bit for anybody having similar problems, all with no luck. Any suggestions would be greatly appreciated.

    Read the article

  • Is it possible to implement events in C++?

    - by acidzombie24
    I wanted to implement a C# event in C++ just to see if i could do it. I got stuck, i know the bottom is wrong but what i realize my biggest problem is... How do i overload the () operator to be whatever is in T in this case int func(float)? I cant? can i? Can i implement a good alternative? #include <deque> using namespace std; typedef int(*MyFunc)(float); template<class T> class MyEvent { deque<T> ls; public: MyEvent& operator +=(T t) { ls.push_back(t); return *this; } }; static int test(float f){return (int)f; } int main(){ MyEvent<MyFunc> e; e += test; }

    Read the article

  • ASP.NET: Building tree picker dialog using jQuery UI and TreeView control

    - by DigiMortal
    Selecting things from dialogs and data represented as trees are very common things we see in business applications. In this posting I will show you how to use ASP.NET TreeView control and jQuery UI dialog component to build picker dialog that hosts tree data. Source code You can find working example with source code from my examples repository in GitHub. Please feel free to give me feedback about my examples. Source code repository GitHub Building dialog box As I don’t like to invent wheels then I will use jQuery UI to solve the question related to dialogs. If you are not sure how to include jQuery UI to your page then take a look at source code - GitHub also allows you to browse files without downloading them. I add some jQuery based JavaScript to my page head to get dialog and button work. <script type="text/javascript">     $(function () {         $("#dialog-form").dialog({             autoOpen: false,             modal: true         });         $("#pick-node")             .button()             .click(function () {                 $("#dialog-form").dialog("open");                 return false;             });     }); </script> Here is the mark-up of our form’s main content area. <div id="dialog-form" title="Select node">     <asp:TreeView ID="TreeView1" runat="server" ShowLines="True"          ClientIDMode="Static" HoverNodeStyle-CssClass="SelectedNode">         <Nodes>             <asp:TreeNode Text="Root" Value="Root">                 <asp:TreeNode Text="Child1" Value="Child1">                     <asp:TreeNode Text="Child1.1" Value="Child1.1" />                     <asp:TreeNode Text="Child1.2" Value="Child1.2" />                 </asp:TreeNode>                 <asp:TreeNode Text="Child2" Value="Child2">                     <asp:TreeNode Text="Child2.1" Value="Child2.1" />                     <asp:TreeNode Text="Child2.2" Value="Child2.2" />                 </asp:TreeNode>             </asp:TreeNode>         </Nodes>     </asp:TreeView>     &nbsp; </div> <button id="pick-node">Pick user</button> Notice that our mark-up is very compact for what we will achieve. If you are going to use it in some real-world application then this mark-up gets even shorter – I am sure that in most cases the data you display in TreeView comes from database or some domain specific data source. Hacking TreeView TreeView needs some little hacking to make it work as client-side component. Be warned that if you need more than I show you here you need to write a lot of JavaScript code. For more advanced scenarios I suggest you to use some jQuery based tree component. This example works for you if you need something done quickly. Number one problem is getting over the postbacks because in our scenario postbacks only screw up things. Also we need to find a way how to let our client-side code to know that something was selected from TreeView. We solve these to problems at same time: let’s move to JavaScript links. We have to make sure that when user clicks the node then information is sent to some JavaScript function. Also we have to make sure that this function returns something that is not processed by browser. My function is here. <script type="text/javascript">     function         $("#dialog-form").dialog("close");         alert("You selected: " + value + " - " + text);         return undefined;     } </script> Notice that this function returns undefined. You get the better idea why I did so if you look at server-side code that corrects NavigateUrl properties of TreeView nodes. protected override void OnPreRender(EventArgs e) {     base.OnPreRender(e);                 if (IsPostBack)         return;     SetSelectNodeUrls(TreeView1.Nodes); } private void SetSelectNodeUrls(TreeNodeCollection nodes) {     foreach (TreeNode node in nodes)     {         node.NavigateUrl = "javascript:selectNode('" + node.Value +                             "','" + node.Text + "');";         SetSelectNodeUrls(node.ChildNodes);     }        } Now we have TreeView that renders nodes the way that postback doesn’t happen anymore. Instead of postback our callback function is used and provided with selected values. In this function we are free to use node text and value as we like. Result I applied some more bells and whistles and sample data to source code to make my sample more informative. So, here is my final dialog box. Seems very basic but it is not hard to make it look more professional using style sheets. Conclusion jQuery components and ASP.NET controls have both their strong sides and weaknesses. In this posting I showed you how you can quickly produce good results when combining jQuery  and ASP.NET controls without pushing to the limits. We used simple hack to get over the postback issue of TreeView control and we made it work as client-side component that is initialized in server. You can find many other good combinations that make your UI more user-friendly and easier to use.

    Read the article

  • 12 days to go for Messenger!

    - by TATWORTH
    In just over twelve days from now, the Messenger space probe will go into orbit around our innermost planet, Mercury. See http://messenger.jhuapl.edu/index.php for latest mission timings. After 2405 days in space and 15+ circuits of the sun (see http://messenger.jhuapl.edu/whereis/index.php), it about to go into orbit around Mercury. It has flown by Earth, Venus and Mercury in order to change velocity sufficiently to be able to go into orbit without requiring a massive amount of propellant.

    Read the article

  • Degraded RAID-5 array with lvm2 lost superblock and partition table

    - by Fred Phillips
    I have a RAID-5 array of 4x1TB hard disks with one lvm2 partition on Ubuntu Linux 10.04 LTS. One of the disks has failed. I have re-assembled the array without this failed disk but now mdadm --examine claims the array has no superblock and fdisk says it has no partition table. What can I do to recover the data? # mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Sat Mar 5 14:43:49 2011 Raid Level : raid5 Array Size : 2930276352 (2794.53 GiB 3000.60 GB) Used Dev Size : 976758784 (931.51 GiB 1000.20 GB) Raid Devices : 4 Total Devices : 4 Persistence : Superblock is persistent Update Time : Sat Mar 5 15:06:49 2011 State : clean, degraded Active Devices : 3 Working Devices : 3 Failed Devices : 1 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : boba:1 (local to host boba) UUID : 52eb4bc9:c3d8aab5:e0699505:e0e1aa05 Events : 18 Number Major Minor RaidDevice State 0 8 1 0 active sync /dev/sda1 1 8 65 1 active sync /dev/sde1 2 8 49 2 active sync /dev/sdd1 3 0 0 3 removed 4 8 17 - faulty spare /dev/sdb1 # mdadm --examine /dev/md0 mdadm: No md superblock detected on /dev/md0. # fdisk -l /dev/md0 Disk /dev/md0: 3000.6 GB, 3000602984448 bytes 2 heads, 4 sectors/track, 732569088 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 524288 bytes / 1572864 bytes Disk identifier: 0x00000000 Disk /dev/md0 doesn't contain a valid partition table # cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] md0 : active raid5 sdb1[4](F) sda1[0] sdd1[2] sde1[1] 2930276352 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/3] [UUU_] unused devices: <none>

    Read the article

  • Resotre single users Exchange 2003 mailbox from backup

    - by Campo
    I take weekly backups of exchange in full. I also take complete weekly backups of the entire server. It is a Server 2003 R2 with AD and Exchange 2003 all on one box. One users inbox has disappeared. She has 19000+ junk items now. It is possible the inbox got mixed into the junk. Regardless it is such a huge mess she is not going to go through all of that.... I want to restore he mailbox from the backup. I followed this MS KB http://support.microsoft.com/kb/823176 I had to use Method 3. I have a VM of Server 2003 R2 with exchange but I am having failures on the restore from NT backup. The backup log just states to check the application log.... Application log points to backup log... Only info Is failed to restore Only thing different is the computer name... The only error I can find is in the Applicaiton log. Information Store Database not found All others just say that the backup failed. Any assistance is greatly appreciated.

    Read the article

  • Proper web server setup

    - by DMin
    I just got myself a slicehost basic slice to play around with so I can learn how to setup web-servers. I have Ubuntu 10.04.2 installed on the server. I was able to successfully get the server up and running from scratch, these were the things I did - following this tutorial. I know this is probably just a starters tutorial, so, I was wondering if you guys can tell me what you like to do while setting up production servers. These are the steps that were followed : Update and Upgrade Ubuntu sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server Backup a copy of and edit apache2.conf Set : 'ServerTokens Full' to 'ServerTokens Prod''ServerSignature On' to 'ServerSignature Off' Backup php.ini and then Change “expose_php = On” to “expose_php = Off” Restart Apache Install Shorewall firewall Configure Shorewall to only accept HTTP and SSH connections(in the rules file) Enable shorewall on startup Add the website to the server : sudo usermod -g www-data root sudo chown -R www-data:www-data /var/www sudo chmod -R 775 /var/www I want make this CommunityWiki but can't seem to find the option to do it. Please feel free to add any feedback on the processes and things I am doing right/wrong. Much appriciated, thanks! :)

    Read the article

  • How to prevent samba from holding a file lock after a client disconnects?

    - by Jean-Francois Chevrette
    Here I have a Samba server (Debian 5.0) thats is configured to host Windows XP profiles. Clients connects to this server and work on their profiles directly on the samba share (the profile is not copied locally). Every now and then, a client may not shutdown properly and thus Windows does not free the file locks. When looking at the samba locking table, we can see that many files are still locked even though the client is not connected anymore. In our case, this seems to occur with lockfiles created by Mozilla Thunderbird and Firefox. Here's an example of the samba locking table: # smbstatus -L | grep DENY_ALL | head -n5 Pid Uid DenyMode Access R/W Oplock SharePath Name Time -------------------------------------------------------------------------------------------------- 15494 10345 DENY_ALL 0x3019f RDWR EXCLUSIVE+BATCH /home/CORP/user1 app.profile/user1.thunderbird/parent.lock Mon Nov 22 07:12:45 2010 18040 10454 DENY_ALL 0x3019f RDWR EXCLUSIVE+BATCH /home/CORP/user2 app.profile/user2.thunderbird/parent.lock Mon Nov 22 11:20:45 2010 26466 10056 DENY_ALL 0x3019f RDWR EXCLUSIVE+BATCH /home/CORP/user3 app.profile/user3.firefox/parent.lock Mon Nov 22 08:48:23 2010 We can see that the files were opened by Windows and imposed a DENY_ALL lock. Now when a client reconnects to this share and tries to open those files, samba says that they are locked and denies access. Is there any way to work around this situation or am I missing something? Edit: We would like to avoid disabling file locks on the samba server because there are good reasons to have those enabled.

    Read the article

  • What are some of the best answer file settings for a WDS Deployment?

    - by drpcken
    I've had my head buried in answer files for days now and have gotten quite comfortable setting them up, test, etc... I use a handful of Components to help my migrations, for my unattend.xml I like: Windows-International-Core-WinPE -- this is good for setting Locales the preboot environment (en-us for us english US speakers). Keeps me from having to set these on the initial image boot. Windows-Setup_neutral -- I like the WindowsDeploymentServices -> ImageSelection, especially if I'm only pushing a single image. This keeps me from having to select it each time. My OOBE_Unattend.xml is really useful and I barely have to touch anything during this part of the installation: Windows-Shell-Setup_neutral -- This lets me put a ProductKey in for my MAK volume license (very useful and time saving). I can also set the TimeZone for the installation. Windows UnattendedJoin_neutral -- I couldn't live without this component. It joins the machine on my domain before logging in as a domain administrator. I would hate to not have this ability. Windows-International-Core -- Again this component really speeds up the OOBE process. I configure my locals and time zone so I don't have to do it by hand when the machine enteres OOBE. Windows-Shell-Setup -- Allows you to configure an autologon when the new machine is finished. I like to logon as a domain admin automatically for customizing and troubleshooting the new machine immediately after it is imaged. Also the OOBE component under here lets me skip the EULA, Hide Wireless Setup, and set my default NetworkLocation. All of this makes the entire OOBE totally automated. What are some other good components I am missing as far as helping me get these images pushed and configured as quickly as possible?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >