text:
Q: How can I display greek symbols in Matlab GUI How can I use the degree symbol when writing a GUI in Matlab? I can use ^\circ when plotting but this does not work when writing a GUI.
This is my GUI so far:
directory = 'Data';
SiteName = 'AAA';
done = false;
spcFrac = 2; %number of spaces = char;
num2delim = 20;
defSlt = 'aTemp';
loader = 'on';

fclose all;
outputOptions = {'Air temperature','aTemp'};
defaults = {'',''};
% long names for outputs
names    = {'latitude (deg N)','altitude (m)'};
lines = [4,5];
[~,b] = sortrows(outputOptions); vL = length(b);
outN = cell(vL,1);outA = outN;outUn = outN;
for k = 1:length(b)
    outUn{k}= outputOptions{b(k),1};
    outN{k} = outputOptions{b(k),1};
    outA{k} = outputOptions{b(k),2};
end

indx = strcmp(defSlt,outA);
slt{1} = outN{indx};
txt = outA{indx};
outN(indx) = [];

close all
bckColor = [.85 .85 .85];
figDims = [150 150 400 300];
lM = 15;
tM = 20;
rM = 15;
bM = 15;
pnS = 12;
bgPw = 180;
bgPh = 120;
btnH = 25;
txtH = 20;
txtW = 40;
txtS = 5;
spc = 9;
radioW = 150;
radioH = 20;

bigPanels(1,:) = [lM figDims(4)-bgPh-tM bgPw bgPh];
bigPanels(2,:) = bigPanels(1,:); bigPanels(2,1) = bigPanels(2,1)+pnS+bgPw;
filePanel = [bigPanels(2,1)+bgPw+pnS*2 bM+pnS+btnH ...
    figDims(3)-bgPw*2-lM-pnS*3-rM figDims(4)-tM-pnS-btnH-bM];
btns(1,:) = [lM bigPanels(1,2)-spc-btnH bgPw btnH];
btns(2,:) = [bigPanels(2,1) bigPanels(1,2)-spc-btnH bgPw btnH];
btns(3,:) = [filePanel(1)+filePanel(3)-bgPw bM bgPw btnH];
btns(4,:) = [filePanel(1) bM radioW radioH];

numTxtIn = numel(defaults);
rowsTxt = ceil(numTxtIn/2);
for p = 1:rowsTxt
    txtBoxL(p,:) = [lM bM+(p-1)*(pnS+txtH) txtW txtH];

    txtBoxR(p,:) = [lM+pnS+bgPw bM+(p-1)*(pnS+txtH) txtW txtH ];
    diaL(p,:) = [lM+txtW+txtS -txtS+bM+(p-1)*(pnS+txtH) txtBoxR(p,1)-...
        lM-txtW-pnS txtH ];
    diaR(p,:) = [txtBoxR(p,1)+txtW+txtS -txtS+bM+(p-1)*(pnS+txtH) ...
        txtBoxR(p,1)-lM-txtW-pnS txtH ];
end
S.fh = figure('units','pixels',...
              'position',figDims,...
              'menubar','none',...
              'resize','off',...
              'numbertitle','off',...
              'name','Configuration File','Color',bckColor);
          movegui(S.fh,'center')
outFrame=uipanel('Parent',S.fh,'BackgroundColor',bckColor,...
        'Title','Output options','FontSize',10);
        setpixelposition(outFrame,[lM-spc btns(1,2)-spc ...
        bgPw+spc*2 bgPh+btnH+spc*3+pnS]);

slcFrame=uipanel('Parent',S.fh,'BackgroundColor',bckColor,...
        'Title','Output selections','FontSize',10);
        setpixelposition(slcFrame,[bigPanels(2,1)-spc btns(1,2)-spc ...
        bgPw+spc*2 bgPh+btnH+spc*3+pnS]);
ParamFrame=uipanel('Parent',S.fh,'BackgroundColor',bckColor,...
        'Title','User parameters','FontSize',10);
        setpixelposition(ParamFrame,[btns(1,1)-spc ...
            bM-spc bgPw*2+pnS+spc*2 btns(1,2)-2*spc-2]);

for lm = 1:rowsTxt
    indr = rowsTxt-lm+1;
S.outT(1,indr) = uicontrol('style','edit',...
    'units','pix',...
    'position',txtBoxL(indr,:),...
    'HorizontalAlign','center',...
    'string','Remove',...
    'fontsize',8,'String',defaults{lm,1},...
    'callback',{@txt_call,lines(lm,1)},...
    'BackgroundColor','w');
S.outT(2,indr) = uicontrol('style','edit',...
    'units','pix',...
    'position',txtBoxR(indr,:),...
    'HorizontalAlign','center',...
    'string','Remove',...
    'fontsize',8,'String',defaults{lm,2},...
    'callback',{@txt_call,lines(lm,2)}...
    ,'BackgroundColor','w');
S.outD(1,indr) = uicontrol('style','text',...
    'units','pix',...
    'position',diaL(indr,:),...
    'HorizontalAlign','left',...
    'string','Remove',...
    'fontsize',8,'String',names{lm,1},'BackgroundColor',bckColor);
S.outD(2,indr) = uicontrol('style','text',...
    'units','pix',...
    'position',diaR(indr,:),...
    'HorizontalAlign','left',...
    'string','Remove',...
    'fontsize',8,'String',names{lm,2},'BackgroundColor',bckColor);
end

Here I would like to change degN into the degree symbol ^\circ does not work.

A: Depending on the symbols you want to use, you can use either extended ascii or unicode symbols. So, for instance, ^\circ is Alt+0176 which gives you ° (numbers must be typed on keypad and the zero is necessary). µ is Alt+0181, etc. If that doesn't work, you can also programmatically use char(). So char(176) will give you the degree sign.
I should add that the Alt+0XXX construct is a MS Windows (it's worked as far back as 95 AFAIK) shortcut. I am certain-ish that there are similar keyboard shortcuts for MacOS and your favorite flavor of *nix. The char command works everywhere.
From your example code above, you just need to change the definition of names:
names    = {'latitude (°N)','altitude (m)'};

or
names    = {['latitude (' char(179) 'N)'],'altitude (m)'};


text:
Q: Change font only for verbatim part of the document I need to set a certain monospace font only for the verbatim parts of the document. How can one do this?
For example, I understand that the commands
\usepackage{lmodern}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage[T1]{fontenc}

will set the font for the entire document, not solely for the verbatim part.

A: Do not redefine \familydefault but \ttfamily,  i.e.:
\renewcommand*\ttdefault{txtt} % or ...
\renewcommand\ttfamily{\sffamily}

But you can do that simply loading a monospaced font:
\usepackage{nimbusmono} % for instance

Or using xelatex (or lualatex):
\usepackage{fontspec}
\setmonofont{Bitstream Vera Sans}

The LaTeX Font catalogue explain the particular setting of every monospaced typewriter font.

A: As far as I can tell, this is what \verbatim@font is for. Example setting this font to newtxtt family in T1 encoding, medium series and upright shape:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\let\normalttdefault\ttdefault
\usepackage{newtxtt}
\let\ttdefault\normalttdefault  % restore normal \ttdefault

\makeatletter
\renewcommand{\verbatim@font}{\usefont{T1}{newtxtt}{m}{n}}
\makeatother

\begin{document}

\texttt{This is typeset with cmtt. Look for instance at the *, \textdollar\ and
  @ characters. What follows is verbatim and uses a different font:}
\begin{verbatim}
The quick brown fox jumps over the lazy dog.
a += 2*(1 + l[44])
l = {1,...5}
#~&\^@_|3/%$÷`'"
\end{verbatim}

\end{document}

For comparison, the default verbatim font (cmtt when using pdfTeX) gives:

This was obtained with:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\begin{document}

\texttt{This is typeset with cmtt. Look for instance at the *, \textdollar\ and
  @ characters. What follows is verbatim and uses the same font:}
\begin{verbatim}
The quick brown fox jumps over the lazy dog.
a += 2*(1 + l[44])
l = {1,...5}
#~&\^@_|3/%$÷`'"
\end{verbatim}

\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: type 'List' is not a subtype of type 'String?' error flutter Hi everyone I am coding chat app but I faced error that say
" type 'List' is not a subtype of type 'String? "
and I tried to solve this but I know where is the error came
when I run this code:
" ControllerModel searchedUser = ControllerModel.fromMap(userMap); "
after stream builder.
please if there any solution help and thank you so much. Console error,
Emulator error, userMap data
this is my code:
// Search users class

import 'dart:developer';

import 'package:chat_app/getX%20files/models/chat_room_model.dart';
import 'package:chat_app/getX%20files/view/chatting_files/chat_room.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../main.dart';
import '../../controller.dart';
import '../../models/model.dart';

class AddAndSearchUsers extends SearchDelegate<String?> {

  final ControllerModel userModel = Get.find();
  final FirebaseFirestore _fireStore = FirebaseFirestore.instance;

  Future<ChatRoomModel?> getChatroomModel(ControllerModel targetUser) async {
    ChatRoomModel? chatRoom;

    QuerySnapshot snapshot = await _fireStore
        .collection("chatRooms")
        .where("participants.${userModel.uid}", isEqualTo: true)
        .where("participants.${targetUser.uid}", isEqualTo: true)
        .get();

    if (snapshot.docs.isNotEmpty) {
      // Fetch the existing one
      var docData = snapshot.docs[0].data();
      ChatRoomModel existingChatroom =
          ChatRoomModel.fromMap(docData as Map<String, dynamic>);

      chatRoom = existingChatroom;
    } else {
      // Create a new one
      ChatRoomModel newChatroom = ChatRoomModel(
        chatRoomId: uuid.v1(),
        lastMessage: "",
        participants: {
          userModel.uid.toString(): true,
          targetUser.uid.toString(): true,
        },
      );

      await _fireStore
          .collection("chatRooms")
          .doc(newChatroom.chatRoomId)
          .set(newChatroom.toMap());

      chatRoom = newChatroom;

      log("New Chatroom Created!");
    }

    return chatRoom;
  }

  @override
  List<Widget> buildActions(BuildContext context) {
    return [
      IconButton(onPressed: () => query = '', icon: const Icon(Icons.clear)),
    ];
  }

  @override
  Widget buildLeading(BuildContext context) {
    return IconButton(
      icon: const Icon(Icons.arrow_back),
      onPressed: () => Get.back(),
    );
  }

  @override
  Widget buildResults(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: GetBuilder<Controller>(
          init: Controller(),
          builder: (_) {
            return StreamBuilder(
                stream: _fireStore.collection("users").where("email", isEqualTo: query)
                    .where("email", isNotEqualTo: userModel.email)
                    .snapshots(),
                builder: (context, snapshot) {
                  if (snapshot.connectionState == ConnectionState.active) {
                    if (snapshot.hasData) {
                      QuerySnapshot dataSnapShot = snapshot.data as QuerySnapshot;
                      if (dataSnapShot.docs.isNotEmpty) {

                        Map<String, dynamic> userMap =
                        dataSnapShot.docs[0].data() as Map<String, dynamic>;

/// ERROR HERE ------->
                        ControllerModel searchedUser = ControllerModel.fromMap(userMap);

                        return ListView(
                          children: [
                            Padding(
                              padding: const EdgeInsets.all(8.0),
                              child: Container(
                                  decoration: BoxDecoration(
                                      color: Colors.white38,
                                      borderRadius: BorderRadius.circular(20)),
                                  child: ListTile(
                                    onTap: () async {
                                      ChatRoomModel? chatRoomModel = await
                                     getChatroomModel(searchedUser);
                                      if (chatRoomModel != null) {
                                         Get.to(() => ChatRoom(
                                            targetUser: searchedUser,
                                            userModel: userModel,
                                            chatRoom: chatRoomModel));
                                      }
                                    },
                                    title: Text(searchedUser.name!),
                                    subtitle: Text(searchedUser.email!),
                                  )),
                            )
                          ],
                        );
                      } else {
                        return const Center(child: Text('No result found'));
                      }
                    } else if (snapshot.hasError) {
                      const Text('Error');
                    }
                  } else {
                    return const Center(child: CircularProgressIndicator());
                  }
                  //controllerModel.saveSearch = snapshot.data!.docs as Map<String, dynamic>?;
                  return const Text('No result found');
                });
          }),
    );
  }

  @override
  Widget buildSuggestions(BuildContext context) {
    return const Center(child: Text('Find people'));
  }
}

