text:
Q: Problem with new lines in cells while reading an Open Document Spreadsheet (*.ods) file in a PHP array with OpenTBS I am trying to read an Open Document Spreadsheet (*.ods) file in PHP using 'TinyButStrong template engine' along with the 'OpenTBS' plugin. My target is to convert the spreadsheet's cell data into a PHP array.
Sample ods row data (row #4 of inferno.ods):

Here is my code:
include_once('lib/plugins/tbs_3140/tbs_class.php');
include_once('lib/plugins/tbs_3140/opentbs-master/tbs_plugin_opentbs.php');

$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);

$TBS->LoadTemplate('inferno.ods', OPENTBS_ALREADY_UTF8);
$options= array('noerr'=>true);
$metaOdsObj= $TBS->Plugin(OPENTBS_GET_CELLS, '$A:$B', $options);
//$xml = $TBS->Source;

var_dump($metaOdsObj);
//var_dump($xml);

The output:
array(6) {
...
[3]=>
  array(2) {
    [0]=>
    float(5)
    [1]=>
    string(4) "THE "
  }
...
}

Note that only the first line of the cell data (separated by a new line) is fetched as the cell value. How can I get the complete text (with new lines) of a cell as an array value? Any clues?
$TBS->Source fetches the contents in XML with each line inside the cells separated by a <text:p> tag. I tried using PHP SimpleXML and DOMDocument::loadXML with this xml data without the desired outcome.
Thank you for reading this far. And also a ton of thanks for giving it a thought.

A: This is an OpenTBS bug that limits the string cell reading to the first line.
This bug is fixed as of OpenTBS 1.11.0-beta4.
You can patch the function OpenDoc_GetCellValue() using the code available at GitHub.
Thanks for reporting this issue.


text:
Q: How can I add job description in Jenkins 2 multi-branch pipeline? I have a multi-branch pipeline job in Jenkins 2, connected to a GitHub repository (available here). Each pull request in the GitHub repository creates a new "job" in Jenkins, but the job inherits its name from the pull request number (i.e. jobs are called PR-1, PR-2, and so on) which is meaningless in a Jenkins context.
Is it possible (and how) to configure the job or Jenkinsfile to add a job description to each pull request ?

A: Here is how I was able to set the job description from the content of the pull request :
if (env.BRANCH_NAME.startsWith('PR')) {
 def resp = httpRequest url: "https://api.github.com/repos/xxx/yyy/pulls/${env.BRANCH_NAME.substring(3)}"
  def ttl = getTitle(resp)
  def itm = getItem(env.BRANCH_NAME)
  itm.setDisplayName("PR '${ttl}'")
 }
}

@NonCPS
def getItem(branchName) {
  Jenkins.instance.getItemByFullName("sonar-openedge/${branchName}")
}

@NonCPS
def getTitle(json) {
  def slurper = new groovy.json.JsonSlurper()
  def jsonObject = slurper.parseText(json.content)
  jsonObject.title
}

This allows having job description available directly from the job overview page (as in this example: https://ci.rssw.eu/job/sonar-openedge/ )
The full commit and Jenkinsfile are available here:
https://github.com/Riverside-Software/sonar-openedge/commit/e2c76ca58b812e4ceac65c406f0b2aae9fbf3f5f

redpajama_set_name: RedPajamaStackExchange


text:
Q: JSP $ sign what does it mean
Greetings, it is now <c:out value="${now}"/>

In this jsp code what is the $ sign actually doing?

A: It Identifies it as an expression, an expression is of the format ${....}, so it's placing your now variable in the page (HTML encoded, since you're using <c:out>).
For the <c:out> encoding comment: You can grab the full spec here, or if you want to learn more about JSTL in general, start here.

A: It's an expression evaluation.


text:
Q: Criteria in hibernate is incasesensitive? I am using criteria api to check If the user name exists or not. After that I am checking the password. But the user name is not case sensitive. I want to make it case sensitive.
Criteria criteria2 = session.createCriteria(UserMaster.class);
criteria2.add(Restrictions.eq("userName", userName));
userDetails = (UserMaster)criteria2.uniqueResult();
if(userDetails != null) {
      //logic goes here
 }

Any help will be appreciated.

A: How strings are compared, depends on the brand and version of the database and the settings of the database. Some databases, for example Microsoft SQL Server, compare strings in a case-insensitive way by default, while others compare strings in a case-sensitive way.
Check the settings of your database; lookup the documentation of your particular brand and version of database to find out how to change this setting.
If it is indeed MS SQL Server, then look for example at this question: Sql Server check case sensitivity?

A: I can say a simple solution. But its not a straight way. Encrypt your username using MD5 and save it to database. When comparing the username, you must encrypt the given username with MD5 and compare it with the username saved in the database. But i am not recommending this solution, anyway you can use this also. :)

A: I did with the native sql as follows
Query query = session.createSQLQuery("select * from USER_MASTER where binary USER_NAME='"+userName+"'").addEntity(UserMaster.class);
userDetails = (UserMaster)query.uniqueResult();
if(userDetails != null) {
  //code goes here
}


text:
Q: Odd warning and missing _Accessor when compiling on new computer I had to resurface my development computer recently, including reinstalling VS2010.  So far as I can tell, I reinstalled everything the same as previously.  However, when I compile my project I get a bunch of errors of the form:
C:\Work\CaseTrakker_v5\CaseTrakker_v5_5\Tests\CaseTrakkerCore.ComponentModel.Test\ComponentModel\NotifyPropertyChangeBaseTest.cs(100,63): error CS0246: The type or namespace name 'NotifyPropertyChangeBaseRef_Accessor' could not be found (are you missing a using directive or an assembly reference?)
Also (and possibly related) I get this warning for most projects in my solution:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(287,9): warning CS1691: '2008' is not a valid warning number
I have another development machine with the same version of Visual Studio, and the same source code (fetched from version control), and everything compiles without incident.
Clearly, I have done something wrong with the installation, but I've exhausted everything I can think of.  I'd really rather not have to go back and reinstall everything from scratch (again).
Any ideas?
David Mullin

A: This post is blaming StyleCop (R#) for this behavior. Is problably entered some information in your projects or solutions that cannot be resolved anymore. Did you have installed StyleCop or Resharper? And is it installed currently after resurfacing?

A: So, it turns out that there was one important step that I omitted when resurfacing my machine - I didn't install VS 2010 SP1.  I did this, and both issues went away.
Thanks for the attention.
David Mullin


text:
Q: Include paths in Visual Studio Express 2012 I wrote a whole bunch of .cpp and .h files that are included amongst them, all in the same directory. I increased the directory level by one and added the path to the VC++ include directories on the project property. At this stage everything works fine. Then I rearranged the files in various folders all rooted to one folder though. Then I added (recursively) all the folders involved from the root folder downward to the directory list, then my project won't compile. I right click and open the files to check if they wee found and they all opened. I even right click and navigate to the definitions and declarations of members and classes and they all worked fine but the project won't compile telling me that my identifiers are undeclared.
Is there an order in which I must have added the directories? What am I doing wrong? How can I fix this?

A: Try creating a new project,
Add only your root source folders to the C++ -> Additional includes, then add all your .CPP files to your project. All your #include <..\file.hpp> paths must be the same as the files actual location within the folder structure (you only need to specify the path below the root folder).


text:
Q: HttpClient: how do I obtain the underlying socket from an existing connection? I am using HttpClient 4.02 to create a connection via proxy (using the CONNECT method) to tunnel a connection to a remote server. HttpClient is very convenient for this but I am new to the API and cannot see how to get at the underlying Socket of the tunneled connection.
The following code taken from: http://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.0.1/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
    // make sure to use a proxy that supports CONNECT
    HttpHost target = new HttpHost("target.server.net", 443, "https");
    HttpHost proxy = new HttpHost("some.proxy.net", 8080, "http");

    // general setup
    SchemeRegistry supportedSchemes = new SchemeRegistry();

    // Register the "http" and "https" protocol schemes, they are
    // required by the default operator to look up socket factories.
    supportedSchemes.register(new Scheme("http",
            PlainSocketFactory.getSocketFactory(), 80));
    supportedSchemes.register(new Scheme("https",
            SSLSocketFactory.getSocketFactory(), 443));

    // prepare parameters
    HttpParams params = new BasicHttpParams();
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);

    ClientConnectionManager ccm = new ThreadSafeClientConnManager(params,
            supportedSchemes);

    DefaultHttpClient httpclient = new DefaultHttpClient(ccm, params);

    httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);

    HttpGet req = new HttpGet("/");

    System.out.println("executing request to " + target + " via " + proxy);
    HttpResponse rsp = httpclient.execute(target, req);
    HttpEntity entity = rsp.getEntity();

This sets up the connection nicely but is there a way to get at the underlying Socket in order for me to use a custom protocol to talk to the server at target.server.net?

A: Not sure I completely understand your requirements, but I'll give it my best shot...
Try this: http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/examples/ProxyTunnelDemo.java?view=markup

A: Open a change request in the project's JIRA. This feature simply got overlooked. While it should be fairly trivial to put together an equivalent of ProxyClient from 3.x, it makes sense to ship one with the stock version of HttpClient.
Edit:
Available since version 4.2. See http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http/impl/client/ProxyClient.html

A: In a comment, @willjcroz says:

It is so that my app is usable for people behind firewalls where the only way out would be a web proxy. By connecting to the proxy it will forward data to the target server as HTTPS, giving a secure connection to the target server.

If you are going to successfully tunnel your protocol through web proxies, protocol aware firewalls and so on, the client and server sides of your application have to conform to the HTTP protocol specifications.  If you (somehow) managed to drill down to the socket level, the chances are that you would violate the protocol ...
Instead, you should implement your custom protocol by putting your data in the content of the HTTP requests and responses, using custom HTTP headers in messages / responses, custom content types, and so on.


text:
Q: Using tab key for navigation in TextEdit I have two TextEdit boxes and one custom button widget, I wish to change focus in the following order using the tab key on my keyboard:
TextEdit1 <-> TextEdit2 <-> Button

I have specified something similar to the following for each widget in order to obtain the chain above:
KeyNavigation.tab: TextEdit2
KeyNavigation.backtab: TextEdit1

My problem is however that the tab keystroke is caught in the TextEdit, and cannot be used to navigate. How can I disable tabs in the TextEdit and instead use it for changing focus?

A: I found the problem.
By default the key events are first sent to the item which is receiving the event - not to  KeyNavigation. This behavior can be changed by setting
KeyNavigation.priority: KeyNavigation.BeforeItem

The complete code thus becomes
KeyNavigation.tab: TextEdit2
KeyNavigation.backtab: TextEdit1
KeyNavigation.priority: KeyNavigation.BeforeItem

A: Read about the Qml Keys element.
You can do something like this :
TextEdit
{
  width : 40
  height: 40
  text  : "junk"

  Keys.onTabPressed:
  {
      // Write logic to transfer focus to whomsoever you want
  }
}

A: While searching for a solution to a similar problem, I came across this option in Qt Creator and seems to solve the thing. Now I can move out of the QTextEdit object with tab key, instead of inserting a tab character into the field.
I see that the topic is old and already solved but maybe this convenient simple option was made available with a more recent update to Qt, I don't know. I just came across it and I hope it helps someone searching for the same solution as me.


