text:
Q: "-bash: ls: command not found" I installed the most recent update to OS X Lion (10.7). After I did that, my terminal won't recognize normal commands. I typed ls and got:
-bash: ls: command not found

I figured I'd try to add usr/bin to my path, but I can't find .bash_profile to edit it since typing edit .bash_profile won't work. I can't set the Finder to show all files since my terminal won't recognize the commands necessary to do that.
what do I need to do?

A: Since two commands are missing something "stomped" your path.
Before doing anything big, kicking off a backup might be prudent.
The default path for bash shell  on Mac OS X 10.7 (Lion) is something like this:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

If you reset the path by typing the above into a shell window, and then typing export PATH it should manually let you test a local fix contained to that window only.
This breakage is almost always something you need to fix in your dot files. For bash, edit and fix .bash_profile and/or .bashrc by undoing a recent change it just setting the $PATH you need again. The usual error is assigning a new path and not referring to the previous value of the variable on the right hand side of the =
If you are totally out of luck, commenting out most of the lines from your dot files and then getting a good path before reworking the customizations is a good plan.

A: It sounds to me as if /etc/profile wasn't run at shell startup. It's the global startup file responsible for initializing PATH. Check whether /etc/profile exists and is readable and executable with the following command:
. /etc/profile

If it isn't there, you'll need to restore it from a backup or another machine with Lion installed, or install Lion again. If it exists but isn't executable, try using Disk Utility to Repair Disk Permissions.
If it does exist and is executable (and it contains some code), either it may not be getting run when it's supposed to or your startup script may somehow be overriding it. As a workaround, try putting . /etc/profile at the start of your ~/.bash_profile to ensure it is run. If you still encounter the problem, add echo $PATH after running it to see if PATH was initialized properly. If it was, something in your script is changing it.
Here's the default contents of /etc/profile:
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi

path_helper constructs the default PATH. You could try running
unset PATH; /usr/libexec/path_helper -s

to see what it produces.
In any case, if the problem isn't in your startup script(s), please contact Apple support http://www.apple.com/support/contact/ or report a bug at https://bugreport.apple.com/ to let Apple know there's a problem.

A: To check that it is indeed a problem with your path, what's the result of /bin/ls ?
If it works, than you should restore your path to /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin, you can use for example VI whose path is (on my mac) /usr/bin/vi.

A: I thought of sharing the mistake that led me to this error - at least in my case,
When I added a new PATH in ~/.bash_profile, I forgot to add :$PATH at the end of the path that I just added.
I used the temporary fix ( the following command in the terminal) that masters here have already pointed out to get back to bash_profile since I could not use vi commands to open it in the first place.
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Once I got in, I rectified my mistake.
(Negative data matters!)

A: This should fix the problem completely and permanently.
first, export environment paths by using below command in the terminal.
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

