text:
Q: Search for a list of words in a file, then find those words on another replacing the whole line with Class=ShipDummy,replacing the 2 lines below it I'd like to search for a list of words from an external list (simple each word on a line) which we'll call "List.txt", and search for them in a file (C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg) (matching the whole word, even if it's inside another, and matching case), then if they are there find those words on another file(Campaign_SCR.mis.tmp) (matching the whole word even if its inside another, matching case) replacing the whole line in (Campaign_SCR.mis.tmp) with Name=ShipDummy ONLY if the line starts with "Name=". After that the two lines below that in that same file would be replaced with 2nd line "Class=ShipDummy",  then 3rd line "Type=206".
Here is the code I have now. Now it searches for ClassName=Variable in C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg, then it replaces the whole line with Class=ShipDummy if it finds the variable in Campaign_SCR.mis.tmp. It also replaces 1 line below it with "Type=206".
setlocal enableDelayedExpansion

>Campaign_SCR.mis.tmp (
for /f "tokens=1* delims=:" %%A in ('findstr /n "^" Campaign_SCR.mis.backup') do (
    ( echo !ln!| findstr "^Type=12$" >NUL && set ln=ln ) || (
        set "ln=%%B"
        if "!ln:~0,6!"=="Class=" (
            findstr /s /c:"ClassName=!ln:~6!" "C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR\*.clg" >"C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR\null" && (
                echo Class=ShipDummy
                set "ln=Type=12"
            )
        )
        if #!ln!==# (echo;) else echo !ln!
    )
  )
)

BUT I'd like it to search for a name from a list I specify, search in (C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg). Then if it finds the match, then search for that in Campaign_SCR.mis.tmp and replace the whole line, only if that line starts with  "Name=", with Name=ShipDummy. The two lines below that would be replaced with 2nd line "Class=ShipDummy",  then 3rd line "Type=206":
Name=ShipDummy
Class=ShipDummy
Type=206

**Please keep in mind that within Campaign_SCR.mis.tmp the variable's line wont often appear as Name=variable. It is likely to be Name=(words)variable(words)
Can the list that is searched be external? Can we make it search one word per line. For exmaple: if the list is as follows:
Bismarck
Hood
Repulse
It will search for each word.**
When it matches the words from the list to (C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg) please ensure that it matches case as well. So "Bismarck" from list will find "Bismarck" from (C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg), and not find "bismarck"
Thank you for your time!
By the way, this may be a simpler workaround to the problem I have here: How do I apply this?
So for example:
Say I have an external list (call it List.txt for example) that looks like this:
Bismarck
Hood
Repulse

I will search C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg for that. Say it finds "Bismarck" and "Hood" in this:
sadfasfasfdBismarckfasdfasdfasdfas

asdfasfdafHoodasdfasfas

Then it will search Campaign_SCR.mis.tmp for Bismarck and Hood replacing:
Name=asdfBismarckasfdw
Class=jlkjf
Type=12

With:
Name=ShipDummy
Class=ShipDummy
Type=206

And
Name=asdfHoodasfdw
Class=jlkjf
Type=13

With:
Name=ShipDummy
Class=ShipDummy
Type=206

A: @echo off
setlocal EnableDelayedExpansion

REM INITIALIZE THE LIST OF WORDS THAT WILL BE SEARCHED
set targetWords=:EOF

rem I'd like to search for a list of words from an external list (simple each word on a line)
for /F %%a in (List.txt) do (
   rem and search for them in a file (C:\Uses\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg)
   findstr "%%a" "C:\Uses\P Ditty\Documents\SH3\data\cfg\Backups_SCR*.clg" > NUL
   rem if they are there...
   if !errorlevel! equ 0 (
      REM INSERT THE WORD IN THE TARGET LIST
      set targetWords=!targetWords! %%a
   )
)

REM INSERT THE END-OF-FILE MARK IN THE FILE
echo :EOF>> Campaign_SCR.mis.tmp

REM INITIALIZE THE NUMBER OF LAST PROCESSED LINE IN REDIRECTED Campaign_SCR.mis.tmp
set lastLine=0

rem ... find those words on another file(Campaign_SCR.mis.tmp)
< Campaign_SCR.mis.tmp (for /F "delims=:" %%a in ('findstr /N "%targetWords%" Campaign_SCR.mis.tmp') do (
   REM DUPLICATE PREVIOUS LINES UNTIL NEW TARGET LINE
   set /A numOfLines=%%a-lastLine-1
   for /L %%i in (1,1,!numOfLines!) do (
      set line=
      set /P line=
      echo(!line!
   )
   rem if the line starts with "Name="
   set /P line=
   if "!line:~0,5!" equ "Name=" (
      rem replacing the whole line...with Name=ShipDummy
      echo Name=ShipDummy
      rem After that the two lines below that in that same file would be replaced with 2nd line "Class=ShipDummy",
      set /P line=
      echo Class=ShipDummy
      rem then 3rd line "Type=206".
      set /P line=
      echo Type=206
      set /A lastLine=%%i+2
   ) else (
      REM DUPLICATE THE NON MATCHING LINE, IF IS NOT THE :EOF MARK
      if "!line!" neq ":EOF" (
         echo !line!
         set lastLine=%%i
      )
   )
)) > Campaign_SCR.mis.tmp.NEW

REM UPDATE THE NEW FILE
REM del Campaign_SCR.mis.tmp
REM ren Campaign_SCR.mis.tmp.NEW Campaign_SCR.mis.tmp


text:
Q: Local reporting options in a Disconnected environment? What are my options to allow local reporting in my environment?  I have an existing central reporting services already working that they access through the web.  I now need to offer those same reports on there local machine.
What are the local reporting options?  Each local machine has SQL Express 2005 running on it.  Would I have to replicate the ReportServer DB's as well then?
Is there another way?  Would it be easier to just generate them a different way to avoid messing with 200 install's of reporting services?  The existing reports are your basic grab the data from the DB reports.  Nothing fancy.

A: You can run the ReportViewer control in Local Processing mode.  In order to do this, in your environment, you will definately need the following two things:
1 - Report definition files (RDLC files) that will build the reports.
2 - Data to display in the reports.
You already have #1, you just need to package it somewhere in a local repository.  The ReportViewer control needs to be able to access this.  Be it a WebControl or a Winform control, they will both require RDLC files in order to create the reports.
As for the DATA, you will need to figure out how you will be replicating from the Database onto user machines.  One idea would be to generate XML files with the data, then read the XML into a Dataset and pass it to the reportViewer control.

redpajama_set_name: RedPajamaStackExchange


text:
Q: problems with setting a cookie hi in my code if there is no cookie show a page who set the cookie so the next time the user reaches the page will show another
if ((!isset($_COOKIE['app']) )){
        $plantilla->app_li();
        $val='desktop';
        $val1='app';
    echo setcookie($val1, $val, time() + (86400 * 2), '/');
    }else{
        echo $plantilla->home();
    }

if the cookie "app" exists shows $plantilla->home(); ,if not will show $plantilla->app_li(); and creat the cookie
but it dont create

A: Use $_COOKIE to retrieve a cookie with PHP. Once the cookies have been set, they can be accessed on the next page load.
$val1='app';

if(!isset($_COOKIE[$val1])) {
        $plantilla->app_li();
        $val='desktop';
    echo setcookie($val1, $val, time() + (86400 * 2), '/');
} else {
   echo $plantilla->home();
}

Looking your question and answer this link http://www.pontikis.net/blog/create-cookies-php-javascript


text:
Q: How to create multiple radio type that will etting seperated? Im trying to create 2 different questions with radion type in HTML. But whenever i tested it, it only allows me to pick 1 even though i used  to seperate those 2 questions so it won't interact. Any help pls?

Yes or No:

Yes

No

Gender:

Male

Female

A: Make Sure There are Separate Names for each question.
For more see the difference between snippet 1 and 2.
1 ( Working )

<form action="#" method="post">
  Q1:
  <input type="radio" name="q1"> A1
  <input type="radio" name="q1"> A2

  Q2:
  <input type="radio" name="q2"> A1
  <input type="radio" name="q2"> A2

  <button>Submit</button>
</form>

1 ( Not Working )

<form action="#" method="post">
  Q1:
  <input type="radio" name="q1"> A1
  <input type="radio" name="q1"> A2

  Q2:
  <input type="radio" name="q1"> A1
  <input type="radio" name="q1"> A2

  <button>Submit</button>
</form>

If This is not what you need pls update your question and add your code


text:
Q: Custom modeline calculation -> monitor "artefact" I am trying to get a custom resolution to run on my 4k, 60Hz TV. I am mostly working on a Thinkpad that only supports 4k@30Hz via Display Port. I would much rather work on a lower resolution with a higher refresh rate, so I set out to generate a custom modeline (1440p @60Hz).
This is necessary since the TVs edid information only forwards 4k and 1080p resolutions.
The first tool I was using is cvt:
> cvt 2560 1440 60
# 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz
Modeline "2560x1440_60.00"  312.25  2560 2752 3024 3488  1440 1443 1448 1493 -hsync +vsync

I added the mode to xrandr and started the output to my TV.
The following artefact is appearing now:

The left side of everything on my monitor gets replicated on the right side and overlaps a significant part of the right side of the monitor. This overlap is clearly only happening on the monitor level since I can move my mouse "below" the overlap on the right side.
What I did next was trying to understand this webpage about modeline calculation: Modeline Details.
I used the Modelines in my TVs edid and based on that information recalculated the clocks etc. for my specific resolution and my TV. However, it does not work. I cannot move the overlap an inch to the right or left regardless of the value I change in the given Modeline (except of course by changing the resolution itself). I need to be pointed into the right direction to understand where this artefact is coming from and how to resolve it.


text:
Q: JTextArea won't show up unless I call append() on it The following problem boggled my mind, so I came here for some help.
After experimenting I ended up with this block of code:
JTextArea chatPanel = null;
JScrollPane scrollPanel = null;

if(chatPanel == null)
{
    chatPanel = new JTextArea("derp");
    chatPanel.setEditable(false);
    chatPanel.setForeground(new Color(10,191,26));
    chatPanel.setOpaque(false);
    scrollPanel = new JScrollPane(chatPanel);
    scrollPanel.setOpaque(false);
    scrollPanel.getViewport().setOpaque(false);
    scrollPanel.setBorder(BorderFactory.createEmptyBorder());
}

//## marked area ##
scrollPanel.setBounds(9,596,435,138);
pane.add(scrollPanel);

The result? Nothing shows up. The text area with "derp" in it I expected is not there, just an empty scroll panel. Now, if I go to the ## marked area ## and replace it with this:
chatPanel.append("Hello.");

the chatPanel shows up fine in the scrollPanel, with its text being "derpHello.". Any ideas as per what's going on?
For the record, pane is a simple container with a null layout that otherwise displays eveyrthing fine. Declaration, just for the record:
Container pane = getContentPane()
pane.setLayout(null);

A: I have no problem with the following code, I can see the "derp" in green just fine:
import java.awt.Color;
import java.awt.Container;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

public class TestTextArea {

    private void initUI() {
        JFrame frame = new JFrame("test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JTextArea chatPanel = null;
        JScrollPane scrollPanel = null;
        Container pane = frame.getContentPane();
        pane.setLayout(null);
        if (chatPanel == null) {
            chatPanel = new JTextArea("derp");
            chatPanel.setEditable(false);
            chatPanel.setForeground(new Color(10, 191, 26));
            chatPanel.setOpaque(false);
            scrollPanel = new JScrollPane(chatPanel);
            scrollPanel.setOpaque(false);
            scrollPanel.getViewport().setOpaque(false);
            scrollPanel.setBorder(BorderFactory.createEmptyBorder());
        }

        // ## marked area ##
        scrollPanel.setBounds(9, 596, 435, 138);
        pane.add(scrollPanel);
        frame.validate();
        frame.setSize(600, 800);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                new TestTextArea().initUI();
            }
        });
    }

}