// ControllerModel

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class ControllerModel extends GetxController {
  //const ModelClass({Key? key}) : super(key: key);

  String? uid,username,email,name,password,phone;

  ControllerModel({this.uid, this.username, this.name,this.email, this.password, this.phone});

  ControllerModel.fromMap(Map<String, dynamic> map) {
    uid = map["uid"];
    username = map["username"];
    email = map["email"];
    name = map["name"];
    password = map["password"];
    phone = map["phone"];
  }

  Map<String, dynamic> toMap() {
    return {
      "uid": uid,
      "username": username,
      "email": email,
      "name": name,
      "password": password,
      "phone": phone
    };
  }

    ... CODE NOT IMPORTANT
}

//ChatRoomModel

class ChatRoomModel {
  String? chatRoomId;
  Map<String, dynamic>? participants;
  String? lastMessage;

  ChatRoomModel({this.chatRoomId, this.participants, this.lastMessage});

  ChatRoomModel.fromMap(Map<String, dynamic> map) {
    chatRoomId = map["chatRoomId"];
    participants = map["participants"];
    lastMessage = map["lastMessage"];
  }

  Map<String, dynamic> toMap() {
    return {
      "chatRoomId": chatRoomId,
      "participants": participants,
      "lastMessage": lastMessage
    };
  }
}


text:
Q: django return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table: I have a simple model class as below
class Language(models.Model):
    name= models.CharField(max_length=20)
    code= models.CharField(max_length=5)
    status=models.BooleanField()
    create_at=models.DateTimeField(auto_now_add=True)
    update_at=models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.name

and I want to use it like this
llist = Language.objects.filter()
list1 = []
for rs in llist:
    list1.append((rs.code,rs.name))
langlist = (list1)

but it keeps throwing this error when I try to use llist :
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: home_language

I tried to use python manage.py shell to make queries and it's showing the same above error.
This is the full error :
Traceback (most recent call last):
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\sqlite3\base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: home_language

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\apps\config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "c:\users\daisy\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Daisy\OneDrive\Documents\Work\django\prjs\funnystore\mysite\home\models.py", line 29, in <module>
    for rs in llist:
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\models\query.py", line 276, in __iter__
    self._fetch_all()
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\models\query.py", line 1261, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\models\query.py", line 57, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\models\sql\compiler.py", line 1152, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 100, in execute
    return super().execute(sql, params)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\Daisy\Downloads\Django-E-Commerce-master\env\lib\site-packages\django\db\backends\sqlite3\base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: home_language

A: use this code on your command prompt:
python manage.py migrate --run-syncdb
this worked for me........

A: I used the migration for the specific app, in your case it's:
python3 manage.py makemigrations home
python3 manage.py migrate

A: You should make migrations and migrate the database using:
python manage.py makemigrations
python manage.py migrate

A: In my case the Error was solved with removing data through your admin panel in advance.
Then:
python manage.py makemigrations
python manage.py migrate

A: Delete this model (home_language) from all of your codes if you used it in any condition, and then migrate it:
python3 manage.py makemigrations
python3 manage.py migrate

i hope it should work.


text:
Q: How to fix collection() function problem in XSLT collection() function does not encount all 50 letters, only the one on which the transformation is done.
I have to transform many xml-letters in a csv file with the parameters "Key", "bezeichnung", and "reference" from any letter located in the same folder. When I execute the transformation, I get only the data from the actually transformed file and not from all 50 letters. What is the problem here with the collection() function because everything else works
<xsl:variable name="briefe"
        select="collection('./?select=l_*.xml')"/>
    <xsl:template match="/">
        <xsl:text>"Key","Bezeichnung","Referenz"</xsl:text>
        <xsl:text>
</xsl:text>
        <xsl:for-each-group select="//tei:correspAction[@type='received']/tei:placeName" group-by="@key">
            <xsl:sort select="." />
            <xsl:text>"</xsl:text><xsl:value-of select="current-grouping-key()" /><xsl:text>",</xsl:text>
            <xsl:text>"</xsl:text><xsl:value-of select="distinct-values(//tei:correspAction[@type='received']/tei:placeName)" /><xsl:text>",</xsl:text>
            <xsl:text>"</xsl:text><xsl:value-of select="//tei:correspAction[@type='received']/tei:placeName/@ref" /><xsl:text>"</xsl:text>
            <xsl:text>
</xsl:text>
        </xsl:for-each-group>
    </xsl:template>
</xsl:stylesheet>


text:
Q: Virtual users in sshd from a postgres database I have a Postgresql database full of user accounts, and i would like to allow these user to access a server through ssh, using only public keys authentification.
So far, i have setup these parts on an Ubuntu Server:

*

*libnss-pgsql2 to connect NSS to several database views listing my users in a Unix compatible format

*libpam-pgsql to allow PAM authentification using these same views

*sshd AuthorizedKeysCommand with a script that authenticates users with their public key (still from the postgresql database).

Is there a simpler way to go around this problem ? I have issues setting up correctly the nss configuration (lack of documentation & logs).
Thanks for your time & help.

A: you can use ssh tunneling to allow user to connect to your database. such as
ssh -L local_port:IP address/hostname:server_port user@IP address/hostname.
here user will be OS user so it best to provide postgres superuser to connect.
But keep in mind that the postgresql database server must be on that server.
once done u can connect using simple psql command as
psql -h hostname/IP address -p port -U user -d database

A: I would dump your users from DB into LDAP and load it into local LDAP. You can automate updates easily. This would make your OS to query users from LDAP and it would be much more portable - libnss-pgsql2 is not on every UNIX-like system, if you would ever like to move out from Linux. You never know ;)


text:
Q: Image capture and display in activities I have an activity A. Starting an activity B from A. In activity B, I capture an image with camera present in the device and at the end of that activity come back to Activity A. In this activity have to display the captured image. How to accomplish this task? Running on version 2.3.3...Have had a look here Capture Image from Camera and Display in Activity but the same NullPointerException...Running on LG device.

A: You can pass the URL of the captured image from Activity B to Activity A using intent.putExtras methos.
Refer Passing string array between android activities
For Capturing image refer below code
public class Camera extends Activity
{
     private static final int CAMERA_REQUEST = 1888;
     private String selectedImagePath;
     WebView webview;
     String fileName = "capturedImage.jpg";
     private static Uri mCapturedImageURI;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
            webview=(WebView)findViewById(R.id.webView1);
    }

    public void TakePhoto()
    {
            ContentValues values = new ContentValues();
            values.put(MediaStore.Images.Media.TITLE, fileName);
            mCapturedImageURI = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
            Intent cameraIntent = new Intent(ACTION_IMAGE_CAPTURE);
            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
            startActivityForResult(cameraIntent, CAMERA_REQUEST);
    }
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        if (resultCode == RESULT_OK)
            {
              if (requestCode == CAMERA_REQUEST)
              {
                selectedImagePath = getPath(mCapturedImageURI);
                 //Save the path to pass between activities
              }
            }
    }

    public String getPath(Uri uri) {
        String[] projection = { MediaStore.Images.Media.DATA };
        Cursor cursor = managedQuery(uri, projection, null, null, null);
        int column_index = cursor
                .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        return cursor.getString(column_index);
    }

}


text:
Q: Why is a pointer to a returned reference not possible? Why can't this work? toBeEvolved is a std::vector, .getIndividual returns an element
Individual& EvolutionaryAlgorithm::tournamentSelection(unsigned int i)
{
    return toBeEvolved.getIndividual(i);
}

Individual* in2 = tournamentSelection(0);

Compile Time Error: No viable conversion from 'Individual' to 'Individual*'

A: You need to take the address of the reference in order to convert it to a pointer.  Even though you may know that the reference is handled as a pointer by the compiler "behind the scenes", there is no explicit requirement in the language that references be implemented as pointer variables, and you will still need to use an explicit & operator to tell it you want the address as a pointer.  So:
Individual* in2 = &tournamentSelection(0);

Other posters have gone into much greater depth on the distinction between pointers and references.


text:
Q: Foundation 6 display elements inline I am struggling with this issue. I am try to show the elements next to each other(horizontally) but i can't achieve this behaviour.
HTML:

Enter text:

<input type="text" name="">

CSS:
.span{
    display: inline-block;
}

A: Just make this change

span *{
  display:inline-block;
}

Enter text:

<input type="text" name="">

Enter text:

<input type="text" name="">

A: well we have some problems here ..
first u need to be more carefull with the css selector you use (.span referes to a class named span..not the span element) and i guess this link may help well.
and 2nd is that you are styling the span but you need to style the elements that you want to be next to each other and i strongly recommand that you read this too.
and as your answer here are the
HTML

Enter text:

    <input class="b" type="text" name="">

and CSS
.a{
    display: inline-block;
}
.b{
    display: inline-block;
}

this way you should get what you wanted to.


