text:
Q: mysql grant privileges over ssh the command:
ssh xxx.xxx.xxx.xxx \"mysql -u root -password \\\"grant all privileges on rcf_275d315.* to rfc_user@localhost identified by \'W27j453frxrff23\'\\\"\"

gives me an error:
bash: mysql -u root -p97yf2beiru3trf289 "grant all privileges on rcf_275d315.* to rfc_user@localhost identified by 'W27j453frxrff23'": command not found

when i copy the string returned by bash, end run locally it works. Also works, when pasted on the remote serve.
For some reason it doesn't work over ssh, and returns error:
mysql -u root -p97yf2beiru3trf289 "grant all privileges on rcf_275d315.* to rfc_user@localhost identified by 'W27j453frxrff23'": command not found

UPDATE:
i tried few variations, without success:
ssh xxx.xxx.xxx.xxx \"mysql -u root -pBOY8o7ubio87gubip7 \\\"grant all privileges on rfc_275d315.* to rfc_user identified by \'KUG34dY976fyvc768g\'\\\"\"

result:
bash: mysql -u root -pBOY8o7ubio87gubip7 "grant all privileges on rfc_275d315.* to rfc_user identified by 'KUG34dY976fyvc768g'": command not found

ssh xxx.xxx.xxx.xxx \"mysql -u root -pBOY8o7ubio87gubip7 \\"grant all privileges on rfc_275d315.* to rfc_user identified by \'KUG34dY976fyvc768g\'\\"\"

