text:
Q: Continuous Integration build over TFS2017 I would like to know what is the equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions.
1- Is it "Run continuous integration triggers for commited changes" in Gated trigger?
2-Or it is a "Continuous Integration trigger with batch changes checked" in build definition.
I ask this question because I was not able to launch a CI build after successfully Gated Check-in. My CI build does different steps than Gated.
I'm over TFS 2017 (15.117.27414.0).

A: The equivalent of "Continuous Integration - build each check-in" (XAML definition) in VNext definitions is Continuous Integration trigger:

Enable CI trigger if you want the build to run whenever someone checks
  in code.
Select Batch changes check box if you have a lot of team members
  uploading changes often and you want to reduce the number of builds
  you are running. If you select this option, when a build is running,
  the system waits until the build is completed and then queues another
  build of all changes that have not yet been built.
Select the version control paths you want to include and exclude. In
  most cases, you should make sure that these filters are consistent
  with your TFVC mappings on the Repository tab.

You can get more details in the link below:
https://learn.microsoft.com/en-us/vsts/build-release/concepts/definitions/build/triggers?view=vsts


text:
Q: How to filter a JSON in nodejs I have the following JSON stored in a variable named data. How can i filter it excluding the "0" values?
{
  "BTC": "0",
  "XCP": "0",
  "LTC": "0",
  "NXT": "0",
  "XPM": "0",
  "NMC": "0",
  "MMC": "0",
  "NOBL": "0",
  "USDE": "0",
  "SOC": "0",
  "KDC": "0",
  "DOGE": "0.00000001",
  "GLB": "0",
  "Q2C": "0",
  "FOX": "0",
  "MRC": "0",
  "MTS": "0"
}

I tried:
   var datos = data.filter(function(data){
    return !!data;
    });
    res.send(data);

but it's telling me

Object # has no method 'filter'

Regards,

A: Objects dont have a filter method, you need to convert your object to an array if you want to use the array filter method.
But to answer the question,
var newData = {};

for(i in data){
    if(data.hasOwnProperty(i) && data[i] != "0"){
       newData[i] = data[i];
    }
}

A: var dataObj = {
  "BTC": "0",
  "XCP": "0",
  "LTC": "0",
  "NXT": "0",
  "XPM": "0",
  "NMC": "0",
  "MMC": "0",
  "NOBL": "0",
  "USDE": "0",
  "SOC": "0",
  "KDC": "0",
  "DOGE": "0.00000001",
  "GLB": "0",
  "Q2C": "0",
  "FOX": "0",
  "MRC": "0",
  "MTS": "0"
}

var keys = Object.keys(dataObj);
keys.forEach(function(key){ if(dataObj[key] === "0") delete dataObj[key];})

console.log(dataObj);

redpajama_set_name: RedPajamaStackExchange


text:
Q: ARC seems to be releasing the view of my NSViewController I am trying to solve a larger problem and I am tipping on the fact that ARC apparently is releasing the view to my NSViewController too early. I think :) So I created a simple app to reconstruct the situation.
I have a simple ARC Cocoa application. In the Window of the MainMenu.xib I hook up a Custom View to a @property (strong) IBOutlet NSView *theView; which is declared in the AppDelegate.h
In the AppDelegate.m I synthesize the property and then call the following:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    TestViewController *tvc =  [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
    [_theView addSubview:[tvc view]];
}

The TestViewControllergets displayed in the Custom View - no problem. It contains one NSButton. It is hooked up to a method called -(IBAction)btnPressed:(id)sender and one NSTextView which is also hooked up as an IBOutlet.
In the TestViewController.h I declare:
@property (nonatomic, strong) IBOutlet NSTextField *textField;
@property (nonatomic, strong) NSString *theString;

-(IBAction)btnPressed:(id)sender;

In the TestViewController.m I then do
@synthesize theString = _theString;
@synthesize textField = _textField;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Initialization code here.
        _theString = @"Hello World";
    }

    return self;
}

-(IBAction)btnPressed:(id)sender
{
    [_textField setStringValue:_theString];
}

When I run the app and press the button it crashes. If I check it for zombies I receive the following:
#   Address Category    Event Type  RefCt   Timestamp   Size    Responsible Library Responsible Caller
0   0x7f97a3047560  TestViewController  Malloc  1   00:00.652.631   128 TestARC -[AppDelegate applicationDidFinishLaunching:]
1   0x7f97a3047560  TestViewController  Retain  2   00:00.653.088   0   TestARC -[TestViewController initWithNibName:bundle:]
2   0x7f97a3047560  TestViewController  Release 1   00:00.653.089   0   TestARC -[TestViewController initWithNibName:bundle:]
3   0x7f97a3047560  TestViewController  Retain  2   00:00.653.912   0   AppKit  -[NSNib instantiateNibWithOwner:topLevelObjects:]
4   0x7f97a3047560  TestViewController  Release 1   00:00.658.831   0   AppKit  -[NSNib instantiateNibWithOwner:topLevelObjects:]
5   0x7f97a3047560  TestViewController  Release 0   00:00.662.377   0   Foundation  -[NSNotificationCenter postNotificationName:object:userInfo:]
6   0x7f97a3047560  TestViewController  Zombie  -1  00:01.951.377   0   AppKit  -[NSApplication sendAction:to:from:]

What am I doing wrong?
Thanks

A: Add a property to hold the view controller.  Your controller currently has nothing to keep it alive past the end of the method that allocates it.
Add:
@property (strong) TestViewController *tvc;

Modify:
self.tvc =  [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];

