text:
Q: Get Many Through and reverse in Laravel 9 I am building an app that has multiple vendors selling products. I need to isolate the customers who have placed an order with that particular vendor.
I have 3 models; Vendor, Customer, Order.
Vendor 'hasMany' Orders.
Order 'belongsTo' Vendor
Order 'belongsTo' Customer
Customer 'hasMany' Orders
class Vendor extends Model
{
    /**
     * @return HasMany
     */
    public function orders(): HasMany
    {
        return $this->hasMany(Order::class);
    }
}

class Order extends Model
{
    /**
     * @return BelongsTo
     */
    public function customer() : BelongsTo
    {
        return $this->belongsTo(Customer::class);
    }

    /**
     * @return BelongsTo
     */
    public function vendor() : BelongsTo
    {
        return $this->belongsTo(Vendor::class);
    }
}

class Customer extends Model
{
    /**
     * @return HasMany
     */
    public function orders(): HasMany
    {
        return $this->hasMany(Order::class);
    }
}

I would like to get all of the orders for a vendor, something like:
class Vendor extends Model
{
    /**
     * @return HasManyThrough
     */
    public function customers(): HasManyThrough
    {
        return $this->hasManyThrough(Customer::class, Order::class);
    }

}

What is the best way to do this?
I have tried hasManyThrough, however as the relationships are not one directional, it doesn't appear to work.

Edit: Here's the relevant migrations:
Vendor
        Schema::create('vendors', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable();
            $table->string('logo')->nullable();
            $table->string('business_type', 32);
            $table->string('address', 128)->nullable();
            $table->string('postcode', 16);
            $table->bigInteger('town_id')->unsigned()->index();
            $table->string('website', 128)->nullable();
            $table->string('telephone', 64)->nullable();
            $table->tinyInteger('approved')->default(0);
            $table->timestamps();
        });

Customer
        Schema::create('customers', function (Blueprint $table) {
            $table->id();
            $table->string('email')->unique();
            $table->string('first_name');
            $table->string('last_name');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->boolean('is_active');
            $table->string('country');
            $table->timestamps();
        });

Order
        Schema::create('orders', function (Blueprint $table) {
            $table->id();

            $table->string('status')->index();
            $table->bigInteger('customer_id')->unsigned()->nullable()->index();
            $table->bigInteger('vendor_id')->unsigned()->index()->nullable();
            $table->string('reference')->nullable()->unique()->index();
            $table->decimal('sub_total')->default(0);
            $table->decimal('discount_total')->default(0);
            $table->decimal('shipping_total')->default(0);
            $table->decimal('tax_total')->default(0);
            $table->decimal('grand_total')->default(0);
            $table->timestamps();
        });

A:
I would like to get all of the orders for a vendor

Then you need to fix your Vendor model as follow (same for Customer model)
class Vendor extends Model
{
    public function orders()
    {
        return $this->hasMany(Order::class);
    }

}

If your order belongs to more relationships than now, you should consider Polymorphic Relationships


text:
Q: How can I Unit Test Gestures in android? I want to unit test a swipe left/right action on the screen in Android but I haven't been able to find any documentation on it. Can anyone lend a hand? Can it even be done?

A: Generally the touch will perform an action and you will be testing the action, not the touch itself.

A: I found your question trying to learn how to do the exact same thing for the exact same type of gesture. I was able to run pretty pure unit tests using the following approach. In other words unit test View.OnTouchListener.onTouch(View v, Event event) function.
Here is how I was able to "mock" the View and Event in order to run onTouch
import android.os.Looper;
import android.test.mock.MockContext;
import android.view.MotionEvent;
import android.view.ViewStub;
import junit.framework.TestCase;

