pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
9,082,640 | 0 | <p>From my experimenting, I've found that Safari 5 (for desktop and iOS) will most certainly render your page in the way you intend using either one of your solutions. Firefox 9, on the other hand, does not appear to respect @-moz-keyframe or -moz-animation rules if they are placed in @media blocks (and both ignore the W3C @keyframe and non-vendor specific animation properties)</p> |
22,710,384 | 0 | Make {{!LOOP}} increase by 10 in iMacros <p>I have problems with making !LOOP jump +10 each time instead of +1.</p> <p>Here is my code:</p> <pre><code>VERSION BUILD=8810214 RECORDER=FX TAB T=1 SET !ERRORIGNORE YES SET !VAR1 100 SET !LOOP {{!VAR1}} URL GOTO=http://www.example.com/lui/?page={{!LOOP}} WAIT SECONDS=1 ADD !VAR1 10 </code></pre> <p>Running this still makes iMacros jump +1 each loop. </p> <p>Above sample goes to page=100,page=101,page=102,page=103 <strong>instead of</strong> page=100,page=110,page=120</p> <p>Best regards,</p> <p>Lui Kang</p> |
12,609,112 | 0 | <p>Try something like this in your <code>wwwpublic</code> directory, preferably before any routing rules you may have:</p> <pre><code>RewriteEngine On # conditions to check that current request doesn't point to a valid resource RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # condition to check that request is for the /spanish/ directory RewriteCond %{REQUEST_URI} ^/spanish/(.+)$ # conditions to check if the /spanish/ is removed whether it would point to a valid resource RewriteCond %{DOCUMENT_ROOT}/%1 -f [OR] RewriteCond %{DOCUMENT_ROOT}/%1 -d # all conditions match, rewrite RewriteRule ^/?spanish/(.+)$ /$1 [L] </code></pre> |
37,385,987 | 0 | GCM and swift can register and receive a success notification but no other push noteificiatons <p>Update: Ok so I redid all my certs and now I am getting this by testing the GCM at this site <a href="http://techzog.com/development/gcm-notification-test-tool-android/" rel="nofollow">http://techzog.com/development/gcm-notification-test-tool-android/</a></p> <pre><code> URL: http://android.googleapis.com/gcm/send Headers: Array ( [0] => Authorization: key=AIzaSyBPTQGXlyImFWPda1s2LVUKIN98uMS0Bac [1] => Content-Type: application/json ) 1 Fields: Array ( [registration_ids] => Array ( [0] => fBspb1tyYDg:APA91bE0-pzjJrJodW2JuNvnEZSkUaw0rBjf0gkwu2Yi9GaS8WcrhZII2LnDcclwd4K5W51osjxfBCM7E76Ck7EDG4YHEESAesXZBgrSrHDQNAjGPv1VgOi-zkFi1biZSQzeaEbS3xch ) [data] => Array ( [message] => Koimute [] => ) ) 1 Result: Unauthorized Error 401 </code></pre> <p>So this means that it is being basically stopped from getting to the phone I think.</p> <p>UPDATE: Ok so I have been working at it and have tried to change the cert around and fool with the settings. now my console is printing out that I am connected to the GCM. But, still I do not receive any notification from the server at all. Here is what my console is printing</p> <pre><code>0028-05-24 12:21:32.829: GCM | GCM library version 1.1.4 0028-05-24 12:21:32.841: GCM | Invalid key in checkin plist: GMSInstanceIDDeviceDataVersion 2016-05-24 12:21:32.856 MyApp[560:] <GMR/INFO> App measurement v.2003000 started 2016-05-24 12:21:32.857 MuApp[560:] <GMR/INFO> To enable debug logging set the following application argument: -GMRDebugEnabled 0028-05-24 12:21:32.920: GCM | Invalid key in checkin plist: GMSInstanceIDDeviceDataVersion 2016-05-24 12:21:33.053 MyApp[560:106171] INFO: GoogleAnalytics 3.14 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X000002 Registration Token: My token i get from GCM 2016-05-24 12:21:33.067 MyApp[560:] <GMR/INFO> App measurement enabled Connected to GCM 2016-05-24 12:21:33.937 MyApp[560:106213] INFO: GoogleAnalytics 3.14 -[GAIBatchingDispatcher hitsForDispatch] (GAIBatchingDispatcher.m:368): No pending hits. </code></pre> <p>The GCM | Invalid key in checkin plist: GMSInstanceIDDeviceDataVersion error from what I gathered means that it is working and is fine. They said that they will fix this in a later release</p> <p>OLD: So I have set up the GCM as well as a Google Analytics in my iOS project. The Analytics works perfect and all. Thats why I don't think its my Google service json that is the problem. I can successfully register to receive a token from the GCM server. But when I try to send a push notification nothing happens. I do receive a notification when it registers successfully so I think that my notification centre is working too. I follows the steps for creating the certificates as well. So I do not know where the problem is.: I am also using a third party APNs tester to rule out my server being the issues. I am using APN Tester. The APN tester returns this from doing a push notification:</p> <pre><code>gateway.sandbox.push.apple.com:2195 2016-05-23 07:56:02 +0000: Connected to server gateway.sandbox.push.apple.com 2016-05-23 07:56:02 +0000: Set SSL connection 2016-05-23 07:56:02 +0000: Set peer domain name gateway.sandbox.push.apple.com 2016-05-23 07:56:02 +0000: Keychain Opened 2016-05-23 07:56:02 +0000: Certificate data for Apple Development IOS Push Services: com.mywebpage.jp.MyClient initialized successfully 2016-05-23 07:56:02 +0000: Sec Identity created 2016-05-23 07:56:02 +0000: Client certificate created 2016-05-23 07:56:03 +0000: Connected 2016-05-23 07:56:03 +0000: Token: <0000000c 00000003 00001bff ff1b0000 00001bff ff1b0000 00001bff ff1b0000 00001bff ff1b0000 00001bff 00000e82 000000ef 0000003a 3a000000 0000003a 3a000000 0000003a 3a000000> 2016-05-23 07:56:03 +0000: Written 92 bytes sending data to gateway.sandbox.push.apple.com:2195 2016-05-23 07:56:03 +0000: Disconnected from server gateway.sandbox.push.apple.com:2195 </code></pre> <p>This is my AppDeligate file</p> <pre><code>import UIKit import Foundation @UIApplicationMain //add this for GCM //, GGLInstanceIDDelegate, GCMReceiverDelegate class AppDelegate: UIResponder, UIApplicationDelegate, GGLInstanceIDDelegate, GCMReceiverDelegate{ let loginInformation = NSUserDefaults.standardUserDefaults() var window: UIWindow?; //MARK: Varaibles for GCM var connectedToGCM = false var subscribedToTopic = false var gcmSenderID: String? var registrationToken: String? var registrationOptions = [String: AnyObject]() let registrationKey = "onRegistrationCompleted" let messageKey = "onMessageReceived" let subscriptionTopic = "/topics/global" func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. APIManager.sharedInstance.setAuthorization(Config.API_USERNAME, password: Config.API_PASSWORD) // [START_EXCLUDE] // Configure the Google context: parses the GoogleService-Info.plist, and initializes // the services that have entries in the file var configureError:NSError? GGLContext.sharedInstance().configureWithError(&configureError) assert(configureError == nil, "Error configuring Google services: \(configureError)") gcmSenderID = GGLContext.sharedInstance().configuration.gcmSenderID // [END_EXCLUDE] // Register for remote notifications let settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil) application.registerUserNotificationSettings(settings) application.registerForRemoteNotifications() // [END register_for_remote_notifications] // [START start_gcm_service] let gcmConfig = GCMConfig.defaultConfig() gcmConfig.receiverDelegate = self GCMService.sharedInstance().startWithConfig(gcmConfig) // [END start_gcm_service] //Google Analyitics functions // [START tracker_swift] // Configure tracker from GoogleService-Info.plist. //var configureGAError:NSError? GGLContext.sharedInstance().configureWithError(&configureError) assert(configureError == nil, "Error configuring Google services: \(configureError)") // Optional: configure GAI options. let gai = GAI.sharedInstance() gai.trackUncaughtExceptions = true // report uncaught exceptions gai.logger.logLevel = GAILogLevel.Verbose // remove before app release // [END tracker_swift] return true } func applicationDidEnterBackground(application: UIApplication) { GCMService.sharedInstance().disconnect() // [START_EXCLUDE] self.connectedToGCM = false // [END_EXCLUDE] } func applicationDidBecomeActive(application: UIApplication) { // Connect to the GCM server to receive non-APNS notifications GCMService.sharedInstance().connectWithHandler({(error:NSError?) -> Void in if let error = error { print("Could not connect to GCM: \(error.localizedDescription)") } else { self.connectedToGCM = true print("Connected to GCM") } }) } // [START receive_apns_token] func application( application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData ) { // [END receive_apns_token] // [START get_gcm_reg_token] // Create a config and set a delegate that implements the GGLInstaceIDDelegate protocol. let instanceIDConfig = GGLInstanceIDConfig.defaultConfig() instanceIDConfig.delegate = self // Start the GGLInstanceID shared instance with that config and request a registration // token to enable reception of notifications GGLInstanceID.sharedInstance().startWithConfig(instanceIDConfig) registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken, kGGLInstanceIDAPNSServerTypeSandboxOption:true] GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler) // [END get_gcm_reg_token] } // [START ack_message_reception] func application( application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { print("Notification received: \(userInfo)") // This works only if the app started the GCM service GCMService.sharedInstance().appDidReceiveMessage(userInfo); // Handle the received message // [START_EXCLUDE] NSNotificationCenter.defaultCenter().postNotificationName(messageKey, object: nil, userInfo: userInfo) // [END_EXCLUDE] } func application( application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler handler: (UIBackgroundFetchResult) -> Void) { print("Notification received: \(userInfo)") // This works only if the app started the GCM service GCMService.sharedInstance().appDidReceiveMessage(userInfo); // Handle the received message // Invoke the completion handler passing the appropriate UIBackgroundFetchResult value // [START_EXCLUDE] NSNotificationCenter.defaultCenter().postNotificationName(messageKey, object: nil, userInfo: userInfo) handler(UIBackgroundFetchResult.NoData); // [END_EXCLUDE] } // [END ack_message_reception] func registrationHandler(registrationToken: String!, error: NSError!) { if (registrationToken != nil) { self.registrationToken = registrationToken print("Registration Token: \(registrationToken)") //store the registation token for use in the postData function in the login page self.loginInformation.setObject(self.registrationToken, forKey: "GCMToken") self.loginInformation.synchronize() let userInfo = ["registrationToken": registrationToken] NSNotificationCenter.defaultCenter().postNotificationName( self.registrationKey, object: nil, userInfo: userInfo) } else { print("Registration to GCM failed with error: \(error.localizedDescription)") let userInfo = ["error": error.localizedDescription] NSNotificationCenter.defaultCenter().postNotificationName( self.registrationKey, object: nil, userInfo: userInfo) } } // [START on_token_refresh] func onTokenRefresh() { // A rotation of the registration tokens is happening, so the app needs to request a new token. print("The GCM registration token needs to be changed.") GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID, scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler) } // [END on_token_refresh] // [START upstream_callbacks] func willSendDataMessageWithID(messageID: String!, error: NSError!) { if (error != nil) { // Failed to send the message. } else { // Will send message, you can save the messageID to track the message } } // [START receive_apns_token_error] func application( application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError ) { print("Registration for remote notification failed with error: \(error.localizedDescription)") // [END receive_apns_token_error] let userInfo = ["error": error.localizedDescription] NSNotificationCenter.defaultCenter().postNotificationName( registrationKey, object: nil, userInfo: userInfo) } func didSendDataMessageWithID(messageID: String!) { // Did successfully send message identified by messageID } // [END upstream_callbacks] func didDeleteMessagesOnServer() { // Some messages sent to this device were deleted on the GCM server before reception, likely // because the TTL expired. The client should notify the app server of this, so that the app // server can resend those messages. } //MRAK: End of GCM Function func applicationWillTerminate(application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } func applicationWillEnterForeground(application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } func applicationWillResignActive(application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } } </code></pre> <p>And this is my testing page where it receives the notification of a successful registration:</p> <pre><code>class PlayGroundController: UIViewController{ @IBOutlet weak var registeringLabel: UILabel! @IBOutlet weak var registrationProgressing: UIActivityIndicatorView! override func viewDidLoad() { super.viewDidLoad() let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(PlayGroundController.updateRegistrationStatus(_:)), name: appDelegate.registrationKey, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(PlayGroundController.showReceivedMessage(_:)), name: appDelegate.messageKey, object: nil) registrationProgressing.hidesWhenStopped = true registrationProgressing.startAnimating() } func updateRegistrationStatus(notification: NSNotification) { registrationProgressing.stopAnimating() if let info = notification.userInfo as? Dictionary<String,String> { if let error = info["error"] { registeringLabel.text = "Error registering!" showAlert("Error registering with GCM", message: error) } else if let _ = info["registrationToken"] { registeringLabel.text = "Registered!" let message = "Check the xcode debug console for the registration token that you " + " can use with the demo server to send notifications to your device" showAlert("Registration Successful!", message: message) } } else { print("Software failure. Guru meditation.") } } func showReceivedMessage(notification: NSNotification) { if let info = notification.userInfo as? Dictionary<String,AnyObject> { if let aps = info["aps"] as? Dictionary<String, String> { showAlert("Message received", message: aps["alert"]!) } } else { print("Software failure. Guru meditation.") } } func showAlert(title:String, message:String) { //Set up for the title color let attributedString = NSAttributedString(string: title, attributes: [ NSFontAttributeName : UIFont.systemFontOfSize(15), //your font here, NSForegroundColorAttributeName : UIColor.whiteColor() ]) //Set up for the Message Color let attributedString2 = NSAttributedString(string: message, attributes: [ NSFontAttributeName : UIFont.systemFontOfSize(15), //your font here, NSForegroundColorAttributeName : UIColor.whiteColor() ]) let alert = UIAlertController(title: title,message: message, preferredStyle: .Alert) alert.setValue(attributedString, forKey: "attributedTitle") alert.setValue(attributedString2, forKey: "attributedMessage") //alert.view.tintColor = UIColor.whiteColor() let dismissAction = UIAlertAction(title: "Dismiss", style: .Destructive, handler: nil) alert.addAction(dismissAction) self.presentViewController(alert, animated: true, completion: nil) //set the color of the Alert //let subview = alert.view.subviews.first! as UIView //let alertContentView = subview.subviews.first! as UIView //alertContentView.backgroundColor = UIColor.blackColor() let subview :UIView = alert.view.subviews.last! as UIView let alertContentView = subview.subviews.last! as UIView alertContentView.backgroundColor = UIColor.blackColor() //alertContentView.backgroundColor = UIColor.greenColor() //Changes is to a grey color :( /* alertContentView.backgroundColor = UIColor( red: 0, green: 0, blue: 0, alpha: 1.0) //Also another Grey Color Not batman black */ //alertContentView.backgroundColor = UIColor.blueColor() //turns into a purple } override func preferredStatusBarStyle() -> UIStatusBarStyle { return UIStatusBarStyle.LightContent } deinit { NSNotificationCenter.defaultCenter().removeObserver(self) } </code></pre> |
2,853,147 | 0 | <p>If you use the Intel C compiler, and set sufficiently high optimisation options, you will find that some of your loops get 'vectorised', which means the compiler has rewritten them to use SSE-style instructions.</p> <p>If you want to use SSE operations directly, you use the intrinsics defined in the 'xmmintrin.h' header file; say</p> <p>#include <xmmintrin.h></p> <p>__m128 U, V, W; float ww[4];</p> <p>V=_mm_set1_ps(1.5);</p> <p>U=_mm_set_ps(0,1,2,3);</p> <p>W=_mm_add_ps(U,V);</p> <p>_mm_storeu_ps(ww,W);</p> |
14,158,129 | 0 | <pre><code>foreach (array_keys($_SESSION['Bookings']['date']) as $key) { $myDate = $_SESSION['Bookings']['date'][$key]; $myPrice = $_SESSION['Bookings']['price'][$key]; } </code></pre> <p>Should work?</p> <p>Some info on: <a href="http://php.net/array_keys" rel="nofollow">array_keys</a></p> |
31,186,489 | 0 | <p>You need to do this on a trial and error basis. And you need to change a static parent. Check this example and follow it.</p> <p><strong>Snippet</strong></p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function () { $(window).scroll(function () { if ($(window).scrollTop() > 125) $("body").addClass("fixed"); else $("body").removeClass("fixed"); }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>* {font-family: 'Segoe UI'; margin: 0; padding: 0; list-style: none;} h1, h2 {font-weight: normal;} h1 {font-size: 1.5em;} h2 {font-size: 1.25em;} h1, h2, p {margin: 0 0 15px;} .fixed {padding-top: 42px;} .fixed .static {position: fixed; top: 0; width: 100%; background: #fff; padding-bottom: 15px;}</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <h1>Static Header Example</h1> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. At, cumque inventore laudantium quod, vel pariatur dolore obcaecati veniam aspernatur aliquam ad dolorum possimus illo facilis et totam nam unde, sint?</p> <h2 class="static">This is gonna be Static!</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officiis tempore praesentium eos odio nobis dignissimos labore expedita corrupti sapiente perferendis consequuntur, in, eveniet error! Officiis iste architecto eos? Deserunt, delectus!</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit, blanditiis dolore ipsum odit sint delectus assumenda excepturi dolor rem aperiam magni eligendi quidem suscipit nam ullam porro tenetur tempora ut!</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officiis tempore praesentium eos odio nobis dignissimos labore expedita corrupti sapiente perferendis consequuntur, in, eveniet error! Officiis iste architecto eos? Deserunt, delectus!</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Velit, blanditiis dolore ipsum odit sint delectus assumenda excepturi dolor rem aperiam magni eligendi quidem suscipit nam ullam porro tenetur tempora ut!</p></code></pre> </div> </div> </p> |
13,725,370 | 0 | <p>If you need to analyse C# code at runtime, take a look at <a href="http://en.wikipedia.org/wiki/Microsoft_Roslyn" rel="nofollow">Roslyn</a>.</p> |
36,131,248 | 0 | tfs unable to browse projects <p>I'm using Visual Studio Team Services (was TFS Online) server {MyProject}.visualstudio.com. I'm able to connect to the server, map the project, even receive a review request, but I can't see my team projects under DefaultCollection. Currently when I'm opening the Source Control Explorer I'm only seeing {MyProject}.visualstudio.com\DefaultCollection underlying projects are missing, but my user is in project team members list.</p> <p><strong>What I missed, what I should do else to be able to browse my projects, get and work with them?</strong></p> <p>Note: My account was not a microsoft account. I received an email to join the visual studio after tfs administrator added my email as the project team member. I follow to the link and I create a new account during VS sign up using that email and then successfully signed in.</p> <p><a href="https://i.stack.imgur.com/i1Fpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i1Fpm.png" alt="enter image description here"></a></p> <p>Thanks a lot</p> |
12,768,279 | 0 | Is there a replacement for the Handler class? <p>I love the convenience of the Handler class; I can easily queue messages and even delay messages. However, all the code runs on the UI thread which is causing stuttering of the animation.</p> <p>Is there a class, like Handler, that doesn't run on the UI thread ?</p> |
3,041,155 | 0 | ListViewWebPart problem with custom Event list template <p>I have copied C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\EventsList\Events\schema.xml into a custom list template feature. I have another feature that creates the list instance:</p> <pre><code><ListInstance FeatureId="58c1f9c9-eadb-41dd-a358-e04b2f2e30c0" TemplateType="100322" Title="$Resources:core,calendarList" Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder" OnQuickLaunch="TRUE"> </ListInstance> </code></pre> <p>and then places a ListViewWebPart on the page:</p> <pre><code><View List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder" BaseViewID="0" WebPartZoneID="TopRightRow" WebPartOrder="3" /> </code></pre> <p>I activate the features and go to the site. The webpart says: There are currently no upcoming events. To add a new event, click "Add new event". I click Add new event, enter the information, and click Save. The page refreshes, the no upcoming events message disappears, but there are no items displayed! If I go to the calendar the list item is there. What gives?</p> <p>I change the list instance definition so that it uses the out of the box template:</p> <pre><code><ListInstance FeatureId="00bfea71-ec85-4903-972d-ebe475780106" TemplateType="106 Title="$Resources:core,calendarList" Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder" OnQuickLaunch="TRUE"> </ListInstance> </code></pre> <p>When I rebuild the site, activate the features, and repeat the "add new" steps, the item is now displaying properly in the webpart after the page refresh.</p> <p>I've backed out all of my changes from the custom list template. It is now identical to the OOTB schema. Why doesn't my custom list template work, but the OOTB list template does?</p> |
4,896,063 | 0 | <p>class != struct in C#.</p> <p>Also, the packing of your structure is not the same between the C# version and the C++ version.</p> |
13,865,580 | 0 | <p>Your access pattern for <code>M</code> is perfectly coalesced, so the global memory with the help of the cache hierarchy of compute capability devices > 2.x will give the best performance for that array. </p> <p>You have the same access pattern in K and J, so, the accesses are also coalesced. So, there is no reason for not use the global memory and get the best performance</p> <p>As you commented that <em>memory limits are obviously not a problem</em> I understand that the size of the arrays will be small, so you would expect a good behaviour of the cache hierarchy.</p> <p>If you want to go one step forward, you could copy the <code>K</code> array to 1D texture memory and compare the performance of both approach. </p> |
4,686,148 | 0 | <p>If you take a look at the <a href="http://docs.amazonwebservices.com/ElasticMapReduce/latest/DeveloperGuide/CLI_CreateStreaming.html" rel="nofollow">Amazon Elastic MapReduce Developer Guide</a> you need to specify the location of input data, output data, mapper script and reducer script in S3 in order to create a MapReduce job flow.</p> <p>If you need to do some pre-processing (such as dumping the MapReduce input file from a database) or post-processing (such as splitting the MapReduce output file to other locations in S3), you will have to automate those tasks separately from the MapReduce job flow.</p> <p>You may use the <a href="http://boto.cloudhackers.com/" rel="nofollow"><code>boto</code> library</a> to write those pre-processing and post-processing scripts. They can be run on an EC2 instance or any other computer with access to the S3 bucket. Data transfer from EC2 may be cheaper and faster, but if you don't have an EC2 instance available for this, you could run the scripts in your own computer... unless there is too much data to transfer!</p> <p>You can go as far as you want with automation: You may even orchestrate the whole process of generating input, launching a new MapReduce job flow, waiting for the job to finish and processing output accordingly, so that given the proper configuration, the whole thing is reduced to pushing a button :)</p> |
5,664,230 | 0 | Detect when cut-ed data is being pasted in MFC COleDataSource VS2008 <p>I need to detect when another application /window in my app does paste on my previously set data , so I can remove it from my source window. I have discovered that <code>COleDataSource::DelaySetData</code> <em>theoretically</em> does this and <code>COleDataSource::OnSetData</code> would get called when paste occurs, but I can not be sure. MSDN is (as usually) vague about this matter and does not clearly say one way or the other.I will be using an custom format and watever format is explorer using for cut/paste files. So the question is how EXACTLY (not theoretically) can this be done. I really need to remove the items from my window <strong>if and only if</strong> they are pasted somewhere else. </p> |
4,471,961 | 0 | I am setting up a SharePoint Development environment. Can I setup Sharepoint on a VM and Visual Studio on my production computer? <p>I am going to be learning how to do SharePoint 2010 development and as such I am setting up my environment? I have a couple of questions about that.</p> <p>First, I am following a couple of helpful articles on how to do it as follows... </p> <p><a href="http://geekswithblogs.net/manesh/archive/2010/05/28/building-the-ultimate-sharepoint-2010-development-environment.aspx" rel="nofollow">http://geekswithblogs.net/manesh/archive/2010/05/28/building-the-ultimate-sharepoint-2010-development-environment.aspx</a> </p> <p>and </p> <p><a href="http://msdn.microsoft.com/en-us/library/ee554869%28office.14%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee554869%28office.14%29.aspx</a> </p> <p>Both of these article recommend setting up Sharepoint on a server environment or VM and THEN setup Visual Studio on that same environment. </p> <p>I was wondering if it will work to setup Sharepoint on a VM Guest and use my existing installation of Visual Studio (my VM host) to do the work. To do Sharepoint development do you HAVE to install Visual Studio on the VM Guest with Sharepoint? What do I lose if I just use my production install of Visual Studio (or will it just plain not work?). </p> <p>It just seems counter-productive to have two development environments (and I refuse to install Sharepoint on my production machine...at least right now.)</p> <p>Also, will SharePoint Foundation edition (rather than full server version) function just fine for learning and development or will I find that I am eventually going to hit barriers and limitations with it. </p> <p>Thanks in advance for your help.</p> <p>Seth</p> |
15,772,958 | 0 | How can I copy dependencies from the local repository to some specific location? <p>I want copy all the dependencies from the local repository to some specific location without have to specify which dependencies should be copied, I just want that copy all the dependencies that I declared in the pom in specific folder. </p> <p><a href="http://pastebin.com/3neyQJyp" rel="nofollow">http://pastebin.com/3neyQJyp</a></p> |
17,398,946 | 0 | <p>Here is the example what you could choose to do: <a href="http://plnkr.co/edit/XRGPYCk6auOxmylMe0Uu?p=preview">http://plnkr.co/edit/XRGPYCk6auOxmylMe0Uu?p=preview</a></p> <pre><code><body key-trap> <div ng-controller="testCtrl"> <li ng-repeat="record in records"> <div class="record" ng-class="{'record-highlight': record.navIndex == focu sIndex}"> {{ record.name }} </div> </li> </div> </body> </code></pre> <p>This is the simplest approach I could think of. It binds a directive <code>keyTrap</code> to the <code>body</code> which catches the <code>keydown</code> event and <code>$broadcast</code> message to child scopes. The element holder scope will catch the message and simply increment or decrement the focusIndex or fire an <code>open</code> function if hitting <code>enter</code>.</p> <h1>EDIT</h1> <p><a href="http://plnkr.co/edit/rwUDTtkQkaQ0dkIFflcy?p=preview">http://plnkr.co/edit/rwUDTtkQkaQ0dkIFflcy?p=preview</a></p> <p>now supports, ordered / filtered list.</p> <p>Event handling part has not changed, but now uses <code>$index</code> and also filtered list caching technique combined to track which item is getting focused.</p> |
35,789,879 | 0 | <p>Just specify in the manifest for the activity as </p> <pre><code> android:persistent="true" </code></pre> <p>That should prevent your activity getting destroyed. To know more about this please refer to these below links which were answered by me </p> <p><a href="http://stackoverflow.com/questions/8557255/how-to-prevent-call-of-ondestroy-after-onpause/35789825#35789825">How to prevent call of onDestroy() after onPause()?</a></p> <p><a href="http://stackoverflow.com/questions/22168287/prevent-activity-from-being-destroyed-as-long-as-possible">Prevent activity from being destroyed as long as possible</a></p> <p>In the above posts I have explained in detail with a use case </p> |
9,632,437 | 0 | <p>You can also achieve this in the markup.</p> <pre><code><asp:ListItem Text="Good" Value="True" style="background-color:green;color:white" /> <br /> <asp:ListItem Text="Bad" Value="False" style="background-color:red;color:white" /> </code></pre> <p>The word Style will be underlined with the warning that <em>Attribute 'style' is not a valid attribute of element 'ListItem'.</em>, but the items are formatted as desired anyway.</p> |
20,787,069 | 0 | <p>Use following line,</p> <pre><code>import android.provider.Settings.Secure; String android_id = Secure.getString(this.getContentResolver(), Secure.ANDROID_ID); </code></pre> |
27,002,360 | 0 | <p>Try using levels.</p> <pre><code>def plot_countour(x,y,z): # define grid. xi = np.linspace(-2.1, 2.1, 100) yi = np.linspace(-2.1, 2.1, 100) ## grid the data. zi = griddata((x, y), z, (xi[None,:], yi[:,None]), method='cubic') levels = [0.2, 0.4, 0.6, 0.8, 1.0] # contour the gridded data, plotting dots at the randomly spaced data points. CS = plt.contour(xi,yi,zi,len(levels),linewidths=0.5,colors='k', levels=levels) #CS = plt.contourf(xi,yi,zi,15,cmap=plt.cm.jet) CS = plt.contourf(xi,yi,zi,len(levels),cmap=cm.Greys_r, levels=levels) plt.colorbar() # draw colorbar # plot data points. # plt.scatter(x, y, marker='o', c='b', s=5) plt.xlim(-2, 2) plt.ylim(-2, 2) plt.title('griddata test (%d points)' % npts) plt.show() # make up some randomly distributed data seed(1234) npts = 1000 x = uniform(-2, 2, npts) y = uniform(-2, 2, npts) z = gauss(x, y, Sigma=np.asarray([[1.,.5],[0.5,1.]]), mu=np.asarray([0.,0.])) plot_countour(x, y, z) </code></pre> <p><img src="https://i.stack.imgur.com/fSj8M.png" alt="enter image description here"></p> |
9,780,306 | 0 | <p>You shouldn't need to destroy and create the annotation every time. Once it has been created, just update the <code>anchorPoint</code>. Removing and adding the annotation is probably related to the constant redraw.</p> |
39,807,752 | 0 | <p>The simplest way is to use <a href="https://docs.python.org/2/library/sys.html#sys.path" rel="nofollow">sys.path</a> to make sure that you will have right order of paths added. <code>sys.path</code> gives out the list of paths that are available in the <code>PYHTONPATH</code> environment variable with the right order. If you want any path to have higher priority over others, just add it to the beginning of the list.</p> <p>And you will also find this in the official docs:</p> <blockquote> <p>A program is free to modify this list for its own purposes.</p> </blockquote> <p>WARNING: Even though this gives better control over the priority, just make sure that whatever library you add does not mess with the system libraries. Else, your library will be searched first, as it is in the beginning of the list, and they may replace the system libraries. Just as an example, if you have written a library by the name <code>os</code>, after adding this to the <code>sys.path</code>, that library will be imported instead of Python's in-built. So take all the caution and also with a large amount of salt before jumping to this.</p> |
39,761,875 | 0 | <p>Try this</p> <pre><code>http://localhost:8983/solr/core/select?q=*&facet=true&facet.field=strings_ss </code></pre> |
25,457,023 | 0 | <p>Here's a really simple example</p> <pre><code>let rememberTheEvens = let theList = List<int>() fun n -> if n%2 = 0 then theList.Add(n) theList </code></pre> <p>And here's a proper write up that I did a while back that uses a closure for Memoization <a href="http://www.devjoy.com/2013/05/learning-to-think-functionally-memoization/" rel="nofollow">http://www.devjoy.com/2013/05/learning-to-think-functionally-memoization/</a></p> <p>Hope that helps.</p> |
15,913,580 | 0 | <p>Here's my solution to make it a little more generic:</p> <pre><code>private static final String[] magnitudes = new String[] {"", "K", "M"}; public static String shortenNumber(final Integer num) { if (num == null || num == 0) return "0"; float res = num; int i = 0; for (; i < magnitudes.length; i++) { final float sm = res / 1000; if (sm < 1) break; res = sm; } // don't use fractions if we don't have to return ( (res % (int) res < 0.1) ? String.format("%d", (int)res) : String.format("%.1f", res) ) + magnitudes[i]; } </code></pre> |
5,174,900 | 0 | <p>This turned out to be a limitation of ClickOnce deployments. Using a normal setup project, after installation the Jump Lists work as expected.</p> |
2,491,538 | 0 | Download estimator using JavaScript and Ajax <p>I would like to implement the download estimator using the JavaScript and the Ajax. </p> <p>I have gone trough Google, existing posts on stackoverflow also to find the existing implementations for the download estimator and i found most of the time asking user bandwidth and then calculating the number is strategy. It good approach and there is hardly anything on reliable to get the estimated time right. </p> <p>What i would like to try is use Ajax to request file size 100KB - 200 KB and do the maths get the number and update the display. Now this is surrounded with so many questions like network, number of packets formed, proxies etc ? These all factors are sufficient to turn down the approach. But THIS IS HOW I HAVE TO DO THIS.</p> <p>Now i would like here inputs from you all to make it better (as good discussion)? what all can be added to this ? Can we get to know bandwidth user using without asking ? How can it can be made better ?</p> |
25,563,796 | 0 | Many to one relation : ArrayCollection issue <p><img src="https://i.stack.imgur.com/PTvzx.png" alt="Domain form"></p> <p>I have a many to one relation between Domain and Site. But when I try to add a new domain I have this error :</p> <blockquote> <p>Found entity of type Doctrine\Common\Collections\ArrayCollection on association Eliophot\BackBundle\Entity\Domain#site, but expecting Eliophot\BackBundle\Entity\Site</p> </blockquote> <p>This is my DomainController : </p> <pre><code>public function createDomainAction(Request $request) { $domain = new Domain; if (!$domain) { throw $this->createNotFoundException('Unable to find Domain entity.'); } $newForm = $this->createForm(new DomainType(), $domain); $newForm->handleRequest($request); if ($newForm->isValid()) { $entityManager = $this->get('doctrine')->getManager(); $entityManager->persist($domain); $entityManager->flush(); $this->get('session')->getFlashBag()->add('success', 'Le domaine a été crée'); return $this->redirect($this->generateUrl('domain_list')); } return $this->render('EliophotBackBundle:Domain:new_domain.html.twig', array( 'domain' => $domain, 'form' => $newForm->createView(), )); } </code></pre> <p>This is my DomainType:</p> <pre><code>class DomainType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('domainName','text', array( 'label' => 'Nom du domaine' )) ->add('site','entity', array( 'class' => 'EliophotBackBundle:Site', 'property' => 'name', 'label' => 'Sélectionnez un ou plusieurs site(s)', 'multiple' => true )); } public function getName() { return 'domain'; } ... } </code></pre> <p>and my SiteType:</p> <pre><code>class SiteType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('name', 'text', array( 'label' => 'Nom du site', 'required' => true )) ->add('nameBundle', 'text', array( 'label' => 'Nom du bundle du site', 'required' => true )) ->add('numClient', 'integer', array( 'label' => 'Numéro client du site', 'required' => true )); } public function getName() { return 'site'; } ... } </code></pre> <p>Site entity : </p> <pre><code>/** * Site * * @ORM\Table() * @ORM\Entity(repositoryClass="Eliophot\BackBundle\Entity\SiteRepository") */ class Site { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255) */ private $name; /** * @var string * * @ORM\Column(name="name_bundle", type="string", length=255) */ private $nameBundle; /** * @var integer * * @ORM\Column(name="num_client", type="integer") */ private $numClient; /** * @ORM\OneToMany(targetEntity="Domain", mappedBy="site") */ protected $domains; /** * Initialisation */ public function __construct() { $this->domains = new ArrayCollection(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name * @return Site */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set nameBundle * * @param $nameBundle * @return $this */ public function setNameBundle($nameBundle) { $this->nameBundle = $nameBundle; return $this; } /** * Get nameBundle * * @return string */ public function getNameBundle() { return $this->nameBundle; } /** * Set numClient * * @param integer $numClient * @return Site */ public function setNumClient($numClient) { $this->numClient = $numClient; return $this; } /** * Get numClient * * @return integer */ public function getNumClient() { return $this->numClient; } /** * Get domains * * @return ArrayCollection */ public function getDomains() { return $this->domains; } /** * Set domains * * @param ArrayCollection $domains */ public function setDomains(ArrayCollection $domains) { $this->domains = $domains; } } </code></pre> <p>Domain entity : </p> <pre><code>/** * Domain * * @ORM\Table() * @ORM\Entity */ class Domain { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="domain_name", type="string", length=255) */ private $domainName; /** * @ORM\ManyToOne(targetEntity="Site", inversedBy="domains") * @ORM\JoinColumn(name="site_id", referencedColumnName="id") */ protected $site; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set domainName * * @param string $domainName * @return Domain */ public function setDomainName($domainName) { $this->domainName = $domainName; return $this; } /** * Get domainName * * @return string */ public function getDomainName() { return $this->domainName; } public function getSite() { return $this->site; } public function setSite($site) { $this->site = $site; return $this; } } </code></pre> <p>Like the error says, I think Symfony expects a Site Object and not an arrayCollection... when I <code>var_dump</code> the request after the adding, I get this for the site field (in this example I have selected "site de test 1" and "site de test 2") : </p> <pre><code>array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } </code></pre> <p>=> this should be added to the domain table 2 new lines for the domain in question</p> <p>So how can I do this ?</p> |
5,733,181 | 0 | <p>Try setting the <a href="http://developer.android.com/reference/java/io/FileOutputStream.html#FileOutputStream%28java.io.File,%20boolean%29" rel="nofollow">append</a> flag to true when constructing your FileOutputStream</p> <pre><code>osr = new FileOutputStream(outputFile, true); </code></pre> |
35,745,130 | 0 | <p>The order of your current media queries is causing the problem.</p> <p>When forking around the <code>min-width</code> values, you should always put them in to ascending order when it comes to the pixel values. Swap places with <code>min-width: 993px</code> and <code>min-width: 1200px</code> and it should run smooth.</p> <p>Other option is to also set the <code>max-width</code> value to the media query (see Roman's answer), so it knows not to interfere with the next query. CSS is always being read from the <strong>top to bottom</strong>, so the last rule overrides the previous if you're not specific enough.</p> |
21,071,686 | 0 | Spring 404 error <p>I am trying to run spring application, but i am getting the 404 error. Can anyone please help? I take this code from mkyong site. The example he given is working but i tried to do everything from scratch it is not working.</p> <pre><code>package com.mkyong.common.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/welcome") public class HelloController { @RequestMapping(method = RequestMethod.GET) public String printWelcome(ModelMap model) { model.addAttribute("message", "Spring 3 MVC Hello World"); return "hello"; } } hello.jsp <html> <body> <h1>Message : ${message}</h1> </body> </html> mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.mkyong.common.controller" /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/pages/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans> web.xml <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Spring Web MVC Application</display-name> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> </code></pre> |
10,229,039 | 0 | <p>You have to implement the static function GetInstance().</p> <p>I would get rid of _instance and do it like this:</p> <pre><code>GamePropertiesManager* GamePropertiesManager::GetInstance() { static GamePropertiesManager manager; return &manager; } </code></pre> |
21,665,315 | 0 | <p>I believe there is no way to make it compile. You will have to use reflection to make the call.</p> <p>Actually. You could cheat if you contain it within a class:</p> <pre><code> public class Container<T> { public Container(T value) { Value = value; } public T Value { get; private set; } } public void Bar<T>(T item) { this.Foo<Container<T>>(new Container<T>(item)); } </code></pre> <p>but this adds one layer you need to call-through and makes the types less clear.</p> |
13,996,618 | 0 | <ol> <li>Your FOR loop: since JS uses zero-based arrays, you can't have <strong><=</strong>, otherwise it will look for an index one higher than what you have. Use <strong><</strong> instead;</li> <li>I moved your validation for whether any fields were checked outside the loop to make management easier. It's cleaner this way than worrying about breakout out of loops in the middle of them.</li> </ol> <p>Here:</p> <pre><code>function isNull() { var isChecked = false; var radiobutton = document.getElementsByName('radiobtn'); for (var i=0; i < radiobutton.length; i++) { if (radiobutton[i].checked) { isChecked = true; } } if ( !isChecked ) { alert("Make a selection."); return false; } } </code></pre> <p>I don't know how your form tag looks, but here is what you need to prevent the form from submitting if no radio fields are checked:</p> <pre><code><form action="" method="post" onSubmit="return isNull();"> </code></pre> |
7,247,541 | 0 | How to findAll in mongoosejs? <p>My code is like that:</p> <pre><code>SiteModel.find( {}, function(docs) { next(null, { data:docs}); } ); </code></pre> <p>but it never returns anything... but if I specify something in the {} then there is one record. so, how to findall?</p> |
15,571,304 | 0 | <p>Well I think the problem is how you bind the <code>.click</code> event. Before jQuery 1.7 they had separate methods for <code>.bind</code>, <code>.delegate</code> and <code>.live</code>. But with arrival of jQuery 1.7 these methods were merged an to simplify things by including them all under 1 method <code>.on</code>. But due to not so clear documentation people don't understand the <code>.on</code> method. <code>.on</code> does provide the function of 3 above mentioned deprecated methods, but it depends how you use <code>.on</code> method. Here is an example:</p> <pre><code>// Bind $( "button" ).on( "click", function( e ) {} ); // Live $( document ).on( "click", "button", function( e ) {} ); // Delegate $( "body" ).on( "click", "button", function( e ) {} ); </code></pre> <p>My guess is that markup for the <code>button</code> that is not working is being declared after your <code>.click</code> is bind. In that case you will have to implement the <code>.on</code> as done for live events. So all you would need to change is the way you bind call.</p> <pre><code>$( document ).on( "click", "button", function () { //Do Something }); </code></pre> <p>Hope this helps.</p> |
12,006,124 | 0 | <p>You should look in the default_master.properties file (in my case it's in the same directory as js-export) and change the database properties according to your setup.</p> <p>Then js-export and js-import should work.</p> |
21,975,826 | 0 | Split a string with <span> using preg_split() <p>I have a sting that is in this format.</p> <pre><code><span class="amount">$25</span>–<span class="amount">$100</span> </code></pre> <p>What I need to do is split that into two strings. The string will remain in the same format but the prices will change. I tried using str_split() but because the price changes I wouldn't be able to always know how many characters to split the string at. </p> <p>What I am trying to get is something like this.</p> <p>String 1 </p> <pre><code><span class="amount">$25</span>– </code></pre> <p>String 2</p> <pre><code><span class="amount">$100</span> </code></pre> <p>It seems the best option I have found is to use preg_split() but I don't know anything about regex so I'm not sure how to format the expression. There may also be a better way to handle this and I just don't know of it.</p> <p>Could someone please help me format the regex, or let me know of a better way to split that string.</p> <h3>Edit</h3> <p>Thanks to @rm-vanda for helping me figure out that I don't need to use preg_split for this. I was able to split the string using explode(). The issue I was having was because the '-' was encoded weird and therefore not returning correctly.</p> |
37,048,308 | 0 | <p><a href="http://php.net/manual/en/function.empty.php" rel="nofollow"><em>"Determine whether a variable is considered to be empty. A variable is considered empty <strong>if it does not exist or if its value equals FALSE</strong>. empty() does not generate a warning if the variable does not exist."</em></a> </p> <blockquote> <p>Returns FALSE if var exists and has a non-empty, non-zero value. Otherwise returns TRUE.</p> <p>The following things are considered to be empty:</p> <p>"" (an empty string)</p> <p>0 (0 as an integer)</p> <p>0.0 (0 as a float)</p> <p>"0" (0 as a string)</p> <p>NULL</p> <p>FALSE</p> <p>array() (an empty array)</p> <p>$var; (a variable declared, but without a value)</p> </blockquote> |
27,446,413 | 0 | SVG path animation issue <p>I'm new to CSS animations and I'm struggling to get <a href="http://codepen.io/anon/pen/LENLxM" rel="nofollow">this animation</a> working.</p> <p>I've been following this <a href="http://css-tricks.com/svg-line-animation-works/" rel="nofollow">CSS Tricks post</a>.</p> <p>Currently I don't understand why there are three separate starting point in the animation.</p> <p>I would like to start from one point, follow the path all the way(doesn't matter which direction) and close the animation at the starting point.</p> <p>Is that possible? If it is, can anyone tell what's wrong in what I've tried so far?</p> <p>Any help appreciated, thanks.</p> <p>This is the code in the demo (I've cut some svg code out):</p> <p><strong>HTML</strong></p> <pre><code><svg xmlns="http://www.w3.org/2000/svg" width="3.27778in" height="3.27778in" viewBox="0 0 236 236"> <path class="path" fill="none" stroke="black" stroke-width="2" d="M 236.00,0.00 C 236.00,0.00 236.00,236.00 236.00,236.00 236.00,236.00 0.00,236.00 0.00,236.00 0.00,236.00 0.00,0.00 0.00,0.00 0.00,0.00 236.00,0.00 236.00,0.00 Z M 74.00,34.00 ......... C 212.00,194.00 213.00,195.00 213.00,195.00 213.00,195.00 213.00,194.00 213.00,194.00 213.00,194.00 212.00,194.00 212.00,194.00 Z" /> </svg> </code></pre> <p><strong>CSS</strong></p> <pre><code>.path { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: dash 10s linear infinite; } @keyframes dash { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } } </code></pre> |
13,858,682 | 0 | switch div tags using javascript doesnt work in xhtml strict <p>Hi i need to switch between div tags, I have no idea where's the problem... The site is XHTML strict...</p> <pre class="lang-js prettyprint-override"><code>$(document).ready(function() { var activeId = $(".active").each(function(){ $("#content" + $(this).attr("id").replace("tab","")).show(); }); $(".tabs a").click(function() { var $tabs =$(this).closest(".tabs"); $("#content" +$tabs.attr("data-lastContent")).hide(); $(this).closest(".tabs").find(".active").removeClass("active"); $(this).addClass("active") var id = $(this).closest("li").attr("id").replace("tab",""); $tabs.attr("data-lastContent", id); $("#content" + id).show(); }); }); </code></pre> <p>It is a menu and some divs below I need to switch... I use the code from this post <a href="http://jsfiddle.net/hKMFb/24/" rel="nofollow">http://jsfiddle.net/hKMFb/24/</a> but with no success....</p> <pre><code><div class="tabs" data-lastContent="1"> <li id="tab1" class="active"><a href="#">PROSBA</a></li> <li id="tab2"><a href="#">PRŮVODNÍ TEXT</a></li> <li id="tab3"><a href="#">GALERIE</a></li> <li id="tab4"><a href="#">JAK POMOCI?</a></li> </div> <div id="content1" class="content"><div class="scroller">ahojjjj</div></div> <div id="content2" class="content"><div class="scroller">nee</div></div> <div id="content3" class="content"><div class="scroller">ahdad</div></div> <div id="content4" class="content"><div class="scroller">ahod</div></div> </code></pre> <p>Any input is appreciated.</p> <p>Thanks. Jan</p> |
4,787,678 | 0 | <p>According to <a href="http://www.boost.org/doc/libs/1_45_0/libs/smart_ptr/shared_ptr.htm">the documentation of Boost <code>shared_ptr</code></a>, the <code>shared_ptr</code> constructor is marked <code>explicit</code>, meaning that there's no implicit conversion from <code>T*</code>s to <code>shared_ptr<T></code>. Consequently, when you're trying to insert the iterator range defining your old container into the new container, the compiler complains because there's no way of implicitly converting from the raw pointers of the old containers into the <code>shared_ptr</code>s of the new container. You can fix this by either using a <code>back_inserter</code> and <code>transform</code>, or by just doing the iteration by hand to wrap each pointer and insert it one at a time.</p> <p>It turns out that there's a good reason that you don't want this conversion to work implicitly. Consider:</p> <pre><code>void DoSomething(shared_ptr<T> ptr) { /* ... */ } T* ptr = new T(); DoSomething(ptr); </code></pre> <p>If the implicit conversion were allowed here, then the call to <code>DoSomething</code> would be legal. However, this would cause a new <code>shared_ptr</code> to start referencing the resource held by <code>ptr</code>. This is problematic, because when this <code>shared_ptr</code> goes out of scope when <code>DoSomething</code> returns, it will see that it's the only <code>shared_ptr</code> to the resource and will deallocate it. In other words, calling <code>DoSomething</code> with a raw pointer would implicitly delete the pointer!</p> |
37,357,578 | 0 | Error easy-captcha npm installing in sailsJS <p>I have run on terminal to install easy-captcha for my app. </p> <pre><code>npm install easy-captcha --save </code></pre> <p>and error appeared:</p> <pre><code>gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/haihv94/Applications/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Linux 3.19.0-25-generic gyp ERR! command "node" "/home/haihv94/Applications/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/haihv94/NDM/ndm.org/node_modules/easy-captcha gyp ERR! node -v v0.12.7 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/home/haihv94/Applications/nodejs/bin/node" "/home/haihv94/Applications/nodejs/bin/npm" "install" "easy-captcha" "--save" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! code ELIFECYCLE npm ERR! [email protected] install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the easy-captcha package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls easy-captcha npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /home/haihv94/NDM/ndm.org/npm-debug.log </code></pre> <p>I've tried installing another npm to using captcha (s.a recaptcha, node-captcha) but same error! How can I solve this problem? thanks all!</p> |
20,521,383 | 0 | Updating MySQL database with values from dynamically generated textboxes in different divs <p>I'll try my best to explain my problem here, forgive me if I use the wrong terms occasionally, I'm still pretty much a beginner, and quite terrible at explaining.</p> <p>My goal is to use Jquery to dynamically add textboxes, and then use C# to update the values in those textboxes into a mysql database.</p> <p>The database consists of four columns, UserID(PK), Date(PK), Subject(PK) and Hours. The goal is to be able to fill in the amount of hours you've worked on a subject on certain day of the current week.</p> <p>So far, I'm able to add a new textbox whenever I press the button for the day I want to update the data for. The problem I'm running into is that I have no idea how to build the mysql query in such a way that it correctly associates the entered values with the day they're entered for.</p> <p>My code so far:</p> <pre><code><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript"> </script> <title></title> </head> <body> <form id="form1" runat="server"> <div id="dag1" runat="server"> <input class="btnAdd" type="button" value="Monday" onclick="AddTextBox($(this).parent().attr('id'));" /> </div> <div id="dag2" runat="server"> <input class="btnAdd" type="button" value="Tuesday" onclick="AddTextBox($(this).parent().attr('id'));" /> </div> <div id="dag3" runat="server"> <input class="btnAdd" type="button" value="Wednesday" onclick="AddTextBox($(this).parent().attr('id'));" /> </div> <div id="dag4" runat="server"> <input class="btnAdd" type="button" value="Thursday" onclick="AddTextBox($(this).parent().attr('id'));" /> </div> <div id="dag5" runat="server"> <input class="btnAdd" type="button" value="Friday" onclick="AddTextBox($(this).parent().attr('id'));" /> </div> <br /> <br /> <div id="TextBoxContainer"> <script type="text/javascript"> function AddTextBox(day) { var value = "" var div = document.createElement('DIV'); div.innerHTML = '<input name = "Subject" type="text" value = "' + value + '" /><input name = "Hours" type="text" value = "' + value + '" />'; document.getElementById(day).appendChild(div); } </script> </div> <br /> <asp:Button ID="btnPost" runat="server" Text="Post" OnClick="Post" /> <asp:Label ID="labeltest" Text="" runat="server" /> </form> </body> </html> </code></pre> <p>And my codebehind:</p> <pre><code> protected string Values; protected void Post(object sender, EventArgs e) { string[] textboxValues = Request.Form.GetValues("Subject"); string[] textboxValues2 = Request.Form.GetValues("Hours"); MySqlConnection conn; MySqlCommand comm; string myConnectionString = "server=localhost;uid=root;database=caroussel"; using (conn = new MySqlConnection()) { try { int veld = 0; foreach (string val in textboxValues) { string value2 = textboxValues2[veld]; veld++; using (comm = new MySqlCommand("update uren set Subject=@Subject, Hours=@Hours WHERE Date=??? AND UserID=1, conn)) ; comm.Parameters.Add("@Subject", MySqlDbType.VarChar, 45); comm.Parameters["@Subject"].Value = val; comm.Parameters.Add("@Hours", MySqlDbType.Int16); comm.Parameters["@Hours"].Value = value2; comm.Parameters.Add("@UserID", MySqlDbType.Int16); comm.Parameters["@UserID"].Value = 1; comm.Parameters.Add("@Date", MySqlDbType.VarChar, 45); comm.Parameters["@Date"].Value = ????; { conn.ConnectionString = myConnectionString; conn.Open(); comm.ExecuteNonQuery(); conn.Close(); } } } finally { conn.Close(); } } } </code></pre> <p>If there's anything missing, or clarification is required, or I simply forgot something, please do tell, I'm rather stuck at the moment, and I haven't been able to find something that would help me so far.</p> |
32,934,259 | 0 | <p>Java's equals contract gets especially spotty in situations like this, and in the end it all becomes a matter of the programmer's preferences and needs. I remember reaching this very same issue and I came across <a href="https://www.artima.com/lejava/articles/equality.html" rel="nofollow" title="How to Write an Equality Method in Java">this article</a>, which goes over several possibilities and issues when considering the equals contract with Java. It basically ends up saying there's no way to properly do it without breaking the Java equals contract.</p> <p>When dealing with <em>abstract</em> classes, my personal preference is to not give the abstract class an equals method at all. It doesn't make sense. You can't have two objects of an abstract type; how should you compare them? Instead, I give each subclass its own equals, and the runtime handles the rest whenever <code>equals()</code> is called. And overall, the solution presented in the article that I most often follow is the "only objects of the exact same class may be compared", which seems the most sensible to me.</p> |
21,160,438 | 0 | <p>I would approach this as follows:</p> <pre><code>from collections import defaultdict # using defaultdict makes the sums easier correlations = defaultdict(int) # default to int (i.e. 0) for i1, i2, correl in strScoresDict: # loop through data correlations[i1] += correl # add score for first item correlations[i2] += correl # and second item output = sorted(correlations, key=lambda x: correlations[x], reverse=True) # sort keys by value </code></pre> <p>Note, however, that the output is </p> <pre><code>output == ['item2', 'item1', 'item4', 'item3'] </code></pre> <p>As the total correlations are</p> <pre><code>{'item1': 220, 'item3': 100, 'item2': 240, 'item4': 200} </code></pre> <p>You can <a href="http://docs.python.org/2/library/collections.html#collections.defaultdict" rel="nofollow">read about <code>defaultdict</code> here</a>.</p> |
22,442,690 | 0 | <p>What did you expect it to do (typos aside)? You have a POD type that does not need any destruction to happen. Try the same thing with something more meaty, say, put a <code>std::string</code> in there, and the destructor will actually do something.</p> <p>Then, put those experiments aside and if at one place in the next twenty years you actually do need placement new and explicitly called destructors, put some debugging output in the destructor you need and check that it is actually called.</p> |
22,551,751 | 0 | Print current date, without complex time commands <p>The prompt is:</p> <p>Implement a function that determines and prints out the current year, month and day. </p> <p>For example:</p> <p>Today is 03/04/2014.</p> <p>You guys dont have to really mind the code i wrote, its just kinda like scribble trying to figure our a way to print the current date using the seconds since the epoch given by the time(NULL) command.</p> <p>Before anyone gives me a super complex time command code etc etc, im pretty sure my professor wants us to convert the unix time (seconds since the epoch: jan 1, 1970) to the current date somehow.</p> <p>Would anyone be able to help me in anyway to do this in the way my professor wants?</p> <p>Thanks!</p> <p>The code i currently have is:</p> <pre><code>#include <stdio.h> #include <time.h> int main () { int days, weeks, months, years, option, rmd, currentyear, currentmonth; time_t seconds; seconds = time(NULL); days = seconds/(60*60*24); weeks = seconds/((60*60*24)*7); rmd=seconds%31557600; months = ((seconds/31557600) * 12)+(((float)rmd/31557600)*12); years = days/(365.25); currentyear = 1970 + years; currentmonth = (((float)rmd/31557600)*12)+1; printf("%ld/%ld", currentmonth,currentyear); ; return 0; } </code></pre> |
161,285 | 0 | <p>Cheat and use <strong><a href="http://libusb.wiki.sourceforge.net/" rel="nofollow noreferrer">libusb</a></strong>. I did this for a project I've been working on for a while and wrote a <strong>C++/<a href="http://wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a></strong> app to handle the data.</p> <p>I've been thinking recently of re-writing the app on the PC in <strong><a href="http://wxpython.org/" rel="nofollow noreferrer">wxPython</a></strong> though as it's much faster for GUI development.</p> <p>How you want to display / log the data? There are a lot of options available. You can do some pretty cool stuff (easily) with <a href="http://www.wxwidgets.org/docs/tutorials/opengl.htm" rel="nofollow noreferrer">the OpenGL capabilities of wxWidgets</a> whether it's 2D or 3D data representation. </p> |
40,103,236 | 0 | <p>The <code>Equals</code> method and the <code>IEquatable<T></code> interface could be used to know if two objects are equal but they won't allow you to know the differences between the objects.</p> |
6,191,772 | 0 | Calling C/C++ functions in dynamic and static libraries in D <p>I'm having trouble wrapping my head around how to interface with C/C++ libraries, both static (.lib/.a) and dynamic (.dll/.so), in D. From what I understand, it's possible to tell the DMD compiler to link with .lib files, and that you can convert .dll files to .lib with the implib tool that Digital Mars provides. In addition, I've come across <a href="http://digitalmars.com/d/2.0/htomodule.html" rel="nofollow">this page</a>, which implies being able to call functions in .dlls by converting C header files to D interface files. Are both of these methods equivalent? Would these same methods work for Unix library files? Also, how would one reference functions, enums, etc from these libraries, and how would one tell their D compiler to link with these libs (I'm using VisualD, specifically)? If anyone could provide some examples of referencing .lib, .dll, .a, and .so files from D code, I'd be most grateful. </p> |
40,636,558 | 0 | <p>Sorry cordova application works at your device. It does not operate at your network switch/router. There is yet no way that your device could ask your router if it has working internet access and the router could acknowledge that yes i have or not. What you could do at your device only to detect network access.</p> <p>The only other thing you can do is send an http request to something like google which is almost never down, in device ready event or when required, if it responds with ready state then your internet is ok and otherwise not.</p> <p>A function to test this address to check if the device has access to internet would look like this :</p> <pre><code>function testInternet(win,fail){ $.get("https://people.googleapis.com/v1/people/me/connections").done(win).fail(fail); } Or , function testInternet(win,fail){ $.ajax({ url:"https://people.googleapis.com/v1/people/me/connections", timeout:5000, //timeout to 5s type: "GET", cache: false }).done(win).fail(fail); } </code></pre> <p>ajax request response back 401 (Unauthorized) which means we have internet access but we are Unauthorized for that google api. here is the google <a href="https://developers.google.com/api-client-library/javascript/features/cors" rel="nofollow noreferrer">api</a></p> <blockquote> <p>The plugin does not detect if the user has access to the Internet, but only if the user is on a network. Since your phone is on a WiFi network even though the WiFi network doesn't have access to the Internet, the plugin is performing as designed.</p> </blockquote> |
17,852,249 | 0 | svn2git: Cannot setup tracking information <p>I am trying to migrate a SVN project to git with thel help of svn2git. When executing the command it exits with the following error:</p> <pre><code>Running command: git branch --track "0.0.9" "remotes/svn/0.0.9" fatal: Cannot setup tracking information; starting point 'remotes/svn/0.0.9' is not a branch. </code></pre> <p>Started it with:</p> <pre><code> svn2git http://<host>/<project> </code></pre> <p>I can't find any solution for it and it seems not many users has the same problem.</p> <p>What can I do to solve this problem?</p> |
11,302,957 | 0 | RestKit not mapping attributes properly when using CoreData <p>I am having some issues implementing RestKit/CoreData with my application. Using the RKTwitterCoreData example application and pointing it to my web service for the json feed, I get the resulting tableview:</p> <p><img src="https://i.stack.imgur.com/XSqw1.png" alt="Duplicate objects/ID not being displayed correctly"></p> <p>The issues encountered so far:</p> <ol> <li>Refresh generates a new core data entry even though i have primaryKeyAttribute set to the orderID.</li> <li>cell textLabel displays an odd orderID that doesn't match with my web service</li> </ol> <p>Here is my applicationDidFinishLaunchingWithOptions:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize RestKit RKObjectManager* objectManager = [RKObjectManager managerWithBaseURLString:@"http://mywebservice.com"]; // Enable automatic network activity indicator management objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; NSString *databaseName = @"RKTwitterData.sqlite"; objectManager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:databaseName usingSeedDatabaseName:nil managedObjectModel:nil delegate:self]; RKManagedObjectMapping* statusMapping = [RKManagedObjectMapping mappingForClass:[Order class] inManagedObjectStore:objectManager.objectStore]; statusMapping.primaryKeyAttribute = @"orderID"; [statusMapping mapKeyPath:@"id" toAttribute:@"orderID"]; [statusMapping mapAttributes:@"created_at", nil]; // Register our mappings with the provider [objectManager.mappingProvider setObjectMapping:orderMapping forResourcePathPattern:@"/orders"]; // Create Window and View Controllers RKTwitterViewController* viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease]; UINavigationController* controller = [[UINavigationController alloc] initWithRootViewController:viewController]; UIWindow* window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; [window addSubview:controller.view]; [window makeKeyAndVisible]; return YES; } </code></pre> <p>And the json result at /orders:</p> <p><img src="https://i.stack.imgur.com/rpp6I.png" alt="enter image description here"></p> <p>Any advice for dealing with this issue? Thanks!</p> |
8,352,772 | 0 | <p>primarykey fields ( of any data-type ) are <strong>not included</strong> in the list returned by <code>allFileds</code> method of the Mapper.</p> <p>You can prepend the field separately if you want </p> <p>something like </p> <pre><code> var myMapperPrimaryKey=DummyMapper.primaryKeyField var fieldList=DummyMapper.allFields.toBuffer[BaseField] fieldList.prepend(myMapperPrimaryKey) // Now fieldList is having the primaryKey along with other fields. </code></pre> |
39,447,117 | 0 | Issue while fetching dates between range <p>I have two tables. One is hall which is having following schema. <a href="https://i.stack.imgur.com/lAJGj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lAJGj.png" alt="Hall Table"></a></p> <p><a href="https://i.stack.imgur.com/rHg81.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rHg81.png" alt="Events Table"></a></p> <p>One hall can have many events.I want halls which are available between two dates.For example halls between 2016-09-10 and enddate = 2016-09-15. I want all the halls which are not booked for the whole range of dates i.e 10,11,12,13,14,15. </p> |
16,314,741 | 0 | <pre><code>myFlv.stop(); removeChild(myFlv); myFlv = null; </code></pre> |
4,483,901 | 0 | <p>All of your view controllers INSIDE the split view controller have to override the method. Seems like at least one of your overrides returns NO in all cases. To make it rotate to all orientations, return YES in all overrides.</p> |
13,875,212 | 0 | <p>Also, read here: <a href="http://docs.doctrine-project.org/en/2.0.x/reference/batch-processing.html" rel="nofollow">http://docs.doctrine-project.org/en/2.0.x/reference/batch-processing.html</a></p> <p>It suggests to use $em->clear() after every bulk of operations. (which should give the same effect as Besnik suggested).</p> <p>From the previously mentioned link:</p> <blockquote> <p>Bulk inserts in Doctrine are best performed in batches, taking advantage of the transactional write-behind behavior of an EntityManager. The following code shows an example for inserting 10000 objects with a batch size of 20. You may need to experiment with the batch size to find the size that works best for you. Larger batch sizes mean more prepared statement reuse internally but also mean more work during flush.</p> </blockquote> |
35,114,477 | 0 | <p>There is no workaround.</p> <blockquote> <p>Using non-top level imports will not work with native ES6 implementations. Babel allows it because it transpiles to CommonJS require, but it is technically not allowed in ES6.</p> </blockquote> <p><a href="https://github.com/eslint/eslint/issues/2259" rel="nofollow">eslint issue</a> and according <a href="https://github.com/eslint/espree/issues/124" rel="nofollow">espree issue</a></p> |
1,861,282 | 0 | .net, UserControls, and application start time <p>We have a medium sized application that depends on several usercontrols, namely:</p> <p>A tablelayout panel, with 2x5 grid of usercontrols, with 3+ levels of inheritance. A big issue we're running into with our application has proven to be startup time (both cold\warm), one of the big big hangups we're getting is initializing this usercontrol grid.</p> <p>From our timing reports, this form comes in at about 0.75 seconds for initialization, and cutting this down would be a <em>big deal</em>.</p> <p>My question is: What the heck can I do to speed this up? Whenever I run timing checks on similar-complexity InitializeComponents (all windows, .net controls), the result is magnitudes less (<10 milleseconds) sometimes. </p> <p>edit) I'm wondering if things like marking my final classes <em>sealed</em> or something similar would help.</p> <p>edit2) I've looked deeper into the timing of initializecomponent, and for my current machine, The main container adds 10 components to it (at 10ms a piece). Each of those components adds 3 components (at 10ms a piece). 10x10 + 30x10 = 700ms. Unless I can increase the speed at which items get added to their containers, I think I'm SOL.</p> |
18,361,595 | 0 | <p>I was able to slightly improve Zach's answer by incorporating a few function calls. The problem with that answer is that it disables onMouseUp completely, thereby preventing you from clicking around in the textbox once it has focus.</p> <p>Here is my code:</p> <pre><code><input type="text" onfocus="this.select()" onMouseUp="javascript:TextBoxMouseUp();" onMouseDown="javascript:TextBoxMouseDown();" /> <script type="text/javascript"> var doMouseUp = true; function TextBoxMouseDown() { doMouseUp = this == document.activeElement; return doMouseUp; } function TextBoxMouseUp() { if (doMouseUp) { return true; } else { doMouseUp = true; return false; } } </script> </code></pre> <p>This is a slight improvement over Zach's answer. It works perfectly in IE, doesn't work at all in Chrome, and works with alternating success in FireFox (literally every other time). If someone has an idea of how to make it work reliably in FF or Chrome, please share. </p> <p>Anyway, I figured I'd share what I could to make this a little nicer.</p> |
38,217,959 | 0 | How to move CSV file in FTP server one folder to another? <p>When i am trying to move file from fileDirectory1 to fileDirectory2 .. Is there any way to move or copy that file from one path to another in one FTP server.Please anyone can help me.</p> <p>Here is my sample code:</p> <pre><code> String existingfile = file.getFilename(); String newfile =file.getFilename(); String fileDirectory1 = clients.getFtpFolder() + "/" + "unprocessed" + "/"; String fileDirectory2 = clients.getFtpFolder() + "/" + "processed" + "/"; sftpChannel.cd(fileDirectory1); if (sftpChannel.get(newfile) != null){ sftpChannel.rename(fileDirectory1 + newfile , fileDirectory2 + newfile ); sftpChannel.cd(fileDirectory2); sftpChannel.rm(existingfile ); } </code></pre> <p>Console:</p> <pre><code>Caused by:2: No such file at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) </code></pre> <p>I have tried <a href="http://stackoverflow.com/questions/30050045/how-to-move-file-from-directory-a-to-directory-b-in-remote-server">How to move file from directory A to directory B in remote server?</a></p> <p><a href="http://stackoverflow.com/questions/13277218/move-a-directory-in-remote-server-to-another-location-in-the-same-remote-server">Move a directory in remote server to another location in the same remote server using jsch</a></p> |
18,833,703 | 0 | Change size of Panorama item <p>I want that the height of one of my Panorama items is higher than usual just like in the TeamViewer app. The height should actually match with the Screen. That Panorama item should be entirely filled with a single canvas. How can I do that?</p> |
18,943,800 | 0 | <p>It's probably your config file...Check your config files for self terminating nodes.</p> |
22,589,182 | 0 | Set 'nice' value to concrete processes, by default <p>I would like to set specific "nice" values to several processes in a laptop. For example, I would like the window manager to run at -10, and keep the default at 0.</p> <p>I know that "renice" can change the niceness of a processes, but this is a-posteriori, and I do not want to "renice" my window manager process every time that I open the computer. Similarly, "limits.conf" allows to specify default niceness for specific users or groups, but not (as far as I know) specific processes.</p> <p>So my question is whether there is a way to define niceness for concrete processes, without having to change the default for the user and without having to renice the process once it runs.</p> |
21,687,674 | 0 | <p>The problem is that when you set a 100% height value it take the longitud from the parent container. If the conatiner is the body tag it ajustment to the size of the content it self that could be very samll. You need to set up the size to a specifycally size you can use the window size for example.</p> |
10,008,250 | 0 | <p>You should do</p> <pre><code>function(data) { $.each(data, function(){ $('#result').append('<p>Name:'+this.name+' Link:'+this.link+' Approve'+this.approve+'</p>'); }); } </code></pre> <p>fiddle here <a href="http://jsfiddle.net/hUkWK/" rel="nofollow">http://jsfiddle.net/hUkWK/</a></p> |
20,197,287 | 0 | <p>You are using <code>JSON.Stringify</code>; it should be <code>JSON.stringify</code>. Did you check your console for errors? Simply spitting the JSON out isn't too user-friendly, though. Is that what you want?</p> <p>You're going to have to iterate over each individual skill and then insert that into the table in a format that you see fit (perhaps you can use an un-ordered list):</p> <pre><code>var $table = jQuery("table"); $table.append(jQuery("tr") .append( jQuery("th").text("First Name")) .append( jQuery("th").text("LastName")) ... //and so on ) for(var i = 0; i < data.length; i++) { var $tr = jQuery("tr"); $tr.append( jQuery("td").text(data[i].firstname}) ).append( jQuery("td").text(data[i].lastname) )... var skills = data[i].skills; var $ul = jQuery("ul"); for(var j = 0; j < skills.length; j++) { var skill = skills[j]; $ul.append(jQuery("li").text(skill.name)); } $tr.append(jQuery("td").append($ul)); } </code></pre> |
2,155,991 | 0 | Keyboard Focus Breaking with Radio Button Group <p>It seems simple, but this has been a bit of a headscratcher for me. Given the following (valid xhtml transitional) code:</p> <pre><code><form action="weird.html"> <label for="test1">T1</label> <input type="radio" id="test1" name="test" value="1" /> <label for="test2">T2</label> <input type="radio" id="test2" name="test" value="2" /> <label for="test3">T3</label> <input type="radio" id="test3" name="test" value="3" /> <label for="test4">T4</label> <input type="radio" id="test4" name="test" value="4" /> <label for="test5">T5</label> <input type="radio" id="test5" name="test" value="5" /> </form> </code></pre> <p>Why is it that I can't tab between radio buttons? This issue seems to be because they all have the same name attribute, but that seems rather counter-intuitive to me as far as accesbility goes. Why does the focus state only get applied to one? Is this because the group is treated as a single element? Are access keys the only non-Javascript solution here?</p> |
2,008,363 | 0 | <p>This should be very easy. Valid function names can only consist of alphanumerics, parenthesis, and possibly parameter values within the parens (i don't know enough javascript to know whether parameters are defined in the function call) and must start with a letter, correct? Therefore to validate that a string is a valid function name. Therefore this should work:</p> <pre><code>[a-xA-z]+[a-zA-z0-9_]\*(\\(.*?\\))\* </code></pre> |
2,976,225 | 0 | <p>You could use a <a href="http://msdn.microsoft.com/en-us/library/ms182538(VS.80).aspx" rel="nofollow noreferrer">Visual Studio Web Test</a> to record and execute a scenario. <a href="http://seleniumhq.org/" rel="nofollow noreferrer">Selenium</a> is another alternative.</p> |
23,614,353 | 0 | <p>Three steps:</p> <p>First, find all the cells in each polygon, return a list of 2-column matrices with the cell number and the value:</p> <pre><code>require(plyr) # for llply, laply in a bit... cell_value = extract(dat, polys,cellnumbers=TRUE) head(cell_value[[1]]) cell value [1,] 31 108 [2,] 32 108 [3,] 33 110 [4,] 92 110 [5,] 93 110 [6,] 94 111 </code></pre> <p>Second, turn into a list of similar matrices but add the x and y coords:</p> <pre><code>cell_value_xy = llply(cell_value, function(x)cbind(x,xyFromCell(dat,x[,"cell"]))) head(cell_value_xy[[1]]) cell value x y [1,] 31 108 8.581164 14.71973 [2,] 32 108 8.669893 14.71973 [3,] 33 110 8.758623 14.71973 [4,] 92 110 8.581164 14.67428 [5,] 93 110 8.669893 14.67428 [6,] 94 111 8.758623 14.67428 </code></pre> <p>Third, compute the weighted mean coordinate. This neglects any edge effects and assumes all grid cells are the same size:</p> <pre><code>centr = laply(cell_value_xy, function(m){c(weighted.mean(m[,3],m[,2]), weighted.mean(m[,4],m[,2]))}) head(centr) 1 2 [1,] 8.816277 14.35309 [2,] 8.327463 14.02354 [3,] 8.993655 13.82518 [4,] 8.467312 13.71929 [5,] 9.011808 13.28719 [6,] 9.745000 13.47444 </code></pre> <p>Now <code>centr</code> is a 2-column matrix. In your example its very close to <code>coordinates(polys)</code> so I'd make a contrived example with some extreme weights to make sure its working as expected.</p> |
24,397,530 | 0 | <p>The developer doesn't own the tabBar, the framework does. It will fight you to make sure that the tabBar stays the same height. If you want to work around this, you can make your own toolbar and add autlayout constraints to its height to force it to stay whatever height you'd like.</p> |
36,254,331 | 0 | Div splitter resize problems <p>I created a splitter using javascript component, but it works only with two columns, if I add a third column, start to have problems with resizing.</p> <p>In the excerpt below is where is the logic to resize.</p> <pre><code>var pos = (e.pageX - dragoffset.x); el.style.left = (pos) + "px"; var total_area = $(el).prev().width() + $(el).next().width(); var f_1 = (pos); var f_2 = (total_area - pos); $(el).prev().width(f_1); $(el).next().width(f_2); </code></pre> <p>I have posted my project in <a href="https://jsfiddle.net/m4y3rkqc/7/" rel="nofollow">https://jsfiddle.net/m4y3rkqc/7/</a></p> <p>What parameters should I consider to calculate the size correctly and dynamically?</p> |
12,099,227 | 0 | When I put a record in the test database in rails, for how long does it persist? <p>If, as part of an RSpec or Cucumber test in my Rails application, I create a model and store it in the test database, how long will the record remain there for?</p> <p>I'm pretty sure that the records are cleared at the end (or beginning?) of every test cycle, because they don't seem to interfere with successive runs of my test suite, but do records persist between different cucumber features and scenarios, or between different RSpec tests?</p> |
1,857,247 | 0 | How do you write to an xml file in win32 C++? <p>I would like to write a simple xml file using <code>xmllite</code> in <code>win32 c++</code>. the file will be saved over every time the user saves. How do I do this? I'd rather not include any new libraries for this...</p> |
13,418,159 | 0 | <p>It can be very confusing working with strings when you want to provide a path... That's the first thing I check whenever something strange is happening.</p> |
8,088,427 | 0 | Programatically rendering a web UserControl <p>I have a load of <code>UserControl</code> objects (<code>ascx</code> files) in their own little project. I then reference this project in two projects: The REST API (which is a class library project) and the main website.</p> <p>I'm sure this would be easy in the website, simply use <code>Controls.Add</code> in any <code>Panel</code> or ASP.NET control would work.</p> <p>However, what about the API? Is there any way I can render the HTML of this control, simply by knowing the type of the control? The <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.rendercontrol.aspx" rel="nofollow">RenderControl</a> method doesn't write any HTML to the writer as the control's life cycle hasn't even started.</p> <p><em>Please bare in mind that I don't have the controls in the web project, so I don't have a virtual path to the <code>ascx</code> file. So the <a href="http://msdn.microsoft.com/en-us/library/t9ecy7tf.aspx" rel="nofollow">LoadControl</a> method won't work here.</em></p> <p>All the controls actually derive from the same base control. Is there anything I can do from within this base class that will allow me to load the control from a completely new instance?</p> |
40,283,274 | 0 | <p>Every memory block obtained via <code>malloc</code> and friends that is not freed with the <code>free</code> function will yield in a memory leak and this is toally independent of scopes.</p> <p>In other words, you may allocate a memory block in some function and free it later in a totally different function; this is actually how <code>malloc</code> and <code>free</code> are used most of the time.</p> <p><strong>Example</strong> (just for illustration purposes, not necessarily good programming practice)</p> <pre><code>char *Foo() { ... return malloc(...); } void Bar() { char *p = Foo(); ... free(p); // freeing the pointer that has been allocated in Foo } </code></pre> <p>The Wiki example causes a leak because once the function has been executed, the a pointer doesn't exist any more because it is a <em>local variable</em> that exists only during the execution time of the function.</p> <p>But the memory block itself that has been allocated and that was pointed by <code>a</code> is still allocated and now there is no more way to free it because the only pointer (<code>a</code>) that pointed to it is gone.</p> |
6,651,380 | 0 | <pre><code>$textFields = $("input[type=text]"); </code></pre> <p>Then you can test them individually using filter</p> <pre><code>$textFields.filter('[name=email]'); </code></pre> |
25,348,522 | 0 | <p>If anyone stumbles upon this...</p> <p>I figured this out by using the sample project from the <a href="http://developer.android.com/training/animation/screen-slide.html" rel="nofollow">Android developer training</a> website. I created an anim folder in res and adding xml set files with the Object animator tag. I didnt understand how to manipulate the values correctly to get the desired animation but after some poking around i realized the following</p> <pre><code> <objectAnimator android:valueFrom= android:valueTo= android:propertyName=" android:interpolator= android:duration= /> </code></pre> <p>The valueFrom tag and the valueTo tag define the points the animation runs between and android fills in the rest. The property name is used to describe what kind of motion is being manipulated (translationX, translationY, rotationX, translationY, scaleX and scaleY). The interpolator sets the rate of change of the animation and finally duration specifies how long the animation should take. </p> <p>Once the animation files are made the following code can be used to set the animations on the fragments during a transaction. </p> <pre><code> getFragmentManager() .beginTransaction() .setCustomAnimations( R.animator.exampleOut, R.animator.exampleIn, R.animator.exampleOut, R.animator.exampleIn, ).add(R.id.container, new mFragment()).addToBackStack(null).commit();\ </code></pre> <p>the first two parameters of setCustomAnimations() set the motion of the two fragments when the transaction is initiated and the last two parameters set the motion of the two fragments when the transaction is reversed, i.e., the back button is pressed.</p> <p>This can be used to achieve the desired animation however I found that the outbound fragment would disappear from view for some reason. There fore I had to use AnimatorListener as follows:</p> <pre><code>Animator.AnimatorListener listener = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator arg0) { getFragmentManager() .beginTransaction() .setCustomAnimations( R.animator.exampleOut, 0, 0, R.animator.exampleIn ) .add(R.id.container, new mFragment()) .addToBackStack(null) .commit(); } }; slideback(listener); mHandler.post(new Runnable() { @Override public void run() { invalidateOptionsMenu(); } }); } private void slideback(Animator.AnimatorListener listener) { View movingFragmentView = cardFrontFragment.getView(); PropertyValuesHolder rotateY = PropertyValuesHolder.ofFloat("rotationY", 15f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f); PropertyValuesHolder translateX = PropertyValuesHolder.ofFloat("translationX", 500f); ObjectAnimator movingFragmentAnimator = ObjectAnimator. ofPropertyValuesHolder(movingFragmentView, rotateY, scaleX, scaleY, translateX); ObjectAnimator movingFragmentRotator = ObjectAnimator. ofFloat(movingFragmentView, "rotationY",15f, 0f); movingFragmentAnimator.setDuration(DURATION_TIME); movingFragmentRotator.setStartDelay(DELAY_TIME); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator); s.addListener(listener); s.start(); } private void slideForward (Animator.AnimatorListener listener) { View movingFragmentView = cardFrontFragment.getView(); PropertyValuesHolder rotateY = PropertyValuesHolder.ofFloat("rotationY", 15f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); PropertyValuesHolder translateX = PropertyValuesHolder.ofFloat("translationX", 0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator. ofPropertyValuesHolder(movingFragmentView, rotateY, scaleX, scaleY, translateX); ObjectAnimator movingFragmentRotator = ObjectAnimator. ofFloat(movingFragmentView, "rotationY",15f, 0f); movingFragmentAnimator.setDuration(DURATION_TIME); movingFragmentRotator.setStartDelay(DELAY_TIME); movingFragmentRotator.setDuration(DURATION_TIME); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mShowingBack = false; } }); s.start(); } </code></pre> <p>This allows you to set the properties for the outbound fragment dynamically during runtime and for some reason allows the fragment to remain in view.</p> |
24,262,645 | 0 | <p>Try this in the selector method of the info button :</p> <pre><code>[self.popover presentPopoverFromRect:[(UIButton *)sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; </code></pre> <p>Hope this helps you!</p> |
8,930,833 | 0 | Which Audio API to use for creating Audio Effects? <p>I want to record audio and apply custom-built sound effect filters, then play it back.</p> <p>Are Audio Units and Audio Queue Services the API I'm looking for? Or are there other APIs which fit this purpose better?</p> <p>Also, I've been told Audio Units can't be customized on iOS so there are just a few pre-made effects available. Is this true?</p> |
5,799,464 | 0 | Trying to see how I can improve the performance of this Sql query <p>I've got a SQL query which is trying to find all the Neighbourhoods in some Counties.</p> <p>When I use SQL Sentry Plan Explorer to visualize the query (IMO, a bit better than the tools provided with MS SSMS) it highlights a really slow performing part :-</p> <p>Full Plan</p> <p><img src="https://i.stack.imgur.com/EFGOM.png" alt="enter image description here"></p> <p>Zoomed in ....</p> <p><img src="https://i.stack.imgur.com/gRrwJ.png" alt="enter image description here"></p> <p>Details</p> <p><img src="https://i.stack.imgur.com/4gvNz.png" alt="enter image description here"></p> <p>SQL script:</p> <pre><code> -- Update which Neighbourhoods are in these Counties. INSERT INTO @NeighbourhoodCounties (NeighbourhoodId, CountyId) SELECT SubQuery.NeighbourhoodId, SubQuery.CountyId FROM ( SELECT e.LocationId AS NeighbourhoodId, b.LocationId AS CountyId, c.OriginalBoundary.STArea() AS CountyArea, c.OriginalBoundary.STIntersection(d.OriginalBoundary).STArea() AS IntersectionArea FROM @CountyIds a INNER JOIN [dbo].[Counties] b ON a.Id = b.LocationId INNER JOIN [dbo].[GeographyBoundaries] c ON b.LocationId = c.LocationId INNER JOIN [dbo].[GeographyBoundaries] d ON c.OriginalBoundary.STIntersects(d.OriginalBoundary) = 1 INNER JOIN [dbo].[Neighbourhoods] e ON d.LocationId = e.LocationId ) SubQuery WHERE (SubQuery.IntersectionArea / SubQuery.CountyArea) * 100 > 5 -- a Neighbourhood has to be 5% or more to be considered 'Inside' </code></pre> <p>Can anyone help interpret this query? What do all these numbers mean? How can I use these numbers to help diagnose and improve my query?</p> <p><a href="http://stackoverflow.com/questions/5798487/how-can-i-create-a-spatial-index-on-an-indexed-view">I tried to make an indexed view on the spatial table</a> but that failed miserably.</p> <p>Can anyone help?</p> |
402,769 | 0 | <p>I think the key to this performing is to think about how you store your data and to have some metadata around it.</p> <p>What do I mean by that?</p> <p>Have a list of Cities that have a store in NJ, for example, and filter out cities that come back from your third party api based on your master list. You might find that you only have 5 matches out of the 450 returned. Similarly, I wouldn't combine 450 querys in one query - try and chunk them up into smaller amounts.</p> <p>Also, if you can create indexes based on states you might find that a smaller index - specifically for NJ - can handle your query more efficiently than selecting a specific state's data in a larger index.</p> <p>Hope this helps, Ciaran</p> |
30,682,924 | 0 | <p>You're using RTMP, which is a Flash protocol. There is no Flash on any mobile device. You'll need to provide an HLS stream or MP4 fallback for mobiles.</p> |
27,924,803 | 0 | Bower images integration <p>I use bower and grunt. Grunt scan bower_components and integrate js/css files in special directories. What about relative paths to images in css files? How can I integrate these images?</p> |
1,117,686 | 0 | <p>I would do something like this. I'm thinking the problem could be the order of the rules, that say, the first rule will try to load the image/js/css since isn't looking if the file exists.</p> <p>try this:</p> <pre><code>Options -Indexes RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} !^www\.website\.com$ [NC] RewriteRule .* https://www.website.com/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ myfolder/index.php?q=$1 [L,QSA] RewriteRule ^$ myfolder/index.php [L] </code></pre> |
40,787,559 | 0 | <p>I think the best way to avoid the highlighting of that unused public methods is writing a couple of test for those methods in your API.</p> |
24,785,261 | 0 | <p>I think what normally happens in the scenario where you want to change an employees manager would be:</p> <ul> <li>load the employee model. You may not need to populate the manager at this point if you just intend to change it without really using the existing manager value. Make sure you change it with <code>employee.manager = newManager</code> and not <code>employee.manager._id = newManagerId</code> otherwise I'm not sure mongoose will properly understand your change.</li> <li>change the manager on the in-memory model. However, just keep your reference to this instance available so you don't have to re-fetch it from the DB.</li> <li>save the employee with the new manager ID</li> <li>If you want to do more with the populated employee (send it to the browser or whatever), just use your existing reference from step 2 instead of refetching.</li> </ul> |
40,111,951 | 0 | How to: Time-in and time-out status on vb.net <p>`Public Sub updateTextBox()</p> <pre><code> s = s + SerialPort1.ReadExisting() If Len(s) > 12 Then Try txtReceived.Text = Microsoft.VisualBasic.Mid(s, 1, 12) strSql = "SELECT * FROM stud WHERE tag = '" & txtReceived.Text & "';" command.CommandText = strSql command.Connection = SQLConnection datapter.SelectCommand = command datardr = command.ExecuteReader Dim img() As Byte If datardr.HasRows Then datardr.Read() img = datardr("picture") Dim ms As New MemoryStream(img) txtFname.Text = datardr("fname").ToString txtLname.Text = datardr("lname").ToString PictureBox1.Image = Image.FromStream(ms) SQLConnection.Close() End If SQLConnection.Open() Catch ex As Exception End Try Try Dim i As Integer Dim newtag As Boolean = True Dim stringfix As String Dim string1 As String Dim string2 As String For i = 0 To (grid.Rows.Count - 1) stringfix = grid.Rows.Item(i).Cells(0).Value string1 = Microsoft.VisualBasic.Mid(stringfix, 1, 10) string2 = Microsoft.VisualBasic.Mid(stringfix, 2, 10) If string1 = string2 Then newtag = False Exit For Else newtag = True End If Next If newtag = True Then Dim dr As Integer dr = grid.Rows.Add() grid.Rows.Item(dr).Cells.Item(0).Value = Microsoft.VisualBasic.Mid(s, 1, 12) grid.Rows.Item(dr).Cells(1).Value = txtFname.Text grid.Rows.Item(dr).Cells(2).Value = txtLname.Text grid.Rows.Item(dr).Cells.Item(3).Value = txtDate.Text + " " + txtTime.Text grid.Rows.Item(dr).Cells.Item(4).Value = "TIME IN" ElseIf newtag = False Then grid.Rows.Item(i).Cells.Item(3).Value = txtDate.Text + " " + txtTime.Text grid.Rows.Item(i).Selected = True End If Catch ex As Exception End Try Dim timeOut As DateTimeOffset = Now.AddMilliseconds(1500) Do Application.DoEvents() Loop Until Now > timeOut s = SerialPort1.ReadExisting() SerialPort1.DiscardOutBuffer() s = String.Empty SerialPort1.DtrEnable = True txtReceived.Text = "" txtFname.Text = "" txtLname.Text = "" PictureBox1.Image = Nothing End If End Sub` </code></pre> <p>Good day! I've been working on an RFID based Daily-Time-Record of a school for our Thesis. My problem is how to set the "status" of the student when he/she 1st tapped the RFID card it should be status = Time-In and when he/she tapped it for the 2nd time the status should be Time-out. Every student has a limit of one Time-In and one Time-out a day. Any idea on how to do this? Hope you guys get what im pointing out.</p> |
15,106,405 | 0 | <p>Both are suitable for bigger projects and both are secure too. But these two things depends on the Programmer or Team you hire. You can have a look <a href="http://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites" rel="nofollow">here</a>.</p> <p>ASP is fully Object oriented and can be written only in OOPS Concept. PHP Can be written in Object oriented as well as Procedural ways. PHP was a Procedural language when it is implemented first but later gained OOPS Principles. Thats why.</p> <p>PHP is an open source language. It is free to the community and lots of tutorials and examples are available everywhere. ASP.net is free framework but Web server and OS Costs.</p> |
5,510,978 | 0 | In Hudson, how do I get the current build's git commit sha? <p>We are using Hudson with git. We have a build/test server which compiles our project and then a QA server to which we need to deploy.</p> <p>We want to get the current built git commit sha and use it to pull the appropriate commit for deployment on our QA server. </p> <p>Unfortunately it seems that the hudon git plugin does not set the git commit sha in the environment variables (as the svn plugin does in SVN_REVISION for example). How do we get around this?</p> <p>Pointer/ examples will be helpful as I am a hudson noob.</p> <p>Thanks</p> |
34,257,839 | 0 | Use $mdDialog stright from controller <p>Trying to use the $mdDialog when login fails; currently I have injected $mdDialog and where my response fails I have added the following code:</p> <p><strong>$mdDialog Code:</strong></p> <pre><code>$mdDialog.show( $mdDialog.alert() .title('Username / password is incorrect') .textContent(response.message) .ok('Got it!')); </code></pre> <p>Any Idea what am I doing wrong ?</p> <p><strong>My error</strong></p> <pre><code>$mdDialog.alert(...).title(...).textContent is not a function </code></pre> <p><strong>My controller (I don't think its necessary but just encase ):</strong></p> <pre><code>(function () { 'use strict'; angular .module('app') .controller('authController', authController); authController.$inject = ['$scope','$state','AuthService','$mdDialog']; function authController($scope,$state,AuthService,$mdDialog) { $scope.login = login; $scope.user = {email: 'user', pass: 'pass'}; function login(){ this.dataLoading = true; AuthService.Login(this.user.email, this.user.pass, function (response) { console.log(response); if (response.success) { $state.go("dashboard"); } else { $mdDialog.show( $mdDialog.alert().title('Username / password is incorrect').textContent(response.message) .ok('Got it!')); } }); } }; })(); </code></pre> |
4,448,418 | 0 | Weblogic ClassCastException <p>I am getting the following exception from WebLogic console.</p> <pre><code>java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory cannot be cast to oracle.xml.jaxp.JXDocumentBuilderFactory </code></pre> <p>I am using oracle.xml.jaxp.JXDocumentBuilderFactory inside my JCA adapter and when I invoke methods on JCA adapter connection, it throws the above Exception. I have installed xmlparserv2.jar into $DOMAIN_DIR/lib.</p> <p>This is the line of code that throws above mentioned exception.</p> <pre><code>JXDocumentBuilderFactory factory =(JXDocumentBuilderFactory)JXDocumentBuilderFactory.newInstance(); </code></pre> <p>It seems to me that WebLogic is using different JXDocumentBuilderFactory and there is some conflict in classpath setting or configuration. </p> <p>Can anyone help me with this issue? Thanks in advance.</p> <p>Regards,</p> <p>K.H</p> |
21,445,811 | 0 | <pre><code>acBox.Items.Add("There is no data"); acBox.DataBind(); </code></pre> <p>Not really sure with my answer, I just answered it based on my understanding of your question.</p> |
16,148,157 | 0 | <pre><code>public enum Logger { INSTANCE; DefaultFileMonitor fm = new DefaultFileMonitor(new CustomFileListener()); private FileObject file = null; private FileObject object = null; private Logger() { this.openFile(); try { FileSystemManager fsManager = VFS.getManager(); file = fsManager.resolveFile(this.getfileLocation()); object = fsManager.resolveFile("c:\test.txt"); } catch (FileSystemException e) { e.printStackTrace(); } fm.setDelay(1000); fm.addFile(file); fm.start(); } </code></pre> <p>Here is the code that I'm using to load the DefaultFileMonitor</p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.