text:
Q: What's a simple way to get a text input popup dialog box on an iPhone I want to get the user name.  A simple text input dialog box.  Any simple way to do this?

A: Try this Swift code in a UIViewController -
func doAlertControllerDemo() {

    var inputTextField: UITextField?;

    let passwordPrompt = UIAlertController(title: "Enter Password", message: "You have selected to enter your passwod.", preferredStyle: UIAlertControllerStyle.Alert);

    passwordPrompt.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (action) -> Void in
        // Now do whatever you want with inputTextField (remember to unwrap the optional)

        let entryStr : String = (inputTextField?.text)! ;

        print("BOOM! I received '\(entryStr)'");

        self.doAlertViewDemo(); //do again!
    }));

    passwordPrompt.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: { (action) -> Void in
        print("done");
    }));

    passwordPrompt.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
        textField.placeholder = "Password"
        textField.secureTextEntry = false       /* true here for pswd entry */
        inputTextField = textField
    });

    self.presentViewController(passwordPrompt, animated: true, completion: nil);

    return;
}

A: Just wanted to add an important piece of information that I believe was left out perhaps with the assumption that the ones seeking answers might already know. This problem happens a lot and I too found myself stuck when I tried to implement the viewAlert method for the buttons of the UIAlertView message. To do this you need to 1st add the delegate class which may look something like this:
@interface YourViewController : UIViewController <UIAlertViewDelegate>
Also you can find a very helpful tutorial here!
Hope this helps.

A: Swift 3:
let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.default, handler: nil))
alert.addTextField(configurationHandler: {(textField: UITextField!) in
     textField.placeholder = "Enter text:"
})

self.present(alert, animated: true, completion: nil)

A: In iOS 5 there is a new and easy way to this. I'm not sure if the implementation is fully complete yet as it's not a gracious as, say, a UITableViewCell, but it should definitly do the trick as it is now standard supported in the iOS API. You will not need a private API for this.
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"This is an example alert!" delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];
[alert release];

This renders an alertView like this (screenshot taken from the iPhone 5.0 simulator in XCode 4.2):

When pressing any buttons, the regular delegate methods will be called and you can extract the textInput there like so:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSLog(@"Entered: %@",[[alertView textFieldAtIndex:0] text]);
}

Here I just NSLog the results that were entered. In production code, you should probably keep a pointer to your alertView as a global variable or use the alertView tag to check if the delegate function was called by the appropriate UIAlertView but for this example this should be okay.
You should check out the UIAlertView API and you'll see there are some more styles defined.
Hope this helped!
-- EDIT --
I was playing around with the alertView a little and I suppose it needs no announcement that it's perfectly possible to edit the textField as desired: you can create a reference to the UITextField and edit it as normal (programmatically).
Doing this I constructed an alertView as you specified in your original question. Better late than never, right :-)?
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Please enter your name:" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeNumberPad;
alertTextField.placeholder = @"Enter your name";
[alert show];
[alert release];

This produces this alert:

You can use the same delegate method as I poster earlier to process the result from the input. I'm not sure if you can prevent the UIAlertView from dismissing though (there is no shouldDismiss delegate function AFAIK) so I suppose if the user input is invalid, you have to put up a new alert (or just reshow this one) until correct input was entered.
Have fun!

A: I would use a UIAlertView with a UITextField subview. You can either add the text field manually or, in iOS 5, use one of the new methods.

A: Add views to a UIAlertView like this.  In iOS 5 there are some "magic" things that do it for you (but that's all under NDA).

A: In Xamarin and C#:
var alert = new UIAlertView ("Your title", "Your description", null, "Cancel", new [] {"OK"});
alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
alert.Clicked += (s, b) => {
    var title = alert.ButtonTitle(b.ButtonIndex);
    if (title == "OK") {
        var text = alert.GetTextField(0).Text;
        ...
    }
};

alert.Show();

A:
For Swift 5.1: (updating previous answer)
func doAlertControllerDemo() {

        var inputTextField: UITextField?;
    let passwordPrompt = UIAlertController(title: "Enter Password", message: "You have selected to enter your password.", preferredStyle: UIAlertController.Style.alert);

    passwordPrompt.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: { (action) -> Void in
        // Now do whatever you want with inputTextField (remember to unwrap the optional)

        let entryStr : String = (inputTextField?.text)! ;

        print("BOOM! I received '\(entryStr)'");

        self.doAlertControllerDemo(); //do again!
    }));

    passwordPrompt.addAction(UIAlertAction(title: "Cancel", style: UIAlertAction.Style.default, handler: { (action) -> Void in
        print("done");
    }));

    passwordPrompt.addTextField(configurationHandler: {(textField: UITextField!) in
        textField.placeholder = "Password"
        textField.isSecureTextEntry = false       /* true here for pswd entry */
        inputTextField = textField
    });

    self.present(passwordPrompt, animated: true, completion: nil);
    return;
}

A: To make sure you get the call backs after the user enters text, set the delegate inside the configuration handler. textField.delegate = self
Swift 3 & 4 (iOS 10 - 11):
let alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.default, handler: nil))
alert.addTextField(configurationHandler: {(textField: UITextField!) in
    textField.placeholder = "Enter text:"
    textField.isSecureTextEntry = true // for password input
})
self.present(alert, animated: true, completion: nil)

In Swift (iOS 8-10):

override func viewDidAppear(animated: Bool) {
    var alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
    alert.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
        textField.placeholder = "Enter text:"
        textField.secureTextEntry = true
        })
    self.presentViewController(alert, animated: true, completion: nil)
}

In Objective-C (iOS 8):
- (void) viewDidLoad
{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Alert" message:@"Message" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"Click" style:UIAlertActionStyleDefault handler:nil]];
    [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        textField.placeholder = @"Enter text:";
        textField.secureTextEntry = YES;
    }];
    [self presentViewController:alert animated:YES completion:nil];
}

FOR iOS 5-7:
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"INPUT BELOW" delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];

NOTE: Below doesn't work with iOS 7 (iOS 4 - 6 Works)
Just to add another version.

- (void)viewDidLoad{

    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Preset Saving..." message:@"Describe the Preset\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
    UITextField *textField = [[UITextField alloc] init];
    [textField setBackgroundColor:[UIColor whiteColor]];
    textField.delegate = self;
    textField.borderStyle = UITextBorderStyleLine;
    textField.frame = CGRectMake(15, 75, 255, 30);
    textField.placeholder = @"Preset Name";
    textField.keyboardAppearance = UIKeyboardAppearanceAlert;
    [textField becomeFirstResponder];
    [alert addSubview:textField];

}

then I call [alert show]; when I want it.
The method that goes along
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSString* detailString = textField.text;
    NSLog(@"String is: %@", detailString); //Put it on the debugger
    if ([textField.text length] <= 0 || buttonIndex == 0){
        return; //If cancel or 0 length string the string doesn't matter
    }
    if (buttonIndex == 1) {
        ...

    }
}

A: Since IOS 9.0 use UIAlertController:
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert"
                                                           message:@"This is an alert."
                                                          preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction * action) {
                    //use alert.textFields[0].text
                                                       }];
UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction * action) {
                                                          //cancel action
                                                      }];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
    // A block for configuring the text field prior to displaying the alert
}];
[alert addAction:defaultAction];
[alert addAction:cancelAction];
[self presentViewController:alert animated:YES completion:nil];

A: Tested out Warkst's third code snippet--worked great, except I changed it to be default input type instead of numeric:
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Please enter your name:" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeDefault;
alertTextField.placeholder = @"Enter your name";
[alert show];

A: Building on John Riselvato's answer, to retrieve the string back from the UIAlertView...
alert.addAction(UIAlertAction(title: "Submit", style: UIAlertAction.Style.default) { (action : UIAlertAction) in
            guard let message = alert.textFields?.first?.text else {
                return
            }
            // Text Field Response Handling Here
        })

A: UIAlertview *alt = [[UIAlertView alloc]initWithTitle:@"\n\n\n" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];

UILabel *lbl1 = [[UILabel alloc]initWithFrame:CGRectMake(25,17, 100, 30)];
lbl1.text=@"User Name";

UILabel *lbl2 = [[UILabel alloc]initWithFrame:CGRectMake(25, 60, 80, 30)];
lbl2.text = @"Password";

UITextField *username=[[UITextField alloc]initWithFrame:CGRectMake(130, 17, 130, 30)];
UITextField *password=[[UITextField alloc]initWithFrame:CGRectMake(130, 60, 130, 30)];

lbl1.textColor = [UIColor whiteColor];
lbl2.textColor = [UIColor whiteColor];

[lbl1 setBackgroundColor:[UIColor clearColor]];
[lbl2 setBackgroundColor:[UIColor clearColor]];

username.borderStyle = UITextBorderStyleRoundedRect;
password.borderStyle = UITextBorderStyleRoundedRect;

[alt addSubview:lbl1];
[alt addSubview:lbl2];
[alt addSubview:username];
[alt addSubview:password];

[alt show];


text:
Q: How to resolve conflicts between dependencies in Plone? I am writing an add-on for Plone 5.1. I have added dependency to my add-on's setup.py install_requires parameter. I have also added my add-on (esperonus.vimeo) to Plone's buildout.cfg. However, upon running buildout, I get this error:
ryselis@ryselis-All-Series:~/Plone/zinstance$ bin/buildout -c develop.cfg
mr.developer: Queued 'esperonus.vimeo_plone' for checkout.
mr.developer: Filesystem package 'esperonus.vimeo_plone' doesn't need a checkout.
Develop: '/home/ryselis/Plone/zinstance/src/esperonus.vimeo_plone'
Updating _mr.developer.
Installing instance.
Version and requirements information containing certifi:
  [versions] constraint on certifi: 2017.11.5
  Requirement of tuspy==0.2.1: certifi==2017.7.27.1
  Requirement of requests>=2.4.0: certifi>=2017.4.17
While:
  Installing instance.
Error: The requirement ('certifi==2017.7.27.1') is not allowed by your [versions] constraint (2017.11.5)