text:
Q: Have multiple views in one Window (MVVM) I'm trying to learn MVVM and as a new person without a tutor, sometimes it gets sooo confusing. right now I have this problem:
** in one window, I have used 3 different views from different modelviews.
** each view is for selecting one item from a branch and we will traverse the tree.
** in first View, I choose my book
** the 2nd view will show pages of that book
** the last view I want it to show exercises of that page.
so far I was able to bind the 1st view to the Books. now, how should I bind the second view's source to the 1st one's slectedItem ?
MVVM Problem http://clickasun.ir/8283kitchen/images/mvvmproblem.jpg

A: there are several ways to achieve what you want. eg.
 public class Exercise{}

 public class Page
 {
    public List<Exercise> MyExercise {get;set;}
 }

 public class Book
 {
    public List<Page > MyPages {get;set;}
 }

viewmodel
 public ObservableCollection<Book> MyBooks {get;set;}

xaml
 <ListBox x:Name=books ItemsSource="{Binding MyBooks}"/>
 <ListBox x:Name=pages ItemsSource="{Binding ElementName=books,Path=SelectedItem}"/>
 <ListBox ItemsSource="{Binding ElementName=pages,Path=SelectedItem}"/>

this is of course just one way to do it.
ps: code handwritten, so check for errors

A: OK I want to thank anyone who read this and tried to help, Specially yo guys "Blindmeis, Jen H"
thank you.
I know this scenario had to be so general, I just couldnt find it.
so I found 2 approaches to it that both can be good solutions.

*

*Use Microsoft Prism. (Its a pattern to make modular programs in WPF with ease)
 MSDN LINK
 Another LINK

*Use Master Detail Pattern
 Here it is clear
So I got mine solved. Hope it would be useful for you too.


text:
Q: how to resolve OAuthException: (#100) I use my recently develop fb app to post on my wall and its shows the following error
Uncaught OAuthException: (#100) picture URL is not properly formatted thrown in
you can also see this directly *https://apps.facebook.com/hack-proof_pages/1gp.html
using two files "1gp.html" and "gp1.php"
1gp.html code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<form id="form1" name="form1" method="post" action="gp1.php">

message
    <textarea style="width:300px; height:50px;" name="message1"></textarea>

link
    <input type="text" style="width:300px;" name="link1" />

    Picture
    <input type="text"  name="picture1" />

    name
    <input type="text" style="width:300px;" name="name1" />

    Caption
    <input type="text" style="width:300px;" name="caption1" />

Description
    <textarea style="width:300px; height:50px;" name="description1"></textarea>

    <input type="submit" name="Submit" value="Submit" />

</form>

gp1.php code
<?php

require_once 'library/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
  'appId' => '149865361795547',
  'secret' => 'shhhh seceret :)',
  'cookie' => true,
));

     $app_id = '149865361795547';

     $canvas_page = "https://apps.facebook.com/hack-proof_pages/gp1.php";

     //get data for post

     $message1 = $_POST['message1'];
     $picture1 = $_POST['picture1'];
     $name1 = $_POST['name1'];
     $link1  = $_POST['link1'];
     $caption1 =  $_POST['caption1'];
     $description1  = $_POST['description1'];

     // compile the post for for user
    $WallPost = array(
        'message' => $message1,
'link' => $link1,
'picture' => $picture1,
'name' => $name1,
'caption' => $caption1);  // you can also use 'picture', 'link', 'name', 'caption', 'description', 'source'....
    //http://developers.facebook.com/docs/reference/api/

         $auth_url = "http://www.facebook.com/dialog/oauth?client_id="
            . $app_id . "&redirect_uri=" . urlencode($canvas_page) . ("&scope=email,read_stream,publish_stream,offline_access,publish_actions,manage_pages,user_groups&response_type=token");

     $signed_request = $_REQUEST["signed_request"];

     list($encoded_sig, $payload) = explode('.', $signed_request, 2);

     $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

     if (empty($data["user_id"])) {
            echo("");
     } else {

     //getting the userid and some other data for verification

     //get the user id
            $UserId = $data["user_id"];
            echo 'UserId;' . $UserId;

    //get the user access token
            $atoken = $facebook->getAccessToken();
            echo "
" . 'User Access_Token:' . $atoken;

    //set default access token and profile
            //$facebook->setAccessToken($atoken);
            //$user_profile = $facebook->api('/me');

     //get the user name and email
            $user_id = $facebook->getUser();
            $user_profile = $facebook->api('/me','GET');
            $user_name = $user_profile['name'];
            echo "Name: " . $user_name;
            $user_email = $user_profile['email'];
            echo "email: " . $user_email;

    // post to user wall
            $response = $facebook->api('/me' . '/feed','POST',$WallPost);

    //posting to groups wall with sleeping time support poster.xls

}
?>

*Note: my app use self signed certificate SSL so that if you want to test this above URL you need to allow my site and store its certificate and one more info that sometimes google chrome shows error due to google chrome one weak point that chrome needs to store self signed certificate in internet explorer means if you want to check this in chrome you need to first open this site in internet explorer and allow my site self signed certificate and store permanently so that its also work in chrome

A: Please check your picture url, you need to give the full url of the photo not the relative url and facebook should be able to access the picture url, i.e. it should not be of your locally hosted application, try placing a fully qualified sample url of any picture in ur code and check.


