text:
Q: Uploading Excel file in swing I am upload the Excel file and read that file according to format, but problem is that that file is not read. I am getting exception. I am adding all required jar file (dom4j-1.6.1,poi-3.9-20121203,poi-ooxml-3.9-20121203,poi-ooxml-schemas-3.9-20121203,xmlbeans-2.3.0). Please suggest me what I getting wrong. Exception is below.
public class Csv_Upload extends JFrame implements ActionListener
{
    public static JFrame f;
    JPanel panel;
    JButton b1,b2,b3,b4;
    JTextField txt1;
    JLabel l1;
    Font g,g1;
      JFileChooser fc;
      JTextArea log;
      File file1 ;
      String str;
    DBConnection connect=new  DBConnection();
     static private final String newline = "\n";
    public Csv_Upload()
    {
        panel=(JPanel)getContentPane();
        panel.setLayout(null);
        g=new Font("Georgia",Font.BOLD,22);
        g1=new Font("Georgia",Font.BOLD,15);
        panel.setBackground(new java.awt.Color(204, 230 , 255));
        l1=new JLabel("Upload Excel File");
        l1.setBounds(200, 50, 400, 30);
        l1.setFont(g);
        l1.setForeground(Color.RED);
        panel.add(l1);
            txt1=new JTextField();
        txt1.setBounds(480, 150,200,40);
        panel.add(txt1);
        fc = new JFileChooser();
        b1=new JButton("Browse File");
        b1.setBounds(50, 150,200,40);
        b1.setFont(g1);
        b1.setForeground(Color.RED);
        panel.add(b1);
        b2=new JButton("Upload File");
        b2.setBounds(260, 150,200,40);
        b2.setForeground(Color.RED);
        b2.setFont(g1);
        panel.add(b2);
        ImageIcon img=new ImageIcon("calender.png");
        b3=new JButton(img);
        b3.setBounds(50, 230,50,30);
        b3.setForeground(Color.RED);
        b3.setFont(g1);
        panel.add(b3);
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
//      b4.addActionListener(this);
        }

    @Override
    public void actionPerformed(ActionEvent e)
    {
         if (e.getSource() == b1) {
              int returnVal = fc.showOpenDialog(Csv_Upload.this);

              if (returnVal == JFileChooser.APPROVE_OPTION) {
             file1 = fc.getSelectedFile();
             str=String.valueOf(file1);
                System.out.println("file fath"+file1);
              }
   //Handle save button action.
}
         if(e.getSource()==b2)
         {
             try
                {
                    FileInputStream file = new FileInputStream(new File(str));
                    System.out.println("action performed in file"+file);
                    XSSFWorkbook workbook = new XSSFWorkbook(file);
                    XSSFSheet sheet = workbook.getSheetAt(0);
                    Iterator<Row> rowIterator = sheet.iterator();
                    while (rowIterator.hasNext())
                    {
                        Row row = rowIterator.next();
                        //For each row, iterate through all the columns
                        Iterator<Cell> cellIterator = row.cellIterator();

                        while (cellIterator.hasNext())
                        {
                            Cell cell = cellIterator.next();

                            switch (cell.getCellType())
                            {
                                case Cell.CELL_TYPE_NUMERIC:
                                    System.out.print(cell.getNumericCellValue() + "\t");
                                    break;
                                case Cell.CELL_TYPE_STRING:
                                    System.out.print(cell.getStringCellValue() + "\t");
                                    break;
                            }
                        }
                        System.out.println("");
                    }
                    file.close();
                }
                catch (Exception e1)
                {
                    e1.printStackTrace();
                }
         }

         if(e.getSource().equals(b3))
            {
            txt1.setText(new DatePicker(f).setPickedDate());
            }
          }

