text:
Q: Make Content visible when UITableView is selected I'm using this method to enlarge the height of my cell when it is selected.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  [tableView beginUpdates];
  [tableView endUpdates];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  if([indexPath isEqual:[tableView indexPathForSelectedRow]]) {
      return 100.0;
  }

  return 44.0;
}

I want to display a UIImageView in the area that is only visible when the cell is enlarged and I want it to be hidden when the cel is deselected.

A: Your code looks correct for enlarging the cell.
You can also do the same by following below mentioned steps as well -
1) Add a property to keep track of the selected cell
@property (nonatomic) int currentSelectedRow;

2) Initialize it with a value
self.currentSelectedRow = -1;

3) Return cell height
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     if([indexPath row] == self.currentSelectedRow) {
          return 100.0;
 }

     return 44.0;
}

4) Set the selected row in cell selection method
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
        // code to do on cell selection

        // set the row number of current selected cell
        self.currentSelectedRow = indexPath.row;

        // animate the selected row
        [tableView beginUpdates];
        [tableView endUpdates];
}

5) Set the selected row to invalid row number(-1) in cell deselection method
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{

        // invalid row number
        self.currentSelectedRow = -1;

        // animate the selected row
        [tableView beginUpdates];
        [tableView endUpdates];
}

Note: It is just a sample code, you can customize it as per your requirements.

A: Here is simple example
NSInteger selectedIndex;

- (void)viewDidLoad
{
   [super viewDidLoad];
   // Do any additional setup after loading the view, typically from a nib.

    UITableView *tbl=[[UITableView alloc]initWithFrame:CGRectMake(0, 75, 320, 300)];
    [tbl setDelegate:self];
    [tbl setDataSource:self];
    [self.view addSubview:tbl];

    selectedIndex=-1;
 }

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
   return 8;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   UITableViewCell *cell=[[UITableViewCell alloc]init];

   UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, 70, 40)];
   [lbl setText:@"cell"];
   [cell addSubview:lbl ];

    UIImageView *imgVw=[[UIImageView alloc]initWithFrame:CGRectMake(100, 6, 50, 30)];
   [imgVw setBackgroundColor:[UIColor clearColor]];
   [imgVw setTag:400+indexPath.row];
   [imgVw setAlpha:0.0];
   [cell addSubview:imgVw];

   return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

   UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];

   [tableView beginUpdates];

   UIImageView *imgVwCellBg=(UIImageView*)[cell viewWithTag:400+indexPath.row];

   if (selectedIndex==indexPath.row)
   {
      selectedIndex=-1;
      [imgVwCellBg setAlpha:0.0];
   }
   else
   {
      selectedIndex=indexPath.row;
      [imgVwCellBg setBackgroundColor:[UIColor brownColor]];
      [imgVwCellBg setAlpha:1.0];
   }

   [tableView endUpdates];
}

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
   UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath];
   UIImageView *imgVwCellBg=(UIImageView*)[cell viewWithTag:400+indexPath.row];

   selectedIndex=-1;

   [imgVwCellBg setAlpha:0.0];

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

   if(selectedIndex==indexPath.row)
   {
      return 100;
   }
   else
   {
      return 44;
   }

}

A: Try this once
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    if (cell == nil) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"identifier"];
    }

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 5, 200, 0)];
    [imageView setTag:1000];
    [imageView setImage:[UIImage imageNamed:@"Image_2"]];
    [cell addSubview:imageView];

    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];

    [tableView beginUpdates];
    UIImageView *imageView = (UIImageView *)[cell viewWithTag:1000];

    if (selectedIndex==indexPath.row)
    {
        selectedIndex=-1;
        [UIView animateWithDuration:0.4 animations:^{
        [imageView setFrame:CGRectMake(20, 5, 200, 0)];
        }];
    }
    else
    {
        selectedIndex = indexPath.row;
        [UIView animateWithDuration:0.4 animations:^{
        [imageView setFrame:CGRectMake(20, 5, 200, 170)];
        }];
    }
    [tableView endUpdates];

}

- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];

    [tableView beginUpdates];

    [UIView animateWithDuration:0.4 animations:^{
    UIImageView *imageView = (UIImageView *)[cell viewWithTag:1000];
    [imageView setFrame:CGRectMake(20, 5, 200, 0)];
}];

    [tableView endUpdates];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(selectedIndex == indexPath.row)
    {
        return 200;
    }
    else
    {
        return 75;
    }
    return 0;
}

A: I think problem maybe isEuqal: method for NSIndexPath, not like NSString, you can't just user isEuqal: to judge NSIndexPath is equal.
  if([indexPath isEqual:[tableView indexPathForSelectedRow]]) {

replace with
NSIndexPath *selectedPath = [tableView indexPathForSelectedRow];
if(selectedPath.row == indexPath.row && selectedPath.section == indexPath.section){

A: Ok so Here is what i have done, using all you have given me and doing it
 @property (nonatomic) int currentSelectedRow;
- (void)viewDidLoad {
[super viewDidLoad];
self.currentSelectedRow = -1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString * cellId = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
UIImageView *contentView = (UIImageView *)[cell viewWithTag:304];
contentView.hidden = YES;

return cell;

}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
self.currentSelectedRow = indexPath.row;

[tableView beginUpdates];
UIImageView *contentView = (UIImageView *)[cell viewWithTag:304];
contentView.hidden = NO;

if (_currentSelectedRow == indexPath.row)
{

    [UIView animateWithDuration:0.4 animations:^{

        [contentView setFrame:CGRectMake(20, 5, 200, 0)];
    }];
}
else
{
    _currentSelectedRow = indexPath.row;
    [UIView animateWithDuration:0.4 animations:^{
        contentView.hidden = NO;
        [contentView setFrame:CGRectMake(20, 5, 200, 170)];
    }];
}

[tableView endUpdates];

}
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
UIImageView *contentView = (UIImageView *)[cell viewWithTag:304];
contentView.hidden = YES;

// invalid row number
self.currentSelectedRow = -1;

// animate the selected row
[tableView beginUpdates];
[tableView endUpdates];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if([indexPath row] == self.currentSelectedRow) {
    return 100.0;
}

return 44.0;
}

Thanks to all your input
Be sure to vote up the question it will help many


text:
Q: Laravel define default layout from controller in good way I googled two hours, but not found answer. Maybe you can help.
When I define in MyController:
class MyController extends Base_Controller {
    public $layout = 'layouts.default';

    public function get_index() {
        $entries = Entry::all();
        return View::make('entries.index')
            ->with('entries', $entries);
        }
    }
}

In entries\index.blade.php:
@section('content')

Test

@endsection

And in layouts\default.blade.php:
<!DOCTYPE html>

    @yield('content')

Nothing is displaying. And I don't understand why. When I am replacing in MyController return part with:
$this->layout->nest('content', 'entries.index', array(
    'entries' => $entries
));

Then all is working, but.. It looks not clean and I don't like it. When adding in every view @layout('layouts.default') all is working good too, but it is not DRY. For example, in RoR I don't need to do such things in Controller.
How can define in MyController one layout and use return View::make (I think that this is right way) or how can do it better?

A: To use layouts in controllers, you must specify:
public $layout = 'layouts.default';

You can also not return in the method as it will override the use of $layout. Instead, to embed your content within the layout you use:
$this->layout->nest('content', 'entries.index', array('entries' => $entries));

No need to return anything in your method now. This will fix it.

Edit:
"Beautiful Ways?"
$this->layout->nest('content', 'entries.index')->with('entries', $entries);

$this->layout->content = View::make('entries.index')->with('entries', $entries);

$this->layout->entries = $entries;
$this->layout->nest('content', 'entries.index');

A: It should be
public $layout = 'layouts.default';

Here's the link Templating - The Basics
Now you can return your layout like this
$view = View::make('entries.index')->with('entries', $entries);
$this->layout->content = $view->render();

A:  class BaseController extends Controller {

/**
 * Setup the layout used by the controller.
 *
 * @return void
 */

/*Set a layout properties here, so you can globally
  call it in all of your Controllers*/
protected $layout = 'layouts.default';

protected function setupLayout()
{
    if ( ! is_null($this->layout))
    {
        $this->layout = View::make($this->layout);
    }
}

}
class HomeController extends BaseController {
public function showHome()
{
    /*now you can control your Layout it here */
     $this->layout->title= "Hi I am a title"; //add a dynamic title
     $this->layout->content = View::make('home');
}

}
Ref:
http://teknosains.com/i/tutorial-dynamic-layout-in-laravel-4

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to launch a Google Chrome Tab with specific URL using C# Is there a way I can launch a tab (not a new Window) in Google Chrome with a specific URL loaded into it from a custom app? My application is coded in C# (.NET 4 Full).
I'm performing some actions via SOAP from C# and once successfully completed, I want the user to be presented with the end results via the browser.
This whole setup is for our internal network and not for public consumption - hence, I can afford to target a specific browser only. I am targetting Chrome only, for various reasons.

A: As a simplification to chrfin's response, since Chrome should be on the run path if installed, you could just call:
Process.Start("chrome.exe", "http://www.YourUrl.com");

This seem to work as expected for me, opening a new tab if Chrome is already open.