now you have the commands you want. (eg. try ls. You'll see the command is working). But this is only for the current session. If you close the terminal and open a new one, you will have the previous issue. To make this change permanent, use below command,
go to home directory
cd ~

open .bash_profile file in nano / vim (I'm using nano here)
nano .bash_profile

This will open up nano editor. In a new line, paste the following;
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH

press 'control'+'o' to save (WriteOut) and 'control'+'x' to exit nano.
All done ! Now try the commands.

A: This is likely not your problem at a fresh begin, but I had added PATH=xyz/ in my .env file and wondered why I could not use ls right after running source .env. Clearly because I overwrote my PATH variable, and it was back as soon as I reopened my shell. ;)

A: you can export the path as follows:
export PATH=$PATH:/bin:/usr/local/bin

A: Looks like your PATH variable is corrupt. Check if by any chance you are modifying the PATH variable within your script or simply check the PATH by saying echo $PATH and you can make sure if nothing is corrupt.

A: I was trying to set my maven path to envoronment variables when this happened. So I just moved my .profile and .bash_profile file to trash and tried again and it worked.

A: Resetting your terminal will work. It will reset your basic configurations.
Reset your terminal. From top navigation go to Shell >> Reset.


text:
Q: UITextField becomeFirstResponder not working in iOS6 i have a UITextField that is subview of a UIView that is set as tableHeaderView of a UITableView.
for some reason the textfield does not invoke the keyboard when clicked in iOS6 (in previous OS it works just fine).
the implementation is pretty straight forward..
any ideas what can be the problem?
Thanx!

A: Here's the code:
_tracksTableView.tableHeaderView = _tableHeaderView;  //this view contains the     _playlistNameTextField

- (IBAction)saveButtonClicked
{
    [self toggleTextField];
}

- (void)toggleTextField
{
   if (_textFieldVisible)
   {

    [_playlistNameTextField resignFirstResponder];
    [_playlistNameTextField fadeOut:0.2 delegate:self];
    [_saveAsPalylistButton fadeIn:0.2 delegate:self];
            _textFieldVisible = NO;
    }
   else
   {
            [_playlistNameTextField setText:@""];
            [_saveAsPalylistButton fadeOut:0.2 delegate:self];
            [_playlistNameTextField fadeIn:0.2 delegate:self startSelector:nil      stopSelector:@selector(launchKeyboard)];
            UIBarButtonItem *barButton = [self barButtonItemWithTitle:NLS(@"Cancel") action:@selector(toggleTextField)];
            [barButton.customView setFrame:CGRectMake(0.0, 0.0, barButton.customView.frame.size.width, _playerTitleView.frame.size.height)];
            self.navigationItem.leftBarButtonItem = barButton;
           _textFieldVisible = YES;
    }
}

- (void)launchKeyboard
{
    [_playlistNameTextField becomeFirstResponder];
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Passing value using delegate is not working In RootViewController I have a button which when it's clicked makes the self.navigationController push to CategoryViewController.
Then, in CategoryViewController, click one cell push to SubCatsViewController. and When I have chosen a cell, and it should dissmiss CategoryViewController and SubCatsViewController back to the RootViewController.
But how to do that?
If I use dismissViewControllerAnimated, it only dismisses SubCatsViewController, not CategoryViewController. I have wrote a delegate in SubCatsViewController so I can get the selected value from SubCatsViewController, and in RootViewController I conform to this delegate protocol, to get the value that I wanted.
However, I can't get the value using the delegate I have written.
- (void)chooseCat:(BButton *)sender
{

    UIStoryboard *storyboard = [UIStoryboard
    storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
    CategoryViewController *cat =
    [storyboard instantiateViewControllerWithIdentifier:@"Cats"];
    SubCatsViewController *sub =
    [storyboard instantiateViewControllerWithIdentifier:@"SubCats"];
    sub.delegate = self; //correct way?
    [self.navigationController pushViewController:cat animated:YES];
}

CategoryViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath
{
    UIStoryboard *storeboard =
    [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
    SubCatsViewController *sub =
    [storeboard instantiateViewControllerWithIdentifier:@"SubCats"];
    sub.subCats =
    [[self.cats objectAtIndex:indexPath.row] objectForKey:@"subcat"];
    [self.navigationController pushViewController:sub animated:YES];
}
SubCatsViewController.h

@protocol SubCatsDelegate <NSObject>

- (void)didSelectSubCats:(SubCats *)cats;

SubCatsViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    self.cat.catId =
    [[self.subCats objectAtIndex:indexPath.row] objectForKey:@"id"];
    self.cat.name =
    [[self.subCats objectAtIndex:indexPath.row] objectForKey:@"name"];
    if ([self.delegate respondsToSelector:@selector(didSelectSubCats:)]) {
        [self.delegate didSelectSubCats:self.cat];
    }
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end

A: The documentation of dismissViewControllerAnimated:completion: in UIViewController (from which UINavigationController inherits) says that:

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller.

That explains why SubCatsViewController (and only that view controller) gets dismissed.
If RootViewController is indeed your root view controller you can change the line in your tableView:didSelectRowAtIndexPath: from
[self dismissViewControllerAnimated:YES completion:nil];

to
[self.navigationController popToRootViewControllerAnimated:YES];


text:
Q: Delete all rows on spotfire Data Table Iron python I was looking for a way to delete rows in my Data table on SPOTFIRE and I didn't find a proper way to do it.
I tried to code a script to do it, but It's too slow and I have more the 20k rows to be deleted.
Does someone have an idea why it's too slow and if there is a another way to do (a faster way)
from Spotfire.Dxp.Data import RowSelection
table=Document.Data.Tables["my Table name"]
i=0
for row in table.GetRows():
  i+=1
  rowToDelete=Document.Data.Tables["my Table name"].Select("[index]="+`i`).AsIndexSet()
  Document.Data.Tables["my Table name"].RemoveRows(RowSelection(rowToDelete))

A: I found a way which is more simple to do it.
from Spotfire.Dxp.Data import RowSelection, IndexSet
dtTarget = Document.Data.Tables["my Table name"]
dtTarget.RemoveRows(RowSelection(IndexSet(dtTarget.RowCount,True)))


text:
Q: "How" to save an entire collection in Backbone.js - Backbone.sync or jQuery.ajax? I am well aware it can be done and I've looked at quite a few places (including: Best practice for saving an entire collection?). But  I'm still not clear "exactly how" is it written in code? (the post explains it in English. It'd be great to have a javascript specific explanation :)
Say I have a collection of models - the models themselves may have nested collections. I have overridden the toJSON() method of the parent collection and I am getting a valid JSON object. I wish to "save" the entire collection (corresponding JSON), but backbone doesn't seem to come in-built with that functionality.
var MyCollection = Backbone.Collection.extend({
model:MyModel,

//something to save?
save: function() {
   //what to write here?
 }

});

I know somewhere you have to say:
Backbone.sync = function(method, model, options){
/*
 * What goes in here?? If at all anything needs to be done?
 * Where to declare this in the program? And how is it called?
 */
}

Once the 'view' is done with the processing it is responsible for telling the collection to "save" itself on the server (capable of handling a bulk update/create request).
Questions that arise:

*

*How/what to write in code to "wire it all together"?

*What is the 'right' location of the callbacks and how to specify a "success/error" callback? I mean syntactically?I'm not clear of the syntax of registering callbacks in backbone...

If it is indeed a tricky job then can we call jQuery.ajax within a view and pass the this.successMethod or this.errorMethod as success/error callbacks?? Will it work?
I need to get in sync with backbone's way of thinking - I know I'm definitely missing something w.r.t., syncing of entire collections.

A: I ended up just having a 'save' like method and called $.ajax within it. It gave me more control over it without the need to add a wrapper class as @brandgonesurfing suggested (although I absolutely love the idea :) As mentioned since I already had the collection.toJSON() method overridden all I landed up doing was using it in the ajax call...
Hope this helps someone who stumbles upon it...

A: My immediate thought is not to override the method on save method on Backbone.Collection but wrap the collection in another Backbone.Model and override the toJSON method on that. Then Backbone.js will treat the model as a single resource and you don't have to hack the way backone thinks too much.
Note that Backbone.Collection has a toJSON method so most of your work is done for you. You just have to proxy the toJSON method of your wrapper Backbone.Model to the Backbone.collection.
var MyCollectionWrapper = Backbone.Model.extend({
url: "/bulkupload",

//something to save?
toJSON: function() {
    return this.model.toJSON(); // where model is the collection class YOU defined above
 }

});

A: This really depends on what the contract is between the client and server. Here's a simplified CoffeeScript example where a PUT to /parent/:parent_id/children with {"children":[{child1},{child2}]} will replace a parent's children with what's in the PUT and return {"children":[{child1},{child2}]}:
class ChildElementCollection extends Backbone.Collection
  model: Backbone.Model
  initialize: ->
    @bind 'add', (model) -> model.set('parent_id', @parent.id)

  url: -> "#{@parent.url()}/children" # let's say that @parent.url() == '/parent/1'
  save: ->
    response = Backbone.sync('update', @, url: @url(), contentType: 'application/json', data: JSON.stringify(children: @toJSON()))
    response.done (models) => @reset models.children
    return response

This is a pretty simple example, you can do a lot more... it really depends on what state your data's in when save() is executed, what state it needs to be in to ship to the server, and what the server gives back.
If your server is ok with a PUT of [{child1},{child2], then your Backbone.sync line could change to response = Backbone.sync('update', @toJSON(), url: @url(), contentType: 'application/json').

A: The answer depends on what you want to do with the collection on server side.
If you have to send additional data with the post you might need a wrapper model or a relational model.
With the wrapper model you always have to write your own parse method:
var Occupants = Backbone.Collection.extend({
    model: Person
});

var House = Backbone.Model.extend({
    url: function (){
        return "/house/"+this.id;
    },
    parse: function(response){
        response.occupants = new Occupants(response.occupants)
        return response;
    }
});

Relational models are better I think, because you can configure them easier and you can regulate with the includeInJSON option which attributes to put into the json you send to your rest service.
var House = Backbone.RelationalModel.extend({
    url: function (){
        return "/house/"+this.id;
    },
    relations: [
        {
            type: Backbone.HasMany,
            key: 'occupants',
            relatedModel: Person,
            includeInJSON: ["id"],
            reverseRelation: {
                key: 'livesIn'
            }
        }
    ]
});

If you don't send additional data, you can sync the collection itself. You have to add a save method to your collection (or the collection prototype) in that case:
var Occupants = Backbone.Collection.extend({
    url: "/concrete-house/occupants",
    model: Person,
    save: function (options) {
        this.sync("update", this, options);
    }
});

A: Old thread i know, what i ended up doing is the following:
Backbone.Collection.prototype.save = function (options) {
            // create a tmp collection, with the changed models, and the url
            var tmpCollection = new Backbone.Collection( this.changed() );
            tmpCollection.url = this.url;
            // sync
            Backbone.sync("create", tmpCollection, options);
        };
        Backbone.Collection.prototype.changed = function (options) {
            // return only the changed models.
            return this.models.filter( function(m){
                return m.hasChanged()
            });
        };
// and sync the diffs.
self.userCollection.save();

Pretty straint foreward :)

A: I was also surprised that Backbone collections don't have a built in save. Here's what I put on my backbone collection to do it. I definitely don't want to iterate through each model in the collection and save independently. Also, I am using Backbone on the backend using Node so am overridding the native Backbone.sync to save to a flat file on my small project—but the code should pretty much be the same:
    save: function(){
      Backbone.sync('save', this, {
        success: function(){
          console.log('users saved!');
        }
      });
    }

A: A very simple...
Backbone.Collection.prototype.save = function (options) {
    Backbone.sync("create", this, options);
};

...will give your collections a save method.  Bear in mind this will always post all the collection's models to the server regardless of what has changed.  options are just normal jQuery ajax options.

A: Here's a simple example:
var Books = Backbone.Collection.extend({
model: Book,
url: function() {
  return '/books/';
},
save: function(){
  Backbone.sync('create', this, {
    success: function() {
      console.log('Saved!');
    }
  });
 }
});

When you call the save() method on your collection, it will send a PUT method request to the defined URL.

A: I would try something like:
var CollectionSync = function(method, model, [options]) {
    // do similar things to Backbone.sync
}

var MyCollection = Backbone.Collection.extend({
    sync: CollectionSync,
    model: MyModel,
    getChanged: function() {
        // return a list of models that have changed by checking hasChanged()
    },
    save: function(attributes, options) {
        // do similar things as Model.save
    }
});

( https://stackoverflow.com/a/11085198/137067 )

A: The accepted answer is pretty good, but I can go one step further and give you code that will ensure the proper events are fired for your listeners while also allowing you to pass in option ajax event callbacks:
save: function( options ) {
  var self = this;

  var success = options.success;
  var error = options.error;
  var complete = options.complete;

  options.success = function( response, status, xhr ) {
    self.trigger('sync', self, response, options);
    if (success) return success.apply(this, arguments);
  };

  options.error = function( response, status, xhr ) {
    self.trigger('error', self, response, options);
    if (error) return error.apply(this, arguments);
  };

  options.complete = function( response, status, xhr ) {
    if (complete) return complete.apply(this, arguments);
  }

  Backbone.sync('create', this, options);
}

A: For anyone who is still using backbone.js in 2017, the accepted answer is not working.
Try removing the toJSON() override in the wrapper model and calling toJSON on the collection when you instantiate the model wrapper.
new ModelWrapper(Collection.toJSON());


text:
Q: Hovering div causes laggs I want to hover a div. When i go with my mouse into the div ist lagging. The Content is not appearing clearly. Here´s my html and my css

.unshow-txt:hover,
.unshow-txt:focus,
.unshow-txt:active {
  display: none;
}

.show-txt {
  display: none;
  font-size: 18px;
}

.box:hover .show-txt,
.box:focus .show-txt,
.box:active .show-txt {
  display: inline;
}

Vorausschauend

Some text

A: You want this ? See this fiddle
I use siblings CSS selector to show the text :
.unshow-txt:hover ~ .show-txt,
.unshow-txt:focus ~ .show-txt,
.unshow-txt:active ~ .show-txt {
  display: inline;
}

A: I suggest to use the hover effect in the .box div. the bug is happening because you have a hover animation in the parent and the child

.box:hover .unshow-txt,
.box:hover .unshow-txt,
.box:hover .unshow-txt {
  display: none;
}

.show-txt {
  display: none;
  font-size: 18px;
}

.box:hover .show-txt,
.box:focus .show-txt,
.box:active .show-txt {
  display: inline;
}

Vorausschauend

Some text


text:
Q: What is the basic difference between Sieves, Series and Splines estimators? As far as I know, Sieve Estimators consists in a broader class of estimators for a function g(x) lying in a space of functions G. The estimation basically consists in choosing the function that best approximates g(x) in a subspace Gn of G. This subspace Gn would grow as n grows.
I know also that Series estimators are a subclass of sieve estimators that could be written as a weighted sum of basis functions.
Here comes my questions:

*

*Are linear sieve estimators the same as Series estimators?

*Are splines just a specific serie estimator, when the basis is a specific one?

*Are there some sieve estimators that could not be written as a sum of weighted basis functions?


text:
Q: How to Test Facebook Login? I'd like to test the server-side manual login workflow I put together using the Facebook developer guide, but I'm unaware what options I have in this regard. At this point, the clients that will use service are yet to be created.
Does facebook or third parties offer a login dialog that can be used in such manual/automated (functional) tests? Or will I have to create a temporary client that calls the login dialog and handles the redirect myself?

A: Facebook provides sandboxed test users (see https://developers.facebook.com/docs/apps/test-users) that you can use for testing purposes.
If you are talking about writing automated tests around this, then consider using the test users along with something like vcr (https://github.com/vcr/vcr), or the equivalent for your server-side environment (you don't say what that is).


text:
Q: Python: '%2s'% doesn't work after breaking the row i need to produce output with specified number of spaces. It is a table with some columns, for saving output in to the file i use line:
save_line = ('%8s' % label[each_atom + str(int(k) + 1)] +
             '%10s' % str(int(i) + 1) +
             '\n' +
             '%2s' % x[i] +
             '%20s' % y[i] +
             '%20s' %z[i] +
             '\n')

but the '%2s'%x[i] doesn't produce two spaces in output. I cant use +"  "+ there. Any ideas what I can do?
Here is output of my code:
      C1         1
2.482705            1.332897           13.175184

And finally here's how my output should looks (it is example from another input, my task is to produce my basing on this):
      C1         1
  2.42416980          4.14117720          4.71196000

It is no problem to change any number of spaces  between any columns. The only one that doesn't work is the first one in every second row. It doesn't mater that the numbers don't mach. The problem is in the spaces.

A: Please combine those templates
save_line = "%8s%10s\n%2s%20s%20s\n" % (
    label[each_atom + str(int(k) + 1)],
    str(int(i) + 1),
    x[i],
    y[i],
    z[i])

The right side of the % operator should be a tuple. None of your values are tuples (from what I can see) and that's a great way to get output you do not expect. If you only want to format one item:
print "Hello %s!" % ("world",)

Note the trailing comma. This is because
("World")

is a string (with parenthesis around it), while
("World",)

is a tuple containing one item.

A:
but the '%2s'%x[i] doesn't produce two spaces in output. I cant use +"  "+ there. Any ideas what I can do?

Why?
The number after % is the size of a new string field.
print '%3s' % 'why'
>>why
print '%4s' % 'why'
>> why

The size is 4 symbols for 'why' string = ' why'.
You have only 1 left space for 3 letters word if you use '%4s'.
Also, you can use '-'.
If your string is 's' and you use '%-2s', you will get new string 's ', with 1 space after your string. You can use it also in your string formatting tasks.
>>> print "%-5s%s" % ("N", "Q")
N    Q
>>> print "%5s%s" % ("N", "Q")
    NQ
>>> print "%5s%5s" % ("N", "Q")
    N    Q
>>> '%.1s' % 'Hello!'
'H'
>>> '%.2s' % 'Hello!'
'He'

And you can use value for tuple:
>>> '%.*s' % (2, 'Hello!')
'He'

Thank you,


text:
Q: If I create a C# desktop application with SQLite, will the database get bundled with the installer? I am trying to make an application for managing a small store, which will be offline. I am considering using SQLite for my data handling needs. Once I create the installer for this project, does the database get attached to the installer or will have have to take additional steps to make the application work.
Also is SQLite the best way to approach this or should I consider something else?

A: Since SQLite needs a file to work with you can include a file which contains empty schema of your SQLite database in your setup project and copy it to working directory. Or add your empty db file as a resource to your application. And in your connection string builder/provider check existence of the file if it doesn't exists read it from resource and copy to the target location. And also SQLite is good option for that kind of usage.


text:
Q: How to sort a list of datatable in c#? I am selecting 3 separate results from database by using select statement 3 times into a dataset.After that i am adding two rows and inserting a total label below second row and addition of result in next cell of that rows.I want to sort table in desc order based on table column values.My code is
 List<DataTable> list_dt = new List<DataTable>();

 for (int i = 0; i < ds.Tables.Count; i++)
        {
            score = TotalScore(ds.Tables[i]);
            list_dt.Add(AddToDataTable(ds.Tables[i], score));
        }

Problem is that how to sort tables based on hours so that i bind them to 3 different gridviews based on hours.
 public DataTable AddToDataTable(DataTable dt, double totalScore)
 {
    var rowTotal = dt.NewRow();
    rowTotal["FullName"] = "Total";
    rowTotal["Hours"] = totalScore;

    dt.Rows.Add(rowTotal);

    return dt;
}

public double TotalScore(DataTable dt)
{
    double Hours = 0.0;

    for (int i = 0; i < dt.Rows.Count; i++)
    {
        Hours += Convert.ToDouble(dt.Rows[i]["Hours"]);
    }

    return Hours;
}

A: You can use one of this possible solutions to sort the tables in your list based on total hours.
var sortedTableList = (from table in list_dt
    orderby Convert.ToDouble((from row in table.AsEnumerable()
        where row.Field<string>("FullName") == "Total"
        select row.Field<string>("Hours"))
        .Single())
        /* place here the keyword "descending" for descending order */
    select table)
    .ToList();

or
// replace "OrderBy" with "OrderByDescending" for descending order
var sortedTableList = list_dt.OrderBy(table =>
    Convert.ToDouble(
        (table.AsEnumerable()
        .Where(row => row.Field<string>("FullName") == "Total")
        .Select(row => row.Field<string>("Hours"))
        .Single())))
    .ToList();

A: Instead of sorting the DataTables, You can use Order By in your query to sort your result by Hour descending.It's simple and easy because you are always sorting your resul according to Hour.

A: Maybe you can use Dictionary : Click here for more info
Way 2 : change your Sql Command and like this : select * from time order by Hours
other way is create 2 arraylist and then play with indexes of 2 arrays


text:
Q: Tradingview Simple Moving Average widget configure I am using trading view simple moving average (20,44,100,200) using below code.

BTCUSDT Chart by TradingView

However i want to change moving average line color and line width for different average, so i tried with studies_overrides function with different inputs but it seems its not working.
Example: I want to change line color to white for 20 days moving average so i tried below code
"studies_overrides": {
            "moving average.lineStyle.color.0": "#ffffff", //Not working
            "simple moving average.lineStyle.color.0": "#ffffff", //Not working
            "MASimple@tv-basicstudies.lineStyle.color.0": "#ffffff", //Not working
        }, //Same on 'lineWidth: 2' not working

any one know how to change color and line width properly?
Ref: https://static.kancloud.cn/isung/tradingview/972246, https://static.kancloud.cn/isung/tradingview/972244

A: Try like this,
You should use the names of the studies in the Insert Study dialog as they are but using lower case letters.
  "studies_overrides": {
        "moving average.ma.color": "#2A2E39",
        "moving average.ma.linewidth": 2,
    },


text:
Q: Interpolation using multiple neighboring points I am wondering, what is the best way to do an interpolation based on $4$ points neighborhood with knowing their value and distance.
Here is the illustration:

I'd like to know the value of the $x$. I know the value of the four neighboring o being $v_0$, $v_1$, $v_2$, $v_3$, and I know their distance to $x$ is $d_0$, $d_1$, $d_2$, $d_3$. So what is the best way to perform the interpolation to get $x$?
I can simply do an inverse of the distance, then normalize each one. It pretty much the idea of barry centric. Is it a better estimation than simply doing the linear using the nearest ones (in this case $v_1$ and $v_2$)? Are there any high-order way to do a better job (say, spline, but I don't want to do spline here since it is too expensive)?

A:
So what is the best way to perform the interpolation to get $x$?

The best way is not universal but depends on the application, I think.

I can simply do an inverse of the distance, then normalize each one.
  It pretty much the idea of barry centric. Is it a better estimation
  than simply doing the linear using the nearest ones (in this case
  $v_1$ and $v_2$)?

If I did understood, you define
$$
f(x) = \frac{\displaystyle\sum_{i=0}^4 w_i \cdot v_i }{\displaystyle\sum_{i=0}^4 w_i},
$$
where $w_i=1/d_i$. I think this approach is not the easiest to implement, because when $d_i \to 0$ you have that $w_i \to \infty$.

Are there any high-order way to do a better job (say, spline, but I
  don't want to do spline here since it is too expensive)?

One possibility is to use polynomial interpolation. Wikipedia writes in paragraph Polynomial interpolation:

Generally, if we have $n$ data points, there is exactly one polynomial
  of degree at most $n−1$ going through all the data points.

So, with $4$ distinct points you could to retrieve a cubic polynomial $f(x) = ax^3+bx^2+cx+d$ as interpolating function, and then compute $f(x)$ by simple substitution. I don't know if this is too expensive for you: to determine the coefficients $a,b,c,d$ it is required an inversion of a $4\times 4$ matrix.


text:
Q: Animating many parts of a vector drawable simultaneously Using AnimatedVectorDrawables, one can apply certain animations to parts of a vectordrawable (see here). For example consider the vectordrawable, called vectordrawable.xml:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
 android:height="64dp"
 android:width="64dp"
 android:viewportHeight="600"
 android:viewportWidth="600" >
     <path
         android:name="path"
         android:fillColor="#000000"
         android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
</vector>

Which is a vectordrawable containing a single path (line). The desired animation would then be in a separate file, called animator.xml, for example:
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
    android:duration="4000"
    android:propertyName="trimPathEnd"
    android:valueFrom="0"
    android:valueTo="1" />
</set>

Which would be animation showing the line being drawn. These two xml files would then feed into a third animatedvectordrawable xml file:
<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/vectordrawable">
<target
    android:animation="@anim/animator"
    android:name="path" />

</animated-vector>

So the question is, what if your vectordrawable path contained a large number of paths, which you wanted to animate simultaneously?  You could do this the long way and would have to give every path a different name, then target each and every path with the same animator in your animatedvectordrawable file. But if you've got over 20 paths, this would take a long time and be a messy solution.
You do have the option of enclosing a set of paths in a group, then target a single group. But the animations for groups are different to that of paths, i.e. animating trimPathEnd isn't possible for a group, thus you cannot apply this animation to a group of paths.

A: I found a library (here), which introduces a new imageview-esque view, which accepts vector drawables. You can then extract the paths (or any part of the vector drawable) either by name, or more importantly, by index. Thus this allows one to animate as many paths as you like by creating a for loop, such as
RichPathView view = findViewbyId(R.id.richpathview);
for(int i=0, i<100, i++){
    RichPath richPath = view.findRichPathByIndex(i);
                RichPathAnimator.animate(richPath)
                        .trimPathEnd(0, 1)
                        .duration(1000)
                        .start();
}

This block would "draw" the first 100 paths of a vector drawable simultaneously.
So this allows you to animate the parts of vector drawable, without having to explicitly name and reference every single part.

A: I want to suggest RichPath as well to do that but I don't recommend to call RichPathAnimator.animate() inside a long loop, you can achieve the same result in a better way, please check the 3rd step in this full example:

1- Normal vector_drawable.xml with 6 paths:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="256dp"
    android:viewportHeight="36.0"
    android:viewportWidth="36.0"
    android:width="256dp">

  <path
      android:pathData="M19.5,6.2l1.3-1.3c0.2-0.2,0.2-0.5,0-0.7c-0.2-0.2-0.5-0.2-0.7,0l-1.5,1.5C17.9,5.2,16.9,5,16,5c-1,0-1.9,0.2-2.7,0.6l-1.5-1.5c-0.2-0.2-0.5-0.2-0.7,0c-0.2,0.2-0.2,0.5,0,0.7l1.3,1.3C11,7.3,10,9,10,11h12C22,9,21,7.2,19.5,6.2z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

  <path
      android:pathData="M13.9,8.9H13V8h0.9V8.9z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

  <path
      android:pathData="M19,8.9h-0.9V8H19V8.9z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

  <path
      android:pathData="M10,22c0,0.5,0.4,1,1,1h1v3.5c0,0.8,0.7,1.5,1.5,1.5s1.5-0.7,1.5-1.5V23h2v3.5c0,0.8,0.7,1.5,1.5,1.5s1.5-0.7,1.5-1.5V23h1c0.5,0,1-0.5,1-1V12H10V22z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

  <path
      android:pathData="M24.5,12c-0.8,0-1.5,0.7-1.5,1.5v7c0,0.8,0.7,1.5,1.5,1.5s1.5-0.7,1.5-1.5v-7C26,12.7,25.3,12,24.5,12z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

  <path
      android:pathData="M7.5,12C6.7,12,6,12.7,6,13.5v7C6,21.3,6.7,22,7.5,22S9,21.3,9,20.5v-7C9,12.7,8.3,12,7.5,12z"
      android:strokeColor="#A4c639"
      android:strokeWidth="0.5"
      android:trimPathEnd="1"/>

</vector>

2- Use RichPathView in your layout insead of ImageView :
<com.richpath.RichPathView
    android:id="@+id/richPathView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:vector="@drawable/vector_drawable" />

3- Animate all of your paths simultaneously.
RichPathView pathView = findViewById(R.id.richPathView);

RichPath[] paths = new RichPath[6];

for (int i = 0; i < paths.length; i++) {
    paths[i] = pathView.findRichPathByIndex(i);
}

RichPathAnimator
    .animate(paths)
    .trimPathEnd(0, 1)
    .duration(1600)
    .start();

also, it will be cleaner if we have an API like pathView.findAllRichPaths(),
I have opened an issue for that here


text:
Q: CakePHP 2 RSS feed from multiple controllers I've created an RSS feed with the RssHelper as in http://book.cakephp.org/2.0/en/core-libraries/helpers/rss.html. It is located at app/View/Posts/rss/index.ctp and is accessible at
/posts/index.rss It shows RSS feeds from Posts.
I have also created RSS feed for other controllers like news, events etc. I want to let users subscribe to RSS feed that shows all the feeds from other contollers like news, events etc. That is I want to combine RSS feeds from different controllers.
Please help. Thanks in advance.

A: Within any Controller's action, you can load other models - for example, in your PostsController, something like this:
//PostsController
public function rss_combined() {
    $this->loadModel('Event');
    $this->loadModel('News');
    //do whatever logic you want to create a combined RSS
}

Or, if the models are associated with the Post model, you can access methods through the Post model:
// Instead of this:
$this->loadModel('Event');
$this->Event->myMethod();

// You can do this:
$this->Post->Event->myMethod();

Often I create a DashboardsController or something of the like when I need many things that aren't tied directly to a specific model.  Then, you can specify that the Dashboard model doesn't use a database table:
public $useTable = false;


text:
Q: EAGLE schematic capture and board layout problems I'm about to start the manual and then auto routing process of my schematic see the following link for my schematic but before doing this I've read quite a lot on different bits of advice on completing the schematic properly before embarking on any routing.
With regards to the routing I've read up on main aspects such as the selection of the routing grid in relation to the trace width, avoiding dimension errors and avoiding clearance errors.
Regarding my schematic I've got two components with each having a pin that I do not need to connect to anything at all. I've followed different pieces of advice and realized there is no "not connected" library in Eagle hence I created mine as per the following link. I then connect this custom symbol to my IC pin but no connection takes place and when I run my ERC check I come across the following errors in relation to both pins:

*

*"No SUPPLY for POWER pin U1 TAB".

*"Unconnected INPUT pin IC1 ADJ".

Original image
In addition to the above problem, can anyone see any other issues with my schematic? Apart from the values of specific components which I intentionally deleted can anyone see any problem on my schematic that I might have not anticipated? Any help is appreciated.
Now moving on to the board routing (which BTW I undertook before realizing the above mentioned problem), I've come learn a lot in the recent days about the following things to watch out for when laying out components and subsequently undertaking the routing:

*

*Selection of the routing grid (in relation to the trace width): I have a routing grid of10 mil and in the DRC sizes setting I have a minimum trace width of 10mil.

*Selection of the trace width whilst watching out for current carrying traces.

*Avoiding dimension errors.

*Avoiding clearance errors.

The following link illustrates the placement of my components before I undertake manual routing and after but if need be auto routing. Just to mention in the image below I have already used the ratsnest tool

Original image
Can anyone please identify anything at all that would cause me a problem in any way? Again any help is appreciated as it would save me time and effort solving errors.

A: U$1 has a TAB on that back that is probably a heatsink. Check to see if it is ground-connected, high-voltage, or floating. I'm assuming its your voltage regulator. Make a big polygon pour around this tab for heat sinking. From experience, these can heat up a lot. The warning EAGLE is telling you is that the IC symbol is listed as a power input and wants either a ground symbol or a power symbol to be connected to this pin. It appears to be floating in your schematic. If the TAB is internally connected to ground, then add a connection to the ground pin and the warning will go away.
Generally, its always a good idea to stick a wire on an IC pin, give it a name, and then connect it to a test pin that you can put on your board later for debugging. This can greatly help you down the road and also make your unconnected warnings go away.


text:
Q: Windows: how to switch back from Scipy 0.14 to Scipy 0.8 I need MaxEnt for text classification in NLTK. Apparently this has been deprecated for Scipy after Scipy 0.8. As I really need to use MaxEnt and I don't understand what I found online about using scikit learn for the topic of text classification, I would like to switch back from Scipy 0.14 to Scipy 0.8.
I am using Windows and I don't really get how to do the switch back.
Can anybody help me out? Thank you!


text:
Q: Morphing  in HTML5 I have an input box
<input style="width: 570px;" id="storagememory" min="0" max="9999" type="text">

At first it might look odd, having a min and max in there.  But you see, I have the following Javascript that changes it thus:
document.getElementById('storagememory').addEventListener('blur', function()
{document.getElementById('storagememory').setAttribute('type','text');
 document.getElementById('storagememory').value = document.getElementById('storagememory').value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
});
document.getElementById('storagememory').addEventListener('focus', function()
{document.getElementById('storagememory').value = document.getElementById('storagememory').value.toString().replace(/\D/g,'');
 document.getElementById('storagememory').setAttribute('type','number');
});

So when the input is being focused on, it becomes an input/number.  This is so the min and max values are respected, and I get the UI up/down (both as buttons and as up/down keystrokes).  When the focus is lost, it becomes input/text so I can format it appropriately with comma separation on the thousands, millions, etc.
The problem lies when the input is focused in on, I lose the capability (Firefox 30.0) to type numbers into it.
My question is, how do I regain the ability to type numbers into this field without losing the ability to display non-numeric data when it's not being focused on?
The expected value of this field is an integer between 0 and 9999.  The integer is to show the proper comma separation if the value is above 999.  Decimals are not to be considered herein...as such I could very well put a parseInt() in the 'blur' to truncate any user-input that would generate a decimal point.
Thank you for reading, and for any constructive suggestions you may have on this topic.

A: If you don't have to use <input>, you might have some success using a
 with the contentEditable attribute set to true:
<!DOCTYPE html>

Of course, you'll have to implement some logic for the max and min constraints.

A: It seems that the issue comes from Firefox blurring the element when the type changes from text to number (probably it happens also from number to text, but it doesn't affect the element as it occurs on blur).
One possible solution for this would be to use a sentinel variable, so Firefox only blurs the element if the action that triggered the blur didn't come from the actions taken during the focus event.
How it would be done:

*

*Add one data- attribute (e.g.: data-focus) to the element. It will be used to keep track of when the input was focused.

*When the focus event is triggered, set that attribute's value to 1.

*When the blur event is triggered, check if the value of that attribute.

*

*If it is 0, the blur was just a regular event.

*If it is 1, the blur was caused by the input type change -> refocus the element (as the type is already number, it will not trigger the blur event again)

*At the end of the focus event, set the attribute's value to 0 to avoid getting stuck focusing the element.

The code would look like this (I hope you don't mind I simplified by using this instead of selecting the element each time, I think it makes the code a little bit more readable):

document.getElementById("storagememory").addEventListener("blur", function() {
    if (this.dataset.focus == 0) {
        this.type = "text";
        this.value = this.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    } else {
        this.focus();
    }
});

document.getElementById("storagememory").addEventListener("focus", function() {
    this.dataset.focus = 1;
    this.value = this.value.toString().replace(/\D/g,'');
    this.type = "number";
    this.dataset.focus = 0;
});
<input style="width: 570px;" id="storagememory" min="0" max="9999" type="number">

You can also see a working demo on this JSFiddle: http://jsfiddle.net/630gdcw4/4/


text:
Q: Pass array in directive attributes I want to pass array in the directive attribute. It doesn't work. I tried to pass an array in the attribute of a directive and nothing happened.

class Directive {
  constructor () {
    'ngInject';

    let directive = {
      restrict: 'E',
      template: '<div class="btn-group">
                   <label class="btn btn-primary classButton"
                          ng-model="radioModel" uib-btn-radio="'First'"
                          config="{{config[0]}}">{{config[0]}}
                   </label>
                 </div>',

      controller: Controller,
      controllerAs: 'vm',
      bindToController: true,
      scope: {
        config: '='
      }
    };

    return directive;
  }
}

class Controller {
  constructor() {
    'ngInject';
  }
}
<directive config="First, Second"></directive>

How should I pass the array to the directive?

A: Maksim,
You need to pass a scope variable instead of a array constant here,
That is, declare a scope variable and assign this value to that variable like this,
$scope.myArray = ['Firs', 'Second'];

and now you can pass this scope variable to your directive.
<directive config="myArray"></directive>

It should work !!!


text:
Q: Can we use .fit_transform() directly? from sklearn.preprocessing import MinMaxScaler()
scaler = MinMaxScaler()

can I directly do:
scaled_data = scaler.fit_transform(mymatrix)

without doing scaler.fit(mymatrix) first?
If not, why so? What is the difference? Doesnt scaler.fit_transform() function already compute the variance and mean values too before transforming?

A: As you can see in the docs  here you can, because fit_transform performs first a fit(), after that it applies a transform().


text:
Q: No Enough Space for Gitlab Backup I have a Gitlab server which I want to back up.
The problem I am facing is that I don't have enough disk space to do that.
What options do I have ?

A: You can backup to S3 or other cloud storage. But you will most likely have to make space for a single snapshot.


text:
Q: Why does git rebase require a 3-way merge? I'm trying to figure out why rebase requires a three-way merge. For instance, if we have
A1 - A2
 \
  B1

And I've checked out B1, and I want to perform:
git rebase A2

why does git merge A2, B1 AND A1? Why wouldn't A2 and B1 suffice? I mean, don't A2 and B1 as commit contain the complete current snapshot of the tree?

A: To perform a merge, Git needs to find out, what exactly happened in the two branches since the common ancestor (A1). As you have said correctly, Git stores snapshots of the commits/trees so to get an actual change set, it has to compare A2 to A1 and B1 to A1 and then merge those individual change sets.
The same thing happens in a rebase. To apply the change set of A2 on B1, we first need to calculate that change set from the differences between A1 and A2. And then we can apply that to B1. You can think of a rebase as something similar to an automated generation of patch files. First it generates all those patch files from the old branch and applies them then to the current HEAD.
So, we need all those three commits to actually calculate the differences, as we cannot figure out what happened in a commit just by looking at that commit.


text:
Q: Parsing in Python between 'in', '==' and 'is' I would like to understand how parsing in Python works. More specifically, how can these three statements give three different results :
0 in [0] is True
# returns False
(0 in [0]) is True
# returns True
0 in ([0] is True)
# raises TypeError

while only two different results are obtained with
1 == 1 is True
# returns False
(1 == 1) is True
# returns True
1 == (1 is True)
# returns False


text:
Q: Z-index for jumbotron Text parrallax Working on the container scrolling over the jumbotron however the text in the jumbotron is not hiding underneath the container beneath it on scroll. How do I get 'Main Title Goes Here', 'Subtitle' and the blue box with those elements to go under the container with lorem ipsum text. Tried setting z-index to -1 for the hero-text class but it hides the text and box all together.
https://codepen.io/zepzia/pen/JrwKbN

Main Title Will

Go Here

SUBTITLE

                <img width="40" height="40" alt="" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iNTEycHgiIGhlaWdodD0iNTEycHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0yOTMuNzUxLDQ1NS44NjhjLTIwLjE4MSwyMC4xNzktNTMuMTY1LDE5LjkxMy03My42NzMtMC41OTVsMCwwYy0yMC41MDgtMjAuNTA4LTIwLjc3My01My40OTMtMC41OTQtNzMuNjcyDQoJbDE4OS45OTktMTkwYzIwLjE3OC0yMC4xNzgsNTMuMTY0LTE5LjkxMyw3My42NzIsMC41OTVsMCwwYzIwLjUwOCwyMC41MDksMjAuNzcyLDUzLjQ5MiwwLjU5NSw3My42NzFMMjkzLjc1MSw0NTUuODY4eiIvPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTIyMC4yNDksNDU1Ljg2OGMyMC4xOCwyMC4xNzksNTMuMTY0LDE5LjkxMyw3My42NzItMC41OTVsMCwwYzIwLjUwOS0yMC41MDgsMjAuNzc0LTUzLjQ5MywwLjU5Ni03My42NzINCglsLTE5MC0xOTBjLTIwLjE3OC0yMC4xNzgtNTMuMTY0LTE5LjkxMy03My42NzEsMC41OTVsMCwwYy0yMC41MDgsMjAuNTA5LTIwLjc3Miw1My40OTItMC41OTUsNzMuNjcxTDIyMC4yNDksNDU1Ljg2OHoiLz4NCjwvc3ZnPg0K" />

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

A: The structure looks a little confusing, but if you dont want to rebuild the html you can add something like:
main {
    background-color: #fff;
    position: relative;
    z-index: 1;
    margin-top: -32px;
    padding-top: 32px;
}


text:
Q: Software and Tools for one person owned business My Girlfriend helps a bit, but for the most part, it's myself working.
I do transportation modeling, anywhere from modeling traffic flows, traffic impact studies, transit studies, safety impact studies, to transportation policy.
The tools I can't live without are:

*

*Ubuntu

*

*QGIS

*PostgreSQL and PostGIS

*Grass

*SKype

*Codeweaver that runs MsOffice 2007

*EDIT ADDED: PyDev/Eclipse

*EDIT ADDED: Gnome DO

*VirtualBox - Win Vista

*

*Microsoft Office 2007

*CAD and Transportation Software I use

*Adobe Acrobat

I currently do most if not all of the business work through Excel and Word. I live in Canada and I was wondering what are some of the products you use for business purposes: inventory, invoicing, tendering, backup, email logs, data interoperability.
What are some of the proprietary or open-source tools that'll make my life easier? The more tools and suggestions you mention, the better as I'm willing to try a solution at least once.
EDIT
Concerning the comment some of the issues I have difficulties with include:

*

*Optimize my project organization: in a lot of my projects, the input data is similar, but the clients and project are different, so a good file/project manager

*My invoice system is basically an excel workbook per year, and each tab represents a new invoice. The same goes to bids and inventory.

*I use Gnome Do for logging in project hours, but a lot of times, I forget to turn it on.

*I use PGadmin III to manage my postgresql, It'll be nice if there were addons to that.

*A good organization system, that is dedicated to organizing projects

I hope that answers the comment

A: If you open to using Gnome, have you considered GnuCash?  I've used it for myself, but my needs are very basic, so YMMV.  It's laid out according to the typical simple gnome style, but I found it very useful for invoicing especially.  Reads QIF if you're exchanging with quickbooks or your bank.
You can use it like you'd use a checkbook:

But you can orgainize you data any way you like:

A: Quickbooks or any accounting package...


text:
Q: CentOS partition reporting out of space I have CentOS server with 7 partitions and 2 of them are LVM partitions one is divided as 2 LVM partitions. While working with the production software the disk suddenly gets full in a folder that is stored in one of the LVM partitions that are together in one of the 7 normal partitions. My / partition is only 40G while the /somedir LVM partition is 250G of space, why is the system reporting disk full when the files in the LVM partition grow near the size of the / partition??
the df -h command throws:
/dev/sda2              39G  6,9G   30G  19% /
tmpfs                 3,9G  1,4M  3,9G   1% /dev/shm
/dev/mapper/vgdata-bcks
                      247G  172G   63G  74% /backups
/dev/sda1             485M  310M  151M  68% /boot
/dev/mapper/vgusers-home
                      386G  3,4G  363G   1% /home
/dev/sda5              14G   36M   13G   1% /tmp
/dev/mapper/vgdata-usrs
                      247G   30G  205G  13% /usr1
192.168.11.70:/data   2,0T  249G  1,8T  13% /mnt/SATANAS
//192.168.11.240/Spooler
                      233G   57G  177G  25% /mnt/Fiscaldir
//192.168.11.223/Catalogos
                       96G   44G   53G  46% /media/Catalogos
//192.168.11.204/compartidos
                       98G   42G   51G  46% /mnt/Reportes
/dev/sdb1             3,7T   31G  3,7T   1% /media/Seagate Backup Plus Drive

sorry it was not formatted before

A: I believe you've run out of inodes on the partition.
If you do df -i you will probably find the inode usage is 100%.

A: *

*First try to figure out if there is any error in the partition using "dmesg" command. If you find any error, and if you are not much familiar to fix the issue, a simple reboot may fix the issue.

*If it is truly a inode related issue, you may reduce your reserved space. It will give some space and also inode as well. (though it is not recommended for production environment. As soon as possible revert it back to 2% or 3%).
tune2fs -m 0 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting reserved blocks percentage to 0% (0 blocks)

*Find zero sized or unused files using find command and remove it after analyzing the files.

*If possible take backup of the entire file system and create filesystem again using the command,
mkfs.ext4 -i </dev/destination>

to specify the number of inodes and then restore the original contents into this.


text:
Q: Execution failed for task ':app:checkDebugDuplicateClasses' in ionic 3 app
This is my ionic info
And this is the error

I enter the commands in this sequence
cordova platforms add android
ionic cordova emulate android
and some times ionic cordova run android --device and connect a device with PC.

A: Installing this plugins cordova-plugin-androidx and cordova-plugin-androidx-adapter will solve this problem:
ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter


text:
Q: Elements of minimal length in normal closures of elements in free groups Let $F_n$ be a free group of rank $n$. Let $w\in F_n$ be cyclically reduced.

*

*What can be said about the element(s) of minimal length from the $\textit{ncl}(w)$ (normal closure of $w$ in $F_n$)? Under what conditions is it a trivial normal root of $w$ (i.e. is conjugate to $w^{\pm 1}$) ?

*Let $v, w\in F_n$ be cyclically reduced. What can be said about the element(s) of minimal length in $\textit{ncl}(w)\cap \textit{ncl}(v)$? Under what conditions is it a conjugate of $\[ v, w \]$?


text:
Q: custom address attribute with module: saving in admin and not in frontend i developed a module to add two new fields in costumer address. The fields are showing but not saving in frontend checkout procedure. The fields are showing also in the admin area and there they saves correctly.
Now, i don't know how to  debug this.
How can i check where the problem is in the frontend?
Thank you.
EDIT
Ok, now i understand that my two custom attributes (codice_sdi and indirizzo_pec) are not saved in the shippingAddress javascript object. I've seen this using console.log.
Any ideas?

A: Below is the best document for your requirement.
https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_new_field.html

Thanks


text:
Q: Cron job not running I have a python script running as a service on Ubuntu11.10. I need to stop the service and then restart it again every 6 hours. I wrote the cronjob and just to check its working, i am stopping and starting the service every 5 mins. Following is the line in my crontab:
*/5 * * * * stop server && start server

I have written the above line in root's crontab. But its not working at all. From CLI the root can stop and start the server absolutely fine. But on automating it using cron, it's not working. Any ideas what I am doing wrong?
Referred the following page for the cronjob syntax.
Referred this as well, but didnt worked for me.

A: Have you tried using the full path to the stop and start executables?
What do you see in /var/log/cron.log?


text:
Q: Is it better to use the UK or USA server? I live in the UK, so it should be better to use the UK ones. But, the USA one is more likely to be well maintained and have the better connection speed.
Which should I use - is there a testing tool, either built in or installable?
I, personally, would prefer a GUI method over command line.

A: There is a built in utility in Ubuntu to find the best server.
Click on the drop down to change the server.

Scroll up to the top and select the top one (mirrors.ubuntu.com). Then click Select Best Server.

Wait for the tests to finish (about 45 seconds).

It will select the best one for you. Click Chose Server.

Enter your password. It will have changed.


text:
Q: Is there a way to turn off one Monitor in a Multiheaded setup like dpms force off does for all at once? I have a multi-screen computer with serveral monitors. Some of the monitors are also connected to other computers. I want to explicitly switch off the signal to one of the monitors without changing the desktop layout and without switching off the other monitors to force the monitor to pick the other signal.
As a workaround I do "xset dpms force off" on my multiscreen machine and then the other machines I do not want to take over the screen.
Is there a way to turn one monitor off in a dual-head setup? wanted to have his windows moved to the other screen. xrandr --output $NAMEOFDISPLAY --off would at least temporarily move my windows until I set my proper xrandr setting again.

A: You can use ddccontrol to control dpms on individual monitors – without modifying the virtual desktop (→ moving windows etc.).
Run
ddccontrol -p

to get your monitor's addresses, e.g. dev:/dev/i2c-5.
You can then run
ddccontrol -r 0xd6 -w 4 dev:/dev/i2c-5

which should turn your monitor into standby mode.
4 is the VESA standard value, but on my monitor, for example, I need to use 5 for off. The ddccontrol-db might help with finding the correct number.

In summary, I got it working a few minutes ago, so this solution is probably not perfect, but it shows that it's absolutely possible to turn off a monitor without changing the virtual desktop.
ddcutil probably works as well, but I have not tested that.

A: i know no way of turning just one monitor off without affecting the desktop layout, as with xrandr, the desktop is really just one big screen. if you could turn one monitor off, some output might still be used on that part of the desktop that is in the power down monitor, creating hidden content. But with the increase of multihead setups, this might be a good time to revive the X11 bug about this: X11 bug #1658
I personally use the "KISS method": i press the monitor power button when i don't need it, and press it back when i do.


text:
Q: Schedule a job in android to run at a specific time I have an Android application which needs to send backup data every midnight to my cloud server. For this I need to schedule the job to occur every 24 hours without fail. I have read about AlarmManager and JobScheduler class which can schedule your jobs effectively.
In my case I am using JobScheduler class and here is my scheduleJob() method which sets a job to schedule after every 86400000 milliseconds (ie. one day).
@RequiresApi(api =Build.VERSION_CODES.LOLLIPOP)
public void scheduleJob(View v){
    JobInfo.Builder builder = new JobInfo.Builder(1,new ComponentName(this,JobSchedule.class));
    builder.setPersisted(true);
    builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
    builder.setPeriodic(86400000);
    builder.setRequiresCharging(false);
    builder.setRequiresDeviceIdle(false);
    builder.setBackoffCriteria(10000,JobInfo.BACKOFF_POLICY_EXPONENTIAL);

    int test = jobScheduler.schedule(builder.build());
    if(test <= 0){
        //sth went wrong
    }

}

My question stands is, from where and how should I implement jobSchedule() so that I can get the script to run exactly at 12 midnight.
Also, if I call scheduleJob method from, say, Android's Activity XYZ's onCreate() method, then everytime the Activity XYZ  is called, it's override method onCreate() will be called and an additional job will be scheduled. So what should I do and from where should I schedule the job such that only one job is scheduled for the entire lifetime of the application?
To summarize using an example, Whatsapp backs up its data every day at 2 am. Even if I have turned off my net connection, it backs up my data as soon as I come online. I want to implement similar functionality in my application.

A: You can use SharedPreference to implement one-time execution. Something like this
SharedPreferences wmbPreference = PreferenceManager.getDefaultSharedPreferences(this);
boolean isFirstRun = wmbPreference.getBoolean("FIRSTRUN", true);
if (isFirstRun)
{
    // Code to run once
    SharedPreferences.Editor editor = wmbPreference.edit();
    editor.putBoolean("FIRSTRUN", false);
    editor.commit();
}

A: According to the documentation JobInfo Builder, setRequieresCharging and setRequieresDeviceIdle are set false by default, so you dont need to set them up false.


text:
Q: android : custom progress bar I want to create Custom ProgressBar with style Spinner as below:

I have tried following way to achieve this:
layout.xml
<ProgressBar
        android:id="@+id/pb_capture_video"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_centerInParent="true"
        android:indeterminate="false"
        android:max="60"
        android:indeterminateDrawable="@drawable/layer_list_progress_bar_background"
        android:progress="30"
        android:progressDrawable="@drawable/layer_list_progress_bar_foreground"/>

layer_list_progress_bar_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
    <shape android:shape="oval">
        <stroke
            android:width="1dp"
            android:color="@android:color/white" />
    </shape>
</item>

layer_list_progress_bar_foreground.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/progress">
    <shape android:shape="oval">
        <stroke
            android:width="1dp"
            android:color="@color/colorAccent" />
    </shape>
</item>

But, I not able to display progress. Output of my code is as below:

Am I going wrong somewhere ? Is there anyway I can achieve what I want ?
If it seems this is not the right way, please suggest me some another.

A: Its not that simple as you think of. You have to make use of animation in Java. Here is a solution.


text:
Q: CakePHP 3 - How to add to an already set view var of type array I'm building a RESTful API which is returning a JSON response. When setting the view vars in the controller, is there a way to explicitly set elements of an array variable which already exists?
For example, let's say the AppController sets a view var which is an array:
$this->set('myArray', array('foo' => 'bar'));

But then in the child controller MyController I want to add to that array. Something like:
$this->set('myArray.add', 'New Element');

So that the JSON response for the view will be:
{
    "myArray": {
        "foo": "bar",
        "add": "New Element"
    }
}

I'm guessing it can be done in a roundabout way by storing the array as a normal PHP property of the AppController class, and then adding to the array in the child controller before finally doing $this->set() once at the end of the controller action.
But I'm curious if there is a way to do this through the Controller::set() method alone.

A:
But I'm curious if there is a way to do this through the Controller::set() method alone.

No. In such a case reading the code is always a good idea. This would have answered your question.
See http://api.cakephp.org/3.2/source-class-Cake.View.ViewVarsTrait.html#129
Implement a method like setMerge() that does what you want or directly array_merge() your data into the viewVars property in your controller.


text:
Q: 'Payload file does not exist' What does this mean? I'm trying to draw some graphs in a windows 8 app.
So I downloaded this:
http://modernuitoolkit.codeplex.com/
I then right clicked my project, clicked add reference and navigated to the .dll file.
But when I try and build the project I get loads of these type of errors:

Error 18  Payload file 'c:\users\mark\Desktop\ChartingTest\ChartingTest\ModernUI.Toolkit.Data.Charting\Charts\Series\LineSeries.xaml' does not exist. App1
Error 15  Payload file 'c:\users\mark\Desktop\ChartingTest\ChartingTest\ModernUI.Toolkit.Data.Charting\Charts\Series\DataPointSeries.xaml' does not exist.    App1
Error  16  Payload file 'c:\users\mark\Desktop\ChartingTest\ChartingTest\ModernUI.Toolkit.Data.Charting\Charts\Series\DefinitionSeries.xaml' does not exist.   App1
Error 17  Payload file 'c:\users\mark\Desktop\ChartingTest\ChartingTest\ModernUI.Toolkit.Data.Charting\Charts\Series\LegendItem.xaml' does not exist. App1

That is just a few of them. They seem to be releated to Xaml.
Thanks.

A: As the other answers suggest, creating the appropriate directory and moving the generated .xr.xml file does work, however,

The correct solution for this is to,

*

*Open the Project Properties (via right clicking the project within the Solution Explorer, or focusing on the project and pressing Alt + Enter.

*Navigate to the Build section (as of VS 2017, via the sidebar)

*Check the Generate Library Layout checkbox under the Output group.

...upon doing which Visual Studio will generate the necessary directory and file structure for you.

A: To workaround this, go to the DLL output folder (e.g. bin\Release), create a new folder named like your DLL-Name (e.g. MyUserControlLibrary) and move the XAML files down to this folder.
bin\Release\
  MyUserControlLibrary.dll
  MyUserControlLibrary.pri
  MyUserControlLibrary\ [folder] <-- create
       UserControl1.xaml         <-- move here
       UserControl2.xaml         <-- move here

A: Though both answers are correct, I found them confusing at first. Here's my attempt to clarify.
The referenced .dll depends on files and it expects them in the folder it is sitting in. Those files are missing and you need to manually arrange the folders and files it needs:

*

*Go to the folder where the .dll is. If you copied it, go to where you first found the .dll.

*You should find some familiar resource files next to the .dll. Your .dll wants them, but the folder structure is wrong.

*Move them, as seen in the error messages. Most likely, you only need to create a folder and copy an existing folder structure into it.

A: Managed to fix it by just moving the folder to the directory it wanted...

A: OK so ALL of these answers are quite useless and confusing.
I have trouble with the package Acr.UserDialogs so I searched google and came across this page on github: Build Failed while compiling UWP in Xamarin.Forms Project
it basically says this:

It is Acr.UserDialogs.xr.xml Manually copying it under Acr.UserDialogs
  Folder works for me.

So basically go and find the file it is looking for. It won't be there (hence the error message) but in my case it was in the folder before, so I manually created the folder it wanted and dragged and dropped the file in.
Error sorted.

A: I got this exception sometimes when I had a reference to a shared project.
When you move (cut/paste) some items from this project to other locations the *.projitems is not adjusted correctly hence the error.
Manually removing these lines solves the issue.


text:
Q: Initialize an array of a class in a constructor I have a class Garage that has a property which is an array of type Car, which is another class in the program. I've tried several iterations and get run-time errors on most of them. I get a NullRefernceException whenever I try to run it. This happens in the Program class where I try to access the length property of the CarLot array.
I know this has something to do with the CarLot property of the Garage class being an array instead of just Car. What piece am I missing here so that the array isn't set to null when the program tries to use it?
class Program
{
    static void Main(string[] args)
    {
        Garage g = new Garage();
        //this is where the exception occurs
        g.CarLot[0] = new Car(5, "car model");
        Console.ReadLine();
    }
}

public class Garage
{
    public Car[] CarLot { get; set; }
    public Garage() { }
    //this should be able to be 0 or greater
    public Garage(params Car[] c)
    {
        Car[] cars = { };
        CarLot = cars;
    }
}

public class Car
{
    public int VIN { get; set; }
    public int Year { get; set; }
    public string Model { get; set; }
    public Car(int _vin, string _model)
    {
        _vin = VIN;
        _model = Model;
    }
    public Car() { }
    public void Print()
    {
        Console.WriteLine("Here is some information about the car {0} and {1} ");
    }
}

A: Instead of using an auto property for your array, you can use a private variable to initialize your array when your parameterless constructor is called in Main.
e.g.
private Car[] carLot = new Car[size];
public Car[] CarLot
{
     get { return carLot; }
     set { carLot = value; }
}

Alternatively, in your parameterless constructor for Garage you can go ahead and initialize the array at that point.
Either way, your array has to be instantiated before you can assign values to it.
http://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx

A: I know it's not the exact thing you're asking for, but how about something like this ? Wouldn't it be much easier ?
    static void Main(string[] args)
    {
        var garage = new List<Car>();
        //this is where the exception occurs
        garage.Add(new Car(5, "car model"));
    }

    public class Car
    {
        public int VIN { get; set; }
        public int Year { get; set; }
        public string Model { get; set; }
        public Car(int _vin, string _model)
        {
            _vin = VIN;
            _model = Model;
        }
        public Car() { }
        public void Print()
        {
            Console.WriteLine("Here is some information about the car {0} and {1} ");
        }

    }


text:
Q: Compressing an image-data string returned by captureVisibleTab (chrome api) and then edited by Konva I have an extension which's taking a screenshot of a browser's tab. Later on, using Konva I'm editing the image and saving it in the following way:
When I print the image, it appears as the following:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABaAAAAOECAYAAABXTZbSAAAAAXNSR0IArs4c6QAAIABJREFUeF7snQeYJVWZ/t+quqnTJHKOgiQDSpiRICqKoitmzKvuuu7fALrrBjO7BgTDmuMGd03rGjEAMiQFUZSkiIKA...

and it continues with 587346 characters in total.
I'm attempting to compress the image. I was thinking of doing it using sharp, but it seems like they're not receiving image data string.
Any ideas how should I approach this?
Below is the component which was passed with the captureVisibleTab's return value (img data string):
// @ts-nocheck
import React from 'react';
import { Stage, Layer, Line, Image } from 'react-konva';
import { useState, useRef } from 'react';
import useImage from 'use-image';
import { Button, Stack, IconButton, Toolbar } from '@mui/material';
import useStackState from "@rooks/use-stack-state";

//import GestureIcon from '@mui/icons-material/Gesture';
import UndoIcon from '@mui/icons-material/Undo';
import RedoIcon from '@mui/icons-material/Redo';
import SaveIcon from '@mui/icons-material/Save';

type Props = {
    imgSrc: string,
    finishedEditing: (editedImg: string) => void;
}

function DrawingArea(props: Props) {
    const imgSrc = props.imgSrc;
    const finishedEditing = props.finishedEditing;

    const [lines, setLines] = useState<any[]>([]);
    const isDrawing = useRef(false);
    const [image, imageSet] = useImage(imgSrc);
    const [toRedo, toRedoSet] = useState(false);
    const [toUndo, toUndoSet] = useState(false);
    const [undoList, undoControls, undoStack] = useStackState([])
    const { push, peek, pop, length } = undoControls;

    const handleMouseDown = (e: any) => {
        isDrawing.current = true;
        const pos = e.target.getStage().getPointerPosition();
        setLines([...lines, { points: [pos.x, pos.ay] }]);
    };

    const handleRedo = () => {
        if (length === 0) {
            console.log("empty stack - no redos");
            return;
        }
        const elementToRedo = pop();
        setLines((lines) => {
            lines.push(elementToRedo)
            return lines;
        })
    };

    const handleClear = () => {
        if (lines.length === 0) return;
        setLines((lines) => {
            lines = [];
            return lines;
        })
        // need to empty redoStack
    }

    const handleUndo = () => {
        if (lines.length < 1) return //empty lines - no undo action needed.
        console.log(lines);
        console.log(lines.length);
        //pop into the stack
        const poppedElement = lines[lines.length - 1];
        undoControls.push(poppedElement); // for the redos
        setLines((lines: any[]) => {
            lines.pop();
            return lines;
        })
    };

    const handleMouseMove = (e: any) => {
        // no drawing - skipping
        if (!isDrawing.current) {
            return;
        }
        const stage = e.target.getStage();
        const point = stage.getPointerPosition();
        // To draw line
        let lastLine: any = lines[lines.length - 1];
        if (lastLine) {
            // add point
            lastLine.points = lastLine.points.concat([point.x, point.y]);

            // replace last
            lines.splice(lines.length - 1, 1, lastLine);
            setLines(lines.concat());
        }
    };

    const handleMouseUp = () => {
        isDrawing.current = false;
    };

    const stageRef = useRef(null);

    const handleSave = async () => {
        const dataURL = await stageRef.current.getStage().toDataURL();
        console.log(dataURL);

        finishedEditing(dataURL);
    }

    return (
        <Stack>
            <Stage
                width={window.screen.width}
                height={window.screen.height}
                onMouseDown={handleMouseDown}
                onMousemove={handleMouseMove}
                onMouseup={handleMouseUp}
                className="canvas-stage"
                ref={stageRef}
            >
                <Layer>
                    <Image image={image} />
                    {lines.map((line: any, i: number) => (
                        <Line
                            key={i}
                            points={line.points}
                            stroke="#df4b26"
                            strokeWidth={2}
                            tension={0.5}
                            lineCap="round"
                            globalCompositeOperation={
                                line.tool === 'eraser' ? 'destination-out' : 'source-over'
                            }
                        />
                    ))}
                </Layer>
            </Stage>

            <Toolbar sx={{ alignItems: "center" }}>
                <IconButton onClick={() => { toUndoSet(!toRedo); handleUndo(); }}> <UndoIcon /> </IconButton>
                <IconButton onClick={() => { toRedoSet(!toRedo); handleRedo(); }}> <RedoIcon /> </IconButton>
                <IconButton onClick={handleSave}> <SaveIcon /> </IconButton>
                <Button variant="contained" sx={{ width: "fit-content", alignItems: "flex-end" }} onClick={handleClear}>Clear</Button>
            </Toolbar>
        </Stack>
    )
}

export default DrawingArea

Regards :_)


text:
Q: CListCtrl::GetSelectedColumn() function in C++ not working as expected in Windows 10 OS We have been doing some development using the CListCtrl Class. Things are working fine in Windows 7 but it is giving some strange behavior in Windows 10 os. I am trying to achieve something very simple here.I have a function let's say funSelect the code snippet looks like this
//this Function is trying to copy the selected column holding by the CListCtrl object
funcSelect()
{
/* The first Step where I am calling the GetSelectedColumn() function to get the selected column which is part of the CListCtrl class */
int iselectedCoulmn = CListCtrlObj.GetSelectedColumn();
// If no column is selected windows 7 will return -1 where Windows 10 is returning 0
//based on the value -1 the rest of the code is written. But in Win 10 it is giving as 0 . So the code is not hitting and creating problems
}
I did check all the settings like manifest file and it is using ComCtl32.dll version 6 properly Also it is using SDK Ver 10 and I have checked the VS2015 set up I can see all the SDK includes are properly set up. So all these things are in place.
Can someone please throw Some light why this API GetSelectedColumn() is returning 0 instead of - 1. Has anything changed for this API for Windows10?
The correct behavior is it should get -1 when no column is selected. Even the MSDN documents say that. Is there any alternative way of achieving the GetSelectedColumn() but more in platform independent and generic way?
Any function or Code snippet will highly help.
Also as an FYI in the manifest file we did introduce the compatibility tag so that it can call the native API, but even after that there is no change in GetSelectedColumn() return value. It still returns 0 instead of -1.
Just as an FYI the below has been added into the manifest files
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!-- Windows 10 -->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
            <!-- Windows 8.1 -->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!-- Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        </application>
    </compatibility>

I will really appreciate if some can throw more light on this and if somebody has encountered the same issue then how did they resolve it. Any snippet or Function which one can do the job please let me know. I will really appreciate if I can get some reply at the earliest
Thanks - Yan


text:
Q: How would I display selected row on a new work sheet?
Possible Duplicate:
How to edit info in cells displayed via macro code in Excel?

I'm just a bit stumped.
I have a large excel table with quite a few columns. The first column item is a 'company name' and then the other columns contain details such as 'website', 'contact name', 'email address', 'query', 'comments' etc etc.
It's a bit confusing and difficult scrolling all the way to the right to see the info in the columns at the end.
I was wondering if there would be any way I could maybe take all the info from a single row and display it on sheet two? Perhaps displaying it vertically, so that I wouldn't have to scroll to the right to see all the company details.
What I would like, is to be able to look through the main spreadsheet to find a 'company name' and then maybe if I click on that company name, all the info from that row would show up in a nice table on sheet two.

A: There are some ways to do it, let's see if one of them fits your needs:

*

*Freeze pane: Click in cell B1 and then 'view / freeze pane'.

*Split: It will split (duh) your spreadsheet.

I believe one of these might fit your request. hope it helps!
Rgds
Edit: Similar question HERE.


text:
Q: sort files by their name in php How can I sort files inside a directory by their file name using PHP ? I have many files inside a directory and I have to list them sorted by name in a page.

A: Store filenames into an array and sort it.

A: store files inside array and sort by file name or use scandir() http://uk3.php.net/manual/en/function.scandir.php


text:
Q: jQuery nth child Is it possible to get jQuery to do the same job as nth:child(odd)?
So that I can add zebra lines to tables in browsers like IE6?
If so can someone help?

A: You are using the wrong syntax: $(":nth-child(odd)") or shorter $(":odd")
http://api.jquery.com/odd-selector/
http://api.jquery.com/nth-child-selector/

A: $("tr:nth-child(odd)").addClass("odd_row");

A: You can use the :odd selector to select odd table rows, like so:
$("tr:odd").css("background-color", "#DDD");

A: Just do ("table tr:odd") or ("table tr:even"). Try using http://api.jquery.com where most of these types of questions are answered.

A: $('.class:nth-child(odd)')...;

http://api.jquery.com/nth-child-selector/


text:
Q: Android sets different layout to AppWidget I have a very weird problem with my AppWidget in Android 4.1.1. I'm currently developing a music player application and its widget. Widget must be updated when song changes, player starts and stops. It has a ListView which must be in sync with playlist in application.
Prior to Jelly Bean everything was working fine. After my test device is upgraded from 4.0.3 to 4.1.1, whenever widget is programmatically forced to update, layout of Android's Messaging widget is set to my widget for a few seconds! I also checked this case in emulator with 4.1, which works fine.
I use that piece of code to force my widget to update:
AppWidgetManager man = AppWidgetManager.getInstance(applicationContext);
int[] ids = man.getAppWidgetIds(
        new ComponentName(applicationContext, MuzikLargeWidgetProvider.class));
Intent updateIntent = new Intent();
updateIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
applicationContext.sendBroadcast(updateIntent);

And here is my onUpdate method
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
        int[] appWidgetIds) {
    this.context = context;
    this.appWidgetManager = appWidgetManager;

    ComponentName thisWidget = new ComponentName(context,
            MuzikLargeWidgetProvider.class);
    int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);

    for (int appWidgetId : allWidgetIds) {
        Intent svcIntent = new Intent(context, UpdateService.class);
        svcIntent.putExtra(WidgetActions.DATA_WIDGET_ID, appWidgetId);
        context.startService(svcIntent);
    }

    super.onUpdate(context, appWidgetManager, appWidgetIds);
}

I'm using a service (UpdateService), which is a static inner class, to update my widget:
public static class UpdateService extends IntentService {

    public UpdateService() {
        super("UpdateService");
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    public RemoteViews buildUpdate(Context context, int widgetId) {

        final RemoteViews views = new RemoteViews(context.getPackageName(),
                R.layout.muzikwidget_large);

        return views;
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        // Build the widget update
        RemoteViews updateViews = buildUpdate(this, intent.getIntExtra(WidgetActions.DATA_WIDGET_ID, 0));

        // Push update for this widget to the home screen
        ComponentName thisWidget = new ComponentName(this, MuzikLargeWidgetProvider.class);
        AppWidgetManager manager = AppWidgetManager.getInstance(this);
        manager.updateAppWidget(thisWidget, updateViews);
    }
}

buildUpdate method does a few more things (setting intents for widget's buttons, setting textviews, etc.) but they are not related with my problem. I'm having this problem on a Asus TF 300 TG tablet (not rooted).
Any help is appreciated.

A: The problem is resolved. I modified the code piece which I use to force widget to update. This is working:
AppWidgetManager man = AppWidgetManager.getInstance(applicationContext);
int[] ids = man.getAppWidgetIds(
        new ComponentName(applicationContext, MuzikLargeWidgetProvider.class));

for (int appWidgetId : ids) {
    Intent svcIntent = new Intent(applicationContext, UpdateService.class);
    svcIntent.putExtra(WidgetActions.DATA_WIDGET_ID, appWidgetId);
    applicationContext.startService(svcIntent);
}

Widget's onUpdate method is not called and UpdateService is invoked directly. It seems like sendBroadcast should be avoided sometimes.
EDIT
If you need to use broadcast to update your widget, this seems to be a proper way to accomplish that:
AppWidgetManager man = AppWidgetManager.getInstance(applicationContext);
int[] ids = man.getAppWidgetIds(
        new ComponentName(applicationContext, MuzikLargeWidgetProvider.class));
Intent updateIntent = new Intent(applicationContext, MuzikLargeWidgetProvider.class);
updateIntent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
applicationContext.sendBroadcast(updateIntent);


text:
Q: Create Custom mapping type in Elasticsearch 7.3.2 using node js When I am doing custom mapping using kibana its working properly but when I am doing the same thing in my node program its showing mapper parsing exception.
Reason:Root mapping definition has unsupported parameters:tags(custom mapping name)
Because in kibana i am able to use include_type_name =true but in my node program it is not available.
        var name = req.body.templatename;
        var index_patterns = req.body.index_patterns;
        console.log(index_patterns);
        const opts: IndicesPutTemplateParams = {
            name: name,
            body: {
                index_patterns: [index_patterns],
                settings: {
                    analysis: {
                        filter: {
                            autocomplete_filter: {
                                type: "edge_ngram",
                                min_gram: 1,
                                max_gram: 20
                            }
                        },
                        analyzer: {
                            autocomplete: {
                                type: "custom",
                                tokenizer: "standard",
                                filter: [
                                    "lowercase",
                                    "autocomplete_filter"
                                ]
                            }
                        }
                    }
                },
                mappings: {
                    tags: {
                        properties: {
                            name: {
                                type: "text",
                                analyzer: "autocomplete",
                                search_analyzer: "standard"
                            },
                            normalized: {
                                type: "text"
                            },
                            status: {
                                type: "text"
                            },
                            createdat: {
                                type: "date"
                            },
                            updatedat: {
                                type: "date"
                            }
                        }
                    }
                }

            }
        }
        try {
            esClient.indices.putTemplate(opts).then((data: any) => {
               return res.json({
                   data
               });
                console.log(data);
              }).catch((err: any) => {
                console.log(err);
                res.status(500).json({
                    err
                })
            });
        } catch (error) {
            res.status(500).json({
                error
            })
        }
    }```

A: As Per documentation you need to give include_type_name as
client.indices.putTemplate({
  name: string,
  include_type_name: boolean,  --->
  order: number,
  create: boolean,
  timeout: string,
  master_timeout: string,
  flat_settings: boolean,
  body: object                -> mapping object
})

Or you can drop mapping name tags from mapping
  mappings: {
                    tags: {  ---> remove


text:
Q: How should a constructor act when given invalid parameters? If a class has a constructor which takes some value object as parameter and relies on this to do its initialization. How should it react if this object is null?
class SomeClass
{
    private SomeData _data;
    public SomeClass(SomeValueObject obj)
    {
        _data = obj.Data;
    }
}

This is one example, but in general: How should a constructor act if it is given invalid parameters and therefore cannot do the construction properly? Should it just return without doing any initialization? Set the parameters to some default values? Throw an exception? Something else?
I'm sure the answer to this is "It depends", but are there any best practices etc?

A: A lot depends on your business logic. If your business logic requires SomeValueObject to be not null, meaning SomeClass could not be instantiated without SomeValueObject then the constructor should definitely throw an Exception, probably IllegalArgumentException.

A: Seems like this is Java, but in C++ it should definitively throw ( a std::invalid_argument even ).
See C++ FAQ Lite 17.2.
I guess that for Java it's exactly the same.
In the rare cases where throwing exceptions presents a too big of a overhead, you should return, and set a flag in the object that it didn't construct properly. Afterwards check a isValid() member function.

A: Throw a null argument exception.

A: A programmer should be able to assume an object was successfully created, unless an exception is raised.  The type of exception depends on the argument, but should nonetheless be unchecked.  The last thing you want is the constructor fail to build a valid object and not tell the caller about it.
I think using default values in a constructor is a dangerous habit.

A: If field is critical it should cast an exception to indicate that object shouldnt be used. If its not critical you can assign default values.

A: If an object can have invalid default values, then it should initialize to the default values and wait for initialization. E.g., foo.set_values(...). In this case, there should be a query of is_ready() or is_valid() to allow checking before use.
If an object can absolutely not be in an invalid data-state, then it should throw an exception.
Both of these cases are things I've encounted.


text:
Q: Is JavaScript test() saving state in the regex? Open up a browser console and execute the following code:
var foo = /foo/g;

Then,
foo.test("foo") // true

Then,
foo.test("foo") // false

If you continue to execute foo.test("foo"), you will see alternating true/false responses as if the var foo is actually being modified.
Anyone know why this is happening?

A: Yes, that's how .test() and .exec() work when the regex is g global. They start at the end of the last match.
You can observe the current last index on the regular expression object using the .lastIndex property.
It's a writeable property, so you can reset it to 0 when/if you need. When the regex is run without finding a match, it automatically resets to 0.

A: The regex keeps the position of the last test. This allows searching of long strings. You can reset this by setting lastIndex = 0;