public class SwipeDetectorTest extends TestCase {
    public void testOnTouch() throws Exception {
         class MyMockContext extends MockContext {
            public Looper getMainLooper() {
                return Looper.getMainLooper();
            }
        }
        MyMockContext context = new MyMockContext();
        View v = new ViewStub(context);
        int x = 0; int y = 0;

        // simulated down event
        MotionEvent event =
            MotionEvent.obtain(1, 0, MotionEvent.ACTION_DOWN, x, y, 0);
        SwipeDetector swipeDetector = new SwipeDetector();
        assertFalse(swipeDetector.onTouch(v, event));

        x = 30; y = 0;
        event =
           MotionEvent.obtain(1, 1, MotionEvent.ACTION_MOVE, x, y, 0);
        boolean action = swipeDetector.onTouch(v, event);
        assertTrue(action);

        boolean result = swipeDetector.getSwipeHorizontal()
            .equals(SwipeDetector.Action.LeftToRight);
        assertTrue(result);
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Access URL by program in C# for Session Managed Website I want to request the URL by program not by Browser and getting the response in C#  for session managed website for example, first C# will  hit the login page (using userName and Password) then next page, I am using request.getresponse() as HttpwebResponse,  but it login successfully and when I hit the next page URL then its saying session is null  and its Redirecting to the login page (and I am getting Response URI as login page URL ). How can I access the website using URL hit  for session managed website.

A: Sounds like the site uses Cookies and you need to include the cookies you get from the response in your subsequent requests:
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(response.Cookies);


text:
Q: Windows notification not displayed by calling .exe in vb.net with process.start I have a vb.net program, that calls an .exe with Process.start()
Short summary about this .exe: It downloads File from a WebServer and sends some Windows notification when download started.. This algorithm works fine, if I just start my "LiveUpdate.exe" file.
This is my call in the vb.net code:
Process.Start(location & "LiveUpdate.exe", "-f "settings.ini")
And this is my c# notification method
public void Popup(string title, string description, Icon systemIcon, ToolTipIcon icon = ToolTipIcon.Info)
        {
            var notification = new NotifyIcon()
            {
                Visible = true,
                Icon = systemIcon, //SystemIcons.Information,
                BalloonTipIcon = icon,
                BalloonTipTitle = title,
                BalloonTipText = description
            };
            Task.Run(() => OpenAndCloseNotification(notification, 2));
        }

        public void OpenAndCloseNotification(NotifyIcon notification, int secconds)
        {
            var milisecconds = secconds * 1000;
            notification.ShowBalloonTip(milisecconds);
            Thread.Sleep(milisecconds);
            notification.Dispose();
        }

Clould it be, that vb.net doesn't allow to popup Windows - notifications?
I'll attach more code if you need it, thanks in advance.

A: This is how it's looks, you can change the background image and remove the transparencies.
if you do not, choose a background with a plain background, so it set that color as transparent and only the shape of the central image remains.

     Private x, y As Integer
    Private fondo As Image
    Private icono As Icon
    Private WithEvents temporizador As Timer
    Private inicio As DateTime
    Private tiempo As Integer

    Private Sub FNotifi_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim destination = New Bitmap(Size.Width, Size.Height)
        Dim original = Image.FromFile(".\Resources\Imagenes\Fondo1_2.bmp")
        Using g = Graphics.FromImage(destination)
            g.InterpolationMode = InterpolationMode.NearestNeighbor
            g.DrawImage(original, New Rectangle(0, 0, destination.Width, destination.Height), New Rectangle(0, 0, original.Width, original.Height), GraphicsUnit.Pixel)
        End Using

        Dim bmp As Bitmap
        ' bmp = New Bitmap(".\Resources\Imagenes\Fondo1_2.bmp")
        bmp = New Bitmap(destination)
        'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
        'como transparente en el Bitmap (color RGB 255,0,0)
        'bmp.MakeTransparent(bmp.GetPixel(1, 1))
        'colocar el Bitmap como fondo del formulario
        Me.BackgroundImage = bmp
        'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
        'como transparente también en el formulario (color RGB 255,0,0)
        Me.TransparencyKey = bmp.GetPixel(1, 1)
        Me.BackgroundImageLayout = ImageLayout.Zoom

        Dim workingArea As Rectangle = Screen.GetWorkingArea(Me)
        x = workingArea.Right - Size.Width
        y = workingArea.Bottom - Size.Height
        Me.Location = New Point(x, y)

    End Sub

    Public Sub New(Titulo As String, mensaje As String, ByRef tempo As Timer, Optional tiempo As Integer = 10000)
        ' Esta llamada es exigida por el diseñador.
        InitializeComponent()

        inicio = Now
        temporizador = tempo
        Me.tiempo = tiempo

        LblTitulo.Text = Titulo
        LblMensaje.Text = mensaje

    End Sub

A: I also had many problems with windows notifications since windows10.
I do not know what it depends but sometimes works and others don't.
you have tried to show the notification directly on a clic's event of a  button?
at least that way you'll check if it works.
Anyway what I had to do at the end was to create my own notifications, with a form that is displayed in the corner of the desk during the required time.
If you are interested in this solution, I'll show you the code


text:
Q: How to get user info from token after Bearer Token in asp.net web api If client A post username and  password to asp.net web API ,then WEB API generate a token response to client A.Next,Every time client A will send token to Web api.
Is there a way to get username from token in web api?

A: Try this
var username = User.Identity.Name;

A: I use Auth0 for authentication in my SPA. It is token based.
In my ASP.NET Web API code, I can use the following lines to get user info:
string userId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;

string name = User.Claims.FirstOrDefault(c => c.Type == "name")?.Value;

Hope that might help!


text:
Q: What are the commands to change value to msgmnb? I've tried cd /proc/sys/kernel followed by sudo chmod u=rwx msgmnb to get permissions for changing the value but I didn't get them, how can I do it?

A: The proc file system doesn't support permission changes in /proc/sys (thanks to ilkkachu for the correction). Any attempt to change a file's mode (which is what chmod does) is rejected with an "operation not permitted" error.
To change a value, you need to write the file as root:
echo newvalue | sudo tee /proc/sys/kernel/msgmnb

or, if you're root:
echo newvalue > /proc/sys/kernel/msgmnb

You can also use sysctl:
sudo sysctl -w kernel.msgmnb=newvalue

You can ensure your setting is applied at boot by adding it to /etc/sysctl.conf.

A: You cannot change permissions in /proc (at least not with chmod).

A: On my system, (almost) everything in /proc/sys/ already has write access for root. They're also the actual interface to the knobs used by sysctl, so they need to be writable. So, no need to chmod, just set new values. Either:
sysctl kernel.msgmnb=$somevalue

or
echo $somevalue > /proc/sys/kernel/msgmnb


text:
Q: Stdin to second command / password protected zip with php I'm hoping to create a oneliner that converts the stdin stream to a (named) file in a password protected zip archive.
So far I've got:
mkfifo importlog.txt; cat - > importlog.txt & zip --password testpass - --fifo importlog.txt; rm importlog.txt;

This works fine when I replace cat - with echo "content", but with the cat - in place a zip file is created with an empty importlog.txt. My preference really is to stream the content, as it will be quite a lot.
I think my question is how to stream stdin to the second command, but it's very much possible I've overlooked an other solution. I'm trying to use this from a php script with proc_open and fwrite.

A: I don't think it's possible to solve this as a single line of bash code. I ended up writing a larger php function that streams the content through a named pipe.
function createSingleFileZipArchive($filename, $contents, $password = null){

    $filename = (string) $filename;
    if(mb_strlen(trim($filename)) === 0){
        throw new LengthException('Filename empty');
    }

    //create subfolder in tempdir containing process id to prevent concurrency issues
    $tempDir = sys_get_temp_dir().'/phpzip-'.getmypid();
    if(!is_dir($tempDir)){
        mkdir($tempDir);
    }

    //create FIFO and start zip process that reads fifo stream
    $madeFifo = posix_mkfifo($tempDir.'/'.$filename, 0600);
    if($madeFifo === false){
        throw new RuntimeException('failed to create fifo to stream data to zip process.');
    }
    $proc = proc_open('cd '.$tempDir.'; zip'.($password === null ? null : ' --password '.escapeshellarg($password)).' - --fifo '.escapeshellarg($filename), [['pipe', 'r'],['pipe', 'w'],['pipe', 'w']], $pipes);
    if($proc === false){
        throw new RuntimeException('failed to start zip-process');
    }

    //write to fifo
    $in = fopen($tempDir.'/'.$filename, 'w'); //always open fifo writer after reader is opened, otherwise process will lock
    fwrite($in, $contents);
    fclose($in);

    //get output before reading errors.
    //If no errors/debug output was generated the process could otherwise hang.
    $output = stream_get_contents($pipes[1]);

    //check if any errors occurred
    if ($err = stream_get_contents($pipes[2])) {
        $errorOutput = [];
        foreach(explode($err,PHP_EOL) as $errLine){
            $errLine = trim($errLine);
            if(strlen($errLine) > 0 && strpos($errLine, 'Reading FIFO') === false && strpos($errLine, 'adding:') === false){ //ignore default notices.
                $errorOutput[] = trim($errLine);
            }
        }
        if(count($errorOutput) > 0){
            throw new RuntimeException("zip-error: ".implode('; ',$errorOutput));
        }
    }

    //cleanup
    foreach($pipes as $pipe){
        fclose($pipe);
    }
    proc_close($proc);
    unlink($tempDir.'/'.$filename);
    rmdir($tempDir);

    //done
    return $output;

}

file_put_contents('importlog.zip',createSingleFileZipArchive('importlog.txt','test contents','testpass'));


text:
Q: django transaction atomc decorator, class view I have a several class based views.
In one of them, let's say View1 which may call other view to return the response.
so I have something like this:
class View1(View):
  def post(self, request, *args, **kwargs):
     # Some logic ...
     return View2.as_view()(request) # There are more lines like this calling to other views.

So View1 is somewhat a route view. Based on some conditions, it pass the request to other view to return the response.
I want to use the transaction.atomic decorator on View1, will the atomic transaction apply to all the views that I call? i.e the call to other views won't cancel the atomic request?
So far I used the following methods to decorate View1:

*

*wrap the view in transaction.atomic in the urls.

*Used the @method_decorator(transaction.atomic) on the post() method of View1.

The issue is, using any of the two ways to set the view as atomic, even though View1 return with error (exception) "View1 didn't return HttpResponse..", objects are still getting created.
Why?

A: You can also define a class-based mixin that you can use:
class AtomicMixin(object):
    def dispatch(self, request, *args, **kwargs):
        with transaction.atomic():
            return super(AtomicMixin, self).dispatch(request, *args, **kwargs)

class View1(AtomicMixin, View):
    def post(self, request, *args, **kwargs):
        # Some logic ...


text:
Q: how can i log system status in JSON format using ruby I have a ruby script where I am logging system status using GET method , the output which is returned in logs is something like this :
1.2.3.111 - - [00/Jan/2016:08:21:24 +0000] "GET /service/sys/status HTTP/1.1" 200 15 0.0006

I want to log these in JSON format .
Is there any way this is can be done, though i got know this can be somehow done with thin webserver but i have no idea how to do that.

A: Use custom Logger::Formatter:
require 'logger'
logger = Logger.new(STDOUT) # or retrieve the default application logger
logger.formatter = proc do |severity, datetime, progname, msg|
  %Q|{timestamp: "#{datetime.to_s}", message: "#{msg}"}\n|
end
logger.info "Hello, world!"
#⇒ {timestamp: "2016-01-06 10:48:13 +0100", message: "Hello, world!"}

Whether you expect messages to have a double quote, it might be better to delegate jsoning to an expert (credits @aidan):
require 'json'
require 'logger'
logger = Logger.new(STDOUT) # or retrieve the default application logger
logger.formatter = proc do |severity, datetime, progname, msg|
  JSON.dump(timestamp: "#{datetime.to_s}", message: msg)
end
logger.info "Hello, world!"
#⇒ {timestamp: "2016-01-06 10:48:13 +0100", message: "Hello, world!"}

A: gem log_formatter is your choice, as the formatter group, now support json formatter for ruby and log4r.
simple to get stated for ruby.
gem 'log_formatter'

require 'log_formatter'
require 'log_formatter/ruby_json_formatter'

logger.debug({data: "test data", author: 'chad'})

result
{
  "source": "examples",
  "data": "test data",
  "author": "chad",
  "log_level": "DEBUG",
  "log_type": null,
  "log_app": "app",
  "log_timestamp": "2016-08-25T15:34:25+08:00"
}

for log4r:
require 'log4r'
require 'log_formatter'
require 'log_formatter/log4r_json_formatter'

logger = Log4r::Logger.new('Log4RTest')
outputter = Log4r::StdoutOutputter.new(
  "console",
  :formatter => Log4r::JSONFormatter::Base.new
)
logger.add(outputter)

logger.debug( {data: "test data", author: 'chad'} )

Advance usage: README
Full Example Code: examples

A: per comments above with @aidan 's recommendation:
require 'json'
require 'logger'
$stdout.sync = true
logger = Logger.new(STDOUT)
logger.formatter = proc do |severity, datetime, progname, msg|
  {
    level: severity,
    timestamp: datetime.to_s,
    app: progname,
    message: msg
  }.to_json + $/
end

Notable additions:

*

*$stdout.sync -- not strictly required in every case and possibly undesirable in others

*the $/ or "\n" (newline). Without this, logging will work in native Docker, but probably not in Kubernetes (kubectl logs ...).

HTH


text:
Q: Converting a CSV file into a JSON file using python I have been trying to convert a csv file into json with python 3. I want to convert a csv file which would look more or less like this:
Key ,Field_1 ,Field_2 ...
0   ,a       ,e       ...
1   ,b       ,f       ...
2   ,c       ,g       ...
3   ,d       ,h       ...

Into a json file that is structured  Key : [Field_1, Field_2, ...]
So that the csv above would end up looking like
{
  "0" : ["a", "e", ...]
  "1" : ["b", "f", ...]
  "2" : ["c", "g", ...]
  "3" : ["d", "h", ...]
}

I have been trying to use the code below but have been unable to fill in the missing parts, like assigning each value to their corresponding part on the json file.
csv = pd.read_csv("file.csv")
n = 0
length = # number of keys
for i in csv:
    if n == 0:
        for y in range(lentgh):
            # Assign as the header
    else:
        for y in range(length):
            # Assign as the properties
    n += 1

Also Im trying to make it so that all new data is attached at the end of the json file automatically.

A: The json will indent on the value lists still but this will convert your csv to the dictionary you desire and append it to json file
import csv
import json

with open('blah.csv') as f:
    reader = csv.reader(f)
    next(reader)
    d = dict((rows[0], rows[1:]) for rows in reader)

with open('blah.json', 'a') as f:
    json.dump(d, f, indent=4)

A: This should do what you want.
import csv
import json

csvfile = open('C:\\your_path\\file.csv', 'r')
jsonfile = open('C:\\your_path\\file.json', 'w')

fieldnames = ("ID","Name","Address","State")
reader = csv.DictReader(csvfile, fieldnames)
for row in reader:
    json.dump(row, jsonfile)
    jsonfile.write('\n')


text:
Q: Can I add actions to control automator to automator? Is there any way that I can add automator itself to the list of services I can automate? For example right now I can go and add a launch application action to the workflow and within that action launch automator. Effectively this creates a level of control over automator but only by routing it through the utilities action item. I know that you can add new application action libraries to automator to control any app that releases a library for it. So is there one for automator? Where is it if there is?

A: Automator itself does not ship with self referencing Automator actions.
GUI Scripting
Alternative approaches include using GUI Scripting to automate interactions with the Automator application. See Accessibility Preferences and GUI Scripting for an example of how to set this up on recent versions of Mac OS X.
automator Command Line Tool
OS X includes an automator command line tool. You can use this tool to incorporate your Automator workflows into other scripts. Through this tool you can pass in variables and thus manipulate the workflow's behaviour.
Beyond Automator
You may find GUI Scripting and the corresponding What Me Do action fragile or unpredictable. If so, consider tools such as Sikuli to help automate your Mac.


text:
Q: Find SVD of the given matrix
Find a decomposition $X=U \Sigma V^{T}$ of the matrix $X=\begin{bmatrix}
2 & 1 & 2\\
-2 & -1 & -2\\
4 & 2 & 4\\
2 & 1 & 2
\end{bmatrix}$  where $\Sigma$ is a rectangular diagonal matrix of
size 4x3, $U$ and $V$ are orthogonal matrices, and the upper right element of $V$ is equal to $\frac{1}{\sqrt{2}}$

I found V according to the given constraint as $\begin{bmatrix}
\frac{2}{3} & \frac{-\sqrt{2}}{6} & \frac{1}{\sqrt{2}} \\
\frac{1}{3} & \frac{2\sqrt{2}}{3} & 0\\
\frac{2}{3} & \frac{-\sqrt{2}}{6} & \frac{-1}{\sqrt{2}}
\end{bmatrix}$ and $\Sigma=\begin{bmatrix}
\sqrt{63} & 0 & 0 \\
0 & 0 & 0\\
0 & 0 & 0\\
0 & 0 & 0
\end{bmatrix}$
For finding $U$, I am using $U\Sigma=XV$. But I am stuck at this step as to how to proceed further as $\Sigma$ matrix has repeated 0 eigen values.
Can you please let me know how to find $U$ from the above equation?

A: You already found the eigenvectors of $X^TX$. These are the rows of $V^T$.
You need to find the eigenvectors of $XX^T$. There should be one eigenvector corresponding to the eigenvalue of $\sqrt {63}$ and three corresponding to the zero eigenvalue. Arrange them as column vectors $U=\begin{pmatrix}u_1&u_2&u_3&u_4\end{pmatrix}$.


text:
Q: Magento : One Page Checkout Alignment Issue (Payment Method) Im sure this is as obvious as the day and the night, but for the life of my I cannot see in the code why the PayPal and Purchase Order button and text do not line up on the same line.
Any help would be great
https://www.acuity-sports.com/onepagecheckout/

A: You should, in your CSS, add display: inline; to the label for sp-methods -- something like this:
.sp-methods label {
    display: inline;
}

That will make the display of the label to be inline with the radio button.

A: This is very simple

Coffee

Black hot drink

Milk

White cold drink

you see the html HTML
 Tag is automatically rendered in your browser on a different line
see example here http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_dd_test
if you want to have it float you have to add css style that overwrites your dt, dd to  'float:left'
here is an example on fiddle http://jsfiddle.net/9Q7T9/


text:
Q: Use i18n internationalization and Custom Routes I want use i18n internationalization. CRUD its works fine, but with custom routes something wrong. How can I use :local in custum routes like this:
match 'signup' => 'newsletter#signup'

if I use /en/signup it is works, but /signup says: no route match

A: Why don't you try to use the i18n_routing gem?
https://github.com/kwi/i18n_routing
It's easy to translate also the name of the action.


text:
Q: Laravel Auth com Subdominio Bom dia, estou tentando realizar um auth com subdominio, porém todas as vezes que logo no site retorna o erro de Too Many Redirects.
Esse é meu .env:
SESSION_DOMAIN=.meudominio.com.br

E a primeira linha de minha rota é essa:
Route::domain('sis.meudominio.com.br')->middleware('admin')->group(function (){

Eu estava tendo um problema em que todas as routes que não estavam nesse grupo funcionavam, então eu tive de colocar isso, na parte do website:
Route::domain('meudominio.com.br')->group(function(){ Auth::Routes();

O Auth::Routes() está lá, por que desejo que somente dê pra logar no caminho principal do site.

A: // Rotas que pertencem a um subdominio deverão ser registradas dentro do grupo
// Rotas para subdominio devem sempre ser declaradas antes das outras
Route::group(['domain' => '{account}.' . env('APP_DOMAIN')], function () {
    Route::get('/', 'Auth\LoginController@showLoginForm')->name('login');
});

// As demais rotas, registra-se normal
Route::get('/', function(){
    return view('welcome');
});


text:
Q: Find word after regex pattern match I am using coldfusion's ReMatch() trying to find all filenames in a string that have a \ at the beginning.  Not having much success.. here is my code so far.
<cfset fname='this is a \\green.png folder.  But this one is \\blue.jpg.'>
<cfset matchval=#ReMatch("\\\\\w+",fname)#>
<cfdump var="#matchval#">

Outputs \\green and \\blue.
I need green.png blue.jpg
Thanks in advance for the help... I'm sure a regex guru will know this right off.

A: Just put \w, dot inside a character class and make it to repeat one or more times by adding + next to that  character class.
<cfset matchval=#ReMatch("\\\\(\\w+\\.\\w+)",fname)#>

Finally print the index 1 value to get your desired string.


text:
Q: Change background of fullscreen keyboard TVOS app I am working on TVOS app using Objective C code and storyboard. I want to change background color of full-screen keyboard to black but default color is light gray. Would it be possible to change the color of the full-screen keyboard?

A: Use UIKeyboardAppearanceDark to make TVOS keyboard screen color dark.


text:
Q: Move my cursor to selected Line in MsWord using C# I am doing Word automation in C#. I want to move current cursor position to selected line number.
Let me explain with an example:
Line 1
Line 2
Line 3
Line 4

Line 6
Line 7

Now I have purposely left Line 5 blank. After Line 7, I want to move cursor to Line 5. I am using oWord.Selection.Range method, but no luck so far.

A: Well It seems no one found any thing.Let me help my self and others who might face this problem
well the logic here is that,every time you move your cursor to the top of the position,here Line 1
   WRange.Range Myrng = oDoc.Range(ref StartPos, ref Endpos);
                   Myrng.Select();

                   object Story = WdUnits.wdLine;
                   oWord.Selection.EndKey(ref Story, ref extend);

                   object NewEndPos = oWord.Selection.End - 1;
                   Myrng = oDoc.Range(ref NewEndPos, ref NewEndPos);
                   Myrng.Select();

after this point the output is something like Line 1 I
now I will move the cursor to Line 5 for that
                   object Count=5;
                   oWord.Selection.MoveDown(ref unit, ref Count, ref oMissing);

And Voila here you are to Line Number 5


text:
Q: Marketing Cloud - Journey Tagging I have noticed this (what appears to be a) "tagging" or label option (image below) available in my Marketing Cloud instance on the Journey Builder page, but it seems to be greyed out.  I have investigated the various ways (security options, journey configurations, etc.) to make it available to my users and me but have had no success (e.g. is there a way to tag/label respective journeys and then filter on those tags/labels). As far as I am aware, this feature is/was not available.  Am I missing something totally obvious as it relates to this button?  Has anyone else had any success in utilizing this?

A: Answer:  Missing something totally obvious.  (big eyeroll and cue more coffee) :-)
There is a checkbox to the left of each journey.  Once selected, you can then specify a tag (or tags) for the journey, etc.  (Screen shot below).
In other news - I did see, there was an update today (3/29/18) from a product manager on this idea (Create folder structure in Journey Builder):  https://success.salesforce.com/ideaView?id=0873A000000E4xvQAC that folder structure for JB was in development and planned for the June MC release.

A: Just wanted to share an update on this topic - since I had posted it some time ago.  Journey Folders (Folders for Journey Builder) will be in the June release (June 23) for Marketing Cloud.  Just an FYI for anyone who's anxiously been waiting for this feature!
https://help.salesforce.com/articleView?id=mc_rn_june_2018_journey_folders.htm&type=5


text:
Q: Dispose Image Control in Windows 10 Noted: Universal Windows Platform (aka Windows 10 App, not WPF)
I have about 80 image files that need to be displayed on a listview inside a page. When user go back to previous page, i need to dispose the Image control so I can delete these images.
The problem is binding directly to image uri lock the image files, and it's not released when going back
I'm using MVVMLight
Some code:
public class FileNameToFullUriConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        string ori = value.ToString();
        string file = ori.Split('/').Last();
        string img = file.Split('.')[0] + ".png";
        img = "ms-appdata:///local/" + StaticClass.ImageFolder + "/" + img;

        return img;

    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        return null;
    }
}

and XAML
<DataTemplate>
    <Grid>
        <Image x:Name="Image2"
               Grid.Column="1"
               HorizontalAlignment="Left"
               Source="{Binding Page2.Page.file,
               Converter={StaticResource FileNameToFullUriConverter},
               Mode=OneWay}"
               Stretch="UniformToFill" />
    </Grid>
</DataTemplate>

I've tried:

*

*Set the list to null

*Clear the list (by calling ListViewName.Clear() )

*Call Cleanup in ViewModelLocator
What's working, but cannot apply:
In ViewModel, I added another property with type of
ObservableCollection<BitmapImage>

, then binding the ListView to this collection.
By using this way, all the image will be loaded into RAM, no lock on file, but it's cause a serious problem: Consume too much RAM. My app from using binding with URI took about 100 MB RAM to 900 MB RAM by binding directly to BitmapImage. Also, the time it took to load into the page take longer, since it has to read and load all the image file into RAM before the list finish rendered.
So, how to dispose Image Control in Windows 10?
PS: this image control: Image Class in MSDN

A: You can maintain a list of your Image controls in the code behind of the page. When the app go back, you can set Source property to null for each images :
<DataTemplate>
    <Grid>
        <Image Loaded="Image_Loaded" />
    </Grid>
</DataTemplate>

In code behind :
private List<Image> _images = new List<Image>();

private void Image_Loaded(object sender, RoutedEventArgs e)
{
    _images.Add(sender as Image);
}

protected override void OnNavigatedFrom(NavigationEventArgs e)
{
    base.OnNavigatedFrom(e);
    foreach(var img in _images)
    {
        img.Source = null;
    }
}

All locks will be released.

A: I'm not really familiar with the image control. It seems to me that the bitmap image must be Disposed before you can delete the file. The problem is that the bitmapImage does not have a Dispose funciton.
I saw other people here in stack overflow asking how to actively Dispose the image. I guess you'll have to do the same.
See:
How to dispose bitmapsource
Delete a bitmapsource file

A: I had the same problem. I have used a workaround which I'm not sure that this is the best way or not. I have added a method to removed deleted items and call the method each time the app starts or the list gets refreshed.
private ObservableCollection<BitmapImage> _items; // your collection which is bound to ListView

// deleting images of removed items
private async Task DeleteUnusedImages()
{
    try
    {
        var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("folderName");
        var files = await folder.GetFilesAsync(); // getting all files inside that folder

        foreach (var file in files)
        {
            // checking if the image still exist in the collection or got removed
            // if removed then remove it from the local folder too.
            if (!_items.Any(i => i.ImageName.Contains(file.Name)))
            {
                await file.DeleteAsync(StorageDeleteOption.PermanentDelete);
            }
        }
    }
    catch (Exception ex)
    {

    }
}

The problem is when you delete an item from the collection that bound to the ListView, the ListView does not release the item until several refreshes. After deleting an item I have tried to manually deleting it by going to "LocalState" folder of the app but it says that it's used by the app and cannot be deleted.


text:
Q: How can a class inherit from a parameterized version of itself? I saw a C# class SomeClass that was defined like
public class SomeClass : IComparable<SomeClass>, IEquatable<SomeClass>
{
   // ...
}

and I'm wondering how to translate that into English. The way I understand it seems logically impossible. How can a class inherit from a parameterized version of itself? Also, is this a common design pattern?

A: The key is to recognize that it's not inheriting from (or implementing) a parameterized version of itself, but rather inheriting from (or implementing) another class or interface, and using itself as a generic parameter for that target type.
For example, IComparable<T> says that there will be a CompareTo() method that takes an object of type T as a parameter. So by implementing IComparable<SomeClass> you're simply guaranteeing that a method with that signature will exist on this class:
public class SomeClass : IComparable<SomeClass>
{
    public int CompareTo(SomeClass other)
    {
        //...
    }
}

And yes, this is fairly common practice. Classes often implement the generic IComparable<> and IEquatable<> interfaces to show that they can be compared with other items of the same type. It's maybe also worth mentioning that enums in Java are declared as extending Enum<> of themselves--a pattern which is not common in C#, but does appear from time to time.

A: Translated in "English" it means: "Boy (or girl), you'd better be type-safe when implementing those interfaces, especially IComparable. Otherwise, you'll have to perform type casting, which I guess you don't want"
See the code below. SomeClass implemented IComparable and IComparable.
See differencies between implementations of CompareTo(object) and CompareTo(SomeClass).
namespace InterfacesStuff
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var someClass1 = new SomeClass {ComparedValue = 1};
            var someClass2 = new SomeClass {ComparedValue = 2};

            //someClassObject defined as SomeClass
            //object someClassObject = new SomeClass { ComparedValue = 2 };

            //someClassObject defined as anything else but SomeClass
            object someClassObject = 5;

            int comparisonSomeClassBySomeClass = someClass1.CompareTo(someClass2);

            int comparisonSomeClassByObject = someClass1.CompareTo(someClassObject);
        }
    }