A: If the user doesn't have Chrome, it will throw an exception like this:
    //chrome.exe http://xxx.xxx.xxx --incognito
    //chrome.exe http://xxx.xxx.xxx -incognito
    //chrome.exe --incognito http://xxx.xxx.xxx
    //chrome.exe -incognito http://xxx.xxx.xxx
    private static void Chrome(string link)
    {
        string url = "";

        if (!string.IsNullOrEmpty(link)) //if empty just run the browser
        {
            if (link.Contains('.')) //check if it's an url or a google search
            {
                url = link;
            }
            else
            {
                url = "https://www.google.com/search?q=" + link.Replace(" ", "+");
            }
        }

        try
        {
            Process.Start("chrome.exe", url + " --incognito");
        }
        catch (System.ComponentModel.Win32Exception e)
        {
            MessageBox.Show("Unable to find Google Chrome...",
                "chrome.exe not found!", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

A: // open in default browser
Process.Start("http://www.stackoverflow.net");

// open in Internet Explorer
Process.Start("iexplore", @"http://www.stackoverflow.net/");

// open in Firefox
Process.Start("firefox", @"http://www.stackoverflow.net/");

// open in Google Chrome
Process.Start("chrome", @"http://www.stackoverflow.net/");

For .Net core 3.0 I had to use
 Process process = new Process();
 process.StartInfo.UseShellExecute = true;
 process.StartInfo.FileName = "chrome";
 process.StartInfo.Arguments = @"http://www.stackoverflow.net/";
 process.Start();

A: UPDATE: Please see Dylan's or d.c's anwer for a little easier (and more stable) solution, which does not rely on Chrome beeing installed in LocalAppData!

Even if I agree with Daniel Hilgarth to open a new tab in chrome you just need to execute chrome.exe with your URL as the argument:
Process.Start(@"%AppData%\..\Local\Google\Chrome\Application\chrome.exe",
              "http:\\www.YourUrl.com");


text:
Q: firefox addons panel hide My addon opens a popup panel (popup.html).
When the user changes the current tab to different tab, the popup panel is hidden
When the tab is selected second time I need it to still available contentURL (popup.html) but I did find the way to do it.

A: You can create your panel like this:
<panel
    id="yourPanel"
    type="arrow"
    noautohide="true"
    level="parent">
</panel>

Explanation:
level = "parent" means the panel is shown just above the window the panel is in, but behind other windows above it.
noautohide = "true" means the panel will only be closed when the hidePopup method is called.
With these two combined, you get the behavior you're looking for.
For reference see mdn panel page


text:
Q: Chrome assuming octet-stream to .png image I have an application with Google Maps API V3 and ASP.Net that uses OverlayView to set an custom icon on the map.
The image of that icon is set on onAdd event by setting the background CSS property with JavaScript. This image is .png.
This icon position is frequently changed by updates($.ajax) and, on that point, the image is downloaded again from the server. This causes a little blink - icon image disappear when another is downloading. It should change it's position without blinking.
The question is "why browser doesn't caches the image?". The Chrome's Developer Tool shows that these images are coming with MIME Type of "application/octet-stream". And on console I see this warning:

Resource interpreted as Image but transferred with MIME type application/octet-stream: "http://localhost:81/Common/Images/Synoptic/bus_b.png"

There's already a question about this on this link but it doens't helped me. I think my problem is more specific.

A: Well, I found a solution for this. I used a .ashx file header and controlled the cache there. This is the result:
path = context.Request.MapPath(path + context.Request.QueryString["name"]);

if (File.Exists(path))
{
    imageBytes = File.ReadAllBytes(path);

    DateTime dt = DateTime.Now.AddYears(1);

    context.Response.Cache.SetMaxAge(new TimeSpan(dt.ToFileTime()));
    context.Response.Cache.SetCacheability(HttpCacheability.Public);

    context.Response.ContentType = "image/png";
    context.Response.BinaryWrite(imageBytes);
}
else
{
    throw new SystemException("Image doesn't exists. '" + path + "'");
}

So the use is:
frmImageCaching.ashx?name=bus_b.png


text:
Q: Add HTTP header to SOAP request via groovy-wslite I am trying to add a HTTP header into my SOAP request. The code is written in groovy and is using groovy-wslite library. My code looks like the following:
    def client = new SOAPClient(AConfig.url)
    client.httpClient.sslTrustStoreFile = abcd
    client.httpClient.sslTrustStorePassword =AConfig.password

How do I add HTTP header to the client object?

A: You can't add an HTTP header to the client object itself.
Instead, each SOAP request that the client sends out can have its own set of HTTP headers added to it.
The first parameter to the send method can contain the HTTP headers. Here is an example:
String content = "<....SOAP message body here...>"
SOAPClient client = new SOAPClient(AConfig.url)

Map requestParams = [ headers: [ CustomHeader: "My custom header" ] ]
client.send(requestParams, content)


text:
Q: Archeologists exploring dead planet find room where they commited suicide by asphyxiation I am trying to find the title of a science fiction book/story that I read many years ago (about 40!).
All that I can remember is that it involved explorers (I think they may have been archaeologists) on a dead planet that at one time had a civilisation. They find various artifacts including symbols that could be a written language. The event that sticks in my mind is the discovery of a room that has a fire in it that has been used by the last remaining members of the civilization to commit suicide by asphyxiation. I can't remember why! Thanks for your help!

A: I think this is The Pirate by Poul Anderson.
In it there is a world hit by the radiation from a super-nova and the some of the inhabitants kill themselves to not suffer from radiation sickness. They use asphyxiation during  a final party as the method of choice.

A: Omnilingual, by H. Beam Piper. On Project Gutenberg
The part where the last Martians are discovered:

"Yes; charcoal. I noticed a quantity of it around a couple of
  hand-forges in the shop on the first floor. That's why you had so much
  trouble breaking in; they'd sealed the room on the inside." He
  straightened and went around the room, until he found a ventilator, and
  peered into it. "Stuffed with rags. They must have been all that were
  left, here. Their power was gone, and they were old and tired, and all
  around them their world was dying. So they just came in here and lit the
  charcoal, and sat drinking together till they all fell asleep. Well, we
  know what became of them, now, anyhow."

And another matching point is of course the analysis of the Martians' written language, which is the main plot thread.


text:
Q: Removing footer and including filename as a column in U-SQL There are expense files(CSV format) from different business units, with header and footer in it. The files are of different names Expense__YYYYMMDD.csv
I have the below requirements to address in U-SQL.

*

*Remove header and footer. I use SkipNRows:1 to skip the header. I couldn't find any option to exclude the footer. Had a look at the "Silent" parameter, but it would by-pass the encoding errors(if any) as per the documentation.
Is there any other parameter/way that I could use to exclude the filter.

The file structure is as follows:
1   ACTUAL  1/03/2018   SourceSystem12  BUNIT3
2   00900_AB    H6720180205gv   1   1/03/2018   XYZ 1000004 4500532 Imogen      userid1 2/03/2018
2   00900_AB    H6720180205ub   1   1/03/2018   XYZ 1000004 4500532 Imogen1     userid2 2/03/2018
2   00900_AB    H6720180205wp   1   1/03/2018   XYZ 1000004 4500532 Imogen      userid1 2/03/2018
2   00900_AB    H6720180205yc   1   1/03/2018   XYZ 1000004 4500532 Imogen      userid2 2/03/2018
9   90  532 68060.24    62916.75    5143.49 BUnit3  1/03/2018   BUMonthYear

Also, the header and footer have less number of columns than the actual data.

*I need to consolidate all these files into a single file before storing it in DatalakeAnalytics. As part of the aggregation, businessunit from the file name should be included as one of the columns in the final output file.
Eg.,
 If there are 2 source files of same structure with different file names as below
Expense_HR_20180801.csv

Column1, column2, column3
Expense_IT_20180801.csv

column1, column2, column3
The final output file should be:
Expense_20180801.csv

Businessunit, column1,column2,column3
Any suggestions/guidance on
   a. how to remove the footer from the individual CSVs, and
   b. how to extract the businessunit from the filename and include it as one of the columns is much appreciated.

Thanks in advance!

A: It looks like the first column is a descriptor for the row type, where 1 is header, 2 is main data and 9 is footer.  One approach to this is to import the data as a single row using a delimiter that does not exist in the data, then remove rows you don't need, eg using .net string methods like StartsWith.  The virtual columns feature of U-SQL easily allows you to incorporate parts of the filename into your rowset.  Here's a simple example:
// Import the file as one column, clean out the header and foot, then output again
DECLARE @inputFile string = @"\input\Expense_{businessUnit}_20180801.csv";

@input =
    EXTRACT col1 string,
            businessUnit string
    FROM @inputFile
    USING Extractors.Text(delimiter : '†');

@output =
    SELECT *
    FROM @input
    WHERE NOT col1.StartsWith("1 ")
      AND NOT col1.StartsWith("9 ");

OUTPUT @output
TO "/output/output.csv"
USING Outputters.Csv(quoting:false);

My results:

Now the file is clean, you can import using normal methods.

A: for your second issue, you should use virtual columns check this solution.
for your first issue, maybe you should try to create custom extractor if you know footer pattern, then in extractor logic, you can remove the footer.
If you can provide more information about file and footer so we can give you more precisely potential solution/fix/idea :)


text:
Q: Does Azure Functions on Consumption Plan utilize multiple servers? When I run an Azure Function App on the Consumption Plan, does it then utilize multiple servers, or does every instance of the functions always run on the same server?
Access Tokens
The background for the question is that I want to cache the access tokens for APIs that the functions are using. Right now I refresh the tokens when the initial timer triggered function starts - but it's no real solution.
Each function should try using the existing auth token and then ask for a new one if it fails. Similar question here: authentication token cache for azure function with a comment saying the Consumption plan doesn't quarantee reuse of servers

A: Yes, it does utilise multiple servers, so in-memory caching will end up having multiple cache instances. The filesystem is shared across servers though, so disk-based caching is an option, or you can just go for a distributed cache like Azure Cache for Redis.

A: Yes, We end up using Redis Cache to handle the same scenario.


text:
Q: Windows не меняет программу по умолчанию для файлов .py Переустановил питон, записал все нужное в переменную PATH

Папку со своими скриптами закинул в папку с питоном(как и было до этого), так же прописал её в переменной PATH чтобы можно было через cmd запускать

Но по какой то причине windows не видит расширения .py у скриптов, то есть не открывает файлы с помощью python.exe открывал через пкм и вручную выбирал программу

Но после выбора python.exe ничего не происходило, не не менялась программа запуска по умолчанию, не появлялась в рекомендуемых программах запуска, через IDLE все скрипты запускаются и работают

В программах по умолчанию указан Notepad++ при попытке изменить и указать python.exe повторяется история что я указал выше

Весь гугл излазил не нашел решения, знает кто в чем дело?

A: Проверьте, что именно у вас установлено в качестве приложения по умлочанию. Сделать это можно в окне "Выбор стандартных приложений для типов файлов".
Открыть данное окно можно следующим образом (описано для Windows 10):

*

*Запустите "Панель управления"

*Далее "Программы" > "Программы по умолчаю" > "Сопоставление типов файлов или протоколов с конкретными программами"

*В появившемся окне "Приложения по умолчанию" проскрольте в самый низ и выберите пункт "Выбор стандартных приложений для типов файлов".

*В появившемся окне найдите типы файлов, начинающиеся с ".py" и выбирайте для них приложения.

Если не помогло, то придется удалять ассоциацию приложения и типа файла вручную.

*

*Запустите Редактор реестра: введите команду regedit.exe в командной строке или окне "Выполнить"

*В дереве слева найдите ветку HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.py. если есть возможность - раскройте ее

*Выделите подветку "OpenWithProgids", нажмите на ней ПКМ, выберите пункт "Удалить". На рисунке я показал это для расширения .pyw

*Проверьте, что ассоциация с другой программой пропала. В этом случае, должна быть выбрана программа, зарегестрировавшая данное расширение - это именно интерпретатор python

A: Нашел решение, вдруг пригодится кому, через реестр можно поправить ассоциацию файлов, переходим по пути в реестре HKEY_CURRENT_USER→Software→Microsoft→Windows→CurrentVersion→Explorer→FileExts→.py и удаляем папку UserChoice, видимо после этого сбрасывается значение по умолчанию и можно выбрать его заново


text:
Q: Delete elements from a list I have two lists, for example
s={{1,3,2},{1,3,2},{2,3,1},{3,1},{2,3,1}};
c={{3},{1,2},{3}};

First element of c means that number 1 from s[[3]] must be deleted. Number is a position of this element in c.
Second element of c: delete number 2 from s[[{1,2}]].
Third: delete number 3 from s[[3]]
The result must be
(* {{1,3},{1,3},{2},{3,1},{2,3,1}} *)

Another example
s={{2,1,3},{2,3,1},{1,2,3},{2,3}};
c={{1},{2,4},{3}};
(* {{2,3},{3,1},{1,2},{3}} *)

One more question. Also two lists:
s={{{1,3},{1,2},{3,2},{1},{3},{2}},
{{1,3},{1,2},{3,2},{1},{3},{2}},
{{1},{2},{3}},
{{3},{2},{1}}};
c={{3},{1,2},{}};

So, from s[[3]] (* {{1},{2},{3}} *) it's necessary to delete ALL elements which contain number 1: {1} (* {{2},{3}} *)
From s[[{1,2}}]] - all elements which contain number 2
(* {{{1,3},{1},{3}},
{{1,3},{1},{3}},
{{2},{3}},
{{3},{2},{1}}} *)

How can I do it?

A: You may use MapIndexed, ReplaceAll, and Nothing.
Delete Numbers
s1 = {{1, 3, 2}, {1, 3, 2}, {2, 3, 1}, {3, 1}, {2, 3, 1}};
c1 = {{3}, {1, 2}, {3}};

MapIndexed[(s1[[#1]] = (s1[[#1]] /. {First@#2 -> Nothing})) &, c1];
s1

(* {{1, 3}, {1, 3}, {2}, {3, 1}, {2, 3, 1}} *)

Delete Sublists
s2 = {
   {{1, 3}, {1, 2}, {3, 2}, {1}, {3}, {2}},
   {{1, 3}, {1, 2}, {3, 2}, {1}, {3}, {2}},
   {{1}, {2}, {3}},
   {{3}, {2}, {1}}
   };
c2 = {{3}, {1, 2}, {}};

MapIndexed[(s2[[#1]] = (s2[[#1]] /. {{___, First@#2, ___} -> Nothing})) &, c2];
s2

(*
{{1,3},{1},{3}}
{{1,3},{1},{3}}
{{2},{3}}
{{3},{2},{1}}
*)

Hope this helps.

A: Do and DeleteCases can do what you want
The first one:
delete[s_, c_] := Module[{s0 = s},
  Do[s0[[c[[i]]]] = DeleteCases[s0[[c[[i]]]], i, 2], {i, Length@c}];
  s0
  ]

The second one
delete2[s_, c_] := Module[{s0 = s},
  Do[s0[[c[[i]]]] = DeleteCases[s0[[c[[i]]]], {___, i, ___}, 2], {i,
    Length@c}];
  s0
  ]


text:
Q: Collision in console based game not working I have two methods inside of my board class to check for collision. One for other player objects and one for the borders of the map. The one for the map is working fine but collision for the players is off.
Here are the methods:
def check_mob(self, player, enemy):
    dx = player.x - enemy.x
    dy = player.y - enemy.y
    distance = math.sqrt(dx ** 2 + dy ** 2)
    if distance <= 1:
        return True
    else:
        return False

def check_brd(self, board, player, enemy, direction):
    '''Deals with collision '''
    brd_x = len(self.board)
    brd_y = len(self.board[0])
    if direction == 'down':
        if player.x + 1 == brd_x or self.check_mob(player, enemy):
            return False
        else:
            return True
    elif direction == 'up':
        if player.x - 1 == brd_x - brd_x -1 or self.check_mob(player, enemy):
            return False
        else:
            return True
    elif direction == 'left':
        if player.y - 1 == brd_y - brd_y - 1 or self.check_mob(player, enemy):
            return False
        else:
            return True
    elif direction == 'right':
        if player.y + 1 == brd_y or self.check_mob(player, enemy):
            return False
        else:
            return True

The player or enemy will walk up to the other and get stuck. I need them to be able to walk away from each other when this happens.
The entire, now working, code is here.

A: check_mob is testing for collision at the current position, not the position where the player is trying to go...
Also simplify
player.x - 1 == brd_x - brd_x -1

to
player.x == 0


text:
Q: How to use Office 365 Enterprise apps for another account in family e.g. for kids? I have Office 365 Enterprise work account with 5 possible installations.
I need to install it for kids without them having access to my work account.
How can I do that?
Whenever I logout from my Office 365 Eneterprise account on their laptops, the license disappears and is no longer available until I login again. I need to logoff - to disable access to company data - but leave the enterprise licence on the PC available for kids.

A: It's 5 installations per user. As they are different users, this isn't what you are licensed for, which is why you are struggling.


text:
Q: Having problem dynamically invoking unmanaged VB COM dll from c#? I have a problem calling unmanaged VB COM dll from c#. This is dynamic invocation using loadLibrary and GetProcAddress.
I can successfully loaded the dll using loadLibrary , but the GetProcAddress always return 0. It wasnt log any error msg and nothing. it just returns 0.
below the sample code
VB COM
VERSION 1.0 CLASS
BEGIN
    MultiUse = -1
    Persistable = 0
    DataBindingBehavior = 0
    DataSourceBehavior  = 0
    MTSTransactionMode  = 0
END

Attribute VB_Name = "Sample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True

Option Explicit

Private Attribute1 As String
Private Sub Class_Initialize()
    Attribute1 = "test"
End Sub

Public Sub TestSub()

End Sub

Public Function testFunction() As String
    testFunction = "default.html"
End Function

Public Function SetData(XML As String) As String
    SetData = Date + Time
End Function

c# code
static class UnManagedInvoker
{
    [DllImport("kernel32.dll")]
    private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string dllToLoad);

    [DllImport("kernel32.dll")]
    private static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)] string procedureName);

    [DllImport("kernel32.dll")]
    private static extern bool FreeLibrary(IntPtr hModule);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate string MethodToInvoke(string sdata);

    public static string InvokeUnmanagedDll(string dllPath, string methodName)
    {
        IntPtr DIedDll = LoadLibrary(dllPath);

        IntPtr AddressOfFunction = GetProcAddress(DIedDll, methodName);

        MethodToInvoke MI = (MethodToInvoke)Marshal.GetDelegateForFunctionPointer(AddressOfFunction, typeof(MethodToInvoke));

        string data = MI("ssdasda");

        FreeLibrary(DIedDll);
        return data;

    }
}

And the calling code
 string res = UnManagedInvoker.InvokeUnmanagedDll("xx.dll","SetData");

Can someone help me out..
Update:
I can successfully call the methods if the component is registered. using the below code
Type Med = Type.GetTypeFromCLSID(new Guid("089DD8B0-E12B-439B-B52C-007CA72C93D0"));
object MedObj = Activator.CreateInstance(Med);
object[] parameter = new object[1];
parameter[0] = "asdasd";
var ss = Med.InvokeMember("SetData", System.Reflection.BindingFlags.InvokeMethod, null, MedObj, parameter);

is there a way if the dll not registered.?

A: Note that the concept of GetProcAddress and COM objects are completely different technologies. VB6 is designed to build COM objects and (to my knowledge) is not able to export code via the GetProcAddress API.
Also by design COM objects need to be registered somewhere, it is however possible to put this information in a manifest file instead of the registry. This means you can register your VB6 COM classes only for your application without using the global registry. (Note that a manifest could also embedded into the .exe instead of being a file.)
For more information search for "Registration free COM", here's a link to the corresponding MSDN article.


text:
Q: Short story: Man crash lands on hostile planet and adapts to it Old short story where a man crash lands on an alien planet with hostile environment.   He thinks he is gradually changing the environment to suit him, but actually he is being changed to adapt to the planet

A: "Enchanted Village" by A. E. van Vogt.
Astronaut is trained in the importance of adaptation for survival.
He crash lands on Mars and finds an alien village. There are no aliens but the buildings are living creatures.
Astronaut tries to get the buildings to adapt so they can feed him and supply water. He fails.
But he does not realize that he himself is adapting.


text:
Q: Using a project in a Git repo in another project I have a framework I am building to make some common functions (database connection) easier and would like to use it in another project. I could always just copy and paste it, but I am working on it and expanding it constantly. It would be much easier to just have it copy its updated self over whenever I do a commit in my Git repo.
Could I use Git to automatically update the framework in my other project or will I have to find another solution?

A: Use either git subtrees or git submodules.
Last time I've checked, submodules had some major issues (but I've heard that they were improved a bit in recent versions). See here for details: Git submodules workflow
In short:
Subtrees are regular Git branches, merged with special merge strategy, which puts all their files into a subdirectory of the host repository working copy. Aside of the merge strategy (which matters only when merge commit is created), Git "subtree" is a perfectly normal Git branch.
Pros:

*

*No extra tool support needed, except when you need to pull in new changes from the subtree, and even then all support is the -s subtree command line option (see here for the full workflow). You need to remember about subtree only when you do the subtree pull.

Cons:

*

*All subtree commits are visible in the history of the host project.

*Don't commit changes to the host repository's directory where subtree lives in or face  conflicts on next subtree pull.

Submodules are Git repositories inside the host repository.
Pros:

*

*Cleaner history, better separation from the host repository.

*One may commit directly to the submodule upstream from the submodule repository directly (or so I think).

Cons:

*

*For each (or many) Git command you have remember that you're dealing with repository with submodules, lots of nasty corner cases (or so it was when I looked). Special tool support required to work with each clone of the repository.

Disclaimer: I'm biased against submodules. Try and see for yourself, what approach is better for your workflow.

A: git-submodules.
You will have a few issues with updating in different places, but it should work out.


text:
Q: How Do i fix this and get my page indicator running in flutter? I am making an APP gui in flutter, i have made 4 pages and made them accessible by sliding using pageview widget.
this is my homepage which has the pageview widget. The error shows "Positional arguments must occur before named arguments.
Try moving all of the positional arguments before the named arguments.dart(positional_after_named_argument)
Too many positional arguments: 0 expected, but 1 found.
Try removing the extra positional arguments, or specifying the name for named arguments.dartextra_positional_arguments_could_be_named"
this is my code for home page
import 'package:final_project/pages/pages1.dart';
import 'package:final_project/pages/pages2.dart';
import 'package:final_project/pages/pages3.dart';
import 'package:final_project/pages/pages4.dart';
import 'package:flutter/material.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';

class HomePage extends StatelessWidget {
  final _controller = PageController(viewportFraction: 0.8, keepPage: true);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey,
      body: PageView(
          controller: _controller,
          children: const [pagg1(), pagg2(), pagg3(), pagg4()]),
          SmoothPageIndicator(controller: _controller, count: 4);
    );
  }
}

The homepage

A: You can use Column on body to have multi-child,
 body: Column(
  children: [
    Expanded(
      child: PageView(
          controller: _controller,
          children: const [pagg1(), pagg2(), pagg3(), pagg4()]),
    ),
    SmoothPageIndicator(controller: _controller, count: 4)
  ],
)


text:
Q: Rolling Oncall Distribution List with Microsoft Exchange I'm trying to set up an "oncall" user/email for Microsoft Exchange (ex: oncall@mybiz.org), with the idea being that whoever on my team is currently "oncall" will be added to the list. Then, when they are no longer on-call, they will be removed from the list, and the next on-call person added.
We have 12 people on my team, with very rigorous on-call schedules. Wondering if Exchange supports this type of behavior, or how I might be able to script something together if the functionality doesn't come out of the box.

A: This should be possible to create but does not come with a solution "out of the box". Best approach (imo) would  be to create a dynamic distribution group based on an AD attribute (there are a number of custom attributes you could use for this) and a powershell script to set and remove the attribute.
Depending on how your on call is recorded you could use a CSV file with a date check to see if the current date is within the set range of the CSV.


text:
Q: Android Data Binding Library lambda for custom Listener This code works just fine:
Adapter code:
@BindingAdapter({"app:onClick"})
public static void setOnClick(My view, View.OnClickListener onClickListener)
{
   view.addOnClickListener(onClickListener);
}

Xml code:
app:onClick="@{ (v) -> view.onClick(v) }"

But I need to make custom listener like this:
Adapter code:
@BindingAdapter({"app:onClose"})
public static void setOnClose(My view, My.OnCloseListener onCloseListener)
{
   view.addOnCloseListener(onCloseListener);
}

Xml code:
app:onClose="@{ (x, y) -> view.onClose(x, y) }"

Listener code:
public interface OnCloseListener
{
    void onClose(My x, int y);
}

In this case the application does not compile(not big suprise :( ), is it even possible to use lambda with custom listener?

A: It is OK with gradle 2.2.0 version:
public interface ITest {
    void apply(String apply);
}

@BindingAdapter({"test"})
public static void testAdapter(View view, ITest test){
}

public interface IViewModel extends Observable {
    void accept(String string);
}

<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>
        <variable
            name="vm"
            type="com.example.mvvm.IViewModel"
            />
    </data>

    <View
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:test="@{vm::accept}"
        />

</layout>

Maybe that was an older version of data-binding library, which cause your error.


text:
Q: What's the difference between smbclient and samba? I've seen both of them in the repos. What's the difference between them?

A: From apt-cache show samba:

This package provides the components necessary to use Samba as a
  stand-  alone file and print server or as an NT4 or Active Directory
  domain  controller. For use in an NT4 domain or Active Directory
  realm, you will  also need the winbind package.  .  This package is
  not required for connecting to existing SMB/CIFS servers  (see
  smbclient) or for mounting remote filesystems (see cifs-utils).

whereas, from apt-cache show smbclient:

This package contains command-line utilities for accessing Microsoft
  Windows and Samba servers, including smbclient, smbtar, and smbspool.
  Utilities for mounting shares locally are found in the package
  cifs-utils.

For completeness, apt-cache show cifs-utils says:

This package provides utilities for managing mounts of CIFS network
  file  systems.


text: Q: Sublime 3 JSHint Gutter always show error at the bottom I'm used to Atom's JSHint always showing the first error on the bottom (so if there's errors on lines 1, 3, 4, it will show the error on line 1 at bottom left hand corner and then show the one on line 3 once line 1's error is resolved and so on and so forth), can I customize Sublime 3 JSHint Gutter to do the same for me automatically? Because currently I have to click on each red squiggly in the editor in order for the error to show up on the bottom left hand corner instead of it appearing automatically.


text:
Q: radio tabIndex to navigate using tab doesn't work in react I have 2 radio button, I expect I can use tabIndex on reach radio input, so it can be navigate and select the value using the up/down arrow button on the keyboard, but it doesn't work with my code

        {[
          {
            id: '1',
            name: 'One',
            label: '1',
            value: false,
            defaultChecked: true,
          },
          {
            id: '2',
            name: 'Two',
            label: '2',
            value: true,
          },
        ].map(({ id, name, label, value, defaultChecked }) => (

            <Radio
              key={id}
              id={id}
              name={name}
              value={value.toString()}
              defaultChecked={defaultChecked}
              onChange={e => console.log(e)}
              tabIndex={+id}
            >
              {label}
            </Radio>

        ))}

demo
https://stackblitz.com/edit/react-ts-xbcqdf

A: Your tabs are working, but you need to use the same name for both checkboxes so they work as a group, select and deselect accordingly.
<Radio
   key={id}
   id={id}
   name="someName"  // render same name for both checkbox
   value={value.toString()}
   defaultChecked={defaultChecked}
   onChange={e => console.log(e)}
   tabIndex={+id}
   >
     {label}
</Radio>


text:
Q: Meaning of Inappropriately appropriative Could someone please elaborate on its usage with examples. Where can I use it ?

A: I read "appropriative" here as "adopting the style or manner of". To say that something is inappropriately appropriative is to say that someone is taking on the style of another in an improper way. An example might be, it is inappropriately appropriative for privileged kids at a New England boarding school to use strong southern accents with fractured grammar. Back in the day, some people complained about Paul Simon's musical collaboration with Ladysmith Black Mambozo (IIRC) - the idea was that he was appropriating a musical style and tradition for commercial gain without having lived the experiences that gave rise to that tradition. He was inappropriately appropriating African musical styles. The real meaning of the phrase, though, is quite possibly a simple flexing of syllabic muscles. Showing off.


text:
Q: Adding Comment to a cell in a spreadsheet document created using OpenXML I am creating an xlsx file using openXML. I want to add comments to some row cells. Is there any way to add comments to the cell. Or should I use Microsoft.Office.Interop to add comments to the excel cells ?

A: I used the Open XML SDK Productivity Tool for Microsoft Office which lets you load an Excel or Word file and then emits the C# code to produce that exact file.
Then I created a file with a comment. First I tried with two comments but the amount of code it generates makes it hard to tell what's what.
The result is not pretty to look at. You could reduce a lot of it and probably eliminate some. But it's a way to find out what's going on under the hood.
You can also skip all of this and just use EPPlus, which after looking at what comes next you can imagine why someone felt the need to make this easier.
The key steps are:

*

*Create a new Comments

*Create a new CommentsList (?!!!)

*Create a new Comment which has a Reference property indicating which cell it belongs to

*Create a new CommentText

*Create a new Run

*Append the Run to the CommentText

*Append the CommentText to the Comment

*Append the Comment to the CommentsList

*Append the CommentsList to the Comments

*Set the WorksheetCommentsPart.Comments property to the Comments.
private void GenerateWorksheetCommentsPart1Content(WorksheetCommentsPart worksheetCommentsPart1)
{
    Comments comments1 = new Comments(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "xr" }  };
    comments1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
    comments1.AddNamespaceDeclaration("xr", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision");

    Authors authors1 = new Authors();
    Author author1 = new Author();
    author1.Text = "Hannen, Scott";

    authors1.Append(author1);

    CommentList commentList1 = new CommentList();

    Comment comment1 = new Comment(){ Reference = "B3", AuthorId = (UInt32Value)0U, ShapeId = (UInt32Value)0U };
    comment1.SetAttribute(new OpenXmlAttribute("xr", "uid", "http://schemas.microsoft.com/office/spreadsheetml/2014/revision", "{811649EF-4CB5-4311-BE14-228133003BE4}"));

    CommentText commentText1 = new CommentText();

    Run run1 = new Run();

    RunProperties runProperties1 = new RunProperties();
    FontSize fontSize3 = new FontSize(){ Val = 9D };
    Color color3 = new Color(){ Indexed = (UInt32Value)81U };
    RunFont runFont1 = new RunFont(){ Val = "Tahoma" };
    RunPropertyCharSet runPropertyCharSet1 = new RunPropertyCharSet(){ Val = 1 };

    runProperties1.Append(fontSize3);
    runProperties1.Append(color3);
    runProperties1.Append(runFont1);
    runProperties1.Append(runPropertyCharSet1);
    Text text1 = new Text(){ Space = SpaceProcessingModeValues.Preserve };
    text1.Text = "This is my comment!\nThis is line 2!\n";

    run1.Append(runProperties1);
    run1.Append(text1);

    commentText1.Append(run1);

    comment1.Append(commentText1);

    commentList1.Append(comment1);

    comments1.Append(authors1);
    comments1.Append(commentList1);

    worksheetCommentsPart1.Comments = comments1;
}


text:
Q: Unable to run DataStax-Studio in Docker on MacBook Pro M1 I'm trying to install Cassandra and DataStax-studio to access the Cassandra on my MacBook Pro M1 inside docker.
I was able to pull a Cassandra image and run container.
But when I tried the studio I get this error. Seems the image is built only for intel architecture. I wasn't able to find a specific image for ARM architecture.
Is there a way I can still run DataStax Studio inside Docker running on Apple Mac M1 ?
Below are some terminal output for more clarification.
-MBP ~ % docker  image ls
REPOSITORY            TAG       IMAGE ID       CREATED       SIZE
cassandra             latest    f6dfc8a5f3d8   7 days ago    393MB
datastax/dse-studio   latest    79b8a4b75312   7 weeks ago   787MB

-MBP ~ % docker container run -d 79b8a4b75312
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ce8d20bd23445a20869371fb8e5c8cefbb16e9c968aa1f2870b6b578b6a81e88

-MBP ~ % docker container ls
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS                                         NAMES
112e980fe11c   f6dfc8a5f3d8   "docker-entrypoint.s…"   13 minutes ago   Up 13 minutes   7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp   hungry_bohr

Update
This link doesn't provide much help
https://docs.datastax.com/en/install/6.0/install/installDSEDocker.html

A: There's no ARM support for Studio.
There were some changes to the Cassandra builds that would allow installation on ARM machines but it's not officially supported yet so there's a chance that you'll run into some issues at some point.
I'm going to reach out to the Studio developers here at DataStax and will post an update here as appropriate. Cheers!
[UPDATE] - Can you try to override it by specifying --platform linux/amd64 with docker run?
P.S. Studio only works with DSE and Astra. It won't work with open-source Cassandra. Cheers!


text:
Q: Array of unknown bound usage in C programming I output of below code is undefined when I ran multiple times. I would like to know why the output is undefined and what will be implication when I try to assign value to an array of unknown bound.
#include <stdio.h>

int main()
{
  int a[]= {};
  int num_of_elements;
  int count = 0;

  printf("Enter the number of elements:\n");
  scanf("%d",&num_of_elements);

  printf("Enter the numbers:\n");
  for(count=0; count<num_of_elements; ++count)
  {
    scanf("%d", &a[count]);
  }
  printf("\n");

  for(count=0; count<num_of_elements; count++)
  {
    printf("%d,   ", a[count]);
  }
  printf("\n");

  return 0;
}

Output when run at different times:
Enter the number of elements:
2

Enter the numbers:
1 2

0,   0,

Enter the number of elements:
3

Enter the numbers:
1 2 3

0,   0,   2,

Enter the number of elements:
4

Enter the numbers:
1 2 3 4

0,   0,   2,   3,
Segmentation fault

Enter the number of elements:
5

Enter the numbers:
1 2 3 4 5

0,   0,   2,   3,   4,
Segmentation fault

A:
I would like to know why the output is undefined and what will be implication when I try to assign value to an array of unknown bound

The size of variable a will be 0, as num_of_elements has not been scanf'ed at that point, so you can't store anything in it.
The solution is to declare the array after you have read its size from the user. This means :
#include <stdio.h>

int main()
{
    int num_of_elements;
    int count = 0;

    printf("Enter the number of elements:\n");
    scanf("%d", &num_of_elements);

    //define here your array
    int a[num_of_elements];

    ...

    return 0;
}

A: As a first hint, when you try to compile this with gccusing -pedantic, it will refuse to compile:
$ gcc -std=c11 -Wall -Wextra -pedantic -ocrap.exe crap.c
crap.c: In function 'main':
crap.c:5:12: warning: ISO C forbids empty initializer braces [-Wpedantic]
   int a[]= {};
            ^
crap.c:5:7: error: zero or negative size array 'a'
   int a[]= {};
       ^

And indeed, the size of such a variable is 0, so you can't store anything  in it.
Still it is a valid syntax and has its uses, for example as a "flexible array member" of a structure:
struct foo
{
    int bar;
    int baz[];
};

[...]

struct foo *myfoo = malloc(sizeof(struct foo) + 5 * sizeof(int));
// myfoo->baz can now hold 5 integers


text:
Q: Problem connecting to Oracle database via ASP.NET page under IIS I'm having a problem getting a simple ASP.NET webpage to display. The page contains a GridView with a SqlDataSource connected to an Oracle database.
When I run the page in the VS debugger (cassini webserver) everything works fine, but when I publish the application to my local IIS server (same machine), I get the following error:
ORA-12154: TNS:could not resolve the connect identifier specified
If it was a different machine I could understand that it might be a tnsnames.ora or other problem that I could investigate via tnsping. I have also set the security on the folder containing the Oracle drivers to "Everybody", and set the webapp to run under a "Priviliged" AppPool (Identity as Administrator), but with no success.
Anyone else got any ideas??

A: this guide is a bible for this kinds of problems :)
Actually i have printed one copy of this guide and distribute it to every consultant involved with IIS ASP.NET to ORACLE connectivity issues. The checklist will probably get your problem solved, unless you have a problem within your code which you don't seem to have based on your scenario.

A: I think you more than 1 Oracle client. You need to search ALL your tnsnames.ora files with the windows explorer and compare and synchronize ALL those files.

A: maybe you need to specify the IP


text:
Q: Why do people choose to put all inline methods into another file? I saw some libraries put all inline methods into another separate file? Is there any benefit about this practice?
for example, put all inline methods into test.hin and include test.hin in the header file?

A: To make the header easier to read.
Ideally anyone else looking at the file will get all the information they need just from the class/function declarations, appropriate names, and accompanying comments and documentation. The actual implementation of the inlined functions shouldn't be needed to be seen (most of the time). So rather than having all the extra stuff which people would have to skip past, one can choose to move it out into a separate "inlines" file.
As far as the compiler is concerned, it ends up working the same as if they were in the main header.


text:
Q: File truncated, when opened in Perl Im new to perl, so sorry if this is obvious, but i looked up how to open a file, and use the flags, but for the life of me they dont seem to work right I narrowed it down to these lines of code.
    if ($flag eq "T"){
        open xFile, ">" , "$lUsername\\$openFile";
    }
    else
    {
        open xFile, ">>", "$lUsername\\$openFile";
    }

Both of these methods seem to delete the contents of my file. I also checked if the flag is formatted correctly and it is, i know for a fact ive gone down both conditions.
EDIT: codepaste of a larger portion of my code http://codepaste.net/n52sma

A: You should use the three-argument-version of open, lexical filehandles and check wether there might have been an error:
# Writing to file (clobbering it if it exists)
open my $file , '>', $filename
    or die "Unable to write to file '$filename': $!";

# Appending to file
open my $file , '>>', $filename
    or die "Unable to append to file '$filename': $!";

A: New to Perl? I hope you're using use strict and use warnings.
As other's have stated, you should be using a test to make sure your file is open. However, that's not really the problem here. In fact, I used your code, and it seems to work fine for me. Maybe you should try printing some debugging messages to see if this is doing what you think it's doing:
use strict;
use warnings;
use autodie;   #Will stop your program if the "open" doesn't work.

my $lUsername = "ABaker";
my $openFile  = "somefile.txt";
if ($flag eq "T") {
    print qq(DEBUG: Flag = "$flag": Deleting file "$lUsername/$openFile");
    open xFile, ">" , "$lUsername/$openFile";
}
else {
    print qq(DEBUG: Flag = "$flag": Appending file "$lUsername/$openFile");
    open xFile, ">>", "$lUsername/$openFile";
}

You want to use strict and warnings in order to make sure you're not having issues with variable names. The use strict forces you to declare your variables first. For example, are you setting $Flag, but then using $flag? Maybe $flag is set the first time through, but you're setting $Flag the second time through.
Anyway, the DEBUG: statements will give you a better idea of what your error could be.
By the way, in Perl, you're checking if $flag is set to T and not t. If you want to test against both t and T, test whether uc $flag eq 'T' and not just $flag eq 'T'.

@Ukemi

I reformated to comply with use strict, i also made print statements to make sure i was trunctating when i want to, and not when i dont. It still is deleting the file. Although now sometimes its simply not writing, im going to give a larger portion of my code in a link, id really appreciate it if you gave it a once over.

Are you seeing it say Truncating, but the file is empty? Are you sure the file already existed? There's a reason why I put the flag and everything in my debug statements. The more you print, the more you know. Try the following section of code:
$file = "lUsername/$openFile"  #Use forward slashes vs. back slashes.
if ($flag eq "T") {
    print qq(Flag = "$flag". Truncating file "$file"\n);
    open $File , '>', $file
        or die qq(Unable to open file "$file" for writing: $!\n);
}
else {
    print qq(Flag = "$flag". Appending to file "$file"\n);
    if (not -e $file) {
        print qq(File "$file" does not exist. Will create it\n");
    }
    open $File , '>>', $file
        or die qq(Unable to open file "$file" for appending: $!\n);
}

*

*Note I'm printing out the flag and the name of the file in quotes. This will allow me to see if there are any hidden characters in my file name.

*I'm using the qq(...) method to quote strings, so I can use the quotation marks in my print statements.

*Also note I'm checking for the existence of the file when I truncate. This way, I make sure the file actually exists.

This should point out any possible errors in your logic. The other thing you can do is to stop your program when you finish writing out the file and verify that the file was written out as expected.
print "Write to file now:\n";
my $writeToFile = <>;
printf $File "$writeToFile";
close $File;
print "DEBUG: Temporary stop. Examine file\n";
<STDIN>;     #DEBUG:

Now, if you see it saying it's appending to the file, and the file exists, and you still see the file being overwritten, we'll know the problem lies in your actual open xFile, ">>" $file statement.

A: >> does not clobber or truncate. Either you ended up in the "then" clause when you expected to be in the "else" clause, or the problem is elsewhere.
To check what $flag contains:
use Data::Dumper;
local $Data::Dumper::Useqq = 1;
print(Dumper($flag));

A: For your reference I have mentioned some basic file handling techniques below.
open FILE, "filename.txt" or die $!;

The command above will associate the FILE filehandle with the file filename.txt. You can use the filehandle to read from the file. If the file doesn't exist - or you cannot read it for any other reason - then the script will die with the appropriate error message stored in the $! variable.
open FILEHANDLE, MODE, EXPR

The available modes are the following:
read    < #this mode will read the file
write   > # this mode will create the new file. If the file already exists it will truncate and overwrite.
append  >> #this will append the contents if the file already exists,else it will create new one.

if you have confusion on this, you can use the module called File::Slurp;
I have mentioned the sample codes using File::Slurp module.
use strict;
use File::Slurp;

my $read_mode=read_file("test.txt"); #to read file contents
write_file("test2.txt",$read_mode); #to write file
my @all_files=read_dir("/home/desktop",keep_dot_dot=>0); #read a dir
write_file("test2.txt",{append=>1},"@all_files"); #Append mode


text:
Q: What is the difference between Kinto and Cliquet? Why is Kinto using Cliquet and what is the difference between the two ?

Disclaimer: I am one of the authors of both tools. Since this is frequently asked question, I thought it would be relevant to share a proper answer here :)

A: At Mozilla Services we regularly implement and deploy micro-services.
Since most services share the same production requirements (in terms of monitoring, REST protocols etc.), we decided to develop and package a reusable toolkit using Cornice.
Kinto is one of those services. It uses Cliquet as one of its core libraries.
The Kinto HTTP API is made of several REST endpoints, that all share a set of common properties (filtrable, sortable etc.). The common code base for those REST resources is implemented as a reusable class in Cliquet.
We really like the name Cliquet. However, given the confusion of its scope, we will probably (some day) split it into two packages, called like cornice-mozprod and cornice-crud.

A: Kinto and Cliquet have now be merged together, and cliquet is no longer a thing.
See all the nifty details at https://mail.mozilla.org/pipermail/kinto/2016-May/000119.html


text:
Q: Change column delims for a range of columns using bash I have an table with multiple columns and I would like to skip the first and second column.  Then I would like to change the delimiter for the (n + 2 columns) from tab to comma.  Any suggestions with awk or sed with be helpful definitely, because normally I could just a find and replace(with sed) but I keep replacing the tabs in the first two columns.
An example test set:
M1  D.130   a   a   a
M2  D.104   -   a   ab
M3  D.150   ab  ab  a
M4  D.160   a   a   -
M5  D.107   a   ab  a
M6  D.107   -   ab  -
M7  D.104   a   ab  ab

Desired Output:
M1  D.130   a,a,a
M2  D.104   -,a,ab
M3  D.150   ab,ab,a
M4  D.160   a,a,-
M5  D.107   a,ab,a
M6  D.107   -,ab,-
M7  D.104   a,ab,ab

A: For given input, you can simply use below
awk '{print $1, $2, $3 "," $4 "," $5}' infile

Or else
awk -v n=3 '{for(i=1; i<=NF; i++)printf("%s%s",$i,i==NF?ORS:i<n?OFS:",")}' infile

With gawk to retain original spacing:
awk -v n=3 '{
              split($0,t,FS,d);
              for(i=1; i<=NF; i++)
                printf("%s%s",$i,i==NF?ORS:i<n?d[i]:",")
            }' infile

non-gawk to retain original spacing:
awk -v n=3 '{
              split($0,d,/[^[:space:]]*/);
              for(i=1; i<=NF; i++)
                 printf("%s%s",$i,i==NF?ORS:i<n?d[i+1]:",")
            }' infile

