text:
Q: SSD changes mount point during partitioning I booted up my computer after a week without using it and I was greeted with a MS-DOS prompt saying that my disk had read errors instead of booting up Windows.
Fed up with the latter OS, I decided to format my SSD and install Pop!_OS.
However, when partitioning my drive, I have the following log :
GParted 1.2.0

configuration --enable-libparted-dmraid --enable-online-resize

libparted 3.4

========================================
...
elapsed by me : description of my other drives
mounted on /dev/sda and /dev/sdb
...
========================================
Device: /dev/sdc
Model:  ATA KINGSTON SA400S3
Serial: 50026B73811B943A
Sector size:    512
Total sectors:  937703088

Heads:  255
Sectors/track:  2
Cylinders:  1838633

Partition table:    msdos

Partition   Type    Start   End Flags   Partition Name  File System Label   Mount Point

========================================
Device: /dev/sdd
Model:  Generic Flash Disk
Serial:
Sector size:    512
Total sectors:  15728640

Heads:  255
Sectors/track:  2
Cylinders:  30840

Partition table:    none

Partition   Type    Start   End Flags   Partition Name  File System Label   Mount Point
/dev/sdd    Unpartitioned   0   15728639            iso9660 Pop_OS 21.10 amd64 Nvidia

========================================
Create Primary Partition #1 (ext4, 447.13 GiB) on /dev/sdc  00:00:19    ( ERROR )

create empty partition  00:00:00    ( SUCCESS )

path: /dev/sdc1 (partition)
start: 2048
end: 937701375
size: 937699328 (447.13 GiB)
clear old file system signatures in /dev/sdc1  00:00:19    ( ERROR )

write 512.00 KiB of zeros at byte offset 0  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 67108864  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 274877906944  00:00:00    ( SUCCESS )
write 512.00 KiB of zeros at byte offset 480101531648  00:00:00    ( SUCCESS )
write 4.00 KiB of zeros at byte offset 480101990400  00:00:00    ( SUCCESS )
write 8.00 KiB of zeros at byte offset 480102047744  00:00:00    ( SUCCESS )
flush operating system cache of /dev/sdc  00:00:18    ( ERROR )

libparted messages    ( ERROR )

Input/output error during write on /dev/sdc
Error fsyncing/closing /dev/sdc: Input/output error

After checking my Disks menu, I can see the KINGSTON SA400S3 drive mounted on /dev/sde.
How can I fix this?

A: Bad news: your disk is probably dead. Check log (journalctl -r), you'll probably see some I/O errors there too. You can also try running SMART test to check the disk health (GNOME Disks can do that too).
It is also possible the disk itself is OK and this is just a bad cable/connection. Disk that disappeared and reappeared after being disconnected and reconnected would explain the change from /dev/sdc to /dev/sde (these are not mount points, but device files representing the raw block device assigned by kernel when the block device (disk) appears).

A: and thanks for your answer!
journalctl -r indeed contains I/O errors, such as :
Apr 02 17:34:27 pop-os kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.SAT0.SPT4._GTF.DSSP], AE_NOT_FOUND (20210930/psargs-330)

Apr 02 17:34:55 pop-os kernel: Buffer I/O error on dev sde, logical block 0, async page read
Apr 02 17:34:55 pop-os kernel: I/O error, dev sde, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Apr 02 17:34:55 pop-os kernel: I/O error, dev sde, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0

However, my disk passes the SMART!
=== START OF INFORMATION SECTION ===
Model Family:     Phison Driven SSDs
Device Model:     KINGSTON SA400S37480G
Serial Number:    50026B73811B943A
LU WWN Device Id: 5 0026b7 3811b943a
Firmware Version: S3H01103
User Capacity:    480,103,981,056 bytes [480 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
TRIM Command:     Available
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-3 T13/2161-D revision 4
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Apr  2 17:52:45 2022 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x02) Offline data collection activity
                    was completed without error.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:        (  120) seconds.
Offline data collection
capabilities:            (0x11) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Suspend Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    No Selective Self-test supported.
SMART capabilities:            (0x0002) Does not save SMART data before
                    entering power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    (  10) minutes.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x0032   100   100   000    Old_age   Always       -       100
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       374
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       71
148 Unknown_Attribute       0x0000   100   100   000    Old_age   Offline      -       0
149 Unknown_Attribute       0x0000   100   100   000    Old_age   Offline      -       0
167 Write_Protect_Mode      0x0000   100   100   000    Old_age   Offline      -       0
168 SATA_Phy_Error_Count    0x0012   100   100   000    Old_age   Always       -       9965
169 Bad_Block_Rate          0x0000   100   100   000    Old_age   Offline      -       0
170 Bad_Blk_Ct_Erl/Lat      0x0000   100   100   010    Old_age   Offline      -       0/0
172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
173 MaxAvgErase_Ct          0x0000   100   100   000    Old_age   Offline      -       0
181 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
182 Erase_Fail_Count        0x0000   100   100   000    Old_age   Offline      -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
192 Unsafe_Shutdown_Count   0x0012   100   100   000    Old_age   Always       -       18
194 Temperature_Celsius     0x0022   026   026   000    Old_age   Always       -       26 (Min/Max 16/26)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
199 SATA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
218 CRC_Error_Count         0x0032   100   100   000    Old_age   Always       -       9965
231 SSD_Life_Left           0x0000   100   100   000    Old_age   Offline      -       100
233 Flash_Writes_GiB        0x0032   100   100   000    Old_age   Always       -       528
241 Lifetime_Writes_GiB     0x0032   100   100   000    Old_age   Always       -       994
242 Lifetime_Reads_GiB      0x0032   100   100   000    Old_age   Always       -       462
244 Average_Erase_Count     0x0000   100   100   000    Old_age   Offline      -       7
245 Max_Erase_Count         0x0000   100   100   000    Old_age   Offline      -       21
246 Total_Erase_Count       0x0000   100   100   000    Old_age   Offline      -       3891

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%       374         -
# 2  Extended offline    Aborted by host               70%       372         -
# 3  Extended offline    Aborted by host               70%       372         -
# 4  Extended offline    Aborted by host               70%       372         -
# 5  Extended offline    Completed without error       00%       370         -
# 6  Extended offline    Completed without error       00%       370         -

Selective Self-tests/Logging not supported

I will try to change the SATA port in which my drive is connected & the cable, and if that does not change anything, I guess it's back to the drawing board.

A: Problem is now solved!
The cause of my problems has been found : my SATA port seems to be faulty. I switched from SATA_5 to SATA_6 and I managed to partition my drive successfully!


text:
Q: gulp-webpack can't resolve node modules building a modern Angular app here.
I am using gulp-webpack for fast development builds. I need webpack for my typescript bundling because I am obviously relying on some node modules. But weirdly enough, gulp-webpack doesn't seem to be automatically resolving imports to my node_modules directory! As a consequence, it throws about a million typescript errors saying it can't find the modules, and my bundle doesn't have, for example, angular in it.
Here's my (abbreviated) gulpfile:
var gulp = require('gulp')
var path = require('path');
// var concat = require('gulp-concat')
var expect = require('gulp-expect-file')
var plumber = require('gulp-plumber')
var sourcemaps = require('gulp-sourcemaps')
// var uglify = require('gulp-uglify')

var webpack = require('gulp-webpack')
var sass = require('gulp-sass')
var nodemon = require('gulp-nodemon')
var ts = require('gulp-typescript')
var del = require('del')
var rename = require('gulp-rename')
var inject = require('gulp-inject-string')
// Client-side javascript to single js file
gulp.task('js', function ()
{
    gulp.safeSrc('src/app/main.ts')
        .pipe(sourcemaps.init())
        .pipe(webpack({
        context: __dirname,
        entry: ['./src/app/main'],
        resolve: {
            modulesDirectories: ["./node_modules"],
            extensions: ['.ts', '.js']
        },
        resolveLoader: {
            root: path.resolve(__dirname, 'node_modules')
        },
        output: {
            filename: "bundle.js"
        },
        module: {
            loaders: [
                {
                test: /\.js$/,
                loader: 'babel-loader'
                },
                {
                test: /\.ts$/,
                loader: 'ts-loader'
                }
            ],
        },
    }))
        .pipe(sourcemaps.write())
   .pipe(gulp.dest('public'))
})

And here's my app.component.ts -- I start getting errors right away with import 'zone.js'

ERROR in ./src/app/app.component.ts Module not found: Error: Cannot
  resolve module 'zone.js' in C:\appdir\src\app  @
  ./src/app/app.component.ts 12:0-18

import 'zone.js';
import 'reflect-metadata';
import { Component } from '@angular/core';

import { Observable } from 'rxjs/Rx';
import { Store } from '@ngrx/store';
import { AppStore } from '../models/application-store';
import { AuthSvc } from './auth/auth.svc';

import { Action } from './actions'

@Component({
  selector: 'my-app',
  template: `
  <div class="app">
     <main-header>
     </main-header>
     <router-outlet></router-outlet>
  </div>`

})

export class AppComponent {
   error: any;
   showNgFor = false;
   constructor ()
   {

   }
}

What's going on?

A: gulp-webpack is an absolutely ancient npm package.
The solution here is to use webpack-stream, which is up to date with webpack 3.0

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting the Size of a NSImage allocated with NSData NSImage *testImages;
NSURL *testImageUrl = [NSURL URLWithString:@"file:///foo/testImage.png"];
NSData *imageData = [testImageUrl resourceDataUsingCache:NO];
testImages = [[NSImage alloc] initWithData:imageData ];

How do I get the NSSize of testImages. In the debugger I can read it with from the _NSSize property but [testImages size] return (0,0)
I need it determine if it's a landscape or portrait image before I do various transformations.
This worked but I don't know why?
NSArray *representation = [testImages representations];
NSImageRep *repOne = [representation objectAtIndex:0];
int width = [repOne pixelsWide];
return width;

A: In NSImage class, We do have property, which give us the size of image in NSImage.
- (NSSize)size
   NSSize size = testImages.size;

A:
"...but [testImages size] return (0,0)"

Always consider whether, at some point in your code, some method or call returned nil where you weren't expecting it. Then walk your way back up the code to figure out where your code (or your assumptions) went wrong.
NSURL *testImageUrl = [NSURL URLWithString:@"file:///foo/testImage.png"];
NSData *imageData = [testImageUrl resourceDataUsingCache:NO];
NSImage *testImages = [[NSImage alloc] initWithData:imageData ];
NSSize size = [testImages size];