Now, I would really advise you to use an appropriate LayoutManager instead of that null layout. That would allow you to use pack() and revalidate() and have a much simpler and more maintainable code.
There must be something else that your code does not illustrate for now. Try to put an SSCCE.

A: There is nothing in your JTextArea to display as you initialize it with the empty String. When you append something to it, there is effectively text inside.
Note that your JScrollPane will never try to resize your component inside (why else would it allow you to scroll?). Therefore, you will have to set a dimension on your JTextArea.
EDIT (after your code correction): I can see "derp" just fine with following code.
public class TextTest extends JFrame {
public TextTest () {
    JPanel pane = new JPanel();
    JTextArea chatPanel = null;
    JScrollPane scrollPanel = null;

    if(chatPanel == null)
    {
        chatPanel = new JTextArea("derp");
        chatPanel.setEditable(false);
        chatPanel.setForeground(new Color(10,191,26));
        chatPanel.setOpaque(false);
        scrollPanel = new JScrollPane(chatPanel);
        scrollPanel.setOpaque(false);
        scrollPanel.getViewport().setOpaque(false);
        scrollPanel.setBorder(BorderFactory.createEmptyBorder());
    }

    //## marked area ##
    scrollPanel.setBounds(9,596,435,138);
    pane.add(scrollPanel);
    setContentPane(pane);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
}

public static void main(String[] args) {
    new TextTest();
}

}


text:
Q: Using R and gsub is there a way to remove two special characters and replace with one I want to remove two special characters from the vector in one line of code
 col1<-c("0;13:14"  "0:12\"22")

I don't want to do this though it works
df$Col1<-
  gsub(";",":",df$Col1)

df$Col1<-
  gsub("\",":",df$Col1)

Is there a way to replace ";" or "" with ":" in one gsub line?


text:
Q: How to load a class from a .cs file Is it possible to load a class and create Instance of it from It's .cs file?
I want to open a custom class in a .cs file and create instance of it in my application
thanks

A: You can use Microsoft.CSharp.CSharpCodeProvider and System.CodeDom to execute code at runtime, there is an article about this code project here and here

A: in theory yes - it mainly depends on whether you have all dependencies available...
IF so you can use the built-in CSharpCodeProvider to compile the .cs- file to an assembly (can be purely in-memory if need be) and then use Reflection to create an instance/use a class from that assembly...
Since don't provide much detail I would suggest to checkout these links and come back with detail questions if some arrise:

*

*http://support.microsoft.com/kb/304655/en-us

*http://www.codeproject.com/KB/cs/codecompilation.aspx

*http://www.digitalcoding.com/Code-Snippets/C-Sharp/C-Code-Snippet-Compile-C-or-VB-source-code-run-time.html

*http://www.c-sharpcorner.com/UploadFile/mgold/CodeDomCalculator08082005003253AM/CodeDomCalculator.aspx

*http://www.csharp-examples.net/reflection-examples/

*http://csharp.net-tutorials.com/reflection/introduction/

*http://www.codeproject.com/KB/cs/C__Reflection_Tutorial.aspx

*http://www.dotnetperls.com/reflection-field

*C# Reflection: How to get class reference from string?

*http://msdn.microsoft.com/en-us/library/system.reflection.assembly.aspx

*http://msdn.microsoft.com/en-us/library/system.type.aspx


text:
Q: UnsatisfiedLinkError in lotus-notes plugin We are having an issue with a dll in a notes plugin.
When we call this:
NotesFactory.createSession();
we get this error:
Unable to create view: nlsxbe (The filename or extension is too long.
java.lang.UnsatisfiedLinkError: nlsxbe (The filename or extension is too long. )
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:952)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:921)
at java.lang.System.loadLibrary(System.java:452)
at lotus.domino.NotesThread.load(Unknown Source)
at lotus.domino.NotesThread.checkLoaded(Unknown Source)
at lotus.domino.NotesThread.sinitThread(Unknown Source)
at com.atempo.adam.lotus.plugin.views.TopicView.createPartControl(TopicView.java:609)
NotesFactory is in Notes.jar, that we have included in our "plugin.xml" in dependencies tab. (The dependencie is: "com.ibm.notes.java.api").
The path to the jar is:
"C:\Archivos de programa\IBM\Lotus\Notes\framework\rcp\eclipse\plugins\com.ibm.rcp.j2se.win32.x86_1.5.0.SR4-200707311521\jre\lib\Notes.jar"
That is longer than 128 characters.
If we install notes in "c:\program files\IBM" instead of "C:\Archivos de programa\IBM", the resulting path is shorter than 128 and we don't get the error.
We have also tried copying nlsxbe.dll to WIN\System32 or registring nlsxbe.dll with the regsvr32 command, but we get the same error.
Versions are:
Lotus notes 8.0, Revision 20070803.1143
java 1.5.0
thanks

A: Try adding the nlsxbe path to your Environment variables. It Worked for me

A: Did you add the jar as an External jar to the plugin project?  If so try copying the jar and the dll into to the plugin project and reference them from there.
You can try asking Mikkel for some help he has lots of experience with plugin development within Lotus Notes --> www.lekkimworld.com

A: @Carlos
Jaime wrote me an e-mail and sure I will answer.
@Mitch Wheat
I don't know if you've seen Notes recently but since Notes 8 was released this is no longer your grand fathers Notes!! Notes is now based on Eclipse and a very modern and capable client. Probably one of the strongest enterprise clients, if not the strongest, on the market today.
Many with views like yours either haven't seen (or used) a Notes client for a looooooong time or they are part of an organization that simply don't upgrade due to reasons that are beyond me.

A: Notes.jar should be in the "Notes\jvm\lib\ext" folder. Use that one instead. There are known issues putting the Notes.jar into your plugin that can cause the client to crash/fail.


text:
Q: How can i instantiate a module inside an if statement in verilog? if (btn[0] == 1)
    begin
        operaciones op(A,B,numop,C);
        display disp(C,led);
    end

I need to instantiate it inside this if, how can i do that?

A: Before you go and use a generate statement for this (which allows module instantiation inside an if statement), you need to consider what you are saying. From what it appears you are trying to do in your code snippet, when button 0 is pressed, you want to do some operation and display the result on the LEDs. However, you are treating modules like function calls when they are something very different.
Module instantiations are declarations that the module hardware exists within its parent module. So, when I have something like this:
module top;

  module_name instances_name( ... );

endmodule

I declare that a module_name (all the hardware of module_name) exists within top (which probably has more hardware). Think of modules as ICs and the parent module as a breadboard, instantiating that module is like putting that IC down on the breadboard with the port connections being your wires to each pin of that IC. All the ICs necesary to do anything that design does exist on in the circuit somewhere; they dont appear and disappear depending on what the user inputs.
Now think back to what you wanted to say: you are saying, when buttton 0 is pressed, put this IC on the breadboard. If not pressed, take it away. As ICs dont appear and disappear from a circuit board, this doesnt make sense. So you need to treat module instantiations the same way you'd treat ICs if you were building the design on a breadboard; you can declare there is hardware to preform this operation (put down and wire up the IC), and when botton 0 is pressed, route the output from that hardware to the LEDs (using another IC or small circuit to do the routing; think mux).

A: Just to add on to what @Unn has said, what you really need to do instantiate your module and then have the enable signal for your module turned on (or off) in your if statement.


text:
Q: Hibernate join table restrictions I have the following tables:
[ table : column1, column2 ]
A : id, name
B : id, name
AB : idA, idB
AB is a join table.
Then I have this method on hibernate class B
@OneToMany( fetch = FetchType.EAGER)
@JoinTable( name = "AB",
            joinColumns = @JoinColumn( name = "idB"),
            inverseJoinColumns = @JoinColumn( name = "idA") )
public List<A> getAs(){
    //return the list of matching stuff
}

This works perfectly fine.
Now I want to do this sql query in hibernate:
select * from B inner join AB on B.id = AB.idB where AB.idA = 1234

Essentially, 'list me all B's that reference A with id 1234'
I could do straight sql, but that would defeat the purpose of getAs()
Is it possible to construct a Criterion/Restriction clause to achieve this?

A: Relationship between A and B is not one-to-many in this case, but rather many-to-many. You should map it as such:
@ManyToMany
@JoinTable(name = "AB",
            joinColumns = @JoinColumn( name = "idB"),
            inverseJoinColumns = @JoinColumn( name = "idA") )
public List<A> getAs(){
    //return the list of matching stuff
}

Note that eagerly fetching a collection is not a good idea in most cases, hence fetch = FetchType.EAGER removed above. You can now do the same on A side to make relationship bidirectional:
@ManyToMany(mappedBy='As')
public List<B> getBs(){
    //return the list of matching stuff
}

Now getting all Bs for given A is just a matter of calling getBs() on that A instance. You can create criteria / write HQL to do that as well - from either side.


text:
Q: Parse Contact details from a block of text Im trying to create a Business card reader
Im having a block of text for example
Name
Head - Business Development
Company Name
# 2/324, ll Floor, Some Road,
Street, City-Zip, State, Country.
Tel : +987654321
Mobile: +123456789
Email : mail@comany.com
Website : www.comany.com

I want to parse the details out of this text like name, company name, designation, address. I was able to parse number, email address and website. Can anyone help me with it. I dont want to use any webservices, I want it to be done offline.

A: You can look at StringTokenizer.

A:
I was able to parse number, email address and website

How are you doing it? What problems are you facing in parsing other parts?
If the sequence of contents is not going to change, simply read line by line and parse accordingly.