result:
bash: -c: line 0: unexpected EOF while looking for matching `"'
bash: -c: line 1: syntax error: unexpected end of file

ssh xxx.xxx.xxx.xxx mysql -u root -pBOY8o7ubio87gubip7 \\"grant all privileges on rfc_275d315.* to rfc_user identified by \'KUG34dY976fyvc768g\'\\"

result:
mysql  Ver 14.14 Distrib 5.1.66, for redhat-linux-gnu (x86_64) using readline 5.1
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

owners.
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.

ssh xxx.xxx.xxx.xxx mysql -u root -pBOY8o7ubio87gubip7 \\\"grant all privileges on rfc_275d315.* to rfc_user identified by \'KUG34dY976fyvc768g\'\\\"

result:
mysql  Ver 14.14 Distrib 5.1.66, for redhat-linux-gnu (x86_64) using readline 5.1
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

owners.
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.

still, don't where the problem is. Thanks for any help.
UPDATE:
when echo saved to file:
ssh xxx.xxx.xxx.xxx "echo mysql -u root -piugiu -e \\"grant all privileges on rfc_275d315.* to rfc_user identified by \'in76bn6bgb876n\'\\" > rfc/echo.txt"
i get this in file:
mysql -u root -piugiu -e "grant all privileges on rfc_275d315.* to rfc_user identified by 'in76bn6bgb876n'"
which is proper command, and when copied and pasted to command line on remote server it works, as it should.
when echo is removed:
ssh xxx.xxx.xxx.xxx "mysql -u root -piugiu -e \\"grant all privileges on rfc_275d315.* to rfc_user identified by \'in76bn6bgb876n\'\\" > rfc/echo.txt"
the text file contain info about usage of mysql:
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.

A: ssh xxx.xxx.xxx.xxx 'mysql -u root -pBOY8o7ubio87gubip7 -e "grant all privileges on rfc_275d315.* to rfc_user@localhost identified by '\''KUG34dY976fyvc768g'\''" yourdatabase'

Should be working. You forgot the -e in the MySQL client parameters which allows you to pass a statement
EDIT 1:
fixed quoting
In bash you can differ two ways of quoting (just like in many other languages)
1. Weak quoting: double quotes
e.g. echo "$PATH"

In a weak-quoted string there is no interpretion of

*

*spaces as word-separators

*pathname expansion

*process substitution

*single-quotes to introduce strong-quoting

*characters for pattern matching

Otherwise parameter expansion is done:
ls -l "*"
not be interpreted, will pass * literally and will cause an error unless you have a file called *
echo "Your PATH is: $PATH"
Will work as expected. $PATH is interpreted
2. Strong quoting: single quotes
Within single quotes you get no interpretation at all. All characters within single quotes are treated as text.
If you have to use the single quote within a single-quoted text, simply escaping isn't enough. You have to concat like this:
QUERY='SELECT * FROM myTable WHERE col1 = ' \' 'value1' \'
source: http://wiki.bash-hackers.org/syntax/quoting

A: You don't need to quote the command you send to ssh. Remove your outermost layer of quoting around your mysql command and it should work fine.


text:
Q: Do any languages implement retained generics on functions passed as parameters? Ran across this in F# today:
let test<'a> (f: 'a -> unit) =
    let x = f 123
    let y = f "wow"
    ()

Which produces a compiler error, since the generic parameter must be the same within each call of test<'a> as described here:
Type inference not working when passing map function

While this makes sense, it made me curious if there are any other languages out there that have implemented something like this--maybe a sort of "parameter-level generics"?
As a follow up, what are the challenges to implementing something like this?

A: Sure.  In Haskell, such things are called "higher rank types": they are types in which you are allowed to "move quantification inside parentheses":
test :: (forall a. a -> ()) -> ()
test f = let x = f 123
             y = f "wow"
         in ()

The "challenge" is also described in the link given:

Rank-N type reconstruction is undecidable in general, and some
  explicit type annotations are required in their presence.

Just rank-2 types are decidable, though, AFAIK (see here).  That's why there are two different flags for enabling them in GHC.

A: One could also claim C++ supports this with it's weird but quite powerful take on parametric polymorphism.
template<typename T>
void test(T f)
{
  std::cout << f(123)   << std::endl;
  std::cout << f("wow") << std::endl;
}

int main()
{
  test([](auto const & v)
    {
      // Note: This is a compile-time test
      if (std::is_same_v<int, std::decay_t<decltype(v)>>)
      {
        return 0;
      }
      else
      {
        return 1;
      }
    });
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: UWP ScrollViewer.TopHeader with SkiaSharp does not drawing The I want to use the SkiaSharp Canvas in ScrollViewer, but not only in Main content, but in TopHeader and LeftHeader as well.  The paint events are called, the skia is drawing, but the result does not displayed on the screen, just in a main content.
here is the example:
<ScrollViewer
    HorizontalScrollBarVisibility="Visible"
    HorizontalScrollMode="Enabled"
    VerticalScrollBarVisibility="Visible"
    VerticalScrollMode="Enabled">
    <ScrollViewer.TopHeader>
        <Grid
            Width="{Binding ElementName=Canvas, Path=ActualWidth}"
            Height="30"
            Background="LightGray">
            <TextBlock Text="Hello" />
            <skia:SKXamlCanvas
                x:Name="TopHeaderCanvas"
                Margin="0"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                PaintSurface="OnPaintTopHeader" />
        </Grid>
    </ScrollViewer.TopHeader>
    <ScrollViewer.LeftHeader>
        <skia:SKXamlCanvas
            Width="60"
            Height="{Binding ElementName=Canvas, Path=ActualHeight}"
            Background="Gray"
            PaintSurface="OnPaintLeftHeader" />
    </ScrollViewer.LeftHeader>
    <ScrollViewer.Content>
        <skia:SKXamlCanvas
            x:Name="Canvas"
            Width="4000"
            Height="3500"
            Margin="0"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            PaintSurface="OnPaintMainContent" />
    </ScrollViewer.Content>
</ScrollViewer>

As You can see, I tried the skia sharp canvas in wrapped in grid, directly under the ScrollViewer. Unfortunately it does not help.
Here is the result.

The left is totally empty, but is should be filled with HotPink, and the TopHeader just displays the Grid with "hello" , but it should be covered by canvas, and filled with Green color.
Anybody has an idea, why the skia is not working in ScrollView TopHeader and Left Header?
The SkiaSharp nuget which contains the canvas:
https://www.nuget.org/packages/SkiaSharp.Views/1.68.2-preview.21
And here are some SkiaSharp example:
https://github.com/mono/SkiaSharp/tree/master/samples/Basic/UWP/SkiaSharpSample

A:
UWP ScrollViewer.TopHeader with SkiaSharp does not drawing

I could reproduce your issue, and I tried to re-draw canvas within PaintSurface but it also does not work, please feel free post this issue in SkiaSharp github, And I will report this to the team.

A: It was a bug In SkiaSharp.
It is fixed: https://github.com/mono/SkiaSharp/pull/1133
Thank you: mattleibow


text:
Q: React Native - 'target. value not working on mobile' Greetings fellow humans,
I have a small problem with this little app that is just supposed to store and display data: https://snack.expo.dev/@vevlex/nullnotanobject
When I test this dircetly from my pc (I scan the QR code in my cmd window) on an ipad, the app boots fine but the data is not saved when re-running the app or when sending a job to another window (The "To Do" button on the right that shows up after you check a job).
When I run it from Expo, I get this error: null is not an object (evaluating 'jobs.map'
So I assume I'm doing something wrong with the saving / loading, or when actually writing the map, but I'm not sure, and I don't know how to approach this problem on my own.
Can anyone help me?
Please and thank you.

Update: var temp1 is not being set, as the alert here returns "Unidentified" even tho I just define it in the previous line. This only happens on iOS and android, it works fine on the web sim. Can anyone explain this?

<TextInput
                  style={s.jobInput}
                  onChange={(e) => {
                    var temp1 = e.target.value;
                    alert(temp1)
                    setJobs((currentJobs) =>
                      produce(currentJobs, (v) => {
                        v[index].address = temp1;
                      })
                    );
                    saveItem();

                  }}
                  value={j.address}
                  placeholder="Address"
                />

A: Ok after finding out what I stated in the update I searched a bit more and found out that on mobile you should use onChangeText rather than just onChange.


text:
Q: Visual studio not recognizing System Probably a simple question but I'm just coming back to using visual studio after years of intellij.
Visual studio recognizes none of the classes from the system namespace. Something is clearly wrong with my dependencies, but I have no idea what or where to find what's wrong. This is in Visual Studio Community 2019 if that helps.

If I have to reinstall .net or something like that please instruct me well, made mistakes there before and I find it really hard to know what I'm doing in that department.

A: The solution to solve the problem is opening a command prompt at the root of the project, execute dotnet restore.
The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.


text:
Q: How to make TextInputLayout and EditText hint gravity same with TogglerVisibility? Currently I am working with login form and here is the output.

This is the xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/activity_vertical_margin"
            app:hintEnabled="false"
            app:passwordToggleContentDescription="description"
            app:passwordToggleEnabled="true">

            <android.support.design.widget.TextInputEditText
                android:id="@+id/edt_password"
                android:layout_width="match_parent"
                android:layout_height="@dimen/password_edit_text_height"
                android:background="@drawable/custom_border_statup_edittext"
                android:gravity="center"
                android:hint="@string/hint_password"
                android:inputType="textPassword" />

        </android.support.design.widget.TextInputLayout>

    </LinearLayout>

But I want email and password hint gravity exact center. Without toggle it is showing center but with toggle it is not showing center. Is there anyway to do this?

A: Just add transparent drawable to the left side of EditText.
<android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:passwordToggleEnabled="true">

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:drawableLeft="@drawable/ic_password_space"
                    android:drawableStart="@drawable/ic_password_space"
                    android:gravity="center" />

</android.support.design.widget.TextInputLayout>

For transparent drawable you can use whatever you want with android:width="48dp".
Create drawable resource file in drawable directory with name ic_password_space.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="48dp"
        android:height="1dp"
        android:viewportWidth="1.0"
        android:viewportHeight="1.0">

    <path
        android:pathData="M"
        android:fillColor="#0000"/>
</vector>


text:
Q: What's the traditional way to navigate a project Having just moved from textmate to vim I'm curious. To be able to navigate my project efficiently I've installed command-t and ack.vim. These both seem like relatively new projects in the history of vim. What do people traditionally do to move around a project when they work in vim, do they just use the file explorer or is there some old school trick I don't know about?

A: I set path properly then use find for most things.  Sometimes I just rely on the tags.  The tags allow tab-completion, but find does not.
in my vimrc:
set path=src/**;c:/work,scripts/**;c:/work

then
:find foobar.cpp

Will turn up foobar.cpp if it exists under a src/ folder somewhere around my current directory (recursing up to find it until c:/work is hit) and then check the scripts hierarchy.
:tag FooBar

just jumps me right to the definition of that class, as I use ctags to tag my C source code and I also wrote a script to generate tags for an in-house DSL.

A: I use NerdTree and I can manage almost everything with it.

A: What I'm using generally:

*

*For opening new files: :e with tab-completion, or :Ex (open explorer in the directory of current file).

*For jumping between files in the buffer list (:ls): the taglist plugin, or :b and its tab-completion. Note that for :b, tab-completion works for substrings. For example, if you have two files in buffer list: module.h and module.cpp, you can type :b cpp and tab will complete module.cpp. Very handy!
For tab-completion I also recommend the must-have wildmenu (:set wildmenu :set wildmode=full)

A: Honestly? I rarely open a code file by name. For the most part I use ctags with ctrl-] to navigate around the files (following through to definitions between files), along with ctrl-t, ctrl-i, and ctrl-o. On the rare occasions I want to open a file by name, that's what a shell/explorer window is for.

A: Many people just use the normal file explorer in the bash command line or Windows Explorer or whatever and open files as necessary.  For navigating existing source trees, cscope and ctags are both very useful.  I find the project plugin really useful for IDE-like navigation of projects and files: it tends to be the main way I navigate my source tree.  Combined with ctags, cscope, command-t and ack, navigation can generally be very fast.

A: "Traditionally?" I've used :Sex for years. That and tab-completion for file-names doesn't make it that bad. Even in directory nestings 8 or 9 deep, using /mo to jump to the directory "models", hit then o to open it... etc etc.
I have installed Command-T on one machine, which is nice, but nothing beats the reliability of netrw

A: I also only use the basic file and buffer commands for managing my projects.  However, I found the following plugins make things easier as well:

*

*Fuzzy Finder ( makes opening files more pleasant )

*NERDTree ( already mentioned, does a nice directory explorer view )

*Taglist ( useful for navigating in a file )

*alternate.vim ( useful for programming languages such as C++ with corresponding file types .h and .cpp )

*MiniBufExplorer ( makes keeping track of buffers easier )

Also, simply remapping :bn and :bp to something easier makes switching buffers more pleasant.  For example:
nmap <C-n> :bn<cr>
nmap <C-p> :bp<cr>
Lastly, it wasn't mentioned but it is related to project management type stuff, make sure to check out the built in compile-edit stuff

*

*:help quickfix

I find that a lot people first coming to vim do not notice it right away.

A: I'm understand that it's may be too late, but I hope this would be useful for someone.
We have relatively large project on work of about thousand files of C/C++ code, php and shell
scripts, configs and other stuff.
To navigate through files I use following options.
First, I use simple grep wrapper, stored in my .vimrc to find specific string in files:
function MyGrep( pattern, path, case, whole )
    execute "normal! GoSearch text " . a:pattern . " in " . a:path . " and subdirs, case: " .a:case. " whole: ".a:whole
    "E - extended regexp, l - display filenames only, r - search recursively
    let l:keys = "Elr"
    if a:case == 0
        "case-sensitive
        let l:keys = l:keys . "i"
    endif
    if a:whole != 0
        "whole words only
        let l:keys = l:keys . "w"
    endif
    let l:cmd = "r!grep -" . keys . " -e \"" . a:pattern ."\" "
    let l:cmd2 = a:path . " --exclude=*.ncb --exclude=*.o --exclude=*.d --exclude-dir=.svn --exclude-dir=.d --exclude-dir=rc.d --binary-files=without-match"
    echo l:cmd . l:cmd2
    execute l:cmd . l:cmd2
endfunction

com -nargs=1 GrepHere          call MyGrep( <q-args>, "./", 0, 0)
com -nargs=1 GrepHereCaseWhole call MyGrep( <q-args>, "./", 1, 1)
com -nargs=1 GrepHereCase      call MyGrep( <q-args>, "./", 1, 0)
com -nargs=1 GrepHereWhole     call MyGrep( <q-args>, "./", 0, 1)

On windows I use vimgrep and changelist with this command (also in .vimrc):
command -nargs=1 VGCodeHere :vimgrep /<args>/j ./**/*.{c,cpp,h,rc} | copen

Both 'greppers' are depend on current working directory, so don't forget to set it properly.
I usually open a new unnamed tab in Vim and use this search commands there to dump there file
names that I'm interested in, search results, logs locations and other info.
Second, a cscope utility and plug-in for Vim - it is Very convenient way to browse files,
functions, symbols in project, but if you dealing with C/C++ sources.
Third, native Vim tricks, such as

*

*:e ./**/filename.cpp to open filename.cpp somewhere in file system subtree. Supports <Tab> filename completion.

*:tabe %<.h to open corresponding header file (you can change .h extension to whatever you like)

*:Ex  to navigate, using built-in file system browser

*Ctrl-O, Ctrl-I to go backwards and forward in Vim jump list

And to resume next time from the same Vim state I use sessions.
Save session in Vim with
:mksession sessionname.vis
, and launch vim with session:
vim -S sessionname.vis


text:
Q: Autolayout ScrollView with dynamic content im going crazy on autolayout and dynamic scrollview heigth.
I want to make my scrollview content height based on the content in multiple textviews. Also the spacing between the textviews should stay the same.
Therefor i tried to make a small sample app with two textviews and a button which calls [textview sizeToFit] for each textview. Another thread suggested to set the bottom verticl spacing of the lowest view to the scrollview (see screen1)
Following problems:

*

*The vertical spacing between the textviews does not apply correctly (see screenshot3)

*After applying [textview sizeToFit] the scrollview isnt scrollable and its size stays the same. Also only textview1 gets scrollable (is set NO in IB)

Im glad for any help or step-by-step tutorials.
Another thought I had: Would it make sense to put those textviews in a tableview and make cells heigth depending on content, so I dont habe to struggle with scrollview stuff?
More details are on the screenshots:

A: I got it figured out, using a UITableView with a custom cell, containing a label on left side and a textview on the right side.
To get the dynamic height in UITableView I used the answer provided in this thread:
Dynamic Height iOS7.
Further more I added 2 constraints to the UITextView (top and bottom to the cell's content view) to stretch the UITextView to same height as the cell.
Though its not the answer that i wanted (since i tried to use autolayout-only), I hope others can use this approach.


text:
Q: HTML comment cause issue in functions.php script root I noticed HTML comment tag <!-- --> will cause issue on themes functions.php script if it is in the root of script(not inside a function).
I was working on my themes functions.php to add some Easy Digital Downloads action/filter, which i realized purchase button will continue to loading and doesnt add product to basket.
after clearing an html comment that was in the root of script,issue solved. i need to know whats wrong with having HTML comment in functions.php root ?
(BTW my wp site is hosted on a cpanel shared host)

A: The functions.php is loaded before WordPress has sent the HTTP response headers. If you have raw HTML content in that file, even a HTML comment, then that will be sent immediately, triggering PHP's built-in HTTP headers.
Now, WordPress doesn't know about this and tries to send the headers as usual. And that will cause an error message like "Headers already sent …". This message comes with information about the file and line that created the first output, so it's rather easy to debug.
Long story short: Don't create raw output in the functions.php, use template files for that.


text:
Q: How to test the keys and values of api response for Request specs I am writing Request specs, and having trouble with to test api respond in json formate. I am using capybara and fabricator, here is my code which i trying...
    context 'discounts in api' do
      let(:user) { Fabricate(:user, activated: true) }
      let(:api_token) { user.api_token }

      before { visit api_url_for('/v1/discount_coupons', api_token) }

      it 'returns coupons collection' do
        Fabricate(:discount_coupon, code: 'Discount One', global: true)

        save_screenshot("tmp/capybara/screenshot-#{Time::now.strftime('%Y%m%d%H%M%S%N')}.png")
        save_and_open_page

        expect(json_response['total_records']).to eq 1
        expect(json_response['total_pages']).to eq 1
        expect(json_response['page']).to eq 0
        expect(json_response['discount_coupons'].size).to eq 1
        expect(json_response['discount_coupons'][0]['code']).to eq 'Discount One'
      end
end

the responce i getting is this
{"discount_coupons":[{"id":11,"code":"Discount One","type":"DiscountPercentage","amount_off":1.5,"global":true,"expires_on":null,"vendors":[]}],"page":0,"total_pages":1,"total_records":1}

and error goes to stop me for run a successful test,
Failure/Error: expect(json_response['total_pages']).to eq 1
             NoMethodError:
               undefined method `body' for nil:NilClass

I think my expect to json_response is wrong or something missing, can somone help me to do it handsome way please, hint to that how can i test using key and value.

A: Best way to test an API is use rspec as you just need to do this:
it "should return the expected information" do
  get "/url"

  parsed_response = JSON.parse(response.body)
  expect(parsed_response["key"]).to eq(whatever)
end

it "should update the expected entity" do
  post "/url", body, headers

  parsed_response = JSON.parse(response.body)
  expect(parsed_response["key"]).to eq(whatever)
end

And your tests are failing because you are trying to parse a response that is empty. The Fabric can be failing or the call might be wrong.