It looks like VimeoPy requires different version of certifi than tuspy (I guess this is Plone's dependency?). Is there anything I could do to add VimeoPy to my add-on?

A: This usually means that you have pinned version in your buildout configuration which are di8ffer from what a packages want's to install. You can remove the pinnings from the buildout configuration accept you have a reason for it.
New buildout versions usually have an option called "update-versions-file" which points to the buildout config file with the list of versions. Buildout will add all picked versions, which where not pinned and add them for you, so that you can rebuild this configuration later with exact the same versions.
But these pinnings are save to remove, especially if you have packages requiring diffent versions.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why is it that I can not capture the new value after my button is click? I am still pretty new to JavaScript. I have a script that will click on a next Month button and I want it to capture the new Header value. Why is it that it still capture the value before the button was click? I want to use the script to to trigger the button and for it to capture the new value as well.
I tried to use the eventListener and dispatchEvent but maybe I am not using it correctly.
var CalandarMonthValue = document.getElementsByClassName('CalandarMonth')[0];
let NextMonthButton = document.getElementsByClassName('NextMonthButton')[0];

function triggerChange(element){
    let changeEvent = new Event("change");
    element.dispatchEvent(changeEvent)
}

console.log("Current Month: "+ CalandarMonthValue);

NextMonthButton.click();
NextMonthButton.addEventListener("click"),()=> {
    triggerChange(CalandarMonthValue)
});

CalandarMonthValue = document.getElementsByClassName('CalandarMonth')[0];
console.log("New Month: "+ CalendarMonthValue.textContent);

the output I am getting is this:
Current Month: December
New Month: December


text:
Q: Html.DropDownList automatically adding prefix I have the following partial view BuyProduct.ascx
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MvcMusicStore.Models.Product>" %>

Precio: <%: Html.Price(Model) %>

<% if (Model.Active) { %>
    <% using (Html.BeginForm("AddToCart", "ShoppingCart", new { id = Model.ProductId }, FormMethod.Post, new { id = "addtocart-form" })) {%>

            <% if (Model.MetricType == (int)ProductMetricType.Units) { %>
                <%: Html.DropDownList("Quantity" , new SelectList(DropDownLists.Units , "Value", "Key" , Model.MetricType)) %>
            <% } else { %>
                <%: Html.DropDownList("Quantity", new SelectList(DropDownLists.Kilograms, "Value", "Key", Model.MetricType)) %>
            <% } %>

        <input type="submit" value="Comprar" />
    <% } %>
<% } else { %>
    Sin existencias!
<% } %>

If I use it in a View the dropdownlist name remains unmodified but if I use it inside an EditorTemplate for example :
<%@ Import Namespace="MvcMusicStore"%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MvcMusicStore.Models.Product>" %>

<%: Html.Truncate(Model.Name, 25) %>

<a href="<%: Url.Action("Details", "Store",  new { id = Model.ProductId }) %>"><img alt="<%: Model.Name %>" src="<%: Model.ProductArtUrl %>" width="180" height="165" />

    <% Html.RenderPartial("BuyProduct", Model); %>

My Controller code :
    public ActionResult AddToCart(Guid id, int quantity = 1) {

A prefix with the name of the model class is being added to the DropDownList name ( Product.Quantity inset of Quantity) and my action no longer gets the correct value, Any idea on how to solve it for both cases?

A: In the DropDownList extensions the SelectInternal method contains the construct below for generating a unique name.
string fullName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name);

I guess it is due to the fact that your are using templates, the containing model name "Product" is rendered along with the member name "Quantity". Probably to avoid name clashes when using multiple templates.
If you would really want to "override" this behaviour, a custom implementation of a DropDownList extension would probably be your best bet.


text:
Q: Implemetation of videos in video with blur effect in objective c I have to make a video editor with a blur effect on video .

Can someone please guide me some useful links or the way this task should be proceeded .I have tried doing overlapping of videos but it doesn't bring me videos in center exactly.
- (void) overlapVideos{
           AVURLAsset* firstAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"BearVideo" ofType:@"mp4"]] options:nil];
    AVURLAsset * secondAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"BearVideo" ofType:@"mp4"]] options:nil];

    AVMutableComposition* mixComposition = [[AVMutableComposition alloc] init];

    AVMutableCompositionTrack *firstTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
    [firstTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, firstAsset.duration) ofTrack:[[firstAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];

    AVMutableCompositionTrack *secondTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
    [secondTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, secondAsset.duration) ofTrack:[[secondAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:nil];
    AVMutableVideoCompositionInstruction * instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
    instruction.timeRange = CMTimeRangeMake(kCMTimeZero, firstAsset.duration);
    AVMutableVideoCompositionLayerInstruction *FirstlayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:firstTrack];
    CGAffineTransform Scale = CGAffineTransformMakeScale(0.6f,0.6f);
    CGAffineTransform Move = CGAffineTransformMakeTranslation(140,20);
    [FirstlayerInstruction setTransform:CGAffineTransformConcat(Scale,Move) atTime:kCMTimeZero];
    AVMutableVideoCompositionLayerInstruction *SecondlayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:secondTrack];
    CGAffineTransform SecondScale = CGAffineTransformMakeScale(0.9f,0.9f);
    CGAffineTransform SecondMove = CGAffineTransformMakeTranslation(0,0);
    [SecondlayerInstruction setTransform:CGAffineTransformConcat(SecondScale,SecondMove) atTime:kCMTimeZero];

    instruction.layerInstructions = [NSArray arrayWithObjects:FirstlayerInstruction,SecondlayerInstruction,nil];;

    AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoComposition];
    videoComposition.instructions = [NSArray arrayWithObject:instruction];
    videoComposition.frameDuration = CMTimeMake(1, 30);
    videoComposition.renderSize = CGSizeMake(1280, 720);

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:@"overlapVideo.mov"];

    if([[NSFileManager defaultManager] fileExistsAtPath:myPathDocs])
    {
        [[NSFileManager defaultManager] removeItemAtPath:myPathDocs error:nil];
    }

    NSURL *url = [NSURL fileURLWithPath:myPathDocs];

    AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetHighestQuality];
    exporter.outputURL=url;
    [exporter setVideoComposition:videoComposition];
    exporter.outputFileType = AVFileTypeQuickTimeMovie;

    [exporter exportAsynchronouslyWithCompletionHandler:^
    {
        dispatch_async(dispatch_get_main_queue(), ^{
            [self exportDidFinish:exporter];
        });
    }];
}

- (void)exportDidFinish:(AVAssetExportSession*)session
{
    NSURL *outputURL = session.outputURL;
    if(self.videodelegateObj!=nil){
        [_videodelegateObj videoOverlappingFinished:outputURL];

    }
}

-(void)applyBlurOnAsset:(AVAsset *)asset Completion:(void(^)(BOOL success, NSError* error, NSURL* videoUrl))completion{
    CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
    AVVideoComposition *composition = [AVVideoComposition videoCompositionWithAsset: asset
                                                       applyingCIFiltersWithHandler:^(AVAsynchronousCIImageFilteringRequest *request){
                                                           // Clamp to avoid blurring transparent pixels at the image edges
                                                           CIImage *source = [request.sourceImage imageByClampingToExtent];
                                                           [filter setValue:source forKey:kCIInputImageKey];

                                                           [filter setValue:[NSNumber numberWithDouble:10.0] forKey:kCIInputRadiusKey];

                                                           CIImage *output = [filter.outputImage imageByCroppingToRect:request.sourceImage.extent];

                                        [request finishWithImage:output context:nil];
                                                       }];

    NSURL *outputUrl = [[NSURL alloc] initWithString:@"Your Output path"];

    [[NSFileManager defaultManager]  removeItemAtURL:outputUrl error:nil];

    AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPreset960x540] ;
    exporter.videoComposition = composition;
    exporter.outputFileType = AVFileTypeMPEG4;

    if (outputUrl){

        exporter.outputURL = outputUrl;
        [exporter exportAsynchronouslyWithCompletionHandler:^{

            switch ([exporter status]) {
                case AVAssetExportSessionStatusFailed:
                    NSLog(@"crop Export failed: %@", [[exporter error] localizedDescription]);
                    if (completion){
                        dispatch_async(dispatch_get_main_queue(), ^{
                            completion(NO,[exporter error],nil);
                        });
                        return;
                    }
                    break;
                case AVAssetExportSessionStatusCancelled:
                    NSLog(@"crop Export canceled");
                    if (completion){
                        dispatch_async(dispatch_get_main_queue(), ^{
                            completion(NO,nil,nil);
                        });
                        return;
                    }
                    break;
                default:
                    break;
            }

            if (completion){
                dispatch_async(dispatch_get_main_queue(), ^{
                    completion(YES,nil,outputUrl);
                });
            }

        }];
    }
}

Kindly give some guidance.Any help or guidance in this direction would be highly appreciated.Thanks in advance.


text:
Q: Populate a Drop Down List with Unique Values from a list I have got a list with names of workers. How could I populate a DropDownList with unique values (ie: avoid duplicate) from the list? If the list contains duplicate values I need to avoid inserting the same value multiple times in the dropdown.
Here is my current code:
SPList kontraktyList = witryna.Lists["Urlopy_prac"];
SPQuery kontraktyQuery = new SPQuery();
kontraktyQuery.Query = "<Query><OrderBy><FieldRef Name='nazwisko'/></OrderBy></Query>";
SPListItemCollection kontraktyGrupa = kontraktyList.GetItems(kontraktyQuery);

foreach (SPListItem kontraktyListItem in kontraktyGrupa)
{
    DropDownList4.Items.Add(kontraktyListItem["nazwisko"].ToString());
}

A: I would modify your foreach like this:
foreach (string kontraktyListText in kontraktyGrupagreat.Cast<SPListItem>().Select<SPListItem,string>(source => source["nazwisko"] as string).Distinct())
{
    DropDownList4.Items.Add(kontraktyListText);
}

Please try it out and tell me if it worked.
Cheers!


text:
Q: How to filter Google Places API autocomplete data to obtain Countries and States I am having trouble filtering the Google Places API data to get countries and states.
The requirement is to follows:
In my application I have to use 2 textfields and when user type in the 1st text field I have to get google places api to show only counties in a table view.
Once the user select the country for example Australia then select the second textfield and type, I have to get the google place api to only show the states of the selected country in another table view.
I have tried to do as requested but was not able to do that. Is this possible to do using google place api or not? Or else what kind of thing should I have to do to achieve the requirement ?
Any suggestion would be appreciated.

A: In my application I have to use 2 textfields and when user type in the 1st text field list of country data show
and 2nd textfields that is call CityName
I suggest use this code
First You need to