text:
Q: Who should be owed to the Morita equivalence theorem on modules over algebras? Let $A$ be a finite dimensional $k$-algebra, then we know there exists a quiver Q with an admissible ideal $J$ such that $$\operatorname{mod} A\cong\operatorname{mod} kQ/J$$
I was wondering who discovered this fact. Is it C.M.Ringel or someone else?

A: (First, note that this is only true for all $k$-algebras if $k$ is algebraically closed.)
I believe that it is (essentially, at least) due to P. Gabriel. At least, the quiver $Q$ is often called the "Gabriel quiver" of $A$.
I don't know any publication of his that gives this precise statement, but I think that the essential ideas are (in a much more general context) contained in the last few sections of
Gabriel, Peter, Indecomposable representations. II, Sympos. math. 11, Algebra commut., Geometria, Convegni 1971/1972, 81-104 (1973). ZBL0276.16001.


text:
Q: ORA-01017 Invalid Username/Password when connecting to 11g database from 9i client I'm trying to connect to a schema on 11g (v11.2.0.1.0) from a PC with 9i (v9.2.0.1) client. It seems to connect fine to some schemas, but not this one - it comes back with a ORA-01017 Invalid Username/Password error every time.
The username and password are DEFINITELY correct - can anyone think of a reason why this wouldn't work?
Are there any fundamental incompatibilities between 9i and 11g?

A: The user and password are DEFINITELY incorrect.
Oracle 11g credentials are case sensitive.
Try ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE;
and alter password.
http://oracle-base.com/articles/11g/case-sensitive-passwords-11gr1.php

A: You may connect to Oracle database using sqlplus:
sqlplus "/as sysdba"

Then create new users and assign privileges.
grant all privileges to dac;

A: Oracle 11 G and 12 C versions suggest to use more complex passwords, Although there is no issues during the user creation. The password must be alphanumeric and with special character.
Verify the password version and status of the user:
select * from dba_users where username = <user_name>;

Amend it to be like below in case of 11G 12C:
alter user <user_name> identified by Pass2019$;

Now test connection!

A: I had the same issue and put double quotes around the username and password and it worked:
create public database link "opps" identified by "opps" using 'TEST';

A: I am not an expert. If you are getting ORA-01017 while trying to connect HR schema from SQL Developer in Oracle 11g
Please try to unlock the  HR as follows
alter user HR identified by hr
DEFAULT tablespace users
temporary tablespace temp
account unlock;

A: I had the same error, but while I was connected and other previous statements in a script ran fine before! (So the connection was already open and some successful statements ran fine in auto-commit mode)
The error was reproducable for some minutes. Then it had just disappeared.
I don't know if somebody or some internal mechanism did some maintenance work or similar within this time - maybe.
Some more facts of my env:

*

*11.2

*connected as: sys as sysdba

*operations involved ... reading from all_tables, all_views and granting select on them for another user

A: I had a similar issue. The id/pw I was using was correct, but I was getting ORA-01017 Invalid Username/Password on one particular connection only.
It turned out that my connection settings in Oracle SQL Developer had the "Use DB Proxy Authentication" turned on in the "Proxy User" tab. I didn't notice that for quite a while.

After I unchecked that option, it worked fine.

A: I had a similar issue some time ago. You must be careful with quotes and double quotes. It's recommended to reset the user password, using a admin credentials.
ALTER USER user_name IDENTIFIED BY new_password;

But don't use double quotes in both parameters.

A: for oracle version 12.2.x users cannot login using case insensitive passwords, even though SEC_CASE_SENSITIVE_LOGON = FALSE if PASSWORD_VERSIONS of user is not 10g.
following sql should show the PASSWORD_VERSIONS for a user.
select USERNAME,ACCOUNT_STATUS,PASSWORD_VERSIONS from dba_users;
USERNAME          ACCOUNT_STATUS    PASSWORD_VERSIONS
---------------   --------------    -----------------
dummyuser         OPEN              11G 12C

to make PASSWORD_VERSIONS compatible with 10g
add/modify line in sqlnet.ora of database to have SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
restart database
change/expire password for existing user
new users created will also have same settings
after above steps PASSWORD_VERSIONS should be something like this
select USERNAME,ACCOUNT_STATUS,PASSWORD_VERSIONS from dba_users;
USERNAME          ACCOUNT_STATUS    PASSWORD_VERSIONS
---------------   --------------    -----------------
dummyuser         OPEN              10G 11G 12C

A: If all else fails, try resetting the password to the same thing. I encountered this error and was unable to work around it, but simply resetting the password to the same value resolved the problem.

A: I also had the similar problem recently with Oracle 12c. It got resolved after I changed the version of the ojdbc jar used. Replaced ojdbc14 with ojdbc6 jar.

A: I face the same issue for connection in laravel 7  I face issue that my password is used in charater base when the  password goes to the connect file is not go incomplete from .so I give the string password in my oci8.php file

A: The tip on Oracle's OTN =
Don't type your password in TOAD when you try to connect and let it popup a dialog box for your password. Type the password in there and it will work. Not sure what they've done in TOAD with passwords but that is a workaround. It has to do with case sensitive passwords in 11g. I think if you change the password to all upper case it will work with TOAD.
https://community.oracle.com/thread/908022

A: I also got the same sql error message when connecting through odp.net via a Proxy User.
My error was that my user was created with quotation marks (e.g. "rockerolf") and I then also had to specify my user in the connectionstring as User Id=\"rockerolf\"..
In the end I ended up deleting the user with the quotation marks and create a new one without..
face palm

A: I know this post was about 11g, but a bug in the 12c client with how it encrypts passwords may be to blame for this error if you decide to use that one and you:

*

*Don't have the password case-sensitivity issue (i.e. you tried ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = FALSE and resetting the password and still doesn't work),

*Put quotes around your password in your connection string and it still doesn't help,

*You've verified all of your environmental variables (ORACLE_HOME, PATH, TNS_ADMIN), and the TNS_ADMIN registry string at HKLM\Software\Oracle\KEY_OraClient12Home is in place,

*You've verified your connection string and user name/password combination works in Net Manager, and

*You can connect using SQL*Plus, Oracle SQL Developer using the same credentials.

All the basic checks.
Fix:  Try setting HKLM\System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy\Enabled to 0 in the registry (regedit) to disable FIPS.
Oracle.ManagedDataAccess and ORA-01017: invalid username/password; logon denied
ORA-01005 error connecting with ODP.Net
https://community.oracle.com/thread/2557592?start=0&tstart=0
https://dba.stackexchange.com/questions/142085/ora-01017-invalid-username-passwordlogon-denied/142149#142149

A: I had a similar problem recently with Oracle 12c. I created a new user with a lower case password and was able to login fine from the database server but all clients failed with an ORA-01017.
The fix turned out to be simple in the end (reset the password to upper case) but took a lot of frustrating effort to get there.

A: Credentials may be correct and something else wrong. I based my pluggable DB connection string on its container DB. Instead of the original parent.example.com service name the correct appeared to be pluggable.example.com.

A: in my case with oracle database using tableplus build 373 on my m1 device
type username and password in another text editor, copy and paste into username and password in tableplus. when i type in tableplus the text automatically changes to lowercase. because i had no problem with sqldeveloper, but when trying tableplus it always refused now i have solved it. i dunno why its problem on apps or other, but i have solved by the trick.


text:
Q: Pure function error, but using a vector I inherited a rather large (but still manageable) fortran (F90) codebase, and being a total fortran newbie, I've tried to compile it. First errors were easy to correct, but this one is beyond my understanding.
% make
[  1%] Building Fortran object CMakeFiles/Core.dir/vars.f90.o
/Users/sensei/Documents/Projects/vars.f90:127:32:

             real*8, dimension(0:links(kg)), intent(out) :: feq_vect
                                1
Error: Specification function 'links' at (1) must be PURE

Now, as I waddle through the code, I find the link declaration:
integer, allocatable, dimension(:) :: links

I see this is a vector, not a function, so why is gfortran complaining about this being a function? A self-contained example follows.
How can I correct this error?
mph.f90
program mph

    use vars
    !
    implicit none

endprogram mph

vars.f90
module vars

    implicit none

    integer, allocatable, dimension(:) :: links

    abstract interface
        subroutine linkstest(kg,feq_vect)
            real*8, dimension(0:links(kg)), intent(out) :: feq_vect
        endsubroutine
    end interface

end module vars

Solution
Although the error is completely different from this question, the solution seems to be the same: adding import into the subroutine.


text:
Q: Define Custom Boundaries for a Composable By default all the Composables, much like views are defined in form of Rects, i.e., four specific corner points with distinct properties. Now, if I want to implement something like this

(This is just an example, I want to implement this with much complex shapes (PATHS using Canvas))
So, when the user clicks on either of the triangles, the specific codeblock implemented for that triangle should be executed.
I got almost no possible approaches to this, so please inform if anyone does, thanks!

A: You can accomplish it by creating a custom shape and applying the image that is drawn latest in a Box
@Composable
private fun DividedImage() {
    Box(
        modifier = Modifier
            .fillMaxWidth()
            .height(200.dp)
    ) {

        val context = LocalContext.current

        val shapeLeft = GenericShape { size: Size, layoutDirection: LayoutDirection ->
            val width = size.width
            val height = size.height
            moveTo(0f, 0f)
            lineTo(0f, height)
            lineTo(width, height)
            close()
        }

        val modifierLeft = Modifier
            .fillMaxWidth()
            .height(200.dp)
            .graphicsLayer {
                clip = true
                shape = shapeLeft
            }
            .clickable {
                Toast
                    .makeText(context, "LEFT", Toast.LENGTH_SHORT)
                    .show()
            }
            .border(3.dp, Color.Green)

        val modifierRight = Modifier
            .fillMaxWidth()
            .height(200.dp)

            .clickable {
                Toast
                    .makeText(context, "RIGHT", Toast.LENGTH_SHORT)
                    .show()
            }
            .border(3.dp, Color.Red)

        Image(
            modifier = modifierRight,
            painter = painterResource(id = R.drawable.landscape2),
            contentDescription = null,
            contentScale = ContentScale.FillBounds
        )

        Image(
            modifier = modifierLeft,
            painter = painterResource(id = R.drawable.landscape1),
            contentDescription = null,
            contentScale = ContentScale.FillBounds
        )
    }

}


text:
Q: How can I find the image from blob url in node.js I input a photo.jpg with Input tag on HTML. The function will send a blob URL to the server by ajax. The server had received the URL but it showed that

no such file or directory, open
'blob:http://localhost:3000/xxxx-xxxxx-xxxxx

How can the server received the photo.jpg and then launch a new function?
Here is my code:
<form id="form">
<input type="file" id="myFile" name="filename">
</form>
<input type="submit" id="submit">
<script>
            submit.addEventListener("click",(e) => {
                const Phone = document.getElementById('Phone');
                const msg = document.getElementById('msg');
                const myFile = document.getElementById('myFile')
                var url = getObjectURL(myFile.files[0])
                data = {
                    Phone:Phone.value,
                    msg:msg.value,
                    url:url
                }
                $(document).ready(function(){
                    $.post('/test', {data});
                })
            })