    public class SomeClass : IComparable, IComparable<SomeClass>, IEquatable<string>, IEquatable<int>,
        IEquatable<double>
    {
        public int ComparedValue;

        public int CompareTo(object obj)
        {
            var presumedSomeClassObject = obj as SomeClass;

            if (presumedSomeClassObject != null)
            {
                if (ComparedValue <= ((SomeClass) obj).ComparedValue)
                    return -1;
            }

            return 0;
        }

        public int CompareTo(SomeClass other)
        {
            if (ComparedValue <= other.ComparedValue)
                return -1;

            return 0;
        }

        public bool Equals(double other)
        {
            throw new NotImplementedException();
        }

        public bool Equals(int other)
        {
            throw new NotImplementedException();
        }

        public bool Equals(string other)
        {
            throw new NotImplementedException();
        }
    }
}

A: It is not Inheriting, It is implementing the IComparable Interface. what is going on is
Someclass Implements the Icomparable and the IEquatable interface. Implementing an interface is like signing a contract stating you gaurentee that this class will implement the methods on an interface.
Icomparable msdn, IEquatable. If you look at the MSDN pages you can see that SomeClass gaurentees it will implement the methods in some fashion.
This is very common practice and it is many different names. The ones I hear most are programming by contract and Implementation over Inhertience. It lets you do a lot of cool things, like Dependency Injection, Proper Unit testing, better Generics. It does this because the compiler doesnt need to know the concrete class that your object is implementing. It just needs to know that it has certain functions on it.  For further reading on this I would read Chapter one of the gang of four Design pattern book.
Wikipedia link Specifically  the Introduction to Chapter one section