If for some reason the URLWithString: call failed, it would return nil. Sending the -resourceDataUsingCache: message to nil would basically result in nil (it's just ignored). Trying to create an NSImage with nil passed in for the data parameter will return nil. And sending the -size message to nil will basically result in nil, which will equal a size of {0, 0}.
So, double-check to make sure your messages weren't just being sent to nil.
Just another note, but you usually use +fileURLWithPath: when creating file-based NSURLs and +URLWithString: when creating other types of URLs.


text:
Q: sqrt function gets error in racket I'm trying to build a simple function that gets a number, checks if the number is more the zero and return the square root of the number:
#lang pl 03

    (: sqrtt: Number -> Number)

    (define (sqrtt root)
      (cond [(null? root) error "no number ~s"]
            [( < root 0) error "`sqrt' requires a non-negative input ~s"]
            [else (sqrt root)]))

but the result I get when I'm trying to compile the function is:

type declaration: too many types after identifier in: (: sqrtt: Number
  -> Number)

Why am I getting that error and how do I fix it?

A: Try this:
(define (sqrtt root)
  (cond [(null? root) (error "no number ~s")]
        [(< root 0)   (error "`sqrt' requires a non-negative input ~s")]
        [else (sqrt root)]))

You simply forgot the () around error. Remember that error is a procedure and, like all other procedures, to apply it you have to surround it with parentheses together with its arguments.

A: The error message you're getting tells you that you have too many types after an identifier in a : type declaration. Now in racket, sqrtt: counts as an identifier. What you probably meant was sqrtt :, with a space in between.
(: sqrtt : Number -> Number)

The difference is that type declarations of the form (: id : In ... -> Out) are treated specially, but those of the form (: id In ... -> Out) are not. And sqrtt: is counts as the id.
There's also the problem Oscar Lopez pointed out, where you're missing parens around the error calls. Whenever you call a function in racket, including error, you need to wrap the function call in parens.
Also, the (null? root) clause is useless, since root has the type Number and null? will always return false for numbers.
And another thing, depending on what the pl language does, if you get a type error from < afterwards, that's because < operates on only Real numbers, but the Number type can include complex numbers. So you might have to change the type to Real or something.


text:
Q: Cant access json file from 000webhost.com I am using 000webhost.com to host my files, and i can access them via web browser, is there any setting that I should be aware on the webhost to make my files available to my android app.
I cant access json file or even images folder via android, when retrofit's onFailure() method gets executed, the printStackTrace method says:
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err: java.net.UnknownHostException: Unable to resolve host "http": No address associated with hostname
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.net.InetAddress.lookupHostByName(InetAddress.java:457)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.net.InetAddress.getAllByName(InetAddress.java:215)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.Dns$1.lookup(Dns.java:39)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:173)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.RouteSelector.nextProxy(RouteSelector.java:139)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.RouteSelector.next(RouteSelector.java:81)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:127)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:289)
04-05 16:41:49.342 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.RealCall.getResponse(RealCall.java:240)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.RealCall.access$100(RealCall.java:30)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.lang.Thread.run(Thread.java:818)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err: Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at libcore.io.Posix.android_getaddrinfo(Native Method)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
04-05 16:41:49.343 23509-23509/com.hanselandpetal.catalog W/System.err:     ... 20 more

Here the http address I am using:
public static final String ENDPOINT =
            "http://services.hanselandpetal.com";
    public static final String ENDPOINT2 =
            "http://ajay_pyaraka.site88.net";

Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(ENDPOINT2)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        FlowersAPI service = retrofit.create(FlowersAPI.class);
        Call<List<Flower>> call = service.getFeed2();

        call.enqueue(new Callback<List<Flower>>() {
            @Override
            public void onResponse(Call<List<Flower>> call, Response<List<Flower>> response) {
                if (response.isSuccessful()) {
                    flowerList = response.body();
                    updateDisplay();
                }

            }

            @Override
            public void onFailure(Call<List<Flower>> call, Throwable t) {
                Toast.makeText(MainActivity.this, "Failure", Toast.LENGTH_SHORT).show();
                t.printStackTrace();
            }

        });

I was able to get from the first var ENDPOINT, but not with the second ENDPOINT2

A: It seems the under score present in the domain is the problem. I tried with another domain name with no underscores and it worked


text:
Q: элементы в RowBuilder если большое количество то начинает тормозить, как это исправить? использую кастомный Row с builder:
import 'package:flutter/material.dart';

class RowBuilder extends StatelessWidget {
  final IndexedWidgetBuilder itemBuilder;
  final MainAxisAlignment mainAxisAlignment;
  final MainAxisSize mainAxisSize;
  final CrossAxisAlignment crossAxisAlignment;
  final TextDirection textDirection;
  final VerticalDirection verticalDirection;
  final int itemCount;
  const RowBuilder({
    Key key,
    @required this.itemBuilder,
    @required this.itemCount,
    this.mainAxisAlignment: MainAxisAlignment.start,
    this.mainAxisSize: MainAxisSize.max,
    this.crossAxisAlignment: CrossAxisAlignment.center,
    this.textDirection,
    this.verticalDirection: VerticalDirection.down,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return new Row(
      mainAxisAlignment: mainAxisAlignment,
      children: new List.generate(
          this.itemCount, (index) => this.itemBuilder(context, index)).toList(),
    );
  }
}

для дальнейшего использования внутри SingleChildCcrollView или Expanded(мне нужно прописать на подобии ListView.builder но без возможности прокрутки и чтобы все элементы поместились внутри родительского виджета) в приложении:
RowBuilder(
     itemCount: list.length,
     itemBuilder: (context, index){
        return Text('Text: ${index}');
})

но при большом объеме элементов начинает тормозить приложение, как можно это исправить?

A: А такой способ чем вам не подошел?
ListView.builder(
  scrollDirection: Axis.horizontal,
  itemCount: 10000,
  itemBuilder: (context, index) {
    return Text('Text: $index');
  },
),

Не уверен что, что-то поменялось:
class RowBuilder extends StatelessWidget {
  final IndexedWidgetBuilder itemBuilder;
  final MainAxisAlignment mainAxisAlignment;
  final MainAxisSize mainAxisSize;
  final CrossAxisAlignment crossAxisAlignment;
  final TextDirection textDirection;
  final VerticalDirection verticalDirection;
  final int itemCount;
  const RowBuilder({
    Key key,
    @required this.itemBuilder,
    @required this.itemCount,
    this.mainAxisAlignment: MainAxisAlignment.start,
    this.mainAxisSize: MainAxisSize.max,
    this.crossAxisAlignment: CrossAxisAlignment.center,
    this.textDirection,
    this.verticalDirection: VerticalDirection.down,
  }) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return new Row(
      mainAxisAlignment: mainAxisAlignment,
      children: [
        for (int i = 0; i < this.itemCount; i++) this.itemBuilder(context, i),
      ],
    );
  }
}


text:
Q: IndexError: tuple index out of range connecting Python to PostgreSQL I know this question has been asked a number of times, but i am stuck here unable to proceed further. I am executing a for loop in python to load data to fact table.
I am executing the below code
for index, row in df.iterrows():

# get songid and artistid from song and artist tables
cur.execute(song_select, (row.song, row.artist, row.length))
results = cur.fetchone()

if results:
    song_id, artist_id = results
else:
    song_id, artist_id = None, None

# insert songplay record

songplay_data = (pd.to_datetime(row.ts, unit='ms'),row.userId,row.level,song_id,artist_id,row.sessionId,row.location,row.userAgent)
cur.execute(songplay_table_insert, songplay_data)
conn.commit()

and getting the error
<ipython-input-22-b8b0e27022de> in <module>()
 13
 14     songplay_data = (pd.to_datetime(row.ts, unit='ms'),row.userId,row.level,song_id,artist_id,row.sessionId,row.location,row.userAgent)
 15     cur.execute(songplay_table_insert, songplay_data)
 16     conn.commit()
 IndexError: tuple index out of range