For Example :
$ cat infile
M1  D.130   a   a   a
M2  D.104   -   a   ab
M3  D.150   ab  ab  a
M4  D.160   a   a   -
M5  D.107   a   ab  a
M6  D.107   -   ab  -
M7  D.104   a   ab  ab

$ awk -v n=3 '{for(i=1; i<=NF; i++)printf("%s%s",$i,i==NF?ORS:i<n?OFS:",")}' file
M1 D.130 a,a,a
M2 D.104 -,a,ab
M3 D.150 ab,ab,a
M4 D.160 a,a,-
M5 D.107 a,ab,a
M6 D.107 -,ab,-
M7 D.104 a,ab,ab

With Gawk to retain original spacing
$ awk -v n=3 '{split($0,t,FS,d);for(i=1; i<=NF; i++)printf("%s%s",$i,i==NF?ORS:i<n?d[i]:",")}' infile
M1  D.130   a,a,a
M2  D.104   -,a,ab
M3  D.150   ab,ab,a
M4  D.160   a,a,-
M5  D.107   a,ab,a
M6  D.107   -,ab,-
M7  D.104   a,ab,ab

With non-Gawk to retain original spacing
$ awk -v n=3 '{split($0,d,/[^[:space:]]*/);for(i=1; i<=NF; i++)printf("%s%s",$i,i==NF?ORS:i<n?d[i+1]:",")}' infile
M1  D.130   a,a,a
M2  D.104   -,a,ab
M3  D.150   ab,ab,a
M4  D.160   a,a,-
M5  D.107   a,ab,a
M6  D.107   -,ab,-
M7  D.104   a,ab,ab