A: The code you posted does not inherit from any class. It is implementing certain so-called Interfaces. How to translate that snippet: "I guarantee that SomeClass will be Comparable and equatable with other SomeClass instances. I will provide definitions in this class on how to do that."
About specializing a class from some other class...
What you can do is something like this:
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Pet
    {
        protected string name;
        public Pet(String name)
        {
            this.name = name;
        }

    }

    class Dog : Pet
    {
        private List<String> tricks;
        public Dog(String name, List<String> tricks):base(name)
        {
            this.tricks = tricks;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            List<string> tricks = new List<string>();
            tricks.Add("sit");
            tricks.Add("jump");
            tricks.Add("bark");
            Dog puppy = new Dog("Fido", tricks);
        }
    }
}

Dog inherits from Pet. Dog calls Pet's constructor at creation. Whatever name you pass into Dog constructor, it will forward it to Pet constructor.
Because what happens is that a subclass first calls the constructor of its superclass with the appropriate arguments. Then it runs its own constructor. Whatever is declared as public or protected in a class will be visible to its subclasses.
Therefore Dog will have name and also a list of tricks:

You achieve this kind of view with the "Locals" window.
I recommend that you read some tutorials on c# inheritance, interfaces and generics

A: It doesn't really have to be convenient to express it in english for it to be valid code, although I'd probably read that as "SomeClass is comparable and equatable to itself". That doesn't really explain what's going on though, it's just a way of expressing it.
In C# types can be generic over categories of other types. Generic types are basically "type constructors". They take other types as parameters, and use them to construct new types. For instance, IEnumerable<int> and IEnumerable<string> are two completely different types. The non-generic version (IEnumerable) is a third one. In C# a type A can inherit ANY other type B as long as none of the following is true (I hope I didn't miss anything):

*

*B is already a subtype of A

*B is a class and A has already inherited another class

*B is a struct

*A is an interface but B is not

*A is the same type as B

*B is sealed

*A is a struct and B is not an interface

This even makes the following code legal:
class Foo<T>
{
    public T Value;
}

class Foo : Foo<int>
{
}

Foo and Foo<T> are different types, so there's no problem at all for one to inherit the other.
You can read more about generics here:
https://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).aspx
And about inheritance here:
https://msdn.microsoft.com/en-us/library/ms173149.aspx


text:
Q: new to IOS, does it really matter if we start writing code in viewcontroller class.. or do we have to create a new class I am trying to figure out if there is really any problem dumping all my code in viewcontroller calls. Is there really any difference if you put code in viewcontroller vs. a new class?

A: As @BergQuester notes, Cocoa relies heavily on MVC. Data goes into its own classes, called "Models", which should not rely on any specific display logic; these are often simple data classes, but may also include network connection logic, database management, etc. The point is that model classes should not care how they are displayed.
The "View" classes display things; these are mostly provided by Apple.
The Controllers live between the views and the model, shuffling events and data between them. The View Controllers specifically are there to manage what a view displays and user interaction.
You should not put all of your logic in the view controllers. In particular, view controllers should not do anything related to the network, and should not do anything that assumes that they will be around for a long time (since view controller often come and go with their views). All of the data management should be handled at the model layer.

A: Cocoa heavily uses the Model-View-Controller (MVC) model to determine where code goes. One could do it some other way, but you'll end up fighting the framework.


text:
Q: Is there a simple proof for the (co)area formula in the case of equal dimensions? Let $\Omega \subseteq \mathbb{R}^n$ be a nice domain (say a ball), and let
$f:\Omega \to \mathbb{R}^n$ be smooth. Then
$$ \int_{\Omega} |\det df|=\int_{\mathbb{R}^n} |f^{-1}(y)|dy, \tag{1}$$
where $|f^{-1}(y)|$ is the cardinality of the set $\{f^{-1}(y)\}$.
Formula $(1)$ is a special case of the area and co-area formulas, when the dimensions of the source and target are equal.
In general, the area\co-area formulas:

*

*Deal with domains of different dimensions.

*Allow the domain to be any measurable set.

*Allow $f$ to be less regular (require only Lipschitzity).
The proofs for the general claims are not very short or easy.

Question: Is there a simpler proof for the specific case mentioned above? (Equal dimensions, $f$ smooth, nice smooth domain).

A reference would suffice (I couldn't find one).

A: I think I have it:
First assume $f$ is orientation-preserving, i.e. $df$ is invertible and has positive determinant everywhere.
Then by degree theory $$ \int_{\Omega} |\det df|=\int_{\Omega} \det df=\int_{\mathbb{R}^n} | f^{-1}(y)|. \tag{1}$$
If $f$ is orientation-reversing, a similar computation works.
Now, for the general case: By Sard's theorem, for almost every $y \in \mathbb{R}^n$, $y$ is a regular value of $f$. Let $Z \subseteq \mathbb{R}^n$ be the set of non-regular values.
Now partition $\Omega=\Omega_0 \cup \Omega_+ \cup \Omega_-,$ where

*

*$ \Omega_0=\{ x \in \Omega \, | \, \det df_x =0 \}$

*$ \Omega_+=\{ x \in \Omega \, | \, \det df_x >0 \}$

*$ \Omega_-=\{ x \in \Omega \, | \, \det df_x <0 \}$

Note that $\Omega_+,\Omega_-$ are open sets. Then, using the above mentioned result for the orientation preserving (reversing) maps $f_{\Omega_+}$  ($f_{\Omega_-}$), we obtain
$$ \int_{\Omega} |\det df|=\int_{\Omega_+} |\det df|+\int_{\Omega_-} |\det df|=\int_{\mathbb{R}^n} | f_{\Omega_+}^{-1}(y)|+\int_{\mathbb{R}^n} | f_{\Omega_-}^{-1}(y)|=$$
$$ \int_{\mathbb{R}^n} | f_{\Omega_+}^{-1}(y)|+|f_{\Omega_-}^{-1}(y)|=\int_{\mathbb{R}^n \setminus Z}| f_{\Omega_+}^{-1}(y)|+|f_{\Omega_-}^{-1}(y)|=\int_{\mathbb{R}^n \setminus Z} | f^{-1}(y)|$$
where we used the fact $Z$ is of measure zero, and that on $\mathbb{R}^n \setminus Z$, every pre-image belongs to $\Omega_+$ or $\Omega_-$.


text:
Q: Angular 1.x bind to variable property Is there a way to bind via html to a variable property in angular 1.x?
I have a data object that I need to update based on certain conditions, which would change the property it should bind to:
<div ng-repeat="option in options">
    <custom-component selected="$ctrl.data[option.dataProperty]"></custom-component>
</div>

I can't seem to get it to bind into the customComponent with one or two way bindings. Would appreciate any other suggestions.
Update:
Thanks for the comments, writing the plunker illuminated the problem for me :) you can find it here for posterity's sake. Thanks!