text:
Q: How does this canonical flock example work? When one must synchronize programs (shell scripts) via file system, I have found an flock-based solution to be recommended (should also work on NFS). The canonical example for usage from within a script (from http://linux.die.net/man/1/flock) is:
(
flock -s 200

# ... commands executed under lock ...

) 200>/var/lock/mylockfile

I don't quite get why this whole construct ensures atomicity. In particular, I am wondering in which order flock -s 200 and 200>/var/lock/mylockfile are executed when e.g. bash executes these lines of code. Is this order guaranteed/deterministic? The way I understand it, it must be deterministic if this idiom should work. But since a sub shell is spawned in a child process, I do not understand how these two processes synchronize themselves. I only see a race condition between these two commands already.
I would appreciate if someone could make my confusion about this disappear and explain why this construct can be used to safely synchronize processes.
At the same time, if someone knows, I would be interested in how safe it is to chose just some arbitrary file descriptor (such as 200 in the example), especially in the context of a large NFS file system with many clients.

A: The whole I/O context of the sub-shell (...) 200>/var/lock/mylockfile has to be evaluated — and the I/O redirection done — before any commands can be executed in the sub-shell, so the redirection always precedes the flock -s 200.  Think about if the sub-shell had its standard output piped to another command; that pipe has to be created before the sub-shell is created.  The same applies to the file descriptor 200 redirection.
The choice of file descriptor number really doesn't matter in the slightest — beyond it is advisable not to use file descriptors 0-2 (standard input, output, error).  The file name matters; different processes could use different file descriptors; as long the name is agreed upon, it should be fine.


text:
Q: PHP Scandir returns extra periods So I am trying to build a script that scans a directory and returns random images to be used as backgrounds.
The php looks like this:
$dir = "views/img/bg/";
$dh  = opendir($dir);
while (false !== ($filename = readdir($dh))) {
    $files[] = $filename;
}

$random_key = array_rand($files, 1);

$random = $files[$random_key];

Then I am just using some simple jquery to attach the images as backgrounds:
<script>
$(document).ready(function(){

    $("body").css( "background" , "url(http://'.$url_root.'/views/img/bg/'.$random.'), center center" );

});
</script>

Everything works fine but the array of all the images in the background folder seems to be returning stuff like '.' or '..' instead of image names every once in a while. Im not sure what is going on - any ideas?

A: Use glob() so you can filter the files.
$files = glob('views/img/bg/*.jpg');
$random = $files[array_rand($files)];

Since you're specifying *.jpg, $files contains only JPG files and you don't need to remove the . and .. items.

A: '.' and '..' are returned for current and parent directory. You can filter them:
while (false !== ($filename = readdir($dh))) {
    if ($filename != '.' && $filename != '..')
        $files[] = $filename;
}

A: Why not use regex? That way it captures any amount of periods. (i.e. ".", "..", "..." etc..)
while (false !== ($filename = readdir($dh))) {
        if(!preg_match('/^\.*$/',$filename)){
            $files[] = $filename;
        }

A: $dh = opendir("c:\");
while (false !== ($filename = readdir($dh))) {
    if ($filename != '.' && $filename != '..')
       $files[] = $filename;
}


text:
Q: CFML sql query modifying original date format from table Say I have the following date format in my SQL Server database: 3/2007 but when I try to get the data via CFML script I get it this altered format 2007-03-31 00:00:00.0, my script looks like this:
<cfquery name="header" datasource="mydb">
SELECT
  ExpDate
FROM
  myTable
</cfquery>

<CFOUTPUT>ExpDate</CFOUTPUT>
<cfloop query="header">
<CFOUTPUT>#ExpDate#</cfoutput>
</cfloop>

Any idea why my date format is altered? Thanks!

A: Dates are not stored in any format in SQL Server. A client application formats dates.
You can modify your query as follows to get date as varchar value  in needed format.
SELECT
  RIGHT(CONVERT(varchar(12),ExpDate,103),7) ExpDate
FROM
  myTable


text:
Q: Are any Sci-Fi video games considered canon? I believe the question speaks for itself, but to elaborate, I cannot think of any video games based on an existing IP that are actually considered canonical. For example, there exists a large library of Star Wars novels that are considered canon by Lucasfilms, but I know of no games - even when the writing is exceptional.
Does anyone know of any games that are considered canon either by the original IP's creator or the fan community at large? It seems like an obvious way to connect with gamers and build a loyal fanbase.

A: Most giant canon machines are based around older media. Games are typically viewed as marketing. So you see games that appear in these worlds, but normally as advertising for the world.
If you want to find games that generate canon for a universe, you almost have to look for worlds that started with games. Like Halo.

A: Enter The Matrix was explicitly designed to be canonical; there are scenes in the second Matrix movie that don't really do anything in the movie but are there as crossover points with the game, and scenes in the game that fill gaps in the movie.
(Unfortunately it's not actually that good.  But it's definitely canon.)

A: According to Wookieepedia:

In mission and quest solving, canon is assumed to be the fullest and best outcome possible of each mission/quest available as given in the briefing or scenario. Kyle Katarn, Keyan Farlander, Maarek Stele, Jaden Korr, etc. never failed their quests.

In addition to that:

In side-choosing games such as the Star Wars: Knights of the Old Republic series and Dark Forces saga where the player has the choice between light side and dark side, as of yet, the light side ending has been verified as canonical by Lucasfilm in all games.

A: I have been informed by a co-worker that the game Star Trek: 25th Anniversary is actually considered canon by Alex Kurtzmann and Roberto Orci.

A: I am tempted to add The Chronicles of Riddick: Butcher Bay (and possibly Dark Athena) to the list. Vin Diesel's likeness was used extensively, since the game was developed by a game studio owned by Vin Diesel, and offers the origin of the character's distinct abilities.

A: I can't find a decent reference for it, but I'm pretty sure Star Wars: The Force Unleashed is cannon. It's the official story about how the rebellion started.


text:
Q: Building ICCDATA Parser using PHP Is there any ICCDATA Parser available in PHP ?
It should be ICCDATA data parser, I have ISO8583 parser, but that do NOT parses ICCDATA.

A: The root of your answer is to properly understand the element's format and then searching for the correct thing.
I am assuming you are referring to Data Element 55 Integrated Circuit Data (ICC) when you say the ISO-8583 ICCDATA field. The EMV (ISO 7814), VISA, MasterCard, and other specifications are pretty clear on its format.
What you require is an X.690 BER-TLV parser to break down this portion of the message, not just a generic TLV field parser.
There have been some other posts on Stack Exchange as well on this, this is a good one. This is a good on on the differences between simple and BER-TLV.
GitHub has BER-TLV parsers if you need a jump start and this one by NuclearDog was one that came up towards the top of the list when searched.
Once you have your code written EMVLabs has a tool for helping you check you encoding or to see if you get the same result with their BER-TLV decoder tool. (obviously don't put production data there).


text:
Q: Javascript find average from user's input I know there are similar questions on here to mine but I don't see the answer there.
Where am I going wrong with this JS code to find the average number from the user's input?
I want to keep entering numbers until -1 is entered. I think -1 is being counted as an input/
    var count = 0;
    var input;
    var sum = 0;

        while(input != -1){
            input = parseInt(prompt("Enter a number"));
            count++;
            sum = sum + input;
            sum = parseInt(sum);
            average = parseFloat(sum/count);
        }

    alert("Average number is " + average);

A: This is the right order (without all the unnecessary parsing...)
var count = 0;
var input;
var sum = 0;
input = parseInt(prompt("Enter a number"));
while (input != -1) {

    count++;
    sum += input;
    average = sum / count;
    input = parseInt(prompt("Enter a number"));
}

alert("Average number is " + average);

DEMO
Note that you can calculate the average once outside of the loop and save some CPU.

A: You need to check after you take the input from the user.
while(input != -1){
        input = parseInt(prompt("Enter a number"));
       //The user enters -1 but still inside the while loop.
        if(input != -1)
           {
           count++;
           sum = sum + input;
           }
        sum = parseInt(sum);
        average = parseFloat(sum/count);
    }

A: Here is the function code you need.
var count = 0;
var input;
var sum = 0;

    while(true){
        input = parseInt(prompt("Enter a number"));

        if(input != -1)
        {
            count++;
            sum = sum + input;
            sum = parseInt(sum);
        }
        else
            break;
    }
average = parseFloat(sum/count);
alert("Average number is " + average);

A: This will grab the average...Simply accumulate the values and then divide the total 'sum' by the number of 'inputs made'(in our case we just use the count++)
var count = 0;
var input;
var sum = 0;

    while(input != -1){
        count++;
        input = prompt("Enter a number");
        sum += input;
        sum = parseInt(sum);
    }
        average = (sum/count);
alert("Average number is " + average);


text:
Q: How can I save an object to a file in Dart and read it again? I have already done that in Java using ObjectOutputStream and ObjectInputStream classes. Now I want to do this with Dart. I have no idea about what I should use. I have also researched on google but I only found something for serialization of objects and saving them with json. But I am looking for something without json, like in Java.
I'm not english, sorry if I made some mistakes in writing.
Thank you for your time.

A: I guess you want to store and retrieve your objects to save some important information.
For fastest setup you can use HIVE pub.dev/packages/hive.
Other options are

*

*Serializing your object to son string and saving it to shared preference. https://pub.dev/packages/shared_preferences

*Use an orm like moor to store and query large amounts of data. https://pub.dev/packages/moor_flutter


text:
Q: Creating ArrayLists involving generics and interfaces So I have a generic interface that has two parameters so Type  that I implemented in another class in which I created a constructor. In my main class I am trying to create an arrayList of objects that will use the constructor that I created in the class in which I implemented the generic interface. I just need help in setting up the arrayList for this process. Any help would be greatly appreciated.
This is the interface:
public interface Trip<K, T> {
    public K getPerson();
    public T getLocation();
}

This is the implementation:
public class TripImpl <K,T> implements Trip <K,T>  {
    private K person;
    private T location;
    private Date dateOfVisit;
    public TripImpl(K person, T locations, Date dateOfVisits){
       person = persons;
       location = locations;
       dateOfVisit = dateOfVisits;
    }
//theres more code with the getters but this is just to show the constructor
}

Main class:
public class Collect {
   ArrayList <TripImpl> tlist = new ArrayList<TripImpl> ();
       String persons, locatione;
       Date visitd;
       for (int i =0; i<uPerson.length; i++){
          persons = uPerson[i];
          locatione = uLocation[i];
          visitd = uDate[i];
          TripImpl u<String, String> =  new TripImpl<String, String>(persons, locatione, visitd);
          ulist.add(u);
       }
 }

It is giving me an error in the main class with the first line.It says that TripImpl is a raw type and that references to generic type TripImpl should be parameterized

A: Does this help?
VisitImpl<String, String> u =  new VisitImpl<String, String>(persons, locatione, visitd);


text:
Q: Is this a perfect problem for the factory pattern? I want to design the file storage part of my application with some flexibility, so one can store files in either S3 or on the web server's hard drive.
I also want this to be flexible on a per user basis, so in their user settings they can choose if they want their files stored in S3 or on the servers file system.
I am thinking of something like this:
IFileStorage fs = FileStorageFactory.Instance(userSettings);

Then I would have a method that looks like:
public static IFileStorage Instance(UserSettings setting)
{
     if(setting == UserSettings.S3)
         return new S3FileStorage();
}

Does this make sense?  (I'm a c# programmer but I will be doing this in Java)
I am using Spring, but I don't think DI will be used here since the implementation changes on a per user basis.

A: Factory and Dependency Injection aren't mutually exclusive. Spring has the so-called factory-method which produces beans. You can pass arguments to the factory-method, and it can be either static or non-static.

A: Yes. That seems appropriate. You're returning a particular instance of a class to the user, so as long as their requirements don't change halfway through the program, then the factory is appropriate (otherwise I'd recommend a strategy pattern)


text:
Q: Javascript, onbeforeunload event works when submitting on a form in IE I am writing for some adivce on a javascript I made for a xhtml page. I got it to mostly work on IE, FF and chrome (Safari still giving me some grief but thats another subject.) The problem I am having is that IE would run the beforeunload event even when someone is submitting a form which is not something i want to happen because the beforeunload script would cause the information to be reseted. It even does it when I press F5 which isn't something I want either. Now FF and Chrome aren't having that problem when the form is submitted don't know why though. Here is the code I have written so far.
<script type="text/javascript">
window.onbeforeunload = function() {
var hiddenBtn = document.getElementById("kioskform:broswerCloseSubmit");
return  hiddenBtn.click();
           }   </script>

Just wondering how to go about this any advice is very appreciated thank you.

A: Define a html hidden variable.  Assign a value to when the user submits the form.  Then in your unload function, check that hidden variable.  If it's populated with whatever value, then leave the function.
<script type="text/javascript">
 window.onbeforeunload = function() {
  if (document.getElementById("wasformsubmitted").value != "Y") {
    var hiddenBtn = document.getElementById("kioskform:broswerCloseSubmit");
    return  hiddenBtn.click();
  }
}
function SetSubmitVariables()
{
 document.getElementById("wasformsubmitted").value = "Y";
 return true;
}
</script>
<body>
  <form ... onsubmit="return SetSubmitVariables();">
    <input type="hidden" id="wasformsubmitted" value="N" />
    ...
  </form>
</body>

A: You can remove onBeforeUnload listener from window when you submit the form
E.g. if you submit form with id="form1", then you can add this code.

    document.getElementById('form1').onsubmit = function(){
        window.onbeforeunload=function(){};
    }


text:
Q: Upon reboot, Linux software raid fails to include one device of a RAID1 array One of my four Linux software raid arrays drops one of its two devices when I reboot my system. The other three arrays work fine. I am running RAID1 on kernel version 2.6.32-5-amd64 (Debian Squeeze). Every time I reboot, /dev/md2 comes up with only one device. I can manually add the device by saying $ sudo mdadm /dev/md2 --add /dev/sdc1. This works fine, and mdadm confirms that the device has been re-added as follows:
mdadm: re-added /dev/sdc1

After adding the device and allowing the array time to resynch, this is what the output of $ cat /proc/mdstat looks like:
Personalities : [raid1]
md3 : active raid1 sda4[0] sdb4[1]
      244186840 blocks super 1.2 [2/2] [UU]

md2 : active raid1 sdc1[0] sdd1[1]
      732574464 blocks [2/2] [UU]

md1 : active raid1 sda3[0] sdb3[1]
      722804416 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      6835520 blocks [2/2] [UU]

unused devices: <none>

Then after I reboot, this is what the output of $ cat /proc/mdstat looks like:
Personalities : [raid1]
md3 : active raid1 sda4[0] sdb4[1]
      244186840 blocks super 1.2 [2/2] [UU]

md2 : active raid1 sdd1[1]
      732574464 blocks [2/1] [_U]

md1 : active raid1 sda3[0] sdb3[1]
      722804416 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      6835520 blocks [2/2] [UU]

unused devices: <none>

During reboot, here is the output of $ sudo cat /var/log/syslog | grep mdadm :
Jun 22 19:00:08 rook mdadm[1709]: RebuildFinished event detected on md device /dev/md2
Jun 22 19:00:08 rook mdadm[1709]: SpareActive event detected on md device /dev/md2, component device /dev/sdc1
Jun 22 19:00:20 rook kernel: [ 7819.446412] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.446415] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.446782] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.446785] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.515844] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.515847] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.606829] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:00:20 rook kernel: [ 7819.606832] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:48 rook kernel: [ 8027.855616] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:48 rook kernel: [ 8027.855620] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:48 rook kernel: [ 8027.855950] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:48 rook kernel: [ 8027.855952] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:49 rook kernel: [ 8027.962169] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:49 rook kernel: [ 8027.962171] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:49 rook kernel: [ 8028.054365] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:03:49 rook kernel: [ 8028.054368] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.588662] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.588664] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.601990] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.601991] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.602693] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.602695] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.605981] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.605983] mdadm: sending ioctl 1261 to a partition!
Jun 22 19:10:23 rook kernel: [    9.606138] mdadm: sending ioctl 800c0910 to a partition!
Jun 22 19:10:23 rook kernel: [    9.606139] mdadm: sending ioctl 800c0910 to a partition!
Jun 22 19:10:48 rook mdadm[1737]: DegradedArray event detected on md device /dev/md2

