text:
Q: Is Rails now working with Ruby 1.9?
Possible Duplicate:
Is it possible to run Ruby on Rails with Ruby 1.9x?

Browsing the web says that Rails is not compatible with Ruby 1.9 but I would like to know if it's always the case?
And how long should we wait to see a Rails version working with Ruby 1.9? Is it work in progress? In dev stage?

A: Yes, the latest Rails works fully with Ruby 1.9.1.
Issues you have will be around gems/plugins that might not be compatible yet. But more and more of the popular gems/plugins are now working with 1.9. (As pointed out in Rahul's link.) See isitRuby19.com for compatibility info.
The other aspect is that if you're developing on Windows, there isn't a one-click installer for Ruby 1.9 yet, so getting set up locally might be more of a pain than it's worth.

A: Hope this helps:
Rails 2.3 with Ruby 1.9

A: Ok, I found this link:
http://guides.rubyonrails.org/2_3_release_notes.html
Indeed, rails 2.3 works with ruby 1.9. That's cool!

A: yes, but you are gonna have a lo of troubles with the plugins


text:
Q: Allow SVN anonymous read access from localhost I have an SVN repository that is configured to use Basic authentication through Apache httpd to limit access to specified users.  To support a continuous integration server (and other read-only services) running on the same server I would like to allow anonymous read access from localhost.
After going some research (i.e. Googling) I came up with trying the following Apache configuration:
<Location /svn>
   DAV svn
   SVNParentPath /var/svn

   AuthType Basic
   AuthName "SVN"
   AuthBasicProvider external
   AuthExternal pwauth

   #Only allow specified users to login to SVN
   require user UID1
   require user UID2
   require user UID3

   #Allow anonymous reads from localhost
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      Order allow,deny
      Allow from 127.0.0.1
   </LimitExcept>
</Location>

When I try to do an anonymous checkout from the local server I still get prompted for a password (in this case for the root user).
Any thoughts or suggestions as to what I might be doing wrong or how I should properly configure things to allow this?
My original attempt at configuring anonymous read access is based off of the information on this page.

A:   Satisfy Any
  require valid-user

work for me nicely (can checkout, can't commit)
Edit
My  block, with relevant and irrelevant parts
<Location /svn/>
  DAV svn

  SVNListParentPath on
  SVNParentPath "D:/Repositories/"
  SVNIndexXSLT "/svnindex.xsl"

  SVNPathAuthz short_circuit

  SVNCacheTextDeltas off
  SVNCacheFullTexts off

  AuthName "VisualSVN Server"
  AuthType Basic
  AuthBasicProvider file
  AuthUserFile "D:/Repositories/htpasswd"
  AuthzSVNAccessFile "D:/Repositories/authz"

  Satisfy Any
  require valid-user

  # Add Expires/Cache-Control header explictly
  ExpiresActive on
  ExpiresDefault access
</Location>

if I skip Satisfy Any, I have to authenticate any request

A: If you have multiple Require lines that by default it is RequireAny - only one rule needs to pass.  So you can do it like this
   Require user UID1 UID2 UID3

   #Allow anonymous reads from localhost
   <LimitExcept GET PROPFIND OPTIONS REPORT>
     Require ip 127.0.0.1
   </LimitExcept>

A: I think you're after Satisfy Any at the bottom of your Location block, which allows access if any of the Allow and Require directives match (as opposed to the default, which requires them all to match).
Documentation is here.

A: i dont think this is going to work
the "require user" directive is active for the whole location block.
my first thought was to put the "require user" inside the limit block, this won't work because the limit block is active regardless from which ip you are requesting the data.
make a second directory called svn-localhost, map your svn root there a second time with only the limit block present.

A: I was never able to find a solution that would allow anonymous read access from localhost only and require authentication for both read and write from any remote system.
Ultimately I created a username/password for the application needing to authenticate.
This wasn't the ideal solution... but it should work fine.

A: Even I was not able to solve the anonymous access problem.
But instead of creating a new read only user, I got the integration (with redmine) to work by using the file based url. So instead of referring to http url (which require authentication), I am using file:///. This does not require authentication.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Form handling action understanding This code works perfectly but if I my form in different page it does not work

$name = isset($_REQUEST["name"]) ? $_REQUEST["name"] : ""; // Andrew

$phoneBook = array("Andrew" => 2753, "Colin" => 2863, "Ken" => 2782);

foreach($phoneBook as $k => $v)
{
if( $k == $name ){
    echo $k. " ".$v; // Andrew 2753
}
}
?>

<form action = "kds.php" method ="GET">
name : <input type = "text" name = "name"/>
<input type = "submit"/>
</form>

A: You have the action relative to the current page. So if you are in www.mysite.com the action is www.mysite.com/kds.php, but if you are in www.mysite.com/page the action will be www.mysite.com/page/kds.php. Yoy can set the action relative to the root setting like this <form action = "/kds.php" method ="GET">


text:
Q: TypeORM - run specific migration I know typeorm migration:run to run all migration files, but some time I want run a file like insert file, or a modified file. But i can't find any doc for that. How to do that thanks.

A: This is not possible. You can see the docs of the migration with
typeorm migration:run -h

During development you can locally change your connection settings, e.g. change the path to the migration files in your ormconfig.json to match only your file.
"migrations": [
    "src/db/migration/**/yourmigration.ts"
]

A: If you want to seed the database with data you shouldn't use migrations.
Migrations' purpose is to create the database's structure, This is why migrations are executed serially, therefore running a single migration non-serially misses the point.
For database seeding with typeorm you can use typeorm cli query, you can create a script that read the SQL from a file.
For example in a node.js app & bash:
package.json:
"scripts": {
...,
"typeorm": "npx ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli --config ormconfig-migrations.ts",
"db:seed": "bash scripts/db-seed.sh"
}

db-seed.sh:
#!/bin/bash
query=""

for filename in sql/seed/*.seed.sql; do
 query=${query}"$(< ${filename})";
done

npm run typeorm query "${query}";

Pay attention there is a bug in this solution, there is always an error thrown from the logger typeorm uses - ignore it. it doesn't relate to the db operation, and does not represent the success of the process.
A migration file that was shared with others shouldn't be modified, in this case, create a new migration.
If that file wasn't shared and is in development, you can run migration:revert as many as you need, then modify and run migration:run again.

A: For running a specific migration my solution is in ormconfig.js add:
module.exports = {
...
   migrations: [process.env.DB_MIGRATION_DIR || 'src/database/migrations/*.ts'],
...
}

and now use DB_MIGRATION_DIR=path/to/migration.ts npm run typeorm migration:run run your specific migration
Another tip for force re-running a migration, but might need some customization for connection string variables - add in your package.json:
{
  "scripts": {
    ...
    "migration:rerun": "psql postgresql://$DB_USER@localhost:5432/$DB_NAME -c "delete from migrations where name like '%$SEED_NAME%';" && DB_MIGRATION_DIR='$DB_MIGRATION_DIR' npm run typeorm migration:run"
    ...
  }
  ...
}

A: I dont think we can run any migration particular with cli, but we can run it through query runner. please refer the following code:
 const connection: Connection = getConnection();
const queryRunner: QueryRunner = connection.createQueryRunner();

//createDatabase16413343434 is class/migration generated from cli
const createDatabase = new createDatabase16413343434();
 await createDatabase.up(queryRunner);

A: One can write custom code to run one migration like inserting a record or just creating/ deleting a single table kind of things. typeorm provides "QueryRunner" which basically run queries in the background. So just create a file with the code given following  code to write custom single migration
code to run migration


text:
Q: how to declare pageSize in axios get api for pagination vue 3 while it has the data I'm using Tailwind Pagination for my vue app. I'm currently getting all the data from axios get, and it also gets page: 1 and pageSize: 200 from api.

but they've told me that I have to send the numbers myself and I'm stuck in the middle of it...
I'm getting data like:
in Employee page:
async getUser() {
await this.$store.dispatch("axiosGet", {url: 'identity/api/employees'}).then(response => {
if (response.status === 'error') return
this.userList = response.data.data.data
this.page = response.data.data.page
this.pageSize = response.data.data.pageSize
this.totalCount = response.data.data.totalCount
console.log(response.data.data)
})
},
and then, in Tailwind component passed data through:
in Table component:

then, inside the VPagination component it's what's happening:
<VueTailwindPagination
:current="page"
  :total="totalCount"
  :per-page="pageSize"
  @page-changed="pageChange($event)">
  </VueTailwindPagination>

then:
props: {
userList: {type: Object},
page: {type: Number},
pageSize: {type: Number},
totalCount: {type: Number}
},

methods:
pageChange(pageNumber) {
  this.currentPage= pageNumber
},

so, there's only one page and no pagination is possible.

the Swagger is like this:

Can anyone help me with the problem?

A: You can get your data like this:
async getUser() {
 await this.$store.dispatch("axiosGet",
 {url: `identity/api/employees?page=${1}&pageSize=${10}`})
 .then(response => {})
},

but you need to replace the constant value with your local variables...


text:
Q: Amo-YouTube and Transition mode I am running a Wordpress (neve theme + Beaver build) site in transition mode of AMP plugin. I have some YouTube videos embedded on the regular way and I would like to start using the amp-YouTube to show this embedded videos.
Problem is: the YouTube videos embedded the regular way show up on both AMP and non-AMP views of the site.
The YouTube videos embedded with amp-youtube shows only on AMP-view.
Is there a workaround to show the videos embedded with amp-youtube on both AMP and non-AMP views? I need the same video to show up on both AMP and non-AMP views...
(Note: I am far from being a hard site developer!)

A: Does the same occur with the default WordPress editor using the YouTube block? Why not ask in the AMP plugins support forums?


text:
Q: PHP creating zip archive adds local disk I want to export all my images in a zip, but for some reason it adds all of my local disk too... I dont understand..
This is the code:
$files = $urls;
$zipname = 'uploads.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);

foreach ($files as $file) {
    $name = explode( '/', $file);
    $zip->addFile($file, pathinfo( $file, PATHINFO_BASENAME ));
}

$zip->close();

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipname);
header('Content-Length: ' . filesize($zipname));

readfile($zipname);

$files is an array of the location of the image:
ServicesController.php on line 61:
array:3 [▼
  0 => "C:\wamp\www\prjct\app/../../prjct/web/uploads/media/default/0001/15/thumb_14794_default_big.gif"
  1 => "C:\wamp\www\prjct\app/../../prjct/web/uploads/media/default/0001/15/thumb_14794_default_small.gif"
  2 => "C:\wamp\www\prjct\app/../../prjct/web/uploads/media/default/0001/15/thumb_14794_admin.gif"
]

When I opne my zip file i see this:

As you can see there is my local disk witch should not be here..

A: This should work:
$files = $urls;
$zipname = 'uploads.zip';
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);

$rootPath = realpath($files);
$files = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator($rootPath),
    RecursiveIteratorIterator::LEAVES_ONLY
);

foreach ($files as $name => $file) {
    // Get real and relative path for current file
    $filePath = $file->getRealPath();
    $relativePath = substr($filePath, strlen($rootPath) + 1);

    // non-empty directories would be added automatically
    if (!$file->isDir()){
        // Add current file to archive
        $zip->addFile($filePath, $relativePath);
    }
}

$zip->close();

Generally, you should to use DIRECTORY_SEPARATOR predefined constant instead of slashes/back slashes. This is especially helpful when developing on a Windows machine.
Generally, when working on Windows, make sure to remove the trailing slash when adding folders to zip - that is what created the local disk in your zip file.
$localDirNoSlashes = rtrim($localDir, DIRECTORY_SEPARATOR);
$zip->addEmptyDir($localDirNoSlashes);

This was driving me crazy for a while until I realized what is going on...


text:
Q: .NET Partial Classes vs. Inheritance Okay, so we have a utility here in-house that generates business-model classes from our database tables and views, similar to (but not quite exactly like) an ORM. In maintaining it, it occurred to me that the data in the schemas isn't likely going to change a whole lot. The functionality, however, might. We may want to add additional functionality down the road. We may want to generate some of that functionality, and we may want to extend it.
The classes we're building will reside in a class library for consumption by other libraries and applications. No big surprise there. But the stumper here is how to design generated classes in such a way that we disrupt as little code as possible when we regenerate a class. If, for example, code has been added to a property (which represents a column in a database table), we don't want to lose that.
So, there are two approaches that leap to mind:
Classic inheritance, where the entire thing is done in a single, "monolithic" class and consumers are free to override the base implementation. This gets kind of tricky from time to time, though, and frequently introduces casting headaches. Further, if the derived class isn't careful and forgets to invoke base class functionality, things can quickly go awry.
Partial classes. In this scheme, we separate the business object into distinct parts: the properties (which map to columns), and the behaviors. Behaviors could even be broken down further into generated behaviors and custom behaviors. The problem with this approach, as you can see, is its inherent complexity. Further, there's the naming problem.
Here's my question for you folks: When you're dealing with a scenario like this (if you ever have), or if you were presented with a scenario like this, what solutions would you consider, and why?

A: I would go partial classes path. Just because it fits more natural for dividing 1 object in many parts. Even Linq2Sql uses partials. Fight with complexity with patterns and proper conventions. And it's easier to perform 'partial update' (if generated code is well structured) on partial classes.
If you aren't doing any code generating - go class inheritance way (actually, you would be forced to, cause partials won't work across different assemblies).

A: This is exactly the problem that partial classes exist to resolve.  I think you may be breaking them down a little too far for practical purposes though.  My gut reaction without knowing the finer details of your application would be to use a partial class file for all the generated code of a class, and a second file for all the code created by hand.  Come up with a naming convention for generated partial classes and stick with it.

A: The whole reason Partial Classes are included in .Net is to make it easier to utilize code generation tools.
If you are generating code, use partial classes.  It's really that simple.  Why would you take the risk that the code might have to be re-generated down the road and you'd have to do a ton of work to re-update it with customizations?
I don't find there is much complexity to partials either - it's simply one class split over multiple files.  Generated code in one file, custom code in the other.

A: If you have a type that is to be serialized (to xml) and want to add some functionality, you have to use partial class and not inheritance.
Thanks ///M

A: You say:

similar to (but not quite exactly like) an ORM

I would draw up some forecats figures around maintenance costs for the current solution (which I'm guessing is significant) then select an ORM, write a proof of concept solution and draw up comparative figures for maintaining that. I'm not sure what this custom package costs in the way of maintenance, rampup and developer buy in but I for one would not go anywhere near a "custom" product such as this. The knowledge is not transferable, the risk of error is high (always the case with code generation) and you are bound to the intracacies of the underlying database.


text:
Q: how do you scale a system from 1 request/sec to thousands of requests/sec General System design question:
There is an application that queries DB with lat,long for address and makes an API call to format the address. Currently these requests are processed at a speed of 1 request per second, how do you scale up our application to 1000 requests/second.

A: You need to make your system distributed. You embed your app in a microservice, and then you horizontally scale it out to reach the traffic levels you need. More specifically:

*

*The application will have a limited number requests that it can handle (let's say 100 requests/second), so you need to add 10 replicas of your app in order to handle 1000 requests / second.

*You also need a load balancer in front of your app, to distribute the load evenly across replicas

*Once you scale up even more, the DB will become a bottleneck, so you might need to think about optimizations in that area, for example:

*

*Design the DB on a NoSQL model, because the flat model of lat/long data maps really well on a NoSQL storage format, which comes with a lot of advantages in terms of scalability and distributivity.

*Also, the API you use to format the address will also become a bottleneck once you scale the app, so if it's a third party you need to check the throughput limits and consider them during the scale-up, or if it's in your control, you can follow a similar procedure to scale it up.


text:
Q: How to create Log file for BrowserMobProxyServer Here i'm trying to open chrome with proxy but chrome shows error "ERR_PROXY_CONNECTION_FAILED" , therefore i need BrowseProxyServer logs to Debug, Please suggest how to save them.
public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", chrome_path);
        System.setProperty("webdriver.chrome.logfile", "chromedriver.log");
        System.setProperty("webdriver.chrome.verboseLogging", "true");
        BrowserMobProxyServer proxy = new BrowserMobProxyServer();
        // SSL related
        proxy.setTrustAllServers(true);
        proxy.start();

        Proxy seleniumProxy = ClientUtil.createSeleniumProxy(proxy);
        ChromeOptions options = new ChromeOptions();
        options.setCapability(CapabilityType.PROXY, seleniumProxy);
        options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
        options.addArguments("--ignore-certificate-errors");

        WebDriver driver = new ChromeDriver(options);

        driver.get("https://space.com/?tmn-debug=2&tmn-ip=73.222.216.161");
        try {
            Thread.sleep(5000);
            Har har = proxy.getHar();
            java.io.StringWriter writer = new java.io.StringWriter();
            har.writeTo(writer);
            String harAsString = writer.toString();
            System.out.println(harAsString);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        driver.close();
        proxy.stop();
    }

}


text:
Q: Can't find Microsoft.SharePoint.Portal.SingleSignOn.dll on Sharepoint 2010 I'm trying to migrate across old code onto sharepoint 2010 where we utilize Microsoft.SharePoint.Portal.SingleSignOn.dll. I can't seem to find the dll anywhere (14 folder, GAC, Visual Studio .Net reference dialog).
MSDN seem to believe that the dll should still be available but doesn't specify where it is located.
I have Sharepoint 2010 Server installed on my development environment with Server Farm setup.

A: So Single Sign-On in Sharepoint 2010 is renamed to Secure Store Service.
And the DLL is using Microsoft.Office.SecureStoreService.dll.
Here's the KB from Microsoft on how you can reference that DLL:
http://support.microsoft.com/kb/982263
Cheers,
Z.


text:
Q: Is there a way to add a padding before an inline element that is ignored if the element is on a new line? I am working on styling a link that I would like to display inline following a brief
 element. Ideally, I'd like that link to appear inline with the text but with a small space between the link and the end of the paragraph. It looks exactly how I want it when the paragraph text ends in the middle of the line and the link comes directly after. The problem is that I want to keep the link text ("Learn More") together and not break across lines, so when the whole element ends up on a new line, it has the padding before it as well.
This is a Squarespace site, so some of the default CSS styling is a little opaque and you have to re-style any stuff in code blocks, especially links. I've tried using inline and inline-block display types.
EDIT: Here's the code block with the text:

  Headline Text

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Learn More →

Here is what I've currently got in CSS.
a.issue-learn {
  display: inline;
  margin-left: 1em;
  white-space: nowrap;

Here's what it looks like when the text isn't long enough to force the link to another line: https://i.imgur.com/ivEMTyb.png
And here's what it looks like when the text pushes the link down to the next line: https://i.imgur.com/sgFPH23.png

A: Have you tried using
word-break: keep-all;

A: Try this:

/*SO related*/
body{max-width:290px;}

p.issue-explain{
display:inline;
}

p.issue-explain::after{
content:" ";
margin-left:1em;
}

  Headline Text

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. aaaaaaa

Learn More →

  Second article

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. consequat. consequat.

Learn More →


text:
Q: problem with sprintf implementation via pointers Im trying to Write a function that takes a buffer, a format string and three void pointers to values and composes a string with the same text that would be printed if format was used on printf. the values being pointed at should replace the 3 placeholders in the format string.
i started to code only for cases of %c placeholder and it has a lot of errors(void value not ignored as it ought to be,dereferencing void * pointer) probably the main function is also problematic:
EDIT:
I've changed some of the code thanks to the responders, and now i'm getting this as the buffer value:

you have � dollars and also your name is � and your letter is �

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int format_to_string(char *buffer, char *format, void *arg1, void *arg2, void
*arg3);
int main(){
char format[20] = "%c bla %c bla %c";
char v1='5';
char v2 ='c';
char v3 = 'F';
void *arg1 = &v1;
void *arg2 = &v2;
void *arg3 = &v3;
char str[20];
char *buffer = str;
format_to_string(buffer,format, &arg1, &arg2,&arg3);
printf("%s",buffer);
return 0;

}
int format_to_string(char *buffer, char *format, void *arg1, void *arg2, void
*arg3)
{
    int counter = 0;
    for(int i=0; *format != '\0'; format++, buffer++ )
    {
        if( *format != '%')
        {
            *buffer = *format;
        }
        else
        {
            format++;
            if(*format == 'c')
            {
                if(counter == 0)
                {
                    *buffer =*(char*)arg1;
                    counter++;
                    continue;
                }
                if(counter == 1)
                {
                    *buffer =*(char*)arg2;
                    counter++;
                    continue;
                }
                if(counter == 2)
                {
                    *buffer =*(char*)arg3;
                    counter++;
                    continue;
                }
            }
        }

    }
    *buffer = '\0';
    return 0;
}

A: This call,
format_to_string(buffer,format, &arg1, &arg2,&arg3);
passes the addresses of the three pointers to your variables, not the addresses of the variables themselves.
Change it to,
format_to_string(buffer,format, &v1, &v2, &v3);
or
format_to_string(buffer,format, arg1, arg2, arg3);
and try again.


text:
Q: What is the universal name for this cable and where can I get PCB connectors for them? What is the name for this style cable? I've always known them as nano-cables or micro-cables but I've seen them called sensor-link cables too.

I typically get the cable from here. However, I don't know that this is a standard name for this cable.
Regardless, what I am really after is a source for a PCB mount connector for this style cable. Having the correct name would help my searching.

A: It's more commonly known as an M12 connector.  They're industrial connectors used for remote sensors or ethernet.  There are a bunch of people that make them. There are smaller versions too, the M8 series.
Several companies make them.
http://www.te.com/catalog/minf/en/856
http://www.molex.com/molex/products/group?key=brad_m12_product_families&channel=products
For some product page links.  Binder USA also makes them, and a number of other industrial manufacturers.
You can also find them from distributors like Digikey and Mouser. (Just search M12)
As long as they're the same number of poles and have the same keying, they should fit.  I'd order a sample from Molex or TE and double check.
I would stress relieve the connector if you're doing a PCB mount, the mating force for these is pretty high.  All the PCB connectors I've seen are panel mount.

A: I would not recommend to directly mount the mating connector for these cables to a PC board. You would be much better off using one of these panel mount types:

...from the same McMaster-Carr web page that you linked to. These can mount to the enclosure wall of your device where the retention against cable strain is far superior. Take the discrete wire harness on the back of the bulkhead connector, cut to necessary length and affix another type of standard PC board connector on the end to mate with your circuit board inside the enclosure.
http://www.mcmaster.com/#sensor-cable/=jfkkzt
http://www.mcmaster.com/#sensor-cable/=jfklm5

A: http://www.farnell.com/datasheets/314442.pdf  -- I think they may be part of the Tyco series starting at page 5012

A: I was just recently was searching for a very similar part. I was told the part I was looking for was Alectron JR-2731-3P.


text:
Q: spark-streaming scala: how can I pass an array of strings to a filter? I want to replace the string "a" for an array of Strings making .contains() to check for every String in the array. Is that possible?
val filtered = stream.flatMap(status => status.getText.split(" ").filter(_.contains("a")))

Edit:
Also tried this (sc is sparkContext):
val ssc = new StreamingContext(sc, Seconds(15))
val stream = TwitterUtils.createStream(ssc, None)
val filtered = stream.flatMap(status => status.getText.split(" ").filter(a.contains(_)))

And got the following error:
java.io.NotSerializableException: Object of org.apache.spark.streaming.twitter.TwitterInputDStream is being serialized  possibly as a part of closure of an RDD operation. This is because  the DStream object is being referred to from within the closure.  Please rewrite the RDD operation inside this DStream to avoid this.  This has been enforced to avoid bloating of Spark tasks  with unnecessary objects.
Then I tried to broadcast the array before it is used:
val aBroadcast = sc.broadcast(a)
val filtered = stream.flatMap(status => status.getText.split(" ").filter(aBroadcast.value.contains(_)))

And got the same error.
Thanks

A: As I understand the question you want to see if the status text after being split contains a list of words which is a subset of a:
val a = Array("a1", "a2")
val filtered = stream.flatMap(status => status.getText.split(" ").filter(_.forall(a contains))


text:
Q: LabVIEW - How to accumulate data in array? I made a program aimed to simulate the intensity of light when many light bulbs are put together. I have intensity data of one bulb in xls.-files. So, I want to program to work as follows.

*

*Open the xls.-file and get the data.

*Put the data into different positions. I put one data set (one bulb) in each excel sheet. This is to simulate putting the bulb in different places.

*Sum the data in the same cell across the different sheets.

My LabVIEW front panel and block diagram are:

My problem is this program runs too slowly. How should I improve this? I have an idea to make a big array and accumulate data in that array. However, I do not know how to do it. The Insert Into Array and Replace Array Subset functions are not suitable for my purposes.

A: The most probable reason of slow performance is that you do a lot of operations on Excel file. You should rather read data into memory and operate on them in VI. At the end, if you need, you can update the Excel file with final results.
It would be difficult to tell you exactly how to do it. As you said, you're beginner and I think that the best way would be to simple do some LabVIEW exercises and gain more experience to understand how to work with arrays :) I recommend to take a look at examples (Help->Find Examples), read some user guides from ni.com or find other "getting started" materials on the Internet.
Check these, you may find them useful:

*

*https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/lv_getting_started/

*https://www.ni.com/getting-started/labview-basics/data-structures

*https://www.ni.com/pl-pl/support/documentation/supplemental/08/labview-arrays-and-clusters-explained.html


text:
Q: Converting a lambda function to an if else statement I'm trying to convert this Python lambda function to an if-else statement so that I can add other arguments onto it. Could someone explain how this Lambda would look like if converted to an if-esle statement?
df['type'] = df[FEATURE_NAME].map(lambda column_name: 'property' if is_categorical(column_name) else 'metric')

A: Is this the answer you're looking for?
def foo(column_name):
    if is_categorical(column_name):
        return 'property'
    else:
        return 'metric'

df['type'] = df[FEATURE_NAME].map(foo)


text:
Q: how to Get by Id data from database Blazor C# already have started crud with blazor serverside to get data from database
i am working now to create a page where i will see details and edit one item of a list
i got the id of the item i want to display but my crud solution give me a list of object not just one llike i need....
i got my SqlDataAccess where i code the two main function (load -> QueryAsync, and Save -> ExecuteAsync) with its interface like below :

And i got a FiledbData class from where i call db like below :

i want now just to ask the database for one item like an getbyId instead of get all data ...

A: You can use parameterized queries to execute an where clause.
Therefore the GetFile method would be like this:
public Task<FileModel> GetFilebyId(int id)
{
    string sql = "select * from dbo.file.. where Id = @Id";
    return _db.LoadSingleResult<FileModel, dynamic>(sql, new  {Id = id });
}

Also you need to add a new method LoadSingleResult like below(other parts apart from try section are similar to your LoadData method):
public async Task<T> LoadSingleResult<T,U>(string sql, U parameters)
{
   .
   .
   .
   try{
       var data=await connection.QueryAsynch<T>(sql, parameters);
       reurn data.Single();
   }
   .
   .
   .
}

Note that:

*

*The id column assumed to be Id.

*The id column assumed to be an integer column

You can use QuerySingleOrDefaultAsync too.

A: Add a where clause to your DB SQL query and create an overload of GetFiles() that takes an ID value which will be interpolated into the SQL query:
public Task<List<FileModel>> GetFile(Guid id)
{
    string sql = $"select * from myTable where Id = '{id:D}'";

    return _db.LoadData<FileModel, dynamic>(sql, new  { });
}


text:
Q: Key for storing user info My app have the authorization module. I use cassandra as nosql keyvalue db. As key for user I use MD5(username+password). Is it good way? What are pros and cons?
TIA!

A: This is not related to Cassandra but the short answer is: don't go with that md5 scheme. It's easy to do a brute-force attack. Use bcrypt (see http://codahale.com/how-to-safely-store-a-password/ for a good explanation)


text:
Q: A more pythonic (or pandorable) way to change a list of columns to different data types Often when wrangling data I have to change datatypes.
For example
    In [11]: import pandas as pd

    In [12]: import numpy as np

    In [13]: df =  pd.DataFrame({'col2': {0: 'apples', 1: 'oranges', 2: 'rabbit'}, 'col1': {0: 'white', 1: 'marshmallow', 2: 'bandwagon'}}
)

    In [14]: df.dtypes
    Out[14]:
    col1    object
    col2    object
    dtype: object

   In [15]: for col in cols:
        df[col] = df[col].astype('category')
        ....:

In [16]: df.dtypes
Out[16]:
col1    category
col2    category
dtype: object

Is there a more pandas friendly way to do this - using for example a list comprehension? I feel that the for loop is slow...
This is a really common thing I have to do, and I'm just wondering if there's an idiom I'm not aware of.

A: I think your solution is nice.
Another is:
df[['col1','col2']] = df[['col1','col2']].apply(lambda x: x.astype('category'))

Timings:
In [32]: %timeit (orig(df))
10 loops, best of 3: 27.8 ms per loop

In [33]: %timeit df.apply(lambda x: x.astype('category'))
10 loops, best of 3: 41.5 ms per loop

In [34]: %timeit pd.concat([df[col].astype('category') for col in df], axis=1)
100 loops, best of 3: 18.7 ms per loop

Code for timings:
df =  pd.DataFrame({'col2': ['apples', 'oranges', 'rabbit'],
                    'col1': ['white', 'marshmallow', 'bandwagon']})

df = pd.concat([df]*1000)
df = pd.concat([df]*100, axis=1)
df.columns = range(df.shape[1])

df[df.columns] = df[df.columns].apply(lambda x: x.astype('category'))
print (df)

df = pd.concat([df[col].astype('category') for col in df], axis=1)
print (df)

def orig(df):
    for col in df.columns:
        df[col] = df[col].astype('category')
    return df


text:
Q: How can I change the theme of the main page for the website to my own design by using the Bluehost? I am new to the web design, and I using the Bluehost. My question is I want to change the theme that the Bluehost had given to me for the main page to my own design.
So, when I bought the plan for the Bluehost, and they had asked me to set up what I want to have for my website. Then there had few choices for "Blog" and "Professional", and I don't know what is the difference between both of them. Then I had chosen the Blog selection, but it looks not want I want to have. Because I want to use my own design for the pages, not using their themes for my website.
What I want to have is that I don't want to have a blog for my website, and I want to write the HTML, CSS, and javascript codes and design the page by myself, then upload it to the Bluehost for my website.
So, how can I change the theme of the blog from Bluehost's system to my own design, I don't want to use their themes that had given. Then how can I upload my code's folder to the Bluehost to design my own page, and I didn't find where I can upload the folder to the Bluehost.
Can someone help me with these problems?
Thank you.


text:
Q: axios get params does not inherit the params in create Playing around with youtube api and reactjs
I am calling youtube api.  Recently noticed there is create in axios so I wanted to use it but somehow params kept on overwritten
What am I doing wrong here?
I have a file named youtube.api
import axios from 'axios';

export default axios.create({
    baseURL: 'https://www.googleapis.com/youtube/v3',
    params: {
        part: 'snippet',
        key: 'blahkey',
    }
});

then inside my react handleOnSubmit
    import youtube from '../apis/youtube';
handleOnSubmit = async (e) => {
    e.preventDefault();
    console.log(this.state.query);
    const response = await youtube.get('/search', {
        params: { q: this.state.query }
    });

    console.log(response, 'response');

};

console.log(response, 'response');

I get an error of https://www.googleapis.com/youtube/v3/search?q=book 400
the params of part and key are missing from the url though.
Can someone please give me a hand?
Thanks in advance

A: I found out that this might be due to new version issue.  I am using "axios": "^0.19.0" which is causing this issue.
I downgrade it to "axios": "^0.18.0" and "axios": "^0.18.1", both worked fine
P.S.
I went through their issue tickets on github and this was posted 6 days ago https://github.com/axios/axios/issues/2190

A: Downgrading the version of Axios helped me.
To downgrade the version
kill the server and run
npm install --save axios@0.18.1
this will downgrade the version of Axios from latest to 0.18.1


text:
Q: Put text in the bash command line buffer I would like to programmatically put a certain piece of text in the command line buffer of bash, read to be edited and used as a command.
What I am looking forward to is something similar to read -i but for commands.

-i text If  readline is being used to read the line, text is placed into the editing buffer before editing begins.

Edit: With programmatically I mean that want to write this in a script, launch the script and have the command buffer prepared or the command history modified (as some questions have suggested).

A: I found a hacky way of doing this on the fzf examples page. This works with bash 4.3 and perl 5.18:
writecmd () {
  perl -e 'ioctl STDOUT, 0x5412, $_ for split //, do{ chomp($_ = <>); $_ }' ;
}

# Example usage
echo 'my test cmd' | writecmd

It prints out the command to stdout, but copies it to the command buffer as well. There is also an example on the linked page if you want to execute the command directly.

A: If this for a function that you're going to use in a readline binding with bind -x then you can modify READLINE_LINE. (Example)
Outside of a readline binding, you can push a fake command onto the history with history -s.

A: Gilles' answer is correct, but not completely satisfying. As I read this question, the OP wants to "preseed" the next input line. In my case I wanted to read the terminal's current position in my PROMPT_COMMAND function. That works but uses the same read buffer as the primary shell's, and so any user input gets discarded by the fact that I did a 'read' builtin call in the function. So I wanted to read the user input separately, do my terminal read, and then put the read input back in the input buffer, which is the original question. Note that this is indeed within the same process, so theoretically it should be possible.
As far as I can see (on my bash 4.2) there is no function to push something to the input stack programmatically. In zsh there is using 'print -z'.
So the answer is: this is not possible in bash, you need to use zsh for this.

A: As an alternative to history -s 'foo' try:
echo 'foo' >> ~/.bash_history
history -n

# or
history -s 'foo'
history -a
history -n


text:
Q: Trying to use Google Sheets to connect to the Enphase solar API. Can't get the code to work? Background:
I have barely any knowledge of coding but I want to be able to use my solar output data from the Enphase system to trigger a hot water service to run. How I'm trying to do this is by moving the solar data into Google Sheets and when the solar generation is high enough, a button is pressed.
I've copied and changed this code from another question but I can't get it working. I am getting this error: Exception: Request failed for https://api.enphaseenergy.com returned code 401. Truncated server response: {"reason":"401","message":["Not authorized to access requested resource.","User not found."]} (use muteHttpExceptions option to examine full response). (line 10, file "Enphase To Sheets").
I have no idea where to go from here. Any ideas what I've done wrong? Thanks
Code:
function getReport()
{
var url = 'https://api.enphaseenergy.com/api/v2/systemskey=<apikey>&user_id=<userid>'

var token = UrlFetchApp.fetch(url,{method:'POST',muteHttpExceptions: true});
var token_data = JSON.parse(token.getContentText());
var access_token = token_data.access_token

var url2 = 'https://api.enphaseenergy.com/api/v2/systems/1692404/stats&key<apikey>&user_id=<userid>'
var report = UrlFetchApp.fetch(url2,{method:'GET',headers:{Authorization: 'Bearer ' + '<apikey>'}});
Logger.log(report)

SpreadsheetApp.getActiveSheet().getSheetByName('Solar').getRange('A1').setValue(report);
}

A: It looks to me like you're supposed to request an API key from them and they'll issue you one that you can put in the parts of your url with the < > symbols.
That is, you'll need a real api "key" and a real userid that you get from enphase.

A: I managed to get this working. All I've changed is a few stupid little mistakes with question marks instead of '&'. Hope this helps someone else if you need it.
Once I had my data in the google sheet, I use =transpose(split(A1)) and then another split function to get the correct formatting to be able to use with IFTTT.
function getReport()
{
  var url = 'https://api.enphaseenergy.com/api/v2/systems?key=<apikey_goes_here>&user_id=<userid_goes_here>'

  var token = UrlFetchApp.fetch(url,{method:'POST',muteHttpExceptions: true});
  var token_data = JSON.parse(token.getContentText());
  var access_token = token_data.access_token

  var url2 = 'https://api.enphaseenergy.com/api/v2/systems/1692404/summary?key=<apikey_goes_here>&user_id=<userid_goes_here>'
  var report = UrlFetchApp.fetch(url2,{method:'GET',headers:{Authorization: 'Bearer ' + '<userid_goes_here>'}});
  Logger.log(report)

  var sheet = SpreadsheetApp.getActive().getSheetByName('Solar');
  sheet.getRange('A1').setValue(report)

}


text:
Q: Drools kie workbench guided decision table Using drools decision table with spreadsheet I was able to make this:
decision table with xls file
But in workbench I can´t
guided decision table
The error I was getting is:
Unable to Analyse Expression entrega.setSeq1( ""number|"+entrega.getNumeroML|()" );:
[Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.verbalizar()]
[Near : {... rega.setSeq1( ""number|"+entrega.ge ....}] ^ [Line: 5, Column: 0]

How to set a fact value in action?
Thanks

A: RESOLVED:
From:
https://groups.google.com/forum/#!topic/drools-usage/ZM76HPQ62cU
Create a "Action BRL Fragment" (you'll need to click the "Include advanced options" on the new column dialog).
With this you can either:-
(1) Add "free form DRL" and enter entrega.setSeq1( "number|"+entrega.getNum() );
(2) Select "modify entrega", select the Seq1 field and use a "formula" for the value entering "number|"+entrega.getNum()


text:
Q: Can generalised continued fractions always be written so that they are simple? Can every generalised continued fraction be written in simple continued fraction form? If not, how else does one represent a generalised continued fraction using the standard $[a_0;a_1,a_2,\ldots]$ notation when there are $b_1,b_2,\ldots$ to consider?

A: How does one represent ...
There is this notation
$$
a_0 + \underset{k=1}{\overset{\infty}{\sf K}} \frac{b_k}{a_k} =
a_0 + \cfrac{b_1}{a_1 + \cfrac{b_2}{a_2 + \cfrac{b_3}{a_3 + \cfrac{b_4\;\;}{{\ddots}}}}}.
$$


text:
Q: Open source Android app Does anybody know an open source app which I can download and use as a starting point?
I just want to add comments on a map. When I m at a bar for example, I want to open the app, see where I am on a map and be able to leave a comment which will be shown to other logged in users. Logged in users can reply to my comment.
Not too familiar with android development, that s why I need something to start with.
App or tutorial sources would be great.

A: you could use PassAndroid as a starting point: https://github.com/ligi/PassAndroid - also includes a map

A: Github has a vast amount of repositories with Android code in it.

A: I think you can start with this tutorial, to learn how to use maps on android.
After that, you can search for android projects on git hub.
Also, you need to learn how to work with web services, for every user can get the information in any device.


text:
Q: Get numbers that does not exist in for loop I have 2 integers.
$a = 5;
$b = 3;

This is my code as of now, I want to do it vice versa, which is to get the integer that does not exist.
Instead of getting the existing numbers which are 1,2,3. I would like to execute a command on the numbers  that does not exist (4 & 5).
for ($x = 1; $x <= $a; $x++) {
    for ($y = 1; $y <= $b; $y++) {
        if ($x == $y)
        {
            echo $y." = Exist Do some commands here<br>";
        }
    }
}

A: You can use the following solution:
<?php
$a = 3;
$b = 5;

$arrNotExists = [];

for ($i = $a + 1; $i <= $b; $i++) {
    $arrNotExists[] = $i;
}

var_dump($arrNotExists);

demo: https://ideone.com/bOSsH8

Another solution using two arrays with array_diff:
<?php
$a = 3;
$b = 5;

$arrA = [];
$arrB = [];

for ($i = 1; $i <= $a; $i++) {
    $arrA[] = $i;
}

for ($i = 1; $i <= $b; $i++) {
    $arrB[] = $i;
}

$arrNotExists = array_diff($arrB, $arrA);

var_dump($arrNotExists);

demo: https://ideone.com/OtSwnN

A: According to description as mentioned into above question as a solution to it please try executing following code snippet
$a = 5;
$b = 3;
$temp=array();
$result=array();
for ($x = 1; $x <= $a; $x++) {
    for ($y = 1; $y <= $b; $y++) {
         $temp[]=$y;

    }
 if(in_array($x,$temp)==false)
        {
           $result[]=$x;
        }
}

Also please try executing another alternative solution
$a1 = range(1, $a);
$a2 = range(1, $b);
$result = array_diff($a1, $a2);


text:
Q: Fetch numeric from a sentence and calculate average. I have a sheet with following data :
team1,team2,outcome
AA,BB,BB won by 90 runs
AA,CC,AA won by 19 runs (D/L method)
CC,BB,CC won by 26 runs (D/L method)
AA,BB,BB won by 56 runs
CC,BB,CC won by 18 runs

I need to pick the numeric value and calculate avg of them grouped by team1,team2.
This is what is have till now. Lot of junk data therefore i filter needy records only !
 df[df['outcome'].str.contains('runs',na=False)].head()

My desired outcome :
team1 , team2 , AVG(NUMERIC COLUMN FROM 'OUTCOME')

Please suggest !

A: You can use extract with casting to int first, then groupby and aggregate mean:
df.outcome = df.outcome.str.extract('(\d+)', expand=False).astype(int)
print (df.groupby(['team1','team2'], as_index=False)['outcome'].mean())
  team1 team2  outcome
0    AA    BB       73
1    AA    CC       19
2    CC    BB       22

Similar solution:
s = df.outcome.str.extract('(\d+)', expand=False).astype(int)
print (s.groupby([df['team1'],df['team2']]).mean().reset_index())
  team1 team2  outcome
0    AA    BB       73
1    AA    CC       19
2    CC    BB       22


text:
Q: OSX multiple nswindow inside another does anybody know how photoshop guys created their panels
I think this is nswindow, But I don't know how to tie this nswindow to parent window to have a functionality like in photoshop.
Can anyone propose a way to make this ? Thanks.

A: You can use following NSWindow method to tie window to parent:
- (void)addChildWindow:(NSWindow *)childWin ordered:(NSWindowOrderingMode)place;


text:
Q: Making an SVG path that looks like two, while still one for animation I'm trying to create an SVG animation of the letters E, D, and S. I have the JavaScript elsewhere in the file for animation, but it requires that all of the paths begin in the same place and branch off in different directions to create the letters.

<svg viewBox="0 0 130.821 87.938">
 <linearGradient id="grad" x1="298" y1="0" x2="304" y2="0" gradientUnits="userSpaceOnUse">
  <stop stop-color="#ddd" offset="0"/>
  <stop stop-color="#111" offset="0.01"/>
  <stop stop-color="#111" offset="0.7"/>
  <stop stop-color="#ddd" offset="0.7"/>
 </linearGradient>
 <g fill="none" stroke="url(#grad)" stroke-width="7.408239999999999"">
  <path d="M14.947 22.795l.082 38.443c16.467-.275 32.951.438 49.406-.502 4.717-1.167 9.144-3.87 12.234-7.623 3.127-5.011 4.014-11.665 1.11-16.988-1.62-3.331-3.98-6.636-7.709-7.742-6.395-2.218-13.296-2.331-19.994-2.068l-.088 27.165"/>
  <path d="M14.936 22.795v20.618h21.458"/>
  <path d="M14.936 22.795v3.703h27.14"/>
  <path d="M14.947 22.795l.082 38.443c16.465-.275 32.966.437 49.406-.502 4.51-.99 8.986-4.004 11.765-6.974 2.592-3.606 8.862 1.661 12.762 3.464 5.917 3.374 13.532 6.138 20.063 2.836 4.74-3.09 4.01-11.262-1.241-13.442-5.428-3.361-12.293-3.772-17.28-7.94-2.658-4.75 1.018-11.315 6.37-11.826 5.538-1.305 10.999 1.337 15.726 3.934"/>
 </g>
</svg>

Paste that in an HTML file and you'll see what I'm talking about with the paths overlapping at first, but branching off. Right now it looks like this:

Problem is, I need a break in between the S and the D. My first idea was to draw another line, the same color as my background, right in between the letters. This way, the whole path would be intact for the animation, but the user would only see the letters separated. Since I have some blurs and shadows on the page, it didn't turn out too well:

You can clearly see the path I drew in between the D and the S. How can I resolve this problem without breaking the path for animation? I can think of a few possible ways, but don't know how to accomplish any of them.

*

*How could I change the stroke color of the path, mid-path? I could change it to the background color at the end of the D, and then back to the normal #eeeeee at the start of the S.

*Possibly I could make the black path (which could be in another svg) higher than the light grey svg (using z-index?), but have the filters I have applied to the light grey svg be actually higher than the black path? It's hard to explain, but I'm just asking if you can set the z-index of a drop shadow CSS filter as different than the rest of the element.

*Somehow set the transparency of the black path so it makes that section of the grey svg invisible (I don't know if that's even possible). It'd be like a CSS invisibilty cloak.

I think I could actually break the grey path into two, but I'd have to nail the timing of the animation for that to actually look alright. There's a lot more going on in the page than I explained, so that would take a very long time to get right. I'd love to hear everyone's suggestions before I go spend 20 hours on about as many pixels.

A: I suppose this is what you need. Using the paths you have I'm creating a mask for the group.
I'm using javascript and css for the animation. Your animation may be different.
Please take a look

let animatedPaths = Array.from(document.querySelectorAll("g path"));
animatedPaths.forEach(p=>{
  let l = p.getTotalLength();
  p.style.cssText = `stroke-dasharray:${l}; stroke-dashoffset:${l};`
  })
svg{border:1px solid; width:100vh}
svg g path{transition:stroke-dashoffset 3s;}
svg:hover g path{stroke-dashoffset:0!important}
<svg viewBox="0 0 130.821 87.938">
  <defs>
    <mask id="m">
       <path stroke="white" stroke-width="7.5"
          d="M14.936 22.795v3.703h27.14
                          M14.936 22.795v20.618h21.458
                          M14.947 22.795l.082 38.443c16.467-.275 32.951.438 49.406-.502 4.717-1.167 9.144-3.87 12.234-7.623 3.127-5.011 4.014-11.665 1.11-16.988-1.62-3.331-3.98-6.636-7.709-7.742-6.395-2.218-13.296-2.331-19.994-2.068l-.088 27.165
                          M14.947,22.795
                          L15.029,61.238
                          C31.494,60.963,47.995,61.675,64.435,60.736
                          C68.945,59.746,73.421,56.732,76.2,53.762
                          M88.962,57.226
                          C94.879,60.6,102.494,63.364,109.025,60.062
                          C113.765,56.972,113.035,48.8,107.784,46.62
                          C102.356,43.259,95.491,42.848,90.504,38.68
                          C87.846,33.93,91.522,27.365,96.874,26.854
                          C102.412,25.549,107.873,28.191,112.6,30.788" />
    </mask>
  </defs>
 <linearGradient id="grad" x1="298" y1="0" x2="304" y2="0" gradientUnits="userSpaceOnUse">
  <stop stop-color="#ddd" offset="0"/>
  <stop stop-color="#111" offset="0.01"/>
  <stop stop-color="#111" offset="0.7"/>
  <stop stop-color="#ddd" offset="0.7"/>
 </linearGradient>
 <g fill="none" stroke="url(#grad)" stroke-width="7.4" style="mask: url(#m)">
  <path d="M14.947 22.795l.082 38.443c16.467-.275 32.951.438 49.406-.502 4.717-1.167 9.144-3.87 12.234-7.623 3.127-5.011 4.014-11.665 1.11-16.988-1.62-3.331-3.98-6.636-7.709-7.742-6.395-2.218-13.296-2.331-19.994-2.068l-.088 27.165
     M14.936 22.795v20.618h21.458
   M14.936 22.795v3.703h27.14
   M14.947 22.795l.082 38.443c16.465-.275 32.966 .437 49.406-.502c4.51-.99 8.986-4.004 11.765-6.974 c2.592-3.606 8.862 1.661 12.762 3.464 c5.917 3.374 13.532 6.138 20.063 2.836 c4.74-3.09 4.01-11.262 -1.241-13.442c-5.428-3.361 -12.293-3.772 -17.28-7.94c-2.658-4.75 1.018-11.315 6.37-11.826 c5.538-1.305 10.999 1.337 15.726 3.934"/>

     <path d="M14.936 22.795v3.703h27.14" />

     <path d="M14.936 22.795v20.618h21.458" />

    <path d="M14.947 22.795l.082 38.443c16.467-.275 32.951.438 49.406-.502 4.717-1.167 9.144-3.87 12.234-7.623 3.127-5.011 4.014-11.665 1.11-16.988-1.62-3.331-3.98-6.636-7.709-7.742-6.395-2.218-13.296-2.331-19.994-2.068l-.088 27.165" />
    </g>

</svg>


text:
Q: Can I persist a User ID for an anonymous user when they upgrade to a new iOS device? I'm looking for a second opinion on an issue.
Scenario: A iOS app user is issued a unique ID upon first launch by a backend platform. Consider this ID to be roughly sequential - or at least not derived anything device-specific - and anonymous. The user has not "logged in" in any way, but may have explicitly provided some information that is being stored platform-side related to this ID.
Now, the user buys a new iPhone, and restores a backup of their previous device to the new device. I'm being advised there is no way to persist that unique ID to the new device, and thus link them to the stored platform data. That the only way this could work would be to have the user specifically provide a "login" function before the new device, and then use that same login to associate the user to their ID in the platform.
Is there really no way to persist a simple piece of data across a device upgrade in iOS anymore? thanks in advance for any tips.


text:
Q: flask pymongo distinct in collection does not work I'm trying to use the following line through flask:
collection = 'mongo.db.vehicules.distinct("date_debut", {"modele":"Q5"})'
When I don't insert the second arguments, the query works fine.
With the second one, I have the following error:
TypeError: distinct() takes 2 positional arguments but 3 were given
The same query in Mongo shell works fine.
Anyone has faced the same issue?
Thanks


text:
Q: Powerpivot install fails My machine runs windows 7 professional (64bit) and I use MS office 2010 professional 32 bit.
I'm attempting to (re)install the powerpivot plugin but i get an error stating "installation of powerpivot for excel failed because a higher version already exists on the machine. To proceed, uninstall the higher version and then run powerpivot for excel setup again."
Powerpivot was installed until recently and worked fine. I removed the power pivot plugin using (File | options | manage .com plugins) in an attempt to solve another problem that I had, and now I'm trying to re-install the addin but the error occurs. I already re-installed excel but no help.
Anyone knows a solution?

A: I think your install of powerpivot was not completely removed.
check here, notably the registry part:
http://www.uninstallapp.com/article/How-to-uninstall-Microsoft-PowerPivot-for-Excel-2010-Data-Analysis-Expressions-Sample-1.0.html


text:
Q: InnoTools Downloader not working with Inno 5.5 On the recommendation of several posts here on SO, I've been working with the InnoTools Downloader to try to install a 3rd party dependency for our app during the Install script in Inno setup.
Unfortunately the InnoTools Downloader hasn't been updated in a few years, and is starting to look like it's incompatible with the current Inno Tools setup (5.5.2 (u) on my machine at present). The PChar parameters in ITD have been replaced by PAnsiChar parameters, and when I try to run the various ITD_xxx procedures it gives me varying degrees of fail:

*

*ITD_DownloadFiles gives a type mismatch error and won't compile in Inno Setup

*ITD_DownloadFile compiles, but the file that shows up is 6KB in length and not runnable.

Has anyone gotten ITP to run with newer Inno (post-5.3.0) unicode versions? Or should I look around for another solution?
EDIT
Just to clarify things a bit, I have tried going into the it_download.iss file and replacing all instances of PChar with PAnsiChar. This got me past the compile errors when I first tried to integrate ITD with my setup script.
Here is a sample section of the Inno script:
[Code]
procedure InitializeWizard();
begin
  ITD_Init; // initialize the InnoTools Downloader
  // install 3rd party tool (ex. Git) from the internet.
  if ITD_DownloadFile('http://git-scm.com/download/win',expandconstant('{tmp}\GitInstaller.exe'))=ITDERR_SUCCESS then begin
     MsgBox(expandconstant('{tmp}\GitInstaller.exe'), mbInformation, MB_OK);
     Exec(ExpandConstant('{tmp}\GitInstaller.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, tmpResult);
  end
end;

When this is run, it will bring up a dialog stating where it "downloaded" and stored the file -- on my machine it's in a subdirectory of c:\Users\\AppData\Local\Temp. This file is 6KB, as opposed to the file downloaded from http://git-scm.com/download/win, which is currently 15,221KB.
The ITP_DownloadAfter method gives a similar result.

A: Except replacing all PChar type occurrences with PAnsiChar you will need to replace all occurrences of string type with AnsiString in the it_download.iss file. The next problem is the URL you're trying to get. The size of a file differs from expectation, because you are downloading a HTML document instead of the binary file on which that site redirects. So, if you have your ITD ready for Unicode, change the URL in your script to a direct binary URL. Note, that I didn't used HTTPS because ITD doesn't currently support SSL. A code proof may look like this:
[Code]
const
  GitSetupURL = 'http://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe';

procedure InitializeWizard;
var
  Name: string;
  Size: Integer;
begin
  Name := ExpandConstant('{tmp}\GitInstaller.exe');

  ITD_Init;
  if ITD_DownloadFile(GitSetupURL, Name) = ITDERR_SUCCESS then
  begin
    if FileSize(Name, Size) then
      MsgBox(Name + #13#10 + 'Size: ' + IntToStr(Size) + ' B',
        mbInformation, MB_OK)
    else
      MsgBox('FileSize function failed!', mbError, MB_OK);
  end;
end;


text:
Q: create Android apps to communicate with bluetooth I'm ignorant in android software- I want to communicate "Arduino" with mobile and send/resive byte in Bluetooth mode - I want to display this code in several page ,some time convert this byte to certain string and then display it

A: Have you seen the Arduino tutorial? Its really basic but is a working framework to help develop more complex android apps.


text:
Q: Which format is best for a number range? When writing about a number range do you:

*

*use the word 'to' as in 10 to 20

*use a hyphen separated by spaces as in 10 - 20

*use a hyphen not separated by spaces as in 10-20?

Is there a best way?

A: The Chicago Manual of Style (13th ed) says in section 5.92:

The en dash is one-half the length of an em dash and is longer than a hyphen.
The principal use of the en dash is to indicate continuing, or inclusive, numbers—dates, times, or reference numbers:
1968–72
pp. 38–45
from 1968 to 1970 (never from 1968–70)

The CMOS is one style guide for American English. It has no spaces surrounding the en dash.
According to Andrew Leach (in comments), in BE, there are no spaces surrounding the en dash for number ranges.
However, see the discussion regarding BE spaces or no spaces at https://en.wikipedia.org/wiki/Dash#En_dash_versus_em_dash:

In the United Kingdom, the spaced en dash is the house style for certain major publishers, including the Penguin Group, the Cambridge University Press, and Routledge. However, this convention is not universal. The Oxford Guide to Style (2002, section 5.10.10) acknowledges that the spaced en dash is used by "other British publishers" but states that the Oxford University Press, like "most US publishers", uses the unspaced em dash.

Staying at the same Wikipedia page on Dash, please see the section "Ranges of values." Apparently, the AMA style guide uses hyphens for number ranges, while the APA style guide uses en dashes. Neither use spaces in this example.


text:
Q: Type Tax is already defined (java.lang.NoSuchMethodError) When I start the program:
Exception in thread "main" java.lang.NoSuchMethodError: Racuni.Tax.<init>(DLjava/lang/String;I)V
        at Racuni.dd.main(dd.java:7).

Please help.
public class dd {
    public static void main (String[] args) {

     Tax t = new Tax(65000,"NJ",3);
     System.out.println(t.dependents + t.grossIncome + t.state);
    }
}
class Tax extends dd{
    double grossIncome;
    String state;
    int dependents;

    Tax(double gi, String st, int depen){
        grossIncome= gi;
        state = st;
        dependents = depen;

     }
}

A: By convention, Java type names usually start with an uppercase letter. Please change your dd class to DD, and so the fileName dd.java to DD.java. And recompile it should work fine.


text:
Q: Problem writing into a database getting errors when trying to write into a SQL database using the 2 following functions:
- (void)viewDidLoad

   NSString *dbName = @"TrackDate.sqlite";
    [dbName retain];

    NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
    NSUserDomainMask, YES) objectAtIndex:0];
    NSString *dbPath = [docDir stringByAppendingPathComponent:dbName];

    NSFileManager *fileManager = [NSFileManager defaultManager];
    BOOL exists = [fileManager fileExistsAtPath:dbName];
    if (exists == false) {
        NSString *resourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:dbName];
        [fileManager copyItemAtPath:resourcePath toPath:dbPath error:nil];
        [fileManager release];
    }

    sqlite3_open ([dbPath UTF8String], &database);
}

Variables are being used
char *sql = "Insert into Daten (Latitude, Longitude, Altitude, Speed, Course, Time) Values (?, ?, ?, ?, ?, ?, ?)";
    sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL);

    sqlite3_bind_text(addStmt, 1, [latitude UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(addStmt, 2, [longitude UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(addStmt, 3, [altitude UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(addStmt, 4, [speed UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(addStmt, 5, [course UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(addStmt, 6, [date UTF8String], -1, SQLITE_TRANSIENT);

    if (SQLITE_DONE != sqlite3_step(addStmt)) {
        recordLabel.text = @"Error!";
    }

    sqlite3_reset(addStmt);
}

A: char *sql = "Insert into Daten (Latitude, Longitude, Altitude, Speed, Course, Time) Values (?, ?, ?, ?, ?, ?, ?)";

You have an error in the SQL statement: six columns, seven placeholders.

A: You pass six field name and assigning seven values.
replace this
char *sql = "Insert into Daten (Latitude, Longitude, Altitude, Speed, Course, Time) Values (?, ?, ?, ?, ?, ?, ?)";
with
char *sql = "Insert into Daten (Latitude, Longitude, Altitude, Speed, Course, Time) Values (?, ?, ?, ?, ?, ?)";

A: sqlite3_stmt *statement = nil;
    char sql[1000];
write values according to your self.
    sprintf(sql, "Insert into *your table name* values ('%s', '%s')",[productId UTF8String], [folderId UTF8String]);

//path will contain the path of your database location.
    NSString *path = [self GetDatabasePath] ;
    if(sqlite3_open([path UTF8String],&database) == SQLITE_OK )
    {
        if((sqlite3_prepare_v2(database, sql, -1, &statement, NULL)) == SQLITE_OK)
        {
            //NSLog(@"%s",sql);
            sqlite3_step(statement);
        }
        sqlite3_finalize(statement);
    }
    sqlite3_close(database);

Happy coding!!


text:
Q: Laravel from 5.4.* to 5.5* Update error and php version error I've created a laravel project with version  5.4.* and I want the project version to be 5.5.*
I've edited the composer.json but I get this error.
error code:
Your requirements could not be resolved to an installable set of packages.
Problem 1
    - laravel/framework v5.5.9 requires php >=7.0 -> your PHP version (5.6.31) does not satisfy that requirement.
composer.json code
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~6.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }

}

A: Update your PHP version to 7.0 or higher. You can check the requirements here https://laravel.com/docs/5.5

A: If you are in a development environment try installing the new version of php. By installing the new version of xampp you will get the updated version of php. Or if you are in production mode upgrade your php version by going to Select PHP Version and update it.


text:
Q: Synchronizing multiple (Highcharts) on a page I have multiple highcharts on a page, which could have different series. If somebody hovers over a chart, I want this hover to be synced on other charts as well (showing the tooltip at the hovered X-point, showing hover effect etc).
When I use this example to try to sync multiple charts https://www.highcharts.com/demo/synchronized-charts
I'm failing because my charts do NOT live in the same div. Their example however does only work if the charts are below each other, not if they are placed next to each other or anywhere at the page.
Ideally, I would just sync the value of the hovered x Axis point as this value (timestamp) is the same for all charts available on this page.
Anybody knows a non hacky way how to do it?
Thanks

A: In broad strokes the way I have solved this in the past would be to use the mouseOver event for a point to capture that points xAxis value. See this example. In addition to getting the value, I would call a custom function that goes through all charts and highlight the same xAxis value there (if it exists).
To make this easier I would make some global array or similar that has a reference to all charts on the page. This way you don't need to explicitly reference each chart from other charts. To make this look nice and be practical, all charts need to be able to call the same custom function to highlight a value, and have a similar function that removes the highlight on the mouseOut event.
This is just one possible solution, there are many ways to achieve what you are after.

Here is a very basic implementation of what I wrote above
function sharedMouseOver() {
  let currentX = this.x
  charts = Highcharts.charts;
  charts.forEach(function(chart, index) {
    chart.series.forEach(function(series, seriesIndex) {
      series.points.forEach(function(point, pointsIndex) {
        if (point.x == currentX) {
          point.setState('hover')
        }
      })
    });
  });
}

function sharedMouseOut() {
  charts = Highcharts.charts;
  charts.forEach(function(chart, index) {
    chart.series.forEach(function(series, seriesIndex) {
      series.points.forEach(function(point, pointsIndex) {
          point.setState('')
      });
    });
  });
}

And in each chart you can find this:
plotOptions: {
  series: {
    point: {
      events: {
        mouseOver: sharedMouseOver,
        mouseOut: sharedMouseOut
      }
    },
    ...
}

Working example: https://jsfiddle.net/ewolden/tvgL8pnh/17/

function sharedMouseOver() {
  let currentX = this.x
  charts = Highcharts.charts;
  charts.forEach(function(chart, index) {
    chart.series.forEach(function(series, seriesIndex) {
      series.points.forEach(function(point, pointsIndex) {
        if (point.x == currentX) {
          point.setState('hover')
        }
      })
    });
  });
}
function sharedMouseOut() {
  charts = Highcharts.charts;
  charts.forEach(function(chart, index) {
    //if (chart.renderTo.id === chartsId) {
    //    chosenChart = chart;
    //}
    chart.series.forEach(function(series, seriesIndex) {
      series.points.forEach(function(point, pointsIndex) {
          point.setState('')
      });
    });
  });
}

Highcharts.chart('container', {
  legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'middle'
  },

  plotOptions: {
    series: {
      point: {
        events: {
          mouseOver: sharedMouseOver,
          mouseOut: sharedMouseOut
        }
      },
      pointStart: 2010
    }
  },

  series: [{
    name: 'Installation',
    data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
  }, {
    name: 'Other',
    data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
  }],

});
Highcharts.chart('container2', {
  legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'middle'
  },

  plotOptions: {
    series: {
      point: {
        events: {
          mouseOver: sharedMouseOver,
          mouseOut: sharedMouseOut
        }
      },
      pointStart: 2010
    }
  },

  series: [{
    name: 'Manufacturing',
    data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
  }],

});


text:
Q: Layout Folder name for 7" Tablet I have two layout folders, layout-sw600dp for 7" Tablet (1024X600) mdpi and another with name layout-xlarge for 12" Tablet (1280X800) mdpi. The problem is that when I run my project in 7" emulator it pics the layout from layout-xlarge folder instead of layout-sw600dp. I have also tried other solutions by changing folder names which are given in different sites but could not find the suitable solution for my problem. Please provide me a working solution for this problem. Thanks in advance.

A: The thing to remember here is that using the swXXXdp resource identifier only works on devices that are running Android 3.2+ (which is when it was added). Older devices will not recognize and therefore will not use these identifiers, so you must use the old identifiers (small, normal, large, xlarge) if you intend on supporting tablets running Android < 3.2. As of now, only 0.3% of tablets out there run Android 3.1 (API 12), so it's a safe call to not fully support them - http://developer.android.com/about/dashboards/index.html.
There is an excellent blog explaining how to use these newer resource identifiers.
http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html
For your particular issue, assuming you are only supporting Android 3.2+ for your tablet layouts, change your layout-xlarge folder to layout-sw720dp to support 10"+ tablets, and your layout-sw600dp will support 7" tablet layouts.

A: The options for layout folders are vast. Not only can you specify things like layout-land/ or layout-large, you can also specify mixtures of them, like layout-large-land/ or layout-xhdpi-land/. You can see all of the qualifiers here at Android Developers. For your problem, check to see if the dimensions of your tablet emulator is of the correct screen resolution. You can specify a specific screen resolution when creating an AVD. Also, when specifying layout-sw600dp/, it checks for the width of the actual available width of your currently running actiity. On tablets running 4.2, for instance, ~50dp of the bottom of the screen is used for the system bar, and some are used for the top action bar if not in fullscreen. These would reduce the actual dp to less than 600.


text:
Q: Project files in repository Is it common practice to keep project files (i.e. files other that source code files) in the version control repository?
Also, are these files checked in/out on a regular basis?
I always envisioned a SCC repository as 'clean' with only source code files.
How do you manage the non-source code files in a repository?
Take a Visual Studio solution, as an example.  Would you "check-in" the entire Solution's directory to the SCCS or would you just add the source code files?  What about when it comes time to build the Solution, then the entire solution needs to be checked out?  Maybe it's best done with a manual process?

A: I think the general rule of thumb is that the minimal amount of data required to make the project compile and run should be included.  That includes art (or other basic data files) and any build scripts.  In the case of an autotools project, this usually means a configure.ac.  In a Visual Studio project, it means the Visual Studio project file.  But you wouldn't include anything that can be automatically generated from the rest, for example a "configure" script, if a configure.ac is already there.
CVS and Subversion both have flags for adding binary files (Subversion adds it automatically), which is great for things like images and project files (the binary ones, anyway).  Subversion also allows for file locking, which can be good for artists who don't want to clobber each other's work.

A: Anything that can be generated from other files in the repository should not itself be stored in the repository.

A: You should keep everything that you need to build the project within the repository.
So source code needs to be kept, but also things like the help files, documentation, graphics, licence, etc.
The final product does not need to be stored, because it is rebuilt from the source.
Also, configuration files with passwords and logins shouldn't be stored either.

A: Yes, you should! You should include all the files necessary for other developers to quickly set up the project in the IDE, including yourself to quickly restore the project if you happened to mess up your local project configuration.
I'm mostly into web development. There are project resource files, such as Photoshop .PSD files, that are used for development and are somehow exported into other files that go into production. You may want to keep them in a separate folder or repository. Project members who aren't mainly concerned with those files, they're rarely updated and maintained by few people anyway, can opt to ignore those resources and not have a local copy.

A: Typically anything that is rebuilt as part of the build is not checked into the respository.  Otherwise there will be merge conflicts when the generated files are committed, especially if they are binaries or contain absolute paths.
As Sydius mentioned, most SCM tools have a way to flag non-source files as binary.  Most modern tools auto-detect non-plaintext files and for CVS it is:
cvs add -kb filenames

A: One of my pet projects is a small cross-platform application for Windows, Mac OSX and Linux. I use wxWidgets as framework and Kdevelop on Linux, XCode on Mac OSX and Dev-Cpp on Windows as IDEs. The project files for each of these IDEs are perfectly manageable with CVS and SVN. I keep the project files in the repo. Whenever i have to rebuild the development environment on any of the target platforms, all i have to do is install the IDE and check out the latest CVS.

A: You need keep history of compiled binaries as separate archive. If you do update on a server and it does not work you need to rollback. Much better if you do it from archived binary copy. I think it is good idea to have some routine for binary version control. But they are not supposed to be stored under SVN or alike. SCC systems are most useful then they are used not for backup purposes but for rollback and to keep track of change sets inside of stored documents. Which does not make sense for binaries.


text:
Q: If a webserver has a host name and a different alias DNS name, what will be the value of document.domain? I have a webserver with the following host name and DNS alias name.
Host name - server1.aa.xx.company.com
Alias name - server1.bb.xx.company.com

In the above scenario, what will be the value of JavaScript DOM object document.domain? Will it be server1.aa.xx.company.com or will it be server1.bb.xx.company.com?

A:
what will be the value of JavaScript DOM object document.domain

It will be the domain the page was requested in the browser on. Javascript isn't interested in DNS aliases - just in what it says in the browser's address bar.


text:
Q: Updating php with homebrew led to complications My php version was 7.1.33 but in order to install a specific Laravel project I needed at least version 7.2. I'm using a Mac with High Sierra (10.13) installed.
So I installed homebrew and then this:
brew install php@7.2
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.bash_profile
brew link php@7.2
According to php -v(in the directory of the laravel project) my version is 7.2.33, MAMP is using 7.2.8, so this is fine I think.
which php shows me: /usr/local/bin/php
and php --ini gives me /usr/local/etc/php/7.2 where my php.ini is and /usr/local/etc/php/7.2/php.ini where the loaded configuration file is located.
In the browser phpinfo of Mamp gives me these paths instead:
php.ini: /Applications/MAMP/bin/php/php7.2.8/conf
loaded configuration file: /Applications/MAMP/bin/php/php7.2.8/conf/php.ini
When trying to 'composer install' in said project I get an error that I can't install some extensions. This extensions are listed in Mamp's php.ini but not in the /usr/local/etc/php/7.2/php.ini the terminal gave me.
I'm confused what to do to resolve this issue, did I failed to install php 7.2 correctly?
Has anyone an idea what exactly went wrong or how I can use the correct php.ini (the Mamp's one, where the extensions are listed) in the terminal when installing the composer of the project?

A: If you just want to ignore the composer error; add the platform config to your composer.json.
For example:
{
    "config": {
        "platform": {
            "ext-mailparse": "1.0",
            "ext-intl": "1",
            "lib-icu": "4.2.1",
            "php": "7.4.8",
            "ext-gettext": "1"
        }
    },
    "require": {
    ...
    }
}

A: The fact is, MAMP will use its own PHP version and configuration files and will ignore the brew-installed ones. Your terminal, on the other hand, will do the opposite.
So you need to tell your system to use MAMP php by adding its bin folder to the path:
brew unlink php@7.2
export PATH="/Applications/MAMP/bin/php/php7.2.8/bin:$PATH" >> ~/.bash_profile

Note: you should remove /usr/local/opt/php@7.2/bin from your path, check your ~/.bash_profile file

If you want to keep system php and MAMP php separated, you could alias a different command for the mamp PHP:
alias phpmamp="/Applications/MAMP/bin/php/php7.2.8/bin/php"

and then invoke composer using it:
phpmamp composer install

A: I just manually installed the extensions I needed, updating php worked fine.


text:
Q: BMC remedy incident fields validation rules via rest api We are using remedy rest api to create and modify incidents.
This works fine. Now, to create or modify incident through UI, we need to make sure correct values for the respected fields are provided.
For example while create an incident the field first name has maxlength 30 chars. This one we found after creating tons of incident and trial and error.
Is there any list of validation rules ? Or is there any specific workflow to get executed for incident fields validation ?

A: If you are creating via HPD:IncidentInterface_Create form there are bunch of out of the box validation filters.
You can also create your own filter, trigering on any choosen field (eg. z1d_action). And force your clients to include this field ind their request.


text:
Q: CheckBox throwing exception in xamarin forms even after adding Xamarin.Forms.Labs Package I am trying to add Checkbox in Xamarin.Forms PCL project in Xamarin Studio Starter Edition.I refered this link How to create checkbox in xamarin forms  to add Checkbox.Then Successfully added Xamarin.Forms.Labs Package Through Nuget Package Manager.I added namespace
xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
in my xaml page. After Running the project i got  Could not load file or assembly 'XLabs.Forms' or one of its dependencies. The system cannot find the file specified throws exception. Please anyone tell me the problem.

A: I had this problem and it was because I hadn't followed the instructions on this page https://github.com/XLabs/Xamarin-Forms-Labs/wiki
You need to make sure you change your AppDelegate to derive from XFormsApplicationDelegate, this fixed the rpoblem for me.
[Register("AppDelegate")]
public partial class AppDelegate : XFormsApplicationDelegate


text:
Q: Enable as a primary App ID option is disable in Sign In with Apple - Apple ID configuration I am trying to add the "Sign In with Apple" to my existing App ID. After checking the option to enable it, the following popup was shown: with this message:

If you're enabling an App ID for the first time or for a new app, enable the App ID as a primary. You can use primary App IDs on their own or to enable identifiers for related apps and websites through grouping. To enable an App ID for a related app, (for example, an App ID for the iOS version of your Mac app), group it with the existing primary. This will also ensure that users only need to provide consent to share their information with you once for each group of apps and websites.

However, I could not proceed because the Save button is disabled. I could not do anything.
are there any extra configs I missed or are there anyways around to enable an App Id as primary?

A: The UI is confusing, what I did was selecting sign in with apple first then immediately clicking save/continue. Don't click configure yet, save first. Then Click cnfigure and enable primary ID.

A: First You have to go to Xcode > Signing & Capabilities > + Capability and Add  Sign in with apple as a new capability.
After that refresh the developer.apple.com page and you should be able to select Enable as a primary App ID and the save button should be enabled.

A: Yes, indeed the UI is confusing. I see

and

I think this means I have it correctly enabled as a primary App ID.


text:
Q: Does this function have inflection points? Does the function $f(x) = 3$ have inflection points?
$f''(x) = f'(x) = 0$ so it seems like every $x$ is an inflection point but according to the graph there is none... What is the correct answer?

A: An inflection point is a point where the sign of curvature changes from negative to positive, or vice versa. More precisely, $x$ is an inflection point of a twice differentiable function $f$ if there exists $\varepsilon>0$ such that $f''(y)<0$ for all $y\in (x-\varepsilon,x)$ and $f''(y)>0$ for all $x\in (x,x+\varepsilon)$, or if $f''(y)>0$ for all $y\in (x-\varepsilon,x)$ and $f''(y)<0$ for all $x\in (x,x+\varepsilon)$. Since $f''(x)=0$ for all $x$ when $f(x)\equiv 3$, no point fits the above definition, so we conclude that no points are inflection points. See Wolfram MathWorld for more information.


text:
Q: Why Won't My PHP mail() work? My PHP mail function isn't sending emails. I've checked my php.ini settings and STMP etc. I also used print_r(error_get_last()) and that returns nothing. The same code used to work when I was with a different host so it is almost definitely a settings/ server issue. Any help would be great - Thanks.
   $msg = "Message";
    $msg = wordwrap($msg,70);

    $mail = mail($email,"Email Confirmation",$msg);
        if($mail){
        //Email Sent

            }
            else{
            //Mail Failed

            }


text:
Q: Facebook not adding likes together My website has a few Facebook like buttons on it, however the numbers doesn't really add up. There is one post with 18 likes, then there's the front-page-like with 8 likes and my facebook wall with 3 likes. Shouldn't these likes be combined? I think I'm using the OG tags correctly.
Website: Rushtips.com
Thanks in advance!
Edit:
I used this code:

Would using this code, make it count on my wall as well?:

If that's the case, all I need to know is how to do it with the posts, if it's possible.

A: It's not possible to add post-likes to the page-likes count, which I think should be done by default, anyway..
Using your Facebook page, instead of your own domain, as the data-href is the only way to get the same count on your wall as well as on the like-button.
In posts, you should use the default permalink of your site.
Hope it helps someone.


text:
Q: Special Characters NSString I have a NSString I am trying to declare so I can use it as an applescript. here is the code:
 NSString *script1 = @"do shell script /usr/bin/php -r ($mac = \"g1:ag:g3:cg:gg:eg\"; $porttemp = \"9\"; $ip = \"255.255.255.255\";
 $mac_bytes = explode(\":\", $mac);
                     $mac_addr = \"\";
                     for ($i=0; $i<6; $i++)
                     $mac_addr .= chr(hexdec($mac_bytes[$i]));
                     $packet = \"\";
                     for ($i=0; $i<6; $i++) /*6x 0xFF*/
                     $packet .= chr(255);
                     for ($i=0; $i<16; $i++)    /*16x MAC address*/
                     $packet .= $mac_addr;
                     $port = $porttemp;
                     $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
                     socket_set_option($sock, SOL_SOCKET, SO_BROADCAST, TRUE);
                     socket_sendto($sock, $packet, strlen($packet), 0, $ip, $port);
                     socket_close($sock);
                     );"

The Problem I am facing it that xcode says I am not terminating it and gives a whole bunch of errors. Any idea how I can solve it or have I got anything wrong?

A: You must surrond every row with "".
Like:
NSString *HelloWorld = @"Hello"
                    " World";

What you are doing is:
NSString *HelloWorld = @"Hello
                     World";

which is not valid.
[Edited to correct code display, so example makes sense as line breaks were being removed.]


text:
Q: Generic Extensions I want to create a set of extensions similiar to the .ToList<>() for a custom Generic Colletion I have.
Here are the Objects I have
AceDataObjectCollection<T> : ICollection<T> where T : IAceDataObject
IAceDataBlock : IAceDataObject
IAceMessage : IAceDataObject

I want to do this.
AceDataObjectCollection<IAceDataObject> objects = new AceDataObjectCollection<IAceDataObject>();
objects.Add(...)  // Add different data objects here
AceDataObjectCollection<IAceMessage> messages = objects.Where(o => o is IAceMessage).ToAceDataObjectCollection<IAceMessage>();

I can't seem to figure out how to form the extension properly with the generics.

A: I believe this is what you're looking for.
public static AceDataObjectCollection<T> ToAceDataObjectCollection<T>(this IEnumerable<T> col) where T : IAceDataObject
{
   AceDataObjectCollection<T> objects = new AceDataObjectCollection<T>();

   foreach (T item in col)
      objects.Add(item);

   return objects;
}


text:
Q: Typescript error when using require - This expression is not callable. Type 'typeof import(...)' has no call signatures.ts(2349) I'm trying to run this script
const fetch = require('node-fetch');

function test() {
  fetch('https://google.com')
    .then(res => res.text())
    .then(text => console.log(text))
}

test();

But i get this error

This expression is not callable.
Type 'typeof import("(...)/node_modules/node-fetch/@types/index")' has no call signatures.ts(2349)

although it works when i use import
import fetch from 'node-fetch';

why and how to fix it?

A: As per spender's comment, you can change the require to use this destructuring:
const {default : fetch} = require('node-fetch');

This has worked for me in a similar situation (using axios in node, which has a similar API)


text:
Q: Using same alias in two or more DIFFERENT correlated subqueries Say I have a Select list with some correlated subqueries, like:
OutputColumnAlias1 = (select min(somedate)
                      from Table1 t1
                      where t1.patientid=OuterTableAlias.patientid
                      and t1.labname='labname1')
OutputColumnAlias2 = (select min(somedate)
                      from Table1 t1
                      where t1.patientid=OuterTableAlias.patientid
                      and t1.labname='labname2')

Is it acceptable to repeat t1 in the second subquery, because it's "scope" will only be limited to the inside of that parenthetical?
Or am I unwittingly producing a bad result because, due to the first subquery, t1 will forever be defined by it's first referenced instance's WHERE clause, (etc) ?
Setting aside the badness of correlated subqueries for a moment, please advise?


text:
Q: how to select constant number of rows in a 2D tensor (Selection up to the optimization) Given a 2D tensor M of n*h. Is there a way that I can select constant number of rows r (r < n)of M. The choice is going depend on the SGD for minimizing the cross-entropy of the prediction error which I will ignore the details. Duplicate rows are not allowed. It has to be r distinct rows no more no less. Is there a way I can achieve this?

A: Here is a kind of proof of concept of how you might try to go about this, although I doubt that you can get anything practically useful out of it. Indexing is not differentiable, so what you might do is treat your tensor "as if" it were a continuous function (or a collection of continuous functions, each in one column), evaluated at integer positions. Then, from differentiation point of view, you could consider linear interpolation between the integer positions to make it "really" continuous, and that would be something you can differentiate. The following script implements this idea:
import tensorflow as tf
import numpy as np

# Problem: find rows with smallest norm
rows, cols = 100, 200
np.random.seed(100)
# Make random sine waves
a = np.random.rand(cols)
f = np.random.rand(cols)
p = 2 * np.pi * np.random.rand(cols)
x = np.linspace(0, 2 * np.pi, rows)[:, np.newaxis]
rand_sin = a * np.sin(f * x + p)
# Solution: row indices sorted by norm
rows_order = np.argsort(np.linalg.norm(rand_sin, axis=-1))
print('Rows ranking:')
print(rows_order)
print()

@tf.custom_gradient
def index_with_gradient(tensor, index):
    # Round index and convert to integer
    index_int = tf.to_int32(tf.round(index))
    # Make sure it does not go out of bounds
    index_int = tf.clip_by_value(index_int, 0, tf.shape(tensor)[0] - 1)
    # These are the selected rows
    out = tf.gather(tensor, index_int)
    # Gradient function
    def grad(dy):
        # Add extra initial and final row so we can take differences
        padded = tf.pad(tensor, [[1, 1], [0, 0]], 'SYMMETRIC')
        # Take differences
        diff = padded[1:] - padded[:-1]
        # Take differences with the previous and with the next
        diff1, diff2 = diff[:-1], diff[1:]
        # Gradients from "left" and "right" for the current indices
        g1 = tf.gather(diff1, index_int)
        g2 = tf.gather(diff2, index_int)
        # Compute error between integer and real-valued index
        index_err = index - tf.cast(index_int, index.dtype)
        # Clip error
        index_err = tf.clip_by_value(index_err, -0.5, 0.5)
        index_err = tf.expand_dims(index_err, -1)
        # Mix left and right gradients according to error
        g = (0.5 - index_err) * g1 + (0.5 + index_err) * g2
        # Aggregate gradients
        g_out = tf.cast(tf.reduce_sum(dy * g, axis=-1), index.dtype)
        # No gradient for tensor, only for index
        return None, g_out
    return out, grad

tf.set_random_seed(100)
# Input tensor
tensor = tf.constant(rand_sin, dtype=tf.float32)
# Index to optimize - must be real so it can be optimized
index = tf.Variable(np.random.randint(rows, size=2), dtype=tf.float32)
# Integer version of the index
index_int = tf.to_int32(tf.round(index))
index_int = tf.clip_by_value(index_int, 0, tf.shape(tensor)[0] - 1)
# Select rows using function with gradient
selected_rows = index_with_gradient(tensor, index)
# Loss value is sum of norms
loss = tf.reduce_sum(tf.norm(selected_rows, axis=-1))
# Pick learning rate for SGD optimizer
learning_rate = 1.0
# Optimization
train_op = tf.train.GradientDescentOptimizer(learning_rate).minimize(loss)
init_op = tf.global_variables_initializer()
# Test
with tf.Session() as sess:
    sess.run(init_op)
    for i in range(1001):
        sess.run(train_op)
        if i % 100 == 0:
            print(f'Iter {i}')
            i1, i2 = sess.run(index_int)
            rank1 = np.where(rows_order == i1)[0][0]
            rank2 = np.where(rows_order == i2)[0][0]
            print(f'- Index 1: {i1} (ranking: {rank1})')
            print(f'- Index 2: {i2} (ranking: {rank2})')
            print()

Output:
Rows ranking:
[ 5  6  4  7  3  8  2  9  1 10  0 11 12 13 14 15 16 17 18 19 20 76 75 77
 74 78 73 79 72 80 71 81 21 70 82 69 83 84 22 68 85 67 86 23 66 87 65 88
 24 89 64 90 25 63 91 92 62 93 26 94 61 95 27 96 60 97 98 99 28 59 58 29
 57 30 56 31 55 32 54 33 53 34 52 35 51 36 50 49 37 48 38 47 39 46 40 45
 41 44 42 43]

Iter 0
- Index 1: 67 (ranking: 41)
- Index 2: 89 (ranking: 49)

Iter 100
- Index 1: 68 (ranking: 39)
- Index 2: 88 (ranking: 47)

Iter 200
- Index 1: 70 (ranking: 33)
- Index 2: 87 (ranking: 45)

Iter 300
- Index 1: 70 (ranking: 33)
- Index 2: 85 (ranking: 40)

Iter 400
- Index 1: 71 (ranking: 30)
- Index 2: 84 (ranking: 37)

Iter 500
- Index 1: 72 (ranking: 28)
- Index 2: 83 (ranking: 36)

Iter 600
- Index 1: 72 (ranking: 28)
- Index 2: 82 (ranking: 34)

Iter 700
- Index 1: 73 (ranking: 26)
- Index 2: 82 (ranking: 34)

Iter 800
- Index 1: 73 (ranking: 26)
- Index 2: 81 (ranking: 31)

Iter 900
- Index 1: 74 (ranking: 24)
- Index 2: 80 (ranking: 29)

Iter 1000
- Index 1: 73 (ranking: 26)
- Index 2: 80 (ranking: 29)

As you can see, the ranking of the indices is actually reduce progressively, although it rather quickly falls into what appears to be a local minimum and does not ever get closer to the actual solution (ranking 0). Also, this solution does not enforce that the selected row indices are actually different. Since it is an optimizer updating the indices, it is not straightforward to put restrictions on it. You might think of something like optimizing an index over the whole tensor, then an index over the whole tensor but one row, etc. although the implementation of the selection and the gradient would probably become significantly more complicated.


text:
Q: Where is apache-cassandra-x.x.x.jar in lib? I was reading somewhere that in order to use the org.apache.cassandra classes in my java project I need to import the apache-cassandra-x.x.x.jar in my java project CLASSPATH but I was unable to find it in any of the folders in my /cassandra path. Has it been deprecated? Is there an alternative to it?

A: Well I have apache-cassandra-0.6.9.jar in my cassandra's lib directory, and that was unpacked as-is from the .tgz distro.
Are you sure you downloaded the bin distro, rather than the src?


text:
Q: Plugin templates in which directory Currently I have a number of custom posts as plugins, which process data and send them to the plugins respective template. I use Roots theme as a basis and currently store my plugin templates in the main theme directory.
However, I'm thinking of moving each of these to their respective plugin folder. Are there any advantages / disadvantages to either? I'm thinking about cases like what happens to existing data on pages which use a plugins template when a plugin is turned off for example.

A: To be honest, there is no correct or wrong answer here. I do believe that templates are theme territory, although custom post types and taxonomies belongs in a plugin
The reasoning behind this is

*

*HTML mark up across the theme should be uniform. For instance, if you have templates in a plugin, and you have customized it for the current theme, it will most probably break your CSS styling in a new theme if you decide to change themes

*This is an extension to the previous point, HTML are almost never the same between themes

*Theme specific functions will lead to fatal errors when a theme is changed if your template is in a plugin and the new theme calls this template
This is just one or two points you should consider. I might have slipped one or two, but these are the important ones
These templates will not be used once the plugin is deactivated if they are specifically named to be used for that particular post type or taxonomy, so you need not be worried about these templates breaking something. If ever a taxonomy or post type is registered with the same name, these templates will most probably just be used without any issues
So, to conclude, this is up to you what you want to do. At the end of the day, you need to keep your site and code as manageable to yourself as possible so that in 5 years time you still know exactly what is going on with your site and code