My table i am trying to insert is
songplay_table_insert = ("""INSERT INTO songplays (songplay_id, start_time,
user_id, level, song_id, artist_id, session_id, location, user_agent )
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)

I am really stuck, any help appreciated.

A: You have one too many %s markers.
VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s)

has 9 markers, while
songplay_data = (pd.to_datetime(row.ts, unit='ms'),row.userId,row.level,song_id,artist_id,row.sessionId,row.location,row.userAgent)

has 8 elements. When it tries to evaluate the last marker, it looks for the 9th element, i.e. songplay_data[8], and that raises the error.
You will also need to remove songplay_id from the SQL to make the INSERT statement valid. The database should be generating the primary key for you if you don't have a value to provide, if not we should take a look at your table definition.


text:
Q: Kotlin functional way I'm trying to perfect myself in Kotlin with functional programming. And then I did this:
I was tired of the way I write try - catch, and created the following function:
package com.learning.functionalway

fun <T> tryCatch(t: T?, excpetion: (Throwable)): T? = try {
    t
} catch (e: Exception) {
    throw excpetion
}

And I used it like this:
@Service
class ProductService(val repository: IProductRepository, val repositoryS: IStockRepository) : IService<Product, ProductModel> {

    override fun find(id: Long) = tryCatch(
            repository.find(id),
            DataNotFound("Product not found"))

other methods ..
}

And my exception that I deal in the "Exception Handler"
class DataNotFound(message: String?) : Exception(message) {
}

Is this a correct way I used to modify the way I use try - catch?
Or are there better ways to do it?

A: Your solution is not a "more functional" way of doing error handling but rather just arguably a slight improvement in try-catch syntax.
If you truly want to embrace functional programming, I'd recommend you to check out Arrow. The standard Kotlin library is not enough for advanced functional programming concepts (such as error handling) and Arrow fills that gap.
You can read their documentation on how to do proper error handling.
If you fancy a talk about it, I'd recommend you to check out this video (topic of error handling starts here) which is about Kotlin and functional programming.

A: One way to remake the try-catch syntax to make it more functional is like this:
sealed class Try<out Output> {
    class Some<Output>(val output: Output) : Try<Output>()
    class None(val exception: Exception) : Try<Nothing>()

    companion object {
        operator fun <Output> invoke(toTry: () -> Output) = try {
            Some(toTry())
        } catch (e: Exception) {
            None(e)
        }
    }

    val value get() = when(this) {
        is Some -> output
        is None -> null
    }

    infix fun catch(onException: (Exception) -> Unit): Output? = when (this) {
        is Some -> output
        is None -> {
            onException(exception)
            null
        }
    }
}

class ProductService(val repository: IProductRepository, val repositoryS: IStockRepository) : IService<Product, ProductModel> {
    override fun find(id: Long): Product? = Try {
        repository.find(id)
    } catch { exception ->
        println("Error trying to get product $exception")
    }
    //other methods ..
}

The key advantage here is that unlike in the original syntax you can do things by parts. So if you have a lot of tries to do and want to handle all the results at the end, with this syntax you can.


text:
Q: R: How to extract value generated inside function I want extract a value inside of a pre-defined function. For example:
sample <- function(x,y){
  p = rnorm(x,y)
  estim = mean(p)
  estim
}

Suppose this is a pre-defined function so I cannot change it after running it. Is it possible for me to also store/read the p generated when I am calling the function?


text:
Q: Can't Update MySQL table I don't know what I'm doing wrong, but my little update code is giving me an error message that I can't work out how to resolve it.
Here's my code:
<?php

     include('dbconfig.php');
     $con = mysql_connect($host, $username, $password) or die(mysql_error()) ;

     if (!$con){
         die('Could not connect: ' . mysql_error());
      }
        mysql_select_db($db, $con);

       function sqlEscape($string){
          return "'".mysql_real_escape_string($string)."'";
       }

        if(isset($_POST['submit'])){

    $q  =  "UPDATE records SET `name` = " + sqlEscape($_POST['name']) + ",
    `age` = " + sqlEscape($_POST['age']) + ",
    `location` = " + sqlEscape($_POST['location']) + ",
    `telephone` = " + sqlEscape($_POST['telephone']) + "

     WHERE id = $_POST[id]";

     mysql_query($q) or die(mysql_error());

     }
  ?>

Here's the error message it prints out:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1

Can someone see where I'm going wrong at all?
Thanks for your help.

A: You are adding strings together with the + operator, which is for adding numbers. In PHP, strings are concatenated with the . (period) operator.
$q = "UPDATE records SET `name` = " . sqlEscape(...) . ",

etc

A: $q  =  "UPDATE records SET `name` = " . sqlEscape($_POST['name']) . ",
    `age` = " . sqlEscape($_POST['age']) . ",
    `location` = " . sqlEscape($_POST['location']) . ",
    `telephone` = " . sqlEscape($_POST['telephone']) . "

     WHERE id = $_POST[id]";

Use "." instead of "+" to concat strings in PHP.


text:
Q: Vulkan error: must write gl_Position Hello!
I have followed this tutorial about Vulkan: https://vulkan-tutorial.com. But the problem is that when I start my application, this error came:
Validation layer: Vertex info
-----------
(0) : error C5145: must write to gl_Position

Failed to create graphics pipeline

This happens when the graphics pipeline got created too.
I only found answer for OpenGL but not for Vulkan.
I tried to rewrite the code that reads the file but nothing.
Here the code of VkShader.cpp (contains the Shader Module)
IOManager::FIOManagerFile shaderCode = IOManager::ReadBinaryFile(filename);

vk::ShaderModuleCreateInfo createInfo = vk::ShaderModuleCreateInfo()
    .setCodeSize(shaderCode.Size)
    .setPCode(reinterpret_cast<const uint32*>(shaderCode.Contents));

if (context->GetDevice().createShaderModule(&createInfo, nullptr, &ShaderModule) != vk::Result::eSuccess)
{
    throw std::runtime_error("Failed to create shader module for shader " + filename);
}

and IOManager.h
struct FIOManagerFile
{
    size_t Size;
    char* Contents;
};

static inline FIOManagerFile ReadBinaryFile(const std::string& filename)
{
    std::ifstream file(filename, std::ios::ate | std::ios::in | std::ios::binary);

    if (file.is_open())
    {
        size_t fileSize = (size_t)file.tellg();
        char *buffer = new char[fileSize];
        file.seekg(0, std::ios::beg);
        file.read(buffer, fileSize);
        file.close();

        FIOManagerFile f;
        f.Size = fileSize;
        f.Contents = buffer;
        return f;
    }
    else
    {
        throw std::runtime_error("Failed to open file " + filename);
    }
}

Have a nice day.

A: It's unlikely that the file IO code has anything to do with this error.  It sounds like you're not attaching a vertex shader to the pipeline, or that you've compiled the GLSL for the vertex shader incorrectly.
When compiling the GLSL to Spir-V your vertex shader input file should have the extension .vert or you need to specify on the command line that you're compiling a vertex shader.  When building the graphics pipeline you need to, at minimum, add two shader modules, one vertex shader and one fragment shader, each using a vk::PipelineShaderStageCreateInfo to wrap the shader modules you're creating.

A: Did you perhaps forget to assign a value to gl_position in your shader?  Your vertex shader should have some lines like:
void main() {
      gl_Position = mvp * vec4(inPosition, 1.0);
}

If this is not it, could you post your vertex shader code?


text:
Q: How to speed up iteration? I got this code, and I want to iterate over a csv file with ~100000 columns.
This script do run very slowly to iterate over that number of columns.
Do any of you have a possible solution to speed up my code?
import pandas as pd
import matplotlib.pyplot as plt
import math

a=pd.read_csv('test.csv', sep = ';', skiprows=[1,2],usecols = [1,2,3,4],dtype=float, decimal=',')
v1 = (math.sqrt(2)/math.sqrt(3))
v2 = (1/math.sqrt(6))
v3 = (1/math.sqrt(6))
v4 = (1/math.sqrt(2))
v5 = (1/math.sqrt(2))

fig=plt.figure()
ax=fig.add_axes([0,0,1,1])

for i in range(len(a)):
    id = ((v1*a.iloc[i,1])-(v2*a.iloc[i,2])-(v3*a.iloc[i,3]))
    iq = (v4*a.iloc[i,2])-(v5*a.iloc[i,3])
    ax.scatter(id,iq)
    print(i)

plt.show()

This is a look into my  csv data:
time;A;B;C;D
(s);(mV);(mV);(mV);(mV)

0,00000000;5,43279200;-19,49701000;5,09095300;1,83738200
0,00010000;6,84287600;-17,72677000;12,59309000;2,53937200
0,00020000;4,02270800;-20,08302000;-1,94725900;2,77743900
0,00030000;4,37675500;-17,84275000;9,07703500;2,30741000
0,00040000;5,66475400;-18,90490000;12,70907000;-6,98937800
0,00050000;2,61872800;-18,43487000;4,73690600;-2,28299400
0,00060000;4,26077400;-17,01868000;12,59309000;-5,81125600
0,00070000;4,02270800;-17,61079000;17,98926000;-6,51935100
0,00080000;2,02661500;-17,01868000;10,48102000;-5,93334100
0,00090000;3,08265200;-15,72458000;17,28116000;-7,45940700
0,00100000;-0,20144060;-18,08082000;3,68086900;-6,63533100
0,00110000;3,43669900;-7,34953000;17,75119000;-6,28738900
0,00120000;1,67867200;-17,25674000;16,81724000;-4,40117200
0,00130000;-0,67146870;-15,84056000;13,41716000;-6,28738900
0,00140000;-0,43340250;-14,90050000;15,05921000;-0,51886220
0,00150000;-3,13759000;-16,78672000;3,44890700;-0,04883409
0,00160000;6,25686700;-12,06812000;17,51923000;-3,57709700

A: Edit
The OP is having trouble reading the CSV file, presumably because of the 2-row header and the slightly unusual separator (and the decimal comma).
Here is a way to read such a file:
a = pd.read_csv(io.StringIO(txt), sep=';', decimal=',', header=[0,1])

>>> a
     time         A         B          C         D
      (s)      (mV)      (mV)       (mV)      (mV)
0  0.0000  5.432792 -19.49701   5.090953  1.837382
1  0.0001  6.842876 -17.72677  12.593090  2.539372
2  0.0002  4.022708 -20.08302  -1.947259  2.777439
...

To drop the units from the columns (facilitate indexing):
a.columns = a.columns.droplevel(1)

Then, in the expression below, replace a[1] by a['A'], etc. to get:
df = pd.DataFrame([
    v1 * a['A'] - v2 * a['B'] - v3 * a['C'],
    v4 * a['B'] - v5 * a['C'],
])

Original answer
While the time spent computing your x and y values, if you do it right, is negligible (10 ms per million rows), the time plotting all the points is not.
For 100K points, it's still tolerable, but if you have millions, consider using hist2d(), or Seaborn's jointplot() instead. Bonus, the latter also plots the marginal distributions:
a = pd.DataFrame(np.random.normal(size=(1_000_000, 4)))
v1 = np.sqrt(2/3)
v2 = 1 / np.sqrt(6)
v3 = v2
v4 = 1 / np.sqrt(2)
v5 = v4

df = pd.DataFrame(dict(
    id_=v1 * a[1] - v2 * a[2] - v3 * a[3],
    iq=v4 * a[2] - v5 * a[3]),
)
# timeit of this gives 9.89 ms ± 9.13 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%%timeit
df.plot.scatter('id_', 'iq')
plt.show()
# timeit (makes multiple plots) and indicates:
# 2.91 s ± 11.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

Instead:
%%timeit
sns.jointplot(
    data=df, x='id_', y='iq', kind='hex',
    marginal_kws=dict(bins=50),
    joint_kws=dict(bins=50),
)
plt.show()
# indicates:
# 852 ms ± 1.73 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

A: Don't use loop, scatter can take array-like as argument:
Sample:
# a = pd.DataFrame(np.random.random((100000, 4)), columns=['A', 'B', 'C', 'D'])
>>> a
              A         B         C         D
0      0.797683  0.819883  0.190643  0.838554
1      0.494024  0.757094  0.863671  0.492803
2      0.935607  0.272122  0.834900  0.707307
3      0.635601  0.329287  0.703526  0.984984
4      0.117422  0.583254  0.399773  0.182749
...         ...       ...       ...       ...
99995  0.182855  0.960854  0.531180  0.242445
99996  0.632885  0.607970  0.043772  0.080374
99997  0.570511  0.214377  0.063418  0.810628
99998  0.401211  0.713925  0.573271  0.500783
99999  0.028511  0.470635  0.315194  0.019288

[100000 rows x 4 columns]

Code:
x = (v1*a[1]) - (v2*a[2]) - (v3*a[3])
y = (v4*a[2])-(v5*a[3])

fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.scatter(x, y)
plt.show()


text:
Q: Error Gradle Build C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
  com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

Here is my gradle build file:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "br.com.gerenciarsc.nfce"
        minSdkVersion 12
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    }
    compile 'com.google.code.gson:gson:2.5'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.j256.ormlite:ormlite-core:4.48'
    compile 'com.j256.ormlite:ormlite-android:4.48'
    compile 'com.beardedhen:androidbootstrap:2.0.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
    compile 'com.google.zxing:core:3.2.0'
    compile 'br.com.uol.ps:library:0.8'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'javax.xml.crypto:jsr105-api:1.0.1'
    compile ('commons-io:commons-io:2.4'){
        exclude group: 'org.apache.commons.collections', module: 'org.apache.commons.collections'
    }
}

A: I faced the same issue. Scrolling down, I found the following error in the logs:

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main :
  Unsupported major.minor version 52.0

Then I searched for the above error and found the following work-around as suggested by the solutions to this question and another similar question:
In the file build.gradle(Module:app) I changed the following from:
buildToolsVersion "24.0.0"
to
buildToolsVersion "23.0.2"
and clicked the button to "sync project with gradle files" in Android Studio and the error vanished.
Note: I didn't understand the exact reason for the error and it's solution completely but it seems to be a compatibility issue of java version 1.7 and Android API level 24. Some people suggested (on the questions' links I mentioned) to use JDK version 8 with API 24, or downgrade it to JDK version 7 and API level 23.0.x as a work around.

A: Found cause and solution.
All at the sudden this happened, when I created a class with the same signature (package and name) in 2 different projects of my environment and started the App to try it. Got that message.
I discovered it by adding multiDexEnabled true and new error message appeared with duplicated class found.
So, I refactored the class (changed package name), also removed multiDexEnabled support as it was before, the App started.

A: I also faced the same issue after did reach i got resolved. issue could be the classes folder not created under build directory while you build the project, the reason for that the project path may not correct. so you have to correct the project path and rebuild that it will work fine. java files should be under path \src\main\java for gradle proejct

A: I've got this error:

Execution failed for task
  ':vvm:transformClassesWithDesugarForRelease'.
  com.android.build.api.transform.TransformException:
  org.gradle.process.internal.ExecException: A problem occurred starting
  process 'command 'E:\Java\jdk1.8.0_181\bin\java.exe''

I've solved it by updating gradle from 4.4 to 5.4

A: I also faced the same issue after did reach i not resolved. instead of applied two approaches as follows:
Process 1: Update plugin with build.gradle
plugins {
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}

Process 2: Update the JAVA path while executing the application inside the IDE
Still it is not working.

A: In my case, I changed buildToolVersion in build.gradle(module:app) to 23.0.2
then the app is running.


text:
Q: How tf.Session.run work when fetch include both Operation and Tensor? The value in the red rectangle is confusing:

The description of Session.run:

Why the value of Variable tmpA is 1.0, it should be 9999.0 since the value of B is 10001.0
Can somebody explain how the function tf.Session.run work?

A: I recommend that you check the graph with Tensorboard. The order of calculation cause this result.
When you run line 13 sess.run([A, ops, B]), the program

*

*fetch the value of A for tmpA (1.0)

*assign 9999 to A

*calculate B

So the value of tmpA is 1.0, and tmpBB is 10001.
Actually the order of evaluation of [A, ops, B] is not deterministic, so there is a possibility that tmpA become 9999 and tmpBB become 3.


text:
Q: Which is more efficient, separate xmls for similar objects or same xml, but settext in oncreate for each? I have an app that displays information about weapons in a game. The way i have it now is that all the weapons share the same XML file becuase they all need to show the same information(e.g dmg,RPM, etc) however i was wondering if there is any performance benefits of having a separate XML for every weapon instead of the way i have it now where i settext in the oncreate of every weapon(Every weapon is its own activity).
There is probably some better way to not have all the weapons as a separate activity but im quite new to android and programming in general so.. xD


text:
Q: how define programmaticaly if app is run on iphone 5 I work on image scaling. How to find out if app is run on iphone 5? Need to know if screen height is 960 or 1136..

A: #define IS_IPHONE5 ([[UIScreen mainScreen] bounds].size.height == 568)

if (IS_IPHONE5) {
    NSLog(@"iPhone 5");
} else {
    NSLog(@"iphone 4s or lower");
}

A: Check the height of screen
int height =  [[UIScreen mainScreen] bounds].size.height;
if(height > 480){
    NSLog(@"iPhone 5");
}
else{
    NSLog(@"iPhone 4, 4s....");
}

A: You might want to use +[UIScreen mainScreen] to get the screen dimensions.


text:
Q: is there a functiojn to break a text and keep it in the next line inside a container in flutter? Container(
height: 100,
width: 320,
child: Text(
domaindesc,
softWrap: true,
overflow: TextOverflow.ellipsis,
style: GoogleFonts.roboto(textStyle: ktextstyle),
),
),

A: If you mean creating a new line in the same text paragraph? add this '\n' where you want a new line to start.
Also if you want to change the fontstyle for different parts of the text (e.g. on a new line, for example) you can use TextSpan. Example borrowed from the Flutter docs with '\n' new line inserted to illustrate:
return Container(
              child: RichText(
            text: TextSpan(
              text: 'Hello \n ',
              style: DefaultTextStyle.of(context).style,
              children: const <TextSpan>[
                TextSpan(
                    text: 'bold',
                    style: TextStyle(fontWeight: FontWeight.bold)),
                TextSpan(text: ' world!'),
              ],
            ),
          ));


text:
Q: Best way to comparing perormance of different version of library Currently for each call in library,I am doing multiple iteration , Measuring time taken for each call and then calculating :

*

*Average time taken for each call

*Min time take

*Max time taken

*Standard Deviation

But it seems its not a good method . As these time depends upon state of machine ,As if CPU is busy with other process result will be impacted.
Please suggest me still if its a good way.Or i can use some better method.

A: It is a good measure of the basic speed of the algorithm but finding total performance is dependent on how you use something. The number of instructions is not useful, either.
For example, say you have some func doMath() written in C, and some templated doMath call that takes 3-4 templated arguments. The C func will often show worse performance in a simple case. However, in a medium to large program the templates will grow to dozens or hundreds or even thousands instead of just one. This will choke out the instruction cache. Same applies for data - some tree implementations will have much more memory efficiency and the more bloated ones will perform better on simple tests, but in actual use they will perform much more poorly.
Similarly, it may seem like a tree has performance through basic tests, but you could find over time it fragments the memory so much that performance drops and drops over time until your program barely functions.
So, performance always depends on your actual use of something, not just its implementation. Not to say it's always a tradeoff, some implementations are better than others. Ultimately, though, the only way to get great performance is to know to a deep level exactly what the computer is doing and exactly what the compiler generates out or else it will always be a mystery to you.
That's part of why people suggest profiling, but profiling will only tell you so much, basically point the way. You will see the symptoms but often not the cause. That's because performance is based on the whole system and it's not just a simple matter of adding up the instruction count.


text:
Q: undefined reference to opencv function when i compiled with Makefile i want to compile opencv4.0 with Makefile but undefined reference error occur.
i have used to opencv in Windows and code is just simple code that only show image for test in ubuntu18.10.
but it work if i typing line below on shell.
g++ -o simple main.cpp $(pkg-config opencv4 --libs --cflags)

my Makefile is below
CC = g++
CFLAGS = -W -Wall
SRCS = main.cpp
TARGET = simple

OPENCV = $(pkg-config opencv4 --libs --cflags)
LIBS = $(OPENCV)

$(TARGET):$(SRCS)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

clean:
    rm -f $(OBJECTS) $(TARGET) core

and my opencv4.pc is below.
# Package Information for pkg-config

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/opencv4

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 4.0.0
Libs: -L${exec_prefix}/lib -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_b
Libs.private: -ldl -lm -lpthread -lrt -L/usr/lib/x86_64-linux-gnu -lGL -lGLU
Cflags: -I${includedir}

and error is below.
g++ -W -Wall -o simple main.cpp
/usr/bin/ld: /tmp/cciHsvhP.o: in function `main':
main.cpp:(.text+0x70): undefined reference to `cv::imread(cv::String const&, int)'
/usr/bin/ld: main.cpp:(.text+0xc4): undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
....
collect2: error: ld returned 1 exit status
make: *** [Makefile:11: simple] Error 1

A: I assume you're using GNU Make, since you are working on Ubuntu Linux.
I also assume what you have posted as:
$(TARGET):$(SRCS)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

is mis-formatted in the posting and that your Makefile really contains:
$(TARGET):$(SRCS)
    (CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

with the recipe command tab-indented as it must be.
In your Makefile you believe that:
OPENCV = $(pkg-config opencv4 --libs --cflags)

is a shell-expansion of the command pkg-config opencv4 --libs --cflags that
assigns the output of the command to the Make variable OPENCV. It is not.
It is simply a Make expansion of the string pkg-config opencv4 --libs --cflags,
just as in the next line:
LIBS = $(OPENCV)

$(OPENCV) is the Make expansion of the Make variable OPENCV and not the shell
expansion of a shell command OPENCV.
The string pkg-config opencv4 --libs --cflags is not a Make variable that has a value (obviously).
Neither can it be an invocation of a GNU Make-function
$(pkg-config ...), as there is no such GNU Make function.
So $(pkg-config opencv4 --libs --cflags) expands to nothing. Hence:
LIBS = $(OPENCV)

makes $(LIBS) expand to nothing, and:
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

expands to the same as:
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS)

which is why the opencv libraries are missing from your linkage and the linkage fails.
To assign the output of a shell command to a Make variable, using the $(shell ...) function:
OPENCV := $(shell pkg-config opencv4 --libs --cflags)

Then $(OPENCV) and $(LIBS) will acquire the correct value.
BTW...
Note that your clean recipe attempts to delete a file, core, that is never created by your Makefile.
And..
Be aware that the recipe:
$(TARGET):$(SRCS)
    (CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

represents in general the most inefficient possible way of automating a
program's build process with Make, because it will recompile all of the N
source files in $(SRCS) whenever you change even 1 of them. In your particular
case as posted, it doesn't matter because N = 1. But when N = 1 there is no
need for Make. In anticipation of writing more professional projects where N is large, you
might like to work through Chapter 2 An Introduction to Makefiles,
at least, in the GNU Make manual.

A: This part of your makefile is likely broken:
$(TARGET):$(SRCS)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(LIBS)

It looks like a leading tab character is missing on the second line.
It is not used, so make uses the default rule for building executables from .cpp files, which does not use the LIBS variable (only CFLAGS).


text:
Q: documents contains one or more extremely long lines of text I'm constantly receiving the following error in a very simple WebProject with 1 html file, 1 js and ext lib included.

Microsoft Visual Studio
Document contains one or more extremely long lines of text. These lines will cause the editor to respond slowly when you open the file. Do you still want to open the file?
Yes   No
My VS version is 2008. I don't have long lines in my html. I don't have DB connections. Anyone knows the reason?

A: When you say "ext lib" I assume you mean the ExtJs javascript framework. The minified version of the ExtJs framework puts the whole framework on a single line. You can test this by double clicking on the ext-all.css or ext-all.js (not ext-all-debug.js) file in Visual Studio to open it in the editor and you should see the message again. The real annoying part is that the message also shows when the ExtJs library is included in the page head as a script tag (or link tag in the case of the css file). My guess is that Visual Studio is silently opening these files in the background.


text:
Q: Linear Regression Approach For Trends I'm working on a project with genetics but I think my problem is applicable to general statistics.
I want to test frequency (Minor Allele Frequency) of a SNP/variant across 5 age categories to see if there is any change. I am expecting either linear or a 'U' shaped curve if such an association exists. I have about 1000 individuals within each age group and have calculated the allele frequency for each age group (ranging from 0.001-0.5), hence I only have 5 frequencies in total.
Now the problem is that I have 2 million variants/SNPs and so I can't plot each SNP to see the trend before I commence the regression.
Currently I propose a linear model with Frequency ~ Age to see if there is a linear trend and Frequency ~ Age + I(Age^2) to see if there is a quadratic curve. Then using a likelihood ratio test to see whether the quadratic term is significant and deducing whether there is a curve.
My question is whether this is the best approach, statistically speaking?

A: You can do somewhat better by using logistic regression instead of linear regression, but otherwise your approach is fine.
Note that with the linear model you propose, the model has no way of "knowing" that there are 1000 observations in each age band because it only "sees" the average. That means the linear model is forced to estimate variance purely from the 5 provided data points which is not very reliable. (It's also extremely likely that we will be violated the underlying assumption of normally distributed error term, although it would of course be extremely difficult to tell one way or the other with just 5 data points!) In contrast to these difficulties, a logistic regression model will be able to "see" the sample size and exploit the known relationship between n, p, and variance of the binomial distribution and we won't have to worry about violating the normality assumptions of the linear model.
To adapt your approach to logistic regression, you'll need to use a categorical variable (a factor) as the response variable instead of a continuous frequency. One way to do this is simply to replicate each row of data the appropriate number of times but another faster way to do this is with observation weights.
Let's say we format the data to look like this:
| age | variant | n_people |
|-----|---------|----------|
| 20  | 0       | 750      |
| 20  | 1       | 250      |
| 30  | 0       | 800      |
| 30  | 1       | 200      |
| 40  | 0       | 800      |
| 40  | 1       | 200      |
| 50  | 0       | 780      |
| 50  | 1       | 220      |
| 60  | 0       | 750      |
| 60  | 1       | 250      |

Then (using R, for example) we can build models which include the quadratic age term, the main (linear) effect only, and the reduced model with only an intercept.
full_model <- glm(variant ~ age + I(age^2), data=df, weights=n_people, family=binomial())
main_effects_model <- glm(variant ~ age , data=df, weights=n_people, family=binomial())
reduced_model <- glm(variant ~ 1, data=df, weights=n_people, family=binomial())

The full model looks like so (using the fake data I mocked up):
> summary(full_model)
Call:
glm(formula = variant ~ age + I(age^2), family = binomial(),
    data = df, weights = n_people)

Deviance Residuals:
    Min       1Q   Median       3Q      Max
-20.960  -19.353    3.096   25.931   26.491

Coefficients:
              Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.2617126  0.2978734  -0.879 0.379616
age         -0.0576910  0.0163196  -3.535 0.000408 ***
I(age^2)     0.0007348  0.0002017   3.643 0.000270 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 5319.2  on 9  degrees of freedom
Residual deviance: 5305.8  on 7  degrees of freedom
AIC: 5311.8

Number of Fisher Scoring iterations: 5

Note that R is helpfully performing a z-test for each coefficient, which already suggests that the quadratic age term may be statistically significant (again, for the fake data.) However, these z-tests on individual coefficients are an approximation at best, so we should use the likelihood ratio test, which is the gold standard.
Here's an example in R of using the LR test to compare the full model to the reduced model. This tells us if including age (both linear and quadratic terms) is better than excluding age from the model altogether:
> anova(full_model, reduced_model, test="LR")
Analysis of Deviance Table

Model 1: variant ~ age + I(age^2)
Model 2: variant ~ 1
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1         7     5305.8
2         9     5319.2 -2  -13.472 0.001188 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Alternatively, we could compare the full model to the main effects model with anova(full_model, main_effects_model) if we are specifically interested whether or not the inclusion of the quadratic term to the model is statistically significant:
> anova(full_model, main_effects_model, test="LR")
Analysis of Deviance Table

Model 1: variant ~ age + I(age^2)
Model 2: variant ~ age
  Resid. Df Resid. Dev Df Deviance  Pr(>Chi)
1         7     5305.8
2         8     5319.0 -1  -13.242 0.0002738 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Note that there are many approaches to this same problem, say a 5x2 $\chi^2$ test, but the logistic regression approach I've outlined above seems closest to your original proposal while avoiding some of the theoretical concerns of the linear model.


text:
Q: Extreamly simple HTML js code,but why doesn`t it work? I am trying learn to make a simple quiz.So I got a script in StackOverflow.It works here http://jsfiddle.net/Zy4gW/ ,but not when I use it ,here is my code

<title>Learning how to make a quiz</title>

Question One

Answer to Question One...

Question Two

Answer to Question Two...

Why doesn`t it run?

A: Put this on top of your script [below the title tag]
Jquery library

A: <!DOCTYPE html>

<title>Learning how to make a quiz</title>
                                    //You had not imported this library which is required for running jQuery

Question One

Answer to Question One...

Question Two

Answer to Question Two...

Your mistakes were as follows:
1) You had not imported the library required for jQuery
2) The function you were using to access the div element
      Actually div is a child element of li. You were accessing it as sibling of li.
3) No need of .each function to access li separately

A: You are using jQuery, but i can't see where you are loading the ressource.
Have a look at hosted libraries

A: You definitely want to make sure your resources are loaded properly, as noted here by others. Check your browser's dev tools to see if resources are loaded, and check the console to see if there are any errors.
I would also suggest adding a doctype to your file (at the very top, before the opening  tag:
<!DOCTYPE html>

The missing doctype might not be causing your issue - but then again, I've seen stranger things happen. Not to mention, it's best practice to always include this.


text:
Q: Cannot receive data on STM32F746 UDP socket via LwIP I've been trying to get the LwIP stack to work on my STM32F746 Discovery board, but no luck so far when it comes to receiving data. Sending works just fine, but for some reason, I can't receive any packets. Wireshark confirms that the packets are sent, but the board seems to ignore them. My assumption is that some configuration in stm32f7xx_hal_conf.h has been done incorrectly, but I have very limited experience when it comes to this, so I haven't been able to figure it out.
Here's how I initialize my socket:
int sock = socket(AF_INET, SOCK_DGRAM, 0);
struct sockaddr_in address;
int addrlen = sizeof(address);

address.sin_len = addrlen;
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port);

bind(sock, (struct sockaddr*)&address, addrlen);
printf("Listening on socket %d\n", sock);
printf("Received %d bytes\n", recv(sock, buffer, 200, 0));

The second to last line gets printed, then the thread blocks indefinitely waiting for a packet. As I said, if I'm sending data instead of receiving it, everything works fine. I also tried the callback approach to listening, to no avail.
I took the network initalization procedures and config files straight from ST's LwIP example application.
This is my stm32f7xx_hal_conf.h, I have a feeling there might be some misconfiguration here, because if I mess with some of these values, sending over the sockets stops working too.
    /**
  ******************************************************************************
  * @file    BSP/inc/stm32f7xx_hal_conf.h
  * @author  MCD Application Team
  * @brief   HAL configuration file.
  ******************************************************************************
  * @attention
  *
  *
© COPYRIGHT(c) 2016 STMicroelectronics

  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *   1. Redistributions of source code must retain the above copyright notice,
  *      this list of conditions and the following disclaimer.
  *   2. Redistributions in binary form must reproduce the above copyright notice,
  *      this list of conditions and the following disclaimer in the documentation
  *      and/or other materials provided with the distribution.
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F7xx_HAL_CONF_H
#define __STM32F7xx_HAL_CONF_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/

/* ########################## Module Selection ############################## */
/**
  * @brief This is the list of modules to be used in the HAL driver
  */
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
/* #define HAL_CAN_MODULE_ENABLED    */
/* #define HAL_CAN_LEGACY_MODULE_ENABLED    */
 #define HAL_CRC_MODULE_ENABLED
/* #define HAL_CRYP_MODULE_ENABLED   */
/* #define HAL_DAC_MODULE_ENABLED    */
#define HAL_DCMI_MODULE_ENABLED
#define HAL_DMA_MODULE_ENABLED
#define HAL_DMA2D_MODULE_ENABLED
 #define HAL_ETH_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
/* #define HAL_NAND_MODULE_ENABLED   */
#define HAL_NOR_MODULE_ENABLED
/* #define HAL_PCCARD_MODULE_ENABLED */
#define HAL_SRAM_MODULE_ENABLED
#define HAL_SDRAM_MODULE_ENABLED
/* #define HAL_HASH_MODULE_ENABLED   */
#define HAL_GPIO_MODULE_ENABLED
#define HAL_I2C_MODULE_ENABLED
#define HAL_I2S_MODULE_ENABLED
/* #define HAL_IWDG_MODULE_ENABLED   */
#define HAL_LTDC_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_QSPI_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
/* #define HAL_RNG_MODULE_ENABLED    */
#define HAL_RTC_MODULE_ENABLED
#define HAL_SAI_MODULE_ENABLED
#define HAL_SD_MODULE_ENABLED
/* #define HAL_SPDIFRX_MODULE_ENABLED */
/* #define HAL_SPI_MODULE_ENABLED    */
#define HAL_TIM_MODULE_ENABLED
#define HAL_UART_MODULE_ENABLED
/* #define HAL_USART_MODULE_ENABLED  */
/* #define HAL_IRDA_MODULE_ENABLED   */
/* #define HAL_SMARTCARD_MODULE_ENABLED */
/* #define HAL_WWDG_MODULE_ENABLED   */
#define HAL_CORTEX_MODULE_ENABLED
/* #define HAL_PCD_MODULE_ENABLED    */
/* #define HAL_HCD_MODULE_ENABLED    */

/* ########################## HSE/HSI Values adaptation ##################### */
/**
  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
  *        This value is used by the RCC HAL module to compute the system frequency
  *        (when HSE is used as system clock source, directly or through the PLL).
  */
#if !defined  (HSE_VALUE)
  #define HSE_VALUE    ((uint32_t)25000000U) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */

#if !defined  (HSE_STARTUP_TIMEOUT)
  #define HSE_STARTUP_TIMEOUT    ((uint32_t)100U)   /*!< Time out for HSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */

/**
  * @brief Internal High Speed oscillator (HSI) value.
  *        This value is used by the RCC HAL module to compute the system frequency
  *        (when HSI is used as system clock source, directly or through the PLL).
  */
#if !defined  (HSI_VALUE)
  #define HSI_VALUE    ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
#endif /* HSI_VALUE */

/**
  * @brief Internal Low Speed oscillator (LSI) value.
  */
#if !defined  (LSI_VALUE)
 #define LSI_VALUE  ((uint32_t)32000U)       /*!< LSI Typical Value in Hz*/
#endif /* LSI_VALUE */                      /*!< Value of the Internal Low Speed oscillator in Hz
                                             The real value may vary depending on the variations
                                             in voltage and temperature.  */
/**
  * @brief External Low Speed oscillator (LSE) value.
  */
#if !defined  (LSE_VALUE)
 #define LSE_VALUE  ((uint32_t)32768U)    /*!< Value of the External Low Speed oscillator in Hz */
#endif /* LSE_VALUE */

#if !defined  (LSE_STARTUP_TIMEOUT)
  #define LSE_STARTUP_TIMEOUT    ((uint32_t)5000U)   /*!< Time out for LSE start up, in ms */
#endif /* LSE_STARTUP_TIMEOUT */

/**
  * @brief External clock source for I2S peripheral
  *        This value is used by the I2S HAL module to compute the I2S clock source
  *        frequency, this source is inserted directly through I2S_CKIN pad.
  */
#if !defined  (EXTERNAL_CLOCK_VALUE)
  #define EXTERNAL_CLOCK_VALUE    ((uint32_t)12288000U) /*!< Value of the Internal oscillator in Hz*/
#endif /* EXTERNAL_CLOCK_VALUE */

/* Tip: To avoid modifying this file each time you need to use different HSE,
   ===  you can define the HSE value in your toolchain compiler preprocessor. */

/* ########################### System Configuration ######################### */
/**
  * @brief This is the HAL system configuration section
  */
#define  VDD_VALUE                    ((uint32_t)3300U) /*!< Value of VDD in mv */
#define  TICK_INT_PRIORITY            ((uint32_t)0x15U) /*!< tick interrupt priority */
#define  USE_RTOS                     0U
#define  PREFETCH_ENABLE              1U
#define  ART_ACCLERATOR_ENABLE        1U /* To enable instruction cache and prefetch */

/* ########################## Assert Selection ############################## */
/**
  * @brief Uncomment the line below to expanse the "assert_param" macro in the
  *        HAL drivers code
  */
/* #define USE_FULL_ASSERT    1 */

/* ################## Ethernet peripheral configuration ##################### */

/* Section 1 : Ethernet peripheral configuration */

/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
#define MAC_ADDR0   0x84
#define MAC_ADDR1   0x16
#define MAC_ADDR2   0x43
#define MAC_ADDR3   0xA6
#define MAC_ADDR4   0x3B
#define MAC_ADDR5   0x2A

 /* Definition of the Ethernet driver buffers size and count */
 #define ETH_RX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for receive               */
 #define ETH_TX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for transmit              */
 #define ETH_RXBUFNB                    ((uint32_t)4U)       /* 4 Rx buffers of size ETH_RX_BUF_SIZE  */
 #define ETH_TXBUFNB                    ((uint32_t)4U)       /* 4 Tx buffers of size ETH_TX_BUF_SIZE  */

/* Section 2: PHY configuration section */
 /* DP83848_PHY_ADDRESS Address*/
 #define DP83848_PHY_ADDRESS           0
 /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
 #define PHY_RESET_DELAY                 ((uint32_t)0x000000FFU)
 /* PHY Configuration delay */
 #define PHY_CONFIG_DELAY                ((uint32_t)0x00000FFFU)

 #define PHY_READ_TO                     ((uint32_t)0x0000FFFFU)
 #define PHY_WRITE_TO                    ((uint32_t)0x0000FFFFU)

 /* Section 3: Common PHY Registers */

 #define PHY_BCR                         ((uint16_t)0x00U)    /*!< Transceiver Basic Control Register   */
 #define PHY_BSR                         ((uint16_t)0x01U)    /*!< Transceiver Basic Status Register    */

 #define PHY_RESET                       ((uint16_t)0x8000U)  /*!< PHY Reset */
 #define PHY_LOOPBACK                    ((uint16_t)0x4000U)  /*!< Select loop-back mode */
 #define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100U)  /*!< Set the full-duplex mode at 100 Mb/s */
 #define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000U)  /*!< Set the half-duplex mode at 100 Mb/s */
 #define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100U)  /*!< Set the full-duplex mode at 10 Mb/s  */
 #define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000U)  /*!< Set the half-duplex mode at 10 Mb/s  */
 #define PHY_AUTONEGOTIATION             ((uint16_t)0x1000U)  /*!< Enable auto-negotiation function     */
 #define PHY_RESTART_AUTONEGOTIATION     ((uint16_t)0x0200U)  /*!< Restart auto-negotiation function    */
 #define PHY_POWERDOWN                   ((uint16_t)0x0800U)  /*!< Select the power down mode           */
 #define PHY_ISOLATE                     ((uint16_t)0x0400U)  /*!< Isolate PHY from MII                 */

 #define PHY_AUTONEGO_COMPLETE           ((uint16_t)0x0020U)  /*!< Auto-Negotiation process completed   */
 #define PHY_LINKED_STATUS               ((uint16_t)0x0004U)  /*!< Valid link established               */
 #define PHY_JABBER_DETECTION            ((uint16_t)0x0002U)  /*!< Jabber condition detected            */

 /* Section 4: Extended PHY Registers */
 #define PHY_SR                          ((uint16_t)0x10U)    /*!< PHY status register Offset                      */
 #define PHY_MICR                        ((uint16_t)0x11U)    /*!< MII Interrupt Control Register                  */
 #define PHY_MISR                        ((uint16_t)0x12U)    /*!< MII Interrupt Status and Misc. Control Register */

 #define PHY_LINK_STATUS                 ((uint16_t)0x0001U)  /*!< PHY Link mask                                   */
 #define PHY_SPEED_STATUS                ((uint16_t)0x0002U)  /*!< PHY Speed mask                                  */
 #define PHY_DUPLEX_STATUS               ((uint16_t)0x0004U)  /*!< PHY Duplex mask                                 */

 #define PHY_MICR_INT_EN                 ((uint16_t)0x0002U)  /*!< PHY Enable interrupts                           */
 #define PHY_MICR_INT_OE                 ((uint16_t)0x0001U)  /*!< PHY Enable output interrupt events              */

 #define PHY_MISR_LINK_INT_EN            ((uint16_t)0x0020U)  /*!< Enable Interrupt on change of link status       */
 #define PHY_LINK_INTERRUPT              ((uint16_t)0x2000U)  /*!< PHY link status interrupt mask                  */

/* ################## SPI peripheral configuration ########################## */

/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
* Activated: CRC code is present inside driver
* Deactivated: CRC code cleaned from driver
*/

#define USE_SPI_CRC                     0U

/* Includes ------------------------------------------------------------------*/
/**
  * @brief Include module's header file
  */

#ifdef HAL_RCC_MODULE_ENABLED
  #include "stm32f7xx_hal_rcc.h"
#endif /* HAL_RCC_MODULE_ENABLED */

#ifdef HAL_GPIO_MODULE_ENABLED
  #include "stm32f7xx_hal_gpio.h"
#endif /* HAL_GPIO_MODULE_ENABLED */

#ifdef HAL_DMA_MODULE_ENABLED
  #include "stm32f7xx_hal_dma.h"
#endif /* HAL_DMA_MODULE_ENABLED */

#ifdef HAL_CORTEX_MODULE_ENABLED
  #include "stm32f7xx_hal_cortex.h"
#endif /* HAL_CORTEX_MODULE_ENABLED */

#ifdef HAL_ADC_MODULE_ENABLED
  #include "stm32f7xx_hal_adc.h"
#endif /* HAL_ADC_MODULE_ENABLED */

#ifdef HAL_CAN_MODULE_ENABLED
  #include "stm32f7xx_hal_can.h"
#endif /* HAL_CAN_MODULE_ENABLED */

#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
  #include "stm32f7xx_hal_can_legacy.h"
#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */

#ifdef HAL_CEC_MODULE_ENABLED
  #include "stm32f7xx_hal_cec.h"
#endif /* HAL_CEC_MODULE_ENABLED */

#ifdef HAL_CRC_MODULE_ENABLED
  #include "stm32f7xx_hal_crc.h"
#endif /* HAL_CRC_MODULE_ENABLED */

#ifdef HAL_CRYP_MODULE_ENABLED
  #include "stm32f7xx_hal_cryp.h"
#endif /* HAL_CRYP_MODULE_ENABLED */

#ifdef HAL_DMA2D_MODULE_ENABLED
  #include "stm32f7xx_hal_dma2d.h"
#endif /* HAL_DMA2D_MODULE_ENABLED */

#ifdef HAL_DAC_MODULE_ENABLED
  #include "stm32f7xx_hal_dac.h"
#endif /* HAL_DAC_MODULE_ENABLED */

#ifdef HAL_DCMI_MODULE_ENABLED
  #include "stm32f7xx_hal_dcmi.h"
#endif /* HAL_DCMI_MODULE_ENABLED */

#ifdef HAL_ETH_MODULE_ENABLED
  #include "stm32f7xx_hal_eth.h"
#endif /* HAL_ETH_MODULE_ENABLED */

#ifdef HAL_FLASH_MODULE_ENABLED
  #include "stm32f7xx_hal_flash.h"
#endif /* HAL_FLASH_MODULE_ENABLED */

#ifdef HAL_SRAM_MODULE_ENABLED
  #include "stm32f7xx_hal_sram.h"
#endif /* HAL_SRAM_MODULE_ENABLED */

#ifdef HAL_NOR_MODULE_ENABLED
  #include "stm32f7xx_hal_nor.h"
#endif /* HAL_NOR_MODULE_ENABLED */

#ifdef HAL_NAND_MODULE_ENABLED
  #include "stm32f7xx_hal_nand.h"
#endif /* HAL_NAND_MODULE_ENABLED */

#ifdef HAL_SDRAM_MODULE_ENABLED
  #include "stm32f7xx_hal_sdram.h"
#endif /* HAL_SDRAM_MODULE_ENABLED */

#ifdef HAL_HASH_MODULE_ENABLED
 #include "stm32f7xx_hal_hash.h"
#endif /* HAL_HASH_MODULE_ENABLED */

#ifdef HAL_I2C_MODULE_ENABLED
 #include "stm32f7xx_hal_i2c.h"
#endif /* HAL_I2C_MODULE_ENABLED */

#ifdef HAL_I2S_MODULE_ENABLED
 #include "stm32f7xx_hal_i2s.h"
#endif /* HAL_I2S_MODULE_ENABLED */

#ifdef HAL_IWDG_MODULE_ENABLED
 #include "stm32f7xx_hal_iwdg.h"
#endif /* HAL_IWDG_MODULE_ENABLED */

#ifdef HAL_LPTIM_MODULE_ENABLED
 #include "stm32f7xx_hal_lptim.h"
#endif /* HAL_LPTIM_MODULE_ENABLED */

#ifdef HAL_LTDC_MODULE_ENABLED
 #include "stm32f7xx_hal_ltdc.h"
#endif /* HAL_LTDC_MODULE_ENABLED */

#ifdef HAL_PWR_MODULE_ENABLED
 #include "stm32f7xx_hal_pwr.h"
#endif /* HAL_PWR_MODULE_ENABLED */

#ifdef HAL_QSPI_MODULE_ENABLED
 #include "stm32f7xx_hal_qspi.h"
#endif /* HAL_QSPI_MODULE_ENABLED */

#ifdef HAL_RNG_MODULE_ENABLED
 #include "stm32f7xx_hal_rng.h"
#endif /* HAL_RNG_MODULE_ENABLED */

#ifdef HAL_RTC_MODULE_ENABLED
 #include "stm32f7xx_hal_rtc.h"
#endif /* HAL_RTC_MODULE_ENABLED */

#ifdef HAL_SAI_MODULE_ENABLED
 #include "stm32f7xx_hal_sai.h"
#endif /* HAL_SAI_MODULE_ENABLED */

#ifdef HAL_SD_MODULE_ENABLED
 #include "stm32f7xx_hal_sd.h"
#endif /* HAL_SD_MODULE_ENABLED */

#ifdef HAL_SPDIFRX_MODULE_ENABLED
 #include "stm32f7xx_hal_spdifrx.h"
#endif /* HAL_SPDIFRX_MODULE_ENABLED */

#ifdef HAL_SPI_MODULE_ENABLED
 #include "stm32f7xx_hal_spi.h"
#endif /* HAL_SPI_MODULE_ENABLED */

#ifdef HAL_TIM_MODULE_ENABLED
 #include "stm32f7xx_hal_tim.h"
#endif /* HAL_TIM_MODULE_ENABLED */

#ifdef HAL_UART_MODULE_ENABLED
 #include "stm32f7xx_hal_uart.h"
#endif /* HAL_UART_MODULE_ENABLED */

#ifdef HAL_USART_MODULE_ENABLED
 #include "stm32f7xx_hal_usart.h"
#endif /* HAL_USART_MODULE_ENABLED */

#ifdef HAL_IRDA_MODULE_ENABLED
 #include "stm32f7xx_hal_irda.h"
#endif /* HAL_IRDA_MODULE_ENABLED */

#ifdef HAL_SMARTCARD_MODULE_ENABLED
 #include "stm32f7xx_hal_smartcard.h"
#endif /* HAL_SMARTCARD_MODULE_ENABLED */

#ifdef HAL_WWDG_MODULE_ENABLED
 #include "stm32f7xx_hal_wwdg.h"
#endif /* HAL_WWDG_MODULE_ENABLED */

#ifdef HAL_PCD_MODULE_ENABLED
 #include "stm32f7xx_hal_pcd.h"
#endif /* HAL_PCD_MODULE_ENABLED */

#ifdef HAL_HCD_MODULE_ENABLED
 #include "stm32f7xx_hal_hcd.h"
#endif /* HAL_HCD_MODULE_ENABLED */

/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT
/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param  expr: If expr is false, it calls assert_failed function
  *         which reports the name of the source file and the source
  *         line number of the call that failed.
  *         If expr is true, it returns no value.
  * @retval None
  */
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
  void assert_failed(uint8_t* file, uint32_t line);
#else
  #define assert_param(expr) ((void)0U)
#endif /* USE_FULL_ASSERT */

#ifdef __cplusplus
}
#endif

#endif /* __STM32F7xx_HAL_CONF_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

I would really appreciate your help, I've been stuck on this for days!


text:
Q: How to get OAuth working on MVC4 mobile I have been struggling to get OAuth to work on my MVC4 mobile application.
I basically

*

*Created an MVC4 Mobile application

*Created an MVC4 Web application

*Copied the AccountController, AccountModel, InitializeSimpleMembershipAttribute and all account views into my MVC4 Mobile application

*Enabled Google and Facebook OAuth providers

*I also ensured RoleManager was initialized according to simplemembershipprovider-not-working, although I do not think that was important. ( I needed it for some role-based security I was testing)

*Disabled ajax ( I think) by setting data-ajax="false":
using (Html.BeginForm("ExternalLogin", "Account",new RouteValueDictionary { { "ReturnUrl", ViewBag.ReturnUrl } }, FormMethod.Post, new Dictionary<string, object> { { "data-ajax", false } })) (This did not seem to have any effect on the page - so I may be doing something wrong here...)

I can get to the LogIn view /Account/Login, and when I click the google button, the debugger breaks into public ActionResult ExternalLogin(string provider, string returnUrl)
However - the public ActionResult ExternalLoginCallback(string returnUrl) is never hit.
Visually, I get the jquery mobile "page loading" animation - then I get "Error Loading Page"
I have two questions:

*

*How can I get more information when I try to figure out what happens?

*How can I get OAuth working on my MVC4 mobile site?

BTW: Both sites target .Net4.0

A: OK - so I figured out the answer - the cuplrit was indeed the ajax in jQuery mobile.
I modified my _layout.cshtml so that it can render a custom script after loading jQuery, but before loading jQuery mobile:
    @Scripts.Render("~/bundles/jquery","~/scripts/RemoveHashFromWindowLocation")
    @RenderSection("beforeJqueryMobile", required: false);
    @Scripts.Render( "~/bundles/jquerymobile")
    @RenderSection("scripts", required: false)

Then I modified my Login.cshtml so that it contains the section:
@section BeforeJqueryMobile {
    @Scripts.Render("~/scripts/disable-ajax.js")
}

And finally, I added the following to my scripts folder:
disable-ajax.js:
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});

RemoveHashFromWindowLocation.js: (Thanks to Facebook Oauth Login With Jquery Mobile #_=_)
if (window.location.hash == "#_=_")
    window.location.hash = "";

Voila - OAuth working with jQuery mobile. :-)

A: The above answer from espenalb does work if your site loads directly to the login page, however if you have say a home page and then and a link to the login page(which uses the same layout), you will get an error loading page when you click one of the social login buttons.
To fix this add
<script>

    $('#login-link').live("click", function () {
        $.mobile.ajaxEnabled = false;
    });

</script>

to the bottom of your mobile layout page, this will attach an event handler that will disable ajax to the login link.


text:
Q: Debug KDevelop in KDevelop I am trying to debug the KDevelop project by using my system KDevelop installation and I came across with a problem that my ( under debugging ) KDevelop application wont read the plugins from the local installation directory. Instead of that it try to use the system plugins by using this api:
KServiceTypeTrader::self() ->query

Is there any possibility to say to KDevelop to read the plugins information from a different resource lets say from one specified directory? I tried to change the code to do something like that:
    QDir dir("/home/alekstheod/workspaces/kdevelop/kdevelop/Installation/lib/kde4/plugins/");

QStringList files;
files = dir.entryList(QStringList("*"),
                      QDir::Files | QDir::NoSymLinks);

QStringList newFiles;
for( int i = 0; i < files.size(); i++ )
{
    newFiles.push_back(  dir.path() + "/" + files.at(i) );
}

//QStringList resources  = dirs.findAllResources("lib", "*.so", KStandardDirs::Recursive);
int a = newFiles.size();
std::cout << a << std::endl;
KPluginInfo::List res = KPluginInfo::fromFiles(newFiles);

return res;

but unfortunately it didn't help me. Probably I did something wrong. Please help :).

A: Either remove the system one and use only the local one (eat your own dog food :D)
Or attach to the running process.


text:
Q: Exchange axes in ListLinePlot I'm sorry to do this right off the bat, but I have the following set of data:
work2={{{0.8, 0.809118, 0.814861, 0.816977, 0.815295, 0.809712, 0.80024,
   0.786964, 0.770033, 0.749636, 0.72598, 0.699279, 0.669736,
   0.637543, 0.602879, 0.565919}, {0.8, 0.81034, 0.817401, 0.820902,
   0.820631, 0.816441, 0.808308, 0.796291, 0.780524, 0.761196,
   0.738526, 0.712744, 0.684073, 0.65272, 0.618871, 0.582699}, {0.8,
   0.811658, 0.820201, 0.825326, 0.826787, 0.824396, 0.818081,
   0.807856, 0.793815, 0.77612, 0.754974, 0.730606, 0.703248,
   0.673125, 0.640442, 0.605384}, {0.8, 0.813028, 0.823152, 0.830064,
   0.833486, 0.833209, 0.829117, 0.821181, 0.809448, 0.794035,
   0.775106, 0.752856, 0.727499, 0.69925, 0.668317, 0.634895}, {0.8,
   0.814417, 0.826168, 0.834948, 0.840471, 0.842507, 0.840916,
   0.835636, 0.826682, 0.814132, 0.798112, 0.77878, 0.756309, 0.73088,
    0.702664, 0.671829}, {0.8, 0.8158, 0.829181, 0.83985, 0.847519,
   0.851945, 0.852973, 0.850525, 0.844596, 0.835245, 0.822582,
   0.806748, 0.787904, 0.766209, 0.741815, 0.714855}, {0.8, 0.817155,
   0.832138, 0.844663, 0.854443, 0.861224, 0.864834, 0.86518,
   0.862239, 0.856059, 0.846741, 0.834429, 0.819293, 0.801511,
   0.781259, 0.758703}, {0.8, 0.818469, 0.834997, 0.849305, 0.861097,
   0.870101, 0.876118, 0.879023, 0.878759, 0.875338, 0.86883, 0.85935,
    0.847044, 0.832076, 0.814614, 0.794818}, {0.8, 0.819731, 0.837729,
    0.853712, 0.86737, 0.87839, 0.88653, 0.891602, 0.89348, 0.892093,
   0.887416, 0.87946, 0.868251, 0.853814, 0.836151, 0.815227}, {0.8,
   0.820932, 0.84031, 0.857841, 0.87318, 0.88596, 0.895861, 0.902602,
   0.905936, 0.905647, 0.901541, 0.893422, 0.881073, 0.864224,
   0.842528, 0.815527}, {0.8, 0.822066, 0.842725, 0.861658, 0.878474,
   0.892721, 0.903977, 0.911825, 0.915846, 0.91562, 0.910701,
   0.900593, 0.884725, 0.862407, 0.832799,
   0.794877}}, {{4.01588*10^-16, -0.00117656, -0.00209305, \
-0.00270322, -0.0029945, -0.00298954, -0.0027423, -0.00232876, \
-0.00183367, -0.00133599, -0.000896415, -0.000550034, -0.00030582, \
-0.000152338, -0.0000670596, -0.0000256643}, {3.67761*10^-16, \
-0.00166851, -0.00308697, -0.00417407, -0.004878, -0.00518289, \
-0.0051112, -0.00472094, -0.00409767, -0.00334207, -0.00255496, \
-0.00182274, -0.00120598, -0.000734139, -0.000407175, -0.000203337}, \
{4.75314*10^-16, -0.00222361, -0.00424177, -0.00594374, -0.00724013, \
-0.00807193, -0.00841719, -0.00829402, -0.0077592, -0.00690202, \
-0.00583382, -0.0046744, -0.00353696, -0.00251412, -0.00166756, \
-0.00102361}, {4.64906*10^-16, -0.00284081, -0.00555595, -0.00801394, \
-0.0100948, -0.0116999, -0.0127599, -0.013242, -0.0131528, \
-0.0125386, -0.0114814, -0.0100918, -0.00849871, -0.00683649, \
-0.00523133, -0.00378773}, {3.82507*10^-16, -0.00351759, -0.00702438, \
-0.010379, -0.0134421, -0.0160855, -0.0182003, -0.0197046, \
-0.0205494, -0.0207212, -0.0202434, -0.0191741, -0.0176032, \
-0.015646, -0.0134362, -0.0111163}, {3.90313*10^-16, -0.00425029, \
-0.00863858, -0.0130256, -0.0172666, -0.0212187, -0.024749, \
-0.0277413, -0.0301023, -0.0317653, -0.0326925, -0.0328751, \
-0.0323323, -0.0311099, -0.0292775, -0.026926}, {4.94403*10^-16, \
-0.0050344, -0.0103875, -0.0159341, -0.0215386, -0.0270611, \
-0.0323642, -0.0373194, -0.0418133, -0.045751, -0.0490587, \
-0.0516839, -0.0535941, -0.054775, -0.0552277, -0.0549661}, \
{5.6552*10^-16, -0.00586492, -0.0122581, -0.0190799, -0.0262177, \
-0.0335511, -0.0409579, -0.0483209, -0.0555327, -0.0625009, \
-0.0691504, -0.0754247, -0.0812848, -0.0867068, -0.0916794, \
-0.0961997}, {3.53884*10^-16, -0.00673654, -0.0142366, -0.0224355, \
-0.0312557, -0.0406103, -0.0504089, -0.0605628, -0.070991, -0.081624, \
-0.0924074, -0.103302, -0.114282, -0.125332, -0.136438, -0.147578}, \
{3.65166*10^-16, -0.00764389, -0.0163083, -0.0259717, -0.0366004, \
-0.0481514, -0.0605759, -0.0738234, -0.0878457, -0.102599, -0.118043, \
-0.134138, -0.150836, -0.168064, -0.185701, -0.20355}, \
{3.22659*10^-16, -0.00858165, -0.0184589, -0.0296591, -0.0421987, \
-0.0560836, -0.0713103, -0.087866, -0.105728, -0.124858, -0.145196, \
-0.166644, -0.189036, -0.212106, -0.235429, -0.258347}}}

Using the following
ListLinePlot[Table[Transpose[Transpose[work2][[i]]], {i, 1, 11}],
 AxesLabel -> {Subscript[\[Beta], A], Subscript[\[Beta], 3]}]

I am able to make the plot I want, except for one thing... I need the axes flipped so that $\beta_A$ is on the y-axis, and $\beta_3$ is on the x.  Could someone give me a hand please?
Thanks,

A: Your data has basically this shape:
data =
   {
    {{x11, x21, x31}, {x12, x22, x32}, {x13, x23, x33}, {x14, x24, x34}},
    {{y11, y21, y31}, {y12, y22, y32}, {y13, y23, y33}, {y14, y24, y34}}
   }

There is a version of Transpose that on its own already does what your whole Table[Transpose[Transpose[work2][[i]]], {i, 1, 11}] did, namely:
Transpose[data, {3, 1, 2}]

(* ==>
  {{{x11, y11}, {x21, y21}, {x31, y31}},
   {{x12, y12}, {x22, y22}, {x32, y32}},
   {{x13, y13}, {x23, y23}, {x33, y33}},
   {{x14, y14}, {x24, y24}, {x34, y34}}}  *)

To exchange the {x,y} values you can use Reverse first:
Transpose[Reverse@data, {3, 1, 2}]

(* ==>
   {{{y11, x11}, {y21, x21}, {y31, x31}},
    {{y12, x12}, {y22, x22}, {y32, x32}},
    {{y13, x13}, {y23, x23}, {y33, x33}},
    {{y14, x14}, {y24, x24}, {y34, x34}}} *)

So, in your case
ListLinePlot[Transpose[Reverse@work2, {3, 1, 2}],
    AxesLabel -> {Subscript[\[Beta], 3], Subscript[\[Beta], A]}]

should work.
It yields:

where you originally had:


text:
Q: Can a deftemplate construct have another template in a slot? I have a template defined as follows:
(deftemplate fact
    (slot name)
    (multislot field)
    (multislot value))

Can I have this above defined fact as a slot/multislot in another template?
For example:
(deftemplate collection1
    (slot fact1))

(deftemplate collection2
    (slot fact1)
    (slot fact2))

In the above desired template, each slot fact should be of defined template fact. I want to have such collection of
many number of slots. Or at least the desired outcome is to assert collection with fields similar to fact template.
So that I could have a logically link between name, fields and values.
(collection2
    (fact1 (name 'ID')
        (field 'Name' 'Company' 'Role')
        (value 'Bob' 'ABC' 'Admin'))
    (fact2 (name 'Event')
        (field 'Name' 'Place')
        (value 'Conference' 'USA')))

Expected outcome : CLIPS could assert the above recursive fact. Is this possible, or any alternative to the problem.
Thank you in advance.

A: Sure you can, you can also restrict the slot type to specifically be a fact address.
(deftemplate fact
    (slot name)
    (multislot field)
    (multislot value))

(deftemplate collection
  (slot fact (type FACT-ADDRESS)))

(assert (collection (fact (assert (fact (name "ID")
                                        (field "Name" "Company" "Role")
                                        (value "Bob" "ABC" "Admin"))))))

The facts list:
(facts)

f-0     (initial-fact)
f-1     (fact (name "ID") (field "Name" "Company" "Role") (value "Bob" "ABC" "Admin"))
f-2     (collection (fact <Fact-1>))


text:
Q: Dividing string and move down the rest of it Can someone help me? I have a string:
This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example.

I want to cut 35 characters of it and the rest of string move to bottom line. After that I want to cut 35 characters of string in second line and rest of string move to third line. After that I want cut 35 characters of string in third line and move rest of string to fourth line. It should look like this:
This is example. This is example. T
his is example. This is example. Th
is is example. This is example. Thi
s is example. This is example. This
is example.

I tried to do thing with substring function but I have no idea how to move down rest of my string.

A: You can use regular expressions to add line separators, or whatever you need, after 35 characters; for example:
select regexp_replace(str, '(.{35})', '\1' || chr(13))
FROM (
        SELECT 'This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example.' STR
        FROM DUAL
     )

This simply gets a group of 35 chars ('(.{35})') and replaces every group with itself plus a line separator ('\1' || chr(13))

A: Well, probably this is not what you're looking for, but you can write this function:
create or replace function split_n(n in number, s in varchar2) return varchar2
  is
     t varchar2(1024);
     ret varchar2(4096);
     rem varchar2(4096);
  begin
    rem := s;
    loop
      t := substr(rem, 1, n);
      ret := ret || t || chr(10);
      rem := substr(rem, n+1);
      exit when rem is null;
    end loop;
    return ret;
  end split_n;

Then you just use:
> select split_n(35, 'This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example.') from dual

A: This time the big solution (Splitting string into multiple rows in Oracle) is not necessary:
   with temp as
(    select 'This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example' example  from dual)
select
    substr(t.example, (level-1)*35+1,35)  as subtext
  , length(t.example) l
  , level lv
from
  temp t
  connect by level <= trunc(length(t.example)/35+1)
order by level;

Ok misread the question..

A: A regular expression is probably simpler, but you could use a recursive CTE or a hierarchical query to split your string into multiple rows of 35 characters each:
with t (str) as (
  select 'This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example.' from dual
)
select substr(str, (35 * (level - 1)) + 1, 35) as result
from t
connect by level <= ceil(length(str)/35);

RESULT
-----------------------------------
This is example. This is example. T
his is example. This is example. Th
is is example. This is example. Thi
s is example. This is example. This
 is example.

5 rows selected.

and then use listagg() (required 11gR2 or above) to stick the parts back together with a newline in between:
with t (str) as (
  select 'This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example. This is example.' from dual
)
select listagg(substr(str, (35 * (level - 1)) + 1, 35), chr(10))
  within group (order by level) as result
from t
connect by level <= ceil(length(str)/35);

RESULT
----------------------------------------
This is example. This is example. T
his is example. This is example. Th
is is example. This is example. Thi
s is example. This is example. This
 is example.

1 row selected.

You don't have to use a CTE, you can repeat the string literal in the two places I've referred to str, and select from dual instead.


text:
Q: Javascript/HTML5 - Store and display score in local storage I created a game with a score. Every time that there's a collision, it ads 10 points and when the user has made 16 collisions, the game ends, and the score gets stored in localstorage so it can be displayed on a scoreboard.
  //everytime there's a collision, contador++
  // when contador reaches 16, there's a pop up and the score is saved in local storage.

  if (contador == 16)  {

  localStorage.setItem("pontosSalvos", pontos);

  var pop = document.getElementById ( "alerta_ajuda");
  pop.style.display = 'inline';
  contador = 0;

          }

Then, there's a page for the scoreboard with the following code:
    //the score gets displayed on a span called mensagem

    function mostraPontos() {
    var pontos = localStorage.getItem ("pontosSalvos");
    var span = document.getElementById ("mensagem_pontos");

    span.innerHTML = pontos;
}

What I wanted to know is this:
With the code like this, whenever there's a new score, it replaces the previous score in the scoreboard and it only shows the new score.
Is there a way to store/display multiple scores without replacing the old ones?
Thank you!

A: The localStorage can only store strings. You can store arrays in it using numerous formats. I would recommend JSON to do this. Have some array with the scores, and when reading from localStorage, JSON.parse it, and when writing, JSON.stringify. You probably want to change the span to an ordered list.
if (contador == 16)  {
    var pontosArr = JSON.parse(localStorage.pontosSalvos || '[]');
    pontosArr.push(+pontos);
    // Sorts highest to lowest
    pontosArr.sort(function(a, b) { return b - a; });
    localStorage.pontosSalvos = JSON.stringify(pontosArr);

    var pop = document.getElementById ( "alerta_ajuda");
    pop.style.display = 'inline';
    contador = 0;

}

function mostraPontos() {
    // pontos is an empty array if nothing has been stored yet.
    var pontos = JSON.parse(localStorage.pontosSalvos || '[]');
    var ol = document.getElementById("mensagem_pontos");
    ol.innerHTML = '';
    // Appends all the scores as list elements
    for (var i = 0; i < pontos.length; i++) {
        var li = document.createElement('li');
        li.textContent = pontos[i];
        ol.appendChild(li);
    }
}

A: You can push the scores to an array and save its stringified version to localStorage instead of storing a single value.
To display them in HTML, you should parse the stringified value coming back from localStorage to obtain an array again and map its values to an HTML element of your choice.
Something like this:

const board = document.getElementById('board');

// Load saved scores:

const fakeLocalStorage = {};

let scores = [];

try {
  scores = JSON.parse(fakeLocalStorage.scores);
} catch(err) {}

// Add new scores and save them:

document.getElementById('push').onclick = function() {
  scores.push(Math.floor(Math.random() * 17));

  fakeLocalStorage.scores = JSON.stringify(scores);

  board.innerHTML = scores.map(score => `<li>${ score }</li>`).join('');
};

// Clear all scores and delete them from localStorage:

document.getElementById('clear').onclick = function() {
  scores = [];

  delete fakeLocalStorage.scores;

  board.innerHTML = '';
};
<button id="push">ADD SCORE</button>
<button id="clear">CLEAR SCORES</button>

Note localStorage is not allowed in StackOverflow snippets, so I just use a normal object fakeLocalStorage in this example. You can just swap it for localStorage in your code and it should still be working as expected.


text:
Q: first Dropdown hide on second drop down click event I am using 2 codrops dropdwon menus in single page. I want to close the first drop down menu   when user clicks on the 2nd drop down menu.
I am using below code in my project.
<select id="Select1" class="cd-select">
    <option value="-1" selected>Menu 1</option>
    <option value="7" >subMenu1</option>
    <option value="8" >subMenu2</option>
    <option value="9" >subMenu3</option></select>

// 2nd Menu
<select id="Select2" class="cd-select">
    <option value="-1" selected>Menu 2</option>
    <option value="2" >subMenu1</option>
    <option value="5" >subMenu2</option></select>

.aspx Page Java Script
<script type="text/javascript">
    $(function () {
        $('#Select1').dropdown({
            gutter: 5,
            stack: false,
            delay: 100,
            slidingIn: 100
        });
        $('#Select2').dropdown({
            gutter: 5,
            stack: false,
            delay: 100,
            slidingIn: 100
        });
    });
</script>

I want to close Select1 when user click on Select2. Please give me suggestion how to do this.
Help me.

*

*JSFiddle here

A: Update:
check the answer to this question:
jquery drop down menu closing by clicking outside
I added it to your fiddle, it works functionally but the dropdowns lose their layout.
You can try calling the hide() function when clicking on the other dropdown, instead of $(document).

A: I got the solution - I just put this code inside document.ready() function and it works.
$('.cd-dropdown').click(function() {
$('.cd-active').not($(this))
        .removeClass('cd-active')
        .children('ul').css('height', 'auto')
        .children('li').css('top', 0);});

Thanks