A: With GNU awk for the 3rd arg to match():
$ awk 'match($0,/(([^\t]+\t){2})(.*)/,a) {gsub(/\t/,",",a[3]); print a[1] a[3]}' file
M1      D.130   a,a,a
M2      D.104   -,a,ab
M3      D.150   ab,ab,a
M4      D.160   a,a,-
M5      D.107   a,ab,a
M6      D.107   -,ab,-
M7      D.104   a,ab,ab

With any awk:
$ awk 'match($0,/([^\t]+\t){2}/) {r=substr($0,RLENGTH+1); gsub(/\t/,",",r); print substr($0,1,RLENGTH) r}' file
M1      D.130    a,a,a
M2      D.104    -,a,ab
M3      D.150    ab,ab,a
M4      D.160    a,a,-
M5      D.107    a,ab,a
M6      D.107    -,ab,-
M7      D.104    a,ab,ab

A: You can use this awk command :
$ awk '{for(i=3; i<NF; i++){a=a$i","} {OFS="  "; print $1,$2,a$NF} a=""}' file
M1  D.130  a,a,a
M2  D.104  -,a,ab
M3  D.150  ab,ab,a
M4  D.160  a,a,-
M5  D.107  a,ab,a
M6  D.107  -,ab,-
M7  D.104  a,ab,ab