A: I think the issue may be that you are visiting the page in the before block and then generating the discount coupon later on in the assertion block. Try moving the code around like this and see if it yields a better result.
context 'discounts in api' do
  let(:user) { Fabricate(:user, activated: true) }
  let(:api_token) { user.api_token }

  before do
    Fabricate(:discount_coupon, code: 'Discount One', global: true)
    visit api_url_for('/v1/discount_coupons', api_token)
  end

  it 'returns coupons collection' do
    save_screenshot("tmp/capybara/screenshot-#{Time::now.strftime('%Y%m%d%H%M%S%N')}.png")
    save_and_open_page

    expect(json_response['total_records']).to eq 1
    expect(json_response['total_pages']).to eq 1
    expect(json_response['page']).to eq 0
    expect(json_response['discount_coupons'].size).to eq 1
    expect(json_response['discount_coupons'][0]['code']).to eq 'Discount One'
  end


text:
Q: How to debug react performance on localhost I have react app running on localhost:3000. I have created very basic application (nothing I haven't did before), but my app performance is poor.

My button contains simple transition CSS attribute and as you can see above the performance results are very slow.
button{
    background: none;
    color: white;
    outline: none;
    border: 2px solid rgb(255, 153, 0);
    font-size: 20px;
    padding: 5px 20px;
    cursor: pointer;
    width: 200px;
    border-radius: 5px;
    transition: 300ms all ease-in-out;
}
button:hover{
    background: rgb(255, 153, 0);
}

I have tried using react performance tool chrome extension but the result are below:

Although I followed the documentation it refuses to work.
Step one: npm install react-perf-devtool
Step Two (index.js):
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const { registerObserver } = require('react-perf-devtool');
const options = {
  shouldLog: true,
  port: 8080,
  timeout: 12000 // Load the extension after 12 sec.
}

function callback(measures) {
  console.log(measures);
}

// assign the observer to the global scope, as the GC will delete it otherwise
window.observer = registerObserver(options, callback);

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

reportWebVitals();

Also tried:

*

*Deleting the app

*Reinstall it

*Remove components and check if they causing the problem

*Run different app that works perfect
What can cause poor performance on so basic react application?

A: The problem was caused by image decoding, by using chrome dev tools I entered performance tab and was able to see image decoding value with hude loading and processing time.
So I figured out that probably because I converted Illustrator file from svg to jpg.
I solved that by uploading my file to online convertor tool and converted it to webp (could convert it to any extension and it probably would of worked).
Once I did that the performance was fast as usual.


text:
Q: If it is possible to add custom menu item on wp_nav_menu with reverse order I'm trying to add a custom menu item on my website. its showing perfectly but i need to show reverse order format.
It is like this screenshot:

Function Code is:
  add_filter('wp_nav_menu_items','add_custom_in_menu', 10, 2);
function add_custom_in_menu( $items, $args ) {

    if( $args->theme_location == 'primary') {
        $items .= "

";
    }

    return $items;
}

Menu linking code on header
<?php if ( has_nav_menu( 'primary' ) ) : ?>

                <?php
                    //  navigation menu.
                    wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'orderby' => 'menu_order') );
                ?>

            <?php endif; ?>

I need reverse order like logo should be on top and others are looping below logo. Please help.

A: Currently you append logo (all the stuff inside
) to $items string. What you should instead is prepend it, like this:
if( $args->theme_location == 'primary') {
  $items = "
\\ template is skipped for readability \\
" . $items;
}
return $items;

You might consider extracting logo template generation into a separate function.


text:
Q: Is there an R function for rounding based on the size of the number? I want the rounding of a set of numbers to automatically change as the numbers get larger. I am making barplot labels. Here is what currently shows up:
<39
39 to 11564
11564 to 23090
23090 to 50893
50893 to 89034
89034 to 138900
138900 to 183562

I think the number 39 is important, that is, I do not want to apply round() to all of the numbers equally because I do not want to change 39 to 40. I am writing a function so I need something that will adjust the amount it rounds based on the size of the number.
Ideal rounding:
<39 .         ( when 2 or 3 digits long, do not round)
39 to 11600    ( when 5 digits long, round to 3 places)
11600 to 23000
23000 to 50900
50900 to 89000
89000 to 139000 ( when 6 digits long, round to 4 places)
139000 to 184000

does this already exist, where I can specify rounding by length? Or should I just write my own helper function to try to do this separately.
Thanks for the help!
Best, Tessa


text:
Q: Java .Net Interop. Axis java.util.Map I have wsdl that needs to be interpreted by wsdl.exe (.net sdk 2.0)
This wsdl is generated on runtime by axis engine, and it is reading a wsdd file to generate this.
One of my return types have java.util.Map inside and here is the schema for a map in wsdl (just one part of wsdl)
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
            <complexType name="Map">
                <sequence>
                    <element maxOccurs="unbounded" minOccurs="0" name="item">
                        <complexType>
                            <all>
                                <element name="key" type="xsd:anyType" />
                                <element name="value" type="xsd:anyType" />
                            </all>
                        </complexType>
                    </element>
                </sequence>
            </complexType>
        </schema>

But when I run the wsdl.exe to read this wsdl I am getting following error;

*

*Unable to import operation 'getXXX'.

*Types must be declared at the top level in the schema. Please review
  schema type 'Map' from namespace
  'http://xml.apache.org/xml-soap':
  element 'item' is using anonymous type
  declaration, anonymous types are not
  supported with encoded SOAP.

Does this mean that I am not allowed to use Map when it comes a web service? I couldn't be satisfied with google results...

A: Let me answer my own question;
You should not use java.util.Map as a return type if you want to make your web services consumable by .NET
http://wiki.apache.org/ws/FrontPage/Axis/DotNetInteropMapInfo


text:
Q: How to split string and insert values into table in SQL Server I have a string like this:
72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San Francisco,CA:72594221871,99,12/30/12,Dallas,TX

This is basically 5 values in each of 3 rows (from an ASP.NET grid). I need to split this string apart into 5 columns and 3 rows in a SQL Server table. Individual values are separated by commas and rows by colons.
I found a function to split a string into pieces and I can get the rows out of this string:
declare @testString varchar(100)
set @testString = '72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San Francisco,CA:72594221871,99,12/30/12,Dallas,TX'

select *
from dbo.SplitString(@testString, ':')

gives me:
72594206916,2,1/2/08,Tacoma,WA
72594221856,5,5/7/13,San Francisco,CA
72594221871,99,12/30/12,Dallas,TX

This gives me a result set with the three rows (the function outputs a table). Can I call this function again at the same time and insert its output into a table somehow?

A: Function Definition by Romil
Create this Function in your Sql Server
CREATE FUNCTION Split (
      @InputString                  VARCHAR(8000),
      @Delimiter                    VARCHAR(50)
)

RETURNS @Items TABLE (
      Item                          VARCHAR(8000)
)

AS
BEGIN
      IF @Delimiter = ' '
      BEGIN
            SET @Delimiter = ','
            SET @InputString = REPLACE(@InputString, ' ', @Delimiter)
      END

      IF (@Delimiter IS NULL OR @Delimiter = '')
            SET @Delimiter = ','

--INSERT INTO @Items VALUES (@Delimiter) -- Diagnostic
--INSERT INTO @Items VALUES (@InputString) -- Diagnostic

      DECLARE @Item                 VARCHAR(8000)
      DECLARE @ItemList       VARCHAR(8000)
      DECLARE @DelimIndex     INT

      SET @ItemList = @InputString
      SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
      WHILE (@DelimIndex != 0)
      BEGIN
            SET @Item = SUBSTRING(@ItemList, 0, @DelimIndex)
            INSERT INTO @Items VALUES (@Item)

            -- Set @ItemList = @ItemList minus one less item
            SET @ItemList = SUBSTRING(@ItemList, @DelimIndex+1, LEN(@ItemList)-@DelimIndex)
            SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
      END -- End WHILE

      IF @Item IS NOT NULL -- At least one delimiter was encountered in @InputString
      BEGIN
            SET @Item = @ItemList
            INSERT INTO @Items VALUES (@Item)
      END

      -- No delimiters were encountered in @InputString, so just return @InputString
      ELSE INSERT INTO @Items VALUES (@InputString)

      RETURN

END -- End Function
GO

Pass Your Parameteres
Since it is a Table Function you will SELECT * FROM this_Function like you would do with a table
declare @testString varchar(100)
set @testString = '72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San Francisco,CA:72594221871,99,12/30/12,Dallas,TX'

SELECT * FROM Split(@testString, ',')

Result Set
Item
72594206916
2
1/2/08
Tacoma
WA:72594221856
5
5/7/13
San Francisco
CA:72594221871
99
12/30/12
Dallas

Your Existing Code
select *
from dbo.SplitString(@testString, ':')

The Second Parameter needs to be the deliminator, Since you are Passing : as the second parameter it is breaking you string where ever it finds : in you passed string which is obviously in 2 places and you get back 3 values/Strings in the result set
                          String1/Value1                             String2/Value2                    String3/Value3
set @testString = '72594206916,2,1/2/08,Tacoma,WA  :   72594221856,5,5/7/13,San Francisco,CA  :  72594221871,99,12/30/12,Dallas,TX'

A: Create this SQL function:
CREATE FUNCTION [dbo].[StringSplit](@input NVARCHAR(MAX), @delimiter CHAR(1)=',')
       RETURNS @returnTable TABLE(item NVARCHAR(100)) AS
     BEGIN
        IF @input IS NULL RETURN;
        DECLARE @currentStartIndex INT, @currentEndIndex INT,@length INT;
        SET @length=LEN(@input);
        SET @currentStartIndex=1;

        SET @currentEndIndex=CHARINDEX(@delimiter,@input,@currentStartIndex);
        WHILE (@currentEndIndex<>0)
          BEGIN
            INSERT INTO @returnTable VALUES (LTRIM(SUBSTRING(@input, @currentStartIndex, @currentEndIndex-@currentStartIndex)))
            SET @currentStartIndex=@currentEndIndex+1;
            SET @currentEndIndex=CHARINDEX(@delimiter,@input,@currentStartIndex);
          END

        IF (@currentStartIndex <= @length)
          INSERT INTO @returnTable
            VALUES (LTRIM(SUBSTRING(@input, @currentStartIndex, @length-@currentStartIndex+1)));
        RETURN;
     END;

Usage example:
DECLARE @testString VARCHAR(100)
SET @testString = '72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San Francisco,CA:72594221871,99,12/30/12,Dallas,TX'

SELECT *
FROM [dbo].[StringSplit](@testString, DEFAULT)

Result (table):
72594206916
2
1/2/08
Tacoma
WA:72594221856
5
5/7/13
San Francisco
CA:72594221871
99
12/30/12
Dallas

A: Something similar to what  M.Ali gave above, but shorter:
Use [Database_Name]
Go;

 CREATE FUNCTION Split
(
@RowData nvarchar(MAX),
@SplitOn nvarchar(MAX)
)
RETURNS @RtnValue table
(
Data nvarchar(MAX)
)
AS
BEGIN
Declare @Cnt int
Set @Cnt = 1