text:
Q: Updating a sharepoint list from Excel I know this is a little backwards, but unfortunately this is what I have to do based on what I have to work with.  Essentially we are getting data from one place, putting it into Excel and then running some pivot tables and then copying and pasting the results to Sharepoint. There is no way of getting the data into SharePoint from its initial source.
So here are the steps I have to do on a daily basis:

*

*Go into 3 lists on sharepoint and delete the current data in there

*Copy the data from each excel table and then paste it into the associated SharePoint list

*Go into the Titles, etc part of SharePoint and update the file name to append the current date to it(ie change it from Data05032017 to Data 05042017)

I would like a way of automating this on a daily basis from Excel by simply pressing a button via VBA or if there is a way I can accomplish this wia linking somehow that would work too(not sure if its possible, I know you can link from SharePoint to Excel but unsure if you can go in the reverse direction).
So I first would like to know if this is possible and then if it is, how  I go about doing it.


text:
Q: Wait for transition to end in puppeteer I'm trying to test a website using Puppeteer. Unfortunately, I'm having trouble clicking elements in a toolbar. The toolbar is using a CSS transition to gracefully slide into the page. My code is failing because I'm clicking where the element will appear while the page is still animating. I'm using a timeout as a workaround, but there's got to be a more elegant solution. Here's an example:
await page.click("#showMeetings"); //Toolbar slides in
await page.waitFor(3000); //Can I do this without a timeout?
await page.click("#mtgfind"); //Click button in toolbar

I think I need to wait on the transitionend event, but I'm unsure of how to do that in Puppeteer. Any help would be appreciated.

A: I came up with a fairly dumb solution. I looked up how long the transition was supposed to take (in this case 0.2 seconds) and just modified the waitFor statement to wait that long. Final code:
await page.click("#showMeetings"); //Toolbar slides in
await page.waitFor(200);
await page.click("#mtgfind"); //Click button in toolbar

This wouldn't work if the timing was variable, but the website reuses the same transition everywhere, so it's fine for my use case.

A: In case of Grant solution, you shouldn't forget to remove event listener and to wait for it. You can try this solution, it works for me. I had similar problem.
async waitForTransitionEnd(element) {
  await page.evaluate((element) => {
    return new Promise((resolve) => {
      const transition = document.querySelector(element);
      const onEnd = function () {
        transition.removeEventListener('transitionend', onEnd);
        resolve();
      };
      transition.addEventListener('transitionend', onEnd);
    });
  }, element);
}

And call it:
await page.click('#showMeetings');
await waitForTransitionEnd('#elementWithTransition');
await page.click("#mtgfind");

A: You can use page.evaluate() to and the transitionend event to accomplish your goal:
await page.evaluate(() => {
  const show_meetings = document.getElementById('showMeetings');
  const mtg_find = document.getElementById('mtgfind');

  mtg_find.addEventListener('transitionend', event => {
    mtg_find.click();
  }, false);

  show_meetings.click();
});


text:
Q: Select rows with max date from table I have such table and need table 2 result. I am trying to select rows with max date grouped by project_id and ordered by id. And result table must have id column. Tried such request:
SELECT MAX(charges.id) as id,
       "charges"."profile_id", MAX(failed_at) AS failed_at
FROM "charges"
GROUP BY "charges"."profile_id"
ORDER BY "charges"."id" ASC

And have error:

ERROR:  column "charges.id" must appear in the GROUP BY clause or be used in an aggregate function)

Example table

id
profile_id
failed_at

1
1
01.01.2021

2
1
01.02.2021

3
1
01.03.2021

4
2
01.06.2021

5
2
01.05.2021

6
2
01.04.2021

Needed result

id
profile_id
failed_at

3
1
01.03.2021

4
2
01.06.2021

A: SELECT charges.*
FROM charges
INNER JOIN
(
    SELECT
        profile_id,
        MAX(charges.failed_at) AS MaxFailed_at
    FROM charges
    GROUP BY profile_id
) AS xQ ON charges.profile_id = xQ.profile_id AND charges.failed_at = xQ.MaxFailed_at


text:
Q: Using a for loop inside brackets It's often possible to surround code in brackets, which can be useful when creating comma expressions.
Why does the code below have syntax errors when surrounding certain code with brackets?
let o = {a: 2, b: 3}

console.log('hello')    // works
(console.log('hello'))  // works

{console.log('hello')}    // works
({console.log('hello')})  // colon or comma expected

for(const k in o) console.log(k)      // works
(for(const k in o) console.log(k))    // error: newline or semicolon expected

for(const k in o) {console.log(k)}    // works
(for(const k in o) {console.log(k)})  // error: statement expected

A: for constructs are statements. Statements are parts of the language that do something - such as declare a variable, or conditionally run a block, or start a loop.
In contrast, some things are expressions, which evaluate to a value. Your {a: 2, b: 3} is an example of something that can be evaluated as an object literal, an expression. console.log calls (and all function calls) are also expressions; they evalute to values.
Statements can't evaluate to values because a statement does something on its own, and interpreting it as a value as part of something else just doesn't make sense. Putting something inside of parentheses will only be syntactically valid if that "something" is an expression; if it's a statement as well, then it can't be evaluated to a value. For similar reasons, none of the following lines are valid:
const val1 = (if (true) {});
const val2 = (const foo = 'foo';);
const val3 = (while(false) {});


text:
Q: Using SQL for cleaning up JIRA database Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible.
Last time I tried it, the jira went nuts because of its own way of doing indexes.

A: How about doing a backup to xml, editing the xml, and reimporting?

A: We got gutsy and did a truncate on the jiraissues table and then use the rebuild index feature on the frontend. It looks like it's working!

A: This is old, but I see that this question was just edited recently, so to chime in:
Writing directly to the JIRA database is problematic. The reindex feature suggested in the Oct 14 08 answer just rebuilds the Lucene index, so it is unlikely to clean up everything that needs to be cleaned up from the database on a modern JIRA instance. Off the top of my head, this will probably leave data lying around in the following tables, among others:

*

*custom field data (customfieldvalue table)

*issue links (issuelink table)

*versions and components (nodeassociation table, which contains other stuff too, so be careful!)

*remote issue links or wiki mentions (remotelink table)

If one has already done such a manual delete on production, it's always a good idea to run the database integrity checker (YOURJIRAURL/secure/admin/IntegrityChecker!default.jspa) to make sure that nothing got seriously broken.
Fast forwarding to 2014, the best solution is to write a quick shell script that uses the REST API to delete all of the required issues. (The JIRA CLI plugin is usually a good option for automating certain types of tasks too, but as far as I can tell, it does not currently support the deletion of issues, so the REST API is your best bet.)


text: Q: How much energy from lighting is converted to heat? In a building, how much of the power used in lighting is converted to heat?  For instance, if 100 watts are used in lighting in a room, will there eventually be 100 watts of heat generated?


text:
Q: / and - in different cells after same function I'm trying to concatenate a column of dates and other of hours.
The fuction:
=CONCATENATE(TEXT(AGENDA!B9 ,"dd-mm-yyyy"), " ", TEXT(AGENDA!C9 ,"hh:mm:ss"))

works, but, some cells are in fuction format, dd-mm-yyyy, and some others are dd/mm/yyyy (the time is correct). I need them all with -

A: You have a non valid date in AGENDA sheet Fecha column note Luque, Hugo 20/08/2021 with month set to 20 !! and day is 08.

To add date validation, Select B2:B and go to Data data > validation > Criteria: date.

and select On invalid data: Show warning.
Fix the date one by one or take a look at the quick fix.
To check the date format:

Go to Formst > number > Custom date and time.

The Quick fix
To get date fixed with a formula from, mm/dd/yyyy to dd-mm-yyyy you need a helper column lets call it Fixed Date, with the formula.
=IF(ISDATE(B2)=False,CONCATENATE(INDEX(SPLIT(B2,"/-"),1,2),"-",INDEX(SPLIT(B2,"/-"),1,1),"-",INDEX(SPLIT(B2,"/-"),1,3)),B2)

Explanation
1 - IF(ISDATE(B2)=False check the date is valid if true return the original value example B2 if false calculate the formula.
2 - INDEX(SPLIT(B2,"/-"),1,2) to get the month column that resulted from SPLIT function with column set to 2.
3 - INDEX(SPLIT(B2,"/-"),1,1) to get the day column that resulted from SPLIT function with column set to 1.
4 - INDEX(SPLIT(B2,"/-"),1,3)) to get the yaer column that resulted from SPLIT function with column set to 3.
5 - CONCATENATE the columns with "-" in between.

Now you can paste your formula but adjusted in BBDD.AGENDA Sheet B3 cell.

=TEXTJOIN(" ",TRUE,TEXT(AGENDA!C2 ,"dd-mm-yyyy"),TEXT(AGENDA!D2 ,"hh:mm:ss"))

Notice that we changed AGENDA!B2 with AGENDA!C2.


text:
Q: Reading from Distinct Ranges into Array and Overwriting to Same Ranges in VBA I would like to read from distinct ranges, in which there are values calculated through some formula in those cells, in VBA and overwrite these ranges with the values that have been saved in order to automatically get rid of the formulae in the cells.
The code looks as follows:
allValues = Range("AR8:AW8,AR10:AW10,AR12:AW24,AR26:AW52,AR54:AW61,AR64:AW87,AR89:AW94,AR96:AW96,AR98:AW104,AR106:AW106,AR108:AW110,AR112:AW122,AR125:AW140,AR142:AW162,AR164:AW192,AR194:AW196,AR198:AW198,AR200:AW202,AR204:AW218,AR220:AW230,AR232:AW232,AR234:AW240").Value

Range("AR8:AW8,AR10:AW10,AR12:AW24,AR26:AW52,AR54:AW61,AR64:AW87,AR89:AW94,AR96:AW96,AR98:AW104,AR106:AW106,AR108:AW110,AR112:AW122,AR125:AW140,AR142:AW162,AR164:AW192,AR194:AW196,AR198:AW198,AR200:AW202,AR204:AW218,AR220:AW230,AR232:AW232,AR234:AW240")= allValues

For conjunctive ranges such an idea worked out but for these not at all.
I appreciate any input.

A: With a multi-area range, iterate on the areas:
Dim r As Range
For Each r In Sheet1.Range("AR8:AW8, AR10:AW10, ..., ...").Areas
    r.Value = r.Value