</script>

server.js:
app.post('/test', (req, res) => {
SendMedia(req.body.data['Phone'],req.body.data['msg'],req.body.data['url']);
});

async function SendMedia(number, message, url) {
    console.log(url)
    media = MessageMedia.fromFilePath(url)
}


text:
Q: How to create customer Observer Event using EventConvertible in RxSwift? For example in the following code the default ObserverType has an event onError where Swift.Error object can be passed. How can I create custom ObserverType / Event so that I'll be able to supply an object of a custom class.
class LoginService: LoginServiceProtocol {
func signIn(with credentials: Credentials) -> Observable<User> {
    return Observable.create { observer in
        /*
         Networking logic here.
        */
        observer.onNext(User()) // Simulation of successful user authentication.
        observer.onError(<#T##error: Error##Error#>) // want to user custom class object instead of Swift.Error object here
        return Disposables.create()
    }
}
}

A: The only way to do it is to have the custom class object conform to the Swift.Error protocol.
class MyCustomClassObject: Error {
    // your custom stuff here
}


text:
Q: I keep getting a error saying cannot find symbol - variable keyboard   import javax.swing.JOptionPane;
  import java.io.File;
  import java.util.Scanner;
  public class Map{
  public static void main(String[] args){

  // create a Scanner object
  Scanner input = new Scanner(System.in);

 //Prompt the user to enter three numbers in inches
 System.out.print("enter four numbers:");
 double distance1 = input.nextDouble();
 double distance2 = input.nextDouble();
 double distance3 = input.nextDouble();
double distance4 = input.nextDouble();

 //public classify DistanceScale

    //Make a constant to hold kilometers to miles conversion
    //final const MILESTOKILOS = 1.609344;

    // Explain the program to the user
    System.out.println("Welcome! This program calculates true distance from map measurements You can enter up to 4 distances");
    System.out.println();

    // ask user for 4 distances, from the map.
    System.out.print("Enter distance 1 (in inches): ");
    double distancel = keyboard.nextdouble();

    System.out.print("Enter distance 2 (in inches): ");
    double distance2 = keyboard.nextdouble();

    System.out.print = "Enter distance 2 (in inches): ";
    double distance3 = keyboard.nextdouble();

    // determine total miles from total inches
    // Scale:  1 inch is 1/4 mile
    double totalMiles = totalInches * 1/4;
    // add to get total inches on map
    distance1 + distance2 + distance2 + distance4 = totalInches;

    //round to one-tenth of a mile
    int miles =(totalMiles + 0.05) * 10;

    //total miles
    int totalMiles = 10%

    // calculate kilometers
    totalKilos = totalMiles * miles * kilos;

    // round kilometers to tenths
    //int class kilos = totalKilos + {005 * 10)};
    //totalKilos = kilos / 100;

    // print results
    System.out.printn("Total inches:     " + "totalInches");
    Sytem.out.println ("Total miles:      " + milesTotal);
    System.out.prntln("Total kilometers: totalKilos");
    {
    }

I keep getting a error on all my double distancel = keyboard.nextdouble(); I'm new to java, and I'm using a program called bluej. I don't understand why its saying keyboard needs to be a variable. If you guys can help me with this error that will be great. I always like to learn. Thanks!

A: You are trying to reference a variable which is not declared, that's why the compiler says he cannot find keyboard.
Just replace all your keyboard references with input.
Seems like either a typo or a copy&paste error.

A: Your Scanner is called input and not keyboard you should change that when calling it here for example:
double distancel = keyboard.nextdouble(); change it to double distancel = input.nextdouble();. I also see another thing:
totalKilos = totalMiles * miles * kilos;
You don't have any declared variable totalKilos to assign it this value.
You should int totalKilos = totalMiles * miles * kilos;
Same thing here: distance1 + distance2 + distance2 + distance4 = totalInches;
I think you want to do double totalInches = distance1 + distance2 + distance2 + distance4;


text:
Q: Cassandra as Cache Front-end to RDBMS We are using Oracle RDBMS in our system. To reduce database load we plan to use a caching layer.
I am looking to see if we can use Apache Cassandra as a Caching Storage frontend to Oracle db.
From what I have looked so far Cassandra is more like a database with built-in caching features. So, using it as a caching layer to Oracle would be more like using another database. I feel it would be better to Cassandra itself as an alternative to Oracle and other RDBMS rather than using it along with Oracle.
Has anyone used Cassandra as a caching layer to RDBMS. But, I have not found any resources or examples for using it. If so can you help me on this.

A: I'm not sure what you mean by a caching storage frontend.
Cassandra might be useful if you are expecting a large volume of writes that arrive at a rate faster than Oracle could handle.  Cassandra can handle a high volume of writes since it can scale by adding more nodes.
You could then do some kind of data analysis and reduction on the data in Cassandra before inserting the crunched data into Oracle.  You might then use Oracle for the tasks that suit it better such as financial reporting, ad hoc queries, etc.


text:
Q: HTML  is not overflowing to newline I try to create a kanban, and i have trouble getting text to overflow to the next line. I tried
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;

and i tried all other styling for breaking to a new line, and none are working. preview
Iuse vuejs, but i doubt this has anything to do with it. I tried everything i could find, but none works. I dont know if the parent needs any styling set for this to work? Someone who can help me out?
css:
.kanban-card {
    display: block;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    width: 100%;
    border-radius: calc(0.15rem - 1px);
    @include depth(1);
    background: $foreground-color;
    border: 1px solid darken($foreground-color, 10%);
    .kanban-type-icon {
        position: absolute;
        top: 0;
        left: 0;
        width: 30px;
        height: 28px;
        border-bottom-right-radius: 30px;
        background-color: $theme-color-1;
        i {
          color: #fff;
          position: absolute;
          top: 5px;
          left: 5px;
        }
    }
    .kanban-type-border {
        position: absolute;
        width: 3px;
        top: 0;
        bottom: 0;
        left: 0;
        background-color: $theme-color-1;
    }
    .kanban-content {
        display: block;
        width: 100%;
        overflow: hidden;
        text-indent: 1em;
        p {
            max-width: 200px;
            margin: 0;
        }
    }
}

and vue:
<template>

hier een lange zin om te zien of deze pastier een lange zin om te zien of deze pastier een lange zin om te zien of deze pastier een lange zin om te zien of deze past

hier een lange zin om te zien of deze past

hier een lange zin om te zien of deze past

hier een lange zin om te zien of deze past

</template>

A: after removing the missing mixin your example wraps properly, so the issue probably stems from something outside of what you've shared.
that being said...

*

*the  is not a self closing tag and this could be causing some of
your problems.

*using an absolute positioned empty  to create
a border is not the best solution and could cause more problems

see if this works better for you:

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.

.kanban-card {
  background: $foreground-color;
  position: relative;
  padding: 1.5em 1em;

  border-left: solid 3px $theme-color-1;
  border-top: solid 3px $theme-color-1;

  .kanban-type-icon {
      background-color: $theme-color-1;
      width: 2em;
      height: 2em;
      border-bottom-right-radius: 100%;
      position: absolute;
      top: 0;
      left: 0;
      i {
        color: #fff;
        margin-left: 6px;
        margin-top: 6px;
      }
  }
  .kanban-content {
      p {
        text-indent: 1em;
        margin-bottom: 1em;
      }
  }
}

Codepen Example

A: You need to add width to parent HTML attribute, in your case
 and add this CSS property to your

word-break: break-all

 testefdsfsdfdsfsdfsdfdssdfsdfdsfdsfsdfsdfdfd

Demo here


text:
Q: Entities and POJOs must have a usable public constructor I am encountering this problem yet I have done everything right.
"Entities and POJOs must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). - kotlin.Unit"
my Entity code is this
@Entity(tableName = "note_table")
data class Note (
    @PrimaryKey(autoGenerate = true)
    val id: Int,

    val name: String,

    val email: String
)

An Update. The error was originating from my Dao class
The code was as follows
@Query("SELECT * FROM note_table ORDER BY ID ASC")
suspend fun getAllNotes(): LiveData<List<Note>>

A: As @DarShan mentioned, the suspend keyword in the dao class shouldn't be there. Specifically if the function should return a liveData


text:
Q: Object reference not set to an instance of an object in view model I get this error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 251:            ManageAccount.Instance.GetUserAccounts(username), "accountID", "name", accountFrom);
Line 252:
Line 253:            Currencies = new SelectList(
Line 254:            ManageCurrency.Instance.getCurrencies(), "id", "name",_Account.currency1.id);
Line 255:

It gives the error in this viewModel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Common;
using Business;
using System.Web.Mvc;
using System.Web.Security;
using System.Runtime.Remoting.Contexts;

namespace internetBankingApplication.ViewModel
{

    public class NewFixedAccountViewModel
    {
        private account _Account { get; set; }

        private fixedAccount _FixedAccount { get; set; }

        public SelectList AccountTypes { get; set; }

        public SelectList Durations { get; set; }

        public SelectList AccountFromList { get; set; }

        public SelectList Currencies { get; set; }

        public int ID
        {
            get
            {
                return _Account.accountID;
            }
        }

        [Required]
        [Display(Name = "Account Name")]
        public string Name
        {
            get
            {
                return _Account.name;
            }
            set
            {
                _Account.name = value;
            }
        }

        [Required]
        [Display(Name = "Account From")]
        public int accountFrom { get;set;}

        public string AccountFromName
        {
            get
            {
                string result = string.Empty;
                try
                {
                    result = ManageAccount.Instance.GetAccountBYID(accountFrom).name;
                }
                catch { }
                return result;
            }
        }

        [Required]
        [Display(Name = "Duration")]
        public int duration
        {
            get
            {
                return _FixedAccount.duration;
            }
            set
            {
                _FixedAccount.duration = value;
            }
        }

        public string durationName
        {
            get
            {
                string result = string.Empty;
                try
                {
                    result = ManageDuration.Instance.GetDurationById(_FixedAccount.duration).duration1;
                }
                catch { }
                return result;
            }
        }

        [Required]
        [Display(Name = "Available Balance")]
        public decimal AvailableBalance
        {
            get
            {
                return _Account.availableBalance;
            }
            set
            {
                _Account.availableBalance = value;
            }
        }

        [Required]
        [Display(Name = "Currency")]
        public int currency
        {
            get
            {
                return _Account.currency;
            }
            set
            {
                _Account.currency = value;
            }
        }

        public string CurrencyName
        {
            get
            {
                string result = string.Empty;
                try
                {
                    result = ManageCurrency.Instance.getTypesByID(_Account.currency).name;
                }
                catch { }
                return result;
            }
        }