A: Simple awk approach:
awk -F'\t' '{ r=$1 FS $2 FS $3; for(i=4;i<=NF;i++) r=r","$i; print r }' file

The output:
M1  D.130   a,a,a
M2  D.104   -,a,ab
M3  D.150   ab,ab,a
M4  D.160   a,a,-
M5  D.107   a,ab,a
M6  D.107   -,ab,-
M7  D.104   a,ab,ab

A: With sed
sed 's/\t/,/3;s/\t/,/3' file


text:
Q: Changing MacOS Location based on SSID - can't get script to run automatically I'm trying to get this GitHub project up and running on my Mac, for the purposes of automatically changing my network location when I switch physical location (based on the SSID I'm connected to). I have two problems I'm so far unable to resolve.

*

*I've followed the instructions to update the appropriate location names, and associated SSID's, and it largely all works as it should. However, there's one SSID that has a space in the name, and when I connect to that SSID, it falls back to "Automatic" location as it did not find a matching SSID in the list. I have updated the script as per the suggestions below to put quote marks in all the places they are missing, but the issue appears to be in getting the SSID in the first place. The log file echoes the new SSID name, and if my SSID were my wifi it just echoes New SSID Found: my. So I likely just need to slightly change the line of code that gets the SSID (below), but I'm not sure how.

SSID=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/ SSID:/ {print $2}')

*I've completed the automated installation (executed ./install.sh on the appropriate directory), and it has placed all the files in the relevant places. However, it does not automatically run whenever I switch SSID's. I can double click on the executable at any point and it will run and select the correct location, but it doesn't execute automatically, which is the whole point of the exercise. Have I missed a step somewhere?

I'm extremely new to scripting on mac and GitHub in general; my previous experience is all on Windows. So I'm probably overlooking something really simple, but I just don't have the skills yet to work out where it is.
Running macOS Catalina 10.15.2

A: Nice sleuthing! It should work if you change the awk to use a colon and a space as the field separator:
SSID=$(AIRPORTTHING| awk -F ': ' '/ SSID:/ {print $2}')

Failing that, this should work too:
SSID=$(AIRPORTTHING| sed -n 's/^ *SSID: //p')


text:
Q: CPU always at 80°C while the system is idle My system is quite unused at the moment:
%Cpu(s): 10.3 us,  3.1 sy,  0.0 ni, 85.9 id,  0.7 wa,  0.0 hi,  0.0 si,  0.0 s

but still the temps sensors give me are quite high:
acpitz-virtual-0
Adapter: Virtual device
temp1:        +79.0°C  (crit = +88.0°C)

asus-isa-0000
Adapter: ISA adapter
temp1:        +79.0°C

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +80.0°C  (high = +80.0°C, crit = +85.0°C)
Core 0:         +80.0°C  (high = +80.0°C, crit = +85.0°C)
Core 1:         +78.0°C  (high = +80.0°C, crit = +85.0°C)

radeon-pci-0100
Adapter: PCI adapter
temp1:        +88.0°C

I cannot understand what process is causing the temperatures to be so high.


text:
Q: A polynomial $x^2 + ax + b$ with three distinct roots modulo $4$
Give an example of a polynomial $x^2 + ax + b \in R[x]$, where $R = \mathbb{Z}$ / $4\mathbb{Z}$, which has 3 distinct roots in $R$.

My immediate thought is that there is no such polynomial because the degree of of the polynomial is less than the number of roots we're looking for. Is that right or naive?

A: In general we can only conclude that the number of roots of a nonzero polynomial $p$ over a ring $R$ is $\leq \deg p$ when $R$ is a field.

Example We have $x^3 = x \bmod 6$ for all $x$ modulo $6$, so the (cubic) polynomial $x^3 - x$ has $6$ roots in $\Bbb Z / 6 \Bbb Z$.

Now, $\Bbb Z / 4 \Bbb Z$ contains a zero divisor, namely, $[2]$, and so is not a field. That said, an exhaustive search shows that no polynomial $x^2 + a x + b$ modulo $4$ has $\geq 3$ distinct roots, but there are two such polynomials, namely $x^2$ and $x^2 + 2 x + 1 = (x + 1)^2$ with two roots of multiplicity two each, and hence total multiplicity larger than the degree of the polynomial. There is a unique quadratic polynomial with $> 2$ distinct roots modulo $4$, namely, $2 x^2 + 2 x = 2 (x + 1) x$.


text:
Q: Detecting Significant Changes in Time Series I'm hoping someone might be able to point me in the right direction for this problem. I've anonymised the problem by describing it in terms of supermarket purchase data rather than the real context so the problem might seem a bit nonsensical but the idea should be the same. The data fields are all categorical.
I have a large dataset with product purchases (each row is a purchase) including 10-15 attributes associated with each purchase. I want to identify purchases that relate to instances where either the number or relative frequency of a particular value in a particular field becomes unusually high. For example, let's say one field is 'location of purchase'. If Manchester purchases normally are 1.5% of the population but from Monday 9am to Monday 12am are 70% of the population, that's unusual. Furthermore, I want to be able to identify that if 60% of those purchases are for tomatoes, that's unusual because purchases of tomatoes in Manchester are not normally 42% of the population. I need to do this for period n using only the time periods 1,2 …, n-1.
The things I have considered are:

*

*Computing mean and standard deviation of number of purchases for a particular attribute and particular value in historic time periods (averaging across the historical periods) and then measuring number of standard deviations from the mean at the current time. I could do the same thing for the proportion of purchases. The problem is I then need to have a threshold.

*Compute the entropy of the current time period (using either number or proportion of purchases as input) and compare to previous entropies, but again I need a threshold.

Aside from the problems I mentioned these also feel a bit basic; I am sure there is some better method but I can't think of what it might be. Some thoughts that I have had that may or may not help someone else answer this:

*

*I don't think this can be solved by anomaly detection approaches since the 'anomaly' relates to many data points and the data at time n, n+1, n+2 ... is not available

*I'm more of a machine learning than statistics person but I can't think of any machine learning approaches to this (open to hearing any ideas)

A: The things you have considered are pretty standard. Based on your description, it sounds like you do have thresholds that make sense to you, but they are combinations, not a single number of an attribute. The real solution, then, will depend on your domain expertise and what analyses reach your version of a threshold.  Some things to look into:

*

*z-score of the change in attributes.  You may find that analyzing
the derivative of your attribute comes closer to your intuition, and
that setting a threshold of 4 or 5 captures the changes you're
looking for.

*Mahalanobis distance is quite useful for
multi-variate distributions.  You can provide a window of attributes
and then check if a single row would fall into that distribution.
In your case, you might need to label your history to capture
distances that make sense to you (compute distance and run it
through a random forrest classifier or something), but you can also
compute histograms and select bins as outliers.

*There is a good review, including a few other techniques for multivariate
distributions here, which focuses on outliers.  I've had
success with the projection methods, but it isn't a
one-size-fits-all solution.

In general, "outlier" is very contextual and depends on your version of what is unusual.  There isn't a blackbox tool for that which isn't simply statistical (i.e. "basic").  But, with machine learning, you can label and teach using some of those methods!


text:
Q: Is it correct to say "I have to reschedule the interview for tomorrow night" I am not sure which preposition I should use here, but I have an interview scheduled for/at/on tomorrow's night and I was trying to reschedule it. This is what I wrote:

Sorry I have not been feeling well since yesterday so I have to reschedule the interview for tomorrow night.

Is this correct? How do I let the other person know that I reschedule the interview which was originally scheduled on some date and I want it to be rescheduled at some other date?
Does the sentence I wrote: "I have to reschedule the interview for tomorrow night." mean that:

*

*the original interview was scheduled at tomorrow's night

*Or the newly proposed date is tomorrow's night

A: The example you give would be taken to mean that you want to reschedule the interview so that it now takes place tomorrow night.
To reschedule a meeting due to take place tomorrow night to some other time you could write:
Sorry I have not been feeling well since yesterday so I have to reschedule tomorrow night's interview for <some other date/time>.

A: The preposition "for" can refer to the time of a current appointment, or the new time of a rescheduled appointment:

I have a appointment for 2:00.
The appointment has been rescheduled for 2:00.

So depending on how the listener parses your sentence, it could have either of the meanings you suggest.

*

*I have to reschedule [the interview (which is currently scheduled) for tomorrow night] (to some other time).

*I have to reschedule [the interview] for (meaning "to") tomorrow night.
To make it unambiguous, you can just remove the "for":

I have to reschedule the interview tomorrow night.

This can only mean that the meeting scheduled for tomorrow night has to be rescheduled to some other time.


text:
Q: Targeting react native views in JavaScript Is there a way I can target views created in react native in JavaScript code akin to what I can do in JavaScript for web? i.e. give an ID to a view and then call document.getElementById ?
What I am trying to achieve is a way to toggle the visibility of a View on a button (TouchableHighlight) tap.

A: There is a way to target a view or component in React Native, through refs.
https://facebook.github.io/react/docs/more-about-refs.html.
But, in your case if what you are trying to do is toggle a view you can achieve this by returning a view based on a state variable being true or false. Something like:
toggleView() {
  this.setState({
      showView: !this.state.showView
  })
}

var view = <View><Text>This view is being toggled</Text></View>

<TouchableHighlight onPress={ () => this.toggleView() } >
    <Text>Toggle View</Text>
</TouchableHighlight>

{this.state.showView && view}

There's a working project set up here. Full code is below.
https://rnplay.org/apps/puK5UQ
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight
} = React;