Here is the result of $ cat /etc/mdadm/mdadm.conf:
ARRAY /dev/md0 metadata=0.90 UUID=92121d42:37f46b82:926983e9:7d8aad9b
ARRAY /dev/md1 metadata=0.90 UUID=9c1bafc3:1762d51d:c1ae3c29:66348110
ARRAY /dev/md2 metadata=0.90 UUID=98cea6ca:25b5f305:49e8ec88:e84bc7f0
ARRAY /dev/md3 metadata=1.2 name=rook:3 UUID=ca3fce37:95d49a09:badd0ddc:b63a4792

Here is the output of $ sudo mdadm -E /dev/sdc1 after re-adding the device and letting it resync:
/dev/sdc1:
          Magic : a92b4efc
        Version : 0.90.00
           UUID : 98cea6ca:25b5f305:49e8ec88:e84bc7f0 (local to host rook)
  Creation Time : Sun Jul 13 08:05:55 2008
     Raid Level : raid1
  Used Dev Size : 732574464 (698.64 GiB 750.16 GB)
     Array Size : 732574464 (698.64 GiB 750.16 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2

    Update Time : Mon Jun 24 07:42:49 2013
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
       Checksum : 5fd6cc13 - correct
         Events : 180998

      Number   Major   Minor   RaidDevice State
this     0       8       33        0      active sync   /dev/sdc1

   0     0       8       33        0      active sync   /dev/sdc1
   1     1       8       49        1      active sync   /dev/sdd1

Here is the output of $ sudo mdadm -D /dev/md2 after re-adding the device and letting it resync:
/dev/md2:
        Version : 0.90
  Creation Time : Sun Jul 13 08:05:55 2008
     Raid Level : raid1
     Array Size : 732574464 (698.64 GiB 750.16 GB)
  Used Dev Size : 732574464 (698.64 GiB 750.16 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is persistent

    Update Time : Mon Jun 24 07:42:49 2013
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 98cea6ca:25b5f305:49e8ec88:e84bc7f0 (local to host rook)
         Events : 0.180998

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       1       8       49        1      active sync   /dev/sdd1

I also ran $ sudo smartctl -t long /dev/sdc and no hardware issues were detected. As long as I do not reboot, /dev/md2 seems to work fine. Does anyone have any suggestions?


text:
Q: Batch file called by scheduled task throws error when scheduled, runs fine when double clicked I have a batch file that maps a networked drive. About a week or so ago the password expired, so the program calling the batch file started throwing errors.
I've updated the password in the batch file, and when I double click on the batch file, the drive maps fine. However, when the scheduled task kicks off, I get the following error:
Logon failure: unknown user name or bad password.

Anyone seen this before? I've tried recreating the scheduled task, but it doesn't seem to make any difference.
EDIT
I've updated the properties of the scheduled task, which isn't the problem. The problem seems to be the username and password in the batch file. The strange thing is if I log on interactively and double click the executable, everything works perfectly.
The last time the job ran it threw a "semaphore timeout period has expired" error. I've never seen this particular error before, but it seems like it was actually logged on and trying to copy files when this happened.
EDIT
I've revised my code to make it as simple as possible. I'm using a batch file to map the drive, then using code to transfer the files. I still run into the same issue - it works fine when I double click the batch file, but once I throw Scheduler into the picture, it throws a "Bad username or invalid password" error.
Occasionally when I'm trying to run the file by double clicking on it, I get a "Could not find part of the path" error. This says to me the drive mapping actually worked but something failed when it was trying to copy. (Most of the time, testing by double clicking works fine)

A: The username and password associated with the task when you created it is no longer valid or has changed.
This occurs generally when creating the task and forgetting to select the option not to store the password. When your password is set to expire, then you will meet this problem everytime you will have to reset your password. Make sure to do as on the image :

A: It sounds like the username and/or password associated with the scheduled task is no longer correct. The batch file is likely OK, you just need to change the properties of the scheduled task.

A: I ran into something similar while testing a new powershell script we wrote to create a scheduled task to back up to one or more network locations. I had to go through a number of iterations, and when I decreased from two network locations to one, the scheduled task stopped working, with individual steps in the called script giving "Logon failure: unknown user name or bad password" errors, though when I copied the arguments and ran them from the command line they worked.
After reading this question and Tim's comment, I tried deleting the scheduled task and re-creating it. After that it worked. I would concur that the scheduled task likely cached something.

A: From:
https://danblee.com/log-on-as-batch-job-rights-for-task-scheduler/
Go to the Start menu.
Run.
Type secpol.msc and press Enter.
The Local Security Policy manager opens.
Go to Security Settings – Local Policies – User Rights Assignment node.
Double click Log on as a batch job on the right side.
Click Add User or Group…
Select the user and click OK.


text:
Q: Can not figure out insecure content in Mixed Content error I'm getting a mixed content error

on my webpage (flutter) but am not sure how to determine the insecure resource. I've gone through the requests on this page with the Network tab on Chrome, and they are all pointing to https.
In the console, I get this error
Mixed Content: The page at 'https://yhat.pub/profile/cbb493d3-4a1c-423b-9813-69da377acda6/build_nbs/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.yhat.pub/build/'. This request has been blocked; the content must be served over HTTPS.

But when I look at chrome dev tools, the URL they are stating http://api.yhat.pub/build/ is going over https.

Any suggestion is appreciated.


text:
Q: Rotate a 3d image On the website that I'm working on, there is an image that is initially rotated. I'm asked to turn it back so that it is facing us properly, but I really have no idea how to do it, I've tried
transform: rotateY(10deg);

transform: rotate3d(1, 1, 1, 45deg);

but they don't seem to be working.
I've created a minimal reproducible example here -

div {
  width: 400px;
  height: auto;
  margin: 0 auto;
}

img {
  width: 100%;
  height: 100%;
  display: block;
  transform:rotateY(140deg)
/*  need to turn it so that the picture is facing us with its front side  */
}

if someone could help with turning this image, I'd be really glad.
This is how it should look:

A: You can start by cutting the image using clip-path to keep only the needed side, then apply a transformation:

div {
  width: 400px;
  margin: 0 auto;
  filter:drop-shadow(-15px 15px 20px rgba(0,0,0,0.5));
}

img {
  width: 100%;
  display: block;
  clip-path:polygon(0% 4%,73.6% 16.5%,73.6% 100%,0 100%);
  transform:skew(-8deg) rotate(-7deg) rotateY(-7deg);
}


text:
Q: Order rows in a sequence and fill gaps for missing rows I got a problem regarding missing rows in a table that is giving me a headache.
As base data, I have the following table:
declare @table table
(
  id1   int,
  id2   int,
  ch    char(1) not null,
  val   int
)

insert into @table values (1112, 121, 'A', 12)
insert into @table values (1351, 121, 'A', 13)
insert into @table values (1411, 121, 'B', 81)
insert into @table values (1312, 7, 'C', 107)
insert into @table values (1401, 2, 'A', 107)
insert into @table values (1454, 2, 'D', 107)
insert into @table values (1257, 6, 'A', 1)
insert into @table values (1269, 6, 'B', 12)
insert into @table values (1335, 6, 'C', 12)
insert into @table values (1341, 6, 'D', 5)
insert into @table values (1380, 6, 'A', 3)

The output should be ordered by id2 and follow a fixed sequence of ch, which should repeat until next id2 begins.
Sequence:
'A'
'B'
'C'
'D'

If the sequence or the pattern is interrupted, it should fill the missing rows with null, so that i get this result table:
id1     id2     ch     val
----------------------------
1112    121     'A'    12
NULL    121     'B'    NULL
NULL    121     'C'    NULL
NULL    121     'D'    NULL
1351    121     'A'    13
1411    121     'B'    81
NULL    121     'C'    NULL
NULL    121     'D'    NULL
NULL    7       'A'    NULL
NULL    7       'B'    NULL
1312    7       'C'    107
NULL    7       'D'    NULL
1401    2       'A'    107
NULL    2       'B'    NULL
NULL    2       'C'    NULL
1454    2       'D'    107

and so on...
What I'm looking for is a way to do this without iterations.
I hope someone can help!
Thanks in advance!

A: A solution might be this:
declare @table table (  id1   int,  id2   int,  ch    char(1) not null,  val   int     )
insert into @table values (1112, 121, 'A', 12)
    ,(1351, 121, 'A', 13),(1411, 121, 'B', 81),(1312, 7, 'C', 107),(1401, 2, 'A', 107)
    ,(1454, 2, 'D', 107),(1257, 6, 'A', 1),(1269, 6, 'B', 12),(1335, 6, 'C', 12)
    ,(1341, 6, 'D', 5),(1380, 6, 'A', 3)
;with foo as
(select
    *
    ,row_number() over (partition by id2 order by id1) rwn
    ,ascii(isnull(lag(ch,1) over (partition by id2 order by id1),'A'))-ascii('A')  prev
    ,count(*) over (partition by id2,ch) nr
    ,ascii(ch)-ascii('A') cur
from @table

)
,bar as
(
select
*,case when cur<=prev and rwn>1 then 4 else 0 end + cur-prev step
from foo
)
,foobar as
(
select *,sum(step) over (partition by id2 order by id1 rows unbounded preceding) rownum
from bar
)
,iterations as
(
select id2,max(nr) nr from foo
group by id2
)
,blanks as
(
select
id2,ch chnr,char(ch+ascii('A') )ch,ROW_NUMBER() over (partition by id2 order by c.nr,ch)-1 rownum,c.nr
from iterations a
inner join (values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)) c(nr)
on c.nr<=a.nr
cross join (values (0),(1),(2),(3)) b(ch)
)
select
b.id1,a.id2,a.ch,b.val
from blanks a
left join foobar b
on a.id2=b.id2 and a.rownum=b.rownum
order by a.id2,a.rownum

I first make the query "foo" which looks at the row number and gets the previous value for ch for each id2.
"bar" then finds how many missing values there are between the rows. For instance If the previous was an A and the current is a c then there are 2. If the previous was an A and the current is an A, then there are 4!
"foobar" then adds the steps, thus numbering the original rows, where they should be in the final output.
"iterations" counts the number of times the "ABCD" rows should appear.
"BLANKS" then is all the final rows, that is for each id2, it outputs all the "ABCD" rows that should be in the final output, and numbers them in rownum
Finally I left join "foobar" with "BLANKS" on id2 and rownum. Thus we get the correct number of rows, and the places where there are values in the original is output.

A: I'm little confused by your output, try this:
Update
   DECLARE @table TABLE
    (
      row INT IDENTITY(1, 1) ,
      id1 INT ,
      id2 INT ,
      ch CHAR(1) NOT NULL ,
      val INT
    );

 DECLARE @Sequence TABLE ( ch3 CHAR(1) NOT NULL );

 INSERT INTO @Sequence
 VALUES ( 'A' );
 INSERT INTO @Sequence
 VALUES ( 'B' );
 INSERT INTO @Sequence
 VALUES ( 'C' );
 INSERT INTO @Sequence
 VALUES ( 'D' );

 INSERT INTO @table
 VALUES ( 1112, 121, 'A', 12 );
 INSERT INTO @table
 VALUES ( 1351, 121, 'A', 13 );
 INSERT INTO @table
 VALUES ( 1411, 121, 'B', 81 );
 INSERT INTO @table
 VALUES ( 1312, 7, 'C', 107 );
 INSERT INTO @table
 VALUES ( 1401, 2, 'A', 107 );
 INSERT INTO @table
 VALUES ( 1454, 2, 'D', 107 );
 INSERT INTO @table
 VALUES ( 1257, 6, 'A', 1 );
 INSERT INTO @table
 VALUES ( 1269, 6, 'B', 12 );
 INSERT INTO @table
 VALUES ( 1335, 6, 'C', 12 );
 INSERT INTO @table
 VALUES ( 1341, 6, 'D', 5 );
 INSERT INTO @table
 VALUES ( 1380, 6, 'A', 3 );

 SELECT r.id1 ,
        fin.id2 ,
        ch3 ,
        r.val
 FROM   ( SELECT    *
          FROM      ( SELECT    CASE WHEN r.chd - l.chd = 1 THEN 0
                                     ELSE 1
                                END [gap in sq] ,
                                l.*
                      FROM      ( SELECT    id2 ,
                                            ASCII(ch) chd ,
                                            ch ,
                                            val ,
                                            id1 ,
                                            row
                                  FROM      @table
                                ) AS l
                                LEFT JOIN ( SELECT  id2 ,
                                                    ASCII(ch) chd ,
                                                    row
                                            FROM    @table
                                          ) AS r ON l.row = r.row - 1
                    ) AS temp ,
                    @Sequence s
          WHERE     temp.[gap in sq] = 1
                    OR ( temp.[gap in sq] = 0
                         AND s.ch3 = temp.ch
                       )
        ) AS fin
        LEFT JOIN @table r ON r.id2 = fin.id2
                              AND r.id1 = fin.id1
                              AND r.ch = fin.ch3

A: If you can manage to add an extra column in your table, that defines which [id2] are part from the same sequence you can try this:
declare @table table
(
  id1   int,
  id2   int,
  ch    char(1) not null,
  val   int,
  category  int -- extra column
)

insert into @table values (1112, 121, 'A', 12, 1)
insert into @table values (1351, 121, 'A', 13, 2)
insert into @table values (1411, 121, 'B', 81, 2)
insert into @table values (1312, 7, 'C', 107, 3)
insert into @table values (1401, 2, 'A', 107, 4)
insert into @table values (1454, 2, 'D', 107, 4)
insert into @table values (1257, 6, 'A', 1, 5)
insert into @table values (1269, 6, 'B', 12, 5)
insert into @table values (1335, 6, 'C', 12, 5)
insert into @table values (1341, 6, 'D', 5, 5)
insert into @table values (1380, 6, 'A', 3, 5)

DECLARE @sequence table (seq varchar(1))
INSERT INTO @sequence values ('A'), ('B'), ('C'), ('D')

SELECT b.id1, a.id2, a.seq, b.val, a.category
INTO #T1
FROM (
    SELECT *
    FROM  @table
    CROSS JOIN @sequence
) A
LEFT JOIN (
    SELECT * FROM @table
) B
    ON 1=1
    AND a.id1 = b.id1
    AND a.id2 = b.id2
    AND a.seq = b.ch
    AND a.val = b.val

;WITH rem_duplicates AS (
    SELECT *, dup = ROW_NUMBER() OVER (PARTITION by id2, seq, category ORDER BY id1 DESC)
    FROM #T1
) DELETE FROM rem_duplicates WHERE dup > 1

SELECT * FROM #T1 ORDER BY id2 DESC, category ASC, seq ASC

DROP TABLE #T1


text:
Q: Would you like to tell me the reason why the version of bundler remains "2.2.16" in Gemfile.lock, even though I updated bundler to "2.2.21"? My ruby version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5.
I use macOS Big Sur(version 11.4) and the text editor "Atom".
The bundler (version 2.2.16) should have been updated
to "2.2.21 " as bellow.
$ bundler -v

Your /Users/****/.bundle/config config includes `BUNDLE_--LOCAK`,
which contains the dash character (`-`).
This is deprecated, because configuration through `ENV` should be possible,
but `ENV` keys cannot include dashes.
Please edit /Users/****/.bundle/config and replace any dashes in configuration keys with a triple underscore (`___`).
Bundler version 2.2.21

But the version of bundler remains "2.2.16" in the following
file "Gemfile.lock".
BUNDLED WITH
   2.2.16

Please tell me the reason why the version of bundler remains "2.2.16" in Gemfile.lock.

A: Your existing application will continue to use the bundler version it was created with, unless you explicitly update it.
To update your application bundler, run this command:
bundle update --bundler

Alternatively:
bundle <VERSION> update --bundler


text:
Q: mat-sidenav sidenav.toggle() is not working I have my toggle button inside the mat-toolbar. The expectation is that I can use the toggle bar to hide and show the sidenav however that is not working. The sidenav is to remain closed until the toggle button is clicked. The toolbar and the sidenav container are in the same component. I also do not have any errors in the console.
nav.component.html
<mat-toolbar ngClass="transparent-nav">

             Login
             Select a plan

        <button mat-icon-button ngClass="btn-toggle-blue">
            <mat-icon (click)="sidenav.toggle()">
                menu
            </mat-icon>
        </button>

</mat-toolbar>

<mat-sidenav-container>
    <mat-sidenav #sidenav mode="side">

             Login
             Select a plan

    </mat-sidenav>

    <mat-sidenav-content>

            <router-outlet></router-outlet>

    </mat-sidenav-content>
</mat-sidenav-container>

nav.component.ts
 @ViewChild(MatSidenav) sidenav !: MatSidenav;

A:
app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatListModule } from '@angular/material/list';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';