While (Charindex(@SplitOn,@RowData)>0)
Begin
    Insert Into @RtnValue (data)
    Select
        Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))

    Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
    Set @Cnt = @Cnt + 1
End

Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(@RowData))

Return
END

Then select from the function as in the above example:
USE [Database_Name]
GO
declare @testString varchar(100)
set @testString = '72594206916,2,1/2/08,Tacoma,WA:72594221856,5,5/7/13,San   Francisco,CA:72594221871,99,12/30/12,Dallas,TX'

SELECT * FROM Split(@testString, ',')

A: assuming your split returns column name item
insert <table> (colname)
select y.item
from dbo.SplitString(@testString, ':') x
cross apply
dbo.SplitString(x.item, ',') y

A: declare @fqdn_list varchar(max) = 'test1.qa.local,test2.qa.local,test3.qa.local'
-- temp table
DECLARE @fqdn_tbl TABLE (   fqdn nvarchar(50) )

INSERT INTO @fqdn_tbl  SELECT LTRIM(RTRIM(split.a.value('.', 'NVARCHAR(MAX)'))) AS fqdn   FROM (
    SELECT CAST ('<M>' + REPLACE(@fqdn_list, ',', '</M><M>') + '</M>' AS XML) AS data   ) AS a   CROSS APPLY data.nodes ('/M') AS split(a)

select * from  @fqdn_tbl

A: If your database is at Compatibility 130 or later, you can use a built-in function STRING_SPLIT:
https://database.guide/how-to-convert-a-comma-separated-list-into-rows-in-sql-server/

A: Try this code:
SELECT value
FROM STRING_SPLIT(@testString, ',')

A: You forgot the last line. In your example, the 'TX' is not taken into account. You shuld check the remaining text avec While loop


text:
Q: PHP skips few data from jsonarray I have a json array from a form saved in the database. I am generating a report from the array.The form has a section for "Do you require the section?" If the user selected "No" to section, I need to skip the section until the end of the section.
In the json array, section starts at
'{"type":"section","label":"Do you require this section?","req":0,"Element_Values":"No"}'
and the end of the section is at
'{"type":"section-end","label":"","req":0,"Element_Values":""}'
If the Element_Values=No then skip the data until the type section-end, otherwise do not do anything.
For that I did the do{}while loop and it's still not working:
 if($jsonArray[$jsonIndex]['type']=="section")
 {
      if($jsonArray[$jsonIndex]['Element_Values']=="")
      {
           $html.='
'
                           .'Unanswered'
                           .'
';
      }
      else if($jsonArray[$jsonIndex]['Element_Values']=="No")
      {
           do
           {
               continue;
           }while($jsonArray[$jsonIndex]['type']=="section-end");
      }

  }

My full code is given below:
<?php
$jsonIndex=0;
$jsonArray='[{"type":"header","label":"Inspection","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"WHAT TYPE OF HOME IS THIS","Element_Values":"\"SINGLE DUPLEX\"","req":1,"choices":[{"label":"SINGLE","sel":0,"notification":0,"subOptions":[]},{"label":"SINGLE DUPLEX","sel":1,"notification":0,"subOptions":[]},{"label":"SINGLE GRANNY FLAT","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE DUPLEX","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE GRANNY FLAT","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"description","label":"IF YOU HAVE SELECTED DUPLEX or GRANNY FLAT THE CHECKLIST IS AT THE BOTTOM FOR THE SECOND UNIT","req":0,"Element_Values":"-"},'
        . '{"type":"sub-header","label":"DOCUMENTS","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Do you have the frame and truss details including bracing, floor joist, wall frame and truss layouts","Element_Values":"\"Yes\"","req":0,"choices":[{"label":"Yes","sel":1,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[{"InstructionLabel":"You cannot complete this inspection "}]}]},'
        . '{"type":"sub-header","label":"SERVICES","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Stackwork and a\/c ducts have been framed if required","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]},{"label":"N\/A","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"All drainage points in correct position","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Is power connected on site","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DUPLEX \/ GRANNY FLAT","req":0,"Element_Values":"-"},'
        . '{"type":"section","label":"Do you require this section?","req":0,"Element_Values":"No"},'
        . '{"type":"dropdown","label":"What side viewing from the street is the home you are about to inspect","Element_Values":"\"\"","req":1,"choices":[{"label":"LEFT","sel":0,"notification":0,"subOptions":[]},{"label":"RIGHT","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DOCUMENTS","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Do you have the frame and truss details including bracing, floor joist, wall frame and truss layouts","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[{"InstructionLabel":"You cannot complete this inspection\n"}]}]},'
        . '{"type":"sub-header","label":"BRACING - ROOF & WALL","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Is all Wall & Roof Bracing as per approved plan and correctly installed","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Sheer blocks installed as required","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DOWNPIPES","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Are all downpipes installed and connected to system","Element_Values":"\"\"","req":1,"choices":[{"label":"YES","sel":0,"notification":0,"subOptions":[{"DropLabel":"Where downpipes are relocated are they 300mm below bottom course of brickwork","DropOptions":["YES","NO"],"DropSel":"","reqDrop":"0"}]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"section-end","label":"","req":0,"Element_Values":""},'
        . '{"type":"sub-header","label":"SIGN OFF","req":0,"Element_Values":"-"},'
        . '{"type":"text","label":"Signature ","req":1,"Element_Values":"fd bvf"},'
        . '{"type":"dropdown","label":"Job is ready to proceed to Mandatory Pre Linings Inspection","Element_Values":"\"PROCEED\"","req":1,"choices":[{"label":"PROCEED","sel":1,"notification":0,"subOptions":[]},{"label":"DO NOT PROCEED","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Who will be the gyprocker for this job","Element_Values":"\"vgfnari\"","req":1,"choices":[{"label":"FBI-Fornari","sel":1,"notification":0,"subOptions":[]},{"label":"MOMENTUM","sel":0,"notification":0,"subOptions":[]}]}]';
$jsonArray=json_decode($jsonArray,true);
$html="";
if(!empty($jsonArray))
{
    for ($i=0;$i <count($jsonArray);$i++)
    {

        if($jsonArray[$jsonIndex]['type']=="header")
        {
            $html.='

'.$jsonArray[$jsonIndex]['label']. '

';
        }
        else if($jsonArray[$jsonIndex]['type']=="sub-header")
        {
            $html.='

'.$jsonArray[$jsonIndex]['label'].'

';
        }
        else if($jsonArray[$jsonIndex]['type']=="description")
        {
            $html.='
'
                        . '
'
                        . '
'
                        . ''.$jsonArray[$jsonIndex]['label']
                        . '	'
                        . '
'
                        . '
'
                        . '
';
        }

        else
        {
            if($jsonArray[$jsonIndex]['type']=="section")
            {
                if($jsonArray[$jsonIndex]['Element_Values']=="")
                {
                    $html.='
'
                           .'Unanswered'
                           .'
';
                }
                else if($jsonArray[$jsonIndex]['Element_Values']=="No")
                {
                    do
                    {
                        continue;
                    }while($jsonArray[$jsonIndex]['type']=="section-end");
                }

            }
            if($jsonArray[$jsonIndex]['type']=="signature")
            {
                    $label="Signature";
            }
            else if($jsonArray[$jsonIndex]['type']=="location")
            {
                    $label="Location";
            }
            else
            {
                    $label=$jsonArray[$jsonIndex]['label'];
            }

            $html.='
'
                       . '
'
                       . '
';
            $html.=''.$label.'
';

            if($jsonArray[$jsonIndex]['Element_Values']=="")
            {
                      $html.='
'
                               .'Unanswered'
                               .'
';
            }
            else
            {
                    //$html.='
'.$jsonArray[$jsonIndex]['Element_Values'].'
';
                    $html.='
'.str_replace('"','', $jsonArray[$jsonIndex]['Element_Values']).'
';
            }
            $html.='
'
         .'
';
        }

        $jsonIndex++;
    }
    echo $html;
}

?>

Updated Code:
<?php
$jsonIndex=0;
$jsonArray='[{"type":"header","label":"Inspection","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"WHAT TYPE OF HOME IS THIS","Element_Values":"\"SINGLE DUPLEX\"","req":1,"choices":[{"label":"SINGLE","sel":0,"notification":0,"subOptions":[]},{"label":"SINGLE DUPLEX","sel":1,"notification":0,"subOptions":[]},{"label":"SINGLE GRANNY FLAT","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE DUPLEX","sel":0,"notification":0,"subOptions":[]},{"label":"DOUBLE GRANNY FLAT","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"description","label":"IF YOU HAVE SELECTED DUPLEX or GRANNY FLAT THE CHECKLIST IS AT THE BOTTOM FOR THE SECOND UNIT","req":0,"Element_Values":"-"},'
        . '{"type":"sub-header","label":"DOCUMENTS","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Do you have the frame and truss details including bracing, floor joist, wall frame and truss layouts","Element_Values":"\"Yes\"","req":0,"choices":[{"label":"Yes","sel":1,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[{"InstructionLabel":"You cannot complete this inspection "}]}]},'
        . '{"type":"sub-header","label":"SERVICES","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Stackwork and a\/c ducts have been framed if required","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]},{"label":"N\/A","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"All drainage points in correct position","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Is power connected on site","Element_Values":"\"YES\"","req":0,"choices":[{"label":"YES","sel":1,"notification":0,"subOptions":[]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DUPLEX \/ GRANNY FLAT","req":0,"Element_Values":"-"},'
        . '{"type":"section","label":"Do you require this section?","req":0,"Element_Values":"No"},'
        . '{"type":"dropdown","label":"What side viewing from the street is the home you are about to inspect","Element_Values":"\"\"","req":1,"choices":[{"label":"LEFT","sel":0,"notification":0,"subOptions":[]},{"label":"RIGHT","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DOCUMENTS","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Do you have the frame and truss details including bracing, floor joist, wall frame and truss layouts","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[{"InstructionLabel":"You cannot complete this inspection\n"}]}]},'
        . '{"type":"sub-header","label":"BRACING - ROOF & WALL","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Is all Wall & Roof Bracing as per approved plan and correctly installed","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Sheer blocks installed as required","Element_Values":"\"\"","req":1,"choices":[{"label":"Yes","sel":0,"notification":0,"subOptions":[]},{"label":"No","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"sub-header","label":"DOWNPIPES","req":0,"Element_Values":"-"},'
        . '{"type":"dropdown","label":"Are all downpipes installed and connected to system","Element_Values":"\"\"","req":1,"choices":[{"label":"YES","sel":0,"notification":0,"subOptions":[{"DropLabel":"Where downpipes are relocated are they 300mm below bottom course of brickwork","DropOptions":["YES","NO"],"DropSel":"","reqDrop":"0"}]},{"label":"NO","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"section-end","label":"","req":0,"Element_Values":""},'
        . '{"type":"sub-header","label":"SIGN OFF","req":0,"Element_Values":"-"},'
        . '{"type":"text","label":"Signature ","req":1,"Element_Values":"fd bvf"},'
        . '{"type":"dropdown","label":"Job is ready to proceed to Mandatory Pre Linings Inspection","Element_Values":"\"PROCEED\"","req":1,"choices":[{"label":"PROCEED","sel":1,"notification":0,"subOptions":[]},{"label":"DO NOT PROCEED","sel":0,"notification":0,"subOptions":[]}]},'
        . '{"type":"dropdown","label":"Who will be the gyprocker for this job","Element_Values":"\"vgfnari\"","req":1,"choices":[{"label":"FBI-Fornari","sel":1,"notification":0,"subOptions":[]},{"label":"MOMENTUM","sel":0,"notification":0,"subOptions":[]}]}]';