Next

A: I'd go like follows:
With Range("AR8:AW8,AR10:AW10,AR12:AW24,AR26:AW52,AR54:AW61,AR64:AW87,AR89:AW94,AR96:AW96,AR98:AW104,AR106:AW106,AR108:AW110,AR112:AW122,AR125:AW140,AR142:AW162,AR164:AW192,AR194:AW196,AR198:AW198,AR200:AW202,AR204:AW218,AR220:AW230,AR232:AW232,AR234:AW240")
    .Value = .Value
End With


text:
Q: setting different indicators for different groups in android I would like to know how to set different indicators for different groups in ExpandableListView.
I tried :
if(true condition for a group say groupA)
{
    getExpandableListView().setGroupIndicator(getResources().getDrawable(R.drawable.image));
}

but the above code sets the indicator for all the groups in the view !
I want different indicators for all the groups like :
groupA having a different indicator;groupB having a different indicator;groupC having a different indicator
where groupA,groupB and groupC have certain number of children.
Can anyone suggest something ?
-Adithya.

A: To create different indicator in expandable listview.
First of all create Adapter for expandable listView.
Create custom layout for all different indicator.
Now in your getGroupView method
@Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
LayoutInflater infalInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            if (groupPosition == 0) {
                convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
            } else if (groupPosition == 1) {
                convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
            }else if (groupPosition == 2) {
                convertView = infalInflater.inflate(INFLATE YOUT LAYOUT HERE, null);
            }
}

Try this this is work for me...
Hope this is helpful for you..


text:
Q: Angular2: converting object to an array for json file I'm trying to load an array of objects from a JSON and display them in my template with *ngFor in my angular2 app. I'm getting this error Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays..
I've found quite a bit of documentation on this particular error and a fix, but I'm having trouble understanding/translating it into a working fix. From what I understand the *ngFor will only render arrays of data and my home.component is trying to render an object of arrays.
The fix I've read is to write a pipe like this:
@Pipe({ name: 'values',  pure: false })
export class ValuesPipe implements PipeTransform {
  transform(value: any, args: any[] = null): any {
    return Object.keys(value).map(key => value[key]);
  }
}

I've tried this but then I'm getting an error that says compiler.umd.js?9df7:14126Uncaught Error: Unexpected value 'HomeComponent' declared by the module 'AppModule' I've built the pipe directly into my home component so I'm unsure why this is a problem.
Here is my code.
home.component.js
    import { Component, OnInit, Pipe, PipeTransform } from '@angular/core';
import { Project } from './project';

import { ProjectService } from './project.service';

@Component({
  selector: 'home',
  templateUrl: './home.html',
  styleUrls: ['./home.scss'],
  providers: [ProjectService]
})

@Pipe({ name: 'values',  pure: false })
export class ValuesPipe implements PipeTransform {
  transform(value: any, args: any[] = null): any {
    return Object.keys(value).map(key => value[key]);
  }
}

export class HomeComponent implements OnInit {
  errorMessage: string;
  projects: Project[];
  selectedProject: Project;
  mode = 'Observable';

  constructor(private projectService: ProjectService) { }

  ngOnInit() { this.getProjects(); }

  getProjects() {
    this.projectService.getProjects()
      .subscribe(
      projects => this.projects = projects,
      error => this.errorMessage = <any>error);
  }

  onSelect(project: Project): void {
    this.selectedProject = project;
  }
}

projects.service.js
import { Injectable }     from '@angular/core';
import { Http, Response } from '@angular/http';

import { Project } from './project';
import { Observable }     from 'rxjs/Observable';

@Injectable()
export class ProjectService {
  private projectsUrl = 'data/project.json'; // URL to web API

  constructor(private http: Http) { }

  getProjects(): Observable<Project[]> {
    return this.http.get(this.projectsUrl)
      .map(this.extractData)
      .catch(this.handleError);
  }

  private extractData(res: Response) {
    let body = res.json();
    return body.data || {};
  }

  private handleError(error: Response | any) {
    // In a real world app, we might use a remote logging infrastructure
    let errMsg: string;
    if (error instanceof Response) {
      const body = error.json() || '';
      const err = body.error || JSON.stringify(body);
      errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
    } else {
      errMsg = error.message ? error.message : error.toString();
    }
    console.error(errMsg);
    return Observable.throw(errMsg);
  }
}