@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    RouterModule,
    MatButtonModule,
    MatIconModule,
    MatInputModule,
    MatToolbarModule,
    MatSidenavModule,
    MatListModule,
    MatButtonModule,
    MatIconModule,
  ],
  declarations: [AppComponent, HelloComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

app.component.ts

import { Component, VERSION } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'app-component',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  title = 'Angular ' + VERSION.major;

  constructor() {}
}

app.component.html

<mat-toolbar color="primary">
  <mat-toolbar-row>
    <button mat-icon-button>
      <mat-icon (click)="sidenav.toggle()">menu</mat-icon>
    </button>

SimpleCRM

       Accounts
       Create Account
       Contacts
       Create Contact
       Activities
       Create Activity

  </mat-toolbar-row>

  <mat-toolbar-row>
    SimpleCRM helps you easily manage your contacts
  </mat-toolbar-row>
</mat-toolbar>

<mat-sidenav-container>
  <mat-sidenav #sidenav>
    <mat-nav-list>
       Accounts
       Create Account
       Contacts
       Create Contact
       Activities
       Create Activity
      Close
    </mat-nav-list>
  </mat-sidenav>
  <mat-sidenav-content>

  </mat-sidenav-content>
</mat-sidenav-container>

Working example is here


text:
Q: MySQL query - Return consult even if one field doesn't exist in the related tables I have this Query:
 SELECT of2ab_content.id, of2ab_content.title, of2ab_content.metakey, of2ab_content.metadesc, of2ab_content.introtext, of2ab_content.fulltext AS completetext, of2ab_content.publish_up, of2ab_users.name AS author
 FROM of2ab_content, of2ab_users
 WHERE of2ab_content.id = 5039
 AND (of2ab_users.id=of2ab_content.created_by)

The problem here is when in the field exist in of2ab_content.created_by but it does not exist on the table of2ab_users.id, then the query return empty. I need the query to return the rest of the fields if the author does not exist in the users table.
Any suggest?

A: You want a left join.  Simple rule:  Never use commas in the FROM clause; always use explicit join syntax.
SELECT c.id, c.title, c.metakey, c.metadesc, of2ab_content.introtext,
       c.fulltext AS completetext, c.publish_up, u.name AS author
 FROM of2ab_content c LEFT JOIN
      of2ab_users u
      ON u.id = c.created_by
WHERE c.id = 5039;

Note that the use of table aliases always makes the query easier to write and to read.


text:
Q: Nuget does not include ancillary (license) files in output We are using nuget to package an older library (dll) file for use in our enterprise nuget share.  We have done this successfully with numerous other libraries.
With the current one I'm packaging, there is a license file (.lic file) that must be copied along with the dll and xml files, but which is not getting included with the build output.  Here is my <files> section from .nuspec:
<files>
    <file src="Lic\test.lic" target="lib" />
    <file src="net4.0\test.dll" target="lib" />
    <file src="net4.0\test.XML" target="lib" />
</files>

This results in all three files being packaged in the lib folder of .nupkg file (as expected).  However, when the consuming project is built, the .lic file is missing from the \bin folder:
licence file missing from output
I've tried many variations of the <file> tag, and have even tried variations of the <contentFiles><files...>  tag.
Does anyone have any idea how to get the .lic file to be copied with the compiled output?
Edit 6/30/2020:
Ok I have tried the technique suggested by @thatguy, but it is not working.  The .lic file is not getting included in the bin folder when the project is compiled; it is not even referenced in the .nupkg file when I unzip it.
I verified my visual studio project is using PackageReferences by opening the project file.  That the .lic file is missing from the .nupkg suggests an error in the .nuspec file content.  Here is screenshot of my nuspec file.  Is there still something awry with the tags or content?
Screenshot of my .nuspec content

A: If you use PackageReference instead of packages.config, then you can use the contentFiles tag. It has to be contained in the metadata tag. Place content files like test.lic in a subfolders any\any\, otherwise it will not work. The following snippet will cause the content files to be copied to the output folder when building the project.
<contentFiles>
    <files include="any/any/test.lic" buildAction="None" copyToOutput="true" />
</contentFiles>

You can upgrade existing .NET Framework projects to use PackageReference. .NET Core projects will have it by default. If you cannot upgrade or you do not want to use contentFiles because of its contraints, you can also use props and targets files for MS Build. One the one hand, it is much more complex to implement and get right, on the other hand, it offers maximum flexibility and enable you to use features of MS Build which is much more beyond copying files. You can find an example for your use-case here.