var SampleApp = React.createClass({

  getInitialState() {
        return {
            showView: true
        }
    },

  toggleView() {
    this.setState({
        showView: !this.state.showView
    })
  },

  render: function() {

    var view = <View style={{height:100, backgroundColor: 'red'}}><Text>This view is being toggled</Text></View>

    return (
      <View style={styles.container}>
        <TouchableHighlight underlayColor="#efefef" onPress={ () => this.toggleView() } style={{marginTop:60, backgroundColor: '#ededed', height:60, flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
            <Text style={{ fontSize:20 }}>Toggle View</Text>
        </TouchableHighlight>
        {this.state.showView && view}
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,

  },
});

AppRegistry.registerComponent('SampleApp', () => SampleApp);


text:
Q: AngularJS - Cancelling a HTTP Request From a Service That Returns a Promise I have a service method that looks like:
this.myServiceFunction = function(){
    var deferred = $q.defer();
    $http({
        method: 'GET',
        url: 'domain/myendpoint'
    })
        .success(function(data){
            deferred.resolve(data);
        })
        .error(function(data){
            deferred.reject(data);
        });
    return deferred.promise;
};

I use this method in my controller in the following fashion:
$scope.myControllerFunction = function(){
    myService.myServiceFunction().then(function(){
        // Do things when promise resolves
    });
};

I would like to cancel the HTTP call above in another function on command.  I found this answer which allows you to cancel a HTTP request by calling the resolve() method on the object returned from $q.defer().  But in my codebase, this object is never made available in my controller.
myService.myServiceFunction() in the example above returns a promise object returned from $q.defer().  How do I cancel my HTTP request within the confines of what I have?

A: The following answers the question, without the overhead in your original code.
this.myServiceFunction = function(){
  this.canceler = $q.defer();
  return $http({
    method: 'GET',
    url: 'domain/myendpoint',
    timeout: this.canceler.promise
  });
};

this.cancelServiceFunction = function() {
  return this.canceler.resolve();
};

If however, you are required to use that pattern for some reason, you can use the following:
this.myServiceFunction = function(){
  this.canceler = $q.defer();
  this.deferred = $q.defer();

  $http({
    method: 'GET',
    url: 'domain/myendpoint',
    timeout: this.canceler.promise
  })
  .success(function(data){
    deferred.resolve(data);
  })
  .error(function(data){
    deferred.reject(data);
  });

  return deferred.promise;
};

this.cancelServiceFunction = function() {
  return this.canceler.resolve();
};


text:
Q: update yiiwheels highchart via javascript I'm using highchart widget from yiiwheels (extension for Yii framework):
<?php $this->widget('yiiwheels.widgets.highcharts.WhHighCharts',array(
'pluginOptions' => array(
            'title' => array('text' => 'Fruit Consumption'),
            'xAxis' => array('categories' => array('Apples', 'Bananas', 'Oranges')),
            'yAxis' => array('title' => array('text' => 'Fruit eaten')),
            'series' => array(
                array('name' => 'Jane', 'data' => array(1, 0, 4)),
                array('name' => 'John', 'data' => array(5, 7, 3))
            )
        )
    ));?>
echo TbHtml::button('Refresh Chart', array('id'=>'refreshButton')); ?>

<script type="text/javascript">
    $('#refreshButton').click(function() {
        var chart = $('#container').highcharts(); // THIS IS NOT WORKING, HELP!!!
        chart.series[0].setData([129.2, 144.0, 176.0, 135.6, 148.5] ); // sample data
});
</script>

This works well if I use native highcharts.js from highcharts.com
But like I said, I use yiiwheels's highcharts widget.
How can I fix this, how to refer my chart from javascript/jquery?
Thanks


text:
Q: SSIS XSD Definition Where can I find the XSD for the SSIS dtsx files?

A: Here is all the XSD you need to work with SSIS package files.
http://msdn.microsoft.com/en-us/library/gg600473.aspx
Hope that it helps

A: I'm afraid it has not been published. This is from someone who worked with SSIS documentation at Microsoft.
http://dougbert.com/blogs/dougbert/archive/2008/07/19/lt-published-gt-some-of-the-xml-schemas-used-by-integration-services-lt-published-gt.aspx


text:
Q: Uncaught DOMException: Document.querySelector: '.3-1' is not a valid selector Basically I'm gonna update this class' html but I keep getting the same error and have absolutely no idea why
document.querySelector(`.${clickField}`).innerHTML = `<img src ='${icon}.svg'>`

Uncaught DOMException: Document.querySelector: '.3-1' is not a valid selector

(I've seen similar questions but they all have jquery etc so i didnt understand shit from them)
Someone just said classes cant start w numbers he's right im so dumb lmfao
image of 3-1 existing in DOM

A: I'm assuming clickField is supposed to be the class of the element you want to get. In that case, since the class starts with a digit, the easiest way to select it using CSS selector is using attribute selectors, like so:
document.querySelector(`[class="${clickField}"]`).innerHTML = `<img src ='${icon}.svg'>`

If clickField might contain " characters, you need to replace ${clickField} by ${clickField.replace(/"/g, '\\"')} to escape them properly.
There is also a far easier way, using document.getElementsByClassName():
document.getElementsByClassName(clickField)[0].innerHTML = `<img src ='${icon}.svg'>`

Classes may contain any characters except space, as the HTML standard imposes no restrictions on them.


text:
Q: How to detect if String contains url and make url clickable using javascript react js Hi guys am trying to detect if a string contains url and if yes wrap it using anchor tags and make it click able. but what i have display both the string and the anchor tags.
My code

function urlify(text) {
        var urlRegex = /(https?:\/\/[^\s]+)/g;

        return text.replace(urlRegex, function(url) {
            var hyperlink = url;
            if(!hyperlink.match('^https?:\/\/')){
                hyperlink = 'http://' + hyperlink;
            }
          return '' + url + ''

        })
        // or alternatively

      }

Inside my html code

{urlify(text)}

output
first remove anchors before return text.replace – Muneeb Mirza https://onlyfans.com/my/notifications

Instead of displaying the link with the anchor tags i want to display it as clickable link without the tags.

A: Assuming the urlify function is working as you expect, the result should be considered an HTML string. Use dangerouslySetInnerHTML to set the inner text of the p tag.
Example:

As the name suggests, this is potentially a dangerous function, but if you've full control over the content and computing the HTML tags that are generated, it's probably pretty safe.
If you've any concern over the content though then I suggest also using DOMPurify to help sanitize the text value before you process it to create the links.


text:
Q: Multidimensional multiple-choice knapsack problem: find a feasible solution My assignment is to use local search heuristics to solve the Multidimensional multiple-choice knapsack problem, but to do so I first need to find a feasible solution to start with.
Here is an example problem with what I tried so far.
Problem
           L1  L2  L3

RESOUCES : 8   8   8

GROUPS:

    G1:

            11.0    3    2    2
            12.0    1    1    3

    G2:

            20.0    1    1    3
            5.0     2    3    2

    G3:

            10.0    2    2    3
            30.0    1    1    3

Sorting strategies
To find a starting feasible solution for my local search I decided to ignore maximization of gains and just try to fit the resources requirements.
I decided to sort the choices (strategies) in each group by comparing their "distance" from the multidimensional space origin, thus calculating SQRT(R1^2 + R2^2 + ... + RN^2). I felt like this was a keen solution as it somehow privileged those choices with resouce usages closer to each other (e.g. R1:2 R2:2 R3:2 < R1:1 R2:2 R3:3) even if the total sum is the same.
Doing so and selecting the best choice from each group proved sufficent to find a feasible solution for many[30] different benchmark problems, but of course I knew it was just luck. So I came up with the problem presented above which sorts like this:
           L1  L2  L3

RESOUCES : 8   8   8

GROUPS:

    G1:

            12.0    1    1    3 < select this
            11.0    3    2    2

    G2:

            20.0    1    1    3 < select this
            5.0     2    3    2

    G3:

            30.0    1    1    3 < select this
            10.0    2    2    3

And it is not feasible because the resources consmption is R1:3, R2:3, R3:9.
The easy solution is to pick one of the second best choices in group 1 or 2, so I'll need some kind of iteration (local search[?]) to find the starting feasible solution for my local search solution.
Here are the options I came up with
Option 1: iterate choices
I tried to find a way to iterate all the choices with a specific order, something like
G1   G2   G3
1    1    1
2    1    1
1    2    1
1    1    2
2    2    1
...

believeng that feasible solutions won't be that far away from the unfeasible one I start with and thus the number of iterations will keep quite low.
Does this make any sense? If yes, how can I iterate the choices (grouped combinations) of each group keeping "as near as possibile" to the previous iteration?
Option 2: Change the comparation term
I tried to think how to find a better variable to sort the choices on.
I thought at a measure of how "precious" a resource is based on supply and demand, so that an higer demand of a more precious resource will push you down the list, but this didn't help at all.
Also I thought there probably isn't gonna be such a comparsion variable which assures me a feasible solution at first strike.
I there such a variable? If not, is there a better sorting criteria anyways?
Option 3: implement any known sub-optimal fast solving algorithm
Unfortunately I could not find any of such algorithms online. Any suggestion?

EDIT
NOTE: I updated the previous description using labels L1 L2 L3 for the problem resource limits in place of R1 R2 R3 which now indicate the resource requirements of each strategy (choice)
Fallowing the input by @J Trana, I decided to go and try a genetic algorithm for the problem setup.
This seemed quite fitting to the problem structure as each Group is a Gene, each Solution is a Chromosome and each Strategy is an Allele.
I also modified the distance expression to fit better with heterogeneous resource limits, so now the distance is : SUM(Rn/Ln) which should give a lower distance (i.e. higher priority) to those strategies with lower resource requirement portions.
Since this part is intended only for solving initialization, I chose the fallowing genetic functions:
Fitness
// if solution is feasible, that's just enough, it has the greatest fitness possible
if(solution.isFeasibleInProblem()) return Integer.MAX_VALUE;

ArrayList<Integer> consumptions = new ArrayList<Integer>();

for(Integer limit : problem.resourceLimits){
    consumptions.add(0);
}

// add the resources consumptions from each group
for(Group g : genes){
    for(int i = 0; i < g.currentSelectedSolution.resourceRequirements.size(); i++){
        consumptions.set(i, consumptions.get(i) + g.currentSelectedSolution.resourceRequirements.get(i));
    }
}

ArrayList<Double> subFitnesses = new ArrayList<Double>();

// each subFitness is the ratio between the total limit and the actual consumption
// this way if the consumption is < limit subFitness is greater than 1 (rises the fitness), else it is less than 1 and lowers the fitness
for(int j = 0; j < consumptions.size(); j++){
    double subFitness = problem.limits.get(j) / consumptions.get(j);
    subFitnesses.add(subFitness);
}

double fitness = 1;

for(Double sF : subFitnesses){
    fitness *= sF;
}

return fitness;

So resource requirements lesser than the limit rise the fitness, where requirements greater than the limit lower the fitness.
Mutation
For the mutation function I found that feasible solutions contain strategies with smaller distance and considering solutions far down in the ordered distance list slows the evolution because most of the time those mutations have negative effects.
public void mutate(int strategyIndex, double mutationIntensity){

    // if there's no choice, don't mutate
    if(this.strategies.size() <= 1) return;

    ... here I'd need something that keeps in the first positions of the list
    but eventually, with higher mutation intensities, goes to greater indexes...

    selectStrategy(newStrategyIndex);

}

The above solution works very well for most of the benchmarks, but there are 2 of them, having a lot of choices per group and a lot of resources per choice, that simply won't find a feasible solution.
How could I implement the mutation algorithm so that those 2 benchmarks convert to a feasible solution? Is there any improvement I can put in my fitness function or in the strategy ordering to speed up the solving path?


text:
Q: How to enable post code entry text box in flutter-stripe plugin? currently, we using bellow packages in a flutter to use stripe as our paymentgateway,
https://pub.dev/packages/stripe_payment
if we compare flutter integration with a web interface (laravel-stripe) ( stipe intent ),
there are 2 different
a) In Web there is an option to enable "postcode" so that users can type postcode but in flutter-stripe packages, it's missing.
b) in laravel-stripe, when there are some issues with stripe i.e (not sufficient fund or postcode validation issues, we get clear messages back from the stripe,
however, in stripe-flutter plugin we just get basic "payment declined"
my question is,
a) Can we enable postcode entry when using a flutter-stripe plugin?
b) when using fluter-stipe plugin, can we get more detailed message from stripe when a payment fails?
Please let me know
we are about to go live but now we realized these two issues
Thanks