(I'm curious...what do you see as the point of creating a view controller if all you want is the view it contains?)

Concerning the general approach, it seems that this is more properly behavior that should be implemented using a container view controller.  That mechanism allows multiple view controllers to share the screen in an organized way.

A: You need to add an ivar or property to hold the TextViewController.  Currently, the only reference to it is going away at the end of applicationDidFinishLaunching: which causes it to be deallocated.
That's bad, because your button needs the controller to be around to handle the button press. The view doesn't hold on to it's controller, as that would cause a retain cycle. So you are responsible for keeping the controller around if you don't want your button talking to a deallocated object.


text:
Q: Agregar nueva fila y autosumar +1 Tengo el siguiente codigo donde agrego una una fila  a una tabla. Tengo un indicador que es un numero.
Quiero poder al momento de agregar una nueva fila este indicador incremente en uno.
Ejemplo si el indicador es 10, y agrego una fila este debe llevar el num 11 y en caso que agregue otro este también debería sumar uno 12.
Mi idea es crear una funcion donde me sume la ultima fila de la tabla y me agrege +1 al valor de ese indicador.

var i = 1;
$('.add').click(function() {
    i++;

    $('#tbl_cotizacion').find('tbody').append('
	 	  	 <button type="button" name="remove" id="' + i + '" class="btn btn-primary btn-sm btn_remove">x</button>
');
});
$(document).on('click', '.btn_remove', function() {
    var button_id = $(this).attr("id");
    $('#row' + button_id + '').remove();
});
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">

                  # Indicador
                  Cantidad
                  Componente

                10
                4
                Falso
                   <button type='button'  class='btn btn-sm btn-slack waves-effect waves-light add'>    add </button>

A: Lo único que te falta es agregar ese flag o contador que estas utilizando en el cuerpo de la tabla que creas a través de JQuery

var i = 1;
$('.add').click(function() {
    i++;

    $('#tbl_cotizacion').find('tbody').append(`<tr id="row${i}"><td>${i}</td> <td></td>  <td></td> <td width="5%"><button type="button" name="remove" id="${i}" class="btn btn-primary btn-sm btn_remove">x</button></td></tr>`);
});
$(document).on('click', '.btn_remove', function() {
    var button_id = $(this).attr("id");
    $('#row' + button_id + '').remove();
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

                  # Indicador
                  Cantidad
                  Componente

                1
                4
                Falso
                   <button type='button'  class='btn btn-sm btn-slack waves-effect waves-light add'>    add </button>

Si te fijas el único cambio que hice fue agregar la variable i al cuerpo del 	.
Adicionalmente te recomiendo utilizar la interpolación que se incluyo desde la versión de JavaScript, ya que son mucho más limpias de utilizar que concatenar cadenas.
Nos comentas si es lo que necesitas :)


text:
Q: Getting list of selection listeners in JTable I want to get all of the list selection listeners that are registered with the selection model in my JTable, but I don't see a method to get them.  Is there a way I can retrieve them?

A: *

*use the getSelectionModel() method on a new JTable

*cast the result to the DefaultListSelectionModel

*use the getListSelectionListeners()
hope it helps!


text:
Q: how to allocate arrays in numba I am trying to create an array inside numba jit function. I tried these two options and both return various errors
@njit
def monte_carlo_ou(T: int, nsamples: int = 100, dt:float=0.1, sigma_g:float =1.0, ):

    particles = np.zeros(T, nsamples, dtype=float)
    velocity_particles = np.zeros(nsamples , dtype=float)

    return particles

monte_carlo_ou(100, 50, dt=0.1, sigma_g=1.0,)

TypingError: Cannot determine Numba type of <class 'numba.core.ir.UndefinedType'>
@njit
def monte_carlo_ou(T: int, nsamples: int = 100, dt:float=0.1, sigma_g:float =1.0, ):

    particles = numba.float32[:, :]
    velocity_particles = numba.float32[:]

    return particles

monte_carlo_ou(100, 50, dt=0.1, sigma_g=1.0,)

Error :
TypingError: No implementation of function Function(<built-in function getitem>) found for signature:

getitem(class(float32), UniTuple(slice<a:b> x 2))

There are 22 candidate implementations:
      - Of which 22 did not match due to:
      Overload of function 'getitem': File: <numerous>: Line N/A.
        With argument(s): '(class(float32), UniTuple(slice<a:b> x 2))':
       No match.

During: typing of intrinsic-call at /var/folders/43/m_k444pn2z7c6ygxj0y3_c4r0000gn/T/ipykernel_58943/4011707724.py (6)
During: typing of static-get-item at /var/folders/43/m_k444pn2z7c6ygxj0y3_c4r0000gn/T/ipykernel_58943/4011707724.py (6)

Any advise on how to get started? All tutorials seems to be very limited

A: The problem is your first in-function line: the shape in np.zeros should be one tuple argument, not multiple scalar arguments.
particles = np.zeros(shape=(T, nsamples), dtype=float) worked for me.
shape= is not necessary but is explicit about how you should provide the shape of the array.


text:
Q: Parsing JSON with RestKit .20 Did some searching and was unable to find any suitable answers.  Thanks in advance for helping me solve my probably trivial problem.
Here is the Json in question:
   {
   "User":{
      "UserEvents":[

      ],
      "Vendor":null,
      "UserId":7,
      "CreatedDate":"1900-01-01T00:00:00",
      "UserName":"jasondboland@gmail.com",
      "LoginCount":0,
      "LastLogin":null,
      "CurrentEventId":6,
      "Company":null,
      "FirstName":"Wedding Pro",
      "LastName":"Boland",
      "Gender":"female",
      "Country":null,
      "FacebookLink":null,
      "FacebookData":null,
      "PaymentToken":"",
      "BillingAddress":null,
      "ShippingAddress":null,
      "ShipToPreference":1,
      "ReferralId":null,
      "BulkLicenseUpgrade":false,
      "DisplayName":"Wedding Pro Boland",
      "ImpersonateUser":null,
      "VendorInd":false,
      "AvailableLicenses":0
   },
   "Theme":{
      "ThemeId":2,
      "Name":"Tropical Beach 1",
      "ThumbnailImage":"~/images/themes/tropical_beach_registry_t.jpg",
      "LargeImage":"~/images/themes/tropical_beach_registry.jpg",
      "Type":1,
      "AccessLevel":1,
      "StyleName":"tropic-beach",
      "ActiveInd":true
   },
   "RegistryItems":[

   ],
   "Organizers":[
      {
         "OrganizerId":11,
         "CreatedDate":"2013-04-25T20:35:40.687",
         "Address":null,
         "OrganizerType":1,
         "FirstName":"Jason",
         "LastName":"Boland",
         "Email":"jasondboland@gmail.com",
         "Phone":"7143922631",
         "FacebookId":null,
         "PrimaryAccountInd":true,
         "VerifiedInd":true,
         "ActiveInd":true
      },
      {
         "OrganizerId":12,
         "CreatedDate":"2013-04-25T20:35:40.75",
         "Address":null,
         "OrganizerType":0,
         "FirstName":"Ezzy",
         "LastName":"Castillo",
         "Email":null,
         "Phone":null,
         "FacebookId":null,
         "PrimaryAccountInd":false,
         "VerifiedInd":false,
         "ActiveInd":true
      }
   ],
   "Attendees":[

   ],
   "Schedules":[
      {
         "ScheduleId":11,
         "CreatedDate":"2013-04-25T20:35:40.763",
         "ScheduleType":2,
         "Name":"Reception",
         "Description":"Sea Cliff Country Club",
         "DateStart":"2013-06-22T16:00:00",
         "DateEnd":null,
         "Address":null,
         "ShowOnline":false,
         "ActiveInd":true
      },
      {
         "ScheduleId":12,
         "CreatedDate":"2013-04-25T20:35:40.763",
         "ScheduleType":1,
         "Name":"Ceremony",
         "Description":"Sea Cliff Country Club",
         "DateStart":"2013-06-22T15:30:00",
         "DateEnd":null,
         "Address":null,
         "ShowOnline":false,
         "ActiveInd":true
      }
   ],
   "EventImages":[
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/aff69cb6-930b-4982-86e0-143d43a91da9_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/62b9c7e3-9ef8-41aa-b008-40847eb2eb18_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/b7281259-793d-4a7e-a2c7-466e2748a049_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/37cecb6b-0819-4a5e-aa21-475dfdad28c3_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/8f51398e-2cdf-47d2-a9bb-4fc32698ec18_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/a0e5f5c5-43f1-40db-b6cb-893bdf8d318e_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/17edaee6-8bdb-4988-847c-8977779c9000_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/0d460b63-9b65-4078-9660-a066c5390957_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/63536715-01ad-473f-b213-ba46f2f8a7d0_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/91f0675a-5df1-4c68-ae1f-e7db0c322e33_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      }
   ],
   "UserEventId":6,
   "CreatedDate":"2013-04-25T20:35:40.56",
   "EventType":0,
   "Name":"Jason Boland and Ezzy Castillo's Wedding",
   "Description":"We can't wait to start out our lives together with a once in a lifetime trip to the south pacific.",
   "Date":"2013-06-22T00:00:00",
   "PaymentType":1,
   "CurrencyType":1,
   "EventLevel":1,
   "RequestAddresses":true,
   "ReferralCode":null,
   "EventURL":"JasonAndEzzy",
   "PublishedInd":true,
   "PublishedDate":"2013-07-17T16:31:02.687",
   "GalleryPurchasedInd":true,
   "GalleryPurchasedDate":"2013-05-16T20:02:36.757",
   "RequirePasswordOnGallery":false,
   "EventPassword":"",
   "BudgetPurchasedInd":true,
   "BudgetPurchasedDate":"2013-05-16T20:02:36.757",
   "GuestlistPurchasedInd":true,
   "GuestlistPurchasedDate":"2013-05-16T20:02:36.757",
   "GuestListInfoRequestsSent":null,
   "GuestListInfoRequestsMessage":null,
   "SampleInd":false,
   "ActiveInd":true,
   "DaysUntilWedding":"-25.13:43:16.6650000",
   "PrimaryOrganizer":{
      "OrganizerId":11,
      "CreatedDate":"2013-04-25T20:35:40.687",
      "Address":null,
      "OrganizerType":1,
      "FirstName":"Jason",
      "LastName":"Boland",
      "Email":"jasondboland@gmail.com",
      "Phone":"7143922631",
      "FacebookId":null,
      "PrimaryAccountInd":true,
      "VerifiedInd":true,
      "ActiveInd":true
   },
   "CeremonySchedule":{
      "ScheduleId":12,
      "CreatedDate":"2013-04-25T20:35:40.763",
      "ScheduleType":1,
      "Name":"Ceremony",
      "Description":"Sea Cliff Country Club",
      "DateStart":"2013-06-22T15:30:00",
      "DateEnd":null,
      "Address":null,
      "ShowOnline":false,
      "ActiveInd":true
   },
   "ReceptionSchedule":{
      "ScheduleId":11,
      "CreatedDate":"2013-04-25T20:35:40.763",
      "ScheduleType":2,
      "Name":"Reception",
      "Description":"Sea Cliff Country Club",
      "DateStart":"2013-06-22T16:00:00",
      "DateEnd":null,
      "Address":null,
      "ShowOnline":false,
      "ActiveInd":true
   }
}

Object:
@interface RKImage : NSObject
@property (nonatomic, copy) NSString *LargeURL;
@property (nonatomic, copy) NSString *ImageID;
@end

Attempted Code:
RKObjectMapping* wMapping = [RKObjectMapping mappingForClass:[RKImage class]];
    [wMapping addAttributeMappingsFromDictionary:@{
     //@"ImageID": @"ImageID",
     @"LargeURL": @"LargeURL"
     }];

    RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:wMapping pathPattern:nil keyPath:@"EventImages" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    NSURL *URL = [NSURL URLWithString:@"http://myurl.cloudapp.net/api/mobilegallery/1"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    RKObjectRequestOperation *objectRequestOperation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[ responseDescriptor ]];
    [objectRequestOperation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
        RKLogInfo(@"Load collection of Articles: %@", mappingResult.array);
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {
        RKLogError(@"Operation failed with error: %@", error);
    }];

    [objectRequestOperation start];

I'm getting the error:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<RKImage 0xa25b240> valueForUndefinedKey:]: this class is not key value coding-compliant for the key LargeURL.'
Edit:  Error with logging enabled

2013-07-17 16:04:43.168 SimplyTieGallery[1002:c07] I
  restkit.network:RKObjectRequestOperation.m:174 GET
  'http://4451cfc5be9c49f4896a2dd6eeec96c9.cloudapp.net/api/mobilegallery/1'
  2013-07-17 16:04:44.927 SimplyTieGallery[1002:4103] D
  restkit.object_mapping:RKMapperOperation.m:390 Executing mapping
  operation for representation: {
      ActiveInd = 1;
      Attendees =     (
      );
      BudgetPurchasedDate = "";
      BudgetPurchasedInd = 0;
      CeremonySchedule =     {
          ActiveInd = 1;
          Address = "";
          CreatedDate = "2013-04-11T13:11:16.803";
          DateEnd = "2013-10-08T13:11:16";
          DateStart = "2013-10-08T13:11:16";
          Description = "Falkirk Estate and Country Club";
          Name = Ceremony;
          ScheduleId = 2;
          ScheduleType = 1;
          ShowOnline = 1;
      };
      CreatedDate = "2013-04-11T13:11:13.93";
      CurrencyType = 1;
      Date = "2013-10-08T00:00:00";
      DaysUntilWedding = "82.00:55:14.3863200";
      Description = "We will soon be Mr. and Ms. Jones and just can't wait! While everyone is recovering from the massive party (our
  wedding) we will be boarding a plane to Bora Bora to start our lives
  together in grand fashion!  We are lucky to be blessed with a fully
  stocked home so we have decided to use SimplyTie to help us create the
  most amazing honeymoon we could think of.  We can\U2019t thank
  everyone enough for all your love, support and generosity!  Thank you
  so much!  John and Judy Jones";
      EventImages =     (
                  {
              Container = "";
              ImageDesc = "";
              ImageID = "00000000-0000-0000-0000-000000000000";
              ImageName = "";
              ImageType = 0;
              LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l";
              MediumURL = "";
              RegistryItems = "";
              SortOrder = 0;
              ThumbURL = "";
              UserEvents = "";
          },
                  {
              Container = "";
              ImageDesc = "";
              ImageID = "00000000-0000-0000-0000-000000000000";
              ImageName = "";
              ImageType = 0;
              LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/cd22c262-8cbc-480b-b0ee-a4b33e248b70_l";
              MediumURL = "";
              RegistryItems = "";
              SortOrder = 0;
              ThumbURL = "";
              UserEvents = "";
          }
      );
      EventLevel = 1;
      EventPassword = "";
      EventType = 0;
      EventURL = BoraBoraSample;
      GalleryPurchasedDate = "2013-04-26T00:11:45.427";
      GalleryPurchasedInd = 1;
      GuestListInfoRequestsMessage = "";
      GuestListInfoRequestsSent = "";
      GuestlistPurchasedDate = "";
      GuestlistPurchasedInd = 0;
      Name = "John and Judy's Wedding";
      Organizers =     (
                  {
              ActiveInd = 1;
              Address = "";
              CreatedDate = "2013-04-11T13:11:16.32";
              Email = "JudyMcGride@SimplyTie.com";
              FacebookId = "";
              FirstName = Judy;
              LastName = McBride;
              OrganizerId = 1;
              OrganizerType = 0;
              Phone = "";
              PrimaryAccountInd = 1;
              VerifiedInd = 1;
          },
                  {
              ActiveInd = 1;
              Address = "";
              CreatedDate = "2013-04-11T13:11:16.323";
              Email = "JohnJones@SimplyTie.com";
              FacebookId = "";
              FirstName = John;
              LastName = Jones;
              OrganizerId = 2;
              OrganizerType = 1;
              Phone = "";
              PrimaryAccountInd = 0;
              VerifiedInd = 1;
          }
      );
      PaymentType = 1;
      PrimaryOrganizer =     {
          ActiveInd = 1;
          Address = "";
          CreatedDate = "2013-04-11T13:11:16.32";
          Email = "JudyMcGride@SimplyTie.com";
          FacebookId = "";
          FirstName = Judy;
          LastName = McBride;
          OrganizerId = 1;
          OrganizerType = 0;
          Phone = "";
          PrimaryAccountInd = 1;
          VerifiedInd = 1;
      };
      PublishedDate = "2013-04-11T13:11:13.93";
      PublishedInd = 1;
      ReceptionSchedule =     {
          ActiveInd = 1;
          Address = "";
          CreatedDate = "2013-04-11T13:11:16.803";
          DateEnd = "2013-10-08T13:11:16";
          DateStart = "2013-10-08T13:11:16";
          Description = "Falkirk Estate and Country Club";
          Name = Reception;
          ScheduleId = 1;
          ScheduleType = 2;
          ShowOnline = 1;
      };
      ReferralCode = "";
      RegistryItems =     (
      );
      RequestAddresses = 1;
      RequirePasswordOnGallery = 0;
      SampleInd = 1;
      Schedules =     (
                  {
              ActiveInd = 1;
              Address = "";
              CreatedDate = "2013-04-11T13:11:16.803";
              DateEnd = "2013-10-08T13:11:16";
              DateStart = "2013-10-08T13:11:16";
              Description = "Falkirk Estate and Country Club";
              Name = Reception;
              ScheduleId = 1;
              ScheduleType = 2;
              ShowOnline = 1;
          },
                  {
              ActiveInd = 1;
              Address = "";
              CreatedDate = "2013-04-11T13:11:16.803";
              DateEnd = "2013-10-08T13:11:16";
              DateStart = "2013-10-08T13:11:16";
              Description = "Falkirk Estate and Country Club";
              Name = Ceremony;
              ScheduleId = 2;
              ScheduleType = 1;
              ShowOnline = 1;
          }
      );
      Theme =     {
          AccessLevel = 1;
          ActiveInd = 1;
          LargeImage = "~/images/themes/tropical_beach_registry.jpg";
          Name = "Tropical Beach 1";
          StyleName = "tropic-beach";
          ThemeId = 2;
          ThumbnailImage = "~/images/themes/tropical_beach_registry_t.jpg";
          Type = 1;
      };
      User =     {
          AvailableLicenses = 0;
          BillingAddress = "";
          BulkLicenseUpgrade = 0;
          Company = "";
          Country = "";
          CreatedDate = "1900-01-01T00:00:00";
          CurrentEventId = 1;
          DisplayName = "John Sample";
          FacebookData = "";
          FacebookLink = "";
          FirstName = John;
          Gender = Male;
          ImpersonateUser = "";
          LastLogin = "";
          LastName = Sample;
          LoginCount = 0;
          PaymentToken = "";
          ReferralId = "";
          ShipToPreference = 2;
          ShippingAddress = "";
          UserEvents =         (
          );
          UserId = 1;
          UserName = "boraborasample@simplytie.com";
          Vendor = "";
          VendorInd = 0;
      };
      UserEventId = 1; }  and targetObject: (null) 2013-07-17 16:04:44.930 SimplyTieGallery[1002:4103] T
  restkit.object_mapping:RKMapperOperation.m:333 Examining keyPath
  'EventImages' for mappable content... 2013-07-17 16:04:44.930
  SimplyTieGallery[1002:4103] D
  restkit.object_mapping:RKMapperOperation.m:310 Found mappable
  collection at keyPath 'EventImages': (
          {
          Container = "";
          ImageDesc = "";
          ImageID = "00000000-0000-0000-0000-000000000000";
          ImageName = "";
          ImageType = 0;
          LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l";
          MediumURL = "";
          RegistryItems = "";
          SortOrder = 0;
          ThumbURL = "";
          UserEvents = "";
      },
          {
          Container = "";
          ImageDesc = "";
          ImageID = "00000000-0000-0000-0000-000000000000";
          ImageName = "";
          ImageType = 0;
          LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/cd22c262-8cbc-480b-b0ee-a4b33e248b70_l";
          MediumURL = "";
          RegistryItems = "";
          SortOrder = 0;
          ThumbURL = "";
          UserEvents = "";
      } ) 2013-07-17 16:04:44.931 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation.m:244 Asked to map source
  object {
      Container = "";
      ImageDesc = "";
      ImageID = "00000000-0000-0000-0000-000000000000";
      ImageName = "";
      ImageType = 0;
      LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l";
      MediumURL = "";
      RegistryItems = "";
      SortOrder = 0;
      ThumbURL = "";
      UserEvents = ""; } with mapping  LargeURL>" )> 2013-07-17 16:04:44.931 SimplyTieGallery[1002:4103] D
  restkit.object_mapping:RKMappingOperation.m:912 Starting mapping
  operation... 2013-07-17 16:04:44.932 SimplyTieGallery[1002:4103] T
  restkit.object_mapping:RKMappingOperation.m:913 Performing mapping
  operation:  for 'RKImage' object.
  Mapping values from object {
      Container = "";
      ImageDesc = "";
      ImageID = "00000000-0000-0000-0000-000000000000";
      ImageName = "";
      ImageType = 0;
      LargeURL = "https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l";
      MediumURL = "";
      RegistryItems = "";
      SortOrder = 0;
      ThumbURL = "";
      UserEvents = ""; } to object  with object mapping (null) 2013-07-17 16:04:44.932
  SimplyTieGallery[1002:4103] T
  restkit.object_mapping:RKMappingOperation.m:515 Mapping attribute
  value keyPath 'LargeURL' to 'LargeURL' 2013-07-17 16:04:44.933
  SimplyTieGallery[1002:1703] D
  restkit.object_mapping:RKPropertyInspector.m:126 Cached property
  inspection for Class 'RKImage': {
      ImageID =     {
          isPrimitive = 0;
          keyValueCodingClass = NSString;
          name = ImageID;
      };
      LargeURL =     {
          isPrimitive = 0;
          keyValueCodingClass = NSString;
          name = LargeURL;
      }; } 2013-07-17 16:04:44.933 SimplyTieGallery[1002:4103] * Terminating app due to uncaught exception 'NSUnknownKeyException',
  reason: '[ valueForUndefinedKey:]: this class is
  not key value coding-compliant for the key LargeURL.'
  * First throw call stack: (0x1e68012 0x1c8de7e 0x1ef0fb1 0x1962d1d 0x18cf00b 0x18cefbd 0x18ed247 0xa3561 0xa4a92 0xa5e39 0xad45d
  0x18ef453 0x18ef164 0x9bb79 0x9b018 0x1e61e7c 0x1e61a16 0x1e61925
  0x9accb 0x9cbff 0x9d657 0x9e021 0x18ef453 0x18ef164 0x8c850 0x8a955
  0x18ef453 0x18ef164 0x197ba31 0x254b53f 0x255d014 0x254e2e8 0x254e450
  0x91453e72 0x9143bd2a) libc++abi.dylib: terminate called throwing an
  exception (lldb)

Tried messing with keyPaths and I'm just getting nowhere fast.  Thanks!


text:
Q: Track IR Led using EMGU CV? I have been trying to make head mounted (Infrared)IR Led light tracker using EMGU CV? I know head tracking using EMGU CV. But head mounted IR Led light tracker gives more accuracy. I want make some thing like Head tracking with webcam or FreeTrack. Any guidelines will be appreciated>

A: If you want to have a quite solid and accurate head tracking using IR LED you should
put an IR filter on your camera sensor (if it's not already shipped with it) and then use IR threshold... once you have found a binary thresholded mask emgucv blob detection will be quite easy.
You can see an example of the suggested approach applied to a low cost PS3-Eye camera
here:
http://codelaboratories.com/forums/viewthread/444/

A: Assuming the answer to my comment is 'Yes, an IR LED on someone's head is tracked by a camera. I think you will find this to be a pretty easy task since the IR LED is likely the brightest object in the scene by far. You can simply use threshold and blob analysis. I think this link is a good starting place for you. http://www.emgu.com/forum/viewtopic.php?f=3&t=205

A: I go with the above two answers and recommend using a IR filter.
I guess the question included 3D stuff.
Use two LED's. Track using the above two methods. If the distance between those two led's is greater then the led's are closer to the camera else further. You can even take in account of rotation like that.
Hope this helps.


text:
Q: Oracle + JPA - querying with INTERVAL I have a Timestamp column in my DB table, LASTUPDATED, which I poll to decide if a row should be updated or not. If the record was not updated in the last 10 minutes, I update it. I want to delegate the date handling to the DB, but none of the following works:
This one says "enexpected token: : near[...]"
    Query query = entityManager.createQuery("SELECT x FROM MyEntity x WHERE x.lastUpdated < SYSTIMESTAMP - INTERVAL :olderThen MINUTE");
    query.setParameter("olderThen", 10);
    list = query.getResultList();

This one says "unexpected token: '10' near[...]
    Query query = entityManager.createQuery("SELECT x FROM MyEntity x WHERE x.lastUpdated < SYSTIMESTAMP - INTERVAL '10' MINUTE");
    list = query.getResultList();

And this one says unexpected token: '?' near[...]
    Query query = entityManager.createQuery("SELECT x FROM MyEntity x WHERE x.lastUpdated < SYSTIMESTAMP - INTERVAL ?1 MINUTE");
    query.setParameter(1, 10);
    list = query.getResultList();

Can I use this INTERVAL keyword with JPA by the way? The expression is correct syntactically, I tested it with console.
Thanks for the help Guys,
Gergely

A: JPA and Hibernate does not sopport interval, finally I found it...
Date arithmetic is also supported, albeit in a more limited fashion. This is due partially to differences in database support and partially to the lack of support for INTERVAL definition in the query language itself.
Source: http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html
Only the BETWEEN keyword can be used.
Take care
Btw the correct expression was:
     select x from MyEntity x where cast((systimestamp - (1/24/60) * 10) as timestamp) between lastUpdated and systimestamp

A: This worked for me:
'10 minutes'::interval


text:
Q: Shuffle an array of strings randomly I am writing a program that reads a text file as an input and randomly shuffles the array of strings for the user.
I have written a program that shuffles the string array randomly but I want to do it in a way that no two elements that are the same are beside each other.
Here's an example:
The original array would look like this
{1,2,3,4,5,1,2}

The shuffled array would look like this
{5,3,1,2,4,2,1}

But currently my program creates an output array of this
{5,1,1,3,2,4,2}

Here is my code that shuffles the elements randomly:
int i;
char s[11][100];
char line[100], t[100];

/*Open the text file*/
FILE *fp;
fp = fopen("players.txt", "r");

/*Read each line and put it into an element in an array.
Each line will be in a seperate element in the array.*/
i=0;
while(fgets(line, 100, fp)!= NULL){
    strcpy(s[i], line);
    i++;

}

/*Generates a random number stored in j and shuffles the order of the array randomly*/
for(i=1; i<10; i++){

    j = rand()%(i+1);
    strcpy(t, s[j]);
    strcpy(s[j], s[i]);
    strcpy(s[i], t);

}

A: As far as I know, there is no better solution than repeatedly running the Fisher-Yates shuffle until you find an arrangement without adjacent duplicates. (That's usually called a rejection strategy.)
The amount of time this will take depends on the probability that a random shuffle has adjacent duplicates, which will be low if there are few duplicates and could be as much as 1.0 if more than half of the set is the same majority element. Since the rejection strategy never terminates if there is no possible qualifying arrangement, it could be worth the trouble to verify that a solution is possible, which means that there is no majority element. There's an O(n) algorithm for that, if necessary, but given the precise details you provided, it shouldn't be necessary (yet).
You can reject immediately rather than continuing to the end of the shuffle, which significantly cuts down on the cost of running the algorithm. So just use your shuffle algorithm, but restart the counter if you place an element beside one of its twins.
By the way, using strcpy to move elements around is really inefficient. Just shuffle the pointers.
Here's some code adapted from this answer. I've assumed that the duplicates are exact, for simplicity; perhaps you have some other way of telling (like looking only at the first word):
void shuffle(const char* names[], size_t n) {
  for (size_t i = 0; i < n;) {
    size_t j = i + rand() % (n - i);
    /* Reject this shuffle if the element we're about to place
     * is the same as the previous one
     */
    if (i > 0 && strcmp(names[j], names[i-1]) == 0)
      i = 0;
    else {
      /* Otherwise, place element i and move to the next one*/
      const char* t = names[i];
      names[i] = s[j];
      names[j] = t;
      ++i;
    }
  }
}

For your use case, where you have 10 objects with frequencies 3, 3, 2, and 2, there are 605,376 valid arrangements, out 3,628,800 (10!) total arrangements, so about five of every six shuffles will be rejected before you find a valid arrangement, on average. However, the early termination means that you will do less than six times as much work as a single shuffle; empirical results indicate that it takes about 33 swaps to produce a valid shuffle of 10 objects with the above frequencies.
Note: rand()%k is not a very good way to generate a uniform distribution of integers from 0 to k-1. You'll find lots of advice about that on this site.

A: import java.util.Random;
import java.util.Arrays;
public class ShuffleRand
{
static void randomize( int arr[], int n)
{
    Random r = new Random();

    for (int i = n-1; i > 0; i--) {

        int j = r.nextInt(i+1);

        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
    System.out.println(Arrays.toString(arr));
}

public static void main(String[] args)
{

     int[] arr = {1, 2, 3, 4, 5, 6, 7, 8};
     int n = arr.length;
     randomize (arr, n);
}

}

A: This function will shuffle array of strings randomly:
void shuffle(char *arr[], int size)
{
    srand(time(NULL));

    for (int i = 0; i < size; i++)
    {
        int b = rand() % size;
        int a = rand() % size;

        char *tmp = arr[a];
        arr[a] = arr[b];
        arr[b] = tmp;
    }
}


text:
Q: Flutter tests throw "Bad state: Future already completed" when testing a call to `notifyListeners` I am trying to test a class with a function like that
class A {
  void doStuff() {
    // Do stuff...
    notifyListeners();
  }
}

I am currently using the flutter-test package to automate my tests.
My test looks like this:
void main() {
  final myInstance = A();

  group("Class A", () {
    test("should correctly do stuff", () async {
      myInstance.doStuff();
      expect(...);
    });
  });
}

The test is working and expect yields the correct result.
However, console shows an error message:

The following StateError was thrown while dispatching notifications for Class A:
Bad state: Future already completed

What causes this error and how can I prevent it from happening?

A: Turns out, notifyListeners() was the root-cause here.
It threw an error, presumably because it was not yet initialized.
By waiting for its initialization, the error has stopped occuring.
See TestWidgetsFlutterBinding.ensureInitialized for reference
setUpAll(() {
  TestWidgetsFlutterBinding.ensureInitialized();
});


text:
Q: Live CD has black screen HP DV6
Possible Duplicate:
My computer boots to a black screen, what options do I have to fix it?

Attempting to install/try ubuntu (11.10, 12.04) on my new laptop, using a liveCD (and tried USB). I get the purple screen (with the man/keyboard at the bottom) and after that the screen flashes bright white before going black. Ubuntu continues to load in the background, with login sound etc but the screen is off.
I have tried as many different solutions as I could find including:

*

*using nomodestep, xforcevesa, i915.modeset=0, and also now i915.modeset=1 in boot options (seperately): varying consequences, but either I end up at a blinking cursor with no prompt, a command line (startx fails: no screen found), or the original blank screen again

*Tried booting from VirtualBox - it crashes at the same place the screen would go blank when using a CD/USB

*tried 11.04: I don't have this problem BUT when trying to install, I get a ubi-partman error 141 (possibly down to the three partitions that came on my laptop... not sure why HP needed there own separate partition for HP Tools...)
Model: HP Pavillion DV6 6B08SA
Processor: AMD Quad-Core A6-3410MX APU with Radeon HD 6545G2 Dual Graphics (1.6 GHZ 4 MB L2 cache )
Chipset: AMD RS880M
Any help would be greatly appreciated. I just want to be able to partition the drive and install Ubuntu. I'm assuming the issue is graphics card related, although I have no confirmation of that.
Update:

*

*Tried the ẁorkarounds on https://wiki.ubuntu.com/X/Troubleshooting/BlankScreen - set gfxpayload=text changed nothing, removing splash did nothing and setting vesafb.nonsense=1 did nothing either. I'd like to be able to collect some log information somehow, but I can't get to a command line from the liveCD.

*tried using the latest 12.04 beta, same issue

*tried nomodeset without splash or quiet. get the following (tail of) output before it freezes on that screen:
* Starting configure network device security   [OK]
* Starting configure network device            [OK]
[ 25.720899] ieee80211 phy0: w1_ops_config: change monitor mode: false (implement)
[ 25.720923] ieee80211 phy0: w1_ops_config: change power-save mode: false (implement)
* Starting restore sound card(s') mixer state(s)  [fail]
[ 25.721849] ieee80211 phy0: w1_ops_bss_info_changed: qos enabled: false (implement)
* Stopping save kernel messages           [OK]
* Starting bluetooth                      [OK]
* PulseAudio configured for per-user sessions
saned disabled; edit /etc/default/saned
[ 25.988016] hci_cmd_timer: hci0 command tx timeout
[ 26.207225] bad LUN (0:1)
[ 26.223735] bad target number (1:0)
[ 26.252111] bad target number (2:0)
[ 26.272170] bad target number (3:0)
[ 26.300154] bad target number (4:0)
[ 26.328162] bad target number (5:0)
[ 26.344180] bad target number (6:0)
[ 26.368142] bad target number (7:0)
* Checking battery state...               [OK]
* Stopping System V runlevel capability   [OK]

Does this give any indication of the problem? the false (implement) messages also reappear when I press the power button to ask it to shutdown, followed by a [fail] status for killing remaining processes.


text:
Q: Why this memory address changed I use debugger in xcode go through my code line by line and finally found where it breaks, because c->sets[10] is NULL, however I do not know the causes.
I declared three structs, line, set and cache.
typedef  struct{
    int access_time;
    int tag;
    int valid;
}line;
typedef  struct{
    line *line;
    int empty;
    int insert;

}set;

typedef  struct{
    int set_num;
    int line_num;
    set* sets;
}cache;

I init a cache, s is 4, b is 4, and E is 1, which means sets in cache struct is an array with size of 16, each set has one line.
cache* init(int s, int b, int E){
cache* c =malloc(sizeof(cache)) ;
assert(c!= NULL);
//cache* c;
c->set_num = (1<<s);
c->line_num = E;
c->sets = (set*)malloc(c->set_num*sizeof(c->sets));
assert(c->sets != NULL);
for (int i=0;i<(1<<s);i++){
    c->sets[i].empty=E;
    c->sets[i].line=(line*)malloc(E* sizeof(*c->sets[i].line));
    c->sets[i].insert=0;

    assert(NULL!=c->sets[i].line);
    if (!c->sets[i].line){
        printf("null here");
    }else{
        for (int j=0; j<E;j++){

             c->sets[i].line[j].access_time = 0 ;
            c->sets[i].line[j].valid = 0;
            c->sets[i].line[j].tag = 0;

        }
    }
}
return c;

}
I have following code, set is 2, tag is 23456, c is already initiated with value in it.
void do_S(cache* c, int set, int tag){

  int i= c->sets[10].line[0].valid;
for(int i=0; i <E;i++ ){

    if (c->sets[set].line[i].valid==1){
        if ( c->sets[set].line[i].tag ==tag )
        {
            hit_count++;
            c->sets[set].line[i].access_time++;
            printf("hit ");
            return;
        }
        }

    }
l10 = c->sets[10].line;
miss_count++;
printf("miss ");
if (c->sets[set].empty==0){
    eviction_count++;
    printf("evict ");
    c->sets[set].line[c->sets[set].insert].tag=tag;
    c->sets[set].line[c->sets[set].insert].valid = 1;
    update_insert(c, set);
}else{
    l10 = c->sets[10].line;
    c->sets[set].empty--;
    l10 = c->sets[10].line; //c->sets[10].line still contains correct value and address is 0x1001043e0
    c->sets[set].line[c->sets[set].insert].tag = tag;
    c->sets[set].line[c->sets[set].insert].valid = 1;
    l10 = c->sets[10].line; //c->sets[10].line still contains correct value and address is 0x1001043e0

    //update_insert(c,set);
    l10 = c->sets[10].line; //c->sets[10].line becomes NULL address change to 0x0000600a001043e0.

}

}

The code did not do anything there, but address is changed and c->sets[10].line turns to null.

A: This allocation is incorrect:
c->sets = (set*)malloc(c->set_num*sizeof(c->sets));

It allocates space for c->set_num pointers (to sets), but what you want is space for c->set_num sets.  That would be this:
c->sets = malloc(c->set_num*sizeof(set));

(casting the result is unnecessary in C) or this:
c->sets = malloc(c->set_num*sizeof(*c->sets));

Because you are not allocating enough space, you later try to access space beyond what you allocated.  The resulting behavior is undefined, but it is not at all surprising if that memory is unexpectedly modified, as it may easily be assigned to some other dynamically allocated block.


text:
Q: Check if an array is mirrored in C I'm trying to check if the inputted array of the user is mirrored or not
Users input:
//for the rows and column
3 3
//elements inside array
1 0 1
2 0 3
4 0 4

the output should tell if the first index and the last index of the array is the same, but the only thing that i have done is mirror it and print mirror even if its not the same
int main()
{
    int arr[10][10];
    int col,row;

    scanf("%d %d", &col, &row);

    for (int i = 0; i < col; i++) {
        for (int j = 0; j < row; j++) {
            scanf("%d", &arr[i][j]);
        }
    }

    for (int i = 0; i < col; i++) {
        for(int j = row - 1; j >= 0; j--) {
            printf("Mirror");
        }
    }
}

the size of the array and the elements depends on the user, thank youuu

A: Usually you iterate through the columns of each row, that means that usually i (the outer loop) represents the rows and j the columns.
This piece of code shows a way to check if a 2D array is mirrored horizontally:
int mirror = 1;

for(int i = 0; i < row; i++) {

    for(int j = 0; j < col/2; j++) {

        // comparing first element with last element of row `i`
        // than comparing the second element with the second last
        // and so on, till you reach the center of the row, `j==col/2`
        // if the comparison is true just one time, the array is not mirrored
        if( array[i][j] != array[i][col-j-1] ) {

            mirror = 0;
            i = row; // to break the outer loop
            break;
        }
    }
}

mirror ? puts("Mirror!") : puts("No mirror.");

At the end of the program if the variable mirror still have a value of 1, you got a mirror array.

A: This is my solution for your problem, this code can have some isuess but in general do what you ask for. Adapt for your particular needs.
OUTPUT:
This program will check if an array is mirrored. Press enter to proceed!

Insert row*col -> 3*3
Insert row 1 elements, one by one!
Element 1 -> 1
Element 2 -> 0
Element 3 -> 1
Insert row 2 elements, one by one!
Element 1 -> 2
Element 2 -> 0
Element 3 -> 3
Insert row 3 elements, one by one!
Element 1 -> 4
Element 2 -> 0
Element 3 -> 4
Mirror found at row 1!
1 0 1
Mirror found at row 3!
4 0 4

CODE:
#include <stdio.h>

#define MAXCOLUMN 10
#define MAXROW    10

void clean(){
  int temp;
  while ((temp = getchar()) != '\n' && temp != EOF);
}

void print(int dim,int r, int row[][MAXCOLUMN]){
  for(int index = 0; index < dim; index++)
    printf("%d ",row[r][index]);
  putchar('\n');
}

int main(void){
  int arr[MAXROW][MAXCOLUMN];
  int col,row,mirror;

  puts("This program will check if an array is mirrored. Press enter to proceed!");

  do{
    clean();
    printf("Insert row*col -> ");
  }
  while(scanf("%d*%d", &row, &col)!=2);

  for(int r = 0; r < row; r++){
    printf("Insert row %d elements, one by one!\n",r+1);
    for(int c = 0; c < col; c++){
      do{
        clean();
        printf("Element %d -> ", c+1);
      }while(!scanf("%d",&arr[r][c]));
    }
  }

  for(int r = 0; r < row; r++){
    mirror = 1;
    for(int cFH = 0, cSH = col-1; cFH < col/2; cFH++, cSH--)//cFH -> column index first half | cSH -> column index second half
      if(arr[r][cFH] != arr[r][cSH]){
        mirror = 0;
        break;
      }
    if(mirror){
      printf("Mirror found at row %d!\n",r+1);
      print(col,r,arr);
    }
  }

  return 0;
}


text:
Q: Audio plays in Chrome but not Safari I've got an angular 5 application where I've set the click handler of a button to download an audio file and play it. I'm using this code to do so:
onPreviewPressed(media: Media): void {
    const url = ".....";

    this.httpClient.get(url, {responseType: 'blob'}).subscribe(x => {
        const fileReader = new FileReader();

        fileReader.onloadend = () => {
            const context = new ((<any>window).AudioContext || (<any>window).webkitAudioContext)();
            const source = context.createBufferSource();

            context.decodeAudioData(fileReader.result, buffer => {
                source.buffer = buffer;
                source.connect(context.destination);
                source.start(0);
            }, y => {
                console.info("Error: " + y);
            });
        };

        fileReader.readAsArrayBuffer(x);
    });
}

If I go to the page in Chrome and press the button the audio starts right up.  If I do it in Safari nothing happens. I know Safari locked things down but this is in response to a button click, it's not an auto-play.
The audio is sent back from the server via a PHP script, and it's sending headers like this, in case it matters:
header("Content-Type: audio/mpeg");
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($_GET['file']));
header('Cache-Control: no-cache');

A: No, it is not "in response to a button click".
In response to this click event, you are starting an asynchronous task. By the time you call source.start(0), your event is long dead (or at least not anymore an "trusted user gesture". So they will indeed block this call.
To circumvent this, you could simply mark your context as allowed with silence. Then, when the data will be available, you'll be able to start it with no restriction:
function markContextAsAllowed(context) {
  const gain = context.createGain();
  gain.gain.value = 0; // silence
  const osc = context.createOscillator();
  osc.connect(gain);
  gain.connect(context.destination);
  osc.onended = e => gain.disconnect();
  osc.start(0);
  osc.stop(0.01);
}

onPreviewPressed(media: Media): void {
  const url = ".....";
  // declare in the event handler
  const context = new(window.AudioContext || window.webkitAudioContext)();
  const source = context.createBufferSource();
  // allow context synchronously
  markContextAsAllowed(context);

  this.httpClient.get(url, {
    responseType: 'blob'
  }).subscribe(x => {
    const fileReader = new FileReader();

    fileReader.onloadend = () => {
      context.decodeAudioData(fileReader.result, buffer => {
        source.buffer = buffer;
        source.connect(context.destination);
        source.start(0);
      }, y => {
        console.info("Error: " + y);
      });
    };

    fileReader.readAsArrayBuffer(x);
  });
}

As a fiddle since Safari doesn't like over-protected StackSnippets®
Also, my angular knowledge is very limited, but if httpClient.get does support {responseType: 'arraybuffer'} option, you could get rid of this FileReader and avoid populating twice the memory with the same data.
Finally, if you are going to play this audio more than once, consider prefetching and pre-decoding it, you'll then be able to avoid the whole asynchronous mess.


text:
Q: Delete image in the gallery after camera intent photo taken i'm creating an image cropping application and i want to delete the image automatically in the gallery after the camera intent photo taken.
my goal is to delete automatically the image taken from the camera app after cropping the image.
this is the code for opening camera
private void pickCamera() {

    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.TITLE, "NewPic");
    values.put(MediaStore.Images.Media.DESCRIPTION,"Image to Text");

    image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,values);

    Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,image_uri);
    startActivityForResult(cameraIntent,IMAGE_PICK_CAMERA_CODE);

}

protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {

    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {

        if (requestCode == IMAGE_PICK_GALLERY_CODE) {
            CropImage.activity(data.getData()).setGuidelines(CropImageView.Guidelines.ON).start(this);
        }

        if (requestCode == IMAGE_PICK_CAMERA_CODE){
            CropImage.activity(image_uri).setGuidelines(CropImageView.Guidelines.ON).start(this);

        }
    }

    if(requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE){
        CropImage.ActivityResult result = CropImage.getActivityResult(data);

        if (resultCode == RESULT_OK) {

            Uri resultUri = result.getUri();

            mPreviewIv.setImageURI(resultUri);
            BitmapDrawable bitmapDrawable = (BitmapDrawable)mPreviewIv.getDrawable();
            Bitmap bitmap = bitmapDrawable.getBitmap();

            TextRecognizer recognizer = new TextRecognizer.Builder(getApplicationContext()).build();

            if(!recognizer.isOperational()){

                Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
            }


text:
Q: "error: cannot find symbol" when building Chromium for Android with new classes I need to create a custom OmniboxResultsAdapter (org.chromium.chrome.browser.omnibox) for Chromium for Android. If I edit existing classes, everything is fine, but if I add new classes (for example, empty MyClass with no fields or methods) and try to use it in code (e.g., MyClass myObject = new MyClass()) and try to make a build with:
 chromium/src$ ninja -C out/Release chrome_public_apk

I get:
    ../chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java:1430: error: cannot find symbol
            MyClass myObject = new MyClass();
            ^
      symbol:   class MyClass
      location: class LocationBarLayout

    ../chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java:1430: error: cannot find symbol
            MyClass myObject = new MyClass();
                                   ^
      symbol:   class MyClass
      location: class LocationBarLayout
    2 errors

    ninja: build stopped: subcommand failed.

I suppose the compiler cannot find the class because of ProGuard.
What files do I need to modify to get the right result?

A: The java class of Chromium is declared in file src/chrome/android/java_sources.gni. You need to add the file path of MyClasst to that file like this:
"java/src/org/chromium/chrome/browser/MyClass.java"


text:
Q: Extending force:sdls and using lightning :xxx tags in component I am on a summer 16 dev box trying to get a hang on lightning apps, I started looking at this documentation. My locker service is disabled

Enable Lightning LockerService Security   This critical update enables
  LockerService, a new and advanced security layer for your Lightning
  Components.   2/11/2017 138 days remaining    Not Activated

https://www.lightningdesignsystem.com/platforms/lightning/
I am facing issues when trying to extend force:slds to my application
1) How do I extend force:slds in <aura:application> to use Lightning design system sytle sheets?

Failed to save undefined: No APPLICATION named markup://force:slds
  found :

As per docs :

Your Lightning Out, LC4VC, and Lightning Application automatically get
  the Lightning Design System stylesheets and design tokens if they
  extend force:slds. This is the easiest way to stay up-to-date and
  consistent with SLDS enhancements.

2) When I try to include lightning:XXX tags in my component I get the component not found error. Is this because I have an older version of SLDS package in static resource?

Failed to save undefined: No COMPONENT named markup://lightning:badge
  found

I am able to add ui:xxx, force:xxx, aura:xxxx tags in the component except the lightning:xxx tags.

A: The lightning: components are only available in API 38.0 (Winter '17) and above. They will not be available in your dev org until the production rollout.


text:
Q: How does the Google Service Client (PHP) method documentation work? I have consistent difficulty using any client service method that is not explicitly exampled somewhere. Despite following the docs and even reading the sourcecode, The class or method names I come up with following the scheme are never right.
The documentation at Packagist (see 'Making Requests") says the client library classes are autogenerated from the Google endpoints, which agrees with the description in the library's docs on Github that say the pattern for accessing methods should be "$service->resource->method(args)".
So why the following?
// works:
// I get a countable object of active classrooms owner by the specified id
$response = $this->ClassroomService->courses->listCourses([
            'courseStates' =>   'ACTIVE',
            'teacherId'     => 'me']);

// works:
// I get an instance of the single classroom's object containing lots of meta data
$response = $this->ClassroomService->courses->get( $id );

// does not work:
// 500 error, obj has no such method
$response = $this->ClassroomService->topics->listCoursesTopics( $id  );

According to the API Explorer all three should be fine.
What am I missing about using client service objects?
Edit
Ultimately I determined the resource in my example to be 'courses_topics'; the method was correct per the docs. Thanks for the idea @ebram.
The question remains how the methods are named though. courseWork is my next challenge and it does not fit the the naming pattern of topics.

A: *

*There is no topics member of ClassroomService.

*The member is named courses_topics.

*

*This is documented in the "Properties summary" at the bottom of the Classroom documentation.

Your code should look like this:
$response = $this->ClassroomService->courses_topics->listCoursesTopics( $id  );

*

*The documentation for Google_Service_Classroom_CoursesTopics_Resource does incorrectly give sample code where the member is named ->topics.

*Given that API documentation is generated from source, but sample code is (generally) written by hand, I'll assume the API documentation is correct and the sample code is incorrect. I'd file a documentation-bug with Google.

Update:
I looked at the PHP source code for Google_Service_Classroom in GitHub and verified that the property is named courses_topics instead of topics, so in conclusion: the sample code is wrong.
What's also interesting is the resource-type in the actual source-code is Google_Service_Classroom_Resource_CoursesTopics but the documentation refers to it as Google_Service_Classroom_CoursesTopics_Resource - so that documentation is definitely wrong.


text:
Q: Why doesn't the color of the points in a scatter plot match the color of the points in the corresponding legend? I have a sample scatterplot via matplotlib via the code below.
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 100, 501)
y = np.sin(x)

label = 'xy data sample'

plt.scatter(x, y, cmap='plasma', c=x, label=label)
legend_dict = dict(ncol=1, loc='best', scatterpoints=4, fancybox=True, shadow=True)
plt.legend(**legend_dict)
plt.show()

Running the code above produces the plot below.

The colormap was successfully plotted, but the legend shows points that are all blue rather than points in a color that correspond to the chosen colormap. Why does this happen?
I tried putting cmap='plasma' in legend_dict, but it results in the error below.
File "/Users/.../
site-packages/matplotlib/axes/_axes.py", line 550, in legend
    self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'cmap'

EDIT:
My desired output is to have the four dots represented in the legend to be a different color via the chosen colormap. Ideally, cmap='plasma' in this example could produce a legend using something similar to a blue dot, then a purple dot, then an orange-red dot, then a yellow dot. Although a colorbar could make for a possible alternative, I have yet to look through any documentation about colorbars.

A: A colorbar can be achieved via plt.colorbar(). This would allow to directly see the values corresponding to the colors.
Having the points in the legend show different colors is of course also nice, although it would not allow to give any quantitative information.
Unfortunately matplotlib does not provide any inbuilt way to achieve this. So one way would be to subclass the legend handler used to create the legend handle and implement this feature.
Here we create a ScatterHandler with a custom create_collection method, in which we create the desired PathCollection and use this by specifying it in the legend_map dictionary of the legend.
handler_map={ type(sc) : ScatterHandler()}

The following code seems a bit complicated at first sight, however you may simply copy the class without understanding it completely and use it in your code.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerRegularPolyCollection

class ScatterHandler(HandlerRegularPolyCollection):
    def update_prop(self, legend_handle, orig_handle, legend):
        legend._set_artist_props(legend_handle)
        legend_handle.set_clip_box(None)
        legend_handle.set_clip_path(None)

    def create_collection(self, orig_handle, sizes, offsets, transOffset):
        p = type(orig_handle)([orig_handle.get_paths()[0]],
                              sizes=sizes, offsets=offsets,
                              transOffset=transOffset,
                              cmap=orig_handle.get_cmap(),
                              norm=orig_handle.norm )

        a = orig_handle.get_array()
        if type(a) != type(None):
            p.set_array(np.linspace(a.min(),a.max(),len(offsets)))
        else:
            self._update_prop(p, orig_handle)
        return p

x = np.linspace(0, 100, 501)
y = np.sin(x)*np.cos(x/50.)

sc = plt.scatter(x, y, cmap='plasma', c=x, label='xy data sample')

legend_dict = dict(ncol=1, loc='best', scatterpoints=4, fancybox=True, shadow=True)
plt.legend(handler_map={type(sc) : ScatterHandler()}, **legend_dict)

plt.show()


text:
Q: Scala "not found: type" error I am a scala noob and I am working on writing unit test cases for a scala spark program. When I try to run my scala unit test case using sbt test command, I get the following error
BasicACRStatsTest.scala:8: not found: type BasicACRStats

[error]   var basicStats: BasicACRStats = _
[error]                   ^
BasicACRStatsTest.scala:14: not found: type BasicACRStats
[error]     basicStats = new BasicACRStats
[error]                      ^
[error] two errors found
[error] (test:compile) Compilation failed

I am using intellij and when I am trying to refer the class BasicACRStats it shows Cannot resolve symbol BasicACRStats even though I have declared it in the correct package.
BasicACRStat.scala
 package com.company.analytics
 import org.apache.hadoop.conf.Configuration
 import org.apache.hadoop.fs.{FileSystem, Path}
 import org.apache.hadoop.fs.FileSystem.Statistics
 import org.apache.spark.SparkConf
 import org.apache.spark.SparkContext
 import org.apache.spark.sql.hive.HiveContext
 import scala.collection.mutable.ArrayBuffer
 import collection.mutable

 object BasicACRStats {

   def main(args: Array[String]) {
   // Some code goes here
   }
 }

BasicACRStatsTest.scala
    import com.company.analytics
    import org.scalatest.FunSuite
    import org.scalatest.BeforeAndAfter
    import org.apache.spark.SparkConf
    import org.apache.spark.SparkContext

    class BasicACRStatsTest extends FunSuite with BeforeAndAfter {
      @transient var sc: SparkContext = _
      var basicStats: BasicACRStats = _
      // some code goes here
    }

Simple.sbt
name := "basicACRStats"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.2.0"
libraryDependencies += "org.apache.spark" % "spark-sql_2.10" % "1.1.0"
libraryDependencies += "org.apache.spark" % "spark-hive_2.10" % "1.1.0"
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "1.9.1" % "test"

Project Directory Structure
projectfoo
  .idea
  src
    main
      scala
        com
          company
            analytics
              BasicACRStats.scala
    test
      scala
        BasicACRStatTest.scala
  target
  simple.sbt

I am not sure on how to troubleshoot this issue, please share your thoughts and please let me know if you would require further information.

A: BasicACRStats seems to be an object in your sample code, not a class.
An object is a singleton and not a class/type. I has a type, in this case BasicACRStats.type, that there is only one instance of ever. Since it isn't a type calling new BasicACRStats is not valid Scala and neither is trying to use it as a type for a value.
What you want is probably to declare BasicACRStats a class. That would make the rest of your sample code make sense.


text:
Q: Not found page and default home page always redirect to home - React Router I have this code and always that I put a non existing route it  redirects to home. I want that when a non existing route is enter redirects to /404 and when nothing or / is enter it redirects to Home.
            <Switch>
                <Route exact path="/badges" component={Badges} />
                <Route exact path="/badges/new" component={NewBadge} />
                <Route path="/404" component={NotFound} />
                <Route path="/" component={Home} />
                <Redirect from="*" to="/404" />
            </Switch>

A: Use the exact prop in your Home route.
            <Route exact path="/" component={Home} />

A: I would add a <Route> component without providing path that should redirect to 404 one.
Try the following:
<Switch>
    <Route exact path="/badges" component={Badges} />
    <Route exact path="/badges/new" component={NewBadge} />
    <Route path="/404" component={NotFound} />
    <Route path="/" component={Home} />
    <Route component={NotFound} />
</Switch>

I hope this helps!

A: I think you can do this:
<Switch>
    <Route exact path="/badges" component={Badges} />
    <Route exact path="/badges/new" component={NewBadge} />
    <Route exact path="/" component={Home} />
    <Route component={NotFound} />
</Switch>


text:
Q: "Sticky" sidebar overflowing vertically We have a sticky side panel on our page implemented with the following very-simple CSS:
position: fixed;
top:62px;
bottom:10px;

Where the top and bottom properties create the desired margins.
The problem is that this panel contains several accordion-style elements, and expanding some of them causes the content to overflow past the bottom of the screen and become invisible/inaccessible. Adding an overflow:auto; rule to the above css style almost solves the problem, by inserting a scrollbar that allows the user to scroll vertically to see the would-be hidden content. However, this results in two scrollbars - one for the main nav and one for the sidebar - which feels clunky an unintuitive. Instead, I'd like to have the "fixed" element scroll with the main scrollbar when it overflows. I'm aware that this would essentially make it not a fixed element, and thus am afraid I'll have to resort to JS to make this happen - but does anyone have a cleaner, html/css-only way of handling this?

A: I'm not sure this is what you need, but hope it helps some way.

#container1 {
    height: 400px;
    width: 200px;
    overflow: hidden;
    position: fixed;
    top: 62px;
    bottom: 10px;
    background: #888;
}

#container2 {
    width: 100%;
    height: 99%;
    overflow: auto;
    padding-right: 20px; /*Adjust this for cross-browser compatibility */
}

#container2 ul li {
    height: 300px;
}

html, body {
    height: 99%;
    overflow:hidden;
}

test1

test2

test3

JSFiddle

Also in chrome you can try out:
::-webkit-scrollbar {
     display: none;
}

But this snippet works only in chrome, so I would rather use the above.

A: Let me try to help. Use Panel-body class selector to handle this.
First you should do many things, such as, width of the div and the second div.
You can manage to hide the scrollbar as follows:
.panel-body {
    height:300px;
    overflow:auto;
    margin-right:0px; // when it shows scrollbar, you need to set it MINUS.
}

Second, you also take notice when browser window gets resized by user and you need to manage Media Queries in related to the div width.
This is the DEMO.


text:
Q: How make image of generated meshes in Unity for Minimap I generate meshes in Unity3d and I need minimap for this generated model. So I need make image or screenshot of this model. But need proportion of bounds of meshes and image must be the same.
I may make schreenshot in Unity, but I do not know how make the same proption of model.
http://prntscr.com/96np5r

A: You might be looking for Renderer.bounds.
It is the bounding volume of the renderer (Read Only).
This is the axis-aligned bounding box fully enclosing the object in world space.
Using bounds is convenient to make rough approximations
about the object's location and its extents.
Have a look at unitys documentation page about it here: http://docs.unity3d.com/ScriptReference/Renderer-bounds.html
There also is "Mesh.bounds"

Note that the Mesh.bounds property is similar but returns the bounds in local space.

A: If you would like to have a live mini-map, you should have two cameras (one acting as the main camera and one for capturing the mini-map). And those should be arranged so that the main camera covers the whole screen and the second one only covers a small portion (e.g. bottom-left corner).
More Info

Another option is applying a mini-map to texture of a given game object (for example, you have a display panel in your game such that you want to show the mini-map on). For this requirement, there is pro-only feature in Unity that help you render into a given texture what a camera is seeing.
More Info


text:
Q: Comparing collection contents with ScalaTest I'm trying to unit-test some Scala that is very collection-heavy. These collections are returned as Iterable[T], so I am interested in the contents of the collection, even if the underlying types differ. This is actually two related problems:

*

*How do I assert that two ordered collections contain the same sequence of elements?

*How do I assert that two unordered collections contain the same set of elements?

In summary, I'm looking the Scala-equivalent of NUnit's CollectionAssert.AreEqual (ordered) and CollectionAssert.AreEquivalent (unordered) in ScalaTest:
Set(1, 2) should equal (List(1, 2))          // ordered, pass
Iterable(2, 1) should equal (Iterable(1, 2)) // unordered, pass

A: You could try .toSeq for ordered collections and .toSet for unordered, which captures what you want as far as I understand it.
The following passes:
class Temp extends FunSuite with ShouldMatchers {
  test("1")  { Array(1, 2).toSeq should equal (List(1, 2).toSeq) }
  test("2")  { Array(2, 1).toSeq should not equal (List(1, 2).toSeq) }
  test("2b") { Array(2, 1) should not equal (List(1, 2)) }
  test("3")  { Iterable(2, 1).toSet should equal (Iterable(1, 2).toSet) }
  test("4")  { Iterable(2, 1) should not equal (Iterable(1, 2)) }
}

BTW a Set is not ordered.
edit: To avoid removing duplicate elements, try toSeq.sorted. The following pass:
  test("5")  { Iterable(2, 1).toSeq.sorted should equal (Iterable(1, 2).toSeq.sorted) }
  test("6")  { Iterable(2, 1).toSeq should not equal (Iterable(1, 2).toSeq) }

edit 2: For unordered collections where elements cannot be sorted, you can use this method:
  def sameAs[A](c: Traversable[A], d: Traversable[A]): Boolean =
    if (c.isEmpty) d.isEmpty
    else {
      val (e, f) = d span (c.head !=)
      if (f.isEmpty) false else sameAs(c.tail, e ++ f.tail)
    }

e.g. (note use of symbols 'a 'b 'c which have no defined ordering)
  test("7")  { assert( sameAs(Iterable(2, 1),    Iterable(1, 2)     )) }
  test("8")  { assert( sameAs(Array('a, 'c, 'b), List('c, 'a, 'b)   )) }
  test("9")  { assert( sameAs("cba",             Set('a', 'b', 'c') )) }

Alternative sameAs implementation:
  def sameAs[A](c: Traversable[A], d: Traversable[A]) = {
    def counts(e: Traversable[A]) = e groupBy identity mapValues (_.size)
    counts(c) == counts(d)
  }

A: Meanwhile you can use
Iterable(2, 1) should contain theSameElementsAs Iterable(1, 2)

To test the ordered set you have to convert it to a sequence.
Set(1, 2).toSeq should contain theSameElementsInOrderAs List(1, 2)


text:
Q: Directories or projects .  On a regular winforms solutions, how do you determine to break classes into different directories / namespaces or seperate projects. Besides binary dependencies should view, controllers, models all be in different projects ?

A: I tend to believe that you can happily work with a simpler system and separate your dependencies using folders. Adding extra projects makes the system slightly harder to work with, deploy and maintain as you now have several smaller things you have to coordinate.
Using folders you will still have to ensure that hasty developers do not bypass your layering, which can be a big concern with junior developers. You can watch out for violations using static checking (like NDepend) but no checker is perfect. If you have specific functionality at each level that you feel you need another protection level (internal) then by all means split it up into separate projects.
As for what folders to break them into I would likely follow the conventions found in web mvp/mvc frameworks such as.

Controllers\
Views\
  Broken down by controller
Model\

You might want to read this blog post on the topic. Good luck.


text:
Q: undefined method for 'downcase'. (WATIR/Ruby related. webdriver-user-agent) I am trying to get Watir to emulate a mobile environment and I followed the directions verbatim from the very helpful, http://watirwebdriver.com/mobile-devices/. Here's my code.
#!/usr/bin/ruby
require 'rubygems'
require 'watir-webdriver'
require "webdriver-user-agent"
require 'headless'
$headmode = 0
$screens = 0
headless = Headless.new if $headmode == 1
headless.start if $headmode == 1

driver = UserAgent.driver(:browser => :firefox, :agent => :iphone, :orientation => :landscape)
....... snip ......
....... snip ......

The exception being thrown is .....
/var/lib/gems/1.8/gems/webdriver-user-agent-0.0.5/lib/webdriver-user-agent.rb:39:in `agent_string_for': undefined method `downcase' for :iphone:Symbol (NoMethodError)
    from /var/lib/gems/1.8/gems/webdriver-user-agent-0.0.5/lib/webdriver-user-agent.rb:11:in `driver'
    from ./test_CAPI.rb:11

Not being a Ruby developer, or being proficient in WATIR (yet), I'm mystified by this error. Can anyone shed some light on this? Many thanks Janie

A: The webdriver-user-agent is complaining that the values you passed for :agent and :orientation cannot be downcased due to the method not existing.
I think there are two solutions:

*

*Upgrade to Ruby 1.9.3. I am guessing like me, you ran the code using something like Ruby 1.8.7. The downcase() method for Symbols does not exist in 1.8.7, which gives you the error. So you need a later version of Ruby that does have the method (ex 1.9.3 based on http://www.ruby-doc.org/core-1.9.3/Symbol.html).

*Pass in a string for the :agent and :orientation values (example below). It looks like it works for the one example (though I do not use this gem so cannot tell you if there are issues elsewhere).
driver = UserAgent.driver (:browser => :firefox, :agent => 'iphone', :orientation => 'landscape')


text:
Q: execute all R chunks at once from an Rmd document A minimal Rmarkdown document has a YAML header, markdown syntax and R code chunks.
To edit such a multi-language file, I am using the Emacs editor, and the buffer in which the Rmd document is opened, is in polymode.
A typical document has more than one R chunk. When I am writing/debugging an R chunk in the middle of the Rmd document, I have a second buffer in the ESS mode with R running inside, and I often have to re-execute all previous chunks by sending the R commands from the Rmd file (1st buffer) into the into R console (2nd buffer).
Is there a single command allowing to execute all commands from all chunks?
From another question, it seems like org-mode can do this. But would it be possible to do it in my setting?

A: If you only have R source code in your Rmarkdown, and want to be able to interactively evaluate it easily, spin from knitr might be easier (see here).
I prefer that (spin) solution, since all the markdown/Rmarkdown mumbo-jumbo is contained within normal R comments, so the buffer can be treated like regular source code.  But, the following should evaluate all the R code chunks in a polymode buffer (not tested thoroughly).
(eval-when-compile
  (require 'polymode-core)  ;; SO format :('
  (defvar pm/chunkmode))
(declare-function pm-map-over-spans "polymode-core")
(declare-function pm-narrow-to-span "polymode-core")

(defun rmd-send-chunk ()
  "Send current R chunk to ess process."
  (interactive)
  (and (eq (oref pm/chunkmode :mode) 'r-mode) ;;'
       (pm-with-narrowed-to-span nil
         (goto-char (point-min))
         (forward-line)
         (ess-eval-region (point) (point-max) nil nil 'R)))) ;;'

(defun rmd-send-buffer (arg)
  "Send all R code blocks in buffer to ess process. With prefix
send regions above point."
  (interactive "P")
  (save-restriction
    (widen)
    (save-excursion
      (pm-map-over-spans
       'rmd-send-chunk (point-min) ;;'
       ;; adjust this point to send prior regions
       (if arg (point) (point-max))))))

A: If using Poly-Markdown+R, the command to evaluate all R snippets in an Rmarkdown document is M-n v b.
Reference


text:
Q: Only one of two ethernet connections has internet access Alright, this one has got me completely stumped. Among other devices, I have three computers currently connected to the same wireless router:
One of them is connected through ethernet and has internet access.
One is connected to the wireless network and has internet access.
The third, despite having no problems connecting with wireless or wired networks in the past, cannot establish a connection with the wireless network. After connecting an ethernet cable, it had internet access for a short time. Now, despite the network still showing a connection and internet access, any attempt to actually access the internet fails.
I've tried all the basic stuff like reconnecting cables and resetting routers with no change. Any insight into what's going on here and how to fix it would be greatly appreciated.

A: There are a number of steps you can take to diagnose where the error might be occurring.
In laymans terms you want to diagnose whether this is a physical problem (cabling) or a configuration issue. In technical terms you want to discern whether this is a layer 1/2 or a layer 3 issue.
When you connect to the router ensure that you are able to ping the local gateway and the access point. This can be accomplished by opening a command prompt and typing ipconfig /all to determine the local gateway /AP IP address, then running 'ping x.x.x.x' - where x is equal to the switch or routers IP address.
In my experience, these kinds of issues are caused by the AP or router DHCP server assigning the same IP address to two hosts. Simply assigning each host a static IP address usually solves it. This can be accomplished by going to the TCP/IP settings through the Network and Sharing Centre in the systray>Adaptor Properties>Rightclick on relevant adaptor>TCP/IP (v4) and setting the address manually. You may need to get DNS information from your router.
So what you want to do is basically ensure you can reach the router from the host connecting wirelessly from the wireless access point (AP). If you can reach the router then double check in ipconfig on both hosts to ensure that both hosts aren't getting assigned the same IP address.


text:
Q: Tikz node vertical alignment & titles added to exercises My question relates to sgmoye's answer to the problem posed in Inspired exercise Sheet from Indesign. I'd like to expand on this answer by having the exercise number vertically aligned with the word 'Exercise'. As you can see from the image below, there is a small vertical space above the red line which means that this currently isn't true. Basically, I'd like to keep the gray border around the white box, but have 'Exercise' level with the number in this white box.
In addition, I'd like to add a different title to each exercise, which should also be vertically aligned with the exercise number. This should sit in the white gap on the right of the given image (outside the tikz rectangle). Can anyone show me how this can be done? I have added the code I am working with.
% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX

\documentclass[11pt,a4paper,landscape]{article}

\usepackage{tikz}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{tikzpagenodes}
\usepackage{eso-pic}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{microtype}
\usepackage[margin=1in]{geometry}

\usetikzlibrary{calc}
\usetikzlibrary{shapes.multipart}

\newcounter{exrc}

\newcommand{\exstep}{%
    \stepcounter{exrc}%
    \tikz[baseline]\node[anchor=base,%
        rectangle split,
        rectangle split parts=2,
        draw=gray,
        thick,
        rectangle split horizontal,
        outer sep = 0pt,
        rectangle split part fill={gray,white},
        inner sep=0pt] (exx) at (0,0)
        {\textcolor{white}{\bfseries\extype}\nodepart{two}\textcolor{black}{\bfseries\theexrc}};
}

\AddToShipoutPictureBG{%
    \begin{tikzpicture}[remember picture,overlay]
        \draw[thick,rounded corners]
            ($(current page text area.south west)+(-12pt,-12pt)$)
                rectangle
                ($(current page text area.north east)+(12pt,12pt)$);
        \node[white,fill=gray,rounded corners]
                at ($(current page text area.north)+(0,12pt)$)
                %% Change `Exercises' to suit
                {\bfseries\sffamily\hspace*{1em}Exercises\hspace*{1em}};
    \end{tikzpicture}
}

%% There are two environments, `exci` for exercises using `enumerate`,
%% and `exct` for text exercises that do not use `enumerate`.
%% Both have an optional argument to change the name of the
%% exercise on the fly. See the included examples.

\newenvironment{exci}[2][Exercise]{%
    \def\extype{#1}%
    \leavevmode\exstep\par
    \smallskip
    #2
    \begin{enumerate}[leftmargin=*,noitemsep,nosep]
}{%
    \end{enumerate}
    \bigskip
    \def\extype{Exercise}%
}

\newenvironment{exct}[1][Exercise]{%
    \def\extype{#1}%
    \leavevmode\exstep\par
    \smallskip
    }{%
        \bigskip
        \def\extype{Exercise}%
}

\setlength{\columnseprule}{0.4pt}
\parindent0pt

\begin{document}

\begin{multicols*}{2}

\begin{exci}{Calculate the following limits:}
\item $$\lim\displaylimits_{x \to2}\frac{4x^3-5x-22}{x^{2}-x-2}$$
\end{exci}

\end{multicols*}

\end{document}

A: You need to add rectangle split part align=base to the node options. But then you will probably want to increase inner sep. I used inner sep=1pt in the code below.

\newcommand{\exstep}{%
    \stepcounter{exrc}%
    \tikz[baseline]\node[anchor=base,%
        rectangle split,
        rectangle split parts=2,
        rectangle split part align=base,
        draw=gray,
        thick,
        rectangle split horizontal,
        outer sep = 0pt,
        rectangle split part fill={gray,white},
        inner sep=1pt] (exx) at (0,0)
        {\textcolor{white}{\bfseries\extype}\nodepart{two}\textcolor{black}{\bfseries\theexrc}};
}


text:
Q: CSS overflow option to hide whole element, not clip it This is what I have at the moment:

Home page

Create new...

My profile

And for the container:
#pando-header-c {
  position:absolute;
  left:100px;
  right:430px;
  height:50px;
  white-space: nowrap;
  overflow:hidden;
  display:block;
}

However, for some reason it renders the elements partially and it doesn't fully cut them out in the overflow; despite the fact that I've set them all to inline-block and block (the a, as well as li).
This is how it clips it:
http://i.stack.imgur.com/dNTJ2.png
The question is how do I make the whole element invisible if it doesn't fit entirely, instide of clipping the text out.

A: Overflow is, by definition, the things that don't fit. So hidden means "hide the overflow", not the element. The best way I can think of to hide it if it doesn't fit is to use media queries:
@media screen and (max-width: 600px) {
  #pando-header-c {
    display: none;
  }
}

It takes some tweaking on your end to see, but there's not a CSS way I can think of to hide it if the content is larger than the container.


text:
Q: SVG text to PNG fails render fonts with php and imagemagick When i tried to convert this svg into png using PHP imagemagick, it only renders the text in default font only.
is there any way to use the same google font to render the text, when converting into png ?
Any help would greatly be appreceated. Thanks in advance.
SVG file with Sickness font is ok but when render with imagemagick fails.
my svg code is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type='text/css' href='svg-stylesheet.css' ?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="250" height="100" version="1.1"><text xml:space="preserve" style="font-size:30px;text-shadow: 1px 1px 1px #CCCCCC;-moz-text-shadow:1px 1px 1px #CCCCCC;-webkit-text-shadow:1px 1px 1px #CCCCCC; fill:#999; font-family:Sickness" x="30" y="70" class="test">
<tspan>Sample TEXT</tspan>
</text>
</svg>

my php code is:
exec('convert -verbose 4.svg -transparent white -quality 100 -alpha on 4.png');

my svg file in here
http://speedy.sh/PfWXD/4.svg
svg result

png result with imagemagick

A: For a custom font outside of your configured type.xml, you'll need to update your $MAGICK_FONT_PATH environment to include the path to where the font is located. Or just copy the font file to the working directory your executing from. Then it's just a matter of defining the -font for Imagemagick to use (if it isn't picked up automatically).
// Example with environment path
exec('MAGICK_FONT_PATH=/path/to/sickness convert -font Sickness 4.svg -transparent white -quality 100 -alpha on 4.png');
// Example with ttf in same directory
exec('convert -font Sickness.ttf 4.svg -transparent white -quality 100 -alpha on 4.png');

Other tips & hints here


text:
Q: Can't access object values in React I have a functional React component that I want to return a list of information about a car. The first three lines of the return statement (model, maker, release) load with no problem, but the categories won't load because React says 'category' is undefined.
When I console.log car after it is set in state, the car object has the categories key on it, and I can expand that to show three category objects. I can then expand each of those to show category.id and category.name.
So is there a way to access car.categories.category.name? Is the issue that there are three objects?
const CarDetails = () => {
    const {carsId} = useParams();
    const [car, setCar] = useState([])

    const loadCar = () => {
        getOneCar(carsId)
            .then(data => {
                setCar(data)})
    }

    useEffect(() => {
        loadCar()
    }, []);

    useEffect(() => {
        console.log(car)
    }, [car])

    return (
        <>

{car.model}

Maker: {car.maker}

Year released: {car.released}

        {/*
Categories: {car.categories.category.name}
 */}
        </>
    )

This is what the object looks like
"model": Corvette
"maker": Chevrolet
"categories": [
            {
                "id": 1,
                "category": {
                    "id": 1,
                    "name": "Sports"
                }
            },
            {
                "id": 2,
                "category": {
                    "id": 2,
                    "name": "Hybrid"
                }

A: Your car.categories is an array, not an object. You cannot read an array by the dot notation. Instead, you must loop through it to access each element, like this:
<>

{car.model}

Maker: {car.maker}

Year released: {car.released}

Categories:

    {car.categories.map((category) => (

{category.name}

    ))}

</>

A: Well, if you look "categories" value, you will see its a list. So you can't access category by doing categories.category.
However, category[0].category.name would work as you need to index the list.
Or you can map the list
categories.map(item => item.category.name)

A: I think car.categories is an array not an object.
So car.categories.category does not work.
Please try car.categories[0].category, car.categories[1].category, ... like this.
<>

{car.model}

Maker: {car.maker}

Year released: {car.released}

  {/*
Categories: {car.categories.category.name}
 */}

Categories:

  {car && car.categories.map(item => {
    return({item.category.name})
  })}
</>

Thanks.


text:
Q: video recorder on iphone This is the program that i make.
But i doesn't run good. when i open this program on iphone it immediatly turn off.
I will show my code and answer me what is the problem.
UIImagePickerController * videoRecorder = [[[UIImagePickerController alloc] init] autorelease];
    videoRecorder.delegate = self;
    videoRecorder.sourceType = UIImagePickerControllerSourceTypeCamera;
    NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:videoRecorder.sourceType];
    if (![sourceTypes containsObject:(NSString*)kUTTypeMovie] ) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
                                                        message:@"Device Not Supported for video Recording."
                                              cancelButtonTitle:@"Yes"
                                              otherButtonTitles:@"No",nil];
        [alert show];
        [alert release];
        return;
    }
    videoRecorder.sourceType = UIImagePickerControllerSourceTypeCamera;
    videoRecorder.mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
    videoRecorder.videoQuality = UIImagePickerControllerQualityTypeLow;
    videoRecorder.videoMaximumDuration = 120;
    videoRecorder.delegate = self;
    self.recorder_ = videoRecorder;
    [videoRecorder release];
    [self presentModalViewController:self.recorder_ animated:YES];

A: First: Use the code formatter in the future please.  This hurts to look at.
Second: You're double releasing UIImagePicketController (videoRecorder)  auto-release will release it after the current runloop exits, but you're also explicitly releasing it near the end of your method call here, so when iOS cleans up the auto-release pool, it will get a double release and crash.
I can't read the rest of this well due to the formatting, but that seems like your most likely bet for what's causing the crash.

A: You should edit your post and make the code readable.
The problem is that you autorelease videoRecorder in the first line so you don't have to call the -release. videoRecorder has a retain count of zero in the first line and a retain count of one when you assign it to self.recorder_. When you call the release, then retain count goes to zero and the autorelease pool makes the object go away before the recorder can be presented as a modal view controller. Remove that -release call and you should be fine. Also, your code sets the delegate and sourceType two times.


text:
Q: R: Creating a IC9-Code Description Variable using the ICD-9 package I have a dataset that contains 3-digit ICD-9 codes and I want to create a ICD9 description variable based on the 3 digit codes. Here is a code to replicate my dataset:
id=c(1:5);icdcode=c("786","401","780","300","V30");df=data.frame(id,icdcode)

I used the following code to create a new var "icd9.explain":
df$icd.explain=icd9ExplainShort(as.character(df$icdcode))

My resulting dataset looks like this:
> df
  id icdcode                                    icd.explain
1  1     786 Anxiety, dissociative and somatoform disorders
2  2     401 Anxiety, dissociative and somatoform disorders
3  3     780 Anxiety, dissociative and somatoform disorders
4  4     300 Anxiety, dissociative and somatoform disorders
5  5     V30 Anxiety, dissociative and somatoform disorders

Does anyone have an idea about how I can get the correct code explanations?
Thanks!!

A: icd (formerly icd9 package author here. Just picked up on your question, which I realise is a while ago.
The package will guess whether you have short form Eg. 0100 or decimal form e.g. 010.0, so you can simplify this slightly. You also don't need to convert to character since it will already handle character or factors.
id=c(1:5)
icdcode <- c("786","401","780","300","V30")
df <- data.frame(id, icdcode, desc = icd::explain_code(icdcode))

There is also explain_table which grabs the short and long descriptions, and ICD chapter and sub-chapter for each code.

A: For anyone who might be experiencing this issue in the future, I was able to resolve my issue by using the lapply function:
 lapply(as.character(df$icdcode),function(x){icd9ExplainShort(x)})


text:
Q: Kafka Broker - Is it same as Zookeeper? or KafkaProducer is the broker? There are multiple code examples available (One of such is here) where KafkaProducer and KafkaConsumers are implemented and can be started separately.
I was trying to find the code that starts the broker?
I think Zookeeper is not the KafkaBroker, as Zookeeper is for some other purpose  .. managing clusters states.
While creating the KafkaProducer we pass in property like
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, IKafkaConstants.KAFKA_BROKERS);

Does that mean the KafkaProducer it self start the broker?

A: The Zookeeper manages the co-ordination and synchronisaton of the Kafka brokers, and they are separate components.
The Producer does not start the broker. The Producer and Consumer are client-side components that connect to one or more Kafka brokers, and produce/consume data to and from the cluster of brokers.
The Kafka broker is generally started by running kafka/bin/kafka-server-start.sh kafka/config/server.properties, which will start one Kafka broker with the properties defined in the server.properties file.

A: Is important to begin have so clear the concepts:
Kafka broker = One instance of kafka started, i mean start the application  download from (https://kafka.apache.org/downloads)
Zookeeper = Effectively is a coordinator for cluster in this specific case you can start up many instance on kafka with zookeeper and take a cluster.
Kafka Producer = Any application (implement kafka libraries) that is in charge of send message to specific kafka topic, some like queue.
Kafka consumer = Any application (implement kafka libraries) that is in charge of get messages of kafka cluster and process it.
For start kafka you first set a system environment (optional), and then execute this commands :
---- first start zookeeper
nohup zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties &
----- then istart kafka
nohup kafka-server-start.sh $KAFKA_HOME/config/server.properties &