text:
Q: screen sharing software creation using as3 I wish to do screen sharing application using as3 as the part of one project.
how to get screen sharing video using as3. Thanks.

A: Screen sharing with flash is already possible with LiveCycle Collaboration Service. Read this article for more info
Update:
LiveCycle Collaboration Service is now known as Influxis Collaboration Service

A: AS3 does not support this per se. There are some solutions that use java or other technologies to stream through a streaming media server such as Flash Media Server (I'm guessing Fuze Meetings uses something like this), but you cannot do this with just the Flash Player alone. Adobe's Connect Now supports some screen sharing through their Acrobat.com service.

A: ScreenCamera SDK is definitily your best option here. It installs a camera on the system just like a regular webcam to which you can connect using Flex. ScreenCamera SDK remains completely invisibe to the end user so it looks like your app is doing all the video capture and recording and sharing.
You can test it from here:
http://www.pcwinsoft.com/download/slsdk/
I think this is the simplest way to do what you want to do,


text:
Q: Convert strings of either one date or possibly two, to the correct number of Java date instances I have the following possible string patterns (whitespace is variable):
2-4 Jun
8-11 Jun
8 Jun-11 Jun
20-Jun
28 Jun-01 Jul
15-18 Jun

and I want to convert to Java dates, either one or two.
Any regex shortcuts ? Iam migrating a legacy excel spreadsheet if it makes a difference, the column is not formatted)

A: If I understood correctly your question, here is a snippet that should do it or at least give you the basics:
Matcher m = Pattern.compile("(\\d+)-(\\d+)?\\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)").matcher(input);
while (m.find()) {
    if (m.groupCount()==3) {
        int first = Integer.valueOf(m.group(1));
        int second = Integer.valueOf(m.group(2));
        String month = m.group(3);
        // DO something here
    } else {
        int first = Integer.valueOf(m.group(1));
        String month = m.group(2);
        // Do something here
    }
}


text:
Q: How to add a multilingual support in react js with api call? I am trying to add a multilingual support in my ReactJS website, the challenge is that it has to be done by making an api call. Whenever the user selects a language an api call is to be made with the user selected value. I have almost 10 apis that needs to be triggered at the same time.
My locale lang variable
import enLang from './entries/en_US';
import daLang from './entries/da_DK';

const AppLocale = {
  en: enLang,
  da: daLang,

};
export default AppLocale;

[]

A: Assuming you are not asking on language translation, and the entries return javascript objects or arrays.
A simple demonstration to change language with select is like this.
import enLang from './entries/en_US';
import daLang from './entries/da_DK';
const Component = () => {

   const [language, setLanguage] = useState(en);

  return (

  <select name="language" onChange={(e) => setLanguage(e.target.value)}>
      <option value="en">DA</option>
      <option value="en">EN</option>
  </select>

{ JSON.stringify(language, null, 4) }

)
}


text:
Q: Why we are creating variable of type of class? First Line we can use for create object, in which scenario we can use 2 and 3?

*

*Test test =new Test();

*Test test =null;

*Test test ;

A: The first way actually creates an instance called Test and assigns it to the variable test.
Test test =new Test(); // ' ; ' missing

The second only assigns a null pointer to test.
Test test =null;

The third way does not assign anything to test, unless it is an instance variable in which case it will assign a value of null to it.
Test test ;

A: You clearly don't "know" the following "ways" to create an object, since only one of your "ways" actually does (assuming the proper semicolon is added to allow the line to compile).
Test test = new Test();

That is the only way to actually create an object in direct Java syntax.  Object creation can be obfuscated by methods that use the new keyword behind the scenes, but it boils down to using the new keyword and a constructor invocation.
Test test = null;

Setting this variable to null doesn't create anything but a holder for a Test object named test.  But null is not an object and nothing is created.
Test test;

This line does the same thing as setting test to null in a class, but in a method it allows the declaration for the holder to allow it to be set in another line further down.  However, you will get a syntax error if the Java compiler can't figure out a path that you actually set this variable prior to it being read in further code.  To get around this error, you can set it to null at the beginning like the previous line.

A: Test test;

in this case , didn't make object. this only create test variable in stack. it is Type is Test object type.
Test test=null;

in this case you assign null value to that referens.
Test test =new Test();

this mean ,you crate new object in class Test.this object made in heap.
I think this is basic thing  java. you do further research.
thank you.

A:   public class Test{
    int a ;

    public Test(){
    }

    public class Test(int a){
        this.a = a ;
    }

    public static void main(String args[]){
        //To define a variable of type Test
        Test t ;
        //Defining another variable of type Test
        Test t2;

        //To instantiate an object of type Test using no argument constructor
        //Now t holds a reference to object created by new Test()
        t = new Test();

        //Pass the Object reference in t to t2 variable
        t2 = t ;

        //To instantiate an object using one argument constructor Test(int a)
        //Now t will hold reference to object created by new Test( 2)
        //That makes old Test instance created by no argument constructor eligible to be cleanedup by garbage collector
        t= new Test(2);

        //now to release the reference to object created by new Test(2) , we set null
        //In better words, we are setting the reference to "null", so that variable t no longer point to the test instance"
        //For better understanding, search for database/JDBC programming example to see how we use "null" in finally block
        t = null;
    }

Generally null is used to dereference any of the objects referenced by the particular variable.


text:
Q: Crash on _CFArrayGetValueAtIndex when calling CGPathRelease on CGPath object I'm getting a crash that I am completely stumped on, when releasing a CGPath object. The crash is occurring in the CoreTextHyperlinkView library at the end of the - (void)drawInContext:(CGContextRef)ctx bounds:(CGRect)bounds method in the JSCoreTextView class.
Basically it's using Core Graphics/Text to draw underlined text. It creates a path, draws it, then releases it.
Here is the relevant stack trace:
Thread 0 Crashed:
0   CoreFoundation                      0x319058b6 _CFArrayGetValueAtIndex + 2
1   MyApp                               0x00300891 -[JSCoreTextView drawInContext:bounds:] (JSCoreTextView.m:678)
2   MyApp                               0x00300c5f -[JSCoreTextView drawRect:] (JSCoreTextView.m:709)
3   UIKit                               0x337ded61 -[UIView(CALayerDelegate) drawLayer:inContext:] + 365
4   QuartzCore                          0x3358f315 -[CALayer drawInContext:] + 113
5   QuartzCore                          0x3358e8c3 CABackingStoreUpdate_ + 1779
6   QuartzCore                          0x3358e037 CA::Layer::display_() + 975
7   QuartzCore                          0x335850b7 CA::Layer::display_if_needed(CA::Transaction*) + 203
8   QuartzCore                          0x33584fe1 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 25
9   QuartzCore                          0x335849c3 CA::Context::commit_transaction(CA::Transaction*) + 239
10  QuartzCore                          0x335847d5 CA::Transaction::commit() + 317
11  QuartzCore                          0x33584639 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 61
12  CoreFoundation                      0x3199b941 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21
13  CoreFoundation                      0x31999c39 __CFRunLoopDoObservers + 277
14  CoreFoundation                      0x31999f93 __CFRunLoopRun + 747
15  CoreFoundation                      0x3190d23d _CFRunLoopRunSpecific + 357
16  CoreFoundation                      0x3190d0c9 _CFRunLoopRunInMode + 105
17  GraphicsServices                    0x354ec33b _GSEventRunModal + 75
18  UIKit                               0x338292b9 _UIApplicationMain + 1121
19  MyApp                               0x0003fad7 main (main.m:13)

It seems like some array internal the the CGPath is causing the problem. Could this just be a Core Text or Core Graphics bug in iOS? I'm stuck as to how to go about investigating further as I can't look into the source code of the iOS SDK.
We only use this view in a modified BlockAlertView like this below example. We're getting the text from our JSON API in either english or arabic, which may contain email addresses or URLs to be underlineed and linkified.
JSCoreTextView *coreTextView = [[JSCoreTextView alloc] initWithFrame:CGRectMake(kAlertViewBorder, _height, frame.size.width-kAlertViewBorder*2, size.height)];
coreTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
coreTextView.delegate = self;
coreTextView.text = message;
coreTextView.textColor = _messageColor;
coreTextView.textAlignment = kCTCenterTextAlignment;
coreTextView.fontName = _messageFont.fontName;
coreTextView.fontSize = _messageFont.pointSize;
coreTextView.linkColor = _messageColor;
coreTextView.highlightedLinkColor = _messageLinkColor;
coreTextView.highlightColor = _messageColor;
coreTextView.backgroundColor = UIColor.clearColor;
coreTextView.underlined = YES;
[_view addSubview:coreTextView];


text:
Q: How do you change the default Gradle wrapper and build file in IntelliJ? I'm trying to switch over to Gradle Kotlin DSL from vanilla Gradle for all my IntelliJ/Kotlin projects. This requires me to specify the distributionUrl property in a Gradle wrapper task of the build file. However whenever I create a Gradle project and choose the "default Gradle wrapper" option, IntelliJ automatically generates a vanilla Gradle version 4.0 (atleast as of right now) wrapper and builds the project using it. Not only does this install an unused Gradle distro on my machine and makes me manually have to recreate the build file and wrapper, but also Gradle 4.0 isn't compatible Java 9.
Is there any way to change what default Gradle wrapper/build file is generated by IntelliJ as I see no wrapper configuration options in the settings tab of the Gradle plugin?

A: So this is actually a requested feature (thanks to @y.bedrov for the info), but I've found a temporary workaround...
Instead of using the Gradle project creation wizard, you can import a custom buildscript via Import Project. This actually supports Kotlin DSL! However for that, you'll have to add a wrapper task in the buildscript and set the distributionUrl to one of the releases here.


text:
Q: How to re-enable display after using unset DISPLAY I recently installed ubuntu 17.10.1 after previously messing it up.So while I was reinstalling Android Studio I faced an issue where it refused to install.After following some tutorial I found out that the issue was running their installer script as Super User but before that another one had mislead me into using this command "unset DISPLAY" so now I can access my display devices and I badly need the night light feature.Please help.
Here is a screenshot of what I get in the display devices panel.Yet before using the command I could access it.link here

A: Did you just try logging out and in again?  Anyway, the default value of the DISPLAY variable is :0
so to reset it:
export DISPLAY=":0"


text:
Q: Getting website image URLs automatically using Excel VBA I have several websites for property listings that I want to get images from and bring them into excel cells automatically using VBA, but I guess I first need to fetch all the image URLs whereby the separate procedure will fetch the images.
I am currently using the following procedure:
Sub scrapeimageurls()

Dim website as string
Dim IE As InternetExplorer
Dim html As HTMLDocument
Dim ElementCol As Object, Link As Object
Dim erow As Long

Application.ScreenUpdating = False

website = "https://ss.ge/ka/udzravi-qoneba/iyideba-4-otaxiani-bina-saburtaloze-3872071"

Set IE = New InternetExplorer

IE.Visible = False

IE.navigate website

Do While IE.readyState <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to website…"
Loop

Set html = IE.document
Set ElementCol = html.getElementsByTagName("img")

For Each Link In ElementCol
erow = Worksheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1).Value = Link.src