A: I'm not familiar with Flutter, but you may want to ask other users in the issues for the repository. Note that this package is a port of tipsi-stripe, and links to its docs for examples.
You can see this doc describing creating a payment method including billing details.


text:
Q: Open link in browser inside iOS app with web techniques Let's assume someone is running a web app directly inside a simple iOS app with UIWebView.
It it possible to open a external website link inside the browser (Safari Mobile) with web techniques like JavaScript? If yes, how could it be done?

A: To open a URL programmatically:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.google.com"];

As far as your WebView, you can use your WebViewDelegate to catch and inspect any hyperlinks the user selects.  For example:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSURL *urlPath = [request URL];
    if (navigationType == UIWebViewNavigationTypeLinkClicked)
    {
        if ([[urlPath scheme] hasPrefix:@"http"]))
        {
            [[UIApplication sharedApplication] openURL:urlPath];
            return (NO);
        }

    }

    return (YES);
}

This should open any hyperlink click in browser app.
You can also create a custom protocol, see Android / iOS - Custom URI / Protocol Handling, and catch those in this same delegate handler by checking the [url scheme] property.  This will allow you to explicitly do something with javascript.


text:
Q: Facebook API - access token works for SOME requests This is driving me totally crazy. I've set up an FB app and retrieved an access token by visiting: https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET.
Now I want to grab a (publicly available) feed from this URL: https://graph.facebook.com/PAGE_OR_USER_ID/feed?access_token=ACCESS_TOKEN
It works fine when I try it with my own user ID or even when I try another random page but it DOESN'T work when I enter the PAGE_ID I need it to work with.
Here are some examples:
This works fine (a friend of mine's Facebook page):
https://graph.facebook.com/tatchit/feed?access_token=213451182120494|JgAwuCE74lh51t1pKMuRM2mz3GU&limit=10&offset=0
This also works fine (my own Facebook ID):
https://graph.facebook.com/al.dev.7/feed?access_token=213451182120494|JgAwuCE74lh51t1pKMuRM2mz3GU&limit=10&offset=0
This doesn't work (the client's Facebook page):
https://graph.facebook.com/142616539131188/feed?access_token=213451182120494|JgAwuCE74lh51t1pKMuRM2mz3GU&limit=10&offset=0
I don't get any errors but the result is empty.
If I try the Graph API Explorer it also works fine:
https://developers.facebook.com/tools/explorer/?method=GET&path=142616539131188%2Ffeed
But not if I enter my own access token. From what I understand the access tokens you get in the API Explorer are temporary so I don't want to use that.
How can this be?
Also. I've struggled to understand this whole access-token, client-id, app-id-business for ages now - is there a good tutorial where all this stuff is explained? I've never had this work without problems ever.
Thank you