        [Required]
        [Display(Name = "Account Description")]
        public string Description
        {
            get
            {
                return _Account.description;
            }
            set
            {
                _Account.description = value;
            }
        }

        [Required]
        [Display(Name = "Account Renew")]
        public bool renew
        {
            get
            {
                if (_FixedAccount.renew == 0)
                {
                    return false;
                }
                return true;
            }
            set
            {
                if (value == false)
                {
                    _FixedAccount.renew = 0;
                }
                else
                {

                    _FixedAccount.renew = 1;
                }
            }
        }

        public NewFixedAccountViewModel()
        {
           // AccountTypes = new SelectList(
           //ManageAccountType.Instance.getTypes(), "id", "type", _Account.typeID);

            string username = HttpContext.Current.User.Identity.Name.ToString();
            AccountFromList = new SelectList(
            ManageAccount.Instance.GetUserAccounts(username), "accountID", "name", accountFrom);

            **Currencies = new SelectList(
            ManageCurrency.Instance.getCurrencies(), "id", "name",_Account.currency1.id);** //Giving the error

            Durations = new SelectList(
            ManageDuration.Instance.GetAllDurations(), "id", "duration", _FixedAccount.duration);

        }

        public NewFixedAccountViewModel(string username)
        {
            AccountTypes = new SelectList(
            ManageAccountType.Instance.getTypes(), "id", "type", _Account.typeID);

            AccountFromList = new SelectList(
            ManageAccount.Instance.GetUserAccounts(username), "accountID", "name", accountFrom);

            Currencies = new SelectList(
            ManageCurrency.Instance.getCurrencies(), "id", "name", _Account.currency);

            Durations = new SelectList(
            ManageDuration.Instance.GetAllDurations(), "id", "duration", _FixedAccount.duration);

        }

        public NewFixedAccountViewModel(int accountID, string username)
        {
            _Account = ManageAccount.Instance.GetAccountBYID(accountID);

            _FixedAccount = ManageFixedAccount.Instance.GetFixedAccountByID(accountID);

            AccountFromList = new SelectList(
            ManageAccount.Instance.GetUserAccounts(username), "accountID", "name", accountFrom);

            AccountTypes = new SelectList(
            ManageAccountType.Instance.getTypes(), "id", "type", _Account.accountType);

            Currencies = new SelectList(
            ManageCurrency.Instance.getCurrencies(), "id", "name", _Account.currency);

            Durations = new SelectList(
            ManageDuration.Instance.GetAllDurations(), "id", "duration", _FixedAccount.duration);

        }
    }
}

A: The error message you are getting means that you are trying to call a method or property on a null value - which you can't do.
From what I can see, either ManageCurrency is null or ManageCurrency.Instance is null.
If ManageCurrency is null the call to the Property Instance fails, as null objects have no methods or properties.  Similarly, if ManageCurrency.Instance is null, the call to the Method getCurrencies fails for the same reason.
In any case - this is not too hard to debug.  As skumar suggests, set a breakpoint on that line, run in debug mode, and see where the null value is, and then work backwards to discover why the value is null.

A: The username you are passing in the following code could be Empty or Invalid. That is why it returns NULL and above exception occurs.
AccountFromList = new SelectList(
            ManageAccount.Instance.GetUserAccounts(username), "accountID", "name", accountFrom);


text:
Q: UIEdgeInsets not working on System Images in TabBar I am using XCode System Images (SF Symbols) for UITabBarItem Images.  I'd like to remove the UITabBarItem Title which I have done.  But also move the UITabBarItem Image down slightly.
In the past when I wasn't using System Images this would work fine using UIEdgeInsets.  However, this appears to have no effect on System Images.
Code:
let imageConfiguration = UIImage.SymbolConfiguration(weight: .regular)
    let imageInsets = UIEdgeInsets(top: 8, left: 0, bottom: -8, right: 0)

lazy var activityTabBarItem: UITabBarItem = {
        let image = UIImage(systemName: "stopwatch")?.applyingSymbolConfiguration(imageConfiguration)
        let tabBarItem = UITabBarItem(title: nil,
                                      image: image,
                                      selectedImage: image)
        tabBarItem.imageInsets = imageInsets
        return tabBarItem
    }()

Is there a workaround for this?

A: Took me a while, but you can use the UIImage property withBaselineOffset(fromBottom: CGFloat)
example:
UIImage(systemName: "someName")?.withBaselineOffset(fromBottom: 6.0)

Took me a few hours, but I ran into this on my custom tabBarController in SwiftUI. Sorry for the late reply.

A: You need to use - withAlignmentRectInsets(_ alignmentInsets: UIEdgeInsets) property of UIImage, to successfully set insets for SFSymbols. Following code in your cases:
image.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: 0, bottom: -6, right: 0)

Apple doc for withAlignmentRectInsets


text:
Q: What method in Eloquent or Query Builder in Laravel 5.2 for unique values Here is the scenario
Table: Users
id     | name  | grade
------  | ------|------
   1    | Mark  |   a
   2    | Earl  |   a
   3    | John  |   c
   4    | Mike  |   d
   5    | Matt  |   e
What I want to do is populate the grades that are non-repeating or non-duplicate grades
So it should just show
c
d
e

I've got this far
controller
$grades = user::select('grade')
        ->distinct()
        ->get();
blade
@foreach ($grades as $grade)
            {{ $grade }}