    public static void main(String []s)
        {
             f=new Csv_Upload();
            f.setVisible(true);
            f.setSize(750,500);

            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
}

Stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError:
    org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(Ljava/io/InputStream;)V
at ADD.Csv_Upload.actionPerformed(Csv_Upload.java:129)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

A: The class org.apache.poi.xssf.usermodel.XSSFWorkbook has a constructor init method that accepts a java.io.InputStream, and XSSFWorkbook is located in poi-ooxml-schemas-3.9-20121203.jar. Check the README file in your project's dist directory. Also check the project JAR's manifest, which should look something like this:

Class-Path: lib/poi-3.9-20121203.jar lib/poi-ooxml-3.9-20121203.jar …


text:
Q: Symfony2 and Twig: how to prevent render of labels? As said in title. I have a form type and have to render some fields without labels (because I have to fit them into table's cells).
How can I do that?
Online documentation seems to be very low quality for that cases.

A: you dont need to change the default behavior.. you easly could render only inputs and labels in your template.
<form>

                {{ form_label(form.fieldName) }}

                {{ form_errors(form.fieldName) }}
                {{ form_widget(form.fieldName) }}

</form>

if you dont render the whole form, dont forget about the {{ form_widget(form._token) }} or more simple use {{ form_rest(form) }}

A: You need to create your own 'form theme' as described in the docs. You can use the methods form_label, form_errors and form_widget to style where you want it. If you don't want the label you don't use the form_label function and just only the form_errors and form_widget functions:
{# src/Acme/TaskBundle/Resources/views/Form/fields.html.twig #}
{% block form_row %}
{% spaceless %}

        {{ form_errors(form) }}
        {{ form_widget(form) }}

{% endspaceless %}
{% endblock form_row %}

redpajama_set_name: RedPajamaStackExchange


text:
Q: set Image and lable text in javascript In my application, I have a Javascript function which get called after every minute. This javascript function returns me new comma seprated string each time which contains image path and image name. I simply split this string and set the Image path to image and text to lable. Goel is to achive effect like image slide show.
Every thing works fine. The Images and name get change successfully on mizilla. When I browse this in IE the image and name not change at one time. Name get change first and then Image get changed. It was loosing the slide show effect.
I don't know why this is happening. Is it because of browse..? I need to change both Image and name at a time.
Can anyone tell me how to do it...?
Here is the sample javascript function I use to set the Image
function setImage(response)

 {

if(response.value != null)

{

var imgArr=response.value.split(',');

var SN=document.getElementById('ctl00_MC_cntrlGal_ScreenName');

var mainImage=document.getElementById("Img");

if(SN!=null && Img!=null)

{

SN.innerHTML=imgArr[0];

mainImage.src=imgArr[1];

}

}

}

A: Himadri is right, problem is on image loading. But instead of setTimeout i recommend to use image preloading and load event as signal to change image. Your images have different size and users have different channels, so you can't be sure that image will be loaded in time.

A: I think the problem is on image loading. Each time a new image path is set the browser takes time to load the image. As you know Images are heavy to load than text so the text is assigned fast and the image is being loaded slowly.
You can use setTimeOut and pause for some miliseconds and then set the text. I think it can solve your problem.
Please check.


text:
Q: Is it possible to change/customize some conversions done by TeXForm? I use TeXForm to convert output of some computation to Latex. I'd like to ask if there is a way to override/change/customize some of these conversions, related to just the name Mathematica assigns to some special functions in its Latex output, since it is not clear what they are in the Latex after the conversion.
Here is an example. FresnelC function is changed to C in Latex. So someone reading the latex PDF, will not really know what C is and I like to keep the name as FresnelC.  I suppose I could add note saying that C is FresnelC, but this is all automated, and I do not know beforehand that the solution being generated even has FresnelC in it to make the note. I just look at the final Latex output.
MWE
sol = y[t] /. First@DSolve[y'[t] + y[t] Sqrt[t] Sin[t] == 0, y[t], t]

But the Latex output is
TeXForm[sol]
(*  c_1 e^{\sqrt{t} \cos (t)-\sqrt{\frac{\pi }{2}}
       C\left(\sqrt{\frac{2}{\pi }} \sqrt{t}\right)} *)

Which is rendered as
$$c_1 e^{\sqrt{t} \cos (t)-\sqrt{\frac{\pi }{2}} C\left(\sqrt{\frac{2}{\pi }} \sqrt{t}\right)}$$
I'd like it to still show as the full name FresnelC
$$c_1 e^{\sqrt{t} \cos (t)-\sqrt{\frac{\pi }{2}} \text{FresnelC}\left(\sqrt{\frac{2}{\pi }} \sqrt{t}\right)}$$
So it is more clear. This is how Maple does it also:

This does not only affect the above function, but others as well. For example
 TeXForm[CosIntegral[x]]

gives
$$\text{Ci}(x)$$ and I'd like to keep the same in the Latex as the name in the Mathematica command.
$$\text{CosIntegral}(x)$$
Since it is more clear.
Question is: Is there a way to customize some of these conversions?

A: I will assume that you want the normal TraditionalForm typesetting in a notebook to be unaffected, and only want to see the TeXForm of FresnelC, CosIntegral and other targeted functions changed. Also, I assume you don't want to have to use a new function, like myTeXForm, but would rather just use TeXForm as you usually do.
TeXForm works by first converting an expression into TraditionalForm boxes, and then converting those boxes into a TeX string. So, one possibility is to do as @QuantumDot suggests, and modify the functions that convert the boxes to a TeX string. However, I prefer avoiding the creation of the wrong boxes. Another possibility is to do as @b3m2a1 suggests, but then both the TeXForm and normal TraditionalForm typesetting will be affected.
Instead, I would modify the expression to boxes internal function so that it creates the desired boxes. This can be done by having this function set a global variable, say $TeX, to True. Then, when the expression is converted to boxes, a conditioned FormatValue can be used to create the TraditionalForm boxes you want.
Initial
It will be convenient to make use of the function Initial from my answer to How can one manually change the rule ordering:
Initial /: Verbatim[TagSetDelayed][Initial[sym_], lhs_, rhs_] := With[
    {
    new = Block[{sym},
        TagSetDelayed[sym, lhs, rhs];
        First @ Language`ExtendedDefinition[sym, "ExcludedContexts" -> {}]
    ],
    protect=Unprotect[sym]
    },

    sym;
    Replace[new,
        Rule[values_, n:Except[{}]] :> (values[sym] = Prepend[values[sym],n]),
        {2}
    ];
    Protect@protect;
]

This function creates a new *Value, and prepends it to the existing *Values. It also forces autoloading of any necessary packages (.mx) files that will populate the *Values of the function before the new *Value is added.
Convert`TeX`ExpressionToTeX
The internal function I will modify is Convert`TeX`ExpressionToTeX:
Initial[Convert`TeX`ExpressionToTeX] /:
    Convert`TeX`ExpressionToTeX[e__] /; !TrueQ@$TeX := Block[
        {$TeX = True},
        Convert`TeX`ExpressionToTeX[e]
    ]

Note that when $TeX is not True, the above DownValue will set $TeX to True, and then use the old DownValue.
FormatValues
The new TraditionalForm FormatValues are:
Initial[FresnelC] /: MakeBoxes[FresnelC[a_], TraditionalForm] /; $TeX :=
    MakeBoxes[Defer[FresnelC][a], TraditionalForm]
Initial[CosIntegral] /: MakeBoxes[CosIntegral[a_], TraditionalForm] /; $TeX :=
    MakeBoxes[Defer[CosIntegral][a], TraditionalForm]

Note the use of the $TeX condition. Also, note the use of Defer[FresnelC] on the RHS so that no recursion errors occur. Finally, I like using Defer[FresnelC] instead of something like HoldForm[FresnelC] because the boxes that are produced are simpler. Compare:
MakeBoxes[Defer[FresnelC], TraditionalForm]
MakeBoxes[HoldForm[FresnelC], TraditionalForm]

"FresnelC"

TagBox["FresnelC", HoldForm]

Results
Here we see the new TeXForm formatting in action:
ToString[{FresnelC[a], CosIntegral[b]}, TeXForm]

"\{\text{FresnelC}(a),\text{CosIntegral}(b)\}"

And here we see the normal TraditionalForm typesetting is still in place:
{FresnelC[a], CosIntegral[b]} //TraditionalForm

{C(a),Ci(b)}

Update
To address the question in the comments, defining:
System`Convert`TeXFormDump`maketex[s_String] /; !StringMatchQ[s, "\""~~___~~"\""] && SyntaxQ[s, TeXForm] := Replace[
    s,
    {
        n_ /; StringMatchQ[n, NumberString] :> n,
        w_?wordQ :> "\\operatorname{"<>w<>"}"
    }
]

wordQ[s_String] := Length @ StringSplit[s, WordBoundary] == 1

should make operators use \operatorname instead of \text.

A: Another option is to just reset the TraditionalForm format of CosIntegral (or whatever symbol you want to mess with):
Unprotect[CosIntegral];
Format[CosIntegral[b_], TraditionalForm] :=
  RawBoxes@RowBox[{"CosIntegral", "(", MakeBoxes[b, TraditionalForm],
     ")"}];
FormatValues[CosIntegral] = RotateRight@FormatValues[CosIntegral];
Protect[CosIntegral];
CosIntegral // FormatValues

{HoldPattern[MakeBoxes[CosIntegral[b_], TraditionalForm]] :> \!\(\*
TagBox[
FormBox[
RowBox[{"CosIntegral", "(", "b", ")"}],
TraditionalForm],
Format[#, TraditionalForm]& ]\),
 HoldPattern[
   MakeBoxes[CosIntegral[BoxForm`a$_], TraditionalForm] /;
    BoxForm`sufficientVersionQ[6.1]] :>
  TemplateBox[{MakeBoxes[BoxForm`a$, TraditionalForm]},
   "CosIntegral"]}

Then:
CosIntegral[x] // TraditionalForm // ToBoxes // FE`makePlainText
CosIntegral[x] // TeXForm // ToBoxes // FE`makePlainText

"CosIntegral(x)"

"\\text{CosIntegral}(x)"

A: You could use my TeXUtilities package:
Import@"https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/NoInstall.m"

Unprotect[FresnelC, CosIntegral];
Format[FresnelC@x_, TeXForm] := TeXVerbatim["\\operatorname{FresnelC}"]@x
Format[CosIntegral@x_, TeXForm] := TeXVerbatim["\\operatorname{CosIntegral}"]@x
(* Move TeXForm format to begining of FormatValues so they take precedence over existing ones. *)
(FormatValues@# = Join[#@False, #@True]&@GroupBy[FormatValues@#, FreeQ@TeXForm]) & /@ {FresnelC, CosIntegral};
Protect[FresnelC, CosIntegral];

Now use TeXForm as usual:
y[t] /. First@DSolve[y'[t] + y[t] Sqrt[t] Sin[t] == 0, y[t], t] // TeXForm
(* c_1 e^{\sqrt{t} \cos (t)-\sqrt{\frac{\pi }{2}} \operatorname{FresnelC}\left(\sqrt{\frac{2}{\pi }} \sqrt{t}\right)} *)

$c_1 e^{\sqrt{t} \cos (t)-\sqrt{\frac{\pi }{2}} \operatorname{FresnelC}\left(\sqrt{\frac{2}{\pi }} \sqrt{t}\right)}$

CosIntegral[x] // TeXForm
(* \operatorname{CosIntegral}(x) *)

$\operatorname{CosIntegral}(x)$


text:
Q: Unable to change listening port via environment variables with ASP.NET Core 2.0 In my ASP.NET Core 2.0 application my web-host ist built like this:
public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .UseNLog()
        .UseUrls("http://*:5000")
        .Build();

I tried to override the listenting port by setting the environment variable:
SET ASPNETCORE_URLS=http://*:5001

But on startup my application still says
Now listening on: http://[::]:5000

I also tried to explicitly include environment variables as configuration source like this:
public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .UseNLog()
        .UseUrls("http://*:5000")
        .UseConfiguration(new ConfigurationBuilder().AddEnvironmentVariables().Build())
        .Build();

But it doesn't work either.
So how can I make the listening port configurable via environment variables (and still provide a hardcoded default)?


text:
Q: Laravel upgrade strategy I have a very old app running on Laravel 4.2 that I want to upgrade to ideally Laravel 7 or 8. I'm wondering if I need to go through the upgrade incrementally from 4.2 to 5.0 to 5.1 etc until the desired version or is there a more efficient and time-saving way? BTW, I've heard of LaraUp which upgrades 4.2 to 5.8 and Laravel Shift but I haven't get around to try them out. Would appreciate some ideas or thoughts here.
Thanks!


text:
Q: Unique ID for each chrome user? Is there a unique ID for each Chrome User?
So that I on my extension, can save informations on my database, with each user have their own unqiue ID?
Does that exist somehow?
EDIT:
Or can I store informations locally on the users machine? This would make it possible to do the same as I want to do?

A: Im sure this answers your question. And for your update, Yes you can use localstorage to store info on the client computer. Hope this helps :)

Well to track how many installs of your extension, you can add the
  Google Analytics ID to your extension in your management area for you
  Chrome Extension Gallery. That will keep track of the installs and
  updates. Google analytics even has tracking usage, so you can add
  tracking information based on a specific metric (clicking, logging)
  etc.
If you meant for each "user" tracking, no, extensions don't identify
  each individual user, the only thing that is unique is the extension
  itself with its extension id. You can have other means of identifying
  a user uniquely through a third party service, such as OAuth, OpenID,
  or some custom stuff. Then you can associate your authentication to
  something locally

A: While identifying a user is not supported without the user actually logging into the app, you could track the install or machine. See this response of mine for details.
What is the best to identify machine/user in Google Chrome Extention?


text:
Q: Google CSE REST API : is v1 deprecated, is there a v2? As many users of google CSE API, I received recently an email from "Google Custom Search" asking me "Please migrate to the Custom Search Element API 2.0". I checked the documentation, but they only describe how to integrate a google search input in a website. I am currently using the REST endpoint of google cse from a Node.js program, so I cannot use this. The documentation concerning the REST endpoint still references the V1, so I am a bit lost. I am wondering if this endpoint is also deprecated and will soon stop working, and if the v2 of the API is (or will be) available via a REST endpoint.
This subject has already been posted on official Google forums, it seems that many people worry about this, but for now there is no answer from google, so I'm trying this here !
Thanks

A: I finally found a satisfying answer, thanks to Josh Sloat on the Google CSE forum. Here is the answer he got from Google support : "Upon looking on a related issue and feedback from one of the Google Enterprise Search Support Team. If you are using JSON API to retrieve results and not using custom search element API 1.0/2.0 code snippets then you won't be impacted with the communication sent regarding the migration of custom search element API 1.0 to 2.0.".
So it appears that the REST API isn't affected by this update !

A: Here to add that we had a tech support chat with Google today, and confirmed the same: JSON/REST v1 API is currently not going away. I'm glad to get clarity on this issue (for now...)


text:
Q: Prove $0 \leq \frac{b-a}{1-ab} \leq 1$ if $ 0 \leq a \leq b \leq 1$
Prove  that $0 \leq \frac{b-a}{1-ab} \leq 1$  if $ 0 \leq a \leq b \leq 1$

It is a pretty easy exersice. I´m starting learning inequalities and  I cant find how prove it.
I want prove that $0 \leq \frac{b-a}{1-ab}$
For it I say that $b-a  \geq 0$ since $a \leq b$, in addition $1-ab$ cannot be zero. it is $a \neq b^{-1}$
then $1-ab<1$ since $1<ab+1$ $a =b \neq 0$ (otherwise $a=b=0$ implies $ 0 \leq\frac{b-a}{1-ab}$)
therefore $\frac{b-a}{1-ab} \geq 0$
Now I want prove that $\frac{b-a}{1-ab} \leq 1$
for this I tryed use the absolute value to the expression, but I fail.
Too try use a triangle inequality, but too fail.
Any hint or advice was very helpful, if someone can tell or explain  how to solve this kind of problems in math was very helpful, because I´m not good for think in tricks for the inequality problems.

A: If the problem says $a<b$ then we are only left to prove $\dfrac{b-a}{1-ab}<1$
or
$$ 1-\dfrac{b-a}{1-ab} = \dfrac{1-ab+a-b}{1-ab} = \dfrac{(1+a)(1-b)}{1-ab} $$
And we are done

A: just rearrange the right part of the inequality (excluding $ab=1$):
$$\frac{b-a}{1-ab} \leq 1 \Leftrightarrow b-a\leq 1-ab \Leftrightarrow b(1+a)\leq 1+a$$
which is obviously true under the given conditions.

A: $$ 1+a = 1+a $$
$$ \Rightarrow b(1+a) \le 1+a $$
$$ \Rightarrow b+ab \le 1+a $$
$$ \Rightarrow b-a \le 1-ab $$
$$ \Rightarrow \frac{b-a}{1-ab} \le 1 $$


text:
Q: Angular2 re-renders on every mouse movement I have a Angular2 (2.4.0) application which presents a list in a ngFor loop, and I've noticed that every time a move the mouse the list is getting re-rendered. Has any one else noticed similar behavior and/or know why it's like this?
The table that is getting re-rendered:

      {{person.name}}

  </tboby>

I've added a console.log statement in getPersons() and it's getting logged on every mouse movement.

A: Using the method, which return array of objects, is very bad solution.
You should iterate the static array or using pipe (it depends on the case).
Try call your function in constructor (or ngOnInit method), for example:
In your TypeScript file:
@Component({
    selector: 'some-selector',
    templateUrl: 'template.html'
})
export class SomeComponent {

   someArray: any[];

   ngOnInit() {
      this.someArray = getPersons();
   }

   getPersons() {
      //some code...
   }
}

and in your HTML file (template.html):

...


text:
Q: duckdb getting 'Error: IO Error: Frame requires too much memory for decoding' error when reading very large files I'm trying to read a month's worth of Reddit data from Pushshift. These files are around 30gigs, compressed (zst format) of json data. I am trying to convert these files to parquet.
Here is the code:
time ~/prog/duckdb -c "copy (select created_utc, body, author, subreddit, parent_id, id from read_ndjson_auto('RC_2022-01.zst')) to 'RC_2022-01.parquet' (format 'PARQUET', CODEC 'ZSTD')"

The weird thing is, I can process the most recent file just fine. This file also happens to be the biggest. Perhaps something changed in the zst parameters they used to compress the file. This also implies that this isn't a bug in duckdb.
However, I do need to know how to change framesize or increase memory available to the zst module. Not sure how to control that in duckdb.


text:
Q: How to clone or detach node from the source using ts-morph? I want to clone or detach node from typescript ast (using ts-morph).
I explain what I mean using this example:
I have two projects:
const fooProject = new Project();
const barProject = new Project();

const fooSourceFile = fooProject.createSourceFile(
  "foo.ts",
  `
  const fn = [{ id: 1 }, { id: 2 }, { id: 3, children: [{ id: 4 }] }];
`
);

const barSourceFile = fooProject.createSourceFile("bar.ts", ``);

And the goal is to increment each id by one and then add it to barSourceFile and not change the fooSourceFile.
But here is the problem, I must call saveSync in the end of my application and I can't change that:
fooProject.saveSync();
barProject.saveSync();

So it easier for me to find the correct node and change the values and write to the target source file as I do here:

const vars = fooSourceFile.getDescendantsOfKind(SyntaxKind.VariableDeclaration);
vars.forEach((v) => {
  // v.forget();
  // v.forgetDescendants();

  const props = v
    .getDescendantsOfKind(SyntaxKind.Identifier)
    .filter((i) => i.getText() === "id");

  props.forEach((prop) => {
    const propertyAssignment = prop.getParentIfKind(
      SyntaxKind.PropertyAssignment
    );

    const oldValue = propertyAssignment?.getInitializer()?.getText();
    const newValue = +(oldValue as string) + 1;
    console.log({ newValue });

    propertyAssignment?.setInitializer(newValue.toString());
  });

  console.log({ props: props.map((p) => p.getText()) });
});

barSourceFile.addStatements(vars.map((a) => a.getText()));

I tried to use forgot and forgetDescendants methods, but it didn't work because I got an error saying the node was forgotten or removed, so I couldn't change the values or take any action.
If it is possible to clone the node or make changes that are not affected on the node - this is what I am looking for.
Is it possible to do with ts-morph?
codesandbox


text:
Q: Is there step by step documentation for installing apache on ubuntu? I need to install Apache on Ubuntu.  Which is the simplest way to accomplish this task?  Is there a detailed documentation?  Regards.  Sumo

A: There is a community guide to install apache. But is very hard to find a step by step guide, because you have to enter just one command to install it.
So for users with few or no experience using a terminal I create this step by step guide:

*

*Turn your computer on and login into your Ubuntu user

*Open a terminal, search it in the dash or press Ctrl+Alt+T

*Now that you have open the terminal enter the next command:
sudo apt-get install apache2

*If it request you a password, enter this and press enter.
To see how it works enter the next command or restart your computer (very annoying):
sudo /etc/init.d/apache2 restart

It will restart apache. Open your web browser and enter http://localhost in the address bar.
Further information: HTTPD - Apache2 Web Server & ApacheMySQLPHP


text:
Q: loop user inputted string in script trying to make a basic addition function that adds the numbers entered and outputs a total. Here's my current function:
function addition() {
    read -a arr

    for i in ${arr[@]}
    do
        str=$str'+'$i

        echo $i
    done

    echo $str
}

but this seems to ask for one input then outputs the above. I've also tried using:
function addition() {
    for i in ${input[@]}

but that outputs an empty string. How do I go about creating a function that takes this command:
$ addition 4 3 13 40

into the function?

A: If your script/function takes the numbers on the command line, then you don't need to read them with read (which reads from standard input).
Instead:
addition () {
    sum=0

    for number do
        sum=$(( sum + number ))
    done

    printf 'Sum is %d\n' "$sum"
}

The loop could also be written more explicitly as
for number in "$@"; do
    sum=$(( sum + number ))
done

In both variations of the loop, the number variable will be assigned the value of each positional parameter ("command line argument") in turn, and the body of the loop will add these to the sum variable.
Note that the above code assumes that all command line arguments are integers without verifying that they are.

For fancier output:
addition () {
    sum=0

    for number do
        sum=$(( sum + number ))
    done

    ( IFS='+'; printf '%s = %d\n' "$*" "$sum" )
}

"$*" will expand to a single string consisting of the positional parameters concatenated with the first character of $IFS as delimiter.
Testing:
$ addition 1 2 3 90 32
1+2+3+90+32 = 128


text:
Q: How to extract uuid from Ramsey\Uuid\Codec\StringCodec? So far, from the following lines
$records = $this->entityManager->getRepository(Translation::class)->findBy([], ['id' => 'DESC'], 1, 0);
$uuid = $records[0]->getId();

I could get following lines.
Ramsey\Uuid\Uuid {#131
  #codec: Ramsey\Uuid\Codec\StringCodec {#86
    -builder: Ramsey\Uuid\Builder\DefaultUuidBuilder {#383
      -converter: Ramsey\Uuid\Converter\Number\DegradedNumberConverter {#390}
    }
  }
  #fields: array:6 [
    "time_low" => "1483fc71"
    "time_mid" => "66e9"
    "time_hi_and_version" => "4e21"
    "clock_seq_hi_and_reserved" => "b9"
    "clock_seq_low" => "50"
    "node" => "c6e9e6405428"
  ]
  #converter: Ramsey\Uuid\Converter\Number\DegradedNumberConverter {#390}
  uuid: "1483fc71-66e9"
}

How can I extract uuid ?

A: The class implements PHP's __toString method, so you can just cast the object to a string:
$uuid = (string) $records[0]->getId();

A: With Ramsey\Uuid\Uuid you can extract the UUID as a string in serval ways. The base method is Ramsey\Uuid\Uuid::toString(), so for your code example like this:
$uuid = $records[0]->getId()->toString();

For naming conventions there exists some wrapper methods that all calling Ramsey\Uuid\Uuid::toString():
Ramsey\Uuid\Uuid::serialize()

Ramsey\Uuid\Uuid::jsonSerialize()

But of course you can cast the whole object to string, like @iainn mentioned before.


text:
Q: Performance improvements in lists and sublists iteration I have a method which receives an object as parameter that contains a list (firstList) and sublist (secondList) of elements, in which I need to add a new element to the firstList with the resulting value of the subtraction of another two elements contained in the secondList that may be identified by one Enum property value that they have.
Here's an example of the code I have right now:
private void calculateAndAddResultingObject(final MainObject mainObject) {
    List<AnObject> firstList = mainObject.getList();

    for (AnObject anObject : firstList) {

        List<AnotherObject> secondList = anObject.getSublist();

        BigDecimal firstOperand = secondList.stream()
                .filter(anotherObject -> Enum.VALUE1.equals(anotherObject.getCode())).findAny()
                .orElse(new AnotherObject(Enum.VALUE1, BigDecimal.ZERO, mainObject.getProperty()))
                .getValue();

        BigDecimal secondOperand = secondList.stream()
                .filter(anotherObject -> Enum.VALUE2.equals(anotherObject.getCode())).findAny()
                .orElse(new AnotherObject(Enum.VALUE2, BigDecimal.ZERO,
                        mainObject.getProperty())).getValue();

        BigDecimal resultingValue = BigDecimal.ZERO;

        if (firstOperand.compareTo(secondOperand) > 0) {
            resultingValue = firstOperand.subtract(secondOperand);
        }

        secondList
                .add(new AnotherObject(Enum.VALUE2, resultingValue, mainObject.getProperty()));
    }
}

How may I reduce the number of iterations to improve performance? Is it possible to do this in a single operation?
Thanks!

A: Assuming that an object in the sublist can equal either Enum.VALUE1 or Enum.VALUE2 (not both for the same AnotherObject) and that the BigDecimal that is given to an AnotherObjet's constructor is equal with AnotherObject.getValue(), you can reduce the Objects being created and remove one stream:
void calculateAndAddResultingObject(final MainObject mainObject) {
    List<AnObject> firstList = mainObject.getList();

    for (AnObject anObject : firstList) {
        List<AnotherObject> secondList = anObject.getSublist();
        final BigDecimal value = calculateSublist(secondList);
        secondList.add(new AnotherObject(Enum.VALUE2, value, mainObject.getProperty()));
    }
}

private BigDecimal calculateSublist(final List<AnotherObject> list) {
    BigDecimal firstOperand = null, secondOperand = null;

    for (AnotherObject object : list) {
        if (firstOperand == null && Enum.VALUE1.equals(object.getCode())) {
            firstOperand = object.getValue();
        } else if (secondOperand == null && Enum.VALUE2.equals(object.getCode())) {
            secondOperand = object.getValue();
        } else if (firstOperand != null && secondOperand != null) { // If firstOperand and secondOperand found, break the loop
            break;
        }

    }
    if (firstOperand == null) firstOperand = BigDecimal.ZERO;
    if (secondOperand == null) secondOperand = BigDecimal.ZERO;

    if (firstOperand.compareTo(secondOperand) > 0) {
        return firstOperand.subtract(secondOperand);
    }
    return BigDecimal.ZERO;
}

Now you have one less stream that is being created. Nevertheless, you have to create a microbenchmark to test weather this change really improved the performance in your case. It depends on the size and the quantity of your objects.


text:
Q: Why when I compare the int values of an RDDpipeline i get both int and none values? I have a csv file that contains fields with the values 1 and 0. Using pyspark I want to capture only those values with 1 in a specific field. When I convert the fields I transform them to int. When I use an if statement to check if the value is 1, it returns me a lot of None and some 1. Why do I have this problem? I am 100% sure that my csv file contains only the values 1 and 0?
def vehA(line):
  fields = line.split(",")
  ddsA = int(fields[28])
  ddsB = int(fields[52])

  if ddsA == 1:
     return ddsA

rdd = lines.map(vehA)
rdd.collect()

Output:
1
1
1
1
1
1
1
None
None
None
None
1
1
1
1
1
1
None
None
...

I even tried this and I still get the same output:
    if ddsA is not None:
        if ddsA == 1 and ddsA is not None:
          return ddsA

A: Your method vehA returns None when ddsA is not equal to 1 as you are not returning anything in case of else python implicitly returns None.
In order to capture only ddsA with one you could use filter instead of map.


text:
Q: enumerate-graphic-types is empty, unable to use graphics [MIT/GNU Scheme] I am using Ubuntu 20.04 and MIT-Scheme's procedure (enumerate-graphic-types) returns nothing. Even compiling the software from source with the flags --include-x11 and --with-x simply tells me that lib/*.com does not exist in my /usr/bin/install directory.
I am not sure how to compile/run scheme so I can use its graphical procedures.

A: (enumerate-graphics-types) ; void
(load-option 'x11)
(enumerate-graphics-types) ; non-void
(define dev (make-graphics-device 'x))

This should work, supposing you compiled with the appropriate autotools flags.
1 ]=>  (enumerate-graphics-types)

;Value: ()

1 ]=> (load-option 'x11)

;Loading "make.scm"...
;  Loading "x11-unx.pkd"... done
;  Loading "x11-base.com"... done
;  Loading "x11-color.com"... done
;  Loading "x11-graphics.com"... done
;  Loading "x11-device.com"... done
;  Loading "x11-terminal.com"... done
;... done
;Value: x11

1 ]=>  (enumerate-graphics-types)

;Value: (x)


text:
Q: Proving Tangency to Circle In $\triangle ABC$, let $E$ be a point on $AC$, $F$ be a point on $AB$, and let $D$ be the intersection of $CF$ and $BD$. We are given that $A,E,D,F$ are concyclic, let this circle be $\Omega$. Let $\omega$ be the circle with diameter $BC$. Also, let $\omega$ and $\Omega$ intersect at $X$ and $Y$. If $M$ is the midpoint of $BC$, prove that $MX$ and $MY$ are tangent to $\Omega$.
I am not sure how to prove this. It may be worth noting that it is easy to see the case where $CF$ and $BE$ are altitudes and $D$ is the orthocenter.
Also, applying Pascal's Theorem on cyclic hexagon $FAEEDF$ implies the intersection of the tangents to $\Omega$ at $E$ and $F$ intersect on $BC$. Not sure if this helps though.

A: I have an algorithmic solution, but it is very far from being elegant (its style is "I have to solve this tough problem of a math competition in a very limited amount of time. Unleash brutality").
Let $\widehat{FCB}=\theta$. Then $\widehat{CFA}=\widehat{B}+\theta$ and since $AFDE$ is cyclic, $\widehat{AEB}=\pi-(\widehat{B}+\theta)$ and $\widehat{CBE}=\pi-(\widehat{B}+\widehat{C}+\theta)=\widehat{A}-\theta$, also because $\widehat{BDC}=\pi-\widehat{A}$.
Now we may use trigonometry to compute the lengths of $AF$ and $AE$ in terms of $a,b,c,\theta$, the cosine theorem to compute the length of $EF$ and $EF=2R_{\Omega}\sin\widehat{A}$ to compute $R_\Omega$.
In a skew reference system with $AE$ and $AF$ being the directions of the axis, we may also easily compute $MO_\Omega$. The orthogonality of $\omega$ and $\Omega$ then follows from checking that:
$$ MO_\Omega^2 = \frac{a^2}{4}+R_{\Omega}^2.$$
Interesting (and probably useful for an elementary solution) facts:

*

*$BY$ and $CX$ meet on $\Omega$;

*$EX$ and $FY$ meet on $BC$;

*by changing $\theta$, $O_\Omega$ travels on a line.


text:
Q: JTabbedPane with banner on the top please help create Layout;
I wont to create tabs(JTabbedPane) and on the top frozen image (like banner).

'''''''''''''''''''''''''''''
          BANNER
  '''''''''''''''''''''''''''''
  Tab1 | Tab2 | Tab3

From first I created
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.CENTER);
tabbedPane.addTab("Tab1", makePanel1());
tabbedPane.addTab("Tab2", makePanel1());
tabbedPane.addTab("Tab3", makePanel1());

now add tabbedPane  to frame.
but tabs show in frame and I didn't have any place for my banner (image file).

A: Create a JPanel with BorderLayout. Place the banner to SOUTH and the tabbedPane in the CENTER. Then add the panel to your frame rather than adding the tabbedPane directly.

A: You can do a grid layout with one column.
Add your banner first and then the Tab panel.
Add your grid layout to the frame.
But you'll have the same height for banner et tabs. Better go with StanislavL answer (Place the banner to NORTH since you want it on top).
In BorderLayout, the CENTER will take as most place as it can filling the space under your banner.


text:
Q: IBM Worklight 6.0 - Native Android app unable to connect when using HTTPS I have a simple Android Hybrid and Native Application developed using Worklight 6.0. Over http both the apps work fine with connecting to the server and invoking a procedure. But as soon as I move to https, hybrid app works fine, but I can see that the native connect request itself is not received at the server end.
Do I need to enable anything else to get https working on the android native app?

A: To use HTTPS, you need to configure your SSL certificate on your WAS server. The SSL certificate should not be self-signed, but signed by a trust CA like VeriSign.
To configure SSL certificate on WebSphere application server, here's the doc for you.


text:
Q: error while creating apache beam dataflow job and inserting into bigquery I am reading the list of jobs from the google API "ml.googleapis.com" and then creating a topic using pub/sub. And when I trying to read the message from the topic and write into bigquery table I am getting an error "No fields named field.638".
I am converting the output from "ml.googleapis.com" into a pandas dataframe and then convert it to a dict and then write into bigquery table. This might be the problem. Any help here is really appreciated. Please find the python code below I used to test. Thanks.
from google.cloud import bigquery

# you use one auth
client = Clients.get_client(ClientType.AUTO_ML_API, name='abc')
client1 = Clients.get_client(ClientType.BIGQUERY, name='abc')

from datetime import datetime
for  Index,row in df1.iterrows():
    jobs = execute_command(client.projects().jobs(), 'list', parent='projects/'+row['project'],fetch_field ='jobs',filter=f"createTime.seconds>={filterseconds}")
    df = pd.DataFrame(jobs, columns = ['jobId', 'trainingInput', 'createTime', 'startTime', 'endTime', 'state', 'trainingOutput', 'etag', 'labels', 'errorMessage'])
    df = df.astype('str')
    if len(df) > 0:
            project = row['project']
            df['project'] = project
            df1 = df.to_dict()
            err1 = client1.insert_rows_json(table,[df1])
            print(err1)

json is
original_json =
{  "jobId": "clid_167_training_demo_train_2022_03_23_14_43_39",  "trainingInput": "{\u0027scaleTier\u0027: \u0027CUSTOM\u0027, \u0027masterType\u0027: \u0027n1-standard-8\u0027, \u0027packageUris\u0027: [\u0027gs://xyz/clid_167_training_demo_train_2022_03_23_14_43_39/bc2cff80468ca3acf9d94c67292594ae25204bd436833f8a0cac76f6202c30e9/vie-model-training-pipeline-0.1.1.tar.gz\u0027], \u0027pythonModule\u0027: \u0027vie_model_training_pipeline.main\u0027, \u0027region\u0027: \u0027us-central1\u0027, \u0027runtimeVersion\u0027: \u00272.5\u0027, \u0027pythonVersion\u0027: \u00273.7\u0027, \u0027masterConfig\u0027: {\u0027acceleratorConfig\u0027: {\u0027count\u0027: \u00271\u0027, \u0027type\u0027: \u0027N_P100\u0027}}}",  "createTime": "2022-03-23T14:43:41Z",  "startTime": "2022-03-23T14:47:58Z",  "endTime": "2022-03-23T14:53:00Z",  "state": "FAILED",  "trainingOutput": "{\u0027consumedMLUnits\u0027: 0.63}",  "etag": "/f6SGm5N6a8\u003d",  "labels": "nan",  "errorMessage": "The replica master 0 exited with a non-zero status of 1. \nTraceback (most recent call last):\n  [...]\n  File \"/opt/conda/lib/python3.7/runpy.py\", line 85, in _run_code\n    exec(code, run_globals)\n  File \"/root/.local/lib/python3.7/site-packages/vie_model_training_pipeline/main.py\", line 115, in \u003cmodule\u003e\n    main()\n  File \"/root/.local/lib/python3.7/site-packages/vie_model_training_pipeline/main.py\", line 96, in main\n    log_dir\u003dModelSettings.log_dir,\n  File \"/root/.local/lib/python3.7/site-packages/vie_model_training_pipeline/train.py\", line 44, in train\n    callbacks\u003d[reduce_lr, modelcheck, tensorboard, csv_logger, early_stopping],\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py\", line 1183, in fit\n    tmp_logs \u003d self.train_function(iterator)\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py\", line 889, in __call__\n    result \u003d self._call(*args, **kwds)\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py\", line 950, in _call\n    return self._stateless_fn(*args, **kwds)\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py\", line 3024, in __call__\n    filtered_flat_args, captured_inputs\u003dgraph_function.captured_inputs)  # pylint: disable\u003dprotected-access\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py\", line 1961, in _call_flat\n    ctx, args, cancellation_manager\u003dcancellation_manager))\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/function.py\", line 596, in call\n    ctx\u003dctx)\n  File \"/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py\", line 60, in quick_execute\n    inputs, attrs, num_outputs)\ntensorflow.python.framework.errors_impl.InvalidArgumentError:  required broadcastable shapes at loc(unknown)\n\t [[node Equal (defined at root/.local/lib/python3.7/site-packages/vie_model_training_pipeline/train.py:44) ]] [Op:__inference_train_function_16218]\n\nFunction call stack:\ntrain_function\n\n\nTo find out more about why your job exited please check the logs: https://console.cloud.google.com/logs/task_training_demo_train_2022_03_23_14_43_39\u0026advancedFilter\u003dresource.type%3D%22ml_job%22%0Aresource.labels.job_id%3D%22clid_167_training_demo_train_2022_03_23_14_43_39%22",  "project": "xyz"}

Error from the dataflow job is google.api_core.exceptions.BadRequest: 400 POST https://bigquery.googleapis.com/bigquery/v2/projects/project/datasets/junk/tables/tbl/insertAll?prettyPrint=false: Invalid value at 'rows[0].json' . The schema of the table is
schema = [
    bigquery.SchemaField("jobId", "RECORD", mode="NULLABLE",  fields=[
            bigquery.SchemaField("jobId", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("trainingInput", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("scaleTier", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("masterType", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("packageUris", "RECORD", mode="NULLABLE",fields=[
            bigquery.SchemaField("packageUris", "STRING", mode="NULLABLE")]) ,
        bigquery.SchemaField("pythonModule", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("region", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("runtimeVersion", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("pythonVersion", "STRING", mode="NULLABLE"),
        bigquery.SchemaField("masterConfig", "RECORD", mode="NULLABLE", fields=[
                bigquery.SchemaField("acceleratorConfig", "RECORD", mode="NULLABLE", fields=[
                        bigquery.SchemaField("count", "STRING", mode="NULLABLE"),
                        bigquery.SchemaField("type", "STRING", mode="NULLABLE")]),
    ])]),
    bigquery.SchemaField("createTime", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("createTime", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("startTime", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("startTime", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField(
        "endTime",
        "RECORD",
        mode="NULLABLE",
        fields=[
            bigquery.SchemaField("endTime", "STRING", mode="NULLABLE"),
        ],
    ),

    bigquery.SchemaField("state", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("state", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("trainingOutput", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("consumedMLUnits", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("etag", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("etag", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("labels", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("labels", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("errorMessage", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("errorMessage", "STRING", mode="NULLABLE")]),
    bigquery.SchemaField("project", "RECORD", mode="NULLABLE", fields=[
        bigquery.SchemaField("project", "STRING", mode="NULLABLE")]),
]

In the dataflow job I am reading the message(dict) from the topic and writing into bigquery as follows:
PUBSUB_TOPIC_PROJECT = "xyz"
TOPIC = "q6"
SUBSCRIPTION = "k6"

######################
# Configuration
######################

# Dataflow
DATAFLOW_PIPELINE_VAR = {
    "service_account": "svc",
    "job_name": "job10",
    "streaming": True,
}

def parse(msg):
    from datetime import datetime
    import logging

    try:
        logging.info(f'msg is{msg}')
    except ValueError:
        logging.info("Parsed: %s", msg)
    return msg

def MainDataflowJob(p):
    lines = (p | "Read from Pub/Sub topic" >> beam.io.ReadFromPubSub(
        subscription=f"projects/{PUBSUB_TOPIC_PROJECT}/subscriptions/{SUBSCRIPTION}")
             | "Parse from JSON" >> beam.Map(parse)
             | "Write to Bigquery" >> beam.io.WriteToBigQuery(project=TARGET_PROJECT, dataset=TARGET_DATASET,
                                                              table=TARGET_TABLE))


text:
Q: Cubic curve in projective space Is it  true that every cubic curve in $\mathbb{P}^3$, which is not contained in a plane, can be parametrized by polynomials? $\\\\\\\\$

A: See the paper On Varieties of Minimal Degree (A Centennial Account) by Eisenbud–Harris.
The first theorem in that paper says:
Theorem 1: If $X \subset \mathbf P^r$ is a variety of minimal degree, then $X$ is a cone over a smooth such variety. If $X$ is smooth and $\text{codim } X>1$, then $X \subset \mathbf P^r$ is either a rational normal scroll or the Veronese surface $\mathbf P^2 \subset \mathbf P^5$.
Now a cubic curve in $\mathbf P^3$ is of minimal degree. So by Theorem 1, if it's a cone, then it's a union of three lines, which is certainly rational (i.e. parametrised by polynomials); if not, then it is smooth, hence a rational normal curve, which again is what you want.


text:
Q: Django-Tastypie: How Do You Access (Http)request object in the Bundle? I need to access the HttpRequest object in my Resource's dehydrate
method.
In the docs, it shows that bundle.request is a valid attribute (it's
in the resources.html page). When I try to add it to my code, I get an
error claiming that Bundle' object has no attribute 'request'.
What gives?

A: Bundle object has request attribute.
class Bundle(object):
    """
    A small container for instances and converted data for the
    ``dehydrate/hydrate`` cycle.

    Necessary because the ``dehydrate/hydrate`` cycle needs to access data at
    different points.
    """
    def __init__(self, obj=None, data=None, request=None):
        self.obj = obj
        self.data = data or {}
        self.request = request or HttpRequest()

Anyway, you can ovveride the Resource method higher than dehydrate in the call stack.
Could you show the code?

A: I just had the same problem, but found the correct answer over here:
http://groups.google.com/group/django-tastypie/tree/browse_frm/thread/801f44af3f2dbe7b/a36f303380eacf96
it seems django-tasty-pie version 0.9.9 didn't have this attribute but version 0.9.10 does!
so if you use buildout, look in to buildout.cfg
under versions:
search for django-tastypie = 0.9.9
remove this one and see what your install picks or replace it with:
django-tastypie = 0.9.10

I still have this problem, so opened a new link, see:
django-tastypie: Cannot access bundle.request in dehydrate(self,bundle)
in the question above I found out, that using 0.9.10 is not enough, version 1.0.0 beta should do the tric..


text:
Q: Tabcontrol  with scrollable tabitems using silverlight  Hi friends,                                                                                Am newbie for windows Development .i have created Grid With tabcontrol using silvelight OOB(out of browser app) .Able to add tabitem at run time by following code
TabItem tabItem = new TabItem();
tabItem.Header = "tab";
tabControl.Items.Add(tabItem);

While adding more no of tabitems, tabitems are  added to new line automatically ,instead of scroll enable like google chrome browser.Any property is there to add Scroll???
            i have gone through msdn documents but couldn't find anything.Some of the stackoverflow answers say third parties control but am not interested to use those.i want to do my own .Possible give some guidance to get my solution.

A: If you want to have scrollable tabs in stead of having them appear on multiple lines, you will need to either create you own tabcontrol from scratch, or create a tab control style in which you override the control template.
If you are completely new to silverlight (and xaml), this might be too difficult for you to do. I do not believe there is a simple way to do this, as this functionality is just not part of the standard tab control.


text:
Q: Store std::string into int[] for Big Integer in C++ I'm trying to create my own class for BigInteger values. In this class Big Integer consist of unsigned int ints[capacity], and I have following code to convert std::string into BigInteger:
void FromByteString1(const std::string& buf) {
    int mask[] = {0, 8, 16, 24};
    int validMask = 0xff;
    size_t currentMask = 0, currentIndex = 0;
    for (register size_t i = 0; i < buf.size(); ++i) {
        int tmp = (int) buf[i];
        data[currentIndex] |= ((tmp << mask[currentMask]) & (validMask << mask[currentMask]));
        if (++currentMask == 4) {
            currentMask = 0;
            ++currentIndex;
        }
    }
}

I trying to resolve this problem using union { char[4] chars; int value; }, but it gives me nothing.
Here is my output:

Here is full code of test project "Convertor", which is created to resolve this issue:
#include <iostream>
#include <iomanip>
#include <bitset>

#define Write(message) std::cout << message
#define WriteLine(message) std::cout << message << std::endl
#define WriteEndl() std::cout << std::endl

#define WIDTH_STR 9
#define WIDTH_INT 33

void ShowStringChars(const std::string& str) {
    for (size_t i = 0; i < str.length(); ++i)
        Write( std::setw(WIDTH_STR) << str[i] );
    WriteEndl();
}

void ShowStringCodes(const std::string& str) {
    for (size_t i = 0; i < str.length(); ++i)
        Write( std::setw(WIDTH_STR) << (int)str[i] );
    WriteEndl();
}

void ShowStringCodesBin(const std::string& str) {
    for (size_t i = 0; i < str.length(); ++i) {
        std::bitset<8> bites( (int)str[i] );
        Write( std::setw(WIDTH_STR) << bites );
    }
    WriteEndl();
}

void ShowIntValues(int* arr, size_t length) {
    for (size_t i = 0; i < length; ++i)
        Write( std::setw(WIDTH_INT) << arr[i] );
    WriteEndl();
}

void ShowIntValuesBin(int* arr, size_t length) {
    for (size_t i = 0; i < length; ++i) {
        std::bitset<32> bites( arr[i] );
        Write( std::setw(WIDTH_INT) << bites );
    }
    WriteEndl();
}

const int capacity = 256;
int data[capacity];

void Clear() {
    for (size_t i = 0; i < capacity; ++i)
        data[i] = 0;
}

union its {
    char chars[4];
    int value;
} int_to_str;

void FromByteString1(const std::string& buf) {
    int mask[] = {0, 8, 16, 24};
    int validMask = 0xff;
    size_t currentMask = 0, currentIndex = 0;
    for (register size_t i = 0; i < buf.size(); ++i) {
        int tmp = (int) buf[i];
        data[currentIndex] |= ((tmp << mask[currentMask]) & (validMask << mask[currentMask]));
        if (++currentMask == 4) {
            currentMask = 0;
            ++currentIndex;
        }
    }
}

void FromByteString2(const std::string& buf) {
    size_t index = 0;
    for (size_t i = 0; i < buf.size(); i += 4, ++index) {

        int_to_str.chars[0] = buf[i + 0];
        int_to_str.chars[1] = buf[i + 1];
        int_to_str.chars[2] = buf[i + 2];
        int_to_str.chars[3] = buf[i + 3];

        data[index] = int_to_str.value;
    }
}

int main() {

    Clear();

    //std::string value = "this is some string";
    std::string value = "this str";

    ShowStringChars(value);
    ShowStringCodes(value);
    ShowStringCodesBin(value);

    WriteEndl();
    WriteEndl();
    WriteEndl();

    FromByteString1(value);

    ShowIntValues(data, value.length() / 4);
    ShowIntValuesBin(data, value.length() / 4);

    return 0;
}

Did anyone had similar problem? Thanks for any help :)

A: The streaming operator of bitset uses std::bitset::to_string which behaves like this:

The resulting string contains N characters with the first character corresponds to the last (N-1th) bit and the last character corresponding to the first bit.

So, the last (rightmost) character of the output is the least significant (first) bit.
The first byte that you read, you shift the least. Therefore it becomes the least significant byte. Therefore the first byte that you read into the integer will be the right most byte in the output of the bitset.
A solution: Reverse the order in which you read the bytes i.e. interpret the input buffer as little endian, rather than big endian.

Note that since bitset prints highest bit first, you could interpret the output as little endian with individual bytes reversed, or big endian with the entire set reversed. I use reversed here in relation to memory position that grows left to right.
PS. representing a big integer as a null terminated string is not very useful since there is no way to represent numbers that contain bytes with the value zero.


text:
Q: Could not obtain transaction-synchronized Session for current thread; I am trying to do read only call like get call.
public TaskModel intializeTaskById(final long taskId){
...
}

then why does it require transaction?


text:
Q: How do I run PHP in a local browser using Ubuntu I'm getting this error when I attempt to run phpMyAdmin from XAMPP. There was an existing mysql installation on this machine previous to my installation and running of XAMPP. When I start XAMPP both mysql and apache2 start up successfully. I can access the mysql database with a PHP script but not through phpmyadmin.
Error

MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

A: If you want to access mysql as root without a password, in your /xampp/phpMyAdmin/config.inc.php file ensure the following variables are being set:
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;

A: Do you have a password set for the root user? You shouldn't connect via root but check that. I also recall having issue with one of the version of phpmyadmin where I wasn't allowed to log in with the root user.


text:
Q: C++ #include and operator<< overloading error So I 3 classes as follows:
class Weapon {
    char* name;
    Target target;
    int hitStrength;
public:
    Methods...
};

class Player {
    char* name;
    int level;
    int life;
    int strength;
    Weapon weapon;
    int location;
public:
    Methods...
};

class Game {
    int maxPlayers;
    Player** players;
public:
    Methods...
};

I am having trouble with includes.
I have a main.cpp file which has the following includes:
#include "Game.h"
#include <iostream>
using namespace std;

However, when I try to build the program I get the following error:
In file included from C:\Users\Name\CLionProjects\Call Of Matam Duties\Player.h:8:0,
             from C:\Users\Name\CLionProjects\Call Of Matam Duties\Game.h:8,
             from C:\Users\Name\CLionProjects\Call Of Matam Duties\main.cpp:1:
C:\Users\Name\CLionProjects\Call Of Matam Duties\Weapon.h:30:12: error: 'ostream' does not name a type
 friend ostream& operator<< (ostream& os, const Weapon& w);`

To mention:
Player.cpp includes Player.h;
    Weapon.cpp includes Weapon.h;
    Game.cpp includes Game.h;
    Game.h includes Player.h and Weapon.h.
Is it correct?
How can I fix this?
If you need more information, let me know.

A: You should include <iostream> in Weapon.h since that is where it is needed. Each header file should be compilable by itself, it should not depend on being placed after other includes.
There's a good practice to avoid errors like this. You have Player.cpp includes Player.h; Weapon.cpp includes Weapon.h; Game.cpp includes Game.h. That's good, but make sure that the first header file that Player.cpp includes is Player.h and the same with all the other header files. If that change causes any compilation errors then that indicates that your header files are wrong because they can't be compiled independently.
Fix those errors by including the needed header files or adding forward declarations. But be careful you don't end up with a cycle of includes, that's a bad idea and can usually be avoided with forward declarations.

A:
error: 'ostream' does not name a type

We can sort of infer here that the compiler thinks 'ostream' isn't defined. So you need to check that ostream is defined by including the iostream header file in Game.h (because ostream is defined in the iostream header file). If you're using ostream (or istream, cin, cout, etc) in the other header files, make sure that you put #include <iostream> in those files as well.
Also, line 2 (#include <iostream>) in main.cpp shouldn't be required if you have already included iostream in Game.h (correct me if I'm wrong).
Edit:
Since you seemed to be confused about how to trace this error... the compiler error tells you:

C:\Users\Name\CLionProjects\Call Of Matam Duties\Weapon.h:30:12:

This tells you that the error was found inside Weapon.h, line 30, 12 characters offset from the left.

A: In addition to other answers it should be noted that there exists a special header <iosfwd> that can and should be used if only forward declarations from <iostream> are required. Typically, <iosfwd> is included in a header .h file, and <iostream> is included in the implementation .cpp file. More information can be found in this SO post.


text:
Q: Unknown Source when adding a Circle in Google Maps V2 I have a map on which i am adding Markers and circle around it but when i try to add circle it gives a nullpointerEcxeption, I don't know what is causing it. I can add marker's and map is being shown correctly.
      add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (name.getText() == null || radius.getText() == null) {
                    Toast.makeText(getContext(), "Name and Radius Please", Toast.LENGTH_SHORT).show();
                } else {

                    CircleOptions c = new CircleOptions().strokeColor(Color.BLUE).radius(Integer.parseInt(radius.getText().toString()));                                                                               This is the line where it happens
                    **googlemap.addCircle(c);**
                    DataBaseOperations hell = new DataBaseOperations(getContext());
                    SQLiteDatabase db = hell.getWritableDatabase();
                    hell.SaveMarker(name.getText().toString(),c.getRadius(),marker.getId(),latLng,db);
                    item.setVisibility(View.INVISIBLE);
                    hell.close();
                    db.close();

                }
            }
        });

Here is my Stack
   java.lang.NullPointerException
                                                                              at com.google.a.a.ae.a(Unknown Source)
                                                                              at com.google.maps.api.android.lib6.e.eg.<init>(Unknown Source)
                                                                              at com.google.maps.api.android.lib6.e.ev.a(Unknown Source)
                                                                              at com.google.android.gms.maps.internal.j.onTransact(SourceFile:390)
                                                                              at android.os.Binder.transact(Binder.java:387)
                                                                              at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addCircle(Unknown Source)
                                                                              at com.google.android.gms.maps.GoogleMap.addCircle(Unknown Source)
                                                                              at com.example.umerasif.homealarm.Map$3.onClick(Map.java:160)
                                                                              at android.view.View.performClick(View.java:5198)
                                                                              at android.view.View$PerformClick.run(View.java:21147)
                                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                              at android.os.Looper.loop(Looper.java:148)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Here is my googleMap setup.
      @Override
public void onMapReady(GoogleMap googleMap) {
    setmap(googleMap);
}

public void setmap(final GoogleMap map) {
    googlemap = map;
    if(googlemap != null){
    if (sharedPreferences.getBoolean(CustomAlarm.satellite, false)) {
        googlemap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
    } else {
        googlemap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    }
    googlemap.getUiSettings().setScrollGesturesEnabled(true);

    googlemap.setOnMapLongClickListener(this);
    googlemap.setLocationSource(new com.example.umerasif.homealarm.LocationSource(getContext(), googlemap));
    MapStateListener mapStateListener = new MapStateListener(googlemap, app_touchableMapFragment, getActivity(), pager);
    mapStateListener.setStateListener(this);
}}

A: The map is not loaded, did you add this line of code to setup your map?
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager ()
            .findFragmentById (R.id.map);
    mapFragment.getMapAsync (this);
to sync your map. If you don't sync the map, you will have Unknown source issue. Look at this tutorial from tutorial point on how to use google map
http://www.tutorialspoint.com/android/android_google_maps.htm
Hope this help

A: Turns out I was missing center of the circle. Thanks Daniel.


text:
Q: Mysql Session State Error When the IIS application pool resets the worker processes at a specific time, the mysql session state store will crash the w3wp.exe process and the website request will result in a crash error message. This is in version mysql connector 6.7.4.0
System.Security.SecurityException was unhandled
  HResult=-2146233078
  Message=Requested registry access is not allowed.
  Source=mscorlib
  StackTrace:
       at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
       at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
       at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName)
       at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
       at System.Diagnostics.EventLog.WriteEntry(String message)
       at MySql.Web.SessionState.MySqlSessionStateStore.HandleMySqlException(MySqlException e, String action)
       at MySql.Web.SessionState.MySqlSessionStateStore.CleanupOldSessions(Object o)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.TimerQueueTimer.CallCallback()
       at System.Threading.TimerQueueTimer.Fire()
       at System.Threading.TimerQueue.FireNextTimers()
  InnerException:

Any ideas?
I also added a Read permission to network service and AppPoolIdentity


text:
Q: VBA Transferring array to a sheet I'm getting a
Run-time error '1004': Application-defined or object-defined error
Here are the relevant lines of code:
ReDim checkedArr(1 To nKeeps, 1 To nCols) As Variant
' A couple loops between here
Worksheets(sheet + "_tmp").Range("A1").Resize(UBound(checkedArr, 1), UBound(checkedArr, 2)).value = checkedArr

I think I'm doing something subtly incorrect but I can't figure out exactly what the issue might be. VB keeps automatically changing my ".Value" to ".value" in the above code snippet and I'm not sure why but it appears that maybe it's not recognizing it as a proper Range object.
I've tried explicitly declaring a range:
Dim dest As Range
Set dest = Worksheets(sheet + "_tmp").Range("A1").Resize(UBound(checkedArr, 1), UBound(checkedArr, 2))
dest.value = checkedArr

but this returns the same issue.
In the Watch, checkedArr is Type Variant/Variant(1 to 17, 1 to 41) and dest is of type Range/Range. When I expand dest (clicking the + in the watch), it doesn't even have a .Value property! There's a Value2 property that is of type Variant/Variant(1 to 17, 1 to 41), but trying to use that doesn't work either (gives the same error).
Can someone help me understand my flaw?
EDIT:
Here's the entire sub if anyone thinks the issue could be in the rest of the body.
Sub findMatches(sheet As String)

Worksheets(sheet).Activate
Dim dataArr() As Variant
dataArr = Worksheets(sheet).Range("A1").CurrentRegion.value

Dim nRows As Long, nCols As Long, nKeeps As Long, mcvCol As Long
Dim row As Integer, col As Integer, eqCrit As Boolean
nRows = UBound(dataArr, 1)
nCols = UBound(dataArr, 2)
mcvCol = getColNum("MC Value", sheet)

' matchStatus(i) will be:
' -2 for matched rules
' -1 for the header
' 1 for an orphan
' 2 for an MC Value mismatch
ReDim matchStatus(1 To nRows) As Integer
matchStatus(1) = -1
nKeeps = 1
matchStatus(nRows) = 1

For row = 2 To nRows - 1
    If matchStatus(row) = 0 Then
        eqCrit = True
        For col = 9 To nCols
            eqCrit = eqCrit And (dataArr(row, col) = dataArr(row + 1, col))
        Next col
        If eqCrit Then
            If dataArr(row, mcvCol) = dataArr(row + 1, mcvCol) Then
                matchStatus(row) = -2
                matchStatus(row + 1) = -2
            Else
                matchStatus(row) = 2
                matchStatus(row + 1) = 2
                nKeeps = nKeeps + 2
            End If
        Else
            matchStatus(row) = 1
            nKeeps = nKeeps + 1
        End If
    End If
Next row
If matchStatus(nRows) = 1 Then
    nKeeps = nKeeps + 1
End If

ReDim checkedArr(1 To nKeeps, 1 To nCols) As Variant
Dim keepIdx As Long
keepIdx = 1
For row = 1 To nRows
    If matchStatus(row) > -2 Then
        checkedArr(keepIdx, 1) = matchStatus(row)
        For col = 2 To nCols
            checkedArr(keepIdx, col) = dataArr(row, col)
        Next col
        keepIdx = keepIdx + 1
    End If
Next row

Application.DisplayAlerts = False
Worksheets(sheet).Delete
Application.DisplayAlerts = True

Sheets.Add.Name = sheet + "_tmp"
Dim dest As Range
'Set dest = Worksheets(sheet + "_tmp").Range("A1:" + Split(Cells(, nCols).Address, "$")(1) + CStr(nKeeps))

Set dest = Worksheets(sheet + "_tmp").Range("A1").Resize(UBound(checkedArr, 1), UBound(checkedArr, 2))
dest.value = checkedArr

'Set dest = Worksheets(sheet + "_tmp").Range("A1")
'dest.Resize(UBound(checkedArr, 1), UBound(checkedArr, 2)) = checkedArr
'Worksheets(sheet + "_tmp").Range("A1:" + Split(Cells(, nCols).Address, "$")(1) + CStr(nKeeps)) = checkedArr

End Sub

A: I "rephrased" your code to a 'test' sub. Have a look. Hope it helps.
    Sub test()

        Dim nKeeps As Integer, nCols As Integer

        nKeeps = 3
        nCols = 4

        ReDim ar(1 To nKeeps, 1 To nCols) As Variant

        For nKeeps = 1 To 3
            For nCols = 1 To 4
                ar(nKeeps, nCols) = nKeeps * nCols
            Next nCols
        Next nKeeps

        Dim ws As Worksheet
        Dim rng As Range

        Set ws = Worksheets("Sheet1")
        Set rng = ws.Range("A1")
        rng.Resize(nKeeps - 1, nCols - 1) = ar

    End Sub


text:
Q: Press "onclick" js in http request <img id="img_verify" src="" height="36" width="140" onclick="testing(this);">

Is there a way to press this button in go with a http request?
Edit:
After the button is pressed there's a 10 digit number generated with Math.Random and put in the html, I want to get the number

A: In general, no. Clicking that button runs some Javascript inside the web browser; there's no HTTP request anywhere for you to make. It's possible that the testing() function ultimately winds up making some request that you could also make from Go, but that's very situational; there's certainly nothing that will do the translation for you.


text:
Q: JavaScript function I am not able to move on to the next section since i could not understand how this works. For reference I will post the link.
  http://eloquentjavascript.net/1st_edition/chapter7.html
var roads = {};

function makeRoad(from, to, length) {
  function addRoad(from, to) {
    if (!(from in roads))
      roads[from] = [];
    roads[from].push({to: to, distance: length});
  }

  addRoad(from, to);
  addRoad(to, from);
}

I am totally lost to get the basic idea of this function. Anyone who is generous to help. Thank you in advance. you are always help me to unlock many concepts.

A: It works by defining a function inline (addRoad) and then calling it to add a road in each direction (from to to and then to to from).
addRoad maintains a data structure of roads:
"roads": [
    "fromLocation" : [ "destination1", "destination2" ],
    "fromLocation2" : [ "destination3" ]
]

addRoad first checks to see if the from location exists in the array of roads (that's the if (!(from in roads)) clause. If it doesn't exist then it creates an empty array to store future destinations. It can then add the destination to that array.
To create my example data structure above I could call addRoad as follows:
addRoad('fromLocation', 'destination1');
addRoad('fromLocation', 'destination2');
addRoad('fromLocation2', 'destination3');


text:
Q: Background process/task in genexus? We're using Genexus EV3 to develop a project and we noticed that we can use it to easily alert users through SMS or emails about relevant information.
I'd like to know if it's possible to create some sort of background process in genexus that checks a database and so that we can send emails based on the information present in the database.
Thanks.

A: You can make a asynchronous call to a procedure object using the submit method, like:
// Some code...
prAnyProcedure.submit(&parm1, &parm2)
// Some code...
// Some code...

In this case, the main program flow will continue processing immediately.
But if you need to call a procedure from time to time without any user intervention, you should use a server-side tool like ant or the cron/crontab linux utility.
http://ant.apache.org/faq.html#what-is-ant
http://linux.die.net/man/8/cron

A: I made some like you need.
I made a procedure, make it MAIN and are launched with de squeduler task (it run every day at 9am). In a table I have the reminder and the mail addresses, the massage to sent etc. This is the main procedure
for each empresa
    where EmpresaEstado=1
    &Empresanombre=EmpresaNombre
    &EmpresaEmail=EmpresaEmail
    &EmpresaServidorSalida=EmpresaServidorSalida
    &EmpresaServidorPassword=EmpresaServidorPassword
endfor

for each recordatorios

    where RecordatoriosEstado=1
    where RecordatoriosDiaEnvio=day(today())
        &smtp.Host = 'smtp.gmail.com'
        &smtp.Port = 25
        &smtp.Sender.Address = TRIM(&EmpresaEmail)
        &smtp.Sender.Name = TRIM(&empresanombre)
        &smtp.Authentication = 1
        &smtp.Secure=1
        &smtp.UserName = TRIM(&empresaEmail)
        &smtp.Password = trim(&EmpresaServidorPassword)
        &recordatoriosasunto=RecordatoriosAsunto
        &recordatoriostexto=RecordatoriosTexto

        &mail.To.New('Mauricio','mlopez.informatica@gmail.com')
        &smtp.ErrDisplay = 0
        &smtp.Login()
        for each
            where RecordatoriosClienteEstado=1
            &mail.BCC.new(RecordatoriosClienteMail1,trim(RecordatoriosClienteMail1))
            if RecordatoriosClienteMail2<>''
                &mail.BCC.new(RecordatoriosClienteMail2,trim(RecordatoriosClienteMail2))
            endif
        endfor
        &mail.Subject = &recordatoriosasunto
        &mail.Text = &recordatoriostexto
        &smtp.Send(&mail)
        &mail.Clear()
        &smtp.Logout()
endfor


text:
Q: Framework build failed with cocoapod pod lib lint with xcode 12.0 I try to update a existing pod, but when I did pod trunk push NAME.podspec, I got this error :

I try several solution from this post Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64_ but none worked(excluded architecture, only active arch).
There is no problem when I run the compilatiton on Xcode, my framework is well generated. The only problem is when I try to pod trunk, or pod lib lint
In my xcode project, In build phase, I run that script :
xcodebuild -target "${TARGET_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 -arch i386 ONLY_ACTIVE_ARCH=NO EXCLUDED_ARCHS="arm64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

If I put ONLY_ACTIVE_ARCH=TRUE, the error message is a bit different :


text:
Q: Making a directory in QFileSystemModel using mkdir() I have made a simple program that show directory listing in QTreeView using QFileSystemModel.
With a QPushButton the program is calling a slot that is making a new directory, but it never makes a new directory.
This is the slot that makes a new directory:
QModelIndex index=viewTreeForModel->currentIndex();

if (!index.isValid()) return;

QString filename=QInputDialog::getText(this, "Enter Name Dialog", "Enter name");

modelFile->mkdir(viewTreeForModel->currentIndex(), filename);

I dont get a error messages from the program when it runs.

A: Check the QModelIndex returned by mkdir is valid.
You could also try
const bool success = QDir(modelFile->filePath(index)).mkdir(string);

Then check the value of success.
As an aside, I would recommend renaming the variable string to something like newfilename, it would make the code more readable.


text:
Q: get coordinates of animated UIImageview I am animating an UIImageview in horizontal position for this purpose i have used the below code i have used the NSTimer
timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];

-(void)onTimer
{
    [UIView animateWithDuration:10.0f animations:^{
          //Moving_Cloud is an image view
            Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height);
           }];

}

now the problem i am facing is i need to get the coordinates of the "Moving_Cloud" after the animate duration
please help me
Thanks in advance.

A: [UIView animateWithDuration:10.0f animations:^{
    Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height);
} completion:^(BOOL finished){
    CGPoint newPost = Moving_Cloud.frame.origin;
    CGFloat xPos = newPost.x;
    CGFloat yPos = newPost.y;
    // do stuff ?
}];

At the end of your animation the block "completion:" will be trigger.
Normally your image should be in x = 200, y = 150.
Be aware that those coordinates are relative to it superview (the view wrapping Moving_Cloud view).
Note:
By convention I recommend changing "Moving_Cloud" to "movingCloud".
Instance class start in lower cap in objective-C.
Also don't use _ but a capital letter instead.

A: Abhijit Chaudhari from the comment in my previous post I understand that what you want is not the position "after the animate duration" but instead the position during the animation.
If I still didn't get it right please clarify your question. (Or buy me an new brain)
-(void) animateMe(){
    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES];
    [UIView animateWithDuration:10.0f animations:^{
         //Moving_Cloud is an image view
         Moving_Cloud.frame = CGRectMake(200.0f, 150.0f, Moving_Cloud.frame.size.width, Moving_Cloud.frame.size.height);
    }];
}

-(void)onTimer:(id)sender{
    NSLog(@"Currently in x=%f", [[ddddd.layer presentationLayer] frame].origin.x);
    NSLog(@"Currently in y=%f", [[ddddd.layer presentationLayer] frame].origin.y);
}


text:
Q: How to Get Shortest/Longest Posting Lists I've written a Class InvertedIndexTable {  } here:
public interface IInvertedIndex
{
    int IndexSize(string path);
    void Load(string path);
}
class InvertedIndexTable : IInvertedIndex
{
     Dictionary<string, List<string>> index = new Dictionary<string, List<string>>();
     CreateMatrix r = new CreateMatrix(); // an object of another class contains stopwords{A,AN,...}
                                          // and also contains RemoveStopword() method
     public HashSet<string> DistincTerms = new HashSet<string>();
     public List<string> filesCollection = new List<string>();
     public int IndexSize(string pa)
     {
         Load(pa);
         return index.Count;
     }
     public void Load(string path)
      {
          string[] filePaths = Directory.GetFiles(Path.GetFullPath(path));
          foreach (string file in filePaths)
          {
              string contents = File.ReadAllText(file);
              contents = RemoveNonAlphaChars(contents);
              String[] tokensCollection = r.RemoveStopsWords(contents.ToUpper().Split(' '));
              foreach (string token in tokensCollection)
              {
                  if (!r.booleanOperator.Contains(token) && !DistincTerms.Contains(token))
                  {
                      DistincTerms.Add(token);
                  }
              }
          }
          Frequenty(filePaths);
      }
     public void Frequenty(string[] path1)
      {
        foreach (string d in DistincTerms)
        {
            foreach (string f in path1)
            {
                if (File.ReadAllText(f).Contains(d))
                {
                    filesCollection.Add(f);
                }

            }
            index.Add(d, filesCollection);
          }
      }
     private string RemoveNonAlphaChars(string content)
      {
          StringBuilder sb = new StringBuilder();

          foreach (char c in content.ToCharArray())
          {
              if (char.IsLetter(c) || char.IsSeparator(c))
              {
                  sb.Append(c);
              }
          }
          return sb.ToString();
      }
     public  string GetSmallestPosting(string p)
      {
          List<int> numbers = new List<int>();
          if (index != null)
          {
              foreach( KeyValuePair<string,List<string>> i in index)
              {
                  string content= i.Value.ToString();
                  String[] itemsList = content.ToUpper().Split(' ');
                  numbers.Add(itemsList.Length);
              }

              return numbers.Min().ToString();
          }
          return null;
      }
     public string GetLongestPosting(string p)
      {
          List<int> numbers = new List<int>();
          if (index != null)
          {
              foreach (KeyValuePair<string, List<string>> i in index)
              {

                  string content = i.Value.ToString();
                  String[] itemsList = content.ToUpper().Split(' ');
                  numbers.Add(itemsList.Count());
              }
              return numbers.Max().ToString();
          }
          return null;
      }
}

I'm going to prepare button6 to show me Smallest and Longest posting lists of Class InvertedIndexTable { } also number of KeyValuePair of Dictionary<string,List<string>> index.
it works without any errors and exception,but the problem is : return value for DictionaryPairsNumbers is correct, but return values for MinSizePosting and MaxSizePosting are wrong, code always returns value "1" for both of them. why? what's the matter?
Code I wrote for button6 is right here :
    `  InvertedIndexTable i = new InvertedIndexTabe();
    private void button5_Click(object sender, EventArgs e)
    {
     MessageBox.Show("DictionaryPairsNumbers: " + i.IndexSize(textBox1.Text)+"\n\rMaxSizePosting: " + i.GetLongestPosting(textBox1.Text)+"\n\rMinSizePosting: "+ i.GetSmallestPosting(textBox1.Text));
    }
    `

please, let me know if there is any way that I achieve my expected result.
the result I need, is size of Shortest and longest List<string> in Dictionary index I thought I wrote right code for GetSmallestPosting() and GetLongestPosting() methods but it seems I was wrong, please tell me what's wrong with these two methods? why they return same values,always??? and why this value is "1",always???
by the way, GetSmallestPosting() finds shortestList<string>of Dictionary<string,List<string>> index and GetLongestPosting() finds the longest one.
thanks for your time.

A: You can use Linq to do this.
Add two new methods to your InvertedIndex class.
Min goes through all key (X) value (List) pairs in your dictionary and returns the list with the smallest Count of items. Max does the exact opposite.
public List<T> GetSmallestPosting()
{
    if(_Index!=null)
       return  _Index.Values.First(v => v.Count == _Index.Min(kv => kv.Value.Count)).ToList();

    return null;
}

public List<T> GetLongestPosting()
{
    if(_Index!=null)
      return   _Index.Values.First(v => v.Count == _Index.Max(kv => kv.Value.Count)).ToList();

    return null;
}

A: for first I've changed Frequenty() { } method , it must be like this
public void Frequenty(string[] path1)
      {
         List<string> filesCollection = new List<string>();
         for (int i = 0; i < DistincTerms.Count(); i++ )
         {
             string d = DistincTerms.ElementAt(i);
             foreach (string f in path1)
             {
                 string c = File.ReadAllText(f);
                 c = r.RemoveNonAlphaChars(c);
                 String[] T = r.RemoveStopsWords(c.ToUpper().Split(' '));
                 foreach (string term in T)
                 {
                     if (term.Equals(d) && !filesCollection.Contains(f))
                     {
                         filesCollection.Add(f);
                     }
                 }

             }
             countor.Add(filesCollection.Count);
             index.Add(d, countor);
             filesCollection.Clear();
         }

now, I've turn both methods  GetSmallest/LongestPostingList :
 public string GetSmallestPosting(string p)
      {
          if (index != null)
          {
            return countor.Min().ToString();
          }
          return null;
      }
     public string GetLongestPosting(string p)
      {
          if (index != null)
          {
              return countor.Max().ToString();
          }
          return null;
      }

it works. I've tested it.


text:
Q: Owl Carousel No Fixed Width so I'm trying to use Owl Carousel without a fixed width because I need a responsive Wordpress site with no fixed images or widths, otherwise it breaks my mobile views.
I tried uncommenting the lines in owlcarousel.js where _width and _widths are set, and that sort of worked, except the items were then not centered within the .owl-stage. When I tried to alter the dimensions of the .owl-stage the entire thing broke.
Can anyone give advice on how to do this? I just want a responsive deployment of Owl Carousel where the widths etc are relative, rather than fixed.

A: Fiddle
Set items to 1
To make the Owl Carousel 2 show a single responsive slide you need to set the number of items to 1 instead of the default 3 and there is no need to use the responsive options offered in the docs because you always want to show a single slide.
JavaScript
$('.owl-carousel').owlCarousel({
    loop:true,
    margin:10,
    nav:true,
    items: 1
})

Full Code

$('.owl-carousel').owlCarousel({
    loop:true,
    margin:10,
    nav:true,
    items: 1
})
.item {
  background-color: #4DC7A0;
  color: white;
  font-size: 30px;
  height: 150px;
  padding: 10px;
}
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.theme.default.min.css" rel="stylesheet"/>
<link href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet"/>

1

2

3

4

5

6

7

8

9

10

11

12

A: I think you can you use attribute width with unit %
$('.owl-carousel').attr("width", "100%")

With unit % width of carousel will responsive follow width of screen device.
Other, you can use css3 to responsive.Corresponding with width of screen device you set width different.
That all i know. if you want :

*

*Always show 1 element : you should set width of  owl-item is 100% and width of owl-carousel is : 100% .Or always show 2,3,4,5,.... you should set width of owl-item is (100/2) %, (100/3)%, (100/4)%, ...

*Corresponding with screen will show 4 for desktop, 1 for mobile :you show use breakpoint to set width. In other, you can try attribute min-width or max-width for owl-item to make it


text:
Q: Not able to add Omnigroup framework for rtf editor in a my iPad application I have been trying to add omnigroup framework for editing rtf files into my local iPad application. But always I am getting the errors like OmniBase/OmniBase.h, OmniFoundation/OmniFoundation.h files are not found.
I tried with different combinations of settings in the build settings of project target. But  did not work. I am using Xcode version 4.2.1,
Mac OS X : 10.7 and IOS 5 Lion OS.

A: There's actually a lot of Xcode configuration involved in using the Omni frameworks. I recently went through the learning process myself and wrote a lengthy tutorial. My tutorial is centered around using OUIEditableFrame but it should be a good starting point for whatever part of the framework you're looking to use.
In a nutshell:

*

*Make sure you're including Omni's Configuration directory in your project.

*Add the required frameworks by adding the appropriate .xcodeproj files from Omni to your project. Many frameworks are dependent on other so all dependencies will need to be added.

*Add required libraries to the Link Binary with Libraries section of the Build Phases tab.

*Add required libraries to the Target Dependencies section of the Build Phases tab.

*Edit your Schema. Select Build and add the required libraries.


text:
Q: How do I pass a method as a parameter in Java 8? I don't understand how to use lambdas to pass a method as a parameter.
Considering the following (not compiling) code, how can I complete it to get it work ?
public class DumbTest {
    public class Stuff {
        public String getA() {
            return "a";
        }
        public String getB() {
            return "b";
        }
    }

    public String methodToPassA(Stuff stuff) {
        return stuff.getA();
    }

    public String methodToPassB(Stuff stuff) {
        return stuff.getB();
    }

    //MethodParameter is purely used to be comprehensive, nothing else...
    public void operateListWith(List<Stuff> listStuff, MethodParameter method) {
        for (Stuff stuff : listStuff) {
            System.out.println(method(stuff));
        }
    }

    public DumbTest() {
        List<Stuff> listStuff = new ArrayList<>();
        listStuff.add(new Stuff());
        listStuff.add(new Stuff());

        operateListWith(listStuff, methodToPassA);
        operateListWith(listStuff, methodToPassB);
    }

    public static void main(String[] args) {
        DumbTest l = new DumbTest();

    }
}

A: Declare your method to accept a parameter of an existing functional interface type which matches your method signature:
public void operateListWith(List<Stuff> listStuff, Function<Stuff, String> method) {
    for (Stuff stuff : listStuff) {
        System.out.println(method.apply(stuff));
    }
}

and call it as such:
operateListWith(listStuff, this::methodToPassA);

As a further insight, you don't need the indirection of methodToPassA:
operateListWith(listStuff, Stuff::getA);

A: Your MethodParameter should be some interface you define with a single method.  This is referred to as a functional interface.  You can then pass your methods in.  A quick demonstration:
public interface Test{
    void methodToPass(string stuff);
}

[...]

public class DumbTest{
     //MethodParameter is purely used to be comprehensive, nothing else...
    public void operateListWith(List<Stuff> listStuff, Test method) {
        for (Stuff stuff : listStuff) {
            System.out.println(method(stuff));
        }
    }
    public DumbTest() {
        List<Stuff> listStuff = new ArrayList<>();
        //fill list
        operateListWith(listStuff, methodToPassA);
        operateListWith(listStuff, methodToPassB);
    }
}

A: The definition of MethodParameter is missing from your source code. To be used with lambda expressions, it must be a functional interface, for example:
@FunctionalInterface
interface MethodParameter {
    String apply(Stuff input);
}

(The @FunctionalInterface annotation is optional.)
To use the method, you have call the method from the interface:
System.out.println(method.apply(stuff));

And thirdly, a method reference always needs a context. In your case you have to do:
operateListWith(listStuff, this::methodToPassA);
operateListWith(listStuff, this::methodToPassB);

A: You need to use method references.
You don't need to create a method like operateListWith, that's sort of the whole idea. Instead, you can operate on each value using forEach by doing  something like this:
listStuff.stream.forEach(object::methodToPassA);

For example:
public class StreamExample {
  public static void main(String[] args) {
    List<String> list = Arrays.asList("Hello", "What's Up?", "GoodBye");
    list.stream().forEach(System.out::println);
  }
}

Output:
Hello
What's Up?
GoodBye

In your case, you can get the value inside Stuff using .map, and then operate on it using forEach, like this:
public class DumbTest {
  public class Stuff {
    public String getA() {
      return "a";
    }

    public String getB() {
      return "b";
    }
  }

  public String methodToPassA(Stuff stuff) {
    return stuff.getA();
  }

  public String methodToPassB(Stuff stuff) {
    return stuff.getA();
  }

  public DumbTest() {
    List<Stuff> listStuff = Arrays.asList(new Stuff(), new Stuff());

    listStuff.stream()
        .map(this::methodToPassA)
        .forEach(System.out::println);
  }

  public static void main(String[] args) {
    DumbTest l = new DumbTest();
  }
}


text:
Q: Incorrect number of answers shown on Notification inbox I'm new to this site, so please pardon if anything wrong in my question.
I'm an regular user of StackOverflow. I yesterday posted a question in StackOverflow.
For which I got 5 answers. But when I got the 5th answer the notification window showed that I got 10 answer for that question.

I checked that again, I got only 5 answers. Also I looked for the deleted answers, but there is no deleted answer till now.
Then why the notification inbox shows like this ? Is this a bug ?
I checked similar question on meta for different sites(sites like mobile version site, Gardening site etc.). But no-one have answers.

*

*Mobile Site

*Gardening Site


text:
Q: CKEditor showing HTML tags in ASP.MVC with decode Everything works perfectly with create/edit pages, where CKEditor encodes input and server side returns decoded for CKEditor to display.
All that goes out of the window when validation error occurs making page reload after it hit the server.
Even though I am decoding on return to the view, CKEditor won't properly render html tags.
If I do Html.Raw for the same field, I can see its showing html properly, so its no the issue with decoding. For the life of me I can't figure out why this case is any different from editing ( loading existing html into CKEditor from dB) which works perfectly. But on page reload it all goes out of whack.
Things I've tried, decoding, encoding, neither. Adding delay to CKEditor initialization.
Server side return code.
if (!ModelState.IsValid)
        {
            q..Text = System.Net.WebUtility.HtmlDecode(q.Text);
            return View(q);
        }

View

        @Html.LabelFor(model => model.Text, htmlAttributes: new { @class = "control-label col-md-2" })

            @Html.TextAreaFor(model => model.Text, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Question.Text, "", new { @class = "text-danger" })

        @Html.LabelFor(model => model.Text, htmlAttributes: new { @class = "control-label col-md-2" })

            @Html.Raw(Model.Text)

JavaScript for CKEditor

    var ckEditorInstance;

    $(document).ready(function () {
        CKEDITOR.replace('Text', { htmlEncodeOutput: true, enterMode: CKEDITOR.ENTER_BR });
        ckEditorInstance = CKEDITOR.instances.Text;
        ckEditorInstance.on('instanceReady', function () { UpdateTextArea(); });
        ckEditorInstance.on('change', function () { UpdateTextArea(); });

    });

    function UpdateTextArea() {
        ckEditorInstance.updateElement();
    };

</script>

Using CKEditor v4.8.0 • 13-12-2017
Image to show the issue, below CKEditor @Html.Raw(Model.Text) output, showing that html is decoded properly.

A: Resolved this by using @Html.Raw(Model.Text) Instead of TextAreaFor
With   @Html.HiddenFor(model=>Model.Text)
To preserve data when posting to server/controller
And Javascript to update hidden field and encode html


text:
Q: viewing/editing .vsd files in ubuntu
Possible Duplicate:
How do I open Visio files?

Can anyone suggest a program which can open MS Visio .vsd files for editing in Ubuntu?

A: As far as I know (and I've researched this for somebody else before), there are no desktop apps that can open Visio VSDs on Linux. Even Visio under Wine seems to struggle.
However, there is Zamzar. It's a webservice that converts lots of documents. You just have to give them the file, tell them what you want in return and give them an email address. Might sound fishy but they're under UK privacy law, which despite our government, is actually pretty strict. Their privacy policy explicitly says they don't sell on your details or documents.