$jsonArray=json_decode($jsonArray,true);
$html="";
if(!empty($jsonArray))
{
    for ($i=0;$i <count($jsonArray);$i++)
    {

        if($jsonArray[$jsonIndex]['type']=="header")
        {
            $html.='

'.$jsonArray[$jsonIndex]['label']. '

';
        }
        else if($jsonArray[$jsonIndex]['type']=="sub-header")
        {
            $html.='

'.$jsonArray[$jsonIndex]['label'].'

';
        }
        else if($jsonArray[$jsonIndex]['type']=="description")
        {
            $html.='
'
                        . '
'
                        . '
'
                        . ''.$jsonArray[$jsonIndex]['label']
                        . '	'
                        . '
'
                        . '
'
                        . '
';
        }

        else
        {
            if($jsonArray[$jsonIndex]['type']=="section")
            {
                if($jsonArray[$jsonIndex]['Element_Values']=="")
                {
                    $html.='
'
                           .'Unanswered'
                           .'
';
                }
                else if($jsonArray[$jsonIndex]['Element_Values']=="No")
                {
                    do
                    {
                        $jsonIndex++;
                    }while($jsonArray[$jsonIndex]['type']!="section-end");
                }

            }
            if($jsonArray[$jsonIndex]['type']=="signature")
            {
                    $label="Signature";
            }
            else if($jsonArray[$jsonIndex]['type']=="location")
            {
                    $label="Location";
            }
            else
            {
                    $label=$jsonArray[$jsonIndex]['label'];
            }

            $html.='
'
                       . '
'
                       . '
';
            $html.=''.$label.'
';

            if($jsonArray[$jsonIndex]['Element_Values']=="")
            {
                      $html.='
'
                               .'Unanswered'
                               .'
';
            }
            else
            {
                    //$html.='
'.$jsonArray[$jsonIndex]['Element_Values'].'
';
                    $html.='
'.str_replace('"','', $jsonArray[$jsonIndex]['Element_Values']).'
';
            }
            $html.='
'
         .'
';
        }

        //$jsonIndex++;
    }
    echo $html;
}
?>

A: This
do
{
    continue;
}while($jsonArray[$jsonIndex]['type']=="section-end");

Needs to be
do
{
  $jsonIndex++;
} while ($jsonArray[$jsonIndex]['type'] != "section-end");

The logic needed to loop is opposite to what you had. It use != instead of ==. Also, it is quite important to increase the $jsonIndex value otherwise it'll end up being an endless loop.
Also change...
for ($i=0;$i <count($jsonArray);$i++)

to
for ($jsonIndex=0;$jsonIndex <count($jsonArray);$jsonIndex++)


text:
Q: django contact form receiving email for free I just finished setting up a contact form thanks to some tutorial, but on the tutorial I took it says I have to setup sendgrid or some other service to get the reply. but thing is they aren't free.
Is there a way to get the emails for free?
def contact(request):

    form_class = ContactForm

    if request.method == 'POST':
        form = form_class(data=request.POST)
        if form.is_valid():
            contact_name = request.POST.get('contact_name','')
            contact_email = request.POST.get('contact_email','')
            form_content = request.POST.get('content','')
            template=get_template('contact_template.txt')
            context = Context({
                'contact_name':contact_name,
                'contact_email':contact_email,
                'form_content':form_content,
                })
            content = template.render(context)

            email = EmailMessage(
                "New Contact form submisssion",
                content,
                "your website"+'',
                ['ebagu.net@gmail.com'],
                headers = {'Reply-To':contact_email})
            email.send()
            return redirect('contact')

    return render(request, 'contact.html', {
        'form':form_class,
        })

I have this in txt file, and this is what I get in email
Contact Name:

Email:

Content:

A: I don't know why you're asking about email services, they have nothing to do with your question. Your email is blank because you don't seem to have any variable placeholders in your template. Add {{ contact_name }} etc to fill in the data, just as you would with an HTML template.


text:
Q: Method to show responsive divs side by side to fit whole space with margins in between them I'm struggling to find a reliable solution to show any number of divs side by side to fit the whole space. They also need to have same height and size despite their content. The divs need to have some margin to separate one another.
I cannot use Flex as the page I'm working on needs to be IE9 compatible. Hence, I'm relying on inline-block, floats and table methods.
Can you suggest anything?
Here is the HTML of what I've tried and the fiddle link for the full example --> https://jsfiddle.net/crvu1oc9/

Choosing your elderly care at home

          <date>04 Nov, 2016</date>

Choosing your elderly care at home

          <date>04 Nov, 2016</date>

Choosing your elderly care at home

          <date>04 Nov, 2016</date>