            @endforeach

however, this query gives this
a
c
d
e

A: Try this query:-
$grades = DB::select(DB::raw('SELECT grade , count(grade) as gradecount  FROM users  group
by grade having gradecount = 1'));

                    OR

$grades = DB::table('users')
            ->select('*', DB::raw('COUNT(grade) as gradecount'))
            ->groupBy('grade')
            ->having('gradecount', '=',1)
            ->get();

Hope it helps!


text:
Q: XMLParser leak instrument leak NSURL *url = [[NSURL alloc] initWithString:@"http://www.someurl.com/sample.xml"];
xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[url release];

XMLParser *parser = [[XMLParser alloc] initXMLParser];        //50.0%

[xmlParser setDelegate:parser];
parser = nil;
[parser release];

[xmlParser parse];                                           //50.0%
[xmlParser release];

This is my parsing code and the leaks instrument is showing leaks. I really dont know what's wrong or how to fix this. Any suggestions?

A: parser = nil;
[parser release];

...this does not do what you think it does. Assuming parser is a property, then self.parser = nil and parser = nil do very different things. The former will call the parser setter method, which will release the old value and set the property to nil. The latter just changes the pointer from its current location to nil.
By setting the pointer to nil you have lost the reference to the object, so you've instantly leaked the object that was previous assigned to it - you are basically trying to release a nil object. You need to remove the nil call, or place it after the release (see below).
You may be thinking of setting a pointer to nil after you have released it, to prevent problems should you try and access it at some point in the future.
Here are a few other questions to help provide some context:
release Vs nil -- Best Practice
Difference between release and release then set to nil

A: I have had similar issues with using NSXMLParser, but found an easy fix to resolve the memory leak.
Instead of doing
xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];

Do the following
NSData *xmlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
xmlParser = [[NSXMLParser alloc] initWithData:xmlData];

I was able to get rid of my memory leaks

A: There's a similar post here about leaks in the parser.  I also have this issue.  it's annoying but it's not a huge leak so I don't worry too much about it.  Will see if iOS 5 fixed the problem (if it is indeed a known leak)
Edit: I'm now interested to see if I made the mistake above!


text:
Q: Convert C data type to Python I want to bind multiple size of data such as one byte value, two byte value, one byte value and then string.
This is a packet to be sent by a simple chatting client.
The network packet I want to make is in the diagram. Total 4 bytes header followed by body.

How can I make this packet by Python??
Is there any solution for storing data with explicit definition of size?

A: You're looking for Python's struct. Here's an example of how to do what you're asking with struct:
from struct import *
header = pack('!chcs', clientID, bodySize, networkMessageId, body)

Now header will have that packet in it, and you can send it over the network (or whatever you need to do with it).
Since your image says "network" I assume this needs to be in network byte order, that's what the ! at the beginning means.


text:
Q: React-Query knows when data changes? I am starting to use react-query for querying my backend. Now, every time I update the backend data (using some admin panel), the GUI (react) shows me immediately the new data. How does react frontend know if the backend data has changed?

A: Sorry guys, found the issue. If I go to admin panel to update data, and go to the react WINDOW again, it auto refetches


text:
Q: error TS2322: Type 'object' is not assignable to type 'NgIterable'. Type 'object' is not assignable to type 'Iterable' I'm trying to use the HTTP library in angular  and I want to get some information from a link that has a JSON file, but it doesn't work for me
api.server.ts:
import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http'

@Injectable({
  providedIn: 'root'
})
export class ApiService {
  constructor(private http: HttpClient) {
  }
    getData(){
      return this.http.get('https://jsonplaceholder.typicode.com/posts');
    }
}

myapp.component.ts:
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../api.service';

@Component({
  selector: 'app-myapp',
  templateUrl: './myapp.component.html',
  styleUrls: ['./myapp.component.css']
})
export class MyappComponent implements OnInit {
  posts$: object;
  constructor( private api: ApiService) {

  }

  ngOnInit(){

    this.api.getData().subscribe(
      api => this.posts$ = api
    )
  }
}

myapp.html:

            Medium.co

              Our story

              Articles

 posts

{{post.title}}

{{post.body}}

I tried to use:

but doesn't work

A: You have explicitly specified the type of posts$ as object so the strict type checking of Angular templates doesn't like it because ngFor requires an iterable.
I recommend using the async pipe in your template as you indicated you tried, then change your component to look something like this:
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../api.service';
import { Observable } from 'rxjs';

@Component({
  selector: 'app-myapp',
  templateUrl: './myapp.component.html',
  styleUrls: ['./myapp.component.css']
})
export class MyappComponent implements OnInit {
  posts$: Observable<Post>;
  constructor( private api: ApiService) {

  }

  ngOnInit(){
    this.posts$ = this.api.getData();
  }

}

Doing it this way the async pipe will take care of subscribing to the observable returned by the api.  You could probably benefit from making the api more strongly typed.


text:
Q: Deploying on windows phone 8.1 I installed the last version of visual studio to target windows phone 8.1 OS. After the installation I figured out that the 8.1 OS was not yet released and I couldn't deploy my application on my device. Can I target the windows phone 8.0 version when building the application?

A: Select This Project Template & It will prompt you to select your targeting Windows Phone OS

But Once you have targeted 8.1 you can't deploy on a 8.0 device or emulator.

A: Yes you can. Go to your project properties and there on your application tab, you can select the target OS.


text:
Q: Laravel 6.0 local server I have this project in laravel 6.0 stored locally in my laptop. I am just wondering if I can still run this same project to another local PC and use it as a server for local only. I know it would be better to have a dedicated server for this project but this is not a bigtime system. I just want to run it only in my  property. Is it okay if the said server is with these specs?
Processor- Intel® Core™ i7-4770
MotherBoard- Gigabyte GA-Z97X Gaming 7 ATX
Cooler- Stock Cooler
RAM- 1x8gb ddr3 Team Elite
GPU- Asus RX 570 4gb ddr5
HDD- WD Green 1TB (100% Healthy)
PSU- Seasonic M12II 620watts fully modular
I don't know if I should I this here or to another site. Thanks if you could help me enlightened.

A: First of all, in addition to the hardware of the machine where you want to host the application, a more thorough study would be necessary such as the type of application you want to host and the data traffic that you will have. In addition to the type of database manager you are going to use, if it will be hosted on the same machine or remotely.
As you said, I understand that it is for domestic use and I imagine that you will use MySql hosted on the same machine (correct me if I am wrong), so with the hardware you described it should not cause you problems.
Hope this can help you

A: Your hardware should suffice, however if you can manage it, try setting it up on a Linux command only OS. Most importantly—if possible—replace your HDD with an SSD, even if it is a small one, it will improve a lot the performance of your application.


text:
Q: How to change the Contextual Action Bar color programmatically? How can I change my Contextual Action Bar color programmatically? That is, not an xml solution. For Android.
Note:

*

*I am working with minsdkVersion 21

*I am using BigNerdRanch's MultiSelector


text:
Q: How to use GUI while threads doing their jobs in QT? As a self-learner, I am trying to understand QThread logics in c++ with QT. I wrote simple thread class which has for loop inside. However when thread is inside for loop I cannot use MainWindow. To try it I open QFileDialog and select some files. When I press "Open" button thread runs and FileDialog is not closing until thread finish his job.
Is it possible to use MainWindow while thread is working background?
Here is simple code for my try..
void MainWindow::on_pushButton_clicked()
{
    QFileDialog *lFileDialog = new QFileDialog(this, "Select Folder", "/.1/Projects/", "*");

    QStringList selectedFileNames = lFileDialog->getOpenFileNames(this, "Select Images", "/home/mg/Desktop/", "", 0, 0);

    if(!selectedFileNames.isEmpty())
    {
        MyThread mThread1;
        mThread1.name = "thread1";
        mThread1.run();
        mThread1.wait();
    }
}

void MyThread::run()
{
    for (int var = 0; var < 100000; ++var)
    {
        qDebug() << this->name << var;
    }
}

A: You shouldn't wait() on the thread in your click handler!
Also, you don't call a thread's run yourself, you just start the thread. Starting the thread will call run().

A: This is a minimal example of using a thread for code that blocks. The main thread remains interactive and outputs tick... every second until the thread is done. When the tread is finished, it cleanly quits.
While I demonstrate a console application, this could just as easily be a GUI application and the GUI thread would not be blocked at any point.
#include <QCoreApplication>
#include <QThread>
#include <QTimer>
#include <QTextStream>
#include <cstdio>

class MyThread : public QThread {
  void run() Q_DECL_OVERRIDE {
    sleep(10); // block for 10 seconds
  }
public:
  MyThread(QObject * parent = 0) : QThread(parent) {}
  ~MyThread() {
    wait(); // important: It's illegal to destruct a running thread!
  }
}

int main(int argc, char ** argv) {
  QCoreApplication app(argc, argv);
  QTextStream out(stdout);
  MyThread thread;
  QTimer timer;
  timer.start(1000);
  QObject::connect(&timer, &QTimer::timeout, [&out]{
    out << "tick..." << endl;
  }
  app.connect(&thread, SIGNAL(finished()), SLOT(quit()));
  thread.start();
  return app.exec();
}


text:
Q: SDL2 iOS multitouch second finger down not detected I am working on a SDL2 project that I have ported to iOS.
I am having trouble getting 2 touches to register to use as game controls.
The controls work like this:
iOS Device
+---------------+
|   F   |   |   |
|-------| L | R |
|   B   |   |   |
+---------------+

F - Move forward
B - Move backwards
L - Turn left
R - Turn right
The player should be able to move forward and turn at the same time - which means I have to handle two individual touches at the same time that are NOT a multitouch gesture.
Here is a sample of the code that does this in my project.
while (SDL_PollEvent(&event)) {
    printf("event %#010x\n", event.type);
    switch (event.type) {
        case SDL_FINGERDOWN:
        //case SDL_FINGERMOTION:
            if (event.tfinger.x < 0.5) {
                lastMoveFinger = event.tfinger.fingerId;
                isMoving = true;
                if (event.tfinger.y < 0.5) {
                    mvForward = true;
                } else {
                    mvForward = false;
                }
            } else {
                lastTurnFinger = event.tfinger.fingerId;
                isTurning = true;
                if (event.tfinger.x < 0.75) {
                    turnRight = false;
                } else {
                    turnRight = true;
                }
            }
            break;
        case SDL_FINGERUP:
            if (event.tfinger.x < 0.5 || event.tfinger.fingerId == lastMoveFinger) {
                lastMoveFinger = -1;
                isMoving = false;
            } else {
                lastTurnFinger = -1;
                isTurning = false;
            }
            break;
    }
}

Here is what happens:

*

*Place the first finger down on the screen (hold it down)

*First touch event is registered

*Place the second finger down on the screen.

*No second touch is registered but multitouch gesture events are fired (I caught these with the printf).

One interesting thing I found is that if I handle SDL_FINGERMOTION both touches are register in the correct locations - but this wont work because it doesn't detect a single tap, but instead only works when fingers are moved around. So it seems multitouch is working but perhaps I am not handling it correctly.
For reference here are the touch events from SDL_events.h
/* Touch events */
SDL_FINGERDOWN      = 0x700,
SDL_FINGERUP,
SDL_FINGERMOTION,

Here is a sample of the event stream. I placed down 1 finger, then a second, then lifted the first, then lifted the second.
event 0x00000401
event 0x00000700 // Finger down
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000802
event 0x00000702
event 0x00000802
event 0x00000402
event 0x00000701 // Finger up

Notice that there is lots of finger motion - but only 1 finger up and down event. If I get some time later I will update this with a printout of the current number of fingers on the screen to illustrate that the second finger down event is never fired.

A: Looking at the source code I see that SDL_SendTouch() should be getting called for every finger (NSEvent) sent to the SDL_uikitview::touchesBegan handler (SDL subclass of UIView). I dont remember enough about UIKit to comment on the expected behavior here, but you can attach a debugger and see for yourself if it gets the expected number of NSEvents.
If the number and type of NSEvents don't match what you expect then it seems there is little SDL could do. If they are as you expect then it points to a bug in SDL.
Specifically, look at the source for SDL_SendTouch as another place to put some breakpoints. There are a few cases where that function can bail out:
   228 SDL_Touch* touch = SDL_GetTouch(id);
   229     if (!touch) {
   230         return -1;
   231     }
   232
   233     finger = SDL_GetFinger(touch, fingerid);
   234     if (down) {
   235         if (finger) {
   236             /* This finger is already down */
   237             return 0;
   238         }
   239
   240         if (SDL_AddFinger(touch, fingerid, x, y, pressure) < 0) {
   241             return 0;
   242         }


text:
Q: Different API & SegmentInfos constants after upgrade Lucene from 3.6 to 4.1 I'm in the middle of upgrading the Lucene engine for indexing my content from version 3.6 to 4.1. I've noticed that some parties of API has been widely changed.
Especially when it comes to statics constants from SegmentInfos class...
My old code uses following pieces of code for detecting corrupted indexes. If any, then removes Lucene binary files:
for (String name : fileNames) {
    if (name != null && name.startsWith("segments_")) {
        IndexInput input = dir.openInput(name);
        int format = input.readInt();
        input.close();
        if (format != SegmentInfos.FORMAT_DIAGNOSTICS) {
            LOG.info(String.format("File %s is corrupted and it will be deleted", name));
            dir.deleteFile(name);
            }
        }
    }

Unfortunatelly static constant SegmentInfos.FORMAT_DIAGNOSTICS in 4.1 version of Lucene is gone and I have not clue how to now recognize whether some index is corrupted or not...

A: There are indeed quite some non backward compatible changes in Lucene 4. That's the main reason why the major version has changed.
But looking at what you are doing manually, I would suggest you to have a look at the check index tool. It allows you to check the health of your index and optionally drop broken segments. If you can't use the tool itself you can at least have a look at its code and see how you can integrate it in your application.


text:
Q: Validate model ajax from server not working      var Model=  Backbone.Model.extend({
                url: "server.php",
                name:'sasha',
                time:'now',
                validate:function(attrs, options) {

     if (attrs.rand >2) {
      console.log('stop');
      debugger;
    }
                 }
            })

            var model=new Model;

model.on("invalid", function(model, error) {
  console.log('invalid');
  debugger
});

   setInterval(function(){
      model.fetch();
     model.save()
  },4000
);

I want to filter the data that come from the server.
I server I have :
$arr = array('a' => 1, 'time' =>date('h:m:s'),rand=>rand()*9);

echo json_encode($arr);

No errors in firebug!


text:
Q: Euler 22/Sorting Names in Alphabetical Order I've been trying to sort these names from the Euler #22 problem. I tried many ways to swap strings. I had problem every time. In some, there were random symbols; in others i had overflowed(?) names while swapping(Like ending up with LINDACIA while trying to swap PATRICIA and LINDA). I tried to add a symbol each free byte in string (like LINDAzzzzzzzzz\0) and got compiler error.
Input File
"MARY","PATRICIA","LINDA","BARBARA","ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET"

Source Code
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main()
{
    char *nameorder;
    char liste[5164][15];
    char hold[15];
    int i=0,j=0,k;
    int c;
    FILE *ptr;
    nameorder ="names.txt";
    ptr= fopen( nameorder , "r");
    if(ptr==0)
    {
        printf("File could not be opened");
        return 0;
    }
    while( (c=getc(ptr)) != EOF) //reading character by character
    {
        if(c=='"')
        {
            continue;
        }
        if(c==',')
        {
            j=0;
            i++;
            continue;
        }
        liste[i][j]=c;
        j++;
    }
    fclose(ptr);
    for(k=0;k<5163;k++)
    {
        for(i=0;i<5164;i++) //
        {
            if( strcmp(liste[i],liste[i+1])>0 )
            {
                strncpy(hold,liste[i],15);
                strncpy(liste[i],liste[i+1],15);
                strncpy(liste[i+1],hold,15);
            }
            else
                continue;
        }
    }

A: At the very least, you don't null terminate your strings. This will matter for all of the names that are not exactly 15 characters long.
The easiest way to fix this is to initialize your entire array to zero.
char liste[5164][15] = {{0}};


text:
Q: Multiple Ring Buffer too slow? I have to make multibuffer to a several shp's (30 or +) and with this code the it takes 30 minutes or more.
    import arcpy,time,glob,os
def multibuffer (probe,Zona_trab,nombarch3,recortes2):
    x=0
    bufdef = (Zona_trab,"\\bufferRing",time.strftime("%H%M%S"),".shp")
    bufferRings = ''.join(bufdef)
    if probe == 1:
        with open (nombarch3) as p:
            for x in recortes2:
                dtaring = p.readline()
                arquet, valbuf2, datperm= dtaring.split(",")
                valbuf2=float(valbuf2)
                a= valbuf2*0.3
                b= valbuf2*0.5
                c= valbuf2
                distances = [a,b,c]
                puntselec1a2 = (Zona_trab,"\\puntsele",x,".shp")
                puntsele2 = ''.join(puntselec1a2)
                print puntsele2
                print distances
                arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL")
        p.close
        wcard="puntsele*"
        try:
            dir=Zona_trab+os.sep+wcard+'.shp'
            flist=glob.glob(dir)
            arcpy.Merge_management(flist, bufferRings)
        except:
            print "error"

The code works, it have no errors, so it will work slow, but safe. My question is:
what would you do for speed up the process?

The first part of the program is done instantly, but this call:
arcpy.MultipleRingBuffer_analysis(puntsele2,"capadeRingbuff"+str(x)+".shp", distances, "meters", "", "ALL")

Make the stop of several minutes in the script.
With this new info, someone know how to speed up this part? Doing several MultipleRingBuffer at once or something like that? (I think is not posible to make that)

A: Since the performance that you are observing seems to be down to one particular tool, Multiple Ring Buffer, which is a Python script tool, I think you should submit an ArcGIS Idea to have it re-written at a lower level to improve its performance.


text:
Q: Detecting close of client connect in node.js I am using node.js for long held connections. I want to know how I can detect when the client connection closes (maybe when the user closes the tab). How do I specify a callback for that?

A: Answering my own question - You can detect close of client connection by doing:
http.createServer(function(request, response) {
    request.connection.addListener('close', function () {
        // callback is fired when connection closed (e.g. closing the browser)
    });
}

A: Take a look at Socket.io.  It supports the following transports with fallbacks in this order:

*

*WebSocket

*Adobe Flash Socket

*AJAX long polling

*AJAX multipart streaming

*Forever Iframe

*JSONP Polling

The benefit is you'll be able to handle a lot more concurrent connections than long polling alone.  In addition you'll get a rich set of features like heartbeats and disconnects.
io.sockets.on('connection', function (socket) {

  // ... other socket handlers here ...

  socket.on('disconnect', function () {
    // do something to handle the disconnect
  });
});


text:
Q: how to access data value using LINQ vb2010, i try this code but it fail Imports System.Data.SqlClient

Public Class Form1
  Dim bd As New lDataContext

  Dim qqq = From bs In bd.FILEs
              Select bs.RETURN_DATE
              Take 1

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If qqq = Date.Today.Date Then
        TextBox1.Text = "yes"
    Else
        TextBox1.Text = "no"
    End If
 End Sub
End Class

A: you can try this:
Dim qqq = (from bs in bd.FILEs select bs.RETURN_DATE).First()


text:
Q: How to push Char** into uin8_t vector? I am working on a function encode data into buffer. I already have functions for the encoding part.
I am encoding and then i push back into a uint8_t vector, which is my output buffer.
For the ints i have no problem, i use my function and everything is done, but now i have to encode a string.
There is already a function made by some developpers before me, which takes as argument char** (buffer to fill), size_t*, and char* which is the string i'm going to encode.
For the char * i just do .c_str() with my string in my C++ object but i don't know what to do about the buffer to fill, because i'm actually using a uint8_t vector.
I thinked about creating a temporary buffer then pushing it in the vector by casting it, is it a good way?
Here is my class (the mother class which is virtual but the string is here so i show you this one):
class CDnsMessage
{
    public:
            CDnsMessage();
            virtual ~CDnsMessage();

            virtual void GetSize() = 0;

            uint32_t       m_ttl;
            eDnsClass      m_class;
            eDnsType       m_type;
            std::string    m_domain;
            uint8_t        m_sizeDnsCorpse;
            uint8_t        m_sizeDomainName;
};

The encode part:
std::vector<uint8_t>& output
char * buffer;
std::size_t* bufsz;
EncodeSmallString(*buffer,*bufsz,RR_A_msg->m_domain.c_str());
output.push_back((uint8_t)buffer)

A: The encoding part needs to look like
char* buffer;
std::size_t bufsz;
EncodeSmallString(&buffer, &bufsize, RR_A_msg->m_domain.c_str());

(You pass in the address of a buffer pointer and size, and the function will allocate the buffer for you.)
Now you need to copy the temporary buffer into your output.  This is not a cast, this is a matter of copying each byte.  This being C++ there are a zillion ways to do this, but something like:
for (std::size_t i = 0; i<bufsiz;i++) {
    output.push_back(static_cast<uint8_t>(buffer[i]));
}

will work (you could also use std::copy or std::vector::insert).
Finally, you need to free the temporary buffer.  You will have to look at the documentation of EncodeSmallString to see how to do that - the most likely answers are free or delete[] depending on whether it was allocated with malloc or new [].
I would be very tempted to rewrite EncodeSmallString in terms of appending to a vector, and then write a wrapper overload (with the existing signature) something like:
void EncodeSmallString(char** pbuf, std::size_t* pbufsiz, const char* txt) {
    std::vector<uint8_t> temp;
    EncodeSmallString(temp, txt);
    *pbufsiz = temp.size();
    *pbuf = malloc(*pbufsiz);  // or new or whatever the existing code uses.
    // add error handling to taste
    std::copy(*pbuf, temp.begin(), temp.end());
}


text:
Q: Error propagation in combined linear models I have a set of observed values ($y_{1Obs}$) and 3 predictive variables (n = 27). I use multiple linear regression to create a linear model:
$Z_1=\alpha_0 + \alpha_1 W_1 + \alpha_2 X_1 + \alpha_3 Y_1$
Where $Z_1$ is my response variable, $\alpha_0$ is the intercept, $\alpha_1 , \alpha_2 , \alpha_3$ are regression coefficients and $W_1, X_1, Y_1$ are predictive variables.
I also have a second set of observed values ($y_{2Obs}$) and 3 different predictive variables (n = 27). I again use multiple linear regression to create a second linear model of the same form:
$Z_2=\beta_0 + \beta_1 W_2 + \beta_2 X_2 + \beta_3 Y_2$
Where $Z_2$ is my response variable, $\beta_0$ is the intercept, $\beta_1 , \beta_2 , \beta_3$ are regression coefficients and $W_2, X_2, Y_2$ are predictive variables.
With 27 predicted values from each model I then calculate the predicted change between the two:
$\Delta Z_{Pred}=Z_2 - Z_1$
While my observed change comes from the two sets of observed values used to create the two linear models:
$\Delta Z_{Obs}=y_{2Obs} - y_{1Obs}$
My question is: what formula do I use to calculate the RMSE of my predictions ($\Delta Z_{Pred}$) that will propagate the errors from predictions of $Z_1$ and $Z_2$?
I've tried using the following formula though I'm not convinced this is correct:
$RMSE_{\Delta Z_{Pred}} = \sqrt{{RMSE_1}^2 + {RMSE_2}^2}$
Where $RMSE_1$ and $RMSE_2$ are the RMSEs from the first two models shown above.

A: Not a complete answer but a couple of hopefully useful comments:

*

*The formula $RMSE_{\Delta Z_{Pred}} = \sqrt{{RMSE_1}^2 + {RMSE_2}^2}$ may work for independent sets of responses and predictors, but is likely to be false if the two sets are correlated. For example, if your two sets of predictors and responses are the same $RMSE_{\Delta Z_{Pred}}=0$, while $\sqrt{{RMSE_1}^2 + {RMSE_2}^2} > 0$.

*If you are interested in $\Delta Z_{Pred}$, I suggest regressing it on the six predictors - although this is not what you are asking, it might serve your goal.


text:
Q: How to use Win32 ThreadPool API? This version (based on this article) works:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>

VOID
CALLBACK
MyWorkCallback(
    PTP_CALLBACK_INSTANCE Instance,
    PVOID                 Parameter,
    PTP_WORK              Work
)
{
    // Instance, Parameter, and Work not used in this example.
    UNREFERENCED_PARAMETER(Instance);
    UNREFERENCED_PARAMETER(Parameter);
    UNREFERENCED_PARAMETER(Work);

    DWORD threadId = GetCurrentThreadId();

    BOOL bRet = FALSE;

    //
    // Do something when the work callback is invoked.
    //
    {
        _tprintf(_T("MyWorkCallback: ThreadId = %d Task performed.\n"), threadId);
    }

    return;
}

int main()
{
    TP_CALLBACK_ENVIRON CallBackEnviron;
    PTP_POOL pool = NULL;
    PTP_CLEANUP_GROUP cleanupgroup = NULL;
    PTP_WORK_CALLBACK workcallback = MyWorkCallback;
    PTP_TIMER timer = NULL;
    PTP_WORK work = NULL;

    InitializeThreadpoolEnvironment(&CallBackEnviron);
    pool = CreateThreadpool(NULL);
    SetThreadpoolThreadMaximum(pool, 1);
    SetThreadpoolThreadMinimum(pool, 3);
    cleanupgroup = CreateThreadpoolCleanupGroup();
    SetThreadpoolCallbackPool(&CallBackEnviron, pool);
    SetThreadpoolCallbackCleanupGroup(&CallBackEnviron, cleanupgroup, NULL);
    work = CreateThreadpoolWork(workcallback, NULL, &CallBackEnviron);
    for (int i = 0; i < 10; ++i)
    {
        SubmitThreadpoolWork(work);
    }
}

However, this version also works (with the same work function from above):
int main()
{
    PTP_WORK = CreateThreadpoolWork(workcallback, NULLPTR, NULLPTR);
    for (int i = 0; i < 10; ++i)
    {
        SubmitThreadpoolWork(work);
    }
}

What are the differences between the two versions (except for the minimum and maximum thread count)?
Why would I use one version over another?

A: This is covered in the documentation for InitializeThreadpoolEnvironment:

Create a callback environment if you plan to call one of the following functions to modify the environment:

*

*SetThreadpoolCallbackCleanupGroup

*SetThreadpoolCallbackLibrary

*SetThreadpoolCallbackPool

*SetThreadpoolCallbackPriority

*SetThreadpoolCallbackRunsLong

If you need the functionality provided by one or more of the listed functions, then you need to create a callback environment.  If you don't, you don't.
If in doubt when starting a new project, use the simple approach to begin with, and see whether it meets your needs.  You can always go back and switch to the more complex variant if and when it becomes necessary.


text:
Q: Can we have a different Icon and Name in Task module I am building chatbot using Bot framewokV4 on MS teams.
Can we use different Icon and Name for the task module?
By default, it is showing bot name and Image.
Is there a way to change the Icon and name for Task module than Bot name and Image.
Thanks.

A: I think the Task Module will use the name and icon from your Team's app definition (your manifest, or your definition from App Studio if you're using that to create/deploy), not from the Azure bot settings.
In that case, you can change the Task Module's name and image by changing the App's icon and name. You'll need to redeploy it though of course to see the changes.


text:
Q: Modular arithmetic in python to iterate a pandas dataframe Ok, I have a big dataframe such as:
      hour    value
  0      0      1
  1      6      2
  2     12      3
  3     18      4
  4      0      5
  5      6      6
  6     12      7
  7     18      8
  8      6      9
  9     12     10
 10     18     11
 11     12     12
 12     18     13
 13      0     14

Let's don't get lost here. The column hour represents the hours of the day, from 6 to 6 hours. Column values is well, exactly that, here the values are as an example, not the actual ones.
If you look closely to the hour column, you can see that there are hours missing. For instance, there is a gap between rows 7 and 8 (the value of hour 0 is missing). There are also bigger gaps, such as in  between rows 10 and 11 (hours 00 and 06).
What do I need? I would like to check when an hour (and of course) a value is missing, and complete the dataframe inserting a row there with the corresponding hour and a np.nan as value.
What have I thought? I think this would be easily solved using modular arithmetic, in this case with mod 24, such as when 18 + 6 = 24 = 0 mod 24. So initializing the counter to zero and adding 6 with the caveat that the counter is defined in modular arithmetic mod 24 you can verify if each hour is the corresponding hour, and if not, insert a new row with the corresponding hour and with np.nan as value.
I don't know how to do the implementation of modular arithmetic in python to iterate a dataframe column.
Thank you very much.

A: Solution
group_hours = (df.hour <= df.hour.shift()).cumsum()

def insert_missing_hours(df):
    return df.set_index('hour').reindex([0, 6, 12, 18]).reset_index()

df.groupby(group_hours).apply(insert_missing_hours).reset_index(drop=1)

Looks like:
    hour  value
0      0    1.0
1      6    2.0
2     12    3.0
3     18    4.0
4      0    5.0
5      6    6.0
6     12    7.0
7     18    8.0
8      0    NaN
9      6    9.0
10    12   10.0
11    18   11.0
12     0    NaN
13     6    NaN
14    12   12.0
15    18   13.0
16     0   14.0
17     6    NaN
18    12    NaN
19    18    NaN

Explanation
In order to apply reindex I needed to determine which rows to group.  I checked to see if row's hour was less or equal than prior row's hour.  If so, that flags a new group.
insert_missing_hours is precisely the reindex of subgroups with [0, 6, 12, 18].

A: Although this solution is more complex, it should be much more efficient, especially for larger dataframes.  This solution creates a list of hours and values (including any filled hours) and then uses this list to produce a dataframe.
def hour_checker(hours, values):
    def check_hour(hour):
        if hour not in (0, 6, 12, 18):
            raise ValueError('Invalid hour')
    [check_hour(hour) for hour in hours]
    result = []
    valid_hours = np.arange(0, 24, 6)
    while valid_hours[-1] != hour:
        # Initialize.
        valid_hours = np.roll(valid_hours, -1)
        result.append([hours.iat[0], values.iat[0]])
    for hour, value in zip(hours.iloc[1:], values.iloc[1:]):
        while hour != valid_hours[0]:
            result.append([valid_hours[0], None])
            valid_hours = np.roll(valid_hours, -1)
        result.append([hour, value])
        valid_hours = np.roll(valid_hours, -1)
    return pd.DataFrame(result, columns=['hour', 'value'])

hour_checker(df['hour'], df['value'])
Out[33]:
    hour  value
0      0      1
1      6      2
2     12      3
3     18      4
4      0      5
5      6      6
6     12      7
7     18      8
8      0    NaN
9      6      9
10    12     10
11    18     11
12     0    NaN
13     6    NaN
14    12     12
15    18     13
16     0     14

Timings
df_test = pd.concat([df] * 100)

%%timeit
group_hours = (df_test.hour <= df_test.hour.shift()).cumsum()
df_test.groupby(group_hours).apply(insert_missing_hours).reset_index(drop=1)
1 loops, best of 3: 611 ms per loop

%timeit hour_checker(df_test['hour'], df_test['value'])
100 loops, best of 3: 12.4 ms per loop


text:
Q: Why use a converged network design in Hyper-V? I am reorienting myself to Hyper-V in its Windows Server 2012 R2 incarnation and have spent a fair bit of time reading Microsoft's Designing Your Cloud Infrastructure documentation. I am in the SME space and working with a pretty typical deployment: three to four Dell R710s as Hyper-V hosts, an EqualLogic PS6100 for shared storage, and 1Gb for traditional data and SAN traffic with physically discrete switches for each network.
The existing infrastructure is a VMware vSphere implementation but I think it is close to what Microsoft is calling a Non-Converged Data Center Configuration: 1) Separate networks for storage, vMotion/Live Migration, Management and Guest traffic and 2) traditional SAN storage. This sounds like the appropriate approach but I do not want to rule out a design architecture simply because it is new and I do not fully understand it.
My only other experience with converged networking is with Cisco UCS and vSphere so to me "converged networking" means the entire networking infrastructure is basically stateless and virtualized. Microsoft's converged networking seems to mean "using Storage Spaces".
My goals for this deployment are:

*

*Simple - I don't want to overbuild or make it unnecessarily complicated. Having the appropriate resources is hard in the SME space.

*Flexible. I want there to be a lot of room for growth and scale in the future. The company is growing, I want the infrastructure to be ready to grow with it.

*Clean. It can be simple and small and slow but it needs to be clean. No hackery allowed. Small environments can be professional too.

*Ease of transition - I want to be able to transition from the vSphere implementation live without doing a cutover. I would like to have both environments up at the same time.

Why would I want to use a converged networking design when I have traditional SAN storage  and am limited to 1Gb? What advantages and disadvantages does it have over non-converged virtualization networks for the SME space?

A: Honestly, in SME, you don't want to run converged. There's at least one person on this site that I know of who runs a converged network, but they are talking multi-million-dollar budgets and racks and racks and racks of blades and SAN storage.
What you've described sounds perfectly normal and perfectly fine. Perhaps the one place you might want to run a converged network is if you have limited ports and the ports are fast.
For example, I'd rather take two 10GbE converged network ports per server than eight 1GbE network ports - but that would dictate the need for appropriate hardware and budgets.


text:
Q: Oracle Client and networking components were not found - Excel VBA I'm trying to connect to an Oracle DB through Excel. I have installed the Instant Client from Oracle on my machine, but am getting this message when I run this code:
Sub testing()

    Dim myConn As Connection: Set myConn = New Connection
    Dim mySet As Recordset: Set mySet = New Recordset
    Dim CONNSTRING As String
    CONNSTRING = "Driver={Microsoft ODBC for Oracle}; " & _
                "CONNECTSTRING=(DESCRIPTION=" & _
                "(ADDRESS=(PROTOCOL=TCP)" & _
                "(HOST=xxxxxx.xxx.xxxxxxxxxxx.com)(PORT=1524))" & _
                "(CONNECT_DATA=(SERVICE_NAME=dev))); uid=xxxxxxx; pwd=xxxxxxxxxxx;"

    myConn.Open CONNSTRING
    mySet.Open "SELECT * FROM apps.ap_invoice_lines_interface", myConn, adOpenStatic, adLockBatchOptimistic, adCmdTable

    Sheet1.Range("A1").CopyFromRecordset mySet

    mySet.Close
    myConn.Close

End Sub

The message I am getting is
The Oracle(tm) client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3 (or greater) client software installation. You will be unable to use this driver until these components have been installed

A: I see this error frequently when our desktop support team installs the wrong Oracle client.  If your application (Excel, in this case) is 32-bit, then you also need to be using 32-bit ODBC and 32-bit Oracle client.  It doesn't matter that your OS or hardware is 64-bit.  What matters is the application.  And it seems that most MS Office installations are 32-bit, even when installed on 64-bit Windows.

A: In my case, the Console project in Visual Studio had Prefer 32 bit check-marked in its Properties.
Press Alt + Enter and open the Build section.
I unchecked it and then the app worked perfectly.
By the way: I had installed Oracle client 64 bit.


text:
Q: Launch a select menu (BASH script) from the GUI with a certain keystroke I've put together a shell script with a select menu that is launched from the command line. Do you guys have any ideas how I could launch it from the GUI with a certain key stroke?
I was thinking about finding a way to launch the script immediately after switching to one of the virtual terminals. (ctr-alt-f1). Is something like this possible?
GUI Shell script options seem very limited.

A: In LXDE, you can bind actions to key combinations. See Bindings in Openbox Help.

A: If you want to use virtual terminal (without LXDE), you can edit /etc/init/tty6.conf and change the exec line at the end to your script.
# tty6 - getty
#
# This service maintains a getty on tty6 from the point the system is
# started until it is shut down again.

start on runlevel [23] and not-container

stop on runlevel [!23]

respawn
exec /path/to/your/script


text: Q: How create Bollinger Bands with infinidb Currently, I use InfiniDB with php trader extension (there is trader_bbands function which help), but I want to check that all final values of Bollinger lines are correct with sql solution.


text:
Q: Чтение файла .xsb в Python Подскажите пожалуйста, возможно ли открыть файл с расширением xsb в Python?
Файл сгенерирован в "Справки БК" (2.5.1) - программе для составления справок госслужащих в налоговую.

A: Как правило государственные структуры обмениваются XML файлами. И сам .XSB формат имеет 4 типа содержимого.

*

*Sybase PowerDesigner XML Model Backup

*XACT Sound Bank

*XMLBeans XML Schema Binary (скорее всего мы говорим о таком .xsb)

*Sokoban++ Level Data

В свою очередь с помощью Java мы можем попробовать с ним используя Apache XMLBeans https://xmlbeans.apache.org/
Но нужно помнить, что этими файлами обмениваются гос.органы, у них вероятней всего есть end-to-end шифрование или кастомизация формата. Вам потребуется изучить ваше приложение "Справки БК" (2.5.1) чтобы определить способ шифрования. Или попробовать дешифровать его самостоятельно путем составления словаря символов.

A: Как оказалось, достаточно поработать с кодировкой:
import base64

encoding = 'UTF-32LE'

with open('путь/к/вашему/файлу.xsb', 'r') as file:
    data = file.read()[6:]
    data_bytes = data.encode('UTF-8')
    converted = base64.b64decode(data_bytes).decode(encoding)