var resultsViewController: GMSAutocompleteResultsViewController?

resultsViewController = GMSAutocompleteResultsViewController()

resultsViewController?.delegate = self

then after you need to use UISearchbar

searchController = UISearchController(searchResultsController: resultsViewController)
searchController?.searchResultsUpdater = resultsViewController

 if !regionCode.isEmpty{
                let filter = GMSAutocompleteFilter()
                filter.type = .city
                filter.country = regionCode
                resultsViewController?.autocompleteFilter = filter
    }

After you use GMSAutocompleteResultsViewController delegate Method

 func resultsController(_ resultsController: GMSAutocompleteResultsViewController,
                               didAutocompleteWith place: GMSPlace) {
    place.formattedAddress
    }


text:
Q: Inverse ROC-AUC value? I have a classification problem where I need to predict a class of (0,1) given a data. Basically I have a dataset with more than 300 features (including a target value for prediction) and more than 2000 rows (samples). I applied different classifiers as follows:
 1. DecisionTreeClassifier()
 2. RandomForestClassifier()
 3. GradientBoostingClassifier()
 4. KNeighborsClassifier()

Almost all the classifiers gave me similar results around 0.50 AUC value except Random forest around 0.28. I would like to know that whether it is correct if I inverse the RandomForest result like:
 1-0.28= 0.72

And report it as the AUC? Is it correct?

A: Your intuition is not wrong: if a binary classifier performs indeed worse than random (i.e. AUC < 0.5), a valid strategy is to simply invert its predictions, i.e. report a 0 whenever the classifier predicts a 1, and vice versa); from the relevant Wikipedia entry (emphasis added):

The diagonal divides the ROC space. Points above the diagonal represent good classification results (better than random); points below the line represent bad results (worse than random). Note that the output of a consistently bad predictor could simply be inverted to obtain a good predictor.

Nevertheless, the formally correct AUC for this inverted classifier, would be to first invert the individual probabilistic predictions prob of your model:
prob_invert = 1 - prob