A: In the CSS, give your each of your card classes a percentage that adds up to 100; since children inherit the width of parent elements, the percentages of all div's with class="card" will be added together.
width + padding + border + margin = total size
And so, in your case:
.cards-list{
            width: 90%;
            max-width: 980px;

        .card{
            float: left; /* or right */
            width: 32%;
            margin-right: 1.333333%;

Since you have only 3 elements with the card class, this will fill up the entire card-list div element. 32% width + 1.33% margin-right = 33.33% / card.
When you add elements, recalculate the percentages.
Here is your code working with four "card"'s: https://jsfiddle.net/crvu1oc9/1/


text:
Q: How to make a ViewPager loop? I have a ViewPager with some views. I'd like to go to the first one after right swiping on the last one.
I tried
@Override
public Fragment getItem(int arg0) {
    int i = arg0 % fragmentList.size();
    return fragmentList.get(i);
}

@Override
public int getCount() {
    return fragmentList.size()+1;
}

But I got an error
E/AndroidRuntime(22912): java.lang.IllegalStateException: Fragment already added: RubricFragment{4136cd80 #1 id=0x7f06000c android:switcher:2131099660:0}

A: I would create a dummy page at the end of the ViewPager.
Then I use this code to go to the first page when the user scroll to the dummy page. I know it's far from perfect :D
@Override
public void onPageScrolled(int position, float arg1, int arg2) {
    if (position >= NUM_PAGE-1) {
        mViewPager.setCurrentItem(0, true);
    }
}

A: One possibility is setting up the screens like this:
C'  A  B  C  A'
C' looks just like C, but when you scroll to there, it switches you to the real C.
A' looks just like A, but when you scroll to there, it switches you to the real A.
I would do this by implementing onPageScrollStateChanged like so:
@Override
public void onPageScrollStateChanged (int state) {
    if (state == ViewPager.SCROLL_STATE_IDLE) {
        int curr = viewPager.getCurrentItem();
        int lastReal = viewPager.getAdapter().getCount() - 2;
        if (curr == 0) {
            viewPager.setCurrentItem(lastReal, false);
        } else if (curr > lastReal) {
            viewPager.setCurrentItem(1, false);
        }
    }
}

Note that this calls the alternate form of setCurrentItem and passes false to cause the jump to happen instantly rather than as a smooth scroll.
There are two main drawbacks I see to this.  Firstly, upon reaching either end the user has to let the scrolling settle before they can go further.  Secondly, it means having a second copy of all of the views in your first and last page.  Depending on how resource-heavy your screens are, that may rule out this technique as a possible solution.
Note also that since the view pager doesn't let clicks go through to underlying controls until after the scrolling has settled, it's probably fine to not set up clicklisteners and the like for the A' and C' fragments.
Edit: Having now implemented this myself, there's another pretty major drawback.  When it switches from A' to A or C' to C, the screen flickers for a moment, at least on my current test device.

A: My solution is based on benkc, but first and last page scroll animation are disabled, and when pages "scrolled" to real page, scroll animation is enable again, this scheme can solve the first drawback.
but my ViewPager.setCurrentItem(position, false) result is still have scroll animation, so i implements animation which is too fast to seen.
the fast scrolling animation like this, don't mind the comment, just my code didn't use these method:
public class FixedSpeedScroller extends Scroller {
    private int mDuration = 0;

    public FixedSpeedScroller(Context context) {
        super(context);
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy, int duration) {
        super.startScroll(startX, startY, dx, dy, mDuration);
    }

    @Override
    public void startScroll(int startX, int startY, int dx, int dy) {
        super.startScroll(startX, startY, dx, dy, mDuration);
    }
}

and use this method to viewpager's activity
private Scroller scroller;
private void setViewPagerScroll(boolean instant) {
    try {
        Field mScroller = null;
        mScroller = ViewPager.class.getDeclaredField("mScroller");
        mScroller.setAccessible(true);
        if (scroller == null) {
            scroller = (Scroller) mScroller.get(mViewPager);
        }
        FixedSpeedScroller fss = new FixedSpeedScroller(mViewPager.getContext());
        mScroller.set(mViewPager, instant ? fss : scroller);

    } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}

and modify onPageScrollStateChanged like this, only first page or last page (i have 5 pages) would change animation to fast scrolling, otherwise has normal scrolling:
public void onPageScrollStateChanged(int state) {
    if (state == ViewPager.SCROLL_STATE_IDLE) {
        if (position == 0) {
            setViewPagerScroll(true);
            mViewPager.setCurrentItem(3);

        } else if (position == 4) {
            setViewPagerScroll(true);
            mViewPager.setCurrentItem(1);

        } else {
            setViewPagerScroll(false);
        }
    }
}

FixedSpeedScroller references is here: http://blog.csdn.net/ekeuy/article/details/12841409

A: Kotlin Version:
Initailize the variables
private var mCurrentPosition = 0
private var mScrollState = 0
private lateinit var mImageViewPager: ViewPager

onCreate:
mImageViewPager = findViewById<View>(R.id.pager) as ViewPager

mImageViewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {

            override fun onPageScrollStateChanged(state: Int) {
                handleScrollState(state)
                mScrollState = state
            }

            override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {

            }
            override fun onPageSelected(position: Int) {
                mCurrentPosition = position
            }

        })

functions outside onCreate:
private fun handleScrollState(state: Int) {

        if (state == ViewPager.SCROLL_STATE_IDLE) {

            if (!isScrollStateSettling()){

                val lastPosition: Int = mImageViewPager.getAdapter()?.getCount()!! - 1
                if (mCurrentPosition == 0) {
                    mImageViewPager.setCurrentItem(lastPosition , false)
                } else if (mCurrentPosition == lastPosition) {
                    mImageViewPager.setCurrentItem(0 , false)
                }
            }
        }
    }

private fun isScrollStateSettling(): Boolean {
        return mScrollState == ViewPager.SCROLL_STATE_SETTLING
    }

A: this should do the job without dummy pages:
private boolean isFirstOrLastPage;
private int currentPageIndex = 0;

@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
    if(currentPageIndex!=arg0){
        isFirstOrLastPage = false;
        return;
    }
    if((arg0==0 || arg0==PAGES.size()-1) && arg1 == 0 && arg2 == 0){
        if(isFirstOrLastPage){
                 //DO SOMETHING
        }else{
            isFirstOrLastPage = true;
        }
    }
}

@Override
public void onPageSelected(int arg0) {
    currentPageIndex = arg0;
}

A: this works, the accepted answer no good because there is a lag when the loop happens:
 @Override
public int getCount() {
    return Integer.MAX_VALUE;
}

@Override
public CharSequence getPageTitle(int position) {
    String title = mTitleList.get(position % mActualTitleListSize);
    return title;
}

@Override
public Object instantiateItem(ViewGroup container, int position) {
    int virtualPosition = position % mActualTitleListSize;
    return super.instantiateItem(container, virtualPosition);
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    int virtualPosition = position % mActualTitleListSize;
    super.destroyItem(container, virtualPosition, object);
}

answer taken from here : ViewPager as a circular queue / wrapping


text:
Q: How could I adjust the text of a column in a table? first of all I want to thank you for the help that you given to me.
In the table that I made, I would like to adjust the width of the vertical text (shown in the pic.) so that It looks shorter. (Idk how to say in English, I hope you understand).
 \begin{table}[ht!]
    \small
   \centering
     \begin{tabular}{lllcccccccccccc}
     \textcolor[rgb]{ .329,  .51,  .208}{\textbf{Nombres}} & \textcolor[rgb]{ .329,  .51,  .208}{\textbf{Ap. Paterno}} & \textcolor[rgb]{ .329,  .51,  .208}{\textbf{Ap. Materno}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Organización, estructura y actividad celular}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Procesos y funciones vitales}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Biología humana y salud}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Herencia y evolución}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Organismo y ambiente}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Ondas}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Mecánica}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Energía}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Macrocosmos y microcosmos}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Estructura Atómica}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Química Orgánica}}} & \rotatebox[origin=lb]{90}{\textcolor[rgb]{ .329,  .51,  .208}{\textbf{Reacciones Químicas y Estequiometría}}} \\
         \hline
     \rowcolor[rgb]{ .886,  .937,  .855} \textcolor[rgb]{ .329,  .51,  .208}{Vicente Joaquin } & \textcolor[rgb]{ .329,  .51,  .208}{Chamorro} & \textcolor[rgb]{ .329,  .51,  .208}{Carrizo} & \textcolor[rgb]{ .329,  .51,  .208}{57\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{57\%} & \textcolor[rgb]{ .329,  .51,  .208}{20\%} & \textcolor[rgb]{ .329,  .51,  .208}{33\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{64\%} & \textcolor[rgb]{ .329,  .51,  .208}{60\%} & \textcolor[rgb]{ .329,  .51,  .208}{30\%} \\
     \textcolor[rgb]{ .329,  .51,  .208}{Vicente} & \textcolor[rgb]{ .329,  .51,  .208}{Donoso} & \textcolor[rgb]{ .329,  .51,  .208}{Vergara} & \textcolor[rgb]{ .329,  .51,  .208}{43\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{43\%} & \textcolor[rgb]{ .329,  .51,  .208}{60\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{25\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{9\%} & \textcolor[rgb]{ .329,  .51,  .208}{20\%} & \textcolor[rgb]{ .329,  .51,  .208}{39\%} \\
     \rowcolor[rgb]{ .886,  .937,  .855} \textcolor[rgb]{ .329,  .51,  .208}{Diego} & \textcolor[rgb]{ .329,  .51,  .208}{Herrera} & \textcolor[rgb]{ .329,  .51,  .208}{Mureno} & \textcolor[rgb]{ .329,  .51,  .208}{57\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{57\%} & \textcolor[rgb]{ .329,  .51,  .208}{40\%} & \textcolor[rgb]{ .329,  .51,  .208}{33\%} & \textcolor[rgb]{ .329,  .51,  .208}{25\%} & \textcolor[rgb]{ .329,  .51,  .208}{33\%} & \textcolor[rgb]{ .329,  .51,  .208}{36\%} & \textcolor[rgb]{ .329,  .51,  .208}{50\%} & \textcolor[rgb]{ .329,  .51,  .208}{35\%} \\
     \textcolor[rgb]{ .329,  .51,  .208}{Nicolás} & \textcolor[rgb]{ .329,  .51,  .208}{Urmeneta} & \textcolor[rgb]{ .329,  .51,  .208}{Gompertz} & \textcolor[rgb]{ .329,  .51,  .208}{29\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{14\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{67\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{67\%} & \textcolor[rgb]{ .329,  .51,  .208}{27\%} & \textcolor[rgb]{ .329,  .51,  .208}{20\%} & \textcolor[rgb]{ .329,  .51,  .208}{43\%} \\
     \rowcolor[rgb]{ .886,  .937,  .855} \textcolor[rgb]{ .329,  .51,  .208}{Joaquín} & \textcolor[rgb]{ .329,  .51,  .208}{Vera} & \textcolor[rgb]{ .329,  .51,  .208}{Sepúlveda} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{100\%} & \textcolor[rgb]{ .329,  .51,  .208}{43\%} & \textcolor[rgb]{ .329,  .51,  .208}{40\%} & \textcolor[rgb]{ .329,  .51,  .208}{17\%} & \textcolor[rgb]{ .329,  .51,  .208}{25\%} & \textcolor[rgb]{ .329,  .51,  .208}{0\%} & \textcolor[rgb]{ .329,  .51,  .208}{9\%} & \textcolor[rgb]{ .329,  .51,  .208}{30\%} & \textcolor[rgb]{ .329,  .51,  .208}{30\%} \\
     \hline
     \end{tabular}%
 \end{table}%

A: Something like this? Note that I've also (a) replaced the multitude of \textcolor statements with a single \color statement and (b) switched the column types of the final 8 columns from c to r.
I had to make quite a few guesses about the document class, the main document font size, and the width and height of the textblock in use in your document. If these guesses are wildly wrong, do please let me know.

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{rotating,ragged2e,array}
\newcommand{\mybox}[1]{\parbox[b]{4.5cm}{\RaggedRight\bfseries #1}}
\newcommand\vertbox[1]{\rotatebox[origin=lb]{90}{~\mybox{#1}}}

\begin{document}

\begin{sidewaystable}
\setlength\extrarowheight{2pt} % for a more open "look"
\small
\centering
\color[rgb]{ .329,  .51,  .208} % we need just 1 \color statement
\begin{tabular}{ lll *{12}{r} }
\bfseries Nombres &
\bfseries Ap.\ Paterno &
\bfseries Ap.\ Materno
& \vertbox{Organización, estructura y actividad celular}
& \vertbox{Procesos y funciones vitales}
& \vertbox{Biología humana y salud}
& \vertbox{Herencia y evolución}
& \vertbox{Organismo y ambiente}
& \vertbox{Ondas}
& \vertbox{Mecánica}
& \vertbox{Energía}
& \vertbox{Macrocosmos y microcosmos}
& \vertbox{Estructura Atómica}
& \vertbox{Química Orgánica}
& \vertbox{Reacciones Químicas y Estequiometría} \\
\hline
\rowcolor[rgb]{ .886,  .937,  .855}
Vicente Joaquin & Chamorro & Carrizo &
57\% & 0\% & 100\% & 0\% & 57\% & 20\% & 33\% & 0\% & 100\% & 64\% & 60\% & 30\% \\
Vicente & Donoso & Vergara &
43\% & 0\% & 0\% & 0\% & 43\% & 60\% & 0\% & 25\% & 0\% & 9\% & 20\% & 39\% \\
\rowcolor[rgb]{ .886,  .937,  .855}
Diego & Herrera & Mureno &
57\% & 0\% & 100\% & 0\% & 57\% & 40\% & 33\% & 25\% & 33\% & 36\% & 50\% & 35\% \\
Nicolás & Urmeneta & Gompertz &
29\% & 0\% & 0\% & 0\% & 14\% & 0\% & 67\% & 0\% & 67\% & 27\% & 20\% & 43\% \\
\rowcolor[rgb]{ .886,  .937,  .855}
Joaquín & Vera & Sepúlveda &
100\% & 100\% & 100\% & 100\% & 43\% & 40\% & 17\% & 25\% & 0\% & 9\% & 30\% & 30\% \\
\hline
\end{tabular}
\end{sidewaystable}
\end{document}

A: *

*With use of the makecell package (for rotating cells in column headers)

*Exploit \rowcolors from xcolor package
add ~% to column definitions (`r<{\%}

*The width of your table is greater than text width. To fit in text area you have two possibilities:

*

*further reduce font size (to \scriptsize) or

*rotate tale as suggest @Mico in his nice answer

\documentclass[12pt]{article}
\usepackage[a4paper,margin=2.5cm,showframe]{geometry}
\usepackage[spanish]{babel}
\usepackage[table]{xcolor}
\usepackage{rotating}
\usepackage{makecell}   % <--- new
\renewcommand{\theadfont}{\footnotesize\bfseries} % <--- new
\renewcommand{\theadgape}{}                       % <--- new
\newcommand\mcrh[1]{\multicolumn{1}{l}{\rothead{#1}}} % <--- new

\begin{document}

\begin{sidewaystable}
\setlength\extrarowheight{2pt} % for a more open "look"
\small
\centering
\settowidth\rotheadsize{\theadfont Organización, estructura} % <--- new
\color[rgb]{ .329, .51, .208} % we need just 1 \color statement
\definecolor{rowgreen}{rgb}{.886, .937, .855}                % <--- new
\rowcolors{1}{white}{rowgreen}                               % <--- new
\begin{tabular}{lll *{12}{ r<{\%} } }                        % <--- changed
\mcrh{Nombres}
    & \mcrh{Ap. Paterno}
    & \mcrh{Ap. Materno}
    & \mcrh{Organización, estructura y actividad celular}
    & \mcrh{Procesos y funciones vitales}
    & \mcrh{Biología humana y salud}
    & \mcrh{Herencia y evolución}
    & \mcrh{Organismo y ambiente}
    & \mcrh{Ondas}
    & \mcrh{Mecánica}
    & \mcrh{Energía}
    & \mcrh{Macrocosmos y microcosmos}
    & \mcrh{Estructura Atómica}
    & \mcrh{Química Orgánica}
    & \mcrh{Reacciones Químicas y Estequiometría} \\
    \hline
Vicente Joaquin & Chamorro  & Carrizo
    & 57 & 0 & 100 & 0 & 57 & 20 & 33 & 0 & 100 & 64 & 60 & 30 \\
Vicente         & Donoso    & Vergara
    & 43 & 0 & 0 & 0 & 43 & 60 & 0 & 25 & 0 & 9 & 20 & 39 \\
Diego           & Herrera   & Mureno
    & 57 & 0 & 100 & 0 & 57 & 40 & 33 & 25 & 33 & 36 & 50 & 35 \\
Nicolás         & Urmeneta  & Gompertz
    & 29 & 0 & 0 & 0 & 14 & 0 & 67 & 0 & 67 & 27 & 20 & 43 \\
Joaquín         & Vera      & Sepúlveda
    & 100 & 100 & 100 & 100 & 43 & 40 & 17 & 25 & 0 & 9 & 30 & 30 \\
    \hline
\end{tabular}
\end{sidewaystable}
\end{document}


text:
Q: Function vs new Function What si difference between calling Function constructor with new and without it in front of keyword Function.
 var result = Function('a', 'b', 'return a + b');
 var myResult = new Function('a','b', 'return a + b');

I know about new operator and that it:
Create a blank, plain JavaScript object
Links (sets the constructor of) this object to another object;
....
But that is make sanse in this situation with constructor function
 function Car(make, model, year) {
    this.make = make;
    this.model = model;
    this.year = year;
}

 const car1 = new Car('Eagle', 'Talon TSi', 1993);

I know that in this situation each time new car instance will be crated.
But in above example what is difference between result and myResult?
Please give me a little bit better explanation.

A: There is no difference. The function constructor looks (more or less) like this:
 function Function(...args) {
   if(!(this instance of Function)) {
      return new Function(...args); // your first call ends up here, so it's like your second
   }
   // ... further magic
 }

So no matter wether you call or construct Function, a new function object gets created and returned, the same way a car object gets created when you contruct Car.

A: result = function(){};

Places a reference to an anonymous function into result. result points to a function.
myResult = new function(){};

Places a reference to a newly constructed instance of an anonymous constructor function into myResult. myResult points to an object.


text:
Q: Possible to extend /DEV/SDB1 on Centos machine without downtime/data loss? on CentOS6 I would like to extend /dev/sdb1 to get more free space:

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_www-lv_root
                       18G  2.9G   14G  18% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             477M  105M  347M  24% /boot
/dev/sdb1             296G  233G   48G  84% /sqldata

The physical harddisk SDB has already been extended to 600GB in VMWare. Fdisk /dev/sdb1 as follows:

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000021cd
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        2611    20458496   8e  Linux LVM
Disk /dev/sdb: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x07acc91f
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       39162   314568733+  83  Linux
/dev/sdb2           39163       78325   314576797+  8e  Linux LVM
Disk /dev/mapper/vg_www-lv_root: 18.9 GB, 18865979392 bytes
255 heads, 63 sectors/track, 2293 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_www-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

As you can probably see, /dev/sdb1 is not part of a volume group. So i'm not sure how to proceed.
I already created a new partition: /dev/sdb2 as linux LVM:

fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): p
Disk /dev/sdb: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x07acc91f
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       39162   314568733+  83  Linux
/dev/sdb2           39163       78325   314576797+  8e  Linux LVM

/dev/sdb2 is a new (empty) partition containing the new 300gb of diskpace. As I cannot affort any downtime really I would like to know how to "merge" sdb1 and sdb2 so I end up with a /sqldata of approx 600gb.
Thanks!

A: Downtime is very likely required in this environment, a single partition.
EL6 docs warn you to not attempt a resize on a device in use. Stop everything using this file system, unmount it, and alter its partition table.
EL7 makes resizing partitions online possible, by deleting, re-creating, and the partx --update trick to tell the kernel. You would need to upgrade first, probably to EL8.

With LVM instead of partitions, this can be easier. Skip partitioning completely. Create physical volumes on entire devices, such as /dev/sdb. Resize the disk, then the PV using it with pvresize.  As you are not using LVM, this would be a migration to new LVM storage.


text:
Q: Is it possible to identify what sticker was assigned to your iMessage Extension? We need to implement iMessage application with the possibility to assign ratings to the messages. Are there any possible way to do it with stickers?
Does iMessage extensions API allow to identify what sticker has been assigned to the sent message? If so are there are any limitation - about that the sticker must be the part of the same application or your extension can identify stickers from other extension.


text:
Q: MC33926 Motor Control Feedback Reporting Too High I'm using an MC33926 motor controller that has a feedback pin which current mirrors the motor current.  According to the data sheet the mirror is 0.24% of the actual current, so the FB pin should reflect 14mA when the motor is drawing 6A.
I have it going to ground via a 270 ohm resistor, and connected to the ADC input of a PIC18F45K40.
The motor is unloaded, and my power supply indicates the total circuit current jumps 500mA when the motor is operating.
The datasheet indicates that at 500mA the FB pin should be pushing about 0.775mA.  With a 270ohm load to ground the pin should be at 0.21V.
However, the pin is actually reading about 3.9V, indicating that the motor controller is pushing 14mA - or max scale 6A - through the FB pin.
Hooking up an oscilloscope to the FB pin shows some amount of jitter, but I'm not using PWM - I'm just setting IN1 high and IN2 low and letting the motor run.
I've verified that the resistor is 270 ohms with a multimeter, and that the FB pin, with the resistor load, is 3.9V when the motor is only consuming 500mA.
What am I missing, or what should I look at next to debug this issue?
The attached PIC18 is running at 3.3v, the motor controller at 12v.  Here's the motor controller circuit:

Note that the TP3 test point is grounded, so the chip is enabled (and the motor does run).  TP2 and TP1 are left floating, which turns slew to slow, and turns off input inversion.  The FB net goes directly to a PIC18 pin, and does react to motor current when running, just not at the scale I expect.
I'm hoping I'm just missing something stupid obvious and I can move on.
Also, note that this is a custom PCB, hand assembled, so if this is a symptom of a mechanical/electrical issue feel free to offer suggestions towards that end as well. I can tell you that all the pins are visibly wetted with solder, and there are no shorts from pins to any other pin or ground except by design. I've also assembled three of these units and they all exhibit the same behavior.  I haven't tested the fault output, but since the motor is running the controller isn't in fault mode.
EDIT:
I measured a few more parameters:

*

*Current at the motor: 588mA

*Ripple at motor: 200mVpp, 444Hz

A: A PCB manufacturing error caused this issue, R6 was unconnected to ground, so the motor controller was trying to force 1mA through the high impedance ADC, and the protection diodes on the chip shunted it to VCC, preventing damage by limiting it to 3.9V, and overflowing the ADC reading.
For the curious, the PCB error appears to be a manufacturing artifact.  The gerbers show R6 connected to a via (which is ground on the bottom layer), but the production PCB appears to have all the copper around that terminal removed.  I have a support request in with the PCB manufacturer, but my guess is they either automatically or manually removed the copper to avoid floating copper in the manufacturing process, but did so too aggressively.
There are marks suggesting an electrical test was done, however my guess is that it's operating based on the manufacturer's adjusted gerber rather than the original.

A: If you measure the current draw from 12v PSU, then this may be a problem. Measure the motor current. The IC has a chopper as current limiter, so it actually works as buck converter.


text:
Q: How do I create a "delete" actionsheet in xcode? How do I create a delete confirmation like the one shown below?

A: You need to use UIActionSheet.
You can create an ActionSheet like this
UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                initWithTitle:@"YOUR_ACTION_SHEET_TITLE"
                                delegate:self
                                cancelButtonTitle:@"Cancel"
                                destructiveButtonTitle:@"Erase Iphone"
                                otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];//If you are not using ARC

You need to implement UIActionSheetDelegate method
- (void)actionSheet:(UIActionSheet *)actionSheet
            clickedButtonAtIndex:(NSInteger)buttonIndex{

    if (buttonIndex == 0){
       //do your action
    }else if(buttonIndex == 1){
      // do your other action
    }
}

A: That is an instance of a UIActionSheet. The red button is called the "destructive button" and the black button, the "cancel button".
Here is a demo:
UIActionSheet *actSheet = [[UIActionSheet alloc] initWithTitle:@"The text to show on top. (Like the message about wiping the phone.)"delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete everything" otherButtonTitles:nil];
[actSheet ShowFromToolbar:self.toolbar];
[actSheet release];

A: If you want the same as shown in photo along with other button use the below UIActionSheet blog tutorial and if you want just standalone button follow the below SO post
How can I create a big, red UIButton with the iPhone SDK?

A: Use InterfaceBuilder (or the equivalent editors in xCode4) to create the view. Write your view controller. Then animate the view to slide in from below using Core Animation.


text:
Q: Nested Partials and Object References in AngularJS I have a partial view that looks like:

when the users clicks a button I have a controller method that resets the activeItem
 $scope.showDetails = function(item){
        $scope.activeItem = item;
 };

with activeItem looking like:
{  name: "Candy", typeOf: "text" }

it works as expected the first time, but every time after that the active item in the nested partial is never updated.  Likely because the reference onload was never updated.  What is the 'right' way to handle this in angular?

A: Always use a reference to facilitate AngularJS to track the change via prototype. This is the nature of Javascript. Try this approach:
$scope.activeItem = {};
$scope.activeItem.values = {
    name: "Candy0",
    typeOf: "text0"
}

$scope.showDetails = function (item) {
    $scope.activeItem.values = item;
}

In the view
{{item.values.name}}


text:
Q: Bootstrap 3 Full screen Collapsible Navigation I'm trying to get Bootstrap 3's collapsable nav to open full screen and  centre it horizontally and vertically with a black background (taking up the full height and width of the screen) positioned behind the navigation links. I've managed to horizontally align the content using margin:auto but i'm unable to vertically align it. I've tried using display:table and vertically-align:middle, but to no avail.
Js fiddle - http://jsfiddle.net/graphixwizardMattzpp/4VSmp/
The Html as follows...

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

</button>

Fashion

Beauty

Advertising

Portraiture

Motion

and the CSS -
.nav.navbar-nav {
float: none;
margin-left: auto;
margin-right: auto;
}

.navbar-nav {
margin-left: auto;
margin-right: auto;
}

.navbar-nav {
float: none!important;
font-size: 49px;
line-height: 43px;
letter-spacing: 3px;
text-transform: uppercase;
text-align: center;
}

.navbar-nav>li {
float: none;
}

.navbar-inverse {
background-color: transparent;
border-color: transparent;
}

.navbar-inverse .navbar-toggle:hover, .navbar-inverse .navbar-toggle:focus {
background-color: transparent;
}

.navbar-inverse .navbar-toggle {
border-color: transparent;
}

.navbar-toggle {
display: block;
float: none;
top: 52px;
left: 125px;
color: #FFF;
}

.nav>li{
display:block;
overflow: visible;
}

.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:hover,    .navbar-inverse .navbar-nav>.active>a:focus {
color: #FFF;
background-color: transparent;
}

.collapsing {
opacity: 0;
transition:opacity 0.3s linear;
 -webkit-transition:opacity 0.3s linear;
 -moz-transition:opacity 0.3s linear;
 -o-transition:opacity 0.3s linear;

}

.navbar-collapse.collapse.in{
opacity:0;
transition:opacity 0.3s linear;
 -webkit-transition:opacity 0.3s linear;
 -moz-transition:opacity 0.3s linear;
 -o-transition:opacity 0.3s linear;
}

.navbar-collapse.collapse{
opacity: 1;
transition:opacity 0.3s linear;
 -webkit-transition:opacity 0.3s linear;
 -moz-transition:opacity 0.3s linear;
 -o-transition:opacity 0.3s linear;
}

.navbar-collapse {
width: 100%;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
margin-top: 65px;
height: auto !important;
font-family: "aktiv-grotesk-std";
font-weight: 400;
line-height: 54px;
font-size: 60px;
display: block !important;
margin-left: auto;
margin-right: auto;
}

Any ideas or approach ?
I thank you all in advance.


text:
Q: Irregular polygons with non-equal integer side lengths and diagonals It is easy to construct a quadrilateral in which all sides, and all diagonals, have integer lengths. Just take a rectangle with integer sides a & b, such that a^2 + b^2 = c^2 (where c is also an integer).
It is not as obvious how to construct a quadrilateral with non-equal integer side and diagonal lengths. However, such a quadrilateral can be constructed, using similar right-angle triangles.
A quadrilateral ABCD (with centre O) is divided by it's diagonals (AC and BD) into four triangles (ABO, BCO, CDO and DAO). Let the diagonals intersect each other perpendicularly. Simply select any two pythagorean triplets, for instance (3,4,5) and (5,12,13). Now construct triangles DAO and BCO to be similar - each a 3-4-5 triangle, with DAO multiplied by 5 and BCO by 12. ABO and CDO are now similar right angle triangles too - each is a 5-12-13 triangle, with ABO multiplied by 3 and CDO by 4.

We now have a quadrilateral with non-equal integer sides (39, 60, 52, 25) and diagonals (56 and 63). Infinite such polynomials exist.
My question: is it possible to construct polynomials of higher order, with the same property - that is, all sides and all diagonals (a connection between a vertex and any other non-adjacent vertex) are integer lengths? If so, how? If not, why not?
For instance, consider this attempt with a pentagon. The pentagon was created by taking a rectangle, AB, and slicing a right-angle triangle off one corner (the non-hypotenuse sides of this triangle, C and D, are shown in red). The pentagon's five diagonals are shown in blue.

By choosing A and B to be part of a pythagorean triplet, and C and D to be part of another, we ensure that the pentagon's 5 sides have integer side lengths, and one integer diagonal (a^2 + b^2). We can ensure that two more diagonals have integer lengths, using the same trick as described with the quadrilateral above: Let A = 3*12, B = 4*12, C=4*5, D=3*5. Now A and D are also part of a pythagorean triplet (hence their deiagonal is an integer), as are C and B.
All that remains is to ensure that two diagonals are integers: that sqrt(A^2 + (B-D)^2) and sqrt(B^2+(A-C)^2) are integers. But I haven't yet been able to construct such a pentagon. Any ideas, or a proof of impossibility?

A: It is possible to get as many points in the plane as you wish, each at an integer distance from all the others, provided they all lie on a line or all lie on a circle. If you forbid three-on-a-line and four-on-a-circle, then it is known how to get seven points in the plane, each at an integer distance from the others, but it is not known whether one can get eight. See Points at integer distance

A: I have found isosceles triangles, pyramids, quadrilaterals, and pentagons by matching sides of primitive Pythagorean triples. Here are 2 samples. I have drawn no picture of the pentagon as of yet.


text:
Q: Jquery Sortable

I am learning jquery , and I am eager to learn more about it, I read a tutorial out there on how to save jquery sortable , But i need a code where i can delete a item and have it saved using php.
I am able to make it work for one where i posted id of one particular sortable and deleted , i read about each and tried but failed :) so for more than one(automatic) it is getting troublesome for me, as i need to have id or something to save deleted in database,
I seem to be lost direction, some help can really help me sharpen my skills.
Js Fiddle Here

A: Hi have a look there if it does as you wish.
K


text:
Q: Named parameter in JPQL I am writing a JPQL query. There is a having clause .
"HAVING COUNT(TC.id) = 5"
But now it turned out that instead of 5 in a special case I have to compare it to 4. So the query would be
"HAVING COUNT(TC.id) = 4"
Of course I do not want to duplicate code. So what I thought I introduce a variable. Like this.
Page funk(@Param("number")Integer number);
So now my query would look like
"HAVING COUNT(TC.id) = number"
But somehow JPQL does not support this. What should I do .


text:
Q: On what timescale does gravitational wave emission circularise an orbit? Gravitational waves remove both energy and angular momentum from a binary orbit. Both rates are enhanced in non-circular (eccentric) orbits and I presume that (like tidal friction) the net effect will be to circularise the orbits over time.
But is there a handy formula for the circularisation timescale and is it always (or never?) shorter than the timescale for merger?

A: I have not seen any nice formula in the literature yet. There are some with baroque rational powers, though. At least for point masses circularisation may not happen fast enough to matter, surprisingly enough.
Peters, P. C., & Mathews, J. (1963). Gravitational radiation from point masses in a Keplerian orbit. Physical Review, 131(1), 435. gives a formula for the average power loss over one period of a Keplerian orbit as $$\langle P \rangle = \frac{32}{5}\frac{G^4}{c^5}\frac{m_1^2m_2^2(m_1+m_2)}{a^5(1-e^2)^{7/2}}\left(1+\frac{73}{24}e^2+\frac{37}{96}e^4\right ),$$ noting that it is equivalent to the standard circular orbit formula multiplied by an enhancement factor of $$f(e)=\frac{1+(73/24)e^2+(37/96)e^4}{(1-e^2)^{7/2}}.$$ where $f(0.6)\sim 10, f(0.8)\sim 100, f(0.9)\sim 1000$. So we should expect circularisation to happen on a timescale less than $1/f(e)$ of the normal energy loss timescale.
Peters then went on analysing the decay rate of eccentricity over time in Peters, P. C. (1964). Gravitational radiation and the motion of two point masses. Physical Review, 136(4B), B1224 as $$\left\langle \frac{de}{dt}\right\rangle = -\frac{304}{15}\frac{G^2}{c^5}\frac{m_1m_2(m_1+m_2)}{a^4(1-c^2)^{5/2}}e\left(1+\frac{121}{304}e^2\right)$$ which can be combined with his expression for $\langle da/dt\rangle$ to get an equation for $\langle da/de\rangle$ and $$a(e)=\frac{c_0 e^{12/19}}{1-e^2}\left (1+\frac{121}{304}e^2\right )^{870/2299}$$ where $c_0$ is determined by the initial condition.

An eccentric system loses a lot of angular momentum until the eccentricity is $<0.5$ and then things level out - but to get rid of the last few percent eccentricity the semi-major axis has to shrink a lot more.
Peters then calculates the lifetime for a system starting at $a_0,e_0$ as $$T(a_0,e_0)=\frac{12}{19}\frac{c_0^4}{\beta}\int_0^{e_0}\frac{e^{29/19}\left(1+\frac{121}{304}e^2\right )^{1181/2299}}{(1-e^2)^{3/2}} de$$ where $\beta=(64/5)(G^4/c^5)m_1m_2(m_1+m_2)$.

The result, compared to a circular system, is that initially eccentric systems have lifetimes that actually are shorter roughly like the $f(e)$ factor: they radiate away so much energy by being in eccentric orbits that the reduction in eccentricity doesn't have the time to "take" before final infall.
However, this is all for point masses. Tidal effects will also allow spin-up and dissipation in actual objects, like in this paper on white dwarfs near black holes.  This numerical paper found that black hole pairs in-spiralling over just 9 orbits with $e\leq 0.8$ circularised by merger time, so the process looks very fast in the more extreme cases.


text:
Q: glStencilOp -- GL_INCR_WRAP GL_DECR_WRAP. stencil mask behaviour OpenGL documentation for glStencilOp isn't clear on what happens for increment and decrement operations in the presence of stencil masks.  It seems to imply that the mask will be ignored for increment and decrement operation.
Can anyone confirm/refute that?
Thanks

A: The mask will not be ignored. Instead, the increment or decrement operation is performed as though there was no mask, but the only bits in the stencil buffer that will be set to the incremented value are those allowed by the mask.


text:
Q: ManifestPlaceholders for multiple elements with same variable In my AndroidManifest.xml file I have the following line:
<supports-gl-texture android:name="${supportedTexture}" />

I inject the correct supported texture in gradle file based on the selected flavor, for example like this:
productFlavors {
    ETC1 {
        manifestPlaceholders = [supportedTexture: "GL_OES_compressed_ETC1_RGB8_texture"]
    }
}

However, this doesn't work if I want to add several supports-gl-texture lines in the manifest. So how should I edit AndroidManifest.xml and build.gradle file if I'd like to have multiple supportedTextures like this:
<supports-gl-texture android:name="GL_OES_compressed_ETC1_RGB8_texture" />
<supports-gl-texture android:name="GL_AMD_compressed_ATC_texture" />

Would it be possible to do something like this in gradle file:
productFlavors {
    ETC1 {
        manifestPlaceholders = [supportedTexture: "GL_OES_compressed_ETC1_RGB8_texture"]
    }
    ETC1andATC {
        //manifestPlaceHolders = ???
    }
}

Or is my only option to go outside gradle and have for example multiple Manifest files which I copy to project depending on gradle flavor?

A: If you have limited numbers of supported textures then you can define multiple keys for all those textures and use in the manifest file.
productFlavors {
    ETC1 {
        manifestPlaceholders = [
        supportedTexture1: "GL_OES_compressed_ETC1_RGB8_texture",
        supportedTexture2: "GL_AMD_compressed_ATC_texture"]
    }
}

Then in your manifest
<supports-gl-texture android:name="${supportedTexture1}" />
<supports-gl-texture android:name="${supportedTexture2}" />