text:
Q: Find function/method body explicit dependency types using Dart analyzer package I would like to understand how can I analyze methods / functions body to find types that are explicitly referenced from it. I have success analyzing method declaration (return type, parameter types, etc..), however I have no idea how to do that for body.
Assuming following function:
String someFunction(int param) {
  final list = <String>['a', 'b', 'c'];                     // -> DartTypes: String, List<String>
  final myClass = MyClass<Arg>();                           // -> DartTypes: Arg, MyClass<Arg>
  final functionCall = anotherFunction<FunctionArg<Arg>>(); // -> DartTypes: Arg, FunctionArg<Arg>
  return 'result';
}

// At is point I would like to know that my function depends on
// String, List<String>, Arg, MyClass<Arg>, FunctionArg<Arg>
// in term of DartType instances with proper typeArguments.

I tried getting AstNode for method element described here: https://stackoverflow.com/a/57043177/2033394
However I could not get elements from nodes to figure out their types. Their declaredElement values are always null. So I can not get back to Element API from AST API.

A: If you've used the exact snippet from the answer you've referenced, the problem is likely in getParsedLibraryByElement(). This method only parses the referenced library - meaning that you'll get an AST that doesn't necessarily have semantic references (like the declaredElement of AST nodes) set.
Instead, you'll want to use getResolvedLibraryByElement. The AST returned by that method will have its types and references fully resolved.
With the resolved AST, you could visit the body of the method with a custom visitor to find type references. Your definition of "referenced types" isn't really exact - but perhaps you can collect types in visitNamedType for type references and visitVariableDeclaration to collect the types of variables.


text:
Q: Selenium Chromedriver: Failed to create channel I've been using Selenium Chromedriver for the last couple of weeks and suddenly I've got this weird error. I don't know what's changed suddenly.
[2560:6100:1025/082057:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.
[ERROR] Unhandled exception occured. SessionNotCreatedError: session not created exception
from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"9556.1","isDefault":true},"id":1,"name":"","origin":"://"}
  (Session info: chrome=54.0.2840.71)
  (Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 10.0.14393 x86_64)

I'm running the chromedriver with Node.js:
var selenium = require("selenium-webdriver/chrome"),
        options = new selenium.Options(),
        service = new selenium.ServiceBuilder().build();

    options.addArguments(["--disable-web-security", "-incognito"]);
    var driver = new selenium.Driver(options, service);
    driver.get(fetchSource.url).then(function() {
        browser = driver;
        fetchSource.ready = true;
        console.log("Ready to fetch data.");
    });

Updating the chronedriver version didn't help. Any idea how to solve this error? Thanks!

A: Turned out chrome updated itself, and the new version wasn't compatible with chromedriver for some reason. Running an older version of chrome solved the problem. In Node.js you can customize the path for the runnable chrome by changing the options object:
options.setChromeBinaryPath('path\to\chrome');

redpajama_set_name: RedPajamaStackExchange


text:
Q: Formatting into text file in R I have a quick formatting question. I have a set of data in a data frame that looks like this:
Animal   Food   Food ID
 dog     steak   100
 dog     beef    200
 dog     poo     001
 cat     milk    020
 cat     steak   100
 cat     beef    200

which, for programming input purposes, I need to transform into a '.txt' file with a format like this :
<dog>
steak   100
beef    200
poo     001
</dog>

<cat>
milk    020
steak   100
beef    200
</cat>

Obviously my real data has tens of thousands of entries or else I could do it by hand. Any suggestions would be great. Thanks.

A: Here's a way:
# create the string
text <- paste0(sapply(unique(dat$Animal), function(x) {
  subdat <- dat[dat$Animal == x, -1]
  subdat[[2]] <- sprintf("%03d", subdat[[2]])
  paste0("<", x, ">\n",
         paste(capture.output(write.table(subdat, sep = "\t",
                                          quote = FALSE, row.names = FALSE,
                                          col.names = FALSE)), collapse = "\n"),
         "\n</", x, ">")
}), collapse = "\n\n")

# write it to a file
write(text, file = "filename.txt")

The resulting file:
<dog>
steak   100
beef    200
poo 001
</dog>

<cat>
milk    020
steak   100
beef    200
</cat>

The columns are tab-delimited.

A: This approach uses the d_ply function to separate the animals before processing.  Notice the default delimited (of a space) can be changed.
Will records ever need to be collapsed?  For instance, if dog has two rows for steak, should they be combined in some way?  If so, the plyr approach should be able to accommodate that, with a little modification.
ProcessAnimal <- function( d, fileLocation, delimiter=" " ) {
  cat(paste0("<", d$Animal[1], ">\n"), file=fileLocation, append=TRUE, sep="")

  cat(sapply(seq_len(nrow(ds)), function(i) {
    paste0(paste0(ds[i, c("Food", "FoodID")], collapse=delimiter), sep="\n")
  }), file=fileLocation, append=TRUE, sep="")

  cat(paste0("</", d$Animal[1], ">\n"), file=fileLocation, append=TRUE, sep="")
}

plyr::d_ply(.data=ds, .variables="Animal", .fun=ProcessAnimal, fileLocation="PetFood.txt")

The text file looks like:
<cat>
steak 100
beef 200
poo 001
milk 020
steak 100
beef 200
</cat>
<dog>
steak 100
beef 200
poo 001
milk 020
steak 100
beef 200
</dog>


text:
Q: How we can increase the instances of Role in Windows Azure? I working with one Service bus application, I would like to know that  how would  we create worker role programmatically?

A: Do you mean deploying your worker role programmatically or increasing the instance count of already running worker role programmatically? For both, you would need to make use Windows Azure Service Management API. For the 1st one, you would invoke Create Deployment (http://msdn.microsoft.com/en-us/library/windowsazure/ee460813) while for the 2nd one, you would need to update the instance count in your role's configuration file (*.cscfg) and invoke Change Deployment Configuration (http://msdn.microsoft.com/en-us/library/windowsazure/ee460809).


text:
Q: $a_n>0, n\in\mathbb Z, \lim_{n->\infty}\frac{a_n}{a_{n+1}+a_{n+2}}=0$, show that $\{a_n\}$ is unbounded. I tried to proof it by contradiction.
I assume $\{a_n\}$ is bounded, then there exists $M$ such that $a_n<M$. Therefore
$$
\frac{a_n}{a_{n+1}+a_{n+2}}>\frac{a_n}{2M}>0
$$
which implies $\lim_{n->\infty}a_n=0$. However I don't know what to do next.

A: I would try it the following way:
If $\lim\limits_{n->\infty}\frac{a_n}{a_{n+1}+a_{n+2}}=0$ then there exists some $N$ so that $\frac{a_n}{a_{n+1}+a_{n+2}}<\frac{1}{4}$ for all $n\geq N$.
This means that $a_{n+1}+a_{n+2}>4{a_n}$ for all $n\geq N$.
This however means that $a_{n+1}>2a_n$ and/or $a_{n+2}>2a_n$.
Now we can prove via recursion that there must be at least one element $a_k>2^ma_N$ in the range $N<k\leq(N+2m)$.
Now prove that $2^ma_N$ is unbounded for $m\to\infty$.


text:
Q: Does the third conditional with past continuous exists? Examples are given below If you had gone to the football game yesterday, you should have invited me to go with you. (Follows structure, sounds weird)
If you were going to the football game yesterday, you should have invited me to go with you. (

*

*But this conditional contains past continuous, while the structure of the third conditional is: if + past perfect, …would + have + past participle. Why so?

A:
If you had gone to the football game yesterday, you should have invited me to go with you.

As you say, this sounds weird. The only way I can read the should is obligation, which doesn't fit with the counterfactual If you have gone.

If you had gone to the football game yesterday, you would have invited me to go with you.

This is grammatically fine, though perhaps an odd thing to say.

If you were going to the football game yesterday, you should have invited me to go with you.

This works as a non-counter-factual conditional (I think that means that it is not what you call a third conditional: this terminology of first, second, third conditionals appears to be taught only to ESL students), with, again, the "obligation" meaning of should. But in that reading you were going is not a past continuous: it is the past of the "intended future" form you are going.


text:
Q: Difference between visitor and component pattern I can't really come to terms with what makes the visitor design pattern different to a component design pattern. Both seem to just involve containers made up of discrete components.
So what's the difference?

A: Do you mean composite design pattern? If so, there is a similarity with both patterns in the aggregate portion.
However, in Visitor, operations are not done by the elements in the aggregate structure. They are rather encapsulated in visitor objects that examine (visit) elements of the composite. It allows adding operations easily without changing the aggregate classes.
Visitor can apply to an aggregate that is not necessarily a composite structure. So visitor and composite can be totally different patterns.


text:
Q: Vue.js bulma modal not displayed I'd like to open a modal when a link is clicked:
 Edit Post

The method:
  showEditModalFunc() {
    console.log('showEditModal value is' , this.showEditModal);
     this.showEditModal=!this.showEditModal;
  },

The modal itself:

    Lorem, ipsum dolor sit amet

  <button class="modal-close is-large" aria-label="close"></button>

This should be straightforward, but the modal does not show up!
I don't get any error either. And I can see in the console showEditModal value is true.
The modal is using bulma.css.
Strangely, I have another modal on the same component which I wrote when the component was using bootstrap.css. That modal  works just fine.
I'm wondering what could be wrong here? And how to fix it?

A: According to the bulma.css documentation:

To activate the modal, just add the is-active modifier on the .modal container

So you could use a class binding like so:

    Lorem, ipsum dolor sit amet

  <button class="modal-close is-large" aria-label="close"></button>


text:
Q: PHPUnit - How to test if callback gets called? Given the following method:
public function foo($callback) {
    call_user_func($callback);
}

How would I test that the callback actually got called, using PHPUnit?  The foo() method has no return value.  Its only job is to execute a callback given to it, with some other lookups and misc. processing that I've left out for simplicity's sake.
I tried something like this:
public method testFoo() {
    $test = $this;
    $this->obj->foo(function() use ($test) {
        $test->pass();
    });
    $this->fail();
}

...but apparently there's no pass() method, so this doesn't work.

A: You can have your callback set a local variable and assert that it was set.
public function testFoo() {
    $called = false;
    $this->obj->foo(function() use (&$called) {
        $called = true;
    });
    self::assertTrue($called, 'Callback should be called');
}

A: To test if something was invoked or not you need to create a mock test double and configure it to expect to be called N number of times.
Here's a solution for using an object callback (untested):
public method testFoo() {
  $test = $this;

  $mock = $this->getMock('stdClass', array('myCallBack'));
  $mock->expects($this->once())
    ->method('myCallBack')
    ->will($this->returnValue(true));

  $this->obj->foo(array($mock, 'myCallBack'));
}

PHPUnit will automatically fail the test if $mock->myCallBack() is never invoked, or invoked more than once.
I used stdClass and its method myCallBack() because I'm not sure if you can mock global functions like the one in your example. I might be wrong about that.


text:
Q: IIS App pool app and console app don't play nice. - named mutexes I have a c# web app that was developed under vs2015 / iis express and a console app that runs on the same box. I had set up a named mutex to mitigate file access contention and all worked great.
The console app created the mutex "IPC" and the web app opened it as an existing mutex.
Once I deployed that web app and console app to the production server (2008 r2/iis) the two apps cant see each others mutexes and the whole scheme comes crashing to the ground.
Is there a way to get around this?


text:
Q: Failed to stop mysql-server.service: Unit mysql-server.service not loaded - In ubuntu Hello!
I downloaded the Xampp panel on Linux where I try to start the Mysql server but it doesn't switch to run
I try this command:
sudo service mysql stop
But I get this err :
Failed to stop mysql-server.service: Unit mysql-server.service not loaded
Anyone have an idea?


text:
Q: Unity 3D Movement Problem when moving backward The following code supposes to move and rotate the character based on the plyer's input. However, it works perfectly when moving forward, left, and right, but keeps spinning when moving backward.
Does anyone know why that is? I really can't figure out how is that possible, it uses exactly the same code with moving toward other directions, why it just doesn't work when it comes to moving backward?!
Please help me! I'm losing my sanity over this.
The code is placed inside Update() function.
PS: So, now I am certain the problem is that the if statement for moving backward is always triggered. I logged transform.foward when moving backward, it outputs (0,0,-1) but the Equals function still returns false. I don't understand why is that, and why this does not happen to any other directions.
Please help, thank you!
PSS: So I switched .Equals function to == operation, and it works now. Still curious about why this happens though.
// Player Movements
        hInput = Input.GetAxis("Horizontal");
        vInput = Input.GetAxis("Vertical");
        if(Mathf.Abs(hInput) > Mathf.Abs(vInput))
        {
            if(hInput > 0)
            {
                // move right
                if (!transform.forward.Equals(new Vector3(1, 0, 0)))
                {
                    transform.Rotate(90, 0, 0);

                }
            } else if(hInput < 0)
            {
                // move left
                if (!transform.forward.Equals(new Vector3(-1, 0, 0)))
                {
                    transform.Rotate(-90, 0, 0);
                }
            }
            controller.Move(new Vector3(hInput, 0, 0) * mSpeed * Time.deltaTime);
        } else if(Mathf.Abs(hInput) < Mathf.Abs(vInput))
        {
            if (vInput > 0)
            {
                // move forward
                if (!transform.forward.Equals(new Vector3(0, 0, 1)))
                {
                    transform.Rotate(90, 0, 0);

                }
            }
            else if (vInput < 0)
            {
                // move backward
                if (!transform.forward.Equals(new Vector3(0, 0, -1)))
                {
                    transform.Rotate(-90, 0, 0);
                }
            }

            controller.Move(new Vector3(0, 0, vInput) * mSpeed * Time.deltaTime);
        }strong text

A: What components do you have on the player? Also, I would recommend logging the transform.foward function
UnityEngine.Debug.Log(transform.forward)

as it seems that transform.foward is the mostly likely cause for your issue.


text:
Q: What is the underlying database being used by Crafter CMS 3.0 or later? AFAIK Crafter CMS prior to version 3.0 used Alfresco as the repository which in turn uses RDBMS database as the underlying database for storage of meta data. It says Crafter CMS 3.0 is using git as the repository.
My application will involve lot of image files along with meta data and I assume image files are stored in the file system and meta data is stored  in underlying database in Crafter CMS 3.0.
Also is there any particular reason crafter CMS 3.0 opted not to use JCR/Jackrabbit as the repository like Magnolia and Hippo CMS are doing?

A: Crafter CMS is a de-coupled CMS, meaning there is an authoring system and a delivery system that are independent. In the case of Crafter CMS, those are Crafter Studio and Crafter Engine respectively.
Up to and including version 2.5, Crafter Studio used Alfresco ECM as its primary content repository, and as you correctly indicated, starting version 3.0 Git became the persistence repository. Crafter Engine always used the filesystem and never relied on an RDBMS or ECM. Solr is used for search, and Solr runs in both authoring and delivery and content are indexed there via Crafter Deployer.
It's important to note that Crafter Studio 3.0 does make use of a small embedded RDBMS schema (MariaDB) to maintain object state and other CMS-related activities, in addition to Git. However, that database can be rebuilt based on Git state if required.
With regard to image and video-based applications: the best practice is to model these assets in Crafter, but rely on an external store (like S3, Box, Alfresco via CMIS -- all of which are natively supported, but all of which are optional) for the binary but keep the meta-data in Crafter CMS. This means the content metadata is available in Crafter Engine (via Groovy, FreeMarker or Java by loading the descriptor (XML) or querying Solr), and the binary can be transformed, transcoded as required for delivery.
Having said that, you can still just store your content object (XML + binary) straight into Git if you'd like.
So to try to answer your question at a higher level: Crafter CMS uses XML to store content and metadata, this XML can point to binary assets (creating the association). The XML is modeled graphically to generate the forms, the forms render as overlays on content for a content author to create content and ultimately result in an XML in Git. XML is indexed by Solr via Crafter Deployer (runs in Authoring and Delivery) and is made available to Crafter Engine (hence your application, which is written in Groovy and FreeMarker (or Java if you really want)).
The reasons for not using the JCR are too many to list here -- Git provides a better developer workflow, performance, scalability, devops support, etc. See the #NoJCR recorded webinar on Crafter Software's website that covers some of the reasoning. One additional immediate resource is the arch overview: http://docs.craftercms.org/en/3.0/developers/architecture.html


text:
Q: ORA-01017 connecting to example schemas on Oracle VM appliance from Windows host I'm a software developer and am working on getting an Oracle VM Appliance running for testing purposes (the Database App Development VM with Oracle 12c - http://www.oracle.com/technetwork/community/developer-vm/index.html#dbapp). The host OS is Win 8.1 x64. I'm having trouble logging into the example schemas (HR, SH etc) from the host machine, with error ORA-01017. I've set up a tnsnames.ora file on the host and can connect as both SYS (as SYSDBA) and SYSTEM from there, so my basic setup seems fine (e.g. no firewall issues). The service alias is set to ORCL12C (the same as the SID on the VM).
the current situation is as follows:

*

*Port-forwarding and Host-only network both set up in the VM.

*From the Win8.1 host I can logon and run queries using both SQL*Plus and SQL Developer as SYS as SYSDBA/SYSTEM using either 0.0.0.0 (port-forwarding) or 192.168.56.101 (host-only) in tnsnames.

*When I attempt a login to HR from the host using SQL Developer I get the ORA-01017 error (using "Basic" connection type with default role). This is the case for both SID and Service Name options.

*A login attempt to HR from the host using SQL*Plus to HR@orcl12c also gives an ORA-01017 error.

*Within the VM I can connect to the HR schema using SQL Developer only if I select the Local/Bequeath connection type, but it fails with the ORA-01017 error if I use the Basic connection type. I can connect to SYSTEM or SYS/SYSDBA using the Basic connection type, however.

*Within the VM I can connect to HR, SH etc using SQL*Plus with no problems.

*I'm using the instant client on the host.

So there appears to be something I'm missing when using the Basic connection type with standard users in SQL Developer, both within the VM and from the host (possibly related to the SQL*Plus failure from the host?). I've done extensive web searching but can find nothing to solve this. Thanks.

A: Do you have Oracle XE or any database running in your host and listener is started as a service in your Windows host? Probably it is trying to connect there. If you have mapped 1521 from your host to 1521 to your guest, just make sure in your host there is no listener service running. If it is running change you port forwarding to 1522 ( Recommended )or something or uninstall the listener running in 1521 ( Don't seem like a wise thing to do :-) )

A: Problem solved - turns out that Oracle 12c has a new pluggable database architecture, and that's where the example schemas reside. So the root container is identified by the "orcl12c" SID, but the pluggable DB is "orcl". The solution was to add a new entry to the tnsnames file as follows:
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
      (SID = orcl12c)
    )
  )
In the host PC SQL Developer logon screen choose the "TNS" connection type and ORCL from the dropdown. You'll then be able to connect to the example schemas from the host PC.


text:
Q: how to get DisplayMemeber value from listbox by valuemember c#? I have a listBox, something like this:
ID ClientName

*

*Michael

*Steve

*Smith

Now, I know the ID of the client , how do i get the DisplayMember of it ?

A: Cast into DataRowView and convert select the client name column by index, which is 1.
String ClientName = (((DataRowView) listBox1.SelectedItem).Row[1]).ToString();

A: You could try this code. the example is written if the DataSource of the Listbox is DataTable, but if it is something else, try to see of what type is the object in Items property of the ListBox.
(Note that I don't like using break statement but this was the quickest way)
string str = string.Empty;
foreach (DataRowView drv in listBox1.Items)
{
       int lvID = int.Parse(drv.Row[listBox1.ValueMember].ToString());
       if (lvID == 5)
       {
             str = drv.Row[listBox1.DisplayMember].ToString();
             break;
       }
}

A: var t = from list in USStates where te.ShortName == textBox1.Text select te.LongName.ToString();

foreach(String st in t)
 {
   MessageBox.Show(st);
}

where USStates is Generic List and TextBox1.text contains the value of the id.Considering your listbox uses Generic list as DataSource.

A: There is a much easier solution. Especially if you are building the DataSource, populating it, then releasing the source. Use the Items list to create a DataRowView of the item currently selected. Then just pull the right index. 0 will give you the "value member" and 1 will give you the "display member".
DataRowView thisLine = cbTrackerFormList.Items[cbTrackerFormList.SelectedIndex] as DataRowView;


text:
Q: How to change value of datepicker using date stored in database? I have a datepicker which I wanted to change the value based on the date retrieved from the database.
Here is what I have tried so far.
1.
rs.Open("select DATE_FORMAT(dateReceived,'%m-%d-%Y') as daterec from tblrequest
where refcode='TR-I-CGS-2016-1', cnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockPessimistic)
dateReceived.Value = rs.Fields("daterec").Value

2.
 rs.Open("select dateReceived from tblrequest
where refcode='TR-I-CGS-2016-1', cnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockPessimistic)
dateReceived.Value = rs.Fields("dateReceived").Value

both methods doesn't get me the result I wanted. What I need is the value of the dateReceived when the form loads is the date obtained from the database. Can anyone please help me. Thanks


text:
Q: How to detect variable change events between controllers I'm making a fairly trivial notification system where I want a main menu (outside ng-view) to display the last activity of the user, from what I've read it looks like a service is best used to communicate between controllers. How should I detect when something happens in controller A immediately from controller B. Should I $watch the variable of the service? Or is there an easier way to do this? Or given should I just have a root scope variable and $watch and change that with the controllers?

A: You should use $broadcast and $on methods. Here's a good example found on the internet
Also, there is no more an issue with $broadcast over $emit in recent versions of angular,  because $broadcast runs as fast as $emit.
Don't use $watch for this because it will create a  lot of events ( angular has also a limit of 10 rerun iterations to prevent deadlock ).

The watch listener may change the model, which may trigger other listeners to fire.
  This is achieved by rerunning the watchers until no changes are
  detected. The rerun iteration limit is 10 to prevent an infinite loop
  deadlock.

Read more here

A: $watch will trigger everytime your variable change. Your can use $emit or $broadcast with $on for a less regular event.
This can be done in a factory : how to emit events from a factory

A: Could store something in the global $window and create a watch expression on it, that is just off the top off my head, might be a better way to do it.
Also take a look at this as it is like the sort of thing you need to do:
Share data between AngularJS controllers


text:
Q: How to deploy JavaFX as web application I have create a dynamic barchart using JavaFx which displays the barchart by query data present in the mysql database. I created this project in netbeans. I am able to run this project as windows application (by converting jar file to exe).
My next challenge is to embed this project to web browser. I have jar, jnlp and html files in the dist folder of the project. I tried to run the html file in browser but they are not running it.
Any help would be much appreciated.
thanks in advance

A: For Netbeans:

*

*Get a Code Signing Certificate. (They seem to cost a couple hundred dollars a year. Self-signed and unsigned don't seem to work anymore for either webstart or applet, unless you don't mind telling all your users to edit their settings https://superuser.com/questions/809027/run-unsigned-java-applets)

*In project properties, click Request unrestricted access(Enable Signing) and then click the Edit button to set Code Signing Certificate data.

*Right-click on the Project. Choose Set Configuration -> Run in Web Browser or  Set Configuration -> Run as Web Start

*Build

*Copy all the files from dist directory to your web server.


text:
Q: Unusual Integer encoding to bytes - what scheme is this? What Integer encoding scheme is used to achieve the following, and how can we do this in .Net:
127 = 7F
128 = 8001
255 = FF01
256 = 8002
500 = F403

A: Not so sure it has an official name, it is a 7-bit encoding.  It is a variable length encoding, the high bit of a byte is set if another byte follows.  Byte order is little-endian.
The .NET Framework uses it, Write7BitEncodedInt() method.  Used by the BinaryWriter.WriteString() method, it saves space since most practical strings have less than 128 characters.
So F403 => 03F4 => |0000011|1110100| => |00000001|11110100| => 0x1F4 == 500

A: SOLVED. I Hope this helps someone else.
    Dim o = {127, 128, 255, 256, 500}

    For Each i As Integer In o
        Console.WriteLine("{0} = {1}", i, Write(i))
    Next

Function Write(value As Short) As String
    Dim a = New List(Of Byte)

    ' Write out an int 7 bits at a time.  The high bit of the byte,
    ' when on, tells reader to continue reading more bytes.
    Dim v = CShort(value)
    ' support negative numbers
    While v >= &H80
        a.Add(CByte((v And &HFF) Or &H80))
        v >>= 7
    End While

    a.Add(CByte((v And &HFF)))

    Return B2H(a.ToArray)
End Function

Function B2H(b() As Byte) As String
    Return BitConverter.ToString(b).Replace("-", "")
End Function

Result:
127 = 7F
128 = 8001
255 = FF01
256 = 8002
500 = F403


text:
Q: Where do the IIS server variables SERVER_NAME and HTTP_HOST come from? Our ASP.NET application is not working at a customer installation because ServerVariables["SERVER_NAME"] and ServerVariables["HTTP_HOST"] return the string "Arcplan".
URLs which we build on the server are then incorrect (we use Request.Url.Authority which appears to use these ServerVariables internally).
The value "Arcplan" stored in the ServerVariables does not correspond to the name of the server or web site or anything that I can find. Maybe the computer was renamed and it used to be called Arcplan?
Does anyone know where IIS gets these values from? Are they stored in a config file somewhere?

A: Check your URL Rewrite configuration module if that thing has been set there.
Follow this link for more info:setting-http-request-headers-and-iis-server-variables


text:
Q: Node.js: bind port 3000 with DNS in IIS I'm running a Windows Server 2012 R2 with IIS 8.5 with different ASP apps. Now I developed a Node.js application which listens on port 3000. Also, there's a DNS record which points exactly to this server.
How can I get the node application to run without IIS involved (iisnode is not an option) on the same server? It should still listen on port 3000 (or similar), but when the user enters the domain name wihtout port, it should recognize it and serve the node app.
With a development server (no DNS binding) it simply worked by writing the port at the end of the ip address (like 10.10.10.10:3000). However, with the DNS record, I can't get this to work. sub.domain.com:3000 is not displaying anything and sub.domain.com is redirecting to the IIS start page. What can I do here?

A: sub.domain.com:3000 should be working. You probably have some firewall blocking incoming external requests to this port.
When someone types http://sub.domain.com (without a port), the client send the request to port 80 by default (or 443 if https:// is used). If IIS is already listening on port 80, then there is nothing you can do to make node.js respond to this port aswell.
What you can do is setup a lightning-fast Reverse Proxy (like NGINX) and bind it to port 80. Move IIS to another one, like 8080. Configure NGINX to pass forward requests from port 80 to another port, based on incoming requests' domain.
Configuration would be something like this:
server {
    listen 80;

    server_name domain.com;

    location / {
       proxy_set_header X-Real-IP  $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;
       proxy_pass http://127.0.0.1:8080;
    }
}

server {
    listen 80;

    server_name sub.domain.com;

    location / {
       proxy_set_header X-Real-IP  $remote_addr;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_set_header Host $host;
       proxy_pass http://127.0.0.1:3000;
    }
}

You can also use your IIS as the Reverse Proxy, but as you said, you don't want IIS to get involved on the request, so NGINX would be a good option.


text:
Q: Total Derivative Notation and Optimization I came across the following notation for a total derivative: $$\textbf{D}^2f(\textbf{a})(\textbf{u})^2 = \sum_{i=1}^n \sum_{j=1}^n f''_{x_j x_i}(\textbf{a})u_iu_j$$ where $\textbf{u} = (dx_1, dx_2,\ldots,dx_n)$.
I understand what this is saying, but my confusion lies in the vector $\textbf{u}$ and the following statement:

If $\textbf{D}^2f(\textbf{a})(\textbf{u})^2$ > 0 for all $\textbf{u} \neq \textbf{0}$, then $f$ has a relative minimum at $\textbf{a}$.

How can a vector of differentials ever be zero? Since $\textbf{a}$ and $f$ are fixed, what exactly are we checking here?
EDIT: After thinking about it is $\textbf{u}$ supposed to denote the differential of any vector? Hence the above must hold for all nonzero vectors?


text:
Q: Compiling or obfuscating node js I have an existing node js backend that need to deploy on customer premise. I would like to compile/obfuscate the code before passing to client.
I do not know whether it is "compilable".
But at very least i want to have only single merged code into index.js file (other javascript file all remove) that is obfuscated before passing to client.
Is there any existing npm module that does that and how reliable that an obfuscated code work as it is then original code.
What are your company/ ways to deal with it when u need to pass an existing node js source code deployable at client premise.
I am much more looking at existing library that can automate the whole process.
eg: npx run obfuscate-code --entrypoint.js (it will search all the import/require from node js and compile everything.
Folder structure is as follow.
    home
     - controllers (folder)
       - file1.js
       - file2.js
     - languages (folder)
       - en.js
     - services (folder)
       - service1.js
       - service2.js
     - index.js (entry point)

A: You can make an executable using PKG (npm package) see => https://github.com/zeit/pkg
or webpack if you want to make a single js file that is minimized.
// webpack.config.js
const nodeExternals = require('webpack-node-externals');

module.exports = {
    mode: 'production',
    target: 'node',
    externals: [nodeExternals()],
    entry: {
        'build/output': './src/index.js'
    },
    output: {
        path: __dirname,
        filename: '[name].bundle.js',
        libraryTarget: 'commonjs2'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: [
                            ['env', {
                                'targets': {
                                    'node': 'current'
                                }
                            }]
                        ]
                    }
                }
            }]
    }
};

By using nodeExternals you don't put external dependencies in the main js file but you refer to node_modules.
You can use both those 2 solutions using npm run ... by adding them to your scripts section in package.json


text:
Q: Gremlin Console for Windows error "The most significant bit.." Seems like Gremlin Console not working for Windows:
I downloaded the latest Gremlin console and run the bin\gremlin.bat file. seems like after connecting (as in the below commands) and running a simple remote command (g.V(123).count()) I'm getting an error:
The most significant bit should be set according to the format

This is the commands I run:
PS C:\Users\L836423\Downloads\apache-tinkerpop-gremlin-console-3.4.7-bin\apache-tinkerpop-gremlin-console-3.4.7\bin> .\gremlin.bat

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml
log4j:WARN No appenders could be found for logger (com.jcabi.manifests.Manifests).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
==>Configured my_gremlin_dns.com/55.222.88.111:8182
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [my_gremlin_dns.com/55.222.88.111:8182] - type ':remote console' to return to local mode
gremlin> g.V(123).count()
The most significant bit should be set according to the format
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin>

A: This happens when the server you are connecting to does not support the string serialization of Graph Binary used by newer versions of TinkerPop. You will need to use an older client. Find out what level the server supports and use the corresponding Gremlin Client version.
Specifically, the change went into the Gremlin Client as part of the 3.4.3 release. Your server needs to be at least at that version to use a Gremlin Client >= 3.4.3
With 3.4.3 the default serializer for the Gremlin Client was changed to be GraphBinary. It is possible you could also edit the settings in the YAML file read by the client to use a different serializer.


text:
Q: Cannot remove Docker container with status "Created" While trying to build docker image to my application, somehow I accidentally create 2 containers with status Created.
$ docker ps -a

CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                      NAMES
597a3d226a08        2eba970a4fc8          "entrypoint.sh"          43 hours ago        Created                                        pedantic_almeida
bae7a9324bc8        b0898d035451          "entrypoint.sh"          43 hours ago        Created                                        zen_franklin

The problem is I cannot do anything with these containers. docker rm/restart/inspect <container-id> all hangs up indefinitely with no message printed. However, starting new container from these 2 images work fine.
So my question is how to remove these 2 containers? Please tell me if you need any additional information.

Docker version: 18.03.0-ce.

A: You can use the below command to remove the two containers hung in "created" state:
docker container prune --force
This will remove all stopped containers, so be careful!

A: docker volume rm $(docker volume ls -qf dangling=true)
docker rm $(docker ps -q -f 'status=created')

After execution of the above commands, restart docker by,
service docker restart


text:
Q: Relational database(sqlite) for holding state information about a network on android? My latest project is an Android app for monitoring various devices(audio equipment with network interfaces) on a network.
My current thinking is that I will run an Android Service which polls the network/devices every second for any changes and maintains a model of the network state in an sqlite database.
My UI will then query the database as and when it needs information on the network state.
So my questions:
Does this sound sensible?
Is there a better way to model my network using Android-y things?
Should I be worried about taking up too much of the system resources with such frequent polling?
Apologies for the slightly vague, design discussion-type question.
Thanks,
Tom

A: Any reason you need to poll so frequently? I'd be concerned about those jobs overlapping.
Battery issues will come up with that much acitivity.
Also - since android relies on wifi you'll have to deal with that connection coming/going.
You might be better suited to setup a machine on the network, let it poll and then query it via android.


text:
Q: Mem error follows address, not DIMM ; how to cope? I have occasional BSOD that concerned me due to increading frequency. Once in two years, then 4 months, then 2 weeks.
I ran Memtest86+ and it locked up after 6 minutes 20 seconds.  It repeatedly locks up in the same place (not universally; outlier was earlier). I tried different botherboard settings including Safe Defaults.  Having reproduced the issue with a baseline setting, I tried reversing the two banks, each bank installed alone, and always got the same address, in the 4 to 6 MB range if I remember correctly.  It follows the address, not the physical RAM module.
I tried one bank only populating the second, with no difference.
Memtest86+ does work OK in F1 Failsafe mode, it seems (longer test run happening now).
Note that turning off a couple cores did not make a difference, but I'm not sure if the indicators mean that just one or many cores were engaged; the display might not ahow the hit that caused the freeze, anyway.
Any idea what might be causing this?  And more important, how might I mitigate it until I get new hardware set up?
Can I get Windows to block out that range and not use it?
(edit: yes! See https://superuser.com/a/490522/368845 )
Hmm, would PCI cards be doing something in that range, or does memtest86+ only count normal RAM?

The CPU (with integrated memory controller) in the AMD 1100T.


text:
Q: could not find host matching read preferences in mongodb I am creating a new collection in a new database on the sharded environment.
I am getting the following error while coll.insertMany(list).
Exception in thread "main" com.mongodb.MongoCommandException:
Command failed with error 133: 'unable to target write op for collection dbname.collection:: caused by ::
FailedToSatisfyReadPreference: Could not confirm non-existence of database "dbname" due to inability to query the config server primary :: caused by ::
FailedToSatisfyReadPreference: could not find host matching read preference { mode: "primary" } for set csReplSet' on server ip:27017.
The full response is { "ok" : 0, "code" : 133, "errmsg" : "unable to target write op for collection dbname.collection:: caused by ::
FailedToSatisfyReadPreference: Could not confirm non-existence of database \"dbname\" due to inability to query the config server primary :: caused by ::
FailedToSatisfyReadPreference: could not find host matching read preference { mode: \"primary\" } for set csReplSet" }

A: It looks like Read Preference is creating problem in your end.
Please go thru read preference and set which is more appropriate for your application
https://docs.mongodb.com/manual/reference/read-preference/
If your issue is something related to the one which is mentioned in below jira then we need mongo version 3.3.11 and currently we have only 3.2.9 released.
https://jira.mongodb.org/browse/SERVER-22620

A: There is possibility of read preference member is not available in replicaset in your case i.e primary not available.
For one or more reason's.

*

*Failover scenario when newely primary is getting elected.

*Majority of server's not available leaving no primary available.

https://docs.mongodb.com/manual/tutorial/troubleshoot-sharded-clusters/


text:
Q: Extracting elements from matrix using strings subscript error Hi I have a massive excel table and I want to extract values for specific compounds. Matrix repeats itself in 72 blocks, where vehicle-class is repeated with different road gradients and compounds and driving conditions.
    cb=[Vehicleclass_raw,Gradient_raw,Component_raw];
    size cb= 119952x3 cell
    Vehicleclass_airquis is string with 37 elements

so I thought I sort it according to criteria gradient vehicle class and component and this is the code blow. it works for the first 30 elements and then it crashes and error message is Subscripted assignment dimension mismatch.  outval_aq(i,:) = (rows). I cant figure out what the error is. Thanks for the help Matthias
    outval_aq = ones(37,72)*119953;
    for i=1:37
    rows = find(strcmp(cb(:,1),Vehclass_airquis(i)) & strcmp(cb(:,2),'0%') &     strcmp(cb(:,3),'NOx'));
    if ~isempty(rows)
    outval_aq(i,:) = (rows)
    end
    end

A: In a Matrix each row has the same number of elements. In your case you initialized outval_aq to be a 37x72 matrix but rows has only 60 elements. Solutions could look like:
%pad rows with nans to make it the required size:
rows(end+1:72)=nan
outval_aq(i,:) = (rows)

.
%write only the first 60 elements to the matrix, leave the remaining untouched:
outval_aq(i,1:numel(rows)) = (rows)

Or you could change outval_aq to be a cell array which contains vectors.


text:
Q: Html5 store local storage database file I'm currently working on a client-side project with Html5 and javascript.
I need create a large database (almost 2GB), and also I need to make this database portable.
In other words, I actually need to store the database into a binary file, migrate it, and retrieve its information.
As the result of my recent research I found two good solutions (especially for Android and IOS)

*

*Html5 Sql

*prepopulate-sqlite-in-phonegap
But none of them really helped me.
I should mention that my application is going to work on Desktop, Android, IOS, and any other platform that is going to support most of HTML5 features.
I should also mention that my DB is preloaded.

A: I would highly recommend JSON, This article will explain some more:
Databases using JSON as storage/transport format
I have personally used this one before which works well and loads its DB from a JSON: http://www.persvr.org/
JSON can be index if you create them corerctly, there basicly fully flexible and good for stroing, as far as i know they dont have any limitations as there just big strings when stringify and objects when parsed, Is there a limit on how much JSON can hold?
Also something similar has been asked before: Using JSon like a Relational SQL Database (Javascript)

A: I have personally found that it is better to write my database tables to json format, and then store the json into local storage as a string. This means your javascript will be able to easily access and modify the data client side, and what ever your using on the backend should be pretty happy working with it to put it back into what ever database your using if needed.


text:
Q: How to make a System.Configuration.Install.Installer to get a variable from the Setup project? I have 2 projects in my solution

*

*A Windows service

*Its Setup project
I need that my ProjectInstaller : System.Configuration.Install.Installer's method called OnAfterInstall to get the ProductName from the Setup Project. How do I do that?

A: Within your setup project right click project and select View > Custom Actions. Add a custom action. Now select Add Output, select your web service project, and click OK.
Now select your custom action and set the CustomActionData property to contain something like /ProductName=[PRODUCTNAME] /whateveryouwant=[Whateveryouwant] (note that these are key-value pairs; i.e. to access the product name, ProductName is the key and the value is PRODUCTNAME).
Note that CustomActionData contains the parameters that will be passed to your installer class. The PRODUCTNAME is the property name associated with the input control in the user interface dialog, and so in your case you would prompt user for Product Name within yor installer. So the label is "Product Name" and the corresponding property should be set as PRODUCTNAME (obviously you could change this, but the most important thing to note is that the UI property name must be the same as the property name in the CustomActionData) for this example to work.
Now within your installer class you can get product name by doing
public override void Install(IDictionary stateSaver)
{
      // If you need to debug this installer class, uncomment the line below
      //System.Diagnostics.Debugger.Break();

       string productName = Context.Parameters["ProductName"].Trim();

       string whateveryouwant = Context.Parameters["whateveryouwant"].Trim();
}

note i included the commented code //System.Diagnostics.Debugger.Break(); which you can comment in so that you can debug the installer class.
hope this helps.


text:
Q: Accessing $post global on a custom post type archive page I have a custom post type called projects, and its archive is at /projects, on the archive page I get notices Notice:  Trying to get property of non-object every time I try to access the $post i.e. $post->post_name. Is this intended behaviour? Should I just accept that and always check the availability of $post before using it?
if (!empty($post)) {
    // Do something with $post
}

A: Put in the following line at the top of archive page :
global $post;

Thing is you need to access the global $post object before trying to use it.

A: You are trying to get array values, so you are getting errors. Try with WP_Query, like:
global $post;
$projects = array(
    'post_type'   => 'projects',
    'orderby'     => 'date',
    'order'       => 'DESC',
    'post_status' => 'publish'
);
$projects1= new WP_Query( $projects );
if ( $projects1->have_posts() ) :
    while ( $projects1->have_posts() ) :
        $projects1->the_post();
        echo $post->post_name;
    endwhile;
endif;


text:
Q: audit logger not working properly my program is not giving error but log file is empty and even in database there is no entry in audit trail table
AuditLogger.java
package com.action;

import org.apache.log4j.Level;

import org.apache.log4j.Logger;

import org.apache.log4j.MDC;

public class AuditLogger {

private static String FQCN =  "myapplication.audit.AuditLogger";

public static void debug (String userid, String activity,String activityDetail)
{
    MDC.put("userid", userid);
    MDC.put("activity", activity);
    Logger.getLogger(AuditLogger.class.getName()).log(FQCN, Level.DEBUG,  activityDetail, null);
    MDC.clear();
}
public static void info (String userid, String activity,String activityDetail)
{
    MDC.put("userid", userid);
    MDC.put("activity", activity);
    Logger.getLogger(AuditLogger.class.getName()).log(FQCN, Level.INFO,  activityDetail, null);
    MDC.clear();
}

}
TestAudit.java
package com.action;

 import org.apache.log4j.Logger;

public class TestAudit {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    Logger.getLogger(TestAudit.class).debug("Before audit");
    AuditLogger.info("ashutosh","accesed", "User edit page");
    Logger.getLogger(TestAudit.class).debug("after audit");
}

}
log4j.xml

   <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
          <param name="File" value="logs/audit.log"/>
          <param name="Append" value="true"/>
          <layout class="org.apache.log4j.PatternLayout">
                 <param name="ConversionPattern"
                       value="%d %-5p [%t] %C{3} (%F:%L) - %m%n"/>
          </layout>
   </appender>

   <appender name="DB" class="org.apache.log4j.jdbc.JDBCAppender">
          <param name="URL" value="jdbc:mysql://localhost:3306/amey"/>
          <param name="driver" value="com.mysql.jdbc.Driver"/>
          <param name="user" value="root"/>
          <param name="password" value="root"/>
          <param name="sql" value="INSERT INTO AUDIT(USER_ID, TIMESTAMP, LEVEL, ACTIVITY, ACTIVITY_DETAIL) VALUES('%X{userid}','%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%X{activity}', '%m')"/>

   </appender>

   <appender name="NULL" class="org.apache.log4j.varia.NullAppender"/>

   <category  name="myapplication.audit">
          <priority value="DEBUG"/>
          <appender-ref ref="FILE"/>
          <appender-ref ref="DB"/>
   </category>
   <category  name="myapplication.test">
          <priority value="DEBUG"/>
          <appender-ref ref="FILE"/>
   </category>

   <root>
          <priority value="off"/>
          <appender-ref ref="NULL"/>
   </root>

A: priority off for root logger and NullAppender for rootlogger prevents the logging.
This is what NullAppender javadocs says:
A NullAppender merely exists, it never outputs a message to any device

This is what is meant when you switch off priority:
The OFF has the highest possible rank and is intended to turn off logging.

Change it to say File and it would write to file audit.log....


text:
Q: how the splash view can be removed with a Bookopening like animation? I have an Iphone application in which i am using an imageview to create a splash screen.and in the remove splash function i am removing that splash view and adding the navigation controllers view.Now i need to remove that splash view with a bookopening like animation like as did in the path application.can anybody help me to do that?

A: If you want it to look like a book cover opening, you could do an animation block, and just set the frame property to have a zero width:
[UIView animateWithDuration:0.2
                          delay:0
                        options:UIViewAnimationCurveEaseInOut
                     animations:^{
                         self.view.frame = CGRectMake(0,0,0,self.view.frame.size.height);

                     }
                     completion:^ (BOOL finished){
                         [self.navigationController popViewControllerAnimated:NO];
                     }
     ];

Otherwise, just use the built-in page-turn animation as mentioned by rckoenes


text:
Q: Having a fixed mean of normal distribution in Python Is there a substitute of np.random.normal()? I am seeking a function which will provide me a fixed mean and not vary with every run as shown below.
import numpy as np
mu, sigma = 50, 1.0 # mean and standard deviation
Nodes=220
r = np.random.normal(mu, sigma, Nodes)
print(r)

mean=np.mean(r)
print("mean =",mean)

Run 1 gives
mean = 49.957893448684665

Run 2 gives
mean = 50.13868428629214

A: You can use a seed to make the random numbers 'predictable'. This way you fix your random numbers and the mean will stay the same each time you run it. Even better, for everyone, the mean is now the same:
import numpy as np
mu, sigma = 50, 1.0 # mean and standard deviation
Nodes=220

np.random.seed(0)

r = np.random.normal(mu, sigma, Nodes)
mean=np.mean(r)
print("mean =",mean)

Returns: 50.07519566707803
Changing the value (seed value 0 in this case) will change your results


text:
Q: Why PHP include file contents getting displayed I have two php files feed.php and main.php.
In main.php, I am using feed.php.
feed.php
class RSSFeed {

    var $channel_url;
    var $channel_title;
    var $channel_description;
    var $channel_lang;
};

main.php

<?php include 'feed.php'; ?>

Welcome to my home page!

Some text.

when I run main.php, I got the following output
class RSSFeed {

    var $channel_url;
    var $channel_title;
    var $channel_description;
    var $channel_lang;

}

Welcome to my home page!

Some text.

I am not able to understand why I see the contents of RSSFeed class when I display the main.php in browser?

A: Because you forgot to put <?php and ?> on feed.php. That file is treated like plain text and is displayed in the HTML.
<?php
class RSSFeed {

    var $channel_url;
    var $channel_title;
    var $channel_description;
    var $channel_lang;
};
?>

A: I think you forgot to put
<?php

In the first line of your feed.php

A: May be you forgot the <?php at start and ?> at end of your feed.php
<?php
class RSSFeed {

    var $channel_url;
    var $channel_title;
    var $channel_description;
    var $channel_lang;
}
?>

A: If you pasted the exact text that is in feed.php, then you are missing the <?php and ?> tags that need to go around it. Otherwise, the PHP doesn't know it needs to process it, and thinks it's just a plain text file.

A: It should work fine assuming you have

<?php include 'main.php'; ?>

Welcome to my home page!

Some text.

and
<?php
class RSSFeed {

    var $channel_url;
    var $channel_title;
    var $channel_description;
    var $channel_lang;

}
?>

In the correct files.

A: More then likely, you forgot to wrap the class page "feed.php" in  tags.
Also, since what you are reading in is a class, I would recommend doing:
<?php require_once('feed.php'); ?>

This will keep you from loading the same file in multiple times.
Trust me, it will save you a headache later.


text: Q: What causes diamagnetism? What makes a diamagnetic substance repel a magnet? If one explains it on the basis of cancelation of dipole moments in an atom and Lenz's law, shouldn't the diamagnetic substance be attracted to the magnet when the magnet is moving away from it? But that does not seem to be the case...


text:
Q: HMR breaks after launch DevTools in Electron App Hello and sorry for my english. I create app with Electron (Webpack + TS + React + Redux) and I have a problem. Webpack Dev Server have Hot Module Replacement system (HMR) and I use it and it works good. I change styles and React components and app reloads after this changes. But when I open Developer Tools in app (Ctrl+Shift+I or by View menu) HMR crashes. I see in console on Developer Tools:
[HMR] Cannot apply update. Need to do a full reload!
[HMR] Error: Aborted because ./src/renderer/containers/MainScreen/index.tsx is not accepted
Update propagation: ./src/renderer/containers/MainScreen/index.tsx -> ./src/renderer/containers/App/index.tsx -> ./src/renderer/renderer.tsx
    at applyHandler (http://localhost:8085/build/renderer.js:60091:31)
    at http://localhost:8085/build/renderer.js:59807:21
    at Array.map (<anonymous>)
    at internalApply (http://localhost:8085/build/renderer.js:59806:54)
    at http://localhost:8085/build/renderer.js:59781:24
    at waitForBlockingPromises (http://localhost:8085/build/renderer.js:59737:55)
    at http://localhost:8085/build/renderer.js:59779:22

After that, the application does not reload and I see no changes in components or styles. Button Force Reload does not works too.
But I work on 2 computers and the problem is only on one, on the second everything works well with some operation system, npm packages and webpack config. I tried to change node version, electron and some other, but the problem remains.
My Webpack dev config:
      mode: 'development',
      entry: MAIN
        ? path.resolve(`${baseWebpackConfig.externals.paths.src}/main/main.ts`)
        : path.resolve(`${baseWebpackConfig.externals.paths.src}/renderer/renderer.tsx`),
      output: {
        path: `${baseWebpackConfig.externals.paths.dist}`,
        filename: MAIN ? 'index.js' : 'renderer.js',
        publicPath: 'http://localhost:8085/build/',
      },
      target: MAIN ? 'electron-main' : 'electron-renderer',
      devtool: 'cheap-module-source-map',
      optimization: {},
      devServer: !MAIN ? {
        publicPath: 'http://localhost:8085/build/',
        port: '8085',
        host: '0.0.0.0',
        historyApiFallback: true,
        hot: true,
        inline: true,
        progress: false,
        index: 'index.html',
      } : {},
      watchOptions: {
        ignored: /node_modules/,
      },
      plugins: [],
    },

I have no idea what is wrong.

A: I solved HMR problem by adding
if (module.hot) {
    module.hot.accept();
  }

on render and main.ts files, but Force Reload still not working.


text:
Q: Update site bindings in applicationHost.config I am trying to add a list of site bindings to the applicationHost.config file as opposed to manually adding each one through IIS 7.5.
<site name="new_site" id="6">
    <application path="/" applicationPool="new_site">
        <virtualDirectory path="/" physicalPath="D:\HTTP\wwwroot\newsite" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:80:example.com" />
        <binding protocol="http" bindingInformation="*:80:www.example.com" />
        <binding protocol="http" bindingInformation="*:80:example2.com" />
        <binding protocol="http" bindingInformation="*:80:www.example2.com" />
    </bindings>
</site>

The reason for doing this is i have 2000 bindings to add, which would be a lot easier to do if i could edit the config file directly.
When editing the config file however the bindings do not work or show up in IIS.
Is this actually possible or am i missing something?

A: You should use Microsoft.Web.Administration assembly and create sites trough that API. Here is the example of creating a site
http://learn.iis.net/page.aspx/226/microsoftwebadministration/

A: You could script this in PowerShell:
[Reflection.Assembly]::Load(
"Microsoft.Web.Administration, Version=7.0.0.0,
Culture=Neutral, PublicKeyToken=31bf3856ad364e35") > $null

$siteId = 6
$serverManager = New-Object Microsoft.Web.Administration.ServerManager
$site = $serverManager.Sites | where { $_.Id -eq $siteID }

# Read your list of hostnames

$reader = [System.IO.File]::OpenText("c:\\hostnames.txt")
for(;;)
{
    $domainName = $reader.ReadLine()
    if($domainName -eq $null) { break }
    $binding1 = "*:80:www." + $domainName
    $binding2 = "*:80:" + $domainName
    $site.Bindings.Add($binding1, "http")
    $site.Bindings.Add($binding2, "http")
}
$serverManager.CommitChanges()

The file c:\\hostnames.txt would contain a list of all your domain names, for example:

domanname1.com
domanname2.com
domanname3.com

If you need to bind to a specific IP address then replace * with the IP address.

A: Are you using a 32-bit editor on a 64 bit machine?  If so, Windows is saving your edits to C:\Windows\SysWOW64\inetsrv\Config\applicationHost.config.
See https://serverfault.com/questions/315904/cannot-open-iis-7-applicationhost-config-in-64-bit-windows-with-32-bit-text-edit


text:
Q: get error for facebook login "the operation cannot be completed (com.facebook.sdk error 2)" for iPhone 5 I created an application using facebook sdk 3.1.1 but i get error like "the operation cannot be completed (com.facebook.sdk error 2)" for iPhone 5. my bundle id and app id are correct. So can any one has any idea?
Thank you

A: I had a similar issue. Later i found that my native ios login had failed. I deleted that account and it worked fine.

A: Set sandbox mode to Off in your application settings in facebook.


text:
Q: Windows Server 2012 R2 Suspending Threads at launch We're having trouble with processes being marked as "Suspended" in Task Manager and being unable to be killed and/or their related services refusing to stop.  Sysinternals Process Explorer is also unable to resume the process, however through the Properties->Threads tab in ProcExp we're able to resume the RtlUserThreadStart thread and the process continues.

We initally put this down to being one server and so began migrating services/processes to a new server (we've just moved one service over which spawns cmd.exe threads), however that is also having the same issue.
I've tried using the system Event Viewer in Administrative Tools with a custom event viewer filter to dump out every event for a minute either side of the start time of the thread, but there's nothing in common between the two servers.
The other differences between the two servers is that the first is a Terminal Server whilst the second is set up as a MS SQL Server, and is running only sqlserv.exe.  Both servers are running as Hyper-V virtual machines.
We've never seen this behaviour on any of the other few hundred servers we look after - although I don't believe any of the others are Hyper-V servers - so we're really hoping someone else out there has seen something similar.
Edit: the A/V running on these particular servers is WebRoot

A: Apologies if etiquette does not allow replies like this..... first time poster.
@EionRobb we have a similar problem with postgre going into suspended status, and some other internally written (admittedly very old) apps doing the same, on Windows 2012 R2. Only started a few weeks ago - no apparent coincidence with any windows updates. Only solution to kill the processes is reboot.
We are running Webroot AV.
Did you find a solution in the end?


text:
Q: Launcher Icon is not visible for Flutter App. on Menu I have below pubspec.yaml file & when i do flutter run , it launches app on device but i cannot see the launcher icon in my phone's menu listing.
My phone is Android 7
name: simpleapp
description: Simple App
version: 1.0.0+1
environment:
  sdk: ">=2.1.0 <3.0.0"
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:
  uses-material-design: true

A: You could use flutter_launcher_icons which is replacing every icons for iOS and Android (as well as Android 8.0 and more with adaptive icons) with a single command in your terminal

A: *

*Add flutter_launcher_icons  package to your pubspec.yaml file

*Within pubspec.yaml file specify the path of the icon you wish to use for the app and then choose whether you want to use the icon for the iOS app, Android app or both.

*Run the package

*here you go !

A: More for me for the next time I have this (2nd app, 2nd time...) In android > app > src > main > AndroidManifest.xml:
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

android:name="io.flutter.embedding.android.NormalTheme" MUST BE kept as is. It's referencing Flutter for some magic to happen behind the scene...


text:
Q: JSF commandLink onclick not working, but commandButton is? I am working with JSF and have implemented a JS function that is called when commandLinks and Buttons are clicked on. The function is used to prevent multiple submissions if the link/button is clicked on more than once. The problem is that it works on all buttons and some links, even though it is always called when being clicked on :S This is the JS function:
var formSubmitted = false;
function onSubmit() {
    if (!formSubmitted) {
        formSubmitted = true;
    } else {
        event.preventDefault();
    }
}

Here is an example of a working button:
<h:commandButton onclick="onSubmit()" value="#{Buttons.andraVGU}" rendered="#{vardgivareVGBean.visaAndraVgu}"
action="#{vardgivareVGBean.actionAndraVGU}" />

And here is an example of a link that calles the function but still gives me an exception.
<h:commandLink value=""
  onclick="onSubmit()"
  action="#{forslagTillaggBulkBean.oppnaFastTillagg}"
  onmouseover="onMouseOverTableRow(this); return false"
  onmouseout="onMouseOutTableRow(this); return false"
  disabled="#{forslagTillagg.tillaggTypAsString=='TILL'}">
<h:outputText escape="false" value="#{forslagTillagg.uppdrag}"
  styleClass="#{forslagTillagg.status != 'N' ? 'farg' : 'greyedout'}" />
    <f:param name="fastTillaggID"
    value="#{forslagTillagg.fastTillaggID}" />
  <f:param name="fastTillaggGiltigt"
    value="#{forslagTillagg.tillaggTypGiltig}" />
</h:commandLink>

Here is a commandLink that works:
<h:commandLink onclick="onSubmit()" value=""
  actionListener="#{oversiktBean.valjFakturaRad}"
  onmouseover="onMouseOverTableRow(this); return false"
  onmouseout="onMouseOutTableRow(this); return false">

I realise that one difference between the links are that the ones that does not work have nested tags, but I don't see why that would cause an issue.
I would really appreciate an explanation from you experienced guys!
Thanks!


text:
Q: How do I keep the sand out of my eyes? The Damp Oasis level is full of sand and I can't see or do anything.
How do I get the sand out of my eyes?

A: Use your stickerized Vacuum Thing to suck it up all up.
To get the Vacuum, go to Surfshine Harbor, and head to right to find a building with a door pasted on sideways. Go into Paperize mode, peel it off, and then put it back on upright.
Next, head through the building and then out the door in the back. Walk over to the next door and you'll be able to make your way up to the second floor. On this floor you will find the Vacuum Thing and a HP-Up Heart.


text:
Q: Fancyhdr not working in TeX Live I have recently added the fancyhdr package (v4.0.3, i.e. latest version) to my application code and it works on Windows 10 with MiKTeX (current version). My application always worked also on Ubuntu 20.04 LTS with TeX Live. So I was quite surprised to discover the following error (on Ubuntu):

It seems to be complaining that the fancyhdr page style definitions are in the document preamble(!!!)... but MiKTeX has no issue with this at all. Isn't this where they are supposed to be?
As a test I moved them after \begin{document} but this did not solve the problem as it didn't like the square brackets in the \fancypagestyle{plain}[frontpage]{...} command (though it did get rid of the ! LaTeX Error: Missing \begin{document}. error).
After reading this: fancyhdr package not working in particular point 4.5 in the answer Few things to know first, I began to wonder if this is the same BUG? Or is it possible to fix this in the LaTeX code?
My TeX example is long, however I think the following will work as an MWE to demonstrate my issue:
\documentclass[10pt, a4paper]{report}
\usepackage[english]{babel}
\usepackage{fontenc}
\usepackage{enumitem} % used to customize the {description} environment
\usepackage[nomarginpar, top=21mm, bottom=15mm, left=10mm, right=10mm]{geometry}
%------------ page styles ------------
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{frontpage}{
  \fancyhf{}% clear all header and footer fields
}
\fancypagestyle{plain}[frontpage]{
  \fancyfootoffset[R]{0pt}% recalculate \headwidth
  \cfoot{\centerline{Page \thepage}}
}
\fancypagestyle{datapage}[plain]{
  \newgeometry{nomarginpar, top=21mm, bottom=18mm, left=16mm, right=16mm, headsep=2.6pt, footskip=15pt}
  \rfoot{\textsf{\footnotesize{https://pypi.org/project/pyalmanac/}}}
} %-----------------------------------
\usepackage{xcolor}  % highlight double moon events on same day
\definecolor{khaki}{rgb}{0.76, 0.69, 0.57}
\usepackage{multirow}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage[pdftex]{graphicx}   % for \includegraphics
\usepackage{tikz}               % for \draw  (load after 'graphicx')
\setlength\fboxsep{1.5pt}       % ONLY used by \colorbox in alma_ephem.py
\begin{document}
\pagestyle{frontpage}
    \begin{titlepage}
bla bla bla
\end{titlepage}
\pagestyle{datapage}  % the default page style for the document
% ------------------ N E W   P A G E ------------------
\newpage
\sffamily
\noindent
\begin{flushright}
\textbf{2022 August 14 to Aug. 15}%
\end{flushright}\par
\begin{scriptsize}
bla bla bla
\end{scriptsize}
\end{document}

I look forward to hearing your responses. By the way - I do need to change page geometry in my case - and as I mentioned this works just fine with MiKTeX.
UPDATE 15-AUG-2022:
Thanks for the first two (very helpful) comments. I have tried a few times de-installing and re-installing TeX Live on Ubuntu 20.04 LTS (Focal Fossa) and every time it installs TeX Live 2019 again. (I actually assumed that's the latest version!) Even here I only see the 2019 versions listed: https://packages.ubuntu.com/search?suite=focal&keywords=texlive
I follow the instructions that are available on most web pages:
$ sudo apt remove texlive-latex-extra
$ sudo apt autoclean && sudo apt autoremove

and afterwards:
$ sudo apt update
$ sudo apt-get install texlive-latex-extra
$ tex --versiom

I don't know if later TeX Live versions are even compatible with Focal Fossa. Does one have to install from source code? (REALLY???) Can I follow this guideline?: https://fahim-sikder.github.io/post/installing-texlive-latest-ubuntu/


text:
Q: jQGrid: Is it possible to start the grid with the search toolbar on? Is it possible to get the jQGrid toolbar to show up on page load?

A: Yes I believe it is possible. Try using the gridComplete option
gridComplete : function() {
  $("#myGridID")[0].toggleToolbar();
}


text:
Q: interconnect/it Search Replace DB AJAX Error, MySQL - Resolved for use case, but could not locate table problem causing error I've been using the interconnect/it Search Replace DB tool for years to do effective mass search and replace on MySQL databases. Today I was presented an error that I had never encountered. I am presenting is a work-around as I would call it, but it did seem to resolve the problem for my specific use case.
Script Version: Search Replace DB v 4.1.1
Data for replacement, simple: data1 change to data2
Error presented:

"The script encountered an error while running an AJAX request. If you
are using your hosts file to map a domain try browsing via the IP
address directly. If you are still running into problems we recommend
trying the CLI script bundled with this package. See the README for
details."

A: These are the steps and use-case resolution:
(1) Entered the data for replacement in Search and Replace
(2) Connected the database, also tested connection with script option
(3) Which Tables, selected 'all tables'
(4) 'Do a safe test run" clicked
All seems OK, until the error was thrown!
The next thing I noticed as that not all of the tables had processed, this was a bit tricky because it was the near last table, so it appears a full table list had been displayed.
Naturally, I then compared the list to the actual database directly. The script ended at a specific table (near the end of all tables)!
(5) So I went back to the Which Tables option and chose Selected Tables, then selected all the tables, with exception to the next table after the last table that processed successfully. This allowed the script to continue successfully.
The table throwing errors was Wordpress usermeta
If you have any idea why this specific table would throw Search Replace DB v 4.1.1 I welcome any suggestions. I understand this could be specific to the data I have in that table, so might not be a general solution.
Shout out to kalico1 of github for helping with data that verified my use case solution!


text:
Q: How to hide table class until data is returned? As indicated in the code. The user enters data into one of the 6 input boxes. Query results are returned in (example:  	)
I need to have the blank
 hidden unless query results are returned.
The code is long but fairly simple and straight forward. Basically the user queries 1 record, 1 record displays. User queries 4 records 4 records display.
I already have the db working and pulling the results I need I just don't know how to hide the blank tables data
enter code here

     <form action="" method="post" name="frmTracking" id="frmTracking" onReset="clearControls(this);">
<input type="hidden" name="recordID" value="">

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    <input name="searchRecord" id="searchRecord" type="text"  size="8" maxlength="8">
<input name="searchRecord" id="searchRecord" type="text"  size="8" maxlength="8">
<input name="searchRecord" id="searchRecord" type="text" size="8" maxlength="8">
<input name="searchRecord" id="searchRecord" type="text"  size="8" maxlength="8">
<input name="searchRecord" id="searchRecord" type="text"  size="8" maxlength="8">
<input name="searchRecord" id="searchRecord" type="text"  size="8" maxlength="8">

          <input type="button" name="btnFind" value="Find"
                                                                class="cmdBtn" onClick="return getDBRecord(this.form);"><input type="button" name="reset_form" value="Clear" onclick="this.form.reset(); history.go(0) "   >

      Procedure Code Record

      Procedure Code

      Medicare Advantage

             Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

      Procedure Code Record1

      Procedure Code

      Medicare Advantage

              Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

      Procedure Code Record2

      Procedure Code

      Medicare Advantage

              Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

      Procedure Code Record3

      Procedure Code

      Medicare Advantage

              Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

      Procedure Code Record4

      Procedure Code

      Medicare Advantage

              Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

      Procedure Code Record5

      Procedure Code

      Medicare Advantage

              Procedure

              Specialty

              Precert Type

              Review Type:

              Guidelines:

</form>

           top of page

A: give table some id and call $(tableId).hide(); Optionally you may want to show the table but disable it until data is returned


text:
Q: Discrete Math Set Problem I came up a problem with for one of the question.
I have to proof if the following statement is true/false.
$$C\setminus(A\setminus B) = (C\setminus A)\cup(C\cap B)$$
I am a little confuse $C\setminus(A\setminus B)$.
I am not sure where to start.
Thanks guys.

A: Using the identity $X\setminus Y=X\cap Y^C$, where $Y^C$ is the compliment of $Y$:
$$C\setminus(A\setminus B) = C\cap (A\setminus B)^C= C\cap (A\cap B^C)^C=C\cap ( A^C \cup B) = (C\cap A^C)\cup(C\cap B)=(C\setminus A)\cup (C\cap B).$$

A: Here is a hint:  draw a Venn diagram for three mutually intersecting sets $A$, $B$, $C$.  Then shade in the region described by the LHS, and shade in the region described by the RHS.  Are they the same?  If so, then use the diagram to try to break down this region into smaller cases.  Or, write out a truth table.


text:
Q: RecyclerView or Glide doesn't update image when the image is overwritten I use Glide in onBindViewHolder() method in an adapter extended from RecyclerView.Adapter as follows:
Glide.with(context)
    .load(imagePath)
    .override(500, 500)
    .crossFade()
    .diskCacheStrategy(DiskCacheStrategy.RESULT)
    .into(((MyItemHolder) holder).imageView);

Then, I do cropping in one of the images that are given as data to the adapter. After cropping image, I overwrite the image file, i.e., I save the edited image with the same filename. So the imagePath stays the same whereas the image has changed. However, this change isn't being reflected in the RecyclerView even with a separate notifyDataSetChanged() call. The change reflected if I save the edited image with a different filename.
Is there any way to achieve detection of the image content change while keeping filename same?

A: The reason this is happening is because Glide is caching the image and as the path is same so it will not get to know about the change. For this to work you need to change the caching strategy and skip the memory cache like this:
Glide.with(context)
    .load(imagePath)
    .override(500, 500)
    .crossFade()
    .diskCacheStrategy(DiskCacheStrategy.NONE)
    .skipMemoryCache(true)
    .into(((MyItemHolder) holder).imageView);

Now the image will not get cached and the image will get updated.


text:
Q: Is there someway to respawn an NPC in roblox studio? So, I'm coding this fighting game in roblox studio. Now I have made an NPC, but I want to script it to be able to respawn a few seconds after dead, but I don't know how to check if an NPC is dead or how to respawn one and make it join its body parts again.
Thank you, and I hope you can help.

A: You can check the health of the NPC from the Health property of its Humanoid in order to see if it's still alive, or if it's dead.
game.workspace.<NPC>.Humanoid.Health

Now in order to check if it's dead, you can do:
if game.workspace.<NPC>.Humanoid.Health <= 0 then
--NPC is dead; respawn
end

In order to 'respawn' the NPC, duplicate the NPC (in workspace) and place the copy in ReplicatedStorage. Now whenever the NPC died, you can replace it with a new one by cloning the one in ReplicatedStorage to workspace:
 if game.workspace.<NPC>.Humanoid.Health <= 0 then
    wait(2) -- If you want to wait before the NPC respwns, change '2' for the amount of seconds you want to wait
    game.ReplicatedStorage.<NPC>:Clone().Parent = game.workspace
 end

Finally, wrap this all in a while loop so it can continuously check the health of the NPCs.
while wait() do
  if game.workspace.<NPC>.Humanoid.Health <= 0 then
      wait(2) -- If you want to wait before the NPC respwns, change '2' for the amount of seconds you want to wait
      game.ReplicatedStorage.<NPC>:Clone().Parent = game.workspace
  end
end


text:
Q: Не выпадает выпадающее меню Вроде всё подключено, но выпадающие меню никак не хочет выпадать, на клик не реагирует, только при нажатии стрелки вниз выпадает, в чем ошибка?

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#responsive-menu"> Открыть навигацию    </button>
            Логотип

Пункт 1

                        Пункт 2

Выбор 1

Выбор 2

Выбор 3

Выбор 4

Пункт 3

Пункт 4

Название страницы

<link href=" https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css " rel="stylesheet "/>


text:
Q: Why do I get 'Can't locate object method "init" via package "wlgmod::odt"' when I try to run wyd.pl in Cygwin? I'm trying to run a Perl script called WyD using Cygwin on Windows. Cygwin is installed at C:\cygwin64, and WyD is installed at C:\wyd\wyd.pl. Both are in the Windows PATH environment variable as C:\cygwin64 and C:\wyd respectively.
When running WyD with bash/Mintty using:
wyd.pl -b -e -t -s 3 -o "OUTPUTTEDWORDLIST" "TARGETFOLDER"
...I get the following error:

Can't locate object method "init" via package "wlgmod::odt" (perhaps
  you forgot to load "wlgmod::odt"?) at /cygdrive/c/WYD/wyd.pl line 284.

Sometimes wlgmod::odt is replaced with wlgmod::doc or any other document type, but running the script always generates that same basic error.  A previous answer to this question recommended installing several dependencies, which turned out to be a mere copy-paste of an answer for Ubuntu systems, and didn't solve the error, so I've decided to start at the beginning and re-ask the question with more details. I also have all Perl packages in the Cygwin installer installed.
After everything I've tried and done to get this script working, I can personally think of two possible causes for the error. Think of these as a guide more than anything else.

*

*The error above references line 284 in the wyd.pl script, so it's possible that something in that script is hardcoded so that it doesn't work with Cygwin/Windows, or just generally has a compatibility bug. I don't understand Perl, so I can't confirm this.

*I notice that the installation of WyD at C:\wyd contains a folder called wlgmod, and that folder contains all the files that the above error seems to be looking for; doc.pm, html.pm, jpeg.pm, etc. If those files exist in that directory but bash is unable to find them, maybe it's due to the fact WyD needs to be run from within Cygwin itself. I've only recently thought about this possibility, and my knowledge of both Cygwin and WyD is too sparse to definitively know how both work. Is it even possible to run WyD from within the Cygwin folder? It's not a package so can't be installed as one, and therefore I'm not sure how that would work.
Here are the relevant sections of the script:
# Module hash containing module name and supported file extensions
# Multiple extensions are seperated using ';'
my %wlgmods = (
           'wlgmod::strings', '',           # only used with command-line switch
           'wlgmod::plain'  , '.txt',       # used for all MIME text/plain as well
           'wlgmod::html'   , '.html;.htm;.php;.php3;.php4',
           'wlgmod::doc'    , '.doc',
           'wlgmod::pdf'    , '.pdf',
           'wlgmod::mp3'    , '.mp3',
           'wlgmod::ppt'    , '.ppt',
           'wlgmod::jpeg'   , '.jpeg;.jpg;.JPG;.JPEG',
           'wlgmod::odt'    , '.odt;.ods;.odp'
           );

...

# Initialize possible modules
foreach(keys %wlgmods) {
    eval("use $_;");
    my $ret = $_->init(); # line 284

    # If module failed, add errortext and remove from hash
    if($ret) {
        $retvals .= "$_: $ret\n";
        delete $wlgmods{$_};
        $ret = "";
    }
}


text:
Q: Get json value dynamically {
 "id":["123"],
 "optionid_123":"98"
}

I have the id as a variable, but from that how can I get the optionid_*? I tried a few things, but nothing seems to work. The each is inside of the appropriate function and jsonid contains the correct value. Here is my attempt at accessing the value 98 which doesn't work:
$.each(data.id,function(){
    var jsonid = this;
    console.log( data.optionid_+jsonid ); // doesn't work
});

A: You can use Bracket notation:
console.log( data['optionid_' + jsonid] );

A: I think your loop with data.id is not correct. That is
$.each(data.id, function() {..})

is incorrect.
For example if you data looks like following:
var data = [{
 "id":["123"],
 "optionid_123":"98"
},
{
 "id":["456"],
 "optionid_456":"99"
}];

Then you need to loop over data and get your required property.
$.each(data, function(index, val) {
  var jsonid = val.id[0]; // as val.id is array so you need [0] to get the value
  console.log(val['optionid_' + jsonid]); // bracket notation used
});

DEMO


text:
Q: SQL convert plus where I have this code
Dim datetofind As Date
datetofind = Calendar1.SelectedDate
AccessDataSource1.SelectCommand = "SELECT * FROM [Table1] WHERE ([Date] = '" & datetofind & "') "

The date field stores the value as dd/mm/yyyy 0.00.00 and there is no way to change it.
How to apply the SQL convert function so that datetofind would be comparable to Date?

A: Use this syntax:
"SELECT * FROM [Table1] WHERE ([Date] = #" & datetofind & "#) "


text:
Q: Confusion about the de-referencing of pointers I'm confused about the de-referencing of pointers, if I've the below code snippet:
char str[]="ABC";
char *a=str;

Then what does a+1 refer to?
Is it B or BC as a whole?
This confusion has dawned in me because when I give:
cout<<a+1;

It gives me BC instead of B, why is it like that?
If I've a function to swap values and if it takes in arguments like:
void swap((a+1),(a+2))

How will the above function work out?
Will it swap B with C?

A: Here's your pointer, a, pointing to the start of the string "ABC" (note the \0 at the end represents the implicit NUL-terminator byte):
ABC\0
^
|
a

Here's what it looks like after you add one to a:
ABC\0
 ^
 |
 a

Note that a is now pointing to the next entry in the char-array.  cout will print chars until it reaches the NUL-terminator byte at the end of the array, so if you do a cout<<(a+1) it will print "BC".

A: The difference between pointing to an element, and pointing to the beginning of a range of elements depends entirely on how you use that pointer. It's not an intrinsic property of the pointer. Whether a+1 refers to 'B' or "BC" depends on what you do with the pointer. It just so happens that std::cout treats all char pointers as pointers to C strings.

A:
Then what does a+1 refer to?

a points to the first element of the array str. The value of the first character is 'A'. The result of a + 1 expression is a pointer to the next element of str after the one that a points to. The next element is the character with the value 'B'.

This confusion has dawned in me because when I give:
cout<<a+1;

It gives me BC instead of B, why is it like that?

This is because when you insert a pointer to a character into a character stream (such as std::cout), it is assumed to point to a character in an array (as it does in this case), and the behaviour is to stream all characters in that array until the null  termination character (\0) is reached.
So, just like when you insert the pointer that points to A and all characters starting from A until the null termination character are printed (ABC), similarly when you pass the pointer that points to B then all characters starting from B are printed (BC).
You can dereference the pointer to insert just that one character, if that is your intention:
std::cout << *a;       // A
std::cout << *(a + 1); // B

or
std::cout << a[0]; // A
std::cout << a[1]; // B

A: char str[]="ABC";
char *a=str;

a is char pointer and it's points to str as below
    --------------------
   |  A  |  B  C  | \0  |
    ----------------------
  0x100   0x101 ... .. (lets say 0x100  is the base address of str)
  str
  a

If you prints
cout<<a<<endl;/* it starts from 0x100 location and prints upto NULL */

and
/* a+1 == 0x100 + 1x1  == 0x101 */
cout<<a+1<<endl; /* a+1 means it starts printing from 0x101 location upto NULL character so it prints BC*/

Edit :
void swap((a+1),(a+2))

How will the above function work out? Will it swap B with C? => yes it will swap B and C, depends upon swap function logic.


text:
Q: how i can use mysql_error() function if i use php with sql server(mssql) or oracle how i can use mysql_error() function if i use php with sql server(mssql) or oracle ?

A: You can not use mysql_error with myssql or oracle databases.
they have their own
mssql_get_last_message for mssql.
oci_error for oracle.


text:
Q: JWT Cookie is not stored right - Laravel I am using Laravel 5.1 and i'm trying to implement a basic JWT-Auth logic.
While i'm creating the jwt_token right (i log it to laravel.log, token has it's three different parts divided by dot as expected), when i try to create a cookie with the jwt_token value, a completely different cookie is created, with no division by dots and it is much bigger than the original jwt_token.
I think code is pretty straightforward :
$jwt_token = $this->findOrCreateUser($user);
Log::error('My jwt_token is '. $jwt_token); //from the log here i see the right jwt_token

//i disable the http-only flag because i want to read it with js

return redirect('/index.html')->withCookie(Cookie::make('jwt_token',$jwt_token,1000,null,null,false,false));

I would be really glad, if anyone could give me some pointers about what may be wrong !
Thanks

A: Laravel 5.1 ships by default with a middleware named EncryptCookies that is registered in the global $middleware array of the HTTP kernel. So the cookies are automatically encrypted when sent to the browser, that's why your cookie value is not the plain text representation of your JWT token.
You can easily fix that in two ways:
1. Add the cookie name to the $except array in the App\Http\Middleware\EncryptCookies:
protected $except = [
    'jwt_token'
];

2. Comment/remove the EncryptCookies middleware in the App\Http\Kernel class (although I do not recommend this unless you specifically want all cookies to be unencrypted):
protected $middleware = [
    \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    // \App\Http\Middleware\EncryptCookies::class,
    \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \App\Http\Middleware\VerifyCsrfToken::class,
];


text:
Q: how to set up outbound email on a fresh server? I'm a novice when it comes to server admin, and I need some help. I recently got sick of GoDaddy, and I signed up for an unmanaged rackspace server. I'm running a Debian instance, and I'd like to set up the server to send outgoing email via PHP and via cron.
PHP and Apache are already installed. I've installed sendmail, via apt. I have no idea how to set any of this up. I don't really need inbound support, although I imagine it would be nice for my PHP emails. (Or I can just have sendmail() change the return address in my PHP script.)
Specifically, I have no idea how to configure sendmail as an outgoing mail server. How would I do that?

A: Looks like the default sendmail config on Debian allows outbound relaying, and listens on 127.0.0.1 by default - pretty much the config you need.
Try testing with something like this:
root@test1:~# mail outside-address@example.com
Subject: test
asdf
.

..and check if the listener is working:
netcat localhost 25

If the message works outbound, then you should be in good shape.
For cron, the email is send to the user that owns the job; if you want those messages going outbound, set up an alias for the user the cron is running under in /etc/aliases.
For PHP, you should be able to configure the application to point to localhost, port 25, and have it successfully send mail outside.

A: Start with a guide, such as http://www.wikihow.com/Configure-Sendmail. Or google other guides, find one you can follow, go through the steps and read the readme files.
Heres a better one http://frenchtouch.pro/tutorial/configure-your-debian-server-to-send-mails/47


text:
Q: Importing .dat files in python without knowing how it is structured I am trying to load and see the contents of data which can be downloaded from here. After which I need to analyze it. In this regard, I had already posed on problem, but I could not get any solution.
Now, I went through their label file located here. In that, it is mentioned that

"Will code useful Python based letters to describe each object
/ / see http://docs.python.org/library/struct.html for codes                 / / formats will comma separated beginning with "RJW," as key then           / / {NAME}, {FORMAT}, {Number of dims}, {Size Dim 1}, {Size Dim 2}, ...      / / where {FORMAT} is the Python code for the type, i.e. I
for uint32        / / and there are as many Size Dim's as number of
dimensions. "

So, I guess one can try python. I do have a working knowledge in python. So, I started with this program which I got from here (for simplicity python file and the data files are in same folder):
import numpy as np
data = np.genfromtxt('JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.dat')
print(data)

I got the error "UnicodeDecodeError: 'cp949' codec can't decode byte 0xff in position 65: illegal multibyte sequence".
If I change the code to (as mentioned here):
data=open('JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.DAT', encoding='utf-8')
print(data)

The error message disappears, but all I get is:
<_io.TextIOWrapper name='JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.DAT' mode='r' encoding='utf-8'>
I had checked other answers in in StackOverflow, but could not get any answer. My question may be closely similar to what is posted here
I need to first see the contents of this dat file and then export to other format, say .csv.
Any help will be deeply appreciated...

A: You need to open the file in binary mode.
with open('JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.DAT', 'rb') as f:
    while True:
        chunk = f.read(160036) # that is record size as per LBL file
            # because the file is huge it will expect to hit Enter
            # to display next chunk. Use Ctrl+C to interrupt
        print(chunk)
        input('Hit Enter...')

Note, you can parse the LBL file, construct format string to use with struct module and parse each chunk into meaningful fields. That is what the comment you quote is saying.
"""Example of reading NASA JUNO JADE CALIBRATED SCIENCE DATA
https://pds-ppi.igpp.ucla.edu/search/view/?f=yes&id=pds://PPI/JNO-J_SW-JAD-3-CALIBRATED-V1.0/DATA/2018/2018091/ELECTRONS/JAD_L30_LRS_ELC_ANY_CNT_2018091_V03&o=1
https://stackoverflow.com/a/66687113/4046632
"""

import struct
from functools import reduce
from operator import mul
from collections import namedtuple

__author__ = "Boyan Kolev, https://stackoverflow.com/users/4046632/buran"

with open('JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.LBL') as f:
    rjws = [line.strip('\n/* ') for line in f if line.startswith('/* RJW')]

# create the format string for struct
rjws = rjws[2:] # exclude first 2 RJW comments related to file itself
names = []
FMT = '='
print(f'Number of objects: {len(rjws)}')
for idx, rjw in enumerate(rjws):
    _, name, fmt, num_dim, *dims = rjw.split(', ')
    fstr = f'{reduce(mul, map(int, dims))}{fmt}'
    FMT = f'{FMT} {fstr}'
    names.append(name)
    print(f'{idx}:{name}, {fstr}')
FMT = FMT.replace('c', 's') # for conveninece treat 21c as s char[]
print(f"Format string: {repr(FMT)}")

# parse DAT file
s = struct.Struct(FMT)
print(f'Struct size:{s.size}')
with open('JAD_L30_LRS_ELC_ANY_CNT_2018091_V03.DAT', 'rb') as f:
    n = 0
    while True: # in python3.8+ this loop can be simplified with walrus operator
        chunk = f.read(s.size)
        if not chunk:
            break
        data = s.unpack_from(chunk)
        # process data further, e.g. split data in 2D containers where appropriate
        n += 1

print(f'Number of records: {n}')

# make a named tuple to represent first 10 fields
# for nice display. This basic use of namedtuple works only
# for first 23 objects, which have single item.
num_fields = 10
Record = namedtuple('Record', names[:num_fields])
record = Record(*data[:num_fields])
print('\n----------------------\n')
print(f'First {num_fields} fields of the last record.')
print(record)

output:
Number of objects: 49
0:DIM0_UTC, 21c
1:PACKETID, 1B
2:DIM0_UTC_UPPER, 21c

--- omitted for sake of brevity ---

46:DIM2_AZIMUTH_DESPUN_LOWER, 3072f
47:MAG_VECTOR, 3f
48:ESENSOR, 1H
Format string: '= 21s 1B 21s 1b 21s 1b 1H 1B 1B 1B 1B 1h 1h 1f 1f 1f 1f 1f 1f 1f 1f 1f 1f 3f 3f 3f 1f 9f 9f 9f 1f 1I 1I 1H 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3072f 3f 1H'
Struct size:160036
Number of records: 1101

----------------------

First 10 fields of the last record.
Record(DIM0_UTC=b'2018-091T23:56:08.925', PACKETID=106, DIM0_UTC_UPPER=b'2018-092T00:01:08.925', PACKET_MODE=1, DIM0_UTC_LOWER=b'2018-091T23:51:08.925', PACKET_SPECIES=-1, ACCUMULATION_TIME=600, DATA_UNITS=2, SOURCE_BACKGROUND=3, SOURCE_DEAD_TIME=0)

Link to GutHub gist


text:
Q: Amazon AWS volume full although www folder has 88 megs my mysql failed because, apparently, my volume is filled. All 8 gb of it. I only have put mongodb, nodejs, apache, mysql and in the www folder, wordpress and phpmyadmin.
My question is, what happened and how do I fix it?
Here is what df -h gave me:
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  7.9G     0 100% /
tmpfs                 298M     0  298M   0% /dev/shm

A: i personally like "du -xk / |sort -n"  as that will list the largest/top used directories on and only the root partition.
that said, root partition is not for storing data.  being you are on aws, it is very easy to simply mount another volume whereever you need it
EDIT:

1) ec2-create-volume
  2) ec2-attach-volume
  3) fixup /etc/fstab
  4) mount /path/to/mountpoint


text:
Q: How to show and change html content at the same time I have the following hidden bootstrap alert div which I setup to show errors
I want to show that and change the html content of it at the same time. I tried the following jquery that will show the errorDisplay. But it is not working.

var errorDisplay = $("#errorDisplay").text();
$("#errorDisplay").html(errorDisplay);
$('#errorDisplay').show();

  Error!

A: Move your id to the  tag

  Error!

No need to get the error text first.
$("#errorDisplay").html(errorDisplay);
$('#errorDisplay').show();

Alternatively you could leave your id where it is and add  tags to your error text
$("#errorDisplay").html(`<strong>${errorDisplay}</strong>`);
$('#errorDisplay').show();

Note that I am using ES6 backticks for the error text in order to put a variable inside a string

A: Do the following steps:
//1. clear the html inside
$("#errorDisplay").empty();

//2. a append new html inside it:
$("#errorDisplay").append("you updated html here..");

//3. now show the popup:
$('#errorDisplay').show();