Next

End Sub

But this code brings all the unnecessary URLs for all the logos and stuff on the website, and I just want to get only the URLs of the images of the properties themselves. Is there another way to get these specific URLs?
The websites (other than the one used in the procedure) I want to get these data from are the following:

*

*https://www.myhome.ge/ka/pr/11377747/iyideba-Zveli-ashenebuli-bina-vakeshi-wyneTis-qucha-3-oTaxiani

*https://livo.ge/udzravi-qoneba/iyideba-bina/iyideba-5-otaxiani-bina-saburtaloze-349298

*https://gethome.ge/udzravi-koneba/75955-iqideba-2-otakhiani-bina

*https://www.myclient.ge/detail?id=61352

*https://www.makler.ge/ka/ad/iyideba-3-othaxiani-bina-vakeshi-20000401

*https://area.ge/ka/search?listingId=236146
Also, this is another procedure that was shared with me on the previous question like this, but this only works for the website that's in the code itself, not on the other ones.
Public Sub ImageLinks()

Dim ie As SHDocVw.InternetExplorer

Set ie = New SHDocVw.InternetExplorer

With ie

    .Visible = True
    .Navigate2 "https://ss.ge/ka/udzravi-qoneba/iyideba-4-otaxiani-bina-saburtaloze-3872071"

    While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend

    With .Document.querySelectorAll(".OrdinaryContainer > img")

        Dim i As Long

        For i = 1 To .length

            ActiveSheet.Cells(i, 1) = .Item(i - 1).src

        Next

    End With

    .Quit
End With

End Sub


text:
Q: Convert forecast time produced by arima into standard date time I have performed forecasting using ARIMA :
Forecasts results look like below:
    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
15552001       18.80470 18.52527 19.08413 18.37735 19.23206
15555601       18.94718 18.63358 19.26078 18.46758 19.42679
15559201       18.86774 18.53623 19.19924 18.36074 19.37473
15562801       18.84979 18.46603 19.23355 18.26288 19.43670
15566401       18.91506 18.52182 19.30830 18.31366 19.51646
15570001       18.86569 18.46538 19.26599 18.25347 19.47791
15573601       18.86727 18.45311 19.28143 18.23387 19.50067
15577201       18.89555 18.47853 19.31258 18.25777 19.53334
15580801       18.86784 18.44715 19.28854 18.22444 19.51125
15584401       18.87419 18.44782 19.30056 18.22212 19.52627
15588001       18.88546 18.45692 19.31399 18.23007 19.54085
15591601       18.87097 18.43914 19.30280 18.21054 19.53139
15595201       18.87679 18.44097 19.31262 18.21025 19.54334
15598801       18.88064 18.44225 19.31904 18.21018 19.55111
15602401       18.87349 18.43165 19.31533 18.19775 19.54923
15606001       18.87755 18.43210 19.32300 18.19630 19.55880
15609601       18.87844 18.43003 19.32685 18.19265 19.56423
15613201       18.87510 18.42320 19.32701 18.18397 19.56623
15616801       18.87759 18.42224 19.33293 18.18120 19.57397
15620401       18.87748 18.41899 19.33597 18.17627 19.57868
15624001       18.87602 18.41411 19.33793 18.16959 19.58245
15627601       18.87742 18.41219 19.34264 18.16592 19.58891

I want to convert this point into human readable date time. How do I do that?
My initial dataframe has epoch times as row.names like :
         y

1484337600  19.22819
1484341200  19.28906
1484344800  19.28228
1484348400  19.21669
1484352000  19.32759
1484355600  19.21833
1484359200  19.20626
1484362800  19.28737
1484366400  19.20651
1484370000  19.18424
This initial dataset I converted using :
xts_dataframe <- xts(x = dataframe$y, order.by = as.POSIXct(as.numeric(row.names(dataframe)), origin="1970-01-01"))

fit <- auto.arima(ts_dataframe ,trace = TRUE,stepwise = FALSE)  #411
  fc <- forecast(fit,h=24)
  fc <- as.POSIXct(as.numeric(fc$mean), origin = '1970-01-01')
  print(fc)

It's giving output like this now:
[1] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
  [3] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
  [5] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
  [7] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
  [9] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [11] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [13] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [15] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [17] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [19] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [21] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"
 [23] "1969-12-31 16:00:18 PST" "1969-12-31 16:00:18 PST"

with no prediction results.
Problem -2 : If I do not make any changes to point in my forecast result :
 fit <- auto.arima(ts_dataframe ,trace = TRUE,stepwise = FALSE)
    fc <- forecast(fit,h=24)
    print(fc)

I get result which I have posted at top. In this epoch time are of 1970 but it should be something after the last epoch time in my original dataframe. Please help.

A: You might check out the new sweep package. Here's a recent post describing the process. The following inputs based on your data frame:

*

*data is your data frame with a column of dates or datetimes and a column of values

*freq is your frequency and start is your start for the ts object

*h is your forecast periods into the future

Here's the general process.
library(forecast)
library(sweep)
library(timekit)

# Make ts with tk_ts()
data_ts <- tk_ts(data, freq = freq, start = start)

# auto.arima()
fit <- auto.arima(data_ts)

# Make forecast
fcast <- forecast(fit, h = h)

# Use sw_sweep with timekit_idx = TRUE
sw_sweep(fcast, timekit_idx = T)

A: i hope this is how your data looks like
> head(data)
       epoch        y
1 1484341200 19.28906
2 1484344800 19.28228
3 1484348400 19.21669
4 1484352000 19.32759
5 1484355600 19.21833
6 1484359200 19.20626

> data$epoch <- as.POSIXct(data$epoch, origin = '1970-01-01')

> head(data)
                epoch        y
1 2017-01-14 02:30:00 19.28906
2 2017-01-14 03:30:00 19.28228
3 2017-01-14 04:30:00 19.21669
4 2017-01-14 05:30:00 19.32759
5 2017-01-14 06:30:00 19.21833
6 2017-01-14 07:30:00 19.20626

> xts_dataframe <- xts(data$y, order.by = data$epoch)
> fit <- auto.arima(xts_dataframe ,trace = TRUE,stepwise = FALSE)
> fc <- forecast(fit,h=24)

> fc <- as.data.frame(fc)
> time1 <- as.data.frame(seq(tail(data$epoch,1)+60, length.out = nrow(fc), by = "30 min"))

> output <- as.data.frame(cbind(time1[,1],fc))
> print(output)


text:
Q: lightning:inputfield checkbox not saving According tot he documentation, lightning:inputfield should work for checkbox type field.
Here is a snapshot of the code we have:
<aura:attribute name="dealershiptTeamRecord" type="IMP_Dealership_Team_Info__c" />

<force:recordData aura:id="recordHandler"
                      recordId="{!v.recordId}"
                      targetFields="{!v.dealershiptTeamRecord}"
                      recordUpdated="{!c.handleRecordChange}"
                      mode="EDIT"
                      fields="IMP_Team_Closed_Friday__c"
/>

<lightning:recordEditForm aura:id="recordViewForm"
    recordId="{!v.recordId.Id}"
    recordTypeId="{!v.recordId.RecordTypeId}"
    objectApiName="IMP_Dealership_Team_Info__c"
    onload="{!c.handleRecordChange}">

        <lightning:inputField   fieldName="IMP_Team_Closed_Monday__c"
                                value="{!v.dealershiptTeamRecord.IMP_Team_Closed_Monday__c}" />
</lightning:recordEditForm>

Where IMP_Team_Closed_Monday__c is a checkbox field type,
In our case, the form, when saved, always sets the value to false not matter what the checkbox in the UI is set.

A: Your <lightning:recordEditForm> isn't receiving the correct sObject Id.
recordId="{!v.recordId.Id}"

should be
recordId="{!v.recordId}"

A: You need to bind your inputField value to an aura:attribute, and then set the value of the aura:attribute in lightning:inputField as value="{!v.IsAdHocItemCreationEnabled}".
IsAdHocItemCreationEnabled is a checkbox field on ActionPlanTemplate object.
I was successfully able to save the checkbox field value as selected in the UI.
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,lightning:actionOverride,force:hasRecordId,force:hasSObjectName"
                access="global" controller="ActionPlanTemplateController" >
    <aura:attribute name="User" type="String"/>
    <aura:attribute name="Name" type="String"/>
    <aura:attribute name="Description" type="String"/>
    <aura:attribute name="IsAdHocItemCreationEnabled" type="Boolean"/>
    <aura:attribute name="ActionPlanType" type="String[]"/>
    <aura:attribute name="TargetEntityType" type="String"/>

    <aura:attribute name="showSpinner" type="Boolean" default="false" />
    <aura:if isTrue="{!v.showSpinner}">
        <lightning:spinner variant="brand" alternativeText="Please Wait" size="small"/>
    </aura:if>

New Action Plan Template

            <c:LookUp
                      aura:id="TemplateOwner-lookup"
                      value="{!v.User}"
                      Description="Template Owner"
                      SelectedSObject="{ Name: 'User', Label: 'User', LabelPlural: 'Users', IconName: 'standard:user' }"
                      label="Template Owner"
                      showAdd="false"
                      />
            <lightning:recordEditForm aura:id="recordEditForm"
                                      objectApiName="ActionPlanTemplate"
                                      onsubmit = "{!c.handleSubmit}"
                                      onsuccess = "{!c.onSave}"
                                  >
                <lightning:messages />
                <lightning:inputField fieldName="Name" value="{!v.Name}" />
                <lightning:inputField fieldName="Description"  value="{!v.Description}"/>
                <lightning:inputField aura:id="checkboxField" fieldName="IsAdHocItemCreationEnabled" value="{!v.IsAdHocItemCreationEnabled}"/>
                <lightning:inputField fieldName="ActionPlanType" value="{!v.ActionPlanType}"/>
                <lightning:inputField fieldName="TargetEntityType" value="{!v.TargetEntityType}" />
                <lightning:button class="slds-m-top_small" type="submit" label= "{! $Label.Buttons.save}"  />
                <lightning:button class="slds-m-top_small" type="cancel" label="{! $Label.Buttons.cancel}" onclick="{!c.onCancel}" />
            </lightning:recordEditForm>

</aura:component>