A: You are using an App Access token instead of a User Access token. Some of the pages you are viewing may have a country or age restriction set, so using an app token will not work.
See: http://developers.facebook.com/docs/concepts/login/access-tokens-and-types/

A: You should be using user access token for all the above queries. App Access token is used when you want to do something like check the app insights so and so.
When the pages has age restrictions or something so, app token wont be able to get through, but since the user is already a member of the page, you can use the user access token to get the data.
Add : Quoting from the documentation,
Note that the **app access token** is for publishing purposes permitted by the publish_actions and publish_stream permissions. You will be **unable to retrieve information** about the status update post with the given ID using the app access token. Instead, you should use a **user access token** for such purposes.

Other Capabilities of an App Access Token
There is a limited set of information that can be retrieved from Facebook using an App Access Token.
    Basic Profile Info of a User (ID, Name, Username, Gender)
    A User's Friends and their IDs
    Permissions granted by the User to your App

Read : https://developers.facebook.com/docs/opengraph/using-app-tokens/
So you should be querying with the user_access token to access all the informations that you are looking for, not with an app access_token.


text:
Q: What is endpoint to access a user's Office 365 group using Microsoft Graph API? I am using https://graph.microsoft.com/v1.0/groups but it needs admin privilege. Does anyone know how to get the groups assigned to sign-in user?

A: For an app to read or manage an Office 365 group, it does require an administrator to grant those permissions to the application.  Once granted, the app can query for the O365 groups that the signed in user is a member of.  For more information please see the scenarios section in the permissions topic here: https://graph.microsoft.io/en-us/docs/authorization/permission_scopes#permission-scope-scenarios.
Also the front page overview of the Microsoft Graph documentation has a table with common queries: https://graph.microsoft.io/en-us/docs/overview/overview.  The one you want (to get the groups for the signed in user) is:
GET https://graph.microsoft.com/v1.0/me/memberOf/$/microsoft.graph.group?$filter=groupTypes/any(a:a%20eq%20'unified')

Hope this helps,


text:
Q: Magento 1.9 Update stock product status with sql query We want to update stock status with sql query. This query worked and products status does as out of stock in product page. But when i did clearing cache, products is appearing in stock
when i check products in admin panel, products is appearing in stock.
Does magento has function for product status change?
$query = "UPDATE cataloginventory_stock_status SET stock_status = 0 WHERE product_id=".$product_id;

Thanks.

A: try this query, in will prevent product appears on the website searching result and although product page can be accessed on the frontend by url, it cannot be added to cart :
$query = "UPDATE cataloginventory_stock_item SET is_in_stock = 0 WHERE product_id=".$product_id;

hope this works