and then calculate the AUC using these predictions prob_invert (arguably the process should give similar results with the naive approach you describe of simply subtracting the AUC from 1, but I'm not quire sure of the exact result - see also this Quora answer).
Needless to say, all this is based on the assumption that your whole process is correct, i.e. you don't have any modeling or coding errors (constructing a worse-than-random classifier is not exactly trivial).


text:
Q: whitespace issue on glyphicon I am struggling to figure out how to remove the white space in the glyphicon.
Ideally if i could get the display:inline-block go to away my life would be so much happier.
Can anyone suggest some options ? I am pretty much out of options at this point. :(
below is a working sample of my issue
https://stevia-affirm.codio.io/VerticalBootstrapTable.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

      <title>Bootstrap Vertical Table</title>

    <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css">

    <link href="css/fonts/glyphicons-halflings-regular.eot" rel="stylesheet" type="text/css">
    <link href="css/fonts/glyphicons-halflings-regular.svg" rel="stylesheet" type="text/css">
    <link href="css/fonts/glyphicons-halflings-regular.ttf" rel="stylesheet" type="text/css">
    <link href="css/fonts/glyphicons-halflings-regular.woff" rel="stylesheet" type="text/css">

                No more tables.

                        Pencil
                        Code
                        Company
                        Price
                        Change
                        Change %
                        Open
                        High
                        Low
                        Volume

                        AAC
                        AUSTRALIAN AGRICULTURAL COMPANY LIMITED.
                        $1.38
                        -0.01
                        -0.36%
                        $1.39
                        $1.39
                        $1.38
                        9,395

                        AAD
                        ARDENT LEISURE GROUP
                        $1.15
                        +0.02
                        1.32%
                        $1.14
                        $1.15
                        $1.13
                        56,431

                        AAX
                        AUSENCO LIMITED
                        $4.00
                        -0.04
                        -0.99%
                        $4.01
                        $4.05
                        $4.00
                        90,641

                        ABC
                        ADELAIDE BRIGHTON LIMITED
                        $3.00
                        +0.06
                        2.04%
                        $2.98
                        $3.00
                        $2.96
                        862,518

                        ABP
                        ABACUS PROPERTY GROUP
                        $1.91
                        0.00
                        0.00%
                        $1.92
                        $1.93
                        $1.90
                        595,701

                        ABY
                        ADITYA BIRLA MINERALS LIMITED
                        $0.77
                        +0.02
                        2.00%
                        $0.76
                        $0.77
                        $0.76
                        54,567

                        ACR
                        ACRUX LIMITED
                        $3.71
                        +0.01
                        0.14%
                        $3.70
                        $3.72
                        $3.68
                        191,373

                        ADU
                        ADAMUS RESOURCES LIMITED
                        $0.72
                        0.00
                        0.00%
                        $0.73
                        $0.74
                        $0.72
                        8,602,291

                        AGG
                        ANGLOGOLD ASHANTI LIMITED
                        $7.81
                        -0.22
                        -2.74%
                        $7.82
                        $7.82
                        $7.81
                        148

                        AGK
                        AGL ENERGY LIMITED
                        $13.82
                        +0.02
                        0.14%
                        $13.83
                        $13.83
                        $13.67
                        846,403

                        AGO
                        ATLAS IRON LIMITED
                        $3.17
                        -0.02
                        -0.47%
                        $3.11
                        $3.22
                        $3.10
                        5,416,303

Link to original article

`enter code here`

A: Put the glyphicon inside the table-cell:

If you dont want it as a inline block, just change it to a block
.glyphicon.glyphicon-pencil  {
    display: block;
}

A: #no-more-tables .glyphicon {display:block;text-align:center;height:auto;}

This will make it block.
http://jsbin.com/budag/1/edit


text:
Q: $a_n:=e^{2\pi i/n} $ , then how to show that $[\mathbb Q(a_n):\mathbb Q(a_n +1/a_n)]=2$ ? Let $a_n:=e^{2\pi i/n} $ , then how to show that $[\mathbb Q(a_n):\mathbb Q(a_n +1/a_n)]=2$ ? From this and using Galois theory can we determine which $a_n$ are irrational ?

A: Hint:
$p(x) = x^2 - (a_n + \frac 1 {a_n})x + 1$


text:
Q: Performance of sql Count* asp.net and sql server, have sqls for selecting a subset of rows, I need the count* frequently
Of course I can have a select count(*) for each of these sqls in each roundtrip but soon it will become too slow.
-How do you make it really fast?

A: Are you experiencing a problem that can't be solved by adding another index to your table? COUNT(*) operations are usually O(log n) in terms of total rows, and O(n) in terms of returned rows.
Edit: What I mean is (in case I misunderstood your question)
Given this structure:
CREATE TABLE emails (
    id INT,
    .... OTHER FIELDS
)

CREATE TABLE filters (
    filter_id int,
    filter_expression nvarchar(max) -- Or whatever...
)

Create the table
CREATE TABLE email_filter_matches (
    filter int,
    email int,
    CONSTRAINT pk_email_filter_matches PRIMARY KEY(filter, email)
)

The data in this table would have to be updated every time a filter is updated, or when a new email is received.
Then, a query like
SELECT COUNT(*) FROM email_filter_matches WHERE filter = @filter_id

should be O(log n) with regard to total number of filter matches, and O(n) in regard to number of matches for this particular filter. Since your example shows only a small number of matches (which seems realistic when it comes to email filters), this could very well be OK.
If you really want to, of course you could create a trigger on the email_filter_matches table to keep a cached value in the filters table in sync, but that can be done the day you hit performance issues. It's not trivial to get these kinds of things right in concurrent systems.

A: Here are a few ideas for speeding up count(*) at the data tier:

*

*Keep the table and the clustered index as narrow as possible, so that more rows fit per page

*Keep the filtering criteria as simple as possible, so the counting goes fast

*Do what you can to make sure the rows to be counted are in memory before you start to count them (perhaps using pre-caching)

*Make sure your hardware is optimized (enough RAM, fast enough disks, etc)

*Consider caching results in separate tables

As an alternative, if only the filters change frequently and not the data itself, you might consider building a cube using Analysis Services, and run your queries against that.


text:
Q: php loop through array I am trying to get certain values from an array but got stuck. Here is how the array looks:
array(2) {
  [0]=>
  array(2) {
    ["attribute_code"]=>
    string(12) "manufacturer"
    ["attribute_value"]=>
    string(3) "205"
  }
  [1]=>
  array(2) {
    ["attribute_code"]=>
    string(10) "silhouette"
    ["attribute_value"]=>
    array(1) {
      [0]=>
      string(3) "169"
    }
  }
}

So from it I would like to have attribute_values, and insert it into a new array, so in this example I need 205 and 169. But the problem is that attribute_value can be array or string. This is what I have right now but it only gets me the first value - 205.
foreach ($array as $k => $v) {
  $vMine[] = $v['attribute_value'];
}

What I am missing here?
Thank you!

A: If sometimes, attribute_value can be an array, and inside it the values, you can just check inside the loop (Provided this is the max level) using is_array() function. Example:
$vMine = array();
foreach ($array as $k => $v) {
    if(is_array($v['attribute_value'])) { // check if its an array
        // if yes merge their contents
        $vMine = array_merge($vMine, $v['attribute_value']);
    } else {
        $vMine[] = $v['attribute_value']; // if just a string, then just push it
    }
}

A: I suggest you to use array_map instead of for loop. You can try something like this..
$vMine = array_map(function($v) {
    return is_array($v['attribute_value']) ? current($v['attribute_value']) : $v['attribute_value'];
}, $arr);

print '<pre>';
print_r($vMine);

A: Try the shorthand version:
foreach ($array as $k => $v) {
  $vMine[] = is_array($v['attribute_value']) ? current($v['attribute_value']):$v['attribute_value'];
}

or the longer easier to understand version, both is the same:
foreach ($array as $k => $v) {
    if(is_array($v['attribute_value'])) {
        $vMine[] = current($v['attribute_value']);
    } else {
        $vMine[] = $v['attribute_value'];
    }
}


text:
Q: Can someone please help me with this Java manipulation code. I wanna know how come the last two printouts are 35 respectively instead of 8? This is how code looks like:
The first printout is 8 which is correct but the 2nd and 3rd printouts are 35 respectively, how?
    int x = 3;
    int y = 5;
    String s6 = x + y + "total";
    String s7 = "total " + x + y;
    String s8 = " " + x + y + "total";
    System.out.println("s6: " + s6);
    System.out.println("s7: " + s7);
    System.out.println("s8: " + s8);


text:
Q: How to include comfirm box in Php I have created a Joomla article. I have installed sourcerer Joomla extension to use JavaScript and php. I am working on course purchase site in this user purchase course from owner and credits are deducted on purchasing of course. We are using a confirm box so that when a user click on "Cancel" button then it return to course page and when user click on "OK" button, then a php code is executed and course is purchased and credits are deducted. It works fine when I click on the OK button. When I click on cancel button, it is deducted credits also. I don't want to deduct credits on click of cancel.
I am using this JavaScript code:
var answer = confirm ("You are about to purchase this course. Click Continue to complete the purchase, or CANCEL to return to the CE page.");
if(!answer)
{
    window.location="index.php";
}

A: Javascript:
function confirm_delete() {
      return confirm('are you sure?');
    }

Use onclick in the button
onclick='return confirm_delete()'

When the user clicks OK the php code gets excecuted but when clicked on Cancel nothing happends.

A: Why don't you use onclick?
onclick="return confirm('Are you sure you want to delete?');"

A: The best way to do this is by onclick method as follows:
oncllick ='return confirm()'

function confirm()
{
    return confirm('Are you sure to continue?');
}

when user click ok then code excecuted and when click on cancel button it remains on that page only


text:
Q: Guice like dependency injection frameworks in PHP Are there any Guice like or similar dependency injection frameworks in PHP? If not are there any good dependency injection frameworks in PHP?
I have to implement same code in PHP what I have implemented in Java and I use Guice in my Java project. So it would be easier to implement PHP version, if it used similar framework.

A: (Posting my comment as a response)
Have a look at my clone of Guice named Sharbat (means juice). The API is quite the same as Guice's.
It has pretty much everything you need:

*

*Constructor injection (does not require @Inject annotation)

*Field injection (regardless of visibility, using @Inject(FooBar))

*Method injection (regardless of visibility, requires @Inject annotation)

*Provider injection (for fields via @InjectProvider(T=FooBar), for methods via @Provider(T=FooBar, param=fooBarProvider)

*Scopes (possible to implement a custom one)

*AOP (method interceptors)

*Circular dependencies

See the readme file for example usage.

A: I like the lightweight Aura.Di. The readme in the linked github project page gives you enough information to get started in a couple of minutes. It is dependant on 5.3 though.
I don't think Guice's use of annotations can be implemented in PHP in runtime without a very heavy performance impact, if that's your primary request.

A: I would like to recommend you pimple. It's very easy to use.
There is interesting presentation about this dependency injection container (author of this presentation is creator of pimple).

A: There is the Symfony's Dependency Injection component.

A: Here is another dependency framework to add to the list: PHP-DI
It is a container meant to be very practical to use, following convention over configuration (so you end up writing much less configuration than with other containers).
It features dependency injection through annotations (which is optional) and minimal configuration:
class Foo {
    /**
     * @Inject
     * @var Bar
     */
    private $bar;

    public function hello() {
        return $this->bar->sayHello();
    }
}

Be aware that annotations are optional though, if you don't like it you don't have to use it.
It's very easy to use, and it integrates with Zend Framework and Symfony very well.
(disclaimer: I do work on this framework)

A: Let me introduce my implementation of the clone of Guice.
Ray.Di https://github.com/ray-di/Ray.Di

A: Check out

*

*https://github.com/researchgate/injektor

rg\injektor is a sophisticated dependency injection container for PHP that was inspired by Guice. Unlike other reflection based containers rg\injektor includes a factory class generator that you can use to prevent the use of reflection on production.

It features Constructor Injection, Property Injection, Provider Classes, Object Management, Named Injection and a couple more things. It is unit-tested and available via Composer.


text:
Q: UNET:how to get each network start position? I'm really new to unity and specially to unity networking system , So my problem is :
I'm devoloping a card game in which i need to get the network start position in scripting so i can instantiate my cards . I found in unity scripting API the following :
enter link description here
So I made a script in which i did this :
public class CardSpawner : NetworkBehaviour
{

public List<GameObject> Cards;

void Start()
{

    distributeCards (Cards);
}

[Server]
public void distributeCards (List<GameObject> list){

    Transform startPositionTransform;
    Vector2 position, finalPosition;
    NetworkManager NetM;
    List<Transform> startPositionsList;

    Vector2 Increment = new Vector2 (1.41f, 0f);
    NetM = GetComponent<NetworkManager> ();
    for ( int i = 1; i<5 ;i++){
        for (int j=0; j<8; j++) {

            GameObject CurrentGameObject = list[Random.Range(0,list.Count)];

            list.Remove(CurrentGameObject);

            switch (i){
            case 1:
                startPositionsList = NetM.startPositions ;
                startPositionTransform = startPositionsList[3];
                position =startPositionTransform.position;
                finalPosition = position + j * Increment;
                Network.Instantiate (CurrentGameObject, finalPosition, Quaternion.identity, 4);
                break;
            case 2:
                //position = startPositionsList [1];
                //finalPosition = position + j * Increment;
                //Network.Instantiate (CurrentGameObject, position, Quaternion.identity, 4);
                break;
            case 3:
                //position = startPositionsList [2];
                //finalPosition = position + j * Increment;
                //Network.Instantiate (CurrentGameObject, position, Quaternion.identity, 4);
                break;
            case 4:
                //position = startPositionsList [3];
                //finalPosition = position + j * Increment;
                //Network.Instantiate (CurrentGameObject, position, Quaternion.identity, 4);
                break;

            }

        }

    }
}

}

but i get this error in the console while playing my scene  :
NullReferenceException: Object reference not set to an instance of an
object
CardSpawner.distributeCards (System.Collections.Generic.List`1 list) (at
Assets/Scripts/CardSpawner.cs:39)
CardSpawner.Start () (at Assets/Scripts/CardSpawner.cs:17)

I don't see from where this error come from but any advice will be appreciated .thanks for your time.


text:
Q: Restarting a Node app running with pm2-runtime causes the container to disappear but app still runs My NodeJs App was successfully deployed inside a Docker Container. I put this command in Dockerfile:

CMD ["pm2-runtime", "app.js"]

After restarting the app from the PM2 key metrics panel, the container disappeared (docker ps shows nothing) but strangely the app kept running. After a couple of minutes I figured out that pm2 was running it globally in the server. pm2 ls shows the app process.
Is this behaviour considered normal? Can this be prevented?

A: This is not the expected behvour, there might be the case the same application is running on host with same keys, so by issue restart command can restart both process, but pm2 dashboard able to recognise the process even if it running against same keys.
What  I assume, That after the restart from the dashboard there were some errors that kill the container and you were not able to see the container when you run docker ps, as pm2-runtime retires 3 times if there is any error occurs.
One way to double-check is to verify, run docker ps -a and grab the container id and check  docker logs stopeed_container_id, you will probely see somethign like
2019-1-02T20:53:03: PM2 log: 0 application online, retry = 3
2019-1-02T20:53:05: PM2 log: 0 application online, retry = 2
2019-1-02T20:53:07: PM2 log: 0 application online, retry = 1
2019-1-02T20:53:09: PM2 log: 0 application online, retry = 0
2019-1-02T20:53:09: PM2 log: Stopping app:www id:0
2019-1-02T20:53:09: PM2 error: app=www id=0 does not have a pid
2019-1-02T20:53:09: PM2 log: PM2 successfully stopped

So overide this behour to do not stopped container even if there is error, I will not recomend this approch but You can run with --no-auto-exit flag.
--no-auto-exit
do not exit if all processes are errored/stopped or 0 apps launched

pm2-runtime option
CMD pm2-runtime --no-auto-exit app.js


text:
Q: How to create a video file path on Android 10 I tried  to create a video file path as the follows :
String fileName =   videoFileName = "VID" + System.currentTimeMillis() + ".mp4";

public static String createVideoPath(Context context, String fileName) {
    File imageThumbsDirectory = context.getExternalFilesDir("FOLDER");
    if (imageThumbsDirectory != null) {
        if (!imageThumbsDirectory.exists()) {
            imageThumbsDirectory.mkdir();
        }
    }
    String appDir = context.getExternalFilesDir("FOLDER").getAbsolutePath();
    File file = new File(appDir, fileName);
    return file.getAbsolutePath();
}

I call the method above like this : String videoPath = createVideoPath(getApplicationContext(),fileName);
I use this library for edits :
EZFilter.input(mainBitmap).addFilter(null).enableRecord(videoPath, true, false).into(renderView);

After the edit finished, I try to save the final video to the gallery as follows :
private static Uri publicDirURI(Context context, String fileName, String dir) {
        ContentValues valuesVideos;
        valuesVideos = new ContentValues();
        valuesVideos.put(MediaStore.Video.Media.RELATIVE_PATH, dir);
        valuesVideos.put(MediaStore.Video.Media.TITLE, fileName);
        valuesVideos.put(MediaStore.Video.Media.DISPLAY_NAME, fileName);
        valuesVideos.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4");
        valuesVideos.put(MediaStore.Video.Media.DATE_ADDED, System.currentTimeMillis() / 1000);
        valuesVideos.put(MediaStore.Video.Media.DATE_TAKEN, System.currentTimeMillis());
        valuesVideos.put(MediaStore.Video.Media.IS_PENDING, 1);
        ContentResolver resolver = context.getContentResolver();
        Uri collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
        Uri uriSavedVideo = resolver.insert(collection, valuesVideos);
        return saveFileToPublicMovies(context, valuesVideos, uriSavedVideo, fileName);
    }

private static Uri saveFileToPublicMovies(Context context, ContentValues contentValues, Uri uriSavedVideo, String fileName) {
    ParcelFileDescriptor pfd;
    try {
        pfd = context.getContentResolver().openFileDescriptor(uriSavedVideo, "w");
        FileOutputStream out = null;
        if (pfd != null) {
            out = new FileOutputStream(pfd.getFileDescriptor());
            File videoFile = new File(context.getExternalFilesDir("FOLDER"), fileName);
            FileInputStream in = new FileInputStream(videoFile);
            byte[] buf = new byte[8192];
            int len;
            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            out.close();
            in.close();
            pfd.close();
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    contentValues.clear();
    contentValues.put(MediaStore.Video.Media.IS_PENDING, 0);
    context.getContentResolver().update(uriSavedVideo, contentValues, null, null);
    return uriSavedVideo;
}

But I always get an empty saved video with 0.00b, I've tried the app with device running Android 9, but with getExternalStoragePublicDirectory, and everyting works just fine, so the issue is not related with the library.
Could anyone help me to solve this issue, I'm stuck on it almost 1 week, thank you
Edit :
 private static Uri saveFileToPublicMovies(Context context, ContentValues contentValues, Uri uriSavedVideo, String fileName) {
        ParcelFileDescriptor pfd;
        try {
            pfd = context.getContentResolver().openFileDescriptor(uriSavedVideo, "w");
            FileOutputStream out = null;
            if (pfd != null) {
                out = new FileOutputStream(pfd.getFileDescriptor());
                File videoFile = new File(context.getExternalFilesDir("AppName"), fileName);
                FileInputStream in = new FileInputStream(videoFile);
                byte[] buf = new byte[8192];
                int len;
                while ((len = in.read(buf)) > 0) {
                    out.write(buf, 0, len);
                }
                out.flush();
                out.getFD().sync();
                out.close();
                in.close();
                pfd.close();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        contentValues.clear();
        contentValues.put(MediaStore.Video.Media.IS_PENDING, 0);
        context.getContentResolver().update(uriSavedVideo, contentValues, null, null);


text:
Q: Instancing a Proxied Class (RealProxy) I'm trying to create a proxy using a RealProxy extension. I had no problem in forwarding calls and intercepting them. However, I also wanted to intercept the instantiation of the class being proxied, so I tried to override the instance creation in a ProxyAttribute derived class.
Here is the code:
namespace T1
{
    [ProxiableProxy]
    class Proxiable : ContextBoundObject
    {
        public void DoStuff(string test)
        {
            return;
        }
    }

    class ProxiableProxyAttribute : ProxyAttribute
    {
        public override MarshalByRefObject CreateInstance(Type serverType)
        {
            return (Proxiable)new MyProxy(serverType).GetTransparentProxy();
        }

        public override RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, System.Runtime.Remoting.Contexts.Context serverContext)
        {
            return new MyProxy(serverType);
        }
    }

    class MyProxy : RealProxy
    {
        public MyProxy(Type myType) : base(myType)
        {
        }

        public override System.Runtime.Remoting.Messaging.IMessage Invoke(IMessage myIMessage)
        {
             Console.WriteLine("MyProxy.Invoke Start");
             Console.WriteLine("");
             ReturnMessage myReturnMessage = null;

             if (myIMessage is IMethodCallMessage)
             {
                Console.WriteLine("MethodCall");
             }
             else if (myIMessage is IMethodReturnMessage)
                Console.WriteLine("MethodReturnMessage");

             if (myIMessage is IConstructionCallMessage)
             {

                 return new ConstructionResponse(new Header[1] { new Header("__Return", this.CreateObjRef(typeof(object))) }, (IConstructionCallMessage)myIMessage);
             }

             myReturnMessage = new ReturnMessage(5,null,0,null,
                                           (IMethodCallMessage)myIMessage);

             Console.WriteLine("MyProxy.Invoke - Finish");
             return myReturnMessage;
        }

        public override ObjRef CreateObjRef(Type requestedType)
        {
            return new MyObjRef();
        }
    }

    class MyObjRef : ObjRef
    {
        public override object GetRealObject(System.Runtime.Serialization.StreamingContext context)
        {
            return base.GetRealObject(context);
        }
    }
}

I took the info from here: http://msdn.microsoft.com/en-us/library/vstudio/scx1w94y(v=vs.100).aspx
This code is supposed to work when I instance the Proxiable class:
new Proxiable() -or- Activator.CreateInstance(typeof(Proxiable))
When I instance the class the code DOES excecute -the CreateInstance in the ProxiableProxyAttribute and the Invoke method in MyProxy-. But in the Invoke method of MyProxy, I have to also emulate the constructor, and it has to return an ObjRef object. I've been trying to return this reference, but I get an exception "Invalid ObjRef provided to 'Unmarshal'."
I really don't have a clue now, this exception is very abstract, and there is little to none information about this on the internet. If anyone knows what kind of ObjRef instance the marshaller is expecting, it would really help me.

A: This seems to work:
 if (myIMessage is IConstructionCallMessage)
 {
    IConstructionReturnMessage retMsg = InitializeServerObject((IConstructionCallMessage)myIMessage);
    MarshalByRefObject ret = GetUnwrappedServer();
    SetStubData(this, ret);
    return retMsg;
 }

From MSDN Blogs.


text:
Q: Probability of 2 people standing next to each other Tony, Angela, and four of their friends are at an amusement park. They all get in line for a roller coaster. If the six of them line up at random, what is the probability that Tony and Angela are standing beside each other?
I know that the answer is 1/3 but how do you solve it?

A: Hint: There are $\binom 62$ equally likely outcomes for which of the six positions in line the two named persons end up at. $5$ of these have them standing next to each other.

A: Henning Makolm's answer will be faster, but you can also count all the possibilities. There are $6!$ ways of arranging everyone in line. There are $5 \cdot 2! \cdot 4!$ ways to arrange everyone with Tony and Angela next to each other: $5$ choices of which two spots to choose, $2!$ ways to arrange Tony and Angela in those spots, and $4!$ ways to arrange the other four in the remaining spots.


text:
Q: Expresión (regex) que tome 2 dígitos asemejando input de mes Se necesita es que el usuario ingrese El mes en Numero (sin usar ningún control de fecha); donde debe validar que sea un numero positivo y que acepte 1 al 9  y 0 al 2; solo que No requieren que se coloque mes 01 o mes 09 si no 9 o 1; Lo que he realizado hasta el momento es esto
^[+]?(0[1-9]|1[0-2])

El problema es que este debe usar el mes 01 y es lo que no quiere el usuario.

var re = /^[+]?(0[1-9]|1[0-2])/;

console.log(re.test('') + ' No cumple' );
console.log(re.test('1')+ ' No cumple deberia Cumplir');
console.log(re.test('01'));
console.log(re.test('12'));
console.log(re.test('13') + ' No cumple');
console.log(re.test('9') + ' No cumple deberia Cumplir');

A: Prueba con /^[+]?(0?[1-9]|1[0-2])$/
He puesto que el cero sea opcional 0?, y también he puesto que la cadena tiene que acabar allí $.
No sé si esta última condición te vale, pero si no la pongo, acepta también el 13 (en realidad se queda con el 1, el 3 no pasa la condición, pero al pasar parte de la cadena de texto la da por válida).
Si no pones $, de hecho, también te dará por válidos: 22, 45, 023, etc.

var re = /^[+]?(0?[1-9]|1[0-2])$/;

console.log(re.test('') + ' debería fallar' );
console.log(re.test('1') + ' debería cumplir');
console.log(re.test('01') + ' debería cumplir');
console.log(re.test('12') + ' debería cumplir');
console.log(re.test('13') + ' debería fallar');
console.log(re.test('9') + ' debería cumplir');

A: Podrías lograrlo así:

*

*Agregar ? al 0 (cero) en el grupo para los meses menores a 10

*Agregar $ al final de la expresión regular, para validar la cadena completa

*OPCIONAL: sacar [+]? (personalmente,no sabría para que esta)

Demo:

var re = /^(0?[1-9]|1[0-2])$/;

console.log(re.test('') + ' No cumple' );
console.log(re.test('1')+ ' No cumple deberia Cumplir');
console.log(re.test('01'));
console.log(re.test('12'));
console.log(re.test('13') + ' No cumple');
console.log(re.test('9') + ' No cumple deberia Cumplir');


text:
Q: Check if android/iOS app installed from web app? I have an android application, an iOS application, and an HTML5 application and I want to be able to check from my HTML5 app whether users have the Android or iOS app installed.  I understand this can be done natively in both respective platforms, but is there a way to check if a native app is installed from a web app?  I have registered uri schemes on both native apps, is there a way to check from my web if these apps are installed?

A: No, not really. If you've setup the app to handle URIs, then you can do some hackery to start the app if it's installed and display something else if it's not. You can't do it without launching the app though as far as I know (and it'd be a user privacy issue if you could).

A: I dont think you can check whether app installed or not in iPhone. Probably you can do it in Android, because it gives more control over system level features. In iPhone the application installs in file system with out having the application's name as the file name of the executable.


text:
Q: Configure Google Cloud SQL instance in Eclipse The name of my instance is

domain.com:my_project:xyz

So i actually completed the form like this :

But i got the following error :

Any ideas? Thank you so much!
I just created it like 20 mins ago may be i need to wait but i doubt that it is the problem.

A: The instance name is "domain.com:my_project:xyz", not just "xyz".


text:
Q: Convergence of harmonic functions in $L^1_{loc}$ implies uniform convergence on compact subsets I came across this question when reading the proof of Lemma 6.19 p246 in the book A Course in Complex Analysis and Riemann Surfaces by Schlag. In the proof, they make the following reasoning.
Take $V\subset \mathbb{C}$ open and $\{u_n \}_n \subset C^{\infty}(V)$ a sequence of harmonic functions on $V$ which converges in the sense of $L^1_{loc}$ to $u_{\infty}$, meaning that for any compact $K\subset V$, we have
$$ \iint_K |u_n(z)-u_{\infty}(z)|dz \rightarrow 0 $$
as $n\rightarrow \infty$. Now, by the mean value property (MVP), we have for each disk $D(z_0,r)$:
$$u_n(z_0)= \frac{1}{\pi r^2}\iint_{D(z_0,r)} u_n(z)dz$$
which implies that $\{u_n \}_n$ is a Cauchy sequence in $C(V)$ and therefore converges uniformly on compact subsets of $V$ to $u_{\infty}$.
My questions are:
1) What do they mean with '$\{u_n \}_n$ is a Cauchy sequence in $C(V)$'? I am pretty sure that this means $\sup_{z\in V}|u_n(z)-u_m(z)|\rightarrow 0$ as $n,m\rightarrow \infty$ but I just want to make sure this interpretation is correct.
2) How does this alternative way of writing the MVP imply the uniform convergence on compact subsets of $V$ to $u_{\infty}$? I can only show that this implies pointwise convergence, but this is not as strong as their claim.
Any help would be very much appreciated.

A: I'll answer question 2, which will hopefully clarify question 1 a bit. (I don't have the book so I am not sure about what they use as the notational convention.)
Let $K\subset V$ be compact. I claim first that there exists $K' \subset V$ and an open set $W \subset K'$ such that $K \subset W$.
This follows by noting that $K$ has positive distance to $V^C$ which is closed. So let $r = \frac12 \mathrm{dist}(K, V^C)$ and you can set $W = \cup_{p\in K} D(p,r)$ and $K'$ the closure of $W$.
Then for any $p\in K$, using the same $r$ as in the above construction, we have that using the mean value property
$$ |u_n(p) - u_\infty(p)| \leq \frac{1}{\pi r^2} \iint_{D(p,r)} | u_n(z) - u_\infty(z)| ~\mathrm{d}z \leq \frac{1}{\pi r^2} \iint_{K'} |u_n(z) - u_\infty(z)| ~\mathrm{d}z $$
Note that on the far right the domain of integration is $K'$ independent of $p\in K$. Hence the convergence of $u_n\to u_\infty$ is uniform on $K$.  (But note that the "$\epsilon$" in the convergence is determined by the $L^1$ convergence on a somewhat bigger $K'$, not just $K$ itself.)


text:
Q: Trying to connect "favorite" pages to member profiles Ok so - I recently started a business and have to be frugal this first year. I reached out to several developers but I just don't have the funds to pay for this at the moment. I'm alright with code - as long as I have a base or snippet to go off of. So this is what I need to build:
I currently have a website built for my students. In it, they have their own personal "member" page. On my website, I have about 300 different pages (with unique URLs) that they use to study content from. What I would like to do is make it to where they can add "favorites" to their member page and it automatically drops the link of that favorited URL into the correct category. For example:
Say a student wants to favorite "Types of Clouds" which is in the category of "Weather Theory" - they can click a button on the "Types of Clouds" page which will automatically add the link of that page to their favorited section of their member page under the correct category of "Weather Theory." It would look something like this once they have a few favorites:
Username Study Guide
Category: Weather Theory

*

*Types of Clouds <--clicking on that would take the student to the saved page

*Storms

*Fronts

Category: Weather Tools

*

*Forecasts

*Winds Aloft

I think I may need to build some sort of database, but I have no idea. Any ideas of where to even begin? Thanks for reading!


text:
Q: Laravel5: Auth::attempt not working as expected i've read the Laravel 5 Docs about Authentication but couldn't manage to Login as described.
My users table contains both fields, username and password (which is type TEXT), i've stored a hashed password which is like $2y$10$XCyEOyvC6Yp/O6HaeemPheO4KV1I8aEMUytZZt77Yjw9hp/j6uivWnope
here's my code:
public function validateLogin()
{
    $email = Input::get('email');
    $pass = Input::get('password');
    $pass = Hash::make($pass);

    $credentials = [
            'username' => $email,
            'password' => $pass
    ];
    if (Auth::attempt($credentials)) {
        // Authentication passed...
        return "passed";
    }else{
        return "nope";
    }
}

I've tried anything, Auth::attempt always returns false :(
Imo it's exactly as described in the Docs, anyone knows what's wrong?
Thanks

A: You probably don't need to do the $pass = Hash::make($password) call by yourself.
Try removing that line see if it works.
From the docs:
<?php

namespace App\Http\Controllers;

use Auth;
use Illuminate\Routing\Controller;

class AuthController extends Controller
{
    /**
     * Handle an authentication attempt.
     *
     * @return Response
     */
    public function authenticate()
    {
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            // Authentication passed...
            return redirect()->intended('dashboard');
        }
    }
}

The attempt method accepts an array of key / value pairs as its first
  argument. The values in the array will be used to find the user in
  your database table. So, in the example above, the user will be
  retrieved by the value of the email column. If the user is found,
  the hashed password stored in the database will be compared with the
  hashed password value passed to the method via the array.

For further reference check:
http://laravel.com/docs/master/authentication#authenticating-users

A: did u write the function in AuthController? or in any new/other controller?
if u wrote the function in other controller make sure you have added this code at top
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

public function login()
    {
        $email = Input::get('email');
        $password = Input::get('password');
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            // Authentication passed...
            return redirect()->intended('dashboard');
        }
        else{
             return redirect()->intended('admin/login');
        }
    }


text:
Q: How to install multiple PHP versions in Virtualmin 6, Debian 9 By default Debian 9 comes with PHP 7, but I was interested in PHP 5 for older websites as well.
I tried following/adapting this guide (not virtualmin specific).
But this is the error I was getting (because Virtualmin was detecting the wrong php binary):
[Tue Jan 22 15:08:58.713966 2019] [fcgid:warn] [pid 1023] (104)Connection reset by peer: [client MYIP:62256] mod_fcgid: error reading data from FastCGI server
[Tue Jan 22 15:08:58.714041 2019] [core:error] [pid 1023] [client MYIP:62256] End of script output before headers: test.php

A: So first you need to add repository for PHP 5.6, "here are packages directly from a maintainer of Debian's PHP packages, Ondřej Surý."
$ apt-get install apt-transport-https
$ curl https://packages.sury.org/php/apt.gpg | apt-key add -
$ echo 'deb https://packages.sury.org/php/ stretch main' > /etc/apt/sources.list.d/deb.sury.org.list
$ apt-get update

Now the key is to install just the right php package, in the case of virtualmin running default FCGId mode, it is:
$ apt-get install php5.6-cgi

I also wanted mysql/i, gd & xml support so:
 $ apt-get install php5.6-mysql php5.6-gd php5.6-xml

These will both install a few dependencies as well.
Finally:
service apache2 restart

Now you should be able to run "System settings"->"Re-Check Configuration" and look for the line that should say something like this:
The following PHP versions are available : 5.6.40 (/usr/bin/php-cgi5.6), 7.0.33 (/usr/bin/php-cgi7.0)

Making sure that both bin's are -cgi variants, this was what got me as i had one detecting as plain php5.6 without the -cgi bit.
Now you should be able to go to "Server Configuration"->"PHP Versions" and select the new (older) version we installed.
Also now check if in "Services" you have an new option to configure the new 5.6 php.ini too, otherwise (eg it was an existing server) you need to go to "Server Configuration"->"Website Options" and change from FCGId to CGI wrapper and back to FCGId again, this will generate your php.ini in the new section.
Now finally you may want to comment out the new apt source we added earlier to stop your 'regular debian' php packages from being upgraded from
#deb https://packages.sury.org/php/ stretch main


text:
Q: Ansible reboot remote host wait for 60 sec and reboot next remote host I'm trying to reboot remote host with ansible. For now it working but remote host rebooted in the same times. I would like to reboot one by one with sleep time.
I tried to put wait_for in the code below but It doesn't work. I got error that conflict with shell.
  Playbook file
  - name: Rebooting ...
    wait_for:
      time_out: 60
    shell: sleep 2 && /sbin/shutdown -r now "Reboot required"
    async: 1
    poll: 0
    ignore_errors: true
    register: rebooting

Error message:
The error appears to have been in '/home/ansible/reboot-hosts.yml': line 20, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - name: Rebooting ...
    ^ here

exception type: <class 'ansible.errors.AnsibleParserError'>
exception: conflicting action statements: shell, wait_for

The error appears to have been in '/home/ansible/reboot-hosts.yml': line 20, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

This is expect procedure:

*

*Reboot host 1

*Sleep 60 seconds

*Reboot host 2

*Sleep 60 seconds

*Reboot host 3

A: As @Peschke said, try the reboot module.  But do do it one at a time, you need to set serial: 1 in the play:
- hosts: all
  serial: 1
  become: yes

  tasks:
  - name: Rebooting ...
    reboot:
      reboot_timeout: 60

A: The issue is that you have two actions in your task: wait_for and shell. Unless you use a block, the wait_for module needs to be within its own task.
Try something like this:
  - name: Rebooting ...
    shell: sleep 2 && /sbin/shutdown -r now "Reboot required"
    async: 1
    poll: 0
    ignore_errors: true
    register: rebooting

  - name: wait for reboot
    wait_for:
      timeout: 60
    delegate_to: localhost

Another option is to use the reboot module. This module will wait for the system to go down and come back up before proceeding. By default, it waits 600 seconds for the system to come back up.
If you only wanted to wait 60 seconds, you could do the following:
  - name: Rebooting ...
    reboot:
      reboot_timeout: 60


text:
Q: Why Mailtrap.io does not receive emails from pear-mail? I installed pear-mail including smtp like so
$ sudo pear install Net_SMTP

my php looks like this
$mail = @ \Mail::factory('smtp', $params);
$mail = & $mail;
$success = $mail->send($this->vchEmail, $headers, $body);
if (!$success) {
        throw new Exception(' Email was not sent.');
    }
if (@\PEAR::isError($mail)) {
   throw new Exception(' Email was not sent: '.$mail->getMessage());
}

And it goes with no exceptions, BUT mailtrap.io does not show incoming emails.
If I send email from my local it is sent and received all right like so:
$mail = @ \Mail::factory('mail', $params);

May be the problems came when I was installing Net_SMTP. I got some WARNINGs like so:
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
WARNING: "pear/Auth_SASL" is deprecated in favor of "pear/Auth_SASL2"
Did not download optional dependencies: pear/Auth_SASL, use --alldeps to download automatically
pear/Net_SMTP can optionally use package "pear/Auth_SASL" (version >= 1.0.5)
downloading Net_SMTP-1.8.0.tgz ...
 Starting to download Net_SMTP-1.8.0.tgz (14,399 bytes)
.....done: 14,399 bytes
downloading Net_Socket-1.2.2.tgz ...
Starting to download Net_Socket-1.2.2.tgz (6,903 bytes)
...done: 6,903 bytes
install ok: channel://pear.php.net/Net_Socket-1.2.2
install ok: channel://pear.php.net/Net_SMTP-1.8.0

I also checked ports availability like so:
Install Nmap $ sudo port install nmap
And check the port 25 $ nmap -p 25 smtp.mailtrap.io
here is the result
Starting Nmap 7.60 ( https://nmap.org ) at 2018-02-01 12:50 AEDT
Nmap scan report for smtp.mailtrap.io (34.197.182.80)
Host is up (0.23s latency).
Other addresses for smtp.mailtrap.io (not scanned): 52.5.224.12 34.224.48.59
rDNS record for 34.197.182.80: ec2-34-197-182-80.compute-1.amazonaws.com

PORT   STATE SERVICE
25/tcp open  smtp

Nmap done: 1 IP address (1 host up) scanned in 0.52 seconds

Thank you.


text:
Q: Prove the set equation How to prove that if $A\backslash B=A$ and $B\subset A$ then $B=\varnothing$.
Can we prove that using some sets relations?

A: If B has an element say $x$, then since $B\subset A$, $x$ must be in $A$ also. Thus, $x$ is contained in both $A$ and $B$ so that $x\notin A\setminus B$. This contradicts the fact that $A\setminus B=A$. So there can not be an element in $B$. That is, $B=\emptyset$.

A: Suppose $B$ is not the null set, then there exists at least one point $b\in B$. Also remember that the whole set is given by $A\cup A^c$. Now try and apply the two relations you have.

A: If $B \neq \varnothing$ then $A \neq \varnothing$, and $(A\setminus B)\subset A\Rightarrow A = (A\setminus B)\cup B\subset A\cup B=A\Rightarrow A\setminus A \neq \varnothing$, contradiction. So $B = \varnothing$.

A: Here's my approach:
$$C\backslash B = A \implies \forall x \in B, x\notin A$$
$$B \subset A \implies \forall x \in B, x\in A$$
I changed A to C in the first condition for purpose of generality. It still holds.


text:
Q: How to make a button flash using .after in Tkinter? I'm a beginner and am making a simple Simon game using Tkinter and Python. I have the logic figured out, however, I'm really struggling getting buttons to flash to show the player the sequence. What I'm doing here is having it loop through the button sequence, as it loops through, it will flash the correct buttons accordingly. However, no matter what I do I cannot get the button to flash white, that is, it seemingly skips the configure method that changes the bg to white, and only does the configure that changes the bg to red/blue/green/yellow.
I tested this in a simple program that is supposed to flash a label after I press a button, but same story. It just won't do the first configure and only seems to do the second. So if I tell it to change the label to white, then wait 200 ms, then change it to blue, it will only change it to blue after 200 ms.
        for x in cpu_sequence:

            if x == "A":
                a_butt.after(200)
                a_butt.configure(bg="white")
                a_butt.after(200)
                a_butt.configure(bg="red")

            elif x == "B":
                b_butt.after(200)
                b_butt.configure(bg="white")
                b_butt.after(200)
                b_butt.configure(bg="green")

            elif x == "C":
                c_butt.after(200)
                c_butt.configure(bg="white")
                c_butt.after(200)
                c_butt.configure(bg="blue")

            elif x == "D":
                d_butt.after(200)
                d_butt.configure(bg="white")
                d_butt.after(200)
                d_butt.configure(bg="yellow")

It should wait 200 ms, change the button to white, then wait 200 ms, then change the button back to its original color (red, green, blue, or yellow).

A: after with a single argument is no different than calling time.sleep -- it causes the application to freeze. However, if you give after an argument other than just the number of milliseconds, it will call that argument as a function after the given delay.
If all you're wanting to do is change the background in 200ms, and then change it again 200ms after that (eg: 400ms after the function is called), you can schedule both of those commands at the same time. Tkinter will then call those functions at the appropriate time.
label.after(200, lambda: label.configure(background="white"))
label.after(400, lambda: label.configure(background="yellow"))

Note: lambda is used here because it's not possible to pass keyword arguments via after. lambda is a way to provide a nameless callable to after.  If we were calling a function that didn't need keyword arguments, lambda would be unnecessary.
For example:
def set_color(label, color):
    label.configure(background=color)

label.after(200, set_color, label, "white")
label.after(400, set_color, label, "yellow")

Here's a complete example:
import tkinter as tk
def flash():
    root.after(200, lambda: label.configure(background="white"))
    root.after(400, lambda: label.configure(background="yellow"))

root = tk.Tk()
label = tk.Label(root, text="Hello", background="yellow")
button = tk.Button(root, text="Flash!", command=flash)
label.pack(side="top", fill="x")
button.pack(side="bottom", padx=20, pady=20)

root.mainloop()


text:
Q: SSIS Create table which is destination in flow I have a database that is dropped and recreated completely. I want to schedule a SSIS package that:

*

*executes a SQL script that creates TableA

*than proceeds to the dataflow task that transfers data from source table to TableA.

Problem is that I get an error that says that TableA does not exist as destination. So the validation sees that in my dataflow task the destination does nog exist.
How can I set the routine, such that step 1 gets done before step 2 in one dtsx?
Please note that solutions such as truncation are not an option for me.

A: In the SSIS package, under the properties for the Data Flow Task, set Delay Validation property equal to True.
This will delay the validation of the step until run-time, after the table has been created by the previous Execute SQL Task.
Careful that some errors may be suppressed when using this property.


text:
Q: RazorPage binding not working as expected I have the following HTML:

And in the bound model:
public class NavigationModel : PageModel
{
    public void OnGet()
    {
        CurrentLocation = new Location()
        {
            Description = "test"
        };
    }

    [BindProperty]
    public Location CurrentLocation { get; set; }
}

So, to my understanding of RazorPages, the site should display "test"; but instead, it displays "Description".  I've looked at several examples where this sort of thing works fine, and I can't see why my version might be different.  Can anyone point me in the right direction?

A: According to the documentation, what you observe is the correct value: Description.

The asp-for attribute is made available by the For property in the LabelTagHelper. See Authoring Tag Helpers for more information.

Labels, in Razor parlance, have never displayed the value of a property, but rather the name if it.
To display the value use something like

 @model.CurrentLocation.Description

A: The label tag will just display the name of the property you use.
If you want to display an input with the contents of the Description property then you will have to type the followign code:
<input asp-for="CurrentLocation.Description" type="hidden" />

if you want to display the value of the property as a label then you will have to type the following:
@CurrentLocation.Description


text:
Q: grub2 loopback booting ubuntu alternate iso I am trying to set up a multi-boot USB stick including both standard desktop and alternate ISOs. I have both kinds of ISOs booting, using examples from a variety of places including https://help.ubuntu.com/community/Grub2/ISOBoot, and the standard install is working fine. The alternate install is not, however.
It boots, runs through the language and keyboard configuration questions, pops up a brief "Detecting hardware" dialog, and then reports:
Detect and mount CD-ROM

Your installation CD-ROM couldn't be mounted. This probably means
that the CD-ROM was not in the drive. If so you can insert it and try again.

Retry mounting the CD-ROM?

Where can I go from here?
My grub2 menu entry reads:
menuentry "Ubuntu 12.04.1 Alternate i386" {
  iso="/boot/ubuntu-12.04.1-alternate-i386.iso"
  loopback loop $iso
  linux (loop)/install/vmlinuz boot=casper persistent iso-scan/filename=$iso noeject noprompt --
  initrd (loop)/install/initrd.gz
}

A: Burce!
I haven't tried this option of grub2 recently enough,so perhaps things have changed now that I have grub2-2.0-0.39 (I run Fedora, but don't mind that)...
However, I gave it a try and (avoiding now numerous interesting issues encountered) must report, that although you will succeed in booting the kernel and initrd from your ISO, there may be no way provided in that initrd&kernel to be aware of being booted from a loopback device. Nor may it be possible to pass on to that kernel a loopback root device as an argument. Actually, I have no idea what happens to that device once kernel + initrd are loaded and booted -- that would be VERY interesting to know.
I remember having succeeded, though, in booting a kfreebsd install DVD using that feature. But at some point it hanged because of not being able to "find the installation media". So I had to go to the console, manually use losetup to loopback-mount the ISO and link it to /dev/dvd or something, for the install scripts to notice it, then go back to the installation "wizard" and tell him where the media was...
And even this completely manual boot from the ISO was not always possible for the reasons mentioned above.
This is my view on the problem, but it may be incomplete and grub2 itself may have evolved. So would be interesting to hear more comments on this. Or perhaps, give it a try again when I have time for't.
Kostya Berger


text:
Q: How to hide keyboard once UITextView becomes the first responder in iPhone SDK? In my iPhone App when I click on UITextView keyboard becomes visible
I try to use resignFirstResponder on "textDidEndOnExit" event but the keyboard does not hide.
What should be done to hide the keyboard?
please Help and Suggest,
Thanks.

A: Here another thread about this topic:
how to hide the keyboard when empty area is touched on iphone
i think this can help you.

A: I would suggest you to keep a toolbar and inside a button called "Dismiss" just above the keyboard. resign your responder and hide the toolbar when dismiss button is clicked. In the textView textViewShouldBeginEditing show the toolbar. Default hide the toolbar.

A: If you want your UITextView to not allow carriage returns, and close when the user presses the return key (or Done if you have changed the return key type) then implement the UITextViewDelegate protocol and use something like:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
  if ([text isEqualToString:@"\n"]) {
      [textView resignFirstResponder];
      return NO;
  }
  return YES;
}

A:    oneway, you can also hide keyboard when touch in view screen

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      UITouch * touch = [touches anyObject];
      if(touch.phase == UITouchPhaseBegan) {
      [txtDetail resignFirstResponder];
     }
  }

A: Make a UIButton or UiBarButton and assign it a method in which write [textView resignFirstResponder];

A:  - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{

    return NO;
}

return No; wont allow your keyboard to appear.Hope it helps.You will not require any toolbar or something.Give it a try...


text:
Q: How can I return a value from a Sub-Class JFrame to the Parent JFrame? Im trying to just Use 2 JFrames to return a username value back to its calling method on the parent class. Im puzzled. It works without using the gui and I understand it that way but this. Theres seems to be something simple im missing. I only posted the main parts of the program thats relevant by the way the second class at the bottom is a seperate class on a another tab. Im using it as another window.
   public class LoginWn extends JFrame implements ActionListener {

   JButton loginBtn = new JButton( );

   JTextField usrNmFld = new JTextField( );
   JPasswordField pswdFld = new JPasswordField( );

   public static  String cnfrmdUsrNm;

  public LoginWn( )
    { //Frame header
            setBounds(100, 100, 727, 482);
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Set Listener for Window
            addWindowListener(new WindowAdapter( ) {
                public void windowClosing(WindowEvent e) {
                    exitForm(e);
                }
            });

    newUsrBtn.setIcon(new ImageIcon("C:\\Users\\Etienne Shelton\\Desktop\\Java IDE Files\\Glossy Blue JButton.png"));
             layeredPane.setLayer(newUsrBtn, 3);
             newUsrBtn.setBounds(550, 412, 89, 23);
             newUsrBtn.addActionListener(new ActionListener( ) {
                 public void actionPerformed(ActionEvent e) {
                     //Send To JPanel
                    newUsrBtnActionPerformed( );
               }
           });
            layeredPane.add(newUsrBtn);

   public void loginBtnActionPerformed(ActionEvent e) throws IOException {

       getUsrData( );
   }

   public void getUsrData( )  {

      cnfrmdUsrNm = NewUsrWn.getUsrData( );
   }

        public NewUsrWn extends LoginWn( ) { //Inherited Class On Seperate ab

    JLayeredPane layeredPane = new JLayeredPane( );
    JFrame frame = new JFrame( );
    frame.setVisible(true);
    frame.setBounds(100, 100, 512, 499);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      layeredPane.setLayer(setBtn, 3);
    setBtn.setBounds(193, 222, 89, 23);
    setBtn.addActionListener(new ActionListener( ) {
        public void actionPerformed(ActionEvent e) {
            setBtnActionPerformed(e);
        }
    });
    layeredPane.add(setBtn);

    layeredPane.setLayer(pswdTxtFld, 3);
    pswdTxtFld.setColumns(10);
    pswdTxtFld.setBounds(152, 188, 184, 23);
    layeredPane.add(pswdTxtFld);

    layeredPane.setLayer(bckBtn, 3);
    bckBtn.setBounds(193, 256, 89, 23);
    layeredPane.add(bckBtn);

frame.getContentPane().setLayout(groupLayout);
   }

    public void setBtnActionPerformed(ActionEvent e) {
    getUsrData();
    }

    //Set UserName and Password
     public static String getUsrData( ) {
     String entrdUsrNm;

     // String entrdPswd;
     //Get Username from user & InhX from NewUsrWn Class
    entrdUsrNm = usrTxtFld.getText( );
    //entrdPswd = pswdTxtFld.getText( );
    //Confirm entered passwords as final Passwords
    cnfrmdUsrNm = entrdUsrNm;
    //cnfrmdPswd = entrdPswd;
    return (cnfrmdUsrNm);
     }


text:
Q: REGEXP_SUBSTR where in condition I have this data in a table
procedure1/loc1/p1
proc2/loc1/p2/c1
proc1/loc2/p2/c2
procedure3/loc1/p1
procedure4/loc3/p1

I want a query to select specific proc, like proc1 and procedure4 , like wouldnt work so
the ouptput should be like this
proc1/loc2/p2/c2
procedure4/loc3/p1

I tried to use REGEXP_SUBSTR, but how include the list of the procedure that i want ?
--this is wrong
select *  from tab1 where  REGEXP_SUBSTR(col1,
'[^/]+', 1, 1) in ('proc1','procedure4')

A: you could check, if the length returned by REGEXP_SUBSTR is greater than 0
select *
from (select 'procedure1/loc1/p1' a from dual union
      select 'proc2/loc1/p2/c1' from dual union
      select 'proc1/loc2/p2/c2' from dual union
      select 'procedure3/loc1/p1' from dual union
      select 'procedure4/loc3/p1' from dual) t
where length(regexp_substr(t.a, 'procedure4|proc1')) > 0

alternativly you could use REGEXP_LIKE, which does simply return a boolean and in my oppinion would fit better here.
select *
from (select 'procedure1/loc1/p1' a from dual union
      select 'proc2/loc1/p2/c1' from dual union
      select 'proc1/loc2/p2/c2' from dual union
      select 'procedure3/loc1/p1' from dual union
      select 'procedure4/loc3/p1' from dual) t
where regexp_like(t.a, 'procedure4|proc1')

O/P
proc1/loc2/p2/c2
procedure4/loc3/p1

if you would want to get the values from a table you could generate the regex dynamicly with the listagg function provided by oracle. What happens now is, that each possible value, that could occure is getting concatinated with an |, which does represent an or in regex. Due to this you  you're not in need for an in, because your regex will have each possible value seperated by an or
select *
from (select 'procedure1/loc1/p1' a from dual union
      select 'proc2/loc1/p2/c1' from dual union
      select 'proc1/loc2/p2/c2' from dual union
      select 'procedure3/loc1/p1' from dual union
      select 'procedure4/loc3/p1' from dual) t
where regexp_like(t.a, (select listagg(regexp.b, '|') WITHIN GROUP (ORDER BY regexp.b) regex
                        from   (select 'procedure4' b from dual union
                                select 'proc1'        from dual) regexp))

O/P of the subquery used for the regex would be proc1|procedure4, which would be the regexp needed as seen in the previous example

A: You don't need to use regular expressions to do that. You just could use ordinary SUBSTR and INSTR to get the substring from the beginning to the first /:
WITH your_table AS (
  SELECT 'procedure1/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'proc2/loc1/p2/c1' procedure_name FROM dual
  UNION
  SELECT 'proc1/loc2/p2/c2' procedure_name FROM dual
  UNION
  SELECT 'procedure3/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'procedure4/loc3/p1' procedure_name FROM dual
)
SELECT *
FROM your_table
WHERE SUBSTR(procedure_name,1,INSTR(procedure_name,'/')-1) IN ('proc1','procedure4');

However, if you want to learn to use regular expressions in Oracle. You could use REGEXP_SUBSTR like this:
WITH your_table AS (
  SELECT 'procedure1/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'proc2/loc1/p2/c1' procedure_name FROM dual
  UNION
  SELECT 'proc1/loc2/p2/c2' procedure_name FROM dual
  UNION
  SELECT 'procedure3/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'procedure4/loc3/p1' procedure_name FROM dual
)
SELECT *
FROM your_table
WHERE REGEXP_SUBSTR(procedure_name,'^(.+?)/',1,1,'i',1) IN ('proc1','procedure4');

The last parameter tells Oracle to return the match for the pattern between ().
As already mentioned, you also could use REGEXP_LIKE:
WITH your_table AS (
  SELECT 'procedure1/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'proc2/loc1/p2/c1' procedure_name FROM dual
  UNION
  SELECT 'proc1/loc2/p2/c2' procedure_name FROM dual
  UNION
  SELECT 'procedure3/loc1/p1' procedure_name FROM dual
  UNION
  SELECT 'procedure4/loc3/p1' procedure_name FROM dual
)
SELECT *
FROM your_table
WHERE REGEXP_LIKE(procedure_name,'^(proc1|procedure4)/');

A: If the procedures you are interesetd in are in a different table, one way could be the following:
Setup:
CREATE TABLE your_table (col) AS
    (SELECT 'procedure1/loc1/p1' FROM DUAL UNION ALL
     SELECT 'proc2/loc1/p2/c1'   FROM DUAL UNION ALL
     SELECT 'proc1/loc2/p2/c2'   FROM DUAL UNION ALL
     SELECT 'procedure3/loc1/p1' FROM DUAL UNION ALL
     SELECT 'procedure4/loc3/p1' FROM DUAL
    )

CREATE TABLE procedures (name) AS
    (SELECT 'proc1'      FROM DUAL UNION ALL
     SELECT 'procedure4' FROM DUAL
    )

You can try this, with no need for regular expressions:
SELECT *
  FROM your_table
    INNER JOIN procedures
      ON (INSTR(col, name) != 0)


text:
Q: How can I render CSS colors with bold, underline, italic in SSRS? I'm trying to render HTML from a database field into a report using SSRS.
But CSS colors will not work if they are bolded, italicized, or underlined.
For example, for the below code snippet: The first 3 paragraphs ('red', 'blue', 'green') all have the correct color. But the next three with underline, strong, and em tags do not render color.
The last 3 paragraphs are without color and demonstrate that colors and bold,underline,italic work separately but NOT together.
Here is the HTML:

red

blue

green

red underline

blue bold

green italic

underline

bold

italic

And here is what is rendered on the report.

This HTML is all generated from the Quill rich text editor. https://quilljs.com/ From which I'm already having enough problems because I have to convert css colors from rgb to hex.
I'm using Microsoft SQL Server Reporting Services Version 13.0.5103.6.
Any help at all would be much appreciated.
Thank you!

A: If you move the style to the paragraph tag, it will work.
="
red
" &
"
blue
" &
"
green
" &
"

red underline
" &
"
blue bold
" &
"
green italic

" &
"
underline
" &
"
bold
" &
"
italic
"

It also works if you keep the color in a separate span tag:

red underline

Not sure if that's an SSRS quirk or an HTML standard that's a little loose.


text:
Q: Monitoring File Changes Call CreateObject("WScript.Shell").Run(some.exe,0,False)

I'm using that line to call a .exe that returns some text, but can also write it to a file.
I would use .Exec instead of .Run to get the results directly but then the script hangs.
I really don't want a timer checking if the output file is created or modified.
What I need is a way to catch an event somehow. Any Ideas?

A: Since you mention that it might either return it or write it to a file, does that mean that after the process has written to the file it'll exit?
If so, you could just call the Shell.Run method with the bWaitOnReturn parameter set to True and your script would wait for the process to finish before it continued.
Otherwise, if the process might write a file and then still continue to run, then I think you will have to poll to check if it exists, or possibly you could create a C# or VB.Net exe that uses FileSystemWatcher (or a normal Win32 exe that uses the API FindFirstChangeNotification) to look for the creation of the file and when it finds one it immediately exists and then you could run that process with bWaitOnReturn set to True, but that's probably just overcomplicating things.


text:
Q: Single CSS selector to match N elements when there are N elements This is similar to this question CSS select first child only if two children but more generic. I have specific task to select both children if there are 2 children.
I came up with this:
li:nth-child(1):nth-last-child(2), li:nth-child(2):nth-last-child(1)

it works, but I was wondering if it's possible to make it with single selector. If so, can this be generalized with pattern and make it work with any number of elements like 3 children if there are only 3 elements or all 4 children if there are only 4 children.
This is useful if you have delete button but you need minimal of N items and want to hide the button when there are min number of items.

A: I think the best you could do is:

.box > *:nth-last-child(3):first-child,
.box > *:nth-last-child(3):first-child ~ * {
  color: red;
}

/*
.box > *:nth-last-child(N):first-child,
.box > *:nth-last-child(N):first-child ~ * {
  color: red;
}
*/

  text

  text
  text

  text
  text
  text

  text
  text
  text
  text