project.json
 {
  "project": [{
    "title": "The Upper Crust",
    "id": "upper-crust",
    "year": "2016",
    "category": ["Design", "Web Design"],
    "thumbnail": "thumbnails/upper-crust.jpg"
  }, (...)
}

Sorry if the answer is already out there I've spent a few hours last night and this morning trying to solve this issue and can't seem to figure it out. I appreciate your help in advance, I'm new to development and am at a loss with much of this stuff.


text:
Q: How to run a command from a batch file and immediately return? When I am on the command line and do this:
"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log

a GUI dialog of TortoiseGit is opened and cmd.exe immediately returns, meaning that I can immediately run other commands like dir etc.
Because the aforementioned command is quite long, I created a helper batch file, tgit.cmd, that contains just this:
@echo off
"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*

I can now call just tgit log which is great, however, there is one difference: the command-line is blocked until I close the TortoiseGit dialog.
I have also tried
cmd /C "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*

but that doesn't make any difference. How to immediately return from the batch file?

A: The answer from Oscar is almost correct, but needs a correction
start "" "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*

Why?
start command has a curious behaviour: the first quoted argument is used to determine the title of a new cmd window, and no, it doesn't matter that no cmd window will be started. First quoted argument is the title.
That is the reason for the empty double quotes in the previous code. Without it, what the start command sees is
start "title=c:\Progra..." /command:....

and as the start command does not include a /command switch, it fails.

A: Use START to run the command.
start "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" "/command:log"


text:
Q: run sample test case of uiveri5 show error "Reference Error: describe is not defined" I installed the @ui5/uiveri5 globally correctly.  I download the ui-uiveri5 repository, then I go to directory of sample\apiTesting, and run the command
uiveri5 APITesting.spec
it report following error:
C:\src\open\ui5-uiveri5\sample\apiTesting\APITesting.spec.js:2
describe('APITesting', function() {
^
ReferenceError: describe is not defined

Please guide me on how to solve this issue. ( It report the same issue after I install the jasmine-node, mocha globally).

A: No need to install jasmine or mocha, just install uiveri5 globally with npm install @ui5/uiveri5 -g. Can you please try again, I merged a fix for another small issue. And with it, this sample starts fine.


text:
Q: Lagrangian Submanifolds in Deformation Quantization Suppose I have a symplectic manifold $M$, and have a deformation quantization of it, i.e. an associative product $\ast:C(M)[[\hbar]]\otimes C(M)[[\hbar]]\to C(M)[[\hbar]]$ so that $f\ast g=fg+\{f,g\}\hbar+O(\hbar^2)$, where $\{\cdot,\cdot\}:C(M)\otimes C(M)\to C(M)$ is the Poisson bracket coming from the symplectic structure.
According to Lu (http://www.ams.org/mathscinet-getitem?mr=1244874 page 395), a Lagrangian submanifold $L\subseteq M$ should correspond to a left-module over $C(M)[[\hbar]]$, that is, we have a deformed module structure $\ast:C(M)[[\hbar]]\otimes C(L)[[\hbar]]\to C(L)[[\hbar]]$, which reduces to the standard module structure when $\hbar=0$, and is compatible with the start product on $C(M)[[\hbar]]$.  (Actually, Lu thought of the left-ideal $I_L\subseteq C(M)[[\hbar]]$ so that $C(L)[[\hbar]]=C(M)[[\hbar]]/I_L$, but I perfer to think of the deformation of the module structure.)
Then we can write, for $f\in C(M)$ and $g\in C(L)$, that $f\ast g=fg+\{f,g\}\hbar+O(\hbar^2)$, for some brackets $\{\cdot,\cdot\}:C(M)\otimes C(L)\to C(L)$.
What are these brackets?  How are the related to the symplectic structure?
It seems that in general the existence of a deformed module structure on $C(L)[[\hbar]]$ is nontrivial (perhaps not even known for arbitrary $L$?), but I am hoping that perhaps the deformation to first order is something that one can understand more easily.

A: One has to choose an identification of a tubular neighborhood $U$ of $L$ in $M$ with a tubular neighborhood $V$ of the zero section of the normal bundle $NL$.
Once one has done this, it means that we have a projection $p:U\to L$. Then your bracket is "simply", for $f\in C^\infty(M)$ and  $g\in C^\infty(L)$, $\{f,g\}:=\{f_{|U},p^*(g)\}_{|L}$.
But $C^\infty(C)$ is, to my opinion, not the right object to consider (see e.g. the work of Cattaneo-Felder).
Remark: another approach is via Tsygan's Oscillatory modules.

A: Well, in the symplectic case, the situation is somehow much simpler as in the general Poisson case where you only can speak about coisotropic (there is no good meaning of minimal coisotropic as the rank may vary). In the symplectic case you have a theorem of Weinstein which states that a there is a tubular neighbourhood of $L$ which is symplectomorphic to a neighbourhood of the zero section of $T^*L$. Thus the question of a module structure is reduced to the case of a cotangent bundle since star products are local. For cotangent bundles there is a good understanding whether you can have a module structure on the functions on the configuration space $L$: the characteristic class of $\star$ has to be trivial. In fact, together with Martin Bordemann and Nikolai Neumaier we constructed such module structures in a series of papers in the end of the nineties. Also Markus Pflaum has some papers on this. Thus the global statement is that on $L$ you have a module structure for $\star$ iff the characteristic class of $\star$ is trivial in an tubular neighbourhood of $L$.
The module structures have (for particular star products) a very nice interpretation as global symbol calculus for differential operators on $L$. Moreover, if the char. class is not trivial but at least integral (up to some $2\pi$'s) then there is a module structure on the sections of some line bundle over $L$, coming quite close to the functions on $L$. Physically, this is important for the quantization of Dirac's magnetic monopole.
As DamienC already said, the situation in the general Poisson case or even in the general coisotropic case on symplectic manifolds is much more involved. Here my answer to
In the dictionary between Poisson and Quantum, what corresponds to Coisotropic?
might also be of interest for you.
Oh, I forgot: the first order term can be obtained as in the flat case, at least morally. On the configuration space $L$ you chose your favorite connection then the first order term of the module structure is something like "half the Poisson bracket" which means that \begin{equation}
f \bullet \psi =
\iota^* f \psi
+  i \hbar \iota^*
\frac{\partial f}{\partial p_i} \frac{\partial \psi}{\partial q^i}
 + \cdots
\end{equation}
(modulo some constants I forgot) where $q^i$ are coordinates on $L$ and $p_i$ are the corresponding fiber coordinates on the cotangent bundle. This has an intrinsic meaning. Here $\iota: L \longrightarrow T^*L$ is the zero section...


text:
Q: Execute python script from subdirectory - pycharm vs command line- no module named XXX When using pycharm I can

*

*right-click on any python file and select "run" or "debug" no matter in which subdirectory it is stored

*all imports are relative to the root directory of the python project

Now I clone the repository to a different machine where I only have a console (bash).

*

*I cd into the subdirectory with the python script

*I execute the script, e.g. python my_script.py

*I receive ModuleNotFoundError: No module named 'my_module_name'
How to fix that?
I tried several things (without success):

*

*touch empty __init__.py files in several needed folders to mark them as python modules

*copy the respective script into the root directory and execute it from there (still cannot import dependent modules

*set a variable PYTHONPATH which points to the root directory before executing the script

Some context:

*

*I'm using pyenv + poetry

*I have installed pyproject.toml using poetry and entered a poetry shell

This is how I set up my environment

*

*install pyenv to get the


text:
Q: How to add and retrieve data from NSDictionary inside a view controller I'm trying to cache some images in my view controller using NSDictionary but I'm not having much luck.
for starters my .h looks like this
...
  NSDictionary *images;
}

@property (nonatomic, retain) NSDictionary *images;

and in my .m I synth the property and attempt to add the image as follows:
[self.images setValue:img forKey:@"happy"];

and later I attempt to grab the image by key
UIImage *image = [self.images objectForKey:@"happy"];
    if (!image) {
      NSLog(@"not cached");
    }else {
      NSLog(@"had cached img %@", image);
    }

Yet each time I NSLog the dictionary it's null. If I @synthesize the property should I be ready to go out of the box? or did I not add this to the dictionary correctly?
Thank you in advance

A: Synthesizing doesn't instantiate the variable so you still need to alloc+init it at some point.
But if you want to add objects to a dictionary after creating it, you need to use NSMutableDictionary instead.
Then alloc+init it in viewDidLoad using something like:
self.images = [[[NSMutableDictionary alloc] initWithCapacity:10] autorelease];

Then to set a value, use setObject:forKey: (not setValue:forKey:):
[images setObject:img forKey:@"happy"];

Remember to release the dictionary in dealloc.


text:
Q: Overriding @LastModifiedDate field with provided Date in springboot mongodb auditing When performing migration of legacy data to a springboot project it is sometimes crucial, to use the same Date for auditing fields such as createdDate and lastModifiedDate.
When using mongodb auditing, it is possible to override the createdDate with a custom date using @CreatedDate annotation.
However, the same is not true for @LastModifiedDate.
Mongodb auditing always saves the document with the actual Date the document was modified on instead of overriding it with the provided date.
Using @LastModifiedDate is there a way to save LastModifiedDate with the provided date similar to when using @CreatedDate?
Thanks


text:
Q: Start doing Rails 3 and JRails 3 development on OS X 10.6 I have OS X 10.6 (Snow Leopard) that is already coming loaded with Rails 2.
Rails now is at version 3 and I'm about to have Rails and JRails (JRuby on Rails) development.
I don't want to mess things, what should I do? How to upgrade to Rails 3? Should I use RVM (Ruby Version Manager)? Should I install JRuby via Homebrew?

A: I'd definitely go for RVM, it's the most painless way to set up different Ruby/Rails combinations on the same host. Especially with a comparatively young project like JRuby it was and sometime still is to effortlessly track HEAD next to the stable release.
Edit according to comment: RVM has excellent documentation, I'm not gonna repeat that. Here are some pointers:

*

*https://rvm.io/rvm/install/

*https://rvm.io/rvm/upgrading/

*https://rvm.io/rubies/installing/

*https://rvm.io/gemsets/basics/

*https://rvm.io/workflow/rvmrc/

A: RVM is the right way to do that. I can't live without it. You can also use a separate package manager like homebrew or macports to install libraries and dependencies for gems which need to be compiled.


text:
Q: Custom WCF client certificate over ssl validation

Hello,
I am trying to use WCF to do some authentication:

*

*Authenticate the user using Username/Passoword

*Authenticate the client using a client certificate

*Customize which root certificate are accepted

After some trial and error, i managed to get points 1 & 2 working, but i am stuck on 3. This is my service configuration
<system.serviceModel>
    <behaviors>
        <endpointBehaviors />
        <serviceBehaviors>
            <behavior name="MyBehavior">
                <serviceCredentials>
                    <userNameAuthentication userNamePasswordValidationMode="Custom"
                                            customUserNamePasswordValidatorType="WcfService1.CustomValidator, WcfService1" />
                </serviceCredentials>
                <serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <customBinding>
            <binding name="certificate">
                <security authenticationMode="UserNameOverTransport" />
                <textMessageEncoding messageVersion="Soap12WSAddressing10" />
                <httpsTransport requireClientCertificate="true" />
            </binding>
        </customBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="MyBehavior" name="WcfService1.Service1">
            <endpoint address="" binding="customBinding" bindingConfiguration="certificate"
                      contract="WcfService1.IService1" />
        </service>
    </services>
</system.serviceModel>

and this is my client configuration
    <client>
        <endpoint name="service1" address="https://localhost:443/WcfService1/Service1.svc" binding="customBinding"
                  bindingConfiguration="certificate" behaviorConfiguration="certificate" contract="WcfService1.IService1" />
    </client>
    <behaviors>
        <endpointBehaviors>
            <behavior name="certificate">
                <clientCredentials>
                    <clientCertificate storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName"
                                       findValue="SignedByCA" />
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
        <serviceBehaviors />
    </behaviors>
    <bindings>
        <customBinding>
            <binding name="certificate">
                <security authenticationMode="UserNameOverTransport" />
                <textMessageEncoding messageVersion="Soap12WSAddressing10" />
                <httpsTransport requireClientCertificate="true" />
            </binding>
        </customBinding>
    </bindings>

Using the  client and attaching username credentials works nicely
var channelFactory = new ChannelFactory<IService1>("service1");
var user = channelFactory.Credentials.UserName;
user.UserName = username;
user.Password = password;

Using OperationContext.Current.ServiceSecurityContext.AuthorizationContext.ClaimSets gives me access to the username and the name and thumbprint of the certificate. Sadly, i am unable to find the IssuerName of the certificate. How else can I disallow clients that do not have a certificate issued by a certain root certificate?
Any hints to point me into the right direction or any alternatives are greatly welcome ;)
Thanks

A: Actually, it's easy, but a hack. There is a list of identities in the authorization context.
OperationContext.Current.ServiceSecurityContext
.AuthorizationContext.Properties["Identities"]

One of which is of type X509Identity. That one is internal to System.IdentityModel, you you can't get it directly.
identity.GetType().Name == "X509Identity"

It doesn't really matter, because the field containing the certificate is private, anyways :)
var field = identity.GetType().GetField(
    "certificate",
    BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic);
var certificate = (X509Certificate2) field.GetValue(identity);
string issuer = certificate.Issuer;


text:
Q: How to flattening child object used repeatedly in C# with Automapper Using the following entities
public class User
{
    public Guid Id { get; set; }
    public string Username { get; set; }
}

public class GeneralEntity
{
    public Guid Id { get; set; }

    public User CreatedByUser { get; set; }

    public User DeletedByUser { get; set; }
}

How do I flatten this to the GeneralEntityDto below?
public class GeneralEntityDto
{
    public Guid Id { get; set; }

    public string CreatedByUsername { get; set; }

    public string DeletedByUsername { get; set; }
}

I have tried setting up my mappings as seen below but it fails with a complaint about "CreatedByUsername" and "DeletedByUsername" not being mapped.
protected void Configure()
{
    CreateMap<GeneralEntity, GeneralEntityDto>()
        .ForMember(dest => dest.CreatedByUsername,
            opt => opt.MapFrom(src => src.CreatedByUser.Username))
        .ForMember(dest => dest.DeletedByUsername, opt =>
            opt.MapFrom(src => src.DeletedByUser.Username));
}

A: You can use the naming convention that automapper provides.
Basically if you include the exact string of the property name of the source Object you do not have to add ForMember() automapper is clever enough to do it automatically.
That means for example :
public class GeneralEntity
{
  public Guid Id { get; set; }

  public User CreatedBy { get; set; } // renaming just for simplicity

  public User DeletedBy { get; set; } // renaming just for simplicity
}

public class GeneralEntityDto
{
  public Guid Id { get; set; }

  public string CreatedByUsername { get; set; }

  public string DeletedByUsername { get; set; }
}

Reference also to these:
http://docs.automapper.org/en/stable/Flattening.html
AutoMapper TwoWay Mapping with same Property Name


text:
Q: How to find out if a package is run locally in visual studio or on the server? I have some script code in an SSIS package that would work differently when run in SSDT/Visual Studio than on the server.
Development tests are done in Visual Studio and the production runs on the SQL server (version 2017)
What's the best approach to find out where the package is running?
I could use a project/package parameter, but it's less automatic and more error prone. E.g. when forgetting to re-set the parameter to the correct value for the target environment.

A: While I've not tested all the ways it can be abused, my first thought would be to check the value of System::ServerExecutionID This is a system variable that is zero during design and run time in visual studio.
When executed on the server, this variable will be populated with the Operation ID that is stored in SSISDB.catalog.operations(operation_id). My packages use an audit table that explicitly logs that ServerExecutionID to the insert/update/delete metrics associated to that load.


text:
Q: How to remove Cinnamon's Alt-F1 keybinding using Linux Mint 15 I've just started using Linux Mint 15 with Cinnamon 1.8.8 at work and when I press Alt+F1 the display zoom out and displays the workspace switcher.
How can I disable this shortcut? I removed the keyboard shortcuts in System settings → Keyboard → Keyboard Shortcuts that seemed relevant but with no effect. Then I removed all of them, but of course still no effect.
Update
The accepted answer worked for Mint 15. After upgrading to Mint 16 I also had to use dconf-editor as described by maosmurf below.

A: Under Linux Mint 16 "Petra" Cinnamon, I had a similar problem.
Removing the Keyboard shortcuts under gnome-control-center and cinnamon-control-center had no effect.
Solution that worked for me:

*

*run dconf-editor

*navigate to org.cinnamon.muffin.keybindings

*for panel-main-menu, replace ['<Alt>F1'] with []

*logout & login

(props to Nick Fortescue @ Superuser)

A: On my system (Cinnamon 1.8.8 on Linux Mint Debian Edition) I can disable it in the Gnome control center. Open a terminal and run gnome-control-center:

Go into keyboard => Shortcuts and select the System section on the left:

Now, change the shortcut for "Show the activities overview" click on it and then press Backspace to disable it.

It may be possible to do the same on Linux Mint 15 by going into cinnamon-control-center but that is not available on the Debian edition so I can't check.


text:
Q: Write app for ios with cordova(or titanium) without mac decive i am android and web programmer and i want write  my program for apple mobiles. i want use Cordova(or titanium) but i don't have mac device.
is it possible?
sorry for my bad English.

A: Yes it's possible using this site Phonegap build You can write code once and build it for different platforms. Don't know about titanium.


text:
Q: SQL Server Query Store - What is considered an 'ad-hoc' query? I've been doing a deep dive into the SQL Server Query Store and I often see references to 'ad-hoc' queries. However, I haven't seen what the Query Store determines an ad-hoc query to be. I've seen places where it could be inferred to be a query without parameters or a query executed just one time. Does a formal definition exist for this? I don't mean in general. I mean as it relates to the Query Store.
As an example, this page shows an example of removing ad-hoc queries from the query store, but it appears the criteria it's using is an execution count of just one. This seems to be an odd definition of an ad-hoc query. BTW, if you go to the page, search for 'Delete ad-hoc queries'.

A: After a little bit of searching, I wasn't able to find a concrete and satisfying source from Microsoft's documentation to answer this question. There are many good third-party descriptions and definitions of adhoc/ad-hoc/ad hoc out there, but for the specificity of this question I think one close to the source is ideal.
Moving past generic (but still accurate) definitions like this SO post (thanks SqlWorldWide), if we look at what the documentation does say on the topic, it agrees with what you've mentioned about the definition being based off of the number of executions, I think to the point that we can take it as fact.
The article on optimizing for ad hoc workflows says,

When this option is set to 1, the Database Engine stores a small
  compiled plan stub in the plan cache when a batch is compiled for the
  first time, instead of the full compiled plan. This helps to relieve
  memory pressure by not allowing the plan cache to become filled with
  compiled plans that are not reused. The compiled plan stub allows the
  Database Engine to recognize that this ad hoc batch has been compiled
  before but has only stored a compiled plan stub, so when this batch is
  invoked (compiled or executed) again, the Database Engine compiles the
  batch ... and adds
  the full compiled plan to the plan cache.

So it would appear the the ad hoc query server configuration option also uses the definition of a single execution as the definition of ad hoc. If the query continues to get executed and generates the same plan it would no longer be treated as such.
The article on Best Practices for Query Store also  aligns with this,

Compare the number of distinct query_hash values with the total number
  of entries in sys.query_store_query. If the ratio is close to 1 your
  ad-hoc workload generates different queries.

This, of course, is for queries that are not already used as stored procedures, parameterized, etc. because they can be recognized and treated appropriately right off the bat.
So based on all this we can say that a query is treated as ad hoc if:

*

*It is not parameterized

*It is not programmatically stored in the database (stored proc, function, trigger, etc.)

*The same query is only executed one time
OR The same query is executed multiple times but generates a different query plan for each subsequent execution.

A: For ad-hoc queries, the object_id column in the sys.query_store_query DMV will be 0, as stated in the sys.query_store_query  documentation:

object_id:
ID of the database object that the query is part of (stored procedure,
  trigger, CLR UDF/UDAgg, etc.). 0 if the query is not executed as part
  of a database object (ad-hoc query).

You can identify ad-hoc queries based on that value, even though it is not explicitly stated as "this is the definition of ad-hoc queries". :)

A: The term ad-hoc is used to refer to queries that have only been executed once. This is consistent with the definition used for the database setting "Optimize for ad-hoc workloads".
The link you reference regards deleting ad-hoc queries includes this specific definition "Delete ad-hoc queries: This deletes the queries that were only executed only once and that are more than 24 hours old."

A: Ad-hoc from sys.dm_exec_cached_plans dmv's objtype column in learn.microsoft.com.

Adhoc: Ad hoc query. Refers to Transact-SQL submitted as language events by using osql or sqlcmd instead of as remote procedure calls.

One use of this column is to see in case of Queries with multiple plans to see if the multiple plans are caused by Adhoc.
    SELECT  DISTINCT
        QCP.objtype
        ,MultipleQ.PlanCount
        ,qStat.query_hash
        ,sText.text AS QueryText
FROM (
        SELECT query_hash,
               COUNT(query_hash) AS PlanCount
        FROM sys.dm_exec_query_stats
        GROUP BY query_hash
    ) AS MultipleQ
INNER JOIN sys.dm_exec_query_stats qStat ON MultipleQ.query_hash = qStat.query_hash
INNER JOIN sys.dm_exec_cached_plans  QCP
    ON QCP.plan_handle = qStat.plan_handle
CROSS APPLY sys.dm_exec_sql_text(qStat.sql_handle) AS sText
CROSS APPLY sys.dm_exec_query_plan(qStat.plan_handle) AS qp
WHERE PlanCount > 1
ORDER BY MultipleQ.PlanCount DESC


text:
Q: Does the iPhone 5S support iOS 13? My iPhone 5S has 16GB of data with 9.7GB used.
Is it possible for iOS 13 to run on it?

A: No version of iOS 13 will install or run for that phone.
Wikipedia is reliable for this kind of information, and it says the iPhone 5S only supports iOS 7 through 12. See also this answer which has Apple's stamp of approval.
You can't sideload iOS, and even if you could, iOS 13 wouldn't work since it doesn't run on the A7 processor which the iPhone 5S has.


text:
Q: can we use widget data inside the initState? Below is a code snippet of the Calendar stateful class I made.My question is, can I access the eventDateList inside the initState below as "widget.eventDateList"?!
class Calendar extends StatefulWidget {
  final List<DateTime> eventDateList;
  final void Function(DateTime, List<Event>) onDayPressed;
  final DateTime selectedDate;
  bool isReserved;

 Calendar(
    {required this.eventDateList,
    required this.onDayPressed,
    required this.selectedDate,
    this.isReserved = false});

  @override
   _CalendarState createState() => _CalendarState();
  }

class _CalendarState extends State<Calendar> {
  DateTime _currentDate = DateTime.now();
  String _currentMonth = DateFormat.yMMM().format(DateTime.now());
  DateTime _targetDateTime = DateTime.now();

  EventList<Event> _markedDateMap=new EventList<Event>(
     events: {},
   );

   @override
   void initState() {
     super.initState();

     }

A: Yes you can. You can access in initstate as follows:
 @override
   void initState() {
     super.initState();
print(widget.eventDateList);

     }


text:
Q: Why won't my Logitech F310 controller work on Ubuntu 16.04? I have recently tried to play games from the Ubuntu store with my Logitech F310 pc controller, and have had problems. I used WINE to use the program Joy2Key and make my controller emulate keyboard commands, but it did not work. Let me clarify, it did work, but not with the games. My video game man spun in a circle when I tried to move where he was pointed, and then the mouse popped out of the side of the game pannel, which does not normally happen when I use the mouse. I don't know about any other programs that would function the same as Joy2Key. Does anybody have a solution to my problem or an alternative software that is build for Ubuntu 16.04?
Update, I want to use the controller for non-Steam games. I also need this controller to emulate mouse movements.

A: Did you try this link already : http://nomoreterminals.blogspot.kr/2013/12/how-to-set-up-logitech-f310-on-ubuntu.html ??
I hope you try installing your contoller driver ?? If you would be able to install the driver of your controller then I think it should work directly there is no need of Joy2Key.


text:
Q: Airflow "This DAG isnt available in the webserver DagBag object " I am currently setup airflow scheduler in Linux server A and airflow web server in Linux server B. Both server has no Internet access. I have start the initDB in server A and keep all the dags in server A.
However, when i refresh the webserver UI, it keep having error message:-
This DAG isn't available in the webserver DagBag object

How do i configure the dag folder for web server (server B) to read the dag from scheduler (server A)?
I am using bashoperator. Is that Celery Operator is a must?
Thanks in advance

A: The scheduler has found your dags_folder, and its processes, and is scheduling them accordingly. The webserver however can "see" these processes solely by their existence in the database but can't find them in its dags_folder path.
You need to ensure that the dags_folder for both servers contain the same files, and that both are kept in sync with one another. This is out of scope for Airflow and it won't handle this on your behalf.


text:
Q: Problems creating a mobile first database I'm experiencing problems with the mobile hybrid app on Bluemix. I've created a new app twice to make sure. The mobile data service reports that it 'cannot get storage' when I access the Manage Data tab. When I try to import json data it fails. It is the identical json data file that I import into an existing mobile hybrid app.
I have two customer facing apps to make ( they need iOS and Android versions ) - please can you advise me if it is still possible to drag and drop static json data files onto the mobile database?
Also, the link 'For more information about the file formats you can import, see importing data into the mobile data service' is broken.
Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /"https://www.ng.bluemix.net/docs/
If this is not the best way to build native apps for iOS and Android on Bluemix, please let me know.

A: We identified an issue with the Mobile Data Service earlier today that has just been fixed. Please let me know if you still experience this problem and apologies for any inconvenience this has caused.

A: You can try using the cloudant or mongolab for your datastorage requirement.
1.Take the Mobile cloud boilerplate and get the security and app id
2.Take Mongo or cloudant as DB and bind it with your mobile application just created
3.In the mobile client and server code, initialize with IBMBluemix.jar initialization functions
4.Now you are ready to read/write data to the database.
Hope this helps.You can refer a sample code in the git below:
If this does not help, then as henry asked, pls. provide more details. https://github.com/RajeshJeyapaul/Beacons-Messenger
video: https://youtu.be/Gn03yIZiCAc