text:
Q: add linefeed when copying Windows 7 files Am running Windows 7 64-bit with 8 GB of memory.
Have a large number of text files that do not have an end_of_line symbol [i.e. LF (\n) or CRLF (\r\n)].
Want to copy the files to a new file to parse and edit.
Using convention Windows "copy," the separate files are concatenated into a single record with only one end_of_line symbol.
How to add a LF or a CRLF to each file before a copy command concatenates the next file to the previous file?
Thanks in advance for advice.
/j

A: Say you have a folder full of .HTML files, and you want to concatenate them together, but put a blank line between each file as concatenated, you can use something like this code at a command prompt:
for %F in (*.html) do type "%F" >>concatenated.html && echo. >>concatenated.html

The echo. echos a blank line into the file.
If you want to add the string "\r\n" in between instead, you could use something like:
for %F in (*.html) do type "%F" >>concatenated.html && echo \r\n >>concatenated.html


text:
Q: What is the difference between VBA.Str and VBA.Str$? What is the difference between these two code lines
Debug.Print VBA.Str(123)

and
Debug.Print VBA.Str$(123)

A: Str$ and Str are identical except for at least 2 important differences:

*

*If the usage of Str$ returns anything other than a String, you'll get an error:
Debug.Print Str(Null)   'Prints Null
Debug.Print Str$(Null)  'Throws Runtime Error 94 - Invalid use of Null

*Str$ returns a String, whereas Str returns a Variant. In general, you should always prefer the strongly typed Str$ over Str
There are many other functions that use $-suffixes, like Left$, Mid$ and Space$.
If we look at Left$ (which is really just an alias for _stdcall _B_str_Left) and Left (which is really just an alias for _stdcall _B_var_Left), in the Type Library MIDL, we see that the input types matter too.
[entry(616), helpcontext(0x000f6ea1)]
BSTR _stdcall _B_str_Left(
                [in] BSTR String,
                [in] long Length);
[entry(617), helpcontext(0x000f653e)]
VARIANT _stdcall _B_var_Left(
                [in] VARIANT* String,
                [in] long Length);

You can actually use the underlying functions in code:
Debug.Print VBA.Strings.[_B_var_Left]("abc",1) 'Prints a
Debug.Print VBA.Strings.[_B_str_Left]("abc",1) 'Prints a

And to make matters more confusing, a function like Join (that does return a String, but which doesn't have a corresponding Join$ function, can actually be used with a $ suffix:
Debug.Print Join$(Array(1, 2, 3), ".") 'Prints 1.2.3

For further discussion, see my answer at Exactly what are these _B_var_Xxxxx and _B_str_Xxxxx members in the VBA COM libraries?

A: Str$ is identical to Str except for the declared type of its return value. i.e.  Str returns a Variant, the Str$ returns a String.
Refer the msdn link


text:
Q: Ubuntu 18 - Netplan - cloud.cfg disable issue Using Ubuntu 18.04 Server LTS for an embedded application.  Two physical network interfaces are present, one ethernet and one a PCI Athros wifi card.  I can use netplan .YAML and ifconfig up/down to manually control and switch between interfaces.
I have added the 99-disable-network-config.cfg file with the contents:
network: {config: disabled}

to the /etc/cloud/cloud.cfg.d directory.   Netplan apply has been run (multiple times)
I have one 01_xx.YAML file present in /etc/netplan that sets the Wifi adapter up to DHCP.  The expectation is that the ethernet interface will remain down on a reboot.  When I reboot I see the startup message that it is attempting to initialize the network and it times out after 2 minutes as failing.  However as soon as I am at the CLI prompt I check the interfaces and I have both the ethernet and Wifi interfaces up and connected.
Is there a way to actually keep one of the interfaces down at startup?  I want to only have one adapter being started based on the 01_xx.YAML I have set.
And then to keep the startup networking timeout from running to 2 minutes?  I suspect this is part of systemd but I can't find it.  This doesn't seem to be related to the dhclient.conf timeout parameter as I already have it set to 30 seconds.

A: Assuming you're using the networkd renderer, try adding optional: true to the device definition. This will tell systemd-networkd not to wait for it on boot.


text:
Q: Hive ParseException - cannot recognize input in Select Clause Am trying to write a Union All query in hive. Below is my query
Create table test.Final_Union_Table as
    Select xyz.column_1,xyz.column_2,xyz.column_3
        From (
        Select a.column_1, a.column_2, a.column_3
                From test.Union_table1 a
                Union All
                Select b.column_1, b.column_2, b.column_3
                From test.Final_Table b)xyz;

Am getting the error below
ParseException line 2:0 cannot recognize input near 'z' '.' 'Column_1' in select clause

Would appreciate some help and guidance here.
Thanks.

A: I think your query is right,try this
Create table test.Final_Union_Table as
    Select column1,column2,column3
        From (
        Select a.column_1 as column1, a.column_2 as column2, a.column_3 as column3
                From test.Union_table1 a
                Union All
                Select b.column_1 as column1, b.column_2 as column2, b.column_3 as column3
                From test.Final_Table b)xyz;

Note- Data type should be same for particular column in both tables example a.column_1 and b.column_1 should have same data type;


text:
Q: Upload file via POST I have the necessity to implements a file upload on a web server in C++, I succeed with the following code:
  #include <windows.h>
  #include <wininet.h>
  #include <iostream>

  #define ERROR_OPEN_FILE       10
  #define ERROR_MEMORY          11
  #define ERROR_SIZE            12
  #define ERROR_INTERNET_OPEN   13
  #define ERROR_INTERNET_CONN   14
  #define ERROR_INTERNET_REQ    15
  #define ERROR_INTERNET_SEND   16

  using namespace std;

  int main()
  {
     // Local variables
     static char *filename   = "test.txt";   //Filename to be loaded
     static char *type       = "image/jpg";
     static char boundary[]  = "pippo";            //Header boundary
     static char nameForm[]  = "uploadedfile";     //Input form name
     static char iaddr[]     = "localhost";        //IP address
     static char url[]       = "test.php";         //URL

     char hdrs[255];                  //Headers
     char * buffer;                   //Buffer containing file + headers
     char * content;                  //Buffer containing file
     FILE * pFile;                    //File pointer
     long lSize;                      //File size
     size_t result;

     // Open file
     pFile = fopen ( filename , "rb" );
     if (pFile==NULL) return ERROR_OPEN_FILE;

     // obtain file size:
     fseek (pFile , 0 , SEEK_END);
     lSize = ftell (pFile);
     rewind (pFile);

     // allocate memory to contain the whole file:
     content = (char*) malloc (sizeof(char)*lSize);
     if (content == NULL) return ERROR_MEMORY;

     // copy the file into the buffer:
     result = fread (content,1,lSize,pFile);
     if (result != lSize) return ERROR_SIZE;

     // terminate
     fclose (pFile);

     //allocate memory to contain the whole file + HEADER
     buffer = (char*) malloc (sizeof(char)*lSize + 2048);

     //print header
     sprintf(hdrs,"Content-Type: multipart/form-data; boundary=%s",boundary);
     sprintf(buffer,"--%s\r\nContent-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n",boundary,nameForm,filename);
     sprintf(buffer,"%sContent-Type: %s\r\n\r\n",buffer,type);
     sprintf(buffer,"%s%s\r\n",buffer,content);
     sprintf(buffer,"%s--%s--\r\n",buffer,boundary);

     //Open internet connection
     HINTERNET hSession = InternetOpen("WinSock",INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
     if(hSession==NULL) return ERROR_INTERNET_OPEN;

     HINTERNET hConnect = InternetConnect(hSession, iaddr,INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
     if(hConnect==NULL) return ERROR_INTERNET_CONN;

     HINTERNET hRequest = HttpOpenRequest(hConnect, (const char*)"POST",url, NULL, NULL, (const char**)"*/*\0", 0, 1);
     if(hRequest==NULL) return ERROR_INTERNET_REQ;

     BOOL sent= HttpSendRequest(hRequest, hdrs, strlen(hdrs), buffer, strlen(buffer));
     if(!sent) return ERROR_INTERNET_SEND;

     //close any valid internet-handles
     InternetCloseHandle(hSession);
     InternetCloseHandle(hConnect);
     InternetCloseHandle(hRequest);

     return 0;
  }

From server side there is a PHP script that perform file saving using informations stored in $_FILES variable.
The code works well with TXT file, but does not work with JPG (image) files: in this case the file is correctly created and named server side, but it is empty! I think it is related to the fact that I read a binary file and wrote it on a string.
Any suggestion?
Thank you

A: You shouldn't be using sprintf(buffer,"%s%s\r\n",buffer,content); on binary data. It isn't a string, so %s is wrong.
You either need to base64 encode it with an appropriate Content-Transfer-Encoding, or use memcpy with a Content-Length header.


text:
Q: Fedora 14 Repository List I've got a machine running FC14 and trying to set up yum on it without much luck. I'm aware that the FC14 repo's have all gone archive though it's not possible to upgrade this box as it's an appliance (network switch) and I need to get package management running on it.
I'd tried creating a fedora.repo file in /etc/yum.repos.d/ with multiple options but haven't had any luck. Can I use a later repo with FC14?
My current repo file
    name=Fedora $releasever - $basearch
    baseurl=http://mirror.aarnet.edu.au/pub/fedora/linux/releases/18/Everything/x86_64/os/
Can someone point me in the right direction - pulling my hair out here. Running yum update on this just sits there.

A: You have a very strange situation. It's really quite bizarre that any vendor would base a "network switch" on Fedora; with its very short 13-month lifecycle it would be very difficult to support. Unless, of course, they made it impossible to install or update anything, which they seem to have done. And that opens you up to security holes...
So if you want to get to a point where you can install software on it, this is what I would recommend.
First, the official Fedora archive site is https://archive.fedoraproject.org/. There you will find the old repositories you are looking for.
What I would do is to download the fedora-release RPM from Fedora 14, and apply that. Then you will have files in /etc/yum.repos.d which you will have to manually update their baseurls to point to the appropriate directories on archive.fedoraproject.org (and remove the mirrorlist or metalink that might have been in there). This should get you to the point where you can install software and apply whatever updates were available for F14.
Also keep in mind that after you do this, the vendor is probably going to tell you to get stuffed...if they're even still in business. Which seems doubtful, if they were making silly business decisions like this.
I wouldn't even think about upgrading it past F14 unless you are prepared to sacrifice whatever functionality the vendor provided with this device. Binary compatibility with their custom software cannot be guaranteed if you upgrade to F15 or higher.


text:
Q: Formatting date properly to insert in database using Carbon I have a column in my database with date schema.
It accepts string in the form of 2018-02-21
I have a date value in this form 1/27/18, 4:15 AM
I need to format the date properly to insert it into the database.
I was trying to use Carbon Package to format the date, but no luck with it.
$date = "1/27/18, 4:15 AM";
$date->format(Y-m-d);

Obviously, this didn't work.
Could someone please help me solve this problem.

A: You need to convert your date to timestamp.
$date = "1/27/18, 4:15 AM";
$formated_date = Carbon::createFromTimestamp(strtotime($date))->format('Y-m-d');

It should works.
If you don't want to use carbon, you can try this with default php date function
date("Y-m-d H:i:s", strtotime($date));

Both case output will be

2018-01-27


text:
Q: java.library.path error Please help me: I'm getting Error While using j4lOCR:
 `A fatal error has been detected by the Java Runtime Environment:

  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1006dc21, pid=3488, tid=2576

 JRE version: 7.0_02-b13
 Java VM: Java HotSpot(TM) Client VM (22.0-b10 mixed mode, sharing windows-x86 )
 Problematic frame:
 C  [tess3Wrapper.dll+0x6dc21]

 Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

 An error report file with more information is saved as:
 C:\Azaz-2012\OCR\hs_err_pid3488.log

 If you would like to submit a bug report, please visit:
   http://bugreport.sun.com/bugreport/crash.jsp
 The crash happened outside the Java Virtual Machine in native code.
 See problematic frame for where to report the bug.
'
actual_tessdata_num_entries_ <= TESSDATA_NUM_ENTRIES:Error:Assert failed:in file .\tessdatamanager.cpp, line 55
Java Result: 1

A: The error happens because the C++ code throws an exception. Java can't "wrap" those.
The exception is thrown because the following assertion is violated:
actual_tessdata_num_entries_ <= TESSDATA_NUM_ENTRIES

The constant is defined in tessdatamanager.h. It's related to the data files which you need. Make sure the data files you use match your version of tesseract.


text:
Q: Highlight words inside the string I got certain string, and I want to highlight the substring typed in the text input.
Here is a fiddle: http://jsfiddle.net/rFGWZ/17/
It is working fine only , when I type the initial string, but when I type fe. 15 in the input, it doesn't highlight the 15 but 21 instead... it is always highlighting the numbers at the beggining, so could someone help me modify it, so it will highlight the string I type in the text input?

A: You can use this :
firstCell.html(id.replace(value, ''+value+''));

instead of
firstCell.html($("").addClass("highlight").text(id.slice(0, value.length)));
firstCell.append(id.slice(value.length, id.length));

Demo : http://jsfiddle.net/qgBt8/
EDIT : case insensitive version

A: I would use a regular expression to solve this. This also takes into account case of characters.
jsFiddle
$("#search").on("keyup", function() {
    var value = $(this).val();

    $("table tr").each(function(index) {
        if (index !== 0) {

            $row = $(this);
            var firstCell = $row.children("td:first");

            var id = $row.children("td:first").text();
            if (id.indexOf(value) === -1) {
                $row.children("td:first").text(id);
                $row.hide();
            }
            else {
                var re = new RegExp(value, "g"); //global replace
                firstCell.html(id.replace(re, "" + value + ""));//replace all instances of the characters
                $row.show();
            }
        }
    });
});


text:
Q: Batch exclude windows, with ver command I want a code who jump to :jumpto if the windows is older than windows 8 (win 7 and older)
IF "windows is older than Windows 8" 6.2.9200.16384 goto jumpto'

I cannot formulate the correct code. Anyone who can help me out please?
I guess if i can use ver and calculate if numbers are lower than 6.2?

A: This should work:
@ECHO OFF
FOR /F "tokens=*" %%a IN ('ver') DO (
    SET ver=%%a
)
SET v1=%ver:~27,1%
SET v2=%ver:~29,1%
IF %v1% LSS 6 GOTO JUMPTO
IF %v2% LSS 2 GOTO JUMPTO
ECHO doing something
PAUSE
GOTO:EOF
:JUMPTO
ECHO Windows version too old!
PAUSE

A: @echo off
cls
Setlocal EnableDelayedExpansion

for /F "tokens=4,5,6 delims=[]. " %%A In ('VER') Do (
    (Set /A "_MAJ=%%A")
    (Set /A "_MIN=%%B")
    (Set /A "_BLD=%%C")
    )

echo !_MAJ!
echo !_MIN!
echo !_BLD!

endlocal

Note the order of the "delims=" statement.  The space must be last.


text:
Q: Position the square on the left after it reaches the top #include <stdio.h> // this library is for standard input and output
#include "glut.h"// this library is for glut the OpenGL Utility Toolkit
#include <math.h>

float squareX = 0.0f;
float squareY = -0.3f;
float squareZ = 0.0f;

static int flag = 1;

void drawShape(void) {
    glTranslatef(squareX, squareY, squareZ);
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 0.0);
    glVertex2f(162, 50);
    glVertex2f(162, 10);
    glVertex2f(220, 10);
    glVertex2f(220, 50);
    glVertex2f(162, 50);
    glEnd();
}

void initRendering() {
    glEnable(GL_DEPTH_TEST);
}

// called when the window is resized
void handleResize(int w, int h) {
    glViewport(0, 0, w, h);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0f, (float)w, 0.0f, (float)h, -1.0f, 1.0f);
}

void drawScene() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    drawShape();
    glutSwapBuffers();
}

// make the square go up
void update(int value) {
    if (flag) {
        squareY += 1.0f;
        if (squareY > 400.0) {
            flag = 0;
        }
    }
    glutPostRedisplay();
    glutTimerFunc(25, update, 0);
}

// make the square go right
/* void update(int value) {
    if (flag) {
        squareX += 1.0f;
        if (squareX > 400.0) {
            flag = 0;
        }
    }
    glutPostRedisplay();
    glutTimerFunc(25, update, 0);
} */

int main(int argc, char** argv) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(400, 400);
    glutCreateWindow("Moving Square");
    initRendering();
    glutDisplayFunc(drawScene);
    glutReshapeFunc(handleResize);
    glutTimerFunc(25, update, 0);
    glutMainLoop();
    return(0);
}

I have uploaded this code before but this time I made the square go all the way up. The code just moves the square up, but I don't know how to position it on the left once it reaches the top, so then I can make it move to the right. I have uploaded a demonstration on how I want it to look below.
Preview:

What I want it to do next:

A: I recommend to initialize the variables squareX, squareY and squareZ with the start position of the rectangle:
float squareX = 162.0f;
float squareY = 0.0f;
float squareZ = 0.0f;

Do not draw a rectangle specific position, but draw a rectangle on the position (0,0) with a length (width, height). Let the model matrix (set by glTranslatef), do the job of the positioning:
void drawShape(void)
{
    float width = 58.0f;
    float height = 40.0f;

    glTranslatef(squareX, squareY, squareZ);
    glBegin(GL_POLYGON);
    glColor3f(1.0, 0.0, 0.0);
    glVertex2f(0, 0);
    glVertex2f(width, 0);
    glVertex2f(width, height);
    glVertex2f(0, height);
    glVertex2f(0, 0);
    glEnd();
}

Use a variable state, which has stated the direction of the current movement:
int state = 1; // 0: stop; 1: move up; 2: move right

If the rectangle a certain position has reached, then the state has to be changed and a the new start position can be set. At the final position, the rectangle can stop or the process can even be restarted:
void update(int value)
{
    if (state == 1) // 1 : move up
    {
        squareY += 1.0f;
        if (squareY > 400.0)
        {
            state = 2;
            squareX = 0.0f;
            squareY = 180.0f;
        }
    }
    else if (state == 2) // 2 : move right
    {
      squareX += 1.0f;
      if (squareX > 400.0)
      {
          state = 0;

          // restart
          //state = 1;
          //squareX = 162.0f;
          //squareY = 0.0f;
      }
    }

    glutPostRedisplay();
    glutTimerFunc(25, update, 0);
}


text:
Q: PHPStorm: How do I setup LESS to output to CSS directory with file watcher? How do, using File Watchers in PHPStorm do I set up LESS file watchers output path to do this:
I want:
/project/path/less/dir/file.less
to output to:
/project/path/css/dir/file.css
or
/project/path/less/file2.less
to output to:
/project/path/css/file2.css
I'm not seeing a clear way to make this happen with the Output Path macros in PHPstorm. With the FileDirRelativeToProjectRoot macro, I'm able to get the path to the current directory, but there is no clear way to replace /less with /css in the path.

A: I want to compile one less file from
sites/all/themes/bic/res/less/style.less to
sites/all/themes/bic/res/css/style.css
Here's what I did

So the Arguments I used is: --no-color $FileName$ ../css/$FileNameWithoutExtension$.css
This will produce: /usr/local/bin/lessc --no-color blogs.less ../css/blogs.css at phpstorm console, and works fine.
I might miss something. Anyway, I tried both "--no-color $FileName$ $ProjectFileDir$/sites/all/themes/bic/res/css/$FileDirPathFromParent(less)$" and "--no-color $FileName$ $ProjectFileDir$/sites/all/themes/bic/res/css/$FileDirPathFromParent(less)$$FileNameWithoutExtension$.css". Neither of them work for me. So just post my solution here, which might help some people who has the same trouble with me..

A: Just change Output Path to Refresh to:
../css/$FileNameWithoutExtension$.css
Update:
In the new version of LESS you should reverse your slashes in Path you specify. So it should be:
..\css\$FileNameWithoutExtension$.css

A: See my related answer for JADE file watcher, I believe it would be the same for LESS.
The trick is to use $FileDirPathFromParent(dir)$ macro:
$ProjectFileDir$/css/$FileDirPathFromParent(less)$ will produce /project/path/css/dir/ for a file located in /project/path/less/dir/ directory.

A: To change output directory for less compiler.
Open edit watcher in tat you will see output paths to refresh in that input box change as like this ../yourfolderpath/$FileNameWithoutExtension$.css. Now you can see less compiles .css to this path.

A: I had a similar problem with getting scss file watcher to output to the css directory
This is what I did.

*

*In Arguments, --no-cache --update $ProjectFileDir$/css/style.css

*In Output paths to refresh, $ProjectFileDir$/css/$FileDirPathFromParent(scss)$$FileNameWithoutExtension$.css
You can modify this to work with LESS

A: You may want to try SimpLESS as a watcher for checking/compiling LESS to CSS on the fly - free to use on all platforms.


text:
Q: Is the natural isomorphism in an adjunction uniquely determined by the pair of adjoint functors An adjunction is a triple $(F, U, \zeta)$, where

*

*$F\colon C\to D$ and $U\colon D\to C$ are functors and

*$\zeta$ is an isomorphism between the functors $\operatorname{Hom}(-, U(-))$ and $\operatorname{Hom}(F(-), -)$.

Can it happen that for functors $F\dashv U$ there are two different natural isomorphisms $\zeta$ and $\zeta'$ such that $(F, U, \zeta)$ and $(F, U, \zeta')$ are adjunctions?
How different can $\zeta$ and $\zeta'$ be? For instance, each adjunction $(F, U, \zeta)$ induces an equivalence between the subcategories

*

*$C_{\zeta}:=\{A\in C\mid \eta_A\colon A\to U(F(A))\text{ is an isomorphism}\}\leq C$

*$D_{\zeta}:=\{B\in D\mid \epsilon_B\colon F(U(B))\to A\text{ is an isomorphism}\}\leq D$,

where $\eta$ and $\epsilon$ are the unit and counit induced by $\zeta$, respectively.
Can it happen that $C_{\zeta}\neq C_{\zeta'}$ and $D_{\zeta}\neq D_{\zeta'}$?

A: Given a functor $U:\mathcal D\to\mathcal C$, a left adjoint $F$ (plus the adjunction unit) can be defined much more locally: if for every $x\in\mathcal C$, we have an initial object $\eta_x:x\to U(F_x)$ in the comma category $(x\downarrow U)$, then we can fix a choice of such an initial object for every $x$ and compile them into a left adjoint $F:\mathcal C\to\mathcal D$ induced by sending $x\mapsto F_x$, where the adjunction unit will be $\eta_x$. This is discussed in proposition 1.9 here.
In particular, if for some $x\in\mathcal C$ one choice of $\eta_x:x\to U(F_x)$ is an isomorphism, then all possible choices of the unit $\eta'_x:x\to U(F_x')$ must be isomorphisms, because initial objects are unique up to unique isomorphism. In particular, for any two natural isomorphisms $\zeta,\zeta':\operatorname{Hom}(-,U(-))\to\operatorname{Hom}(F(-),-)$, we will have $\mathcal C_\zeta=\mathcal C_{\zeta'}$. Dually, we also have $\mathcal D_\zeta=\mathcal D_{\zeta'}$.
However, this also reveals that the choice of unit and counit are componentwise only unique up to unique isomorphism (in the appropriate comma category) and thus not strictly unique. Since the unit and counit are uniquely determined by the natural isomorphism $\zeta:\operatorname{Hom}(-,U(-))\to\operatorname{Hom}(F(-),-)$ (in particular, $\eta_x:x\to U(F(x))$ is the preimgae under $\zeta$ of $\operatorname{id}:F(x)\to F(x)$ and $\epsilon_y:F(U(y))\to y$ is the image under $\zeta$ of $\operatorname{id}:U(y)\to U(y)$), this shows that the natural isomorphism $\zeta$ will not be unique either.


text:
Q: Is there a way to slow down the Day/Night cycle? While there is a command that you can use to set the time, the problem with it is that one would have to remember to use it when it's getting late to set it back.
I'm looking for a way to slow down the day/night cycle to add a little more danger to the game when I get caught out at night without a shelter and a bed, and also so that when I'm building I have more daylight to not have to worry about Creepers blowing crap up and more nighttime to see if I have enough lights around.

A: There is no way to do this directly in Vanilla Minecraft, no. You may be able to find a mod to do this, or you can probably rig something up with Command Blocks. Specifically, if you hook up a circuit to send a redstone pulse alternately into one of two Command Blocks, with the commands
gamerule doDaylightCycle true
gamerule doDaylightCycle false

Then they will alternately turn on and off the code that advances the day/night cycle. Use some repeaters to control how long the pause is between them activating, and you should be able to control the rate pretty carefully, but this will only work as long as the chunk containing the whole setup remains loaded; wander too far away, and time will go back to normal.

A: This can also be achieved using purely command blocks (because redstone is an evil lag-machine), ideally using 1.9's new command blocks.
First, set the gamerules commandBlockOutput and doDaylightCycle to false to turn off command block spam and the natural daylight cycle. We'll also need an objective to store a timer.
/scoreboard objectives add TIMER dummy

1.9
Next, place one repeat command block and three chain command blocks in a line. Set the last two to "conditional" and put the following commands
/scoreboard players add #TIMER TIMER 1
/scoreboard players test #TIMER TIMER <X>
/time add <Y>
/scoreboard players set #TIMER TIMER 0

#TIMER is a nonexistent player (the # makes the name illegal for real players) who counts ticks for us.
Replace <X> and <Y> with appropriate numbers. Time will advance at a rate of <Y>/<X> the normal speed. Try and use low numbers, or time will "stutter" because it's only advanced every <X> ticks.

1.8
Emulating 1.9's conditional command blocks in 1.8 without using redstone is non-trivial (but doable). Hence using /scoreboard players test won't work.
We can use /execute instead, but that won't work on a non-existing player because those are not entities. We can use an invisible armorstand instead:
/summon ArmorStand ~ ~ ~ {CustomName:"#TIMER",Marker:1b,Invisible:1b}

Create a fill clock and place the following three commands:
/scoreboard players add @e[type=ArmorStand,name=#TIMER] TIMER 1
/execute @e[type=ArmorStand,name=#TIMER,score_TIMER=0] ~ ~ ~ /time add <Y>
/scoreboard players set @e[type=ArmorStand,name=#TIMER,score_TIMER_min=<X>] TIMER 0

As above, set <X> and <Y> accordingly.

A: Using command blocks and some redstone, this can be achieved.
First of all, you need to set /gamerule doDaylightCycle to false, to stop the natural daylight cycle. From here, we are going to use command blocks (/give <username> command_block), some redstone, and the command /time add <number> to control the daylight cycle.
Here is a very simple, and pretty easy to tune setup:

The command on the command block is /time add <number>, tuned however you would like (1 item in the clock with an increment of 5 results in a 28 minute day). There is no hidden redstone, and both pistons are sticky. The hoppers feed into each other, and you choose the number of items put in (more items means slower day/night cycle).
The formula for calculating the length of daytime is 140 * (items / number) minutes of daytime (double that for the length of a whole day).
You're also going to want to use the command /gamerule commandBlockOutput false if you don't want periodic chat updates saying Added 1 to time.
You're also going to want to put this in your spawn chunk if you intend for it to work no matter where you are in the world (determine your spawn chunk by breaking your bed and killing yourself).


text:
Q: What is the meaning difference what is the  meaning difference between
I'd better go and I'd better be going  Does the first one means I must go now and the other I should begin to think to leave

A: I think you're right, 'I'd better go' sounds a little more abrupt and sudden than 'I'd better be going', which sounds a bit softer.
I'd better be going will pretty much only be used for a (probably pre planned) exit from a social gathering or whatever and generally is a way of saying 'I am about to go', whereas I'd better go can also be used for things like if your house is on fire and you realise the flames have reached your room, you might say 'I'd better go!'. So I'd better go can be you literally saying you need to go/making the decision it would be best for you to go and it generally means there will be a REASON why you now need to go, not just a way of announcing your imminent exit.
But I think by and large they are interchangeable.


text:
Q: Can't rm directory in /mnt read a bunch of posts about similar issues but can't get it working.
I mount a folder on my RPi that sits on my Hackintosh. I use it for backup. Lately I keep getting this error:

I have set the permissions to 777 but still no go:

Any suggestions on where to begin? Thanks for your help!
Edit: I'm sorry, I didnt realize I shouldnt insert images. Took me a few min to edit it. Here is the code in the script I run via cron:
#!/bin/sh
sudo mount.cifs //10.0.2.20/"RPi Backup" /mnt/netbackup -o
user=xxxxxxxx,password=xxxxxxx umask=000sudo
/usr/local/bin/raspiBackup.sh

A: Your /mnt/netbackup is a CIFS/SMB network share. That means the remote server that is sharing it to you has the ultimate access control authority: even though your mount command says umask=000, it cannot override server-side settings.
It appears that the specified user xxxxxxxx currently has no permissions to write to //10.0.2.20/"RPi Backup". This is something you'll need to fix at the system that has the IP address 10.0.2.20. There is nothing you can do on the RPi side.
When connecting to a CIFS/SMB share like this, all access to the network share will happen as the user specified in the mount command. So even though you may be root on the RPi, on the network share you will only be able to access the things user xxxxxxxx on server 10.0.2.20 has access to.


text:
Q: Setup Active Directory in home network - do i need to set up DNS first I'd like to experiment setting up a windows domain at home. I have limited resources: 1 x64 machine and 1 x32 machine.
My plan is to create a couple of virtual machines using VMware workstation, install an AD domain controller, a DNS + DHCP server on the x64 machine. Then create a Windows 7 VM in the x32 machine just to for testing.
Is this possible? (This can be difficult to achieve hardware wise because they eat lots of memory)
Do I need to set up DNS + DHCP server before I create the AD domain controller?

A: No. Active directory relies on a windows AD server being the DNS server.
If you set up other servers to hand out DHCP or resolve DNS names then AD will not work properly. So go ahead and install the domain controller VM. Install the DNS services and the DHCP service. Configure the DHCP scope.
After you have done that create the other hosts and connect them to the domain.


text:
Q: how to repeat Selenium test script forever I need to re-run my Selenium test script for unlimited number of times (infinite loop) - how I do that and what language should I use ?
thanks

A: Selenium supports lots of programming languages. See here for the full list:
http://seleniumhq.org/about/platforms.html#programming-languages
Just pick one of them and write an infinite loop that does what you need.
You could also use the Selenium Firefox plugin to do an initial recording of your script and then convert it to your language of choice.

A: Have a look at http://51elliot.blogspot.com/2008/02/selenium-ide-goto.html
A script you can add to selenium and offers looping and if/then

A: You can just write your task which you want to perform in loop. Put while loop to repeat your task number of times.
Here is the code to make a counter and create a while loop in Selenium script

getEval
index = 0;

while
index < 40;

    click
    id=page

    click
    id=correct

    clickAndWait
    id=action

getEval
index++;

endWhile

A: TestMaker allows you to run Selenium scripts multiple times and as load tests and performance monitors.  If you don't need more than 50 simulated users for load testing, then the community version is free.
http://www.pushtotest.com

A: I think it is useful to install FlowControl extension in Firefox. Of course you need to have Selenium IDE installed first. Restart firefox after the installation and then you can use in Selenium IDE:
label your_start_point
some selenium commands here (click, etc)
...
gotolabel your_start_point

You can find here the extension for Firefox.


text:
Q: DDL_admin vs db_owner permissions I'm taking over a project that involves removing and limiting permissions of all database users across our server farm. (fun times)
One of the permissions currently being limited is db_owner permissions.
This permission is being reviewed on a case-by-case basis, but a common change is to replace the db_owner permissions with the following:

*

*db_datareader

*db_datawriter

*db_ddladmin

*db_executor
I would like to define the exact difference between the two (to inform clients).
However, as far as I can tell, the difference between the two should be:

*

*db_accessadmin permissions

*db_backupoperator permissions

*db_securityadmin permissions

So in effect they would lose:
[ALTER ANY USER]
[CREATE SCHEMA]
[BACKUP DATABASE], [BACKUP LOG], [CHECKPOINT]
[ALTER ANY APPLICATION ROLE], [ALTER ANY ROLE]
[DROP DATABASE]
Is there anything else that a user would loose once db_owner is replaced by the four roles above?
Does this actually serve much of a purpose security wise?

A: Using a SQL Script to list all the permissions, I went and created users for each case.
EXECUTE AS USER = 'test_user'
SELECT
    permission_name
FROM fn_my_permissions(null, 'DATABASE')
ORDER BY subentity_name, permission_name
REVERT;

I then compared the results, and came to the following list, with documentation from primarily msdn (any quotes not specifically referenced are from the msdn link).
Below is some of the documentation I used to inform the people who would be losing dbo permissions what exactly they were losing.
ALTER

Confers the ability to change the properties, except ownership, of a
  particular securable. When granted on a scope, ALTER also bestows the
  ability to alter, create, or drop any securable that is contained
  within that scope. For example, ALTER permission on a schema includes
  the ability to create, alter, and drop objects from the schema.

ALTER ANY APPLICATION ROLE
ALTER ANY DATABASE AUDIT
ALTER ANY ROLE
ALTER ANY USER

Confers the ability to CREATE, ALTER, or DROP individual instances of
  the Database Securable. For example, ALTER ANY SCHEMA confers the
  ability to create, alter, or drop any schema in the database.
Application roles are database principals that enable an
  application to run with its own, user-like permissions.
Auditing an instance of SQL Server or a SQL Server database
  involves tracking and logging events that occur on the system. The
  Database-Level Audit Specification object belongs to an audit. You can
  create one database audit specification per SQL Server database per
  audit.
Database Roles are used to easily manage the permissions in your
  databases, SQL Server provides several roles which are security
  principals that group other principals. They are like groups in the
  Microsoft Windows operating system. Database-level roles are
  database-wide in their permissions scope.

AUTHENTICATE
Found in msdn.

AUTHENTICATE & AUTHENTICATE SERVER permissions are only used when
  using EXECUTE AS in cross database and server-access (respectively)
  scenarios.

BACKUP DATABASE
BACKUP LOG
CONNECT REPLICATION

Used for database replication permissions.

CONTROL

Confers ownership-like capabilities on the grantee. The grantee
  effectively has all defined permissions on the securable. A principal
  that has been granted CONTROL can also grant permissions on the
  securable.

CREATE ROLE

Confers to the grantee the ability to create the Database Securable.

SHOWPLAN

Showplan permissions are used for various Showplan SET statement
  options when they are used with Transact-SQL batches.

SUBSCRIBE QUERY NOTIFICATIONS
Documentation about query notifications.

Built upon the Service Broker infrastructure, query notifications
  allow applications to be notified when data has changed. This feature
  is particularly useful for applications that provide a cache of
  information from a database, such as a Web application, and need to be
  notified when the source data is changed.

TAKE OWNERSHIP

Enables the grantee to take ownership of the securable on which it is
  granted.

VIEW DATABASE STATE

Used to view Dynamic Management Views and Functions
  (Transact-SQL).

VIEW DEFINITION
Documentation on view definition permissions.

The VIEW DEFINITION permission lets a user see the metadata of the
  securable on which the permission is granted. However, VIEW DEFINITION
  permission does not confer access to the securable itself. For
  example, a user that is granted only VIEW DEFINITION permission on a
  table can see metadata related to the table in the sys.objects catalog
  view. However, without additional permissions such as SELECT or
  CONTROL, the user cannot read data from the table.

A: db_ddladmin vs db_owner
From what I can tell from what I tested and read up on, for the most part your list looks accurate except db_ddladmin DOES allow you to CREATE SCHEMA. I did confirm that the other security permissions you listed were indeed denied.
Denied with DDLADMIN only:
[ALTER ANY USER]
[BACKUP DATABASE], [BACKUP LOG], [CHECKPOINT]
[ALTER ANY APPLICATION ROLE], [ALTER ANY ROLE]
[DROP DATABASE]
Noting that the. . .

*

*db_datareader will allow SELECT access to all tables

*db_datarwriter will allow INSERT, UPDATE, and DELETE access to all tables

*db_executor will allow EXECUTE access to all executable objects

Additonally, having db_ddladmin role permissions may mean. . .

Note: Since you have so many different versions of SQL Server from 2005 - 2014, it may be best to have a small set of users test
  this initially to see who screams to iron out any kinks, etc.

*

*Objects they own with this role will not be owned by DBO so you may have to deal with ownership chaning issues if there's ever a problem with something at this level. I'm not 100% certain that this would be a problem but it's worth mentioning just in case.
Source: Ownership Chains

*With this role (may vary depending on the version of SQL Server) they may be able to add SQL security principles defined in the current DB to objects they own still, just not all objects (ones they do not own) nor add a new server-level defined principal to the DB level.

Additionally, not having DBO role permissions may mean. . .

Note: Since you have so many different versions of SQL Server from 2005 - 2014, it may be best to have a small set of users test
  this initially to see who screams to iron out any kinks, etc.

*

*Not having the DBO role may prevent certain SSMS designer GUI interfaces (SQL Server version varying) from populating or opening without error (e.g. when modifying tables or columns through the GUI) even though doing it via T-SQL works and the permissions are in place. In some versions of SQL Server this may be resolved by allowing GRANT VIEW DEFINITION where this is an issue and it can also just be a warning only on certain versions of SQL Server.
Resources

*

*You are not logged in as the database owner or as a user that is a member of the db_owner role. You will not be able to save changes to tables that you do not own.

*db_ddladmin Role doesn't allow use of "design" functions in SSMS

"We try to prevent giving users/developers dbo in their QA databases
  as much as we can. One of the problems with this is that they still
  need to be able to create and modify database objects such as user
  tables. Many devs are new to MS SQL and thus tend to stick with the
  GUI (SSMS) for this sort of work. The problem arises when we grant
  them db_ddladmin (not dbo) and they are no longer able to modify
  tables or columns via the table designer GUI. Instead, they have to
  take additional time to learn the TSQL commands and their syntax (that
  they may never need again) or engage the DBA team which takes time
  away from our other activities.
I don't know if this is a bug or a feature request but I consider it a
  bug since the user has sufficient permissions to alter the table via
  TSQL but the GUI gives them messages stating:
"You are not logged on as the database owner or system
  administrator. You might not be able to save changes to tables that
  you do not own." AND "Table [schema].[table] is set to read only,
  user doesn't have enough rights on this table."
A trace seems to point to the check being a is_member('db_owner')
  which will preclude members of db_ddladmin even though they do in fact
  have permissions to modify the object. Microsoft SQL Server Management
  Studio"

Posted by Agent DBA on 1/25/2010 at 7:06 AM
I had a similar issue and managed to solve it by performing the
  following grant
GRANT view definition on schema:: <schemaname> to <username>

Other Considerations
Since you state that this is being reviewed on a case-by-case basis

One of the permissions currently being limited is db_owner permissions.
This permission is being reviewed on a case-by-case basis, but a common change is to replace the db_owner permissions with the following:

*

*db_datareader

*db_datawriter

*db_ddladmin

*db_executor

Have you considered creating additional custom roles for more "all object" DB-level access that each person needs rather than granting them the db_ddladmin role as that will probably give them more than they actually need to DB level objects as well.
I usually give what's needed exactly and nothing more for them to do their job and if there's a "usual" or "standard" need for DB level object access to all objects in a DB, I create a custom DB role sort of like the the db_executor but see my below example. This way you can grant the people what they really need to ALL DB object in a particular DB if you're not getting object level explicit in your DBs for their security.
----Custom Database Roles

/* CREATE A NEW ROLE  -- Execute to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_Execute
GRANT EXECUTE TO db_All_StoredProc_Execute

/* CREATE A NEW ROLE  -- Alter to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_Alter
GRANT ALTER ANY SCHEMA TO db_All_StoredProc_Alter

/* CREATE A NEW ROLE  -- View Definition to all stored procs including newly created ones*/
-- Database specific
CREATE ROLE db_All_StoredProc_View
GRANT VIEW DEFINITION TO db_All_StoredProc_View

/* CREATE A NEW ROLE - Any schema alter and create procedure permissions */
-- Database specific
CREATE ROLE db_All_CreateProc_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateProc_AlterSchema
GRANT CREATE PROCEDURE TO db_All_CreateProc_AlterSchema
GO

/* CREATE A NEW ROLE - Any schema alter and create table permissions */
-- Database specific
CREATE ROLE db_All_CreateTable_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateTable_AlterSchema
GRANT CREATE TABLE TO db_All_CreateTable_AlterSchema

/* CREATE A NEW ROLE - Any schema alter and create function permissions */
-- Database specific
CREATE ROLE db_All_CreateFunction_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateFunction_AlterSchema
GRANT CREATE FUNCTION TO db_All_CreateFunction_AlterSchema

/* CREATE A NEW ROLE - Any schema alter and create aggregate permissions */
-- Database specific
CREATE ROLE db_All_CreateAggregate_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateAggregate_AlterSchema
GRANT CREATE AGGREGATE TO db_All_CreateAggregate_AlterSchema

/* CREATE A NEW ROLE - Any schema alter and create view permissions */
-- Database specific
CREATE ROLE db_All_CreateView_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateView_AlterSchema
GRANT CREATE VIEW TO db_All_CreateView_AlterSchema

/* CREATE A NEW ROLE - Any schema alter and create schema permissions */
-- Database specific
CREATE ROLE db_All_CreateSchema_AlterSchema
GRANT ALTER ANY SCHEMA TO db_All_CreateSchema_AlterSchema
GRANT CREATE SCHEMA TO db_All_CreateSchema_AlterSchema

I also wanted to share a db_DDLAdmin_Restriction role you may want to consider to consider creating otherwise with explicit DENY to restrict what db_ddladmin give access to so you could at least create this on the DBs where you grant them this role and set the explicit DENY for the actual object types, etc. you don't want them to have access to.
For example, if you know they will definitely be creating stored procedures and functions, you can exclude DENY CREATE FUNCTION, DENY CREATE PROCEDURE, DENY ALTER ANY SCHEMA.
---Create ddladmin restriction custom DB role
DENY ALTER ANY ASSEMBLY                    TO db_DDLAdmin_Restriction
DENY ALTER ANY ASYMMETRIC KEY              TO db_DDLAdmin_Restriction
DENY ALTER ANY CERTIFICATE                 TO db_DDLAdmin_Restriction
DENY ALTER ANY CONTRACT                    TO db_DDLAdmin_Restriction
DENY ALTER ANY DATABASE DDL TRIGGER        TO db_DDLAdmin_Restriction
DENY ALTER ANY DATABASE EVENT NOTIFICATION TO db_DDLAdmin_Restriction
DENY ALTER ANY DATASPACE                   TO db_DDLAdmin_Restriction
DENY ALTER ANY FULLTEXT CATALOG            TO db_DDLAdmin_Restriction
DENY ALTER ANY MESSAGE TYPE                TO db_DDLAdmin_Restriction
DENY ALTER ANY REMOTE SERVICE BINDING      TO db_DDLAdmin_Restriction
DENY ALTER ANY ROUTE                       TO db_DDLAdmin_Restriction
DENY ALTER ANY SCHEMA                      TO db_DDLAdmin_Restriction
DENY ALTER ANY SERVICE                     TO db_DDLAdmin_Restriction
DENY ALTER ANY SYMMETRIC KEY               TO db_DDLAdmin_Restriction
DENY CHECKPOINT                            TO db_DDLAdmin_Restriction
DENY CREATE AGGREGATE                      TO db_DDLAdmin_Restriction
DENY CREATE DEFAULT                        TO db_DDLAdmin_Restriction
DENY CREATE FUNCTION                       TO db_DDLAdmin_Restriction
DENY CREATE PROCEDURE                      TO db_DDLAdmin_Restriction
DENY CREATE QUEUE                          TO db_DDLAdmin_Restriction
DENY CREATE RULE                           TO db_DDLAdmin_Restriction
DENY CREATE SYNONYM                        TO db_DDLAdmin_Restriction
DENY CREATE TABLE                          TO db_DDLAdmin_Restriction
DENY CREATE TYPE                           TO db_DDLAdmin_Restriction
DENY CREATE VIEW                           TO db_DDLAdmin_Restriction
DENY CREATE XML SCHEMA COLLECTION          TO db_DDLAdmin_Restriction
DENY REFERENCES                            TO db_DDLAdmin_Restriction
GO


text:
Q: How does Phantom DSL for Cassandra actually connect? I'd like to use the Phantom DSL for Cassandra from Scala. I've noted that it uses the Datastax Java driver underneath, but I don't see anything in the documentation about how to actually connect or configure a connection. The included tests use an embedded Cassandra, so that doesn't help. Are there any detailed examples or tutorials for this library?

A: To run operations with Phantom "tables" you need to have implicit Session object in scope. One way to achieve that is CassandraConnector, and you can build connectors using ContactPoint. For instance you can use this example.
Or you can build your own way of initializing implicit Session.
Update
Additionally you can read about connectors in more depth on this blog post.


text:
Q: How to make my calculator default display show '0' before inputting a number? Also how to add keyboard input functionality? Vanilla JS I would like to make the default display value '0' before inputting numbers into the calculator.
Also I would like to add the functionality to use the keyboard to input numbers and operations.
Here's a link to the Codepen
I've tried updating the this.currentOperand value to '0' but that hasn't worked.
I can only use vanilla JS
Thank you for taking a look.
HTML
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Calculator</title>
    <link rel="stylesheet" href="styles.css">

        <button data-all-clear id='clear' class="span-two">AC</button>
        <button data-delete id='delete'>DEL</button>
        <button data-operation id='divide'>÷</button>
        <button data-number id='one'>1</button>
        <button data-number id='two'>2</button>
        <button data-number id='three'>3</button>
        <button data-operation id='multiply'>x</button>
        <button data-number id='four'>4</button>
        <button data-number id='five'>5</button>
        <button data-number id='six'>6</button>
        <button data-operation id='add'>+</button>
        <button data-number id='seven'>7</button>
        <button data-number id='eight'>8</button>
        <button data-number id='nine'>9</button>
        <button data-operation id='subtract'>-</button>
        <button data-number id='decimal'>.</button>
        <button data-number id='zero'>0</button>
        <button data-equals id='equals' class="span-two">=</button>

Javascript
class Calculator {
    constructor( previousOperandTextElement, currentOperandTextElement){
        this.previousOperandTextElement = previousOperandTextElement;
        this.currentOperandTextElement = currentOperandTextElement;
        // Call the clear function to start with a clear display
        this.clear();
    }

    clear(){
        this.previousOperand = '';
        this.currentOperand = '';
        this.operation = '';

    }

    delete(){
        this.currentOperand = this.currentOperand.slice(0, -1)

        }

    appendNumber(number) {
        // If there is a '.' in the number and the currentOperand already contains a '.', end the function by returning. I.E do not append a '.'
        if (number === '.' && this.currentOperand.includes('.')) return;
        // Coverting the numbers to a string as JS will try to add the numbers together instead of appending ie putting onto the end
        this.currentOperand = this.currentOperand.toString() + number.toString();

    }

    chooseOperation(operation) {
        if (this.currentOperand === '') return;
        // This will compute the equation berofe appling another operation such as +, etc
        if (this.currentOperand !== ''){
            this.compute()
        }
        this.operation = operation;
        this.previousOperand = this.currentOperand;
        this.currentOperand = ''

    }

    compute() {
        let computation;
        // parseFloat() converts the string into a number, until it reaches a value that is not a number
        const prev = parseFloat(this.previousOperand);
        const current = parseFloat(this.currentOperand);
        if (isNaN(prev) || isNaN(current)) return;
        // Switch statement for the calculation programming
        switch (this.operation) {
            case '+':
                computation = prev + current;
                break;
                case '-':
                    computation = prev - current;
                    break;
                    case 'x':
                computation = prev * current;
                break;
                case '÷':
                computation = prev / current;
                break;
                default:
                    return;

        }
        this.currentOperand = computation;
        this.operation = undefined;
        this.previousOperand = '';
    }

    updateDisplay() {
        // Displays text in the previous-operand div that is equal to currentOperand
        this.currentOperandTextElement.innerText = this.currentOperand;
        if (this.operation != null){
        // Displays a concatenation of previous operand and the operation symbol
        this.previousOperandTextElement.innerText = `${this.previousOperand} ${this.operation}`;
    }
    }
}

// Data attribute needs to be inside []
const numberButtons = document.querySelectorAll('[data-number]');
const operationButtons = document.querySelectorAll('[data-operation]');
const deleteButton = document.querySelector('[data-delete]');
const equalsButton = document.querySelector('[data-equals]');
const allClearButton = document.querySelector('[data-all-clear]');

const previousOperandTextElement = document.querySelector('[data-previous-operand]');
const currentOperandTextElement = document.querySelector('[data-current-operand]');

// Defining a new Calculator class. Function declaration?
const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement);

numberButtons.forEach(button => {
    button.addEventListener('click', () => {
        calculator.appendNumber(button.innerText)
        calculator.updateDisplay()
    })
})

operationButtons.forEach(button => {
    button.addEventListener('click', () => {
        calculator.chooseOperation(button.innerText)
        calculator.updateDisplay()
    })
})

equalsButton.addEventListener('click', button => {
    calculator.compute();
    calculator.updateDisplay();
})

allClearButton.addEventListener('click', button => {
    calculator.clear();
    calculator.updateDisplay();
})

deleteButton.addEventListener('click', button => {
    calculator.delete();
    calculator.updateDisplay();
})

CSS
*, *::before, *::after {
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: normal;
}

body {
    padding: 0;
    margin: 0;
    background: linear-gradient(to right, #7262B3, #CF98B6);

}

.calculator-grid {
    display: grid;
    justify-content: center;
    align-content: center;
    min-height: 100vh;
    grid-template-columns: repeat(4, 100px);
    grid-template-rows: minmax(120px, auto) repeat(5, 100px);
}

.calculator-grid > button {
    cursor: pointer;
    font-size: 2rem;
    border: solid 1px #CF98B6;
    /* border-radius: 10px; */
    outline: none;
    background-color: rgba(255,255,255, .75);
}

.calculator-grid > button:hover {
    background-color: rgba(255,255,255, .91);
}
/* This causes any button within the span-two class to span over two squares */
.span-two {
    grid-column: span 2;
}

.output {
    /* This spans the output from the 1st column (1) to the last column (-1) */
    grid-column: 1 / -1;
    background-color: rgba(0, 0, 0, .75);
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    flex-direction: column;
    padding: 10px;
    word-wrap: break-word;
    word-break: break-all;
}

.output .previous-operand {
    color: rgba(255,255,255, .75);
    font-size: 1.5rem;
}

.output .current-operand {
    color: white;
    font-size: 2.5rem;
}

A: The way I solved this was by using an if statement to reset to calculator to 0 and then setting the string to empty once the 0 condition had been met.
if (this.currentOperand === '0') {
        this.currentOperand = '';
        }


text:
Q: Quicksort - No matching function for call to c++ Im trying to create a quick sort algorithm using pointers and am having a but of trouble
The line: int* pivot = partition(start, stop); is causing the error "No matching function for call to partition". There may be other issues with the code, but this is the one not allowing me to run.
Any help would be greatly appreciated.
void quickSort(int* start, int* stop) {
    if (stop - start <= 1) return;
    int* pivot = partition(start, stop);
    quickSort(start, pivot);
    quickSort(pivot + 1, stop);
}

int partition(int* start, int* stop) {
    int* pivot = stop - 1;
    int* i = start;
    int* j = stop - 1;
    for (;;) {
        while (i < pivot && i < stop) ++i;
        while (j >= pivot && j > start) --j;
        if (*i >= *j) break;
        swap(i, j);
    }
    swap(*(stop - 1), *i);
    return *i;
}

A: The compiler does all its work in one pass.  So when it sees the usage of "partition" before it's actually declared (or defined), it doesn't know how to interpret that symbol.  So it spews an error.
Simple solution is to just forward declare the partition function.  Add this line above the quickSort function.
 /* forward declare */
 int partition(int* start, int* stop);

What this basically says to the compiler is, "hey, when you see partition token later in the compile, don't freak out, it's a function that takes two int pointer params.  It will be defined later and the linker will take care of resolving it.".

A: Either declare function prototype above
int partition(int *, int *);

or
define partition() above quickSort()

A: The main problem is that pivot must not be an int * but simply a plain int, as you are comparing array values, not array references.  you have to change your code in partition function, to show something like:
int pivot = *(stop - 1);
...
if (i < stop && *i <= pivot) ... /* [ NOTE 1 ] */
if (j >= start && *j >= pivot) ... /* [ NOTE 1 ] */

NOTE 1
you have to check first for the array position, before comparing, as you can lead comparing elements that are outside the range.  Be most careful when using && operator and double check the order in which you check the clauses (in boolean algebra this is not important, as the AND  operator is commutative, but not in C/C++, you have to first check for array boundaries, then the array element, or you'll run into trouble)
NOTE 2
You have to copy apart pivot, as it can be moved as the result of some comparation, and you'll finish using different pivots in each call to partition.  The best should be that you get the pivot (as the selection of pivot is something open in the algorithm) from a possible external function call and pass the value directly to partition (well, but this is  not related to the problem)
Of course, the problem of the missing forward declaration of partition() is another thing already described in other answers. C++ requires that everything used in the program is properly declared before its use.


text:
Q: JavaScript Redirect In Drupal Does Not Redirect Out of iFrame I am trying to breakout of an iFrame after a form is submitted. After the form is submitted it should end up at example.org/thankyou, for example. I have tried various options but I think the best way to do it is to navigate to a controller and then have that controller load JavaScript for the redirect.
I have tried both window.parent.location.href = "https://example.org/" and window.parent.location = "https://example.org/" in the JavaScript and neither of them work.  They do not appear to do anything.  There are no JavaScript errors in the Chrome DeveTools.
My custom JavaScript that I am loading in the controller is in the JS that is delivered when the page is loaded. This is verified by loading the JS file through the ChromeDevTools.
The code is loaded at the end of the HTML document. I am almost wondering if this is being called to late in the page render process.
Any help is greatly appreciated.
Thanks!


text:
Q: How can I access to a subfolder of htdocs directory of XAMPP? When I use header() to redirect the user to another folder of my htdocs directory:

the browser shows this error.

How can I solve this problem?
elseif (preg_match('/^[آ ا ب پ ت ث ج چ ح خ د ذ ر ز ژ س ش ص ض ط ظ ع غ ف ق ک گ ل م ن و ه ی]/', $name) === 0){
    header('Location: http://localhost/error/error1.php'); /* Redirect browser */
    // /^[0-9][0-9][0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]$/
    $check_error = 1;
}


text:
Q: Metaclass Resolver Context
I started exploring the concept of Metaclass with python. Rapidly, I found myself facing a common problem.
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
From my understanding, this happens when you create a class [C] that inherits from two classes (or more) [A, B] that does not share the same metaclass [M_A, M_B]
M_A     M_B
 :       :
 :       :
 A       B
  \     /
   \   /
     C

The problem is well described here and the solution is simple. We need to create a new metaclass [M_C] that inherits from both M_A and M_B
I tried to make this process automatic by creating a method that creates [M_C] dynamically. Something like this
My problem
My class [C] inherits from [B] and I want to use [M_A] has its metaclass,
M_A is a custom metaclass (singleton)
B's metaclass is abc.ABCMeta
My metaclass_resolver() successfully creates a new metaclass [M_C] however it inherits from abc.ABCMeta and type instead of inheriting from abc.ABCMeta and M_A.
from collections import UserDict

def metaclass_resolver(*classes):

    metaclasses     = tuple(set(type(cls) for cls in classes))
    new_metaclass   = metaclasses[0]
    new_meta_name   = new_metaclass.__name__

    #if there's more than one metaclass
    #combine them and create a new metaclass (M_C)
    if len(metaclasses) > 1:
        #get the name of each metaclass
        new_meta_name = "_".join(mcls.__name__ for mcls in metaclasses)
        #create a new dynamic class
        #               type('name','bases {inheritance}, attrs)'
        new_metaclass = type(new_meta_name, metaclasses, {})

    return new_metaclass(new_meta_name, metaclasses, {})

#my custom metaclass (singleton)
class M_A(type):
    def __new__(cls, name, bases, attrs):
        c = super().__new__(cls, name, bases, attrs)
        return c

    def __init__(cls, name, bases, attrs):
        #When this metaclass is initiated, no instance of the class
        #using this metaclass would have been created
        cls.__instance = None
        super().__init__(name, bases, attrs)

    def __call__(cls, *args, **kwargs):
        #get the saved instance
        instance = cls.__instance
        #if the instance does not exists
        if instance is None:
            #create one
            instance = cls.__new__(cls)
            instance.__init__(*args, **kwargs)
            #save it
            cls.__instance = instance

        return instance
    pass

#abc metaclass
class B(UserDict):
    def method_needed_in_C(self):
        pass

#my class
class C(B, metaclass = metaclass_resolver(M_A, B)):
    def __init__(self):
        super().__init__()
        print(type(self.__class__))
        #<class 'abc.ABCMeta_type'>
    pass

if __name__ == "__main__":
    c = C()

In metaclass_resolver() when I use type(cls) it returns <class 'type'> instead of <class 'M_A'> which make sense since every class derived from type. But then, how can I point directly to <class 'M_A'>?
If I use cls directly I get this error :
TypeError: descriptor '__init__' requires a 'type' object but received a 'str'
Thanks!

A: You should only use
new_metaclass = type(new_meta_name, metaclasses, {}) and not ever
new_metaclass(new_meta_name, metaclasses, {}) <- with this arrangement you are changing the metaclass of the metaclass - and you want the metaclass of the metaclass to always be type if you merely want to combine both metaclasses.
It is likely that on the unexpected input for abc.ABCMeta or even on your own M_A class, yo are getting this side-effect of only having one ancestor metaclass. That is probably the source of your unexpected behaviour.
In other words: to create your metaclass itself, call type not one of the metaclasses you are combining - even it this happen to work, the mechanisms in place that make those useful as "metaclasses" for ordinary classes are probably not useful and certainly outright meaningless for being a metaclass of other combined metaclass which include itself as an ancestor.
Another thing is that by using the tuple(set(...)) thing for eliminating duplicate metaclasses, you are basically randomizing their order: metaclasses are a sensitive thing, and not all of them are built in a way they can be combined with others - and a lot less of them will be able to be combined in a random order. You can use a dict comprehension instead, which will both preserve the order and eliminate duplicates, and can extract the metaclasses name for your fancy naming in one step:
def metaclass_resolver(*classes):

    metaclasses     = {mcls.__name__: mcls for cls in classes if (mcls:=type(cls)) is not type}
    new_meta_name = "_".join(metaclasses)
    return type(new_meta_name, tuple(metaclasses.values()), {})


text:
Q: References do not appear using TexStudio and MiKTex I reinstalled the TexStudio and MiKTex recently. When I want to generate my document, my biblography (references) does not appear and I always get the following error. I went through the similar questions, but I could not solve the problem yet.
Also, I already checked the configure Texstudio->command->bibtex, and the address that is there is "C:/Program Files/MikTex/miktex/bin/x64/bibtex.exe" %
The error is:
Error: Could not start the command: "C:/Program Files/MikTex/miktex/bin/x64/bibtex.exe" "main"

Process started: "C:/Program Files/MiKTeX 2.9/miktex/bin/x64/pdflatex.exe" -synctex=1 -interaction=nonstopmode "main".tex

Process exited normally

A: Normally (if you install TeXStudio after MiKTeX), all executables should be in the PATH, and TeX Studio should find them.
In your case you can  load the configuration interface of TeX Studio (menu Options -> Configure TeX Studio, Commands tab. Click  on the small blue icon on the right of the bibtex field to indicate  where it should find it, like in this screenshot:


text:
Q: Typo3 8.7.15 Flexform: displayCond on field pages (record storage page) Is there a way to show my flexform field only when a record storage page is defined? I tried the following, but I got an error:
   <settings.view.type>
       <TCEforms>
           <displayCond>FIELD:pages:REQ:true</displayCond>
....

-> Flex form displayCond on field "settings.view.type" on flex form sheet "sDEF" references a field or field / sheet combination "pages" that might be defined in given data structure but is not found in data values.

A: Try prefixing the fieldname with: parentReq.
This will then access the parent database record instead of the FlexForm data:
<settings.view.type>
    <TCEforms>
        <displayCond>FIELD:parentRec.pages:REQ:true</displayCond>
        ...
    </TCEforms>
</settings.view.type>


text:
Q: Failing ajax function and some advice on how to debug jquery/ajax calls I am working on a project for a crm(just to learn) and i have trouble with an ajax function.

    Name
    <select class="named" name ="named" id="named" onchange="userData('<?php echo $client['client_name']; ?>')">
        <?php
        $clients=mysqli_query($db->db,"SELECT client_name FROM clients");
        foreach($clients as $client): ?>
        <option value="<?= $client['client_name'];?>"><?= $client['client_name']; ?></option>
    <?php endforeach; ?>
    </select>

    Location
    <input type="text" class="form-control" name="locationd" id="locationd"/>

and the ajax function
function userData(name){
    alert('debug');
    $.ajax({
        type: 'POST',
        dataType:'JSON',
        url: 'adminAction.php',
        data: 'action_type=clientdata&name='+name,
        success:function(data){
            alert('debug');
            $('#locationd').val(data.client_location);
        }
    });
}

its a mysql generated dropdown and on change it should fill the location input with this clients location but it doesnt work.Apache returns no errors but i am kinda noob especially when it comes to debugging ajax calls(how the ** can i see what data it sends and receives ? :D).Thanks for your help in advance !!
I post the adminaction.php code too
if($_POST['action_type'] == 'clientdata'){
            $tblName = 'clients';
            $conditions['where'] = array('client_name' =>$_POST['named']);
            $conditions['return_type'] = 'single';
            $client = $db->getRows($tblName,$conditions);
            echo json_encode($client);
            $tblName  = 'clients_contact';

for anyone interested i fixed it like that
function userData(){
            userData = $("#named").serialize()+'&action_type=clientdata';
            $.ajax({
                type: 'POST',
                dataType:'JSON',
                url: 'adminAction.php',
                data: userData,
                success:function(data){
                    $('#locationd').val(data.client_location);
                }
            });
        }

A: Usually the main mistake with ajax calls is, that they don't send the expected requests or don't receive the expected results. Both of those can at least be seen with almost every decent browser by:

*

*pressing F12,

*going to the network tab and then

*check the requests that are made from this point on (sometimes a reload of the page is necessary).

Also: almost every decent browser has a javascript debugger somewhere, where you can set breakpoints and step through your code, while watching all the variables of interest.

A: If your AJAX output is in JSON format you can use $.parseJSON(result) to decode your JSON data to Array.


text:
Q: Very interesting problem with integral,number theory and irrationality It's a problem that I found interesting because it gives an approximation of $\frac{\pi}{2}$ and a sequence of term .I can add to my problem a bit of elementary number theory furthermore.Finally and maybe we can make a link with the irrationality of $\pi$
We have that :
$$\int_{0}^{\frac{\pi}{2}}\frac{(\sin(x)-1)^n}{(\sin(x)+1)^n}dx=\frac{\pi}{2}-\frac{a}{b}$$
Where $n\geq 2$ a natural number and $a,b$ natural number to find.
Remark (number theory)

1)$b$ is always dividing by $5$
2)$a$ is always a composite number .

Remark (irrationality)
When $n$ increasing the integrals tends to $0$ so the fraction tends to $\frac{\pi}{2}$.Unfortunatly $a,b$ are choose arbitrary so it's  inconvenient if we want to prove the irrationality of $\pi$ and caluclate the integral is delicate.
Remark sequence
$n=2$
$n=3$
$n=4$
$n=5$
My questions :
Can someone prove these remarks ?
Is the sequence referenced and is there a recurrence formula?
Can we prove the irrationality of $\pi$ with the integral ?
Thanks in advance !
Last remark :
$$\int_{0}^{\frac{\pi}{2}}\frac{(\sin(x)-1)^{n-1}}{(\sin(x)+1)^n}dx=\pm\frac{1}{2n-1}$$
So integration by parts is your friends in this case .

A: $$\begin{align}
\int_0^{\pi/2}\left(\frac{\sin x-1}{\sin x+1}\right)^n dx
&=\int_0^{\pi/2}\left(\frac{\cos x-1}{\cos x+1}\right)^n dx
=\int_0^{\pi/2}\left(-\tan^2\frac x2\right)^n dx\\
&=2\int_0^{1}\frac{(-t^2)^n}{1+t^2} dt
=2\int_0^{1}\left(\frac1{1+t^2}-\frac{1-(-t^2)^n}{1+t^2}\right) dt\\
&=\frac{\pi}2-2\int_0^1 \sum_{k=0}^{n-1}(-1)^kt^{2k} dt
=\frac{\pi}2-2\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}.
\end{align}
$$
Thus, $$\frac ab=2\sum_{k=0}^{n-1}\frac{(-1)^k}{2k+1}.$$
The fact that the limit of the above sum for $n\to\infty$ is equal to $\frac\pi4$ is very well-known and as far as I know never was used for a proof of the irrationality of $\pi$.


text:
Q: SSL: benefit of using schedule I read this :

More data and longer pre-training schedule benefit SSL in general.

So I write this:
steps = EPOCHS * (num_training_samples // BATCH_SIZE)
lr_decayed_fn = tf.keras.optimizers.schedules.PolynomialDecay(
   initial_learning_rate=0.00001, decay_steps=steps
)

But I would like to understand the meaning of longer pre-training schedule.
Thanks


text:
Q: Object reference not set to an instance of an object when loading the page with the paypal ipn I'm working with the paypal ipn integrated in my asp page , everything worked perfectly when I was using the sandbox url, when I was accessing the page with the ipn , the page was loaded normally without any errors but when I've changed the post url in the ipn process , now when I'm opening the page in the browser I get the following error:
Object reference not set to an instance of an object.
I'm worried and confused... if someone will send a payment , will the ipn page works?
Is this error because when I load it , it tries to post data to paypal but since there's no data..it tells me object reference ....
protected void Page_Load(object sender, EventArgs e)
        {
            string postUrl = "https://www.paypal.com/cgi-bin/webscr";
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(postUrl);

            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
            string strRequest = Encoding.ASCII.GetString(param);
            string ipnPost = strRequest;
            strRequest += "&cmd=_notify-validate";
            req.ContentLength = strRequest.Length;

            StreamWriter streamOut = new StreamWriter(req.GetRequestStream(),
            System.Text.Encoding.ASCII);
            streamOut.Write(strRequest);
            streamOut.Close();

            StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
            string strResponse = streamIn.ReadToEnd();
            streamIn.Close();

            if (strResponse == "VERIFIED")
            {
                  //some checking
            }
             else if (strResponse == "INVALID")
            {
                //some code
            }
            else
              {
               }
}


text:
Q: Почему строковые функции PHP substr и substr_replace портят последний символ в строке? Ограничиваю вводимые данные перед занесением в БД с помощью функции substr:
$string = "Lorem Ipsum - это текст-рыба, часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной рыбой для текстов на латинице с начала XVI века.";
$test = substr($string, 0, 150);

При записи в БД получаю ошибку: General error: 1366 Incorrect string value: '\xD0' for column ...
Смотрю на вывод функции substr и вижу юникод в конце строки: Lorem Ipsum - это текст-рыба, часто используемый в печати и вэб-дизайне. Lorem Ipsum является �
Насколько понимаю, проблема не в кодировке, так как задана UTF-8, кроме того, юникод появляется не всегда, но только на определенных значениях длины текста; если я укажу, например, $test = substr($string, 0, 120);, юникод не появляется. При использовании функции substr_replace результат аналогичный.
Прошу совета, как решить задачу ограничения длины строки и почему в конце строки появляется юникод?

A:
Смотрю на вывод функции substr и вижу юникод в конце строки: Lorem
  Ipsum - это текст-рыба, часто используемый в печати и вэб-дизайне.
  Lorem Ipsum является �

� – Вы называете это «юникодом», но это неправильное понимание вещей. Это не «юникод», а символ, который получился в результате неверной разбивки многобайтового символа на части.
Дело в том, что UTF-8 символы содержат от 1 до 4 байт, а функция substr отрезает строку по байтам (она предназначена для однобайтовых кодировок). Поэтому в некоторых случаях функция substr разрезает юникод-последовательность на две части. Тогда и получаются такие «кракозяблы»: � :)
Для правильной работы с многобайтовыми кодировками используйте функции с префиксом mb_. В данном случае используйте mb_substr() вместо substr.
Перед использованием mb_-функций следует сделать вызов:
mb_internal_encoding('UTF-8');

– это нужно для того, чтобы указать конкретную многобайтовую кодировку, с которой будет идти работа в mb_-функциях.
В некоторых случаях mb_substr и substr будут давать одинаковый результат. Например, если входная строка состоит из однобайтовых символов («Hello World!» – здесь все символы состоят из одного байта). Тем не менее, при работе с многобайтовыми кодировками следует всегда использовать mb_substr, а не полагаться на набор символов в строке.


text:
Q: Separable and irreducible polynomial over $F$ Let $f(x) \in F[X]$ a polynomial with degree 5 and Galois Group $S_5$. Show that $f(x)$ is separable and irreducible over $F$.
For irreducibility, I tried by contradiction
$$
f(x) = g(x) * h(x)
$$
where $g(x), h(x) \in  F[X]$ and $g(x)$ is irreduccible. I don't know how to continue, any help?


text:
Q: extjs combobox two columns I would like to display two columns in my combobox. I read in various forums, but everyone says to use the property tpl. but since I'm using sencha architect this property can not find it. a similar rendertpl but does not work

A: You can add any new attribute that is not already in the list by typing it into the search box at the top of the property toolbox and then click the "Add" button to the right of the search box.  These can be custom attributes that you handle manually yourself or they can be built in attributes that Sencha just forgot to include in the attributes list (or left out for one reason or another).
--Stewart McGuire


text:
Q: Dynamicaly append html code via javascript i built my own infinitescroll similar to the google image search. Everythings works fine. I only wanted to know if there is another way to append html code in javascript, especially when it is more than one row including javascript functions.
In the moment it loos like this:
appenddiv += '
'+
        ''+
              ''+
        ''+
 '
';

Is there another way to do this, cause this is just a very small example. I thought of a function where i can enter "normal" html code without the quotes ' and + and escaping \' etc. and then get the formatted code above.
Normal code:

I am interesting in your ideas which other ways there are to do this.

A: You could use "JavaScript Micro-Templating" where you add the html in a script tag in semi js format like this:

Take a look at John Resigs blog about how you can use it.

A: You can use jquery html function like $("#parent_div_id").html(appenddiv);
$("#parent_div_id").append(appenddiv);

A: In Jquery, you could use:
.append();
.html();


text:
Q: oracle regexp_replace delete last occurrence of special character I have a pl sql string as follows :
String := 'ctx_ddl.add_stopword(''"SHARK_IDX19_SPL"'',''can'');

       create index "SCOTT"."SHARK_IDX2"
       on "SCOTT"."SHARK2"
       ("DOC")
          indextype is ctxsys.context
          parameters(''
            datastore       "SHARK_IDX2_DST"
           filter          "SHARK_IDX2_FIL"
           section group   "SHARK_IDX2_SGP"
           lexer           "SHARK_IDX2_LEX"
           wordlist        "SHARK_IDX2_WDL"
           stoplist        "SHARK_IDX2_SPL"
           storage         "SHARK_IDX2_STO"
           sync (every "SYSDATE+(1/1)" memory 67108864)
           '')
           /
       ';

I have to get search the final occurrence of '/' and add ';' to it. Also I need to escape the quotes preset in parameters ('') to have extra quotes. I need output like
String := 'ctx_ddl.add_stopword(''"SHARK_IDX19_SPL"'',''can'');

       create index "SCOTT"."SHARK_IDX2"
       on "SCOTT"."SHARK2"
       ("DOC")
          indextype is ctxsys.context
          parameters(''''
            datastore       "SHARK_IDX2_DST"
           filter          "SHARK_IDX2_FIL"
           section group   "SHARK_IDX2_SGP"
           lexer           "SHARK_IDX2_LEX"
           wordlist        "SHARK_IDX2_WDL"
           stoplist        "SHARK_IDX2_SPL"
           storage         "SHARK_IDX2_STO"
           sync (every "SYSDATE+(1/1)" memory 67108864)
           '''')
           /;
       ';

Any help.

A: There's an age-old saying: "Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems"
Unless you are confronted by a problem that truly requires regular expressions, I'd recommend working with basic string manipulation functions.
Semi-colon:
Use INSTR to find last occurence of '/', call this P1.
Result = Substr from position 1 through P1||';'||substr from P1+1 through to end-of-string
Parameters substitution:
Use INSTR to find where parameter list starts (i.e. find "parameters(" in your string) and ends (presumably the last closing parenthesis ")" in your string).  Call these P2 and P3.
Result = substr from 1 through P2 || REPLACE(substr from P2+1 through P3-1,'''','''''''') || substr from P3 to end-of-string


text:
Q: Linq - left join on multiple (OR) conditions I need to do a left join on multiple conditions where the conditions are ORs rather than ANDs.  I've found lots of samples of the latter but am struggling to get the right answer for my scenario.
from a in tablea
join b in tableb on new { a.col1, a.col2 } equals new { b.col1, b.col2 }
group a by a into g
select new () { col1 = a.col1, col2 = a.col2, count = g.Count() }

works great for joins where all conditions must match.  I need to get the join to match on a.col1 = b.col1 OR a.col2 = b.col2.
I know it must be easy but I've coming up blank on this!
Edit:
To give a little more info, the purpose of the query is to get a projection containing all of the fields from 'a' plus a count of the matching records in 'b'.  I've amended the sample above to try and illustrate what I'm after.  When I run with the above using the approach Jon Skeet has noted I'm getting a count of all records from a, not the count of the related records in b.
The basic left join works fine:
from a in tablea
from b in tableb
.Where( b => ( a.col1 == b.col1 || a.col2 == b.col2))
.DefaultIfEmpty()
select new { col1 = a.col1, col2 = a.col2 }

If I revise it to add the grouping as below
from a in tablea
from b in tableb
.Where( b => ( a.col1 == b.col1 || a.col2 == b.col2))
.DefaultIfEmpty()
group a by a.col1 into g
select new { col1 = g.Key, count = g.Count() }

I'm getting the count of the records returned from a - not the count of records in matching in b.
Edit:
I'll give the answer to Jon - I've solved my count issue - I hadn't realized I could use a lamda to filter the count (g.Count(x => x != null)).  Plus I need to group b by a rather than a by a as I had above. This gives the correct result but the SQL is not as efficient as I'd write it by hand as it adds a correlated sub query - if anyone can advise a better way of writing it to simulate the following SQL I'd appreciate it!
select a.col1, count(b.col1)
from tablea a
left join tableb b
on a.col1 = b.col1
or a.col2 = b.col2
group by a.col1

A: LINQ only directly supports equijoins. If you want to do any other kind of join, you basically need a cross-join and where:
from a in tablea
from b in tableb
where a.col1 == b.col1 || a.col2 == b.col2
select ...

It's probably worth checking what the generated SQL looks like and what the query plan is like. There may be more efficient ways of doing it, but this is probably the simplest approach.

A: Depending on the query provider, you could just choose to use two from clauses:
from a in tablea
from b in tableb
where a.col1 == b.col1 || a.col2 == b.col2

Which, if you execute on a DB, will be just as efficient.  If you execute in-memory (Linq to Objects), this will enumerate all possible combinations, which may be inefficient.
Arg, Skeeted ;-).
More efficient Linq to Objects alternatives are possible.  The join operator enumerates each source only once, and then does a hash-join, so you could split the or-clause into two seperate joins, and then take their union.  A union in linq is just a concatenation without duplicates, so that would look as follows:
(from a in tablea
join b in tableb on a.Col1 equals b.Col1
select new {a, b})
.Concat(
from a in tablea
join b in tableb on a.Col2 equals b.Col2
select new {a, b}
).Distinct()

This approach works, and it's just one query, but it's somewhat non-obvious in the sense that the performance characteristics of the code depend on understanding in detail how linq works.  Personally, if you want to do a hash-join with potentially multiple matches, a more obvious tool is ToLookup.  An alternative using that might look as follows:
var bBy1 = tableb.ToLookup(b=>b.Col1);
var bBy2 = tableb.ToLookup(b=>b.Col2);
var q3 =
    from a in tablea
    from b in bBy1[a.Col1].Concat(bBy2[a.Col2]).Distinct()
    ...

This solution is actually shorter, and the reason it works is more obvious, so it's the one I'd prefer.  Just remember that if you split the || operator into two separate queries like in the above two scenarios that you need to manually avoid double-counting the results (i.e. use Distinct).