text:
Q: No mapping found for HTTP request with URI in DispatcherServlet with name 'dispatcher' I'm new to Spring framework. I just started implementing multiaction controller in netbeans. But. I'm getting the above error. I'm pasting my code below. Plz take a look into it and resolve me the issue.
dispatcher-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xsi:schemaLocation="http://www.springframework.org/schema/beans           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="index.htm">indexController</prop>
            </props>
        </property>
    </bean>

    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />

    <bean name="indexController"
          class="org.springframework.web.servlet.mvc.ParameterizableViewController"
          p:viewName="index" />
    <bean name="/*.htm" class="controller.MyController"/>
</beans>

index.jsp:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Hello</title>

Multi Action Controller Example

    Add
    Update
    Remove

MyController.java:
package controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

public class MyController extends MultiActionController {

    public ModelAndView add(HttpServletRequest req, HttpServletResponse resp) throws      Exception {
        System.out.println("Add ma");
        return new ModelAndView("result","message","Add Method Called");
    }

    public ModelAndView update(HttpServletRequest req, HttpServletResponse resp) throws Exception {
        System.out.println("Update ma");
        return new ModelAndView("result","message","Update Method Called");
    }

    public ModelAndView remove(HttpServletRequest req, HttpServletResponse resp) throws Exception {
        System.out.println("Remove ma");
        return new ModelAndView("result","message","Remove Method Called");
    }
}

result.jsp:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Nee Varaatha</title>

Please Show it

    ${message}

A: Try checking your apachelog in the output Window of netbeans and see what's the default mapping of your controller in it, and append that mapping in the index.jsp.
For example in the log you'll find

Mapped URL path [/employee] onto handler '/*.html'

Simply append employee/add.htm in the JSP

A: Have you considered using @Controller annotated classes? Since spring 2.5 annotations are usually preferred.
Here's an example web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<display-name>Example</display-name>

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/example-servlet.xml
    </param-value>

</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

</web-app>

example-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<context:component-scan base-package="controller" />

<mvc:view-controller path="/" view-name="index"/>

<context:annotation-config />

<mvc:annotation-driven />

<mvc:default-servlet-handler/>

<mvc:resources location="/resources/**, classpath:resources" mapping="/resources/**"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

And an example simple controller:
@Controller
public class ExampleController {

    @RequestMapping("/test")
    public String test(Model model) {
            model.addAttribute("message","Test message");
            return "result";
    }
}

Also see the spring reference documentation here


text:
Q: Sort alphabetically an array taken dynamically I have an array obtained from a json, and I want to sort its elements alphabetically.
I have a function that returns me the result of the array:
      $cities = get_cities();

I tried both:
  asort($cities['cities']);
  foreach($cities['cities'] as $rc) { blah blah

and
  foreach(asort($cities['cities']) as $rc) { blah blah

none did not do the sorting.
any idea about where I am wrong?
thanks!

A: Without knowing what your $cities array looks like, it is hard to tell what the problem is.
Have you tried using the just the regular PHP sort function? i.e.
sort( $cities );

A: Sorting by city names could look like
$c = $cities['cities'];
usort($c, function($cityA, $cityB) {
    return strcmp($cityA['name'], $cityB['name']);
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Sync sent emails from Exchange to Gmail I would like to sync my sent items (and the draft) from Exchange to Gmail. Unfortunately I can only enable a POP3 account which sync the inbox only.
Is there a way (this could involve a third-party service) to sync my Exchange account with Gmail?

A: There are other users who have the same issue as you. I'm afraid that finding the correct tool for this may be problematic and you may try the other workarounds mentioned in this thread.


text:
Q: Navigation dots that highlight as you scroll through page - not working I'm using dots on my page to allow the user to navigate to certain sections. When they are clicked they change colour and navigate to that section. I want it so that they change colour as you scroll through the page.
The code snippet below works fine but on my page the dots only change colour if you click them, not when you scroll through the page. I guess this means there's an error with the way I've added it to the page but i'm not sure what this is.

$(document).on("click","a[href^='#']",function(e){
  var href=$(this).attr("href"),target=$(href).parents(".mCustomScrollbar");
  if(target.length){
    e.preventDefault();
    target.mCustomScrollbar("scrollTo",href);
  }
});

$(document).ready(function () {

    $(document).on('scroll', function() {
      var currentPosition = $(this).scrollTop();
      $('.section').each(function() {
        var sectionPosition = $(this).offset().top;
        if(sectionPosition < currentPosition) {
          $('a').removeClass('active');
          $('a[href="#'+$(this).attr('id')+'"]').addClass('active');
        }
      });
    });
    $('a').on('click', function() {
      $('a').removeClass('active');
      $(this).addClass('active');
    });
});
.navbar-nav{
    width: 100%;
    position: fixed;
    top: 0;
}
.navbar-nav li {
  float: left;
  margin-left: 10px;
  list-style: none;
  border-radius: 50%;
  height: 30px;
}
.section {
     height: 200px;
    text-align: center;
    padding: 200px;
}
.nav a.active {
    background-color: red;
}
.navbar-nav li a{
 background-color: transparent;
  border: 1px solid #3D4E58;
  border-radius: 50%;
  cursor: pointer;
  display: block;
  font-size: 0;
  height: 8px;
  line-height: 0;
  outline: medium none;
  padding: 5px;
  position: relative;
  text-indent: -9999px;
  width: 8px;
  margin-bottom: 25px;
}
#home {clear: both;}

.newClass{
    background : red;
    color: #fff;
}

name

name

name

name

name

name

name

name

name

name

name

Our three year strategic plan ends in 2017 so we are busy writing our new one. Kent Union's plan outlines the priorities for our organisation and what we will be working on. It's really important that we get your input into our plan for 2017 - 2020. We are your students' union and improving your student experience here at the University of Kent is what we are here to do.

There are lots of different ways you can get involved in developing our new plan.

Take our survey to tell us how you feel about life at Kent and what you want us to work on

Send us your feedback, on anything you think we need to know

Sign up to take part in a focus group or interview

How we're developing our new plan. We'll keep this section updated, so you can see our progress and what we've found out.

Stage 1: Desk based research to understand all the issues that might affect you. You can read our full report here, or for those of you without an hour to spare we've done a one page version.

Stage 2: Interviews with senior university staff

Stage 3: Large scale survey with all our members

Stage 4: Focus groups and interviews with some of you

Stage 5: Focus groups with secondary school and FE students, to understand their perspectives of studying at University

Stage 6: Presenting our draft plan at AGM in November for your feedback

Stage 7: Presenting our plan to the University of Kent's management team in December

Stage 8: Signing off our plan at our Board of Trustees in March

If you have any questions about how we use our plan or to find out more about us, please contact your full time officer team.


text:
Q: Change resolution - zoom resolution I use a big screen 4K 43", of course the resolution 4K makes everything too small on screen.
On windows, I have a option to zoom all the desktop GUI, normally I use 150%.
Is there a way to do the same on linux? I'm using Ubuntu Studio latest version. I can change the resolution to FHD but than the things are tooooo big.
Thx for any help.


text:
Q: Wait for GET request to have certain variable I'm using POST to submit jobs remotely from my application.  The POST request returns a job ID that I can use a GET request to check the status of.
$http.get('http://localhost:8090/jobs/'+id).then(function successCallback(results) {
    jobResults = results;
}

Only problem is I would like to assign the variable after the job is done, and not right when it just started.  Is there a way to do that?
If it is done, the results look like this:
{
  "duration": "0.171 secs",
  "classPath": "spark.jobserver.WordCountExample",
  "startTime": "2017-02-17T22:47:49.291Z",
  "context": "c4c62dd3-spark.jobserver.WordCountExample",
  "result": {
    "word1": 1,
    "word2": 3
  },
  "status": "FINISHED",
  "jobId": "994569f9-b6a5-40d3-a4b3-f281276c6716"
}

The only difference aside from the status message if it's not done is that the "result" variable is not there.

A: I think your problem is you are trying to find a solution in the wrong place. What i see is that your job is being processed in the backend, so you want to update it in the frontend but you have not the information needed to do that.
So you will have to wirte a process that check the job status for assign the variable when you want to doi it, in this case when the job is finished. You can do it with setInterval for example.
var jobs = [];
setInterval(function () {
  for (var i = 0; i < jobs.lenght; i++) {
    checkJobStatus();
  }
});

A: Please try the below get url.
Consider you get jobId from post request.
$http.get('http://localhost:8090/jobs/:id',{id : jobId}).then(function successCallback(results) {
    jobResults = results;
}


text:
Q: SVG or Canvas for HTML5 browsers? What would be the best method for creating graphs in HTML/JavaScript if the minimum browser support is IE9, Chrome 16, FF 13, Safari 5.1.& Opera 10 ? SVG or Canvas ?
Google Charts ?

A: Going by https://stackoverflow.com/a/1651167/138772 and http://dev.opera.com/articles/view/svg-or-canvas-choosing-between-the-two/:

You should use Canvas for:

*

*Interactive image editing: cropping, resizing, filters (think red eye removal, sepia, colorize, etc.)

*Generating raster graphics: data visualizations, data plots, rendering fractals, function plots.

*Image analysis: read pixels to gather data for histograms, color usage, and anything else you can imagine.

*Rendering game graphics, such as sprites and backgrounds.

  You should use SVG for:

*

*Resolution-independent Web application user interfaces.

*Highly interactive animated user interfaces.

*Data charts and plots.

*Vector image editing.

So basically, use SVG if you want to have nice vectored graphs and the ability to manipulate them via the DOM, but use Canvas if you just want them drawn and don't need the vectoring (you could probably set it up so it would scale to the page/window size, anyway) or DOM usage. Personally I'd recommend SVG, though, as I like vector graphics.


text:
Q: Сколько классов можно создавать во одном файле? Добрый день! Хотел узнать, в java я создаю класс вот так
public class Solution
{

}

По примеру внутри него могу создать еще кучу классов вот так
public static class Mouse
    {
}

Если убрать слово static сразу начинает ругаться. Почему я должен создать только со static? Что такое Static?
A: Отвечаю на вопрос, указанный в заголовке:
Максимальное количество методов и интерфесов, поддерживаемое Виртуальной Машиной Java - 65535.
Источник (Java 8), §4.11, а также Ответ на StackOverflow (Java 7)

Отвечаю (точнее пытаюсь) на вопрос, указанный на странице:
В одном файле может быть только один публичный (public (главный)) класс.
public static class в данном случае говорит, что вложенный класс находится в публичном доступе, то есть доступен из других классов. Убирая static, компилятор думает, что вы пытаетесь в главном классе создать ещё один главный класс, вот он и ругается. Можете оставить только class вместо public static class, на работоспособность не должно повлиять.
P.S. Что-то мне подсказывает, что выше я нёс полную ахинею. Если это так, то пусть другие участники меня поправят :)

A: В одном файле можно создавать больше одного класса!

Главное условие успешной компиляции:
! В одном файле может быть только один public class
Может  быть несколько ситуаций когда в одном файле можно создать несколько классов и это не вызовет ошибку компиляции:
1)  Если не указывать для классов модификатор доступа вообще (оставить по умолчанию), то после компиляции будет создано столько файлов .class сколько вы объявите(без модификатора доступа) в исходном файле .java, при этом ошибки компиляции не возникнет.
2) Можно создавать множество внутренних классов (inner classes) внутри основного.
3) Можно создавать множество статических вложенных классов (static nested classes)
4) Можно создавать множество Внутренних классов-членов (member inner classes), которые бывают  трёх видов:

*

*внутренние классы-члены (member inner classes);

*локальные классы   (local classes);

*анонимные классы (anonymous classes).

5) В одном файле также можно объявлять множество абстрактных классов (abstract classes)

В общем, такая возможность есть! Но хорошим тоном является 1 класс - 1 файл

A: Внутри класса Static не могут быть Статики. Так как статичные данные выгружаются в память.


text:
Q: How to SELECT for Value Mark Characters in TCL? I am doing a SELECT in TCL for UniVerse. I want to see if there are any value marks in a given field. Is there way to represent a value mark character in my TCL SELECT?
I know there are reserved variables in PICK, such as value mark @VM, representing the ASCII 253 character.
I have something like this already:
SELECT SOMEFILE WITH DICT7 = "[SUBSTRING]"

I want something like this using the appropriate reserved word for value marks:
SELECT SOMEFILE WITH DICT7 = "[@VM]"

A: If you just want to test a Field to see if contains any Value Marks, you can do this.
SELECT SOMEFILE WITH EVAL "COUNT(DICT7,@VM)" GT 0


text:
Q: How to get all order ID which not paid in SQL Server 2008? I want to get all order id numbers for selected customer which not paid till now, my data show as following:

What I want is Write a SELECT statement that answers this question:
select orderID
from order
where customer id = @custID
and Total cashmovementValue
        for current order id
    is less than total (sold quantity * salePrice )
        for current order id

How to do it?
Thanks.

A: You need to compare the sum of each order line with the sum of each payment per order. GROUP BY and a few sub-queries is what you need to get the job done.
Something like this should work:
SELECT
    O.OrderID
FROM [Order] O
INNER JOIN (
   -- Add up cost per order
   SELECT
       OrderID,
       SUM(SoldQuantity * P.SalePrice) AS Total
   FROM OrderLine
   INNER JOIN Product P ON P.ProductID = OrderLine.ProductID
   GROUP BY OrderID
) OL ON OL.OrderID = O.OrderID
LEFT JOIN (
    -- Add up total amount paid per order
    SELECT
        OrderID,
        SUM(CashMovementValue) AS Total
    FROM CashMovement
    GROUP BY OrderID
) C ON C.OrderID = O.OrderID
WHERE
    O.CustomerID = @custID
    AND ( C.OrderID IS NULL OR C.Total < OL.Total )

EDIT
I've just noticed you're not storing the sale price on each order line. I've updated my answer accordingly, but this is a very bad idea. What will happen to your old orders if the price of an item changes? It is okay (and actually best practice) to denormalise the data by storing the price at the time of sale on each order line.


text:
Q: How to import and set as working folder on Tortoisesvn I'm new on SVN and tortoise, I googled but can't find the answer. What I want, is to import a local folder into my repository, and bind it, so I can update, check out, etc.
Right now what we do, is to import the a local folder, check-out into a new local folder to bind it, and then, it downloads the previously uploaded content (waste of time). there must be a better way right?
How you can help me thanks!

A: @crashmstr's hint is correct
Sample
Initial conditions:

*

*new empty repository

*some tree
>dir /B /S
z:\Data\file.txt
z:\Data\Sub
z:\Data\Sub\file.txt

Process:

*

*Tree imported into repo
svn import Data file:///Z:/Repo
>svn ls -R -v file:///Z:/Repo
   1 Badger                сен 23 20:35 ./
   1 Badger                сен 23 20:35 Sub/
   1 Badger              6 сен 23 20:35 Sub/file.txt
   1 Badger              6 сен 23 20:35 file.txt

*Repo checkouted to the existing Data-dir
Data>svn co --force file:///Z:/Repo .
E    Sub
E    Sub\file.txt
E    file.txt
Checked out revision 1.

and now it's good Working Copy
Data>svn info
Path: .
Working Copy Root Path: Z:\Data
URL: file:///Z:/Repo
...


text:
Q: Is this the right way to check if a table exists before creating it? IF NOT EXISTS(SELECT * FROM sys.tables
        WHERE [name] = N'MyTableName' AND [object_id] = OBJECT_ID(N'MyDataBaseName'))
BEGIN

CREATE TABLE [dbo].[MyTableName]
(
    [ID] [uniqueidentifier] NOT NULL,
    [FirstName] [nvarchar](300) NULL,
    [LastName] [nvarchar](300) NULL,
    [Index_No] [varchar](50) NULL
)
END

I am using the above T-SQL to check if a table exists in my database and if it does not exist i create. I am however wonder if this is the right way of doing it or is there better recomended approach?

A: There is a logical error in your query, namely the object_id column in sys.tables is not related to the database (it is the table's object_id from the sys.objects catalog view).
OBJECT_ID('DatabaseName') will evaulate to NULL unless there is a table (an object, not just a table) named exactly as the database itself, but in this case, you will retrieve that object's object_id instead of the database's.
Because of the above two reasons, your IF statement will always evaulates to true. (The query will not find any match, so the EXISTS will evaulate to false)
Almazini's answer is a pretty good approach. I recommend to use it.

A: I am using a bit smaller query to do that:
IF OBJECT_ID('tempdb..##Product', 'U') IS  NULL
CREATE TABLE ##Product (DataTypeID INT NULL,
            ProductID INT  NOT NULL,
            CountryCodeID INT NOT NULL)
ELSE TRUNCATE TABLE ##Product;

A: If you have simple creation statements, then condition like
IF OBJECT_ID('dbo.TableName', 'U') IS NULL BEGIN
    ...statements....
END

will be good enough. If your script is more complex, there is another approach:
-- If object exists we disable scripts execution
IF OBJECT_ID('dbo.TableName', 'U') IS NOT NULL SET NOEXEC ON

...you can even create triggers/functions/procedures here...

-- Enable script execution
SET NOEXEC OFF

A: You can also try like this:
IF NOT EXISTS (SELECT * FROM sys.objects WHERE name='MyTableName' AND type='U')
   BEGIN
       CREATE TABLE [dbo].[MyTableName]
       (
        [ID] [uniqueidentifier] NOT NULL,
        [FirstName] [nvarchar](300) NULL,
        [LastName] [nvarchar](300) NULL,
        [Index_No] [varchar](50) NULL
       )
   END


text:
Q: Firestore: pagination without charging twice I want to add some pagination (with listeners) to my collection but for that I need to first get the next n items and them create new listener from the first doc to the last doc.
this operation will make me charged twice - for the get and then, for the unnecessary first listener result.
can we avoid this situation?


text:
Q: Locus of points a fixed distance from a hyperplane I want to specify a subspace of a high dimension Euclidean space. The subspace consists of those points whose closest proximity to a specified hyperplane is a fixed value r.
Here are some examples.
Example 1.
Consider a 3D space, and a line (the hyperplane) running though it. The subspace is the surface of cylinder of radius r whose axis is the line.
Example 2.
Consider a 3D space, and a plane (the hyperplane) running though it. The subspace consists of the two planes parallel to the original one and a distance r from it.
I want this subspace specified in the form of a locus of points. In other words, a set of parameters uniquely specifies any point in the subspace. For instance in example 1, any point in the subspace could be specified by 3 parameters, e.g.

*

*one parameter would specify a point on the line

*r would specify a circle radius r, centred on the point and orthogonal to the line

*theta (an angle) would specify a point on that circle. (You would have to define where theta=zero was and the direction of rotation of theta but I don't think you would need more parameters for that, just the adoption of some convention.)

I've been able to specify a b dimensional hyperplane in a b + c dimensional euclidean space (b < b+c), but am now stuck.
I appreciate any help you can give me.
What about this. One could start with the polar coordinates for a point on a b dimensional sphere. Covert from polar to Cartesian, to express these b parameters as a b-vector in b dimensional Euclidean space. Place the b dimensional sphere in a b + c dimensional Euclidean space. Place it at position zero in each of the c new dimensions. Now add c parameters which are the positions of the b-sphere in the c new dimensions. You have now created a parameterisation for one example of the desired subspace. The c dimensions are the hyperpane. You can then rotate and translate your c+b parameterisation in c+b dimensional space to make it coincide with any specific c dimensional hyperplane. You set the radius of the b-sphere to a specific value. Your final parameterisation has b+c-1 parameters.

A: You could think about stereographic projection: If you have a linear subspace $U$ of dimension $m$ of a Euclidean vector space $V$ of dimension $n$, you could pick a vector in $U^\bot$, call it $w$, and consider (orthonormal) co-ordinates $(x_1,\ldots,x_{n-1})$ on the space $w^\bot$ orthogonal to $w$, chosen such that $(x_1,\ldots,x_m)$ give co-ordinates on $U$. Now apply the inverse stereographic projection map (you can look up the formula I guess) to the co-ordinates $(x_{m+1},\ldots, x_{n-1})$, and leave the variables $x_1,\ldots,x_m$ fixed. That gives you a map from $\mathbb{R}^{n-1}$ to your locus. Unfortunately this is not quite surjective, and misses out a translate of $U$ in the direction $w$. Still, the formulas are nicer than finding spherical co-ordinates I think.
One small point: 'hyperplane' generally refers to a subspace of dimension one less than the ambient vector space.


text:
Q: Save variable from txt using awk I have a txt in my folder named parameters.txt which contains
PP1 20 30 40 60
PP2 0 0 0 0
I'd like to use awk to read the different parameters depending on the value of the first text field in each line. At the moment, if I run
src_dir='/PP1/'
awk "$src_dir" '{ print $2 }' parameters.txt

I correctly get
20

I would simply like to store that 20 into a variable and to export the variable itself.
Thanks in advance!

A: If you want to save the output, do var=$(awk expression):
result=$(awk -v value=$src_dir '($1==value) { print $2 }' parameters.txt)

You can make your command more general giving awk the variable with the -v syntax:
$ var="PP1"
$ awk -v v=$var '($1==v) { print $2 }' a
20
$ var="PP2"
$ awk -v v=$var '($1==v) { print $2 }' a
0

A: You don't really need awk for that. You can do it in bash.
$ src_dir="PP1"
$ while read -r pattern columns ; do
      set - $columns
      if [[ $pattern  =~ $src_dir ]]; then
          variable=$2
      fi
   done < parameters.txt

A: shell_pattern=PP1
output_var=$(awk -v patt=$shell_pattern '$0 ~ patt {print $2}' file)

Note that $output_var may contain more than one value if the pattern matches more than one line. If you're only interested in the first value, then have the awk program exit after printing .


text:
Q: How to install access BIOS with broken screen I have Sony vaio laptop(svf15213snb) around 9 year old. Laptop was completely fine when screen broke and used laptop on external monitor for some time and completely detached internal screen and bazel. Sometime later i formatted its HDD and used somewhere else.
Now i want to use it again but to install any OS on this laptop, i must get into BIOS but can't access BIOS on external display.

*

*I tried to put magnet near hall sensor to trick computer think lead
closed and return bios screen on external monitor but didn't work.

*Also tried to plug bootable USB if anything comes up on screen but no
luck. I'm not sure what to do.

I heard somewhere that Linux can be easily migrate on other machine!! I didn't try this one.

A: If there is a separate F-key to change boot-order only, without entering BIOS/UEFI, that would be a better option when working blind. Some makers, e.g., HP and Toshiba, use F9 or F12, to enter that limited-option screen.
Try booting with a single Down push, and if that doesn't work try with two or three. You can make a bootable USB device, e.g. Ubuntu Desktop Live, once you find the USB boot option, this should load in "user test" mode by pressing Enter after boot-up finishes. Usually, Ubuntu installation media can boot in EFI or in Legacy mode, so you should not need to make a switch in BIOS.
Hopefully, Ubuntu will recognize that a display is connected!


text:
Q: Generating Fractals with transformation matrices I'm trying to generate fractals using five different transformations that I have implemented from skeleton code, translate, rotate, scale, non-uniform scale, and image. These transformations are all 3x3 matrices, for example:
Matrix rotate ( Pt p, float theta )
{
    Matrix rvalue;
    rvalue.data[0][0] = cos(theta);
    rvalue.data[0][1] = -sin(theta);
    rvalue.data[0][2] = p.x + p.y*sin(theta) - p.x*cos(theta);
    rvalue.data[1][0] = sin(theta);
    rvalue.data[1][1] = cos(theta);
    rvalue.data[1][2] = p.y - p.y*cos(theta) - p.x*sin(theta);
    rvalue.data[2][0] = 0;
    rvalue.data[2][1] = 0;
    rvalue.data[2][2] = 1;
    return rvalue;
}

where Matrix is defined as
class Matrix
{
    public:
    float data [ 3 ] [ 3 ];

    Matrix ( void )
    {
        int i, j;

        for ( i = 0; i < 3; i++ )
        {
            for ( j = 0; j < 3; j++ )
            {
                data [ i ] [ j ] = 0;
            }
        }
    }
};

In a test file, there is the following code that is supposed to generate Serpinski's Triangle
vector<Matrix> iat;
iat.push_back ( scale ( Pt ( -.9, -.9 ), 0.5 ) );
iat.push_back ( scale ( Pt ( .9, -.9 ), 0.5 ) );
iat.push_back ( scale ( Pt ( 0, .56 ), 0.5 ) );

setIATTransformations ( iat );

Where Pt is defined as:
class Pt
{
public:
    float x, y;

    Pt ( float newX, float newY )
    {
        x = newX;
        y = newY;
    }

    Pt ( void )
    {
        x = y = 0;
    }
};

How should I implement setIATTransformations? Multiply the matrices until there is one transformation matrix and loop it a number of times to generate the fractal?

A: you want sierpinski triangle or fractal generator driven by input script ?
1.triangle

*

*is easy enough

*no rotations translations or what so ever are needed

*just create the points according to sierpinski rule http://en.wikipedia.org/wiki/Sierpinski_triangle

*all sides of triangles are divided to half

*so the new points are just average of start and end point of each line

*and then fill the sub triangles

*if you want just wire-frame then even the point list is not needed

2.generator

*

*you did not provide any rules,commands for the control script

*the only thing I see in your script is input of the 3 vertexes of the triangle

*and that is all

*I do not see any rule for triangle division

*or which part is filled or not

*how many recursions are used

*the only thing you mentioned was that you use 5 transformation matrices 3x3 for rotation,scale and translation

*but did not specify when and why

A: You will have to implement the chaos game. That is, you randomly select one of the transformations and apply it to the iteration point. Do it a number (30, 50 or 100) without painting the point and after that mark all the points. The resulting point cloud will in time fill the fractal.
Your operation scale( Pt (a,b), s) should realize the operation
(x',y')=s*(x,y)+(1-s)*(a,b), that is, in matrix terms
| x' |   |  s  0  (1-s)*a|   | x |
| y' | = |  0  s  (1-s)*b| * | y |
| 1  |   |  0  0    1    |   | y |


text:
Q: HTML5 audio not supporting android Webview Hi I am using android WebView for playing HTML5 video and audio files. When I am working file from local server "http://myip/kids_sample/Alphabets/A/A_main.html" the file is working good. But when I am trying to play file from my assets folder "file:///android_asset/kids_data/Alphabets/A/A_main.html" it's not working, please help me come out from this.

A: You can use html parse library to get tag & parameters and made your own player on background
1- inject javascript code with function returning doc html
2- wait to onfinish loading
3- call the function from vebview, to get html code,( next javascript inject, aka function(); )
4- get the function result
5- parse html tags, and get attributes
6- made action from tag with parameters


text:
Q: Creation of OAuth User IDs I am just starting the process of learning to access APIs using Python. Initially I presumed OAuth User IDs were generated or supplied by the API owner somehow. Would it actually be fabricated by myself, using alphanumerics and symbols? This is just for a personal project, I wouldn't have a need for a systematic creation of IDs. The APIs I am working with are owned by TDAmeritrade.

A: OAuth is has no capabilities for any type of provisioning of users or credentials.
OAuth 2.0 provides for the Delegation of Authorization

*

*By the Resource Owner (User)

*to the OAuth Client (Application)

*for Access to a Resource Server (Website or Api or ???)


text:
Q: Creating @Autowire like annotation for injecting properties I am using Spring 3 and also heavily utilize the well known @Autowire annotation. I would like to create a new annotation, let's call it @Property that autowires Java properties from set by .property files or vm arguments.
Considering the following class
class A {

    @Property("my.a")
    private int a;
}

if the property my.a is present, the property A.a is set.
Is such an annotation maybe already existing? If not I am aiming to create one, as mentioned above. Are the utilities given by spring to achieve my goal? I think about creating a BeanPostProcessor ...
Thanks for your hints!

A: There's already such an annotation - @Value
You should just define a PropertyPlaceHolderConfigurer, and configure it to resolve system properties.

A: Refer http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/
you can use @ImportResource to import XML configuration files. Then use context:property-placeholder to load properties
@Configuration
@ImportResource("classpath:/com/acme/properties-config.xml")
public class AppConfig {
    private @Value("${jdbc.url}") String url;
    private @Value("${jdbc.username}") String username;
    private @Value("${jdbc.password}") String password;

    public @Bean DataSource dataSource() {
       return new DriverManagerDataSource(url, username, password);
    }
}

properties-config.xml
   <beans>
      <context:property-placeholder location="classpath:/com/acme/jdbc.properties"/>
   </beans>

jdbc.properties
   jdbc.url=jdbc:hsqldb:hsql://localhost/xdb
   jdbc.username=sa
   jdbc.password=

public static void main(String[] args) {
   ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
   TransferService transferService = ctx.getBean(TransferService.class);
   // ...
}


text:
Q: get variable content using another variable inside Please see the code below, the idea is that I need the third line as it is because I declare several input_${k} and fill them with a lot of values (so I iterate over k). I kept it simple for you by isolating 1 variable here and only filling it with '1'. My only problem is that the node.py line does not receive the content of input_1_128 ( here a user input is simulated using <<< ), but
'input_1_128: command not found'. Here I need it to send 1 to the python script.
Can you guys help me please?
declare input_2_128=''
k=1
declare input_${k}_128+='1'
python3 node.py <<< $(input_${k}_128)

Please note that if I write
echo $(input_1_128)

It will show the correct value (1) but I must use the first version (using $k).
I type 'bash myscript.sh' to run the script if that is relevant here.
I thank you all for your help.
Of course do not hesitate to ask for more details

A: First a couple of answers of your original question (indirect and nameref) and what I suggest you do instead (array):

*

*Indirect access with the syntax ${!...}:

$ k=1
$ declare input_${k}_128=1

$ v=input_${k}_128
$ echo ${!v}
1

$ declare input_${k}_128=$((${!v} + 1))
$ echo ${!v}
2

*Nameref:

$ k=1
$ declare input_${k}_128=1

$ declare -n v=input_${k}_128
$ echo $v
1

$ v=$(($v + 1)); echo $v; echo $input_1_128
2
2

*Associate array:

$ declare -A a
$ a[input_${k}_128]=1
$ echo ${a[input_${k}_128]}
1

$ a[input_${k}_128]+=1
$ echo ${a[input_${k}_128]}
11

$ # if you mark the variable an integer you can use += 1
$ declare -i a[input_${k}_128]
$ a[input_${k}_128]+=1
$ echo ${a[input_${k}_128]}
12


text:
Q: sprite.svg not displaying icons when deployed to Heroku but working locally (Django, Heroku, SVG) I am coding a landing page using Django, html, CSS.
I have a sprite.svg file containing different icons(svg drawings which can be accessed using "" for instance).
The sprite.svg file is located in my static file.
When I launch the page on my local server the icons appear with no problem.
When I deploy to heroku the icons are not showing.
Could you please help me with this problem?
The architecture is the following
django project
-----main app
----------settings.py
----------urls.py
-----second app
     -----static
----------css
----------img
---------------sprite.svg
----------js
-----templates
----------secondapp
---------------index.html
-----manage.py
-----Procfile

The settings.py file:
from pathlib import Path
import os
import django_heroku

BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATE_DIR = os.path.join(BASE_DIR, "templates")
STATIC_DIR = os.path.join(BASE_DIR, "static")

DEBUG = True

ALLOWED_HOSTS = [...]

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'main_app',
    'lp001',
    'corsheaders',
    'rest_framework',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    "corsheaders.middleware.CorsMiddleware",
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'leadinsightmarketing.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [TEMPLATE_DIR, ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'leadinsightmarketing.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': '...',
        'HOST': '...',
        'PORT': '...',
    }
}

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    STATIC_DIR,
]

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
    ]
}

CORS_ALLOWED_ORIGINS = [
    ...
]

ACTIVE_CAMPAIGN_URL = '...'
ACTIVE_CAMPAIGN_KEY = '...'

django_heroku.settings(locals())

The sprite.svg file:
<svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-chevron-thin-down" viewBox="0 0 20 20">
<path d="M17.418 6.109c0.272-0.268 0.709-0.268 0.979 0s0.271 0.701 0 0.969l-7.908 7.83c-0.27 0.268-0.707 0.268-0.979 0l-7.908-7.83c-0.27-0.268-0.27-0.701 0-0.969s0.709-0.268 0.979 0l7.419 7.141 7.418-7.141z"></path>
</symbol>
<symbol id="icon-layers" viewBox="0 0 20 20">
<path d="M9.248 11.601c0.45 0.313 1.050 0.313 1.5 0l9.088-5.281c0.236-0.164 0.21-0.518-0.048-0.646l-9.205-3.537c-0.368-0.183-0.802-0.183-1.17 0l-9.205 3.537c-0.258 0.127-0.284 0.482-0.048 0.646l9.088 5.281zM19.788 10.811l-2.486-1.233-5.725 3.327c-0.469 0.309-1.014 0.471-1.579 0.471s-1.11-0.163-1.579-0.471l-5.721-3.329-2.49 1.234c-0.258 0.128-0.284 0.482-0.048 0.646l9.088 6.309c0.45 0.313 1.050 0.313 1.5 0l9.088-6.309c0.236-0.163 0.21-0.517-0.048-0.645z"></path>
</symbol>
<symbol id="icon-address" viewBox="0 0 20 20">
<path d="M19.799 5.165l-2.375-1.83c-0.135-0.093-0.324-0.176-0.521-0.237-0.198-0.061-0.403-0.098-0.567-0.098h-6.836l0.801 5h6.035c0.164 0 0.369-0.037 0.566-0.098s0.387-0.145 0.521-0.236l2.375-1.832c0.135-0.091 0.202-0.212 0.202-0.334s-0.067-0.243-0.201-0.335zM8.5 1h-1c-0.276 0-0.5 0.224-0.5 0.5v3.5h-3.336c-0.166 0-0.37 0.037-0.567 0.099-0.198 0.060-0.387 0.143-0.521 0.236l-2.375 1.83c-0.135 0.091-0.201 0.213-0.201 0.335s0.066 0.242 0.201 0.335l2.375 1.832c0.134 0.091 0.323 0.175 0.521 0.235s0.401 0.098 0.567 0.098h3.336v8.5c0 0.276 0.224 0.5 0.5 0.5h1c0.276 0 0.5-0.224 0.5-0.5v-17c0-0.276-0.224-0.5-0.5-0.5z"></path>
</symbol>
<symbol id="icon-bell" viewBox="0 0 20 20">
<path d="M14.65 8.512c-2.28-4.907-3.466-6.771-7.191-6.693-1.327 0.027-1.009-0.962-2.021-0.587-1.010 0.375-0.143 0.924-1.177 1.773-2.902 2.383-2.635 4.587-1.289 9.84 0.567 2.213-1.367 2.321-0.602 4.465 0.559 1.564 4.679 2.219 9.025 0.607s7.086-4.814 6.527-6.378c-0.765-2.145-2.311-0.961-3.272-3.027zM10.924 16.595c-3.882 1.44-7.072 0.594-7.207 0.217-0.232-0.65 1.253-2.816 5.691-4.463s6.915-1.036 7.174-0.311c0.153 0.429-1.775 3.116-5.658 4.557zM9.676 13.101c-2.029 0.753-3.439 1.614-4.353 2.389 0.643 0.584 1.847 0.726 3.046 0.281 1.527-0.565 2.466-1.866 2.095-2.904-0.005-0.013-0.011-0.023-0.016-0.036-0.251 0.082-0.508 0.171-0.772 0.27z"></path>
</symbol>
<symbol id="icon-compass" viewBox="0 0 20 20">
<path d="M5.454 14.548c0 0 4.568-0.627 6.518-2.576s2.576-6.518 2.576-6.518-4.569 0.627-6.518 2.576-2.576 6.518-2.576 6.518zM9.017 9.015c0.818-0.818 2.385-1.4 3.729-1.762-0.361 1.342-0.945 2.92-1.76 3.732-0.543 0.545-1.426 0.545-1.969 0-0.545-0.543-0.545-1.425 0-1.97zM10.001 0.4c-5.303 0-9.601 4.298-9.601 9.6 0 5.303 4.298 9.601 9.601 9.601 5.301 0 9.6-4.298 9.6-9.601s-4.299-9.6-9.6-9.6zM10 17.6c-4.197 0-7.6-3.402-7.6-7.6 0-4.197 3.402-7.6 7.6-7.6 4.197 0 7.601 3.402 7.601 7.6 0 4.197-3.404 7.6-7.601 7.6z"></path>
</symbol>
<symbol id="icon-credit" viewBox="0 0 20 20">
<path d="M11 16.755v2.245h-2v-2.143c-1.712-0.1-3.066-0.589-4.241-1.797l1.718-1.74c0.859 0.87 2.023 1.16 3.282 1.16 1.565 0 2.405-0.599 2.405-1.702 0-0.483-0.133-0.889-0.42-1.16-0.267-0.251-0.572-0.387-1.202-0.483l-1.642-0.232c-1.164-0.174-2.022-0.541-2.634-1.141-0.648-0.657-0.973-1.546-0.973-2.707 0-2.155 1.382-3.743 3.707-4.1v-1.955h2v1.932c1.382 0.145 2.465 0.62 3.415 1.551l-1.679 1.682c-0.859-0.832-1.889-0.947-2.787-0.947-1.412 0-2.099 0.792-2.099 1.74 0 0.348 0.115 0.716 0.401 0.986 0.267 0.252 0.706 0.464 1.26 0.541l1.602 0.232c1.241 0.174 2.023 0.522 2.596 1.063 0.726 0.696 1.050 1.702 1.050 2.92 0 2.25-1.567 3.662-3.759 4.055z"></path>
</symbol>
<symbol id="icon-drop" viewBox="0 0 20 20">
<path d="M10.203 0.561c-0.027-0.215-0.38-0.215-0.406 0-0.883 7.107-5.398 8.572-5.398 13.512 0 3.053 2.564 5.527 5.601 5.527s5.6-2.475 5.6-5.527c0-4.94-4.514-6.405-5.397-13.512zM9.35 8.418c-0.059 0.219-0.123 0.444-0.189 0.678-0.401 1.424-0.856 3.039-0.856 4.906 0 1.012-0.598 1.371-1.156 1.371-0.639 0-1.156-0.523-1.156-1.166 0-2.207 1.062-3.649 2-4.92 0.295-0.398 0.572-0.775 0.797-1.15 0.103-0.172 0.38-0.164 0.506 0.006 0.059 0.080 0.079 0.182 0.054 0.275z"></path>
</symbol>
<symbol id="icon-emoji-happy" viewBox="0 0 20 20">
<path d="M10 0.4c-5.302 0-9.6 4.298-9.6 9.6s4.298 9.6 9.6 9.6c5.301 0 9.6-4.298 9.6-9.601 0-5.301-4.299-9.599-9.6-9.599zM10 17.599c-4.197 0-7.6-3.402-7.6-7.6s3.402-7.599 7.6-7.599c4.197 0 7.601 3.402 7.601 7.6s-3.404 7.599-7.601 7.599zM7.501 9.75c0.828 0 1.499-0.783 1.499-1.75s-0.672-1.75-1.5-1.75-1.5 0.783-1.5 1.75 0.672 1.75 1.501 1.75zM12.5 9.75c0.829 0 1.5-0.783 1.5-1.75s-0.672-1.75-1.5-1.75-1.5 0.784-1.5 1.75 0.672 1.75 1.5 1.75zM14.341 11.336c-0.363-0.186-0.815-0.043-1.008 0.32-0.034 0.066-0.869 1.593-3.332 1.593-2.451 0-3.291-1.513-3.333-1.592-0.188-0.365-0.632-0.514-1.004-0.329-0.37 0.186-0.52 0.636-0.335 1.007 0.050 0.099 1.248 2.414 4.672 2.414 3.425 0 4.621-2.316 4.67-2.415 0.184-0.367 0.036-0.81-0.33-0.998z"></path>
</symbol>
<symbol id="icon-globe" viewBox="0 0 20 20">
<path d="M10 0.4c-5.295 0-9.601 4.307-9.601 9.6s4.306 9.6 9.601 9.6c5.293 0 9.6-4.307 9.6-9.6s-4.307-9.6-9.6-9.6zM18.188 10c0 1.873-0.636 3.6-1.696 4.98-0.3-0.234-0.619-0.867-0.319-1.523 0.303-0.66 0.382-2.188 0.312-2.783-0.066-0.594-0.375-2.025-1.214-2.039-0.838-0.012-1.413-0.289-1.911-1.283-1.033-2.068 1.939-2.465 0.906-3.609-0.289-0.322-1.783 1.322-2.002-0.869-0.014-0.157 0.135-0.392 0.336-0.636 3.244 1.090 5.588 4.157 5.588 7.762zM8.875 1.893c-0.196 0.382-0.713 0.537-1.027 0.824-0.684 0.619-0.978 0.533-1.346 1.127-0.371 0.594-1.567 1.449-1.567 1.879s0.604 0.936 0.906 0.838c0.302-0.1 1.099-0.094 1.567 0.070 0.469 0.166 3.914 0.332 2.816 3.244-0.348 0.926-1.873 0.77-2.279 2.303-0.061 0.225-0.272 1.186-0.285 1.5-0.025 0.486 0.344 2.318-0.125 2.318-0.471 0-1.738-1.639-1.738-1.936s-0.328-1.338-0.328-2.23c0-0.891-1.518-0.877-1.518-2.062 0-1.068 0.823-1.6 0.638-2.113-0.181-0.51-1.627-0.527-2.23-0.59 1.053-2.731 3.53-4.758 6.516-5.172zM7.424 17.77c0.492-0.26 0.542-0.596 0.988-0.613 0.51-0.023 0.925-0.199 1.5-0.326 0.51-0.111 1.423-0.629 2.226-0.695 0.678-0.055 2.015 0.035 2.375 0.689-1.295 0.861-2.848 1.363-4.514 1.363-0.899 0-1.765-0.149-2.575-0.418z"></path>
</symbol>
<symbol id="icon-graduation-cap" viewBox="0 0 20 20">
<path d="M3.302 12.238c0.464 1.879 1.054 2.701 3.022 3.562 1.969 0.86 2.904 1.8 3.676 1.8s1.648-0.822 3.616-1.684c1.969-0.861 1.443-1.123 1.907-3.002l-5.523 2.686-6.698-3.362zM19.511 7.336l-8.325-4.662c-0.652-0.365-1.72-0.365-2.372 0l-8.326 4.662c-0.652 0.365-0.652 0.963 0 1.328l8.325 4.662c0.652 0.365 1.72 0.365 2.372 0l5.382-3.014-5.836-1.367c-0.225 0.055-0.472 0.086-0.731 0.086-1.052 0-1.904-0.506-1.904-1.131 0-0.627 0.853-1.133 1.904-1.133 0.816 0 1.51 0.307 1.78 0.734l6.182 2.029 1.549-0.867c0.651-0.364 0.651-0.962 0-1.327zM16.967 16.17c-0.065 0.385 1.283 1.018 1.411-0.107 0.579-5.072-0.416-6.531-0.416-6.531l-1.395 0.781c0-0.001 1.183 1.125 0.4 5.857z"></path>
</symbol>
<symbol id="icon-heart" viewBox="0 0 20 20">
<path d="M17.19 4.155c-1.672-1.534-4.383-1.534-6.055 0l-1.135 1.042-1.136-1.042c-1.672-1.534-4.382-1.534-6.054 0-1.881 1.727-1.881 4.52 0 6.246l7.19 6.599 7.19-6.599c1.88-1.726 1.88-4.52 0-6.246z"></path>
</symbol>
<symbol id="icon-leaf" viewBox="0 0 20 20">
<path d="M19.025 3.587c-4.356 2.556-4.044 7.806-7.096 10.175-2.297 1.783-5.538 0.88-7.412 0.113 0 0-1.27 1.603-2.181 3.74-0.305 0.717-1.644-0.073-1.409-0.68 2.978-7.685 13.11-11.519 13.11-11.519s-7.149-0.303-11.927 5.94c-0.128-1.426-0.34-5.284 3.36-7.65 5.016-3.211 14.572-0.715 13.555-0.119z"></path>
</symbol>
<symbol id="icon-light-up" viewBox="0 0 20 20">
<path d="M19 9.199c-0.182 0-0.799 0-0.98 0-0.553 0-1 0.359-1 0.801s0.447 0.799 1 0.799c0.182 0 0.799 0 0.98 0 0.552 0 1-0.357 1-0.799 0-0.441-0.449-0.801-1-0.801zM10 4.5c-3.051 0-5.5 2.449-5.5 5.5s2.449 5.5 5.5 5.5c3.050 0 5.5-2.449 5.5-5.5s-2.451-5.5-5.5-5.5zM10 14c-2.211 0-4-1.791-4-4 0-2.211 1.789-4 4-4 2.209 0 4 1.789 4 4 0 2.209-1.791 4-4 4zM3 10c0-0.441-0.449-0.801-1-0.801-0.185 0-0.816 0-1 0-0.553 0-1 0.359-1 0.801s0.447 0.799 1 0.799c0.184 0 0.815 0 1 0 0.551 0 1-0.358 1-0.799zM10 3c0.441 0 0.799-0.447 0.799-1 0-0.184 0-0.816 0-1 0-0.553-0.358-1-0.799-1s-0.801 0.447-0.801 1c0 0.184 0 0.816 0 1 0 0.553 0.359 1 0.801 1zM10 17c-0.442 0-0.801 0.447-0.801 1 0 0.184 0 0.816 0 1 0 0.553 0.359 1 0.801 1s0.799-0.447 0.799-1c0-0.184 0-0.816 0-1 0-0.553-0.358-1-0.799-1zM17.365 3.766c0.391-0.391 0.454-0.961 0.142-1.273s-0.883-0.248-1.272 0.143c-0.108 0.107-0.593 0.592-0.7 0.699-0.391 0.391-0.454 0.961-0.142 1.273s0.883 0.248 1.273-0.143c0.107-0.108 0.591-0.592 0.699-0.699zM3.334 15.533c-0.108 0.109-0.593 0.594-0.7 0.701-0.391 0.391-0.454 0.959-0.142 1.271s0.883 0.25 1.272-0.141c0.108-0.107 0.593-0.592 0.7-0.699 0.391-0.391 0.454-0.961 0.142-1.274s-0.883-0.247-1.272 0.142zM3.765 2.635c-0.39-0.391-0.961-0.455-1.273-0.143s-0.248 0.883 0.141 1.274c0.108 0.107 0.593 0.592 0.7 0.699 0.391 0.391 0.96 0.455 1.272 0.143s0.249-0.883-0.141-1.273c-0.107-0.108-0.591-0.593-0.699-0.7zM15.534 16.666c0.108 0.107 0.593 0.592 0.7 0.699 0.391 0.391 0.96 0.453 1.272 0.143 0.312-0.312 0.249-0.883-0.142-1.273-0.107-0.107-0.592-0.592-0.699-0.699-0.391-0.391-0.961-0.455-1.274-0.143s-0.248 0.882 0.143 1.273z"></path>
</symbol>
<symbol id="icon-line-graph" viewBox="0 0 20 20">
<path d="M0.69 11.331l1.363 0.338 1.026-1.611-1.95-0.482c-0.488-0.121-0.981 0.174-1.102 0.66-0.121 0.483 0.175 0.973 0.663 1.095zM18.481 11.592l-4.463 4.016-5.247-4.061c-0.1-0.076-0.215-0.133-0.338-0.162l-0.698-0.174-1.027 1.611 1.1 0.273 5.697 4.408c0.166 0.127 0.362 0.189 0.559 0.189 0.219 0 0.438-0.078 0.609-0.232l5.028-4.527c0.372-0.334 0.401-0.906 0.064-1.277s-0.911-0.4-1.284-0.064zM8.684 7.18l4.887 3.129c0.413 0.264 0.961 0.154 1.24-0.246l5.027-7.242c0.286-0.412 0.183-0.977-0.231-1.26-0.414-0.285-0.979-0.182-1.265 0.23l-4.528 6.521-4.916-3.147c-0.204-0.131-0.451-0.174-0.688-0.123-0.236 0.053-0.442 0.197-0.571 0.4l-7.497 11.767c-0.27 0.422-0.144 0.983 0.28 1.25 0.15 0.096 0.319 0.141 0.486 0.141 0.301 0 0.596-0.149 0.768-0.42l7.008-11z"></path>
</symbol>
<symbol id="icon-magnet" viewBox="0 0 20 20">
<path d="M12.165 17.86c-0.028 0.309 0.217 0.584 0.545 0.611l3.985 0.326c0.329 0.027 0.621-0.203 0.65-0.512l0.311-3.287-5.18-0.426-0.311 3.288zM2.344 14.999l0.312 3.287c0.028 0.309 0.321 0.539 0.65 0.512l3.985-0.326c0.328-0.027 0.573-0.303 0.546-0.611l-0.312-3.287-5.181 0.425zM1.831 9.583l0.321 3.391 5.181-0.426-0.322-3.387c-0.007-0.082-0.011-0.166-0.011-0.25 0-1.555 1.346-2.82 3-2.82s3 1.266 3 2.82c0 0.084-0.004 0.168-0.012 0.25l-0.321 3.387 5.181 0.426 0.321-3.391c0.021-0.225 0.030-0.449 0.030-0.672 0.001-4.252-3.677-7.711-8.199-7.711s-8.2 3.459-8.2 7.711c0 0.223 0.011 0.447 0.031 0.672z"></path>
</symbol>
<symbol id="icon-medal" viewBox="0 0 20 20">
<path d="M10 10c0.528 0 1.026 0.104 1.504 0.256l-6.077-9.115c-0.059-0.088-0.157-0.141-0.263-0.141h-3.556c-0.117 0-0.188 0.131-0.122 0.229l6.231 9.347c0.687-0.356 1.456-0.576 2.283-0.576zM18.392 1h-3.556c-0.106 0-0.204 0.053-0.263 0.141l-3.823 5.734 2 3 5.764-8.646c0.065-0.098-0.005-0.229-0.122-0.229zM10 11c-2.209 0-4 1.791-4 4s1.791 4 4 4 4-1.791 4-4c0-2.209-1.791-4-4-4zM12.112 15.117c0.062 0.064 0.052 0.158-0.022 0.208s-0.095 0.153-0.049 0.229c0.047 0.076 0.018 0.165-0.065 0.199s-0.125 0.13-0.095 0.214-0.017 0.165-0.104 0.181-0.149 0.101-0.137 0.189-0.051 0.158-0.14 0.155c-0.089-0.003-0.167 0.068-0.174 0.156s-0.083 0.144-0.169 0.123-0.178 0.031-0.203 0.117-0.111 0.124-0.191 0.085c-0.080-0.039-0.18-0.006-0.222 0.072s-0.134 0.098-0.205 0.043-0.175-0.044-0.232 0.024-0.151 0.068-0.209 0-0.162-0.079-0.232-0.024-0.162 0.035-0.205-0.043-0.142-0.111-0.222-0.072c-0.080 0.039-0.166 0-0.191-0.085s-0.116-0.138-0.203-0.117-0.163-0.034-0.169-0.123-0.084-0.159-0.173-0.157c-0.089 0.003-0.152-0.067-0.14-0.155s-0.050-0.173-0.137-0.189-0.135-0.097-0.104-0.181-0.013-0.18-0.095-0.214-0.111-0.123-0.065-0.199c0.047-0.076 0.025-0.179-0.049-0.229s-0.083-0.144-0.022-0.208c0.062-0.064 0.062-0.169 0-0.234s-0.052-0.158 0.022-0.208 0.095-0.153 0.049-0.229c-0.047-0.076-0.018-0.165 0.065-0.199s0.125-0.13 0.095-0.214 0.017-0.165 0.104-0.181 0.149-0.101 0.137-0.189 0.051-0.158 0.14-0.155c0.089 0.003 0.167-0.068 0.174-0.156s0.083-0.144 0.169-0.123 0.178-0.031 0.203-0.117 0.111-0.124 0.191-0.085c0.080 0.039 0.18 0.006 0.222-0.072s0.134-0.098 0.205-0.043 0.175 0.044 0.232-0.024 0.151-0.068 0.209 0 0.162 0.079 0.232 0.024 0.162-0.035 0.205 0.043 0.142 0.111 0.222 0.072c0.080-0.039 0.166 0 0.191 0.085s0.116 0.138 0.203 0.117 0.163 0.034 0.169 0.123 0.085 0.159 0.174 0.156c0.089-0.003 0.152 0.067 0.14 0.155s0.050 0.173 0.137 0.189 0.135 0.097 0.104 0.181 0.013 0.18 0.095 0.214 0.111 0.123 0.065 0.199c-0.047 0.076-0.025 0.179 0.049 0.229s0.083 0.144 0.022 0.208-0.063 0.171-0.001 0.235z"></path>
</symbol>
<symbol id="icon-megaphone" viewBox="0 0 20 20">
<path d="M17.223 7.030c-1.584-3.686-4.132-6.49-5.421-5.967-2.189 0.891 1.304 5.164-9.447 9.533-0.929 0.379-1.164 1.888-0.775 2.792 0.388 0.902 1.658 1.801 2.587 1.424 0.161-0.066 0.751-0.256 0.751-0.256 0.663 0.891 1.357 0.363 1.604 0.928 0.296 0.68 0.939 2.158 1.158 2.66s0.715 0.967 1.075 0.83c0.359-0.137 1.582-0.602 2.050-0.779s0.579-0.596 0.436-0.924c-0.154-0.355-0.786-0.459-0.967-0.873-0.18-0.412-0.769-1.738-0.938-2.156-0.23-0.568 0.259-1.031 0.97-1.104 4.894-0.512 5.809 2.512 7.475 1.834 1.287-0.525 1.025-4.259-0.558-7.942zM16.672 13.006c-0.287 0.115-2.213-1.402-3.443-4.267-1.231-2.863-1.076-5.48-0.79-5.597 0.286-0.115 2.165 1.717 3.395 4.58s1.124 5.167 0.838 5.284z"></path>
</symbol>
<symbol id="icon-moon" viewBox="0 0 20 20">
<path d="M13.719 1.8c0.686 0.385 1.332 0.867 1.916 1.449 3.42 3.422 3.42 8.966 0 12.386s-8.965 3.42-12.386 0c-0.583-0.584-1.065-1.231-1.449-1.916 3.335 1.867 7.633 1.387 10.469-1.449s3.318-7.134 1.45-10.47z"></path>
</symbol>
<symbol id="icon-star" viewBox="0 0 20 20">
<path d="M10 1.3l2.388 6.722h6.412l-5.232 3.948 1.871 6.928-5.439-4.154-5.438 4.154 1.87-6.928-5.233-3.948h6.412l2.389-6.722z"></path>
</symbol>
<symbol id="icon-trophy" viewBox="0 0 20 20">
<path d="M11.18 14.356c0-1.451 1.1-2.254 2.894-3.442 2.194-1.456 4.926-3.265 4.926-7.56 0-0.387-0.317-0.699-0.709-0.699h-3.43c-0.484-0.896-1.929-1.855-4.861-1.855-2.934 0-4.377 0.959-4.862 1.855h-3.431c-0.391 0-0.707 0.313-0.707 0.699 0 4.295 2.73 6.104 4.926 7.559 1.794 1.188 2.894 1.991 2.894 3.442v1.311c-1.884 0.209-3.269 0.906-3.269 1.736 0 0.994 1.992 1.799 4.449 1.799s4.449-0.805 4.449-1.799c0-0.83-1.385-1.527-3.269-1.736v-1.31zM13.957 9.3c0.566-1.199 1.016-2.826 1.088-5.246h2.51c-0.24 2.701-1.862 4.064-3.598 5.246zM10 2.026c2.732-0.002 3.799 1.115 3.798 1.529 0 0.418-1.066 1.533-3.798 1.535-2.732-0.001-3.799-1.116-3.799-1.534-0.001-0.414 1.067-1.532 3.799-1.53zM2.445 4.054h2.509c0.073 2.42 0.521 4.047 1.089 5.246-1.736-1.182-3.359-2.545-3.598-5.246z"></path>
</symbol>
<symbol id="icon-user" viewBox="0 0 20 20">
<path d="M7.725 2.146c-1.016 0.756-1.289 1.953-1.239 2.59 0.064 0.779 0.222 1.793 0.222 1.793s-0.313 0.17-0.313 0.854c0.109 1.717 0.683 0.976 0.801 1.729 0.284 1.814 0.933 1.491 0.933 2.481 0 1.649-0.68 2.42-2.803 3.334-2.13 0.918-4.326 2.073-4.326 4.073v1h18v-1c0-2-2.197-3.155-4.328-4.072-2.123-0.914-2.801-1.684-2.801-3.334 0-0.99 0.647-0.667 0.932-2.481 0.119-0.753 0.692-0.012 0.803-1.729 0-0.684-0.314-0.854-0.314-0.854s0.158-1.014 0.221-1.793c0.065-0.817-0.398-2.561-2.3-3.096-0.333-0.34-0.558-0.881 0.466-1.424-2.24-0.105-2.761 1.067-3.954 1.929z"></path>
</symbol>
<symbol id="icon-facebook-with-circle" viewBox="0 0 20 20">
<path d="M10 0.4c-5.302 0-9.6 4.298-9.6 9.6s4.298 9.6 9.6 9.6 9.6-4.298 9.6-9.6-4.298-9.6-9.6-9.6zM12.274 7.034h-1.443c-0.171 0-0.361 0.225-0.361 0.524v1.042h1.805l-0.273 1.486h-1.532v4.461h-1.703v-4.461h-1.545v-1.486h1.545v-0.874c0-1.254 0.87-2.273 2.064-2.273h1.443v1.581z"></path>
</symbol>
<symbol id="icon-instagram-with-circle" viewBox="0 0 20 20">
<path d="M13 10c0 1.657-1.343 3-3 3s-3-1.343-3-3c0-0.171 0.018-0.338 0.049-0.5h-1.049v3.997c0 0.278 0.225 0.503 0.503 0.503h6.995c0.277 0 0.502-0.225 0.502-0.503v-3.997h-1.049c0.031 0.162 0.049 0.329 0.049 0.5zM10 12c1.104 0 2-0.896 2-2s-0.896-2-2-2-2 0.896-2 2 0.896 2 2 2zM12.4 7.9h1.199c0.166 0 0.301-0.135 0.301-0.3v-1.199c0-0.166-0.135-0.301-0.301-0.301h-1.199c-0.166 0-0.301 0.135-0.301 0.301v1.199c0.001 0.165 0.136 0.3 0.301 0.3zM10 0.4c-5.302 0-9.6 4.298-9.6 9.6s4.298 9.6 9.6 9.6c5.302 0 9.6-4.298 9.6-9.6s-4.298-9.6-9.6-9.6zM15 13.889c0 0.611-0.5 1.111-1.111 1.111h-7.778c-0.611 0-1.111-0.5-1.111-1.111v-7.778c0-0.611 0.5-1.111 1.111-1.111h7.778c0.611 0 1.111 0.5 1.111 1.111v7.778z"></path>
</symbol>
<symbol id="icon-twitter" viewBox="0 0 20 20">
<path d="M17.316 6.246c0.008 0.162 0.011 0.326 0.011 0.488 0 4.99-3.797 10.742-10.74 10.742-2.133 0-4.116-0.625-5.787-1.697 0.296 0.035 0.596 0.053 0.9 0.053 1.77 0 3.397-0.604 4.688-1.615-1.651-0.031-3.046-1.121-3.526-2.621 0.23 0.043 0.467 0.066 0.71 0.066 0.345 0 0.679-0.045 0.995-0.131-1.727-0.348-3.028-1.873-3.028-3.703 0-0.016 0-0.031 0-0.047 0.509 0.283 1.092 0.453 1.71 0.473-1.013-0.678-1.68-1.832-1.68-3.143 0-0.691 0.186-1.34 0.512-1.898 1.861 2.285 4.644 3.787 7.781 3.945-0.064-0.277-0.097-0.564-0.097-0.861 0-2.084 1.689-3.773 3.774-3.773 1.086 0 2.067 0.457 2.756 1.191 0.859-0.17 1.667-0.484 2.397-0.916-0.282 0.881-0.881 1.621-1.66 2.088 0.764-0.092 1.49-0.293 2.168-0.594-0.506 0.758-1.146 1.422-1.884 1.953z"></path>
</symbol>
<symbol id="icon-happy" viewBox="0 0 32 32">
<path d="M16 32c8.837 0 16-7.163 16-16s-7.163-16-16-16-16 7.163-16 16 7.163 16 16 16zM16 3c7.18 0 13 5.82 13 13s-5.82 13-13 13-13-5.82-13-13 5.82-13 13-13zM16 18.711c3.623 0 7.070-0.963 10-2.654-0.455 5.576-4.785 9.942-10 9.942s-9.544-4.371-10-9.947c2.93 1.691 6.377 2.658 10 2.658zM8 11c0-1.657 0.895-3 2-3s2 1.343 2 3c0 1.657-0.895 3-2 3s-2-1.343-2-3zM20 11c0-1.657 0.895-3 2-3s2 1.343 2 3c0 1.657-0.895 3-2 3s-2-1.343-2-3z"></path>
</symbol>
</defs>
</svg>

The template of the concerned app:
<!DOCTYPE html>
{% extends "lp001/base.html" %}
{% load static %}
{% block body_block%}
<body class="main-container">
<div class="card">
        <div class="card-wrapper">
            <svg class="card--img">
                <use href="img/sprite.svg#icon-light-up"></use>
            </svg>
            <p class="card--text">blablabla</p>
        </div>
  </div>

icons showing locally:

icons not showing with Heroku:

Thank you in advance


text:
Q: ios delegate not pass value and not enter respondsToSelector in my structure I have similar problem. But I don't know why about this structure.
I want to use delegate pass the value about the navigationController pushViewController.
But the structure is Tabs ViewController. The Tabs ViewController is embed the ContainerViewController.
When I click the TabAUIViewcontroller. I want to pass the value use the delegate to ResultViewController.(Yellow UIViewController pass value to Blue UIViewController )
The structure like below:

In the RootUIViewController.h(green), I add the ResultViewController property.
RootViewController.h
 @interface RootViewController : UIViewController
 - (IBAction)rootBtnChangePageAction:(id)sender;
 @property (nonatomic,strong)  ResultViewController *resultVC;

 @end

The RootViewController.m
 - (void)viewDidLoad {
     [super viewDidLoad];

     self.resultVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ResultViewController"];

   }

Then I set the protocol and delegate method in the TabAUIViewController(Yellow).
TabAUIViewController.h
    @class TabAUIViewController;
 @protocol TabAUIViewControllerDelegate <NSObject>

 @optional

 -(void) tabAVC:(TabAUIViewController*)tabAVC passValue:(NSString*) str;

 @end

 @interface TabAUIViewController : UIViewController

 @property (nonatomic,assign) id<TabAUIViewControllerDelegate> delegate;

 - (IBAction)tabABtnAction:(id)sender;

 @end

In the TabAUIViewController.m I declare the resultVC and call the parentViewController.parentViewController to pass the value .
TabAUIViewController.m
 @interface TabAUIViewController()
 {
     ResultViewController  *resultVC;
 }
 @end

 @implementation TabAUIViewController

 - (void)viewDidLoad {
     [super viewDidLoad];
     resultVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ResultViewController"];
 }

 - (IBAction)tabABtnAction:(id)sender {
  RootViewController* tempRootVC = (RootViewController*)self.parentViewController.parentViewController;
    NSLog(@"tabABtnAction");
     if( [self.delegate respondsToSelector:@selector(tabAVC:passValue:)])
     {
         NSLog(@"respondsToSelector");
         [self.delegate tabAVC:self passValue:@"test"];

     }
     [tempRootVC.navigationController pushViewController:resultVC animated:YES];

 }
 @end

Then in the ResultViewController.m , I had add the delegate.
But I can't get the value in the delegate method.
ResultViewController.m
 @interface ResultViewController ()<TabAUIViewControllerDelegate>
 {
     TabAUIViewController *tabAVC;
 }
 @end

 @implementation ResultViewController

 - (void)viewDidLoad {
     [super viewDidLoad];

     tabAVC = [self.storyboard instantiateViewControllerWithIdentifier:@"TabAUIViewController"];
     tabAVC.delegate = self;
 }

 // tab a delegate method
 -(void) tabAVC:(TabAUIViewController *)tabAVC passValue:(NSString *)str
 {
     NSLog(@"str:%@",str);
 }

I can't get the value in the ResultViewController.m
I had try to trace the log, there are not enter the
[self.delegate respondsToSelector:@selector(tabAVC:passValue:)] method.
How can I use the pushViewController and delegate pass the value in this structure?
Have anyone can resolved the problem using delegate?
Thank you very much.
I had upload the test project and simplify project in here.


text:
Q: Xcode simulator is not showing swift ui place holder text I have text fields that have placeholder text inside them, on the preview screen in swift UI it shows up however the simulator with Xcode doesn't show the placeholder text.
It works in the preview but not in the Xcode Simulator so is it just a bug in swift UI or my code?
Images below
SwiftUI preview screen
Simulator Screen
import SwiftUI

struct doctor: View {
@State var userInputone: String = ""
@State var userInputtwo: String = ""
@State var userInputthree: String = ""
@State var userInputfour: String = ""
@State var userInputfive: String = ""
@State var userInputsix: String = ""

var body: some View {
    ZStack{
        Color.white
    .edgesIgnoringSafeArea(.all)
        VStack{
            Text("Whats up Doc?")
                .font(.largeTitle)
                .foregroundColor(Color.gray)
                .multilineTextAlignment(.leading)

            Text("Let's get to know each other")
                .foregroundColor(Color.gray)
                .multilineTextAlignment(.leading)

                 .padding()

            .shadow(radius:10)
            TextField("FirstName", text: $userInputone)
            .padding()
             .background(Color(red: 0.937, green: 0.952, blue: 0.956))
            .cornerRadius(15)
                .padding()

            .shadow(radius:10)
            TextField("LastName", text: $userInputtwo)
                .padding()
                .background(Color(red: 0.937, green: 0.952, blue: 0.956))
                 .cornerRadius(15)
                .padding()
               .shadow(radius:10)

            TextField("LastName", text: $userInputthree)
                .padding()
              .background(Color(red: 0.937, green: 0.952, blue: 0.956))
                  .cornerRadius(15)
                   .padding()
        .shadow(radius:10)
            TextField("LastName", text: $userInputfour)
                    .padding()
                   .background(Color(red: 0.937, green: 0.952, blue: 0.956))
                   .cornerRadius(15)
                                  .padding()
            .shadow(radius:10)
            TextField("LastName", text: $userInputfive)
                 .padding()
                .background(Color(red: 0.937, green: 0.952, blue: 0.956))
               .cornerRadius(15)
               .padding()
            .shadow(radius:10)
            TextField("LastName", text: $userInputsix)
              .padding()
              .background(Color(red: 0.937, green: 0.952, blue: 0.956))
               .cornerRadius(15)
               .padding()
           .shadow(radius:10)

            NavigationLink(destination: createaccount()){

               Text("Next")
             .fontWeight(.bold)
            .foregroundColor(Color.white)
              .padding(.all, 20.0)
              .frame(height: 44.0)
            .frame(width: 300.0)
        .background(LinearGradient(gradient: Gradient(colors: [Color.gray, Color.purple]), startPoint: .top, endPoint: .bottom))
          .cornerRadius(20)

        }
        }

    }

}
}

struct doctor_Previews: PreviewProvider {
static var previews: some View {
    doctor()
}
}

A: Because of the dark mode, the placeholder not visible on Textfield background with a color you defined.
The solution could be this:
in  Assets.xcassets define new Color, from the right side in inspector change Appearance to Any, Dark and change your color to what you preferred. Then you can use it as a background in your Textfield


text:
Q: Is it possible to discover endpoint parameters in a Spring Boot application? I have a Spring Boot application exposing some endpoints for REST requests. I am trying to decouple two components (which currently call each other's code directly), and I want them to make REST requests to each other (for an eventual microservice implementation). I know endpoint discovery can be done through a discovery service (e.g. Eureka), but is there a way to also communicate parameter information from the service which requires it to the client requesting it?
Example: I have a shopping cart service which relies on information about products available for purchase. Using Eureka (or another service discovery tool) I can register my services so that the shopping cart service is now aware of the product service. If the product service has something like:
@GetMapping("/product")
public Product findById(@RequestParam int id) {
  return products.find(id);
}

I know to use this endpoint to get product with ID 3 the cart service would have to make a request to http://localhost:1234/product?id=3, but is there a way that it can discover these parameters and their required types at run time? In my example, if I use Eureka, the shopping cart service is dynamically made aware of the product service's location, but is not made aware of the parameters that its endpoints will accept. I know Spring Boot Actuator is supposed to provide this information, but whenever I use it, the params field for my endpoints is always empty.

A:
Is there a way that it can discover these parameters and their required types at run time?

Do you really need this information at runtime?
Because it would be much simpler if you need this at development time. Then you could just use something like Swagger, which will provide a service specification endpoint. It can even generate a client for your service.
But, if you really want it at runtime, you may be better served with a HATEOAS API. HATEOAS (Hypermedia as the Engine of Application State) means that your API is navigable. That means that clients can "crawl" you API following the links presented, like a human navigating through a website. How useful it will be, depend on what you are trying to achieve.
There are two popular "solutions" to this:

*

*HAL (Hypertext Application Language) - Still an Internet Draft

*JSON-LD (JSON for Linking Data) - A W3C Standard

Spring Boot has HAL support, see spring-boot-starter-hateoas.

A: You can use parameter map, that will be dynamically populated with all used parameters:
@GetMapping("/product")
public Product findById(@RequestParam Map<String,String> allRequestParams) {
 return products.find(allRequestParams.get("id"));
}

You can iterate the parameter map to find which parameters are present.

A: You can use Swagger in your product service to generate apis, exposed in a json file. For example you can look at sample project petstore with its json exposed, containing apis and parameters with definition.
Then in your shopping cart service you can navigate at runtime product service apis, iterating for specific api parameters.


text:
Q: foundation tabs with one up not working I have two tabs on my page and I would like the page to init with both tabs closed.  I cannot get it to work.  If I switch to accordion I can get both to init closed.
Is there a different property for tabs?
Also I would assume closing a tab would occur if you click on a tab that is already open. However that is not the case.

Section 1

Content of section 1.

Section 2

Content of section 2.

http://jsbin.com/omuvik/1/

A: I believe this was a design decision on the part of the Foundation team, as tabbed content normally has one section open at all times. If you resize a browser window with all accordion elements closed to the breakpoint where those become tabs, the first one will be forced open, which makes it seem like a deliberate behavior.
You can try setting a callback function in your data-options attribute: if you remove the "active" class from all tab sections, they'll all be closed.


text:
Q: What is the best way to publish c# app with PreLoaded Sql Server Express Database I would like to distribute my C# application along with SQL Server Express 2005 and the apps corresponding database.  When installed SQL Server Express 2005 needs to have my sample database automatically loaded with data, not just table structures, when it is installed.  How can I accomplish this.
Is there a way to do this with the Visual Studio Click Once technology?  I have VS 2008.

A: There are several ways you can do this - as JFV mentioned, you can ship a MDF/LDF database and re-attach it after installation.
Or you could wrap up your database creation scripts into a .NET project and/or stand-alone EXE with something like Red-Gate's SQL Packager.
Or yet again, on SQL Server Express, you could simply add your MDF file to a directory and use the "attach local database file" mechanism in ADO.NET to connect to your database file. Your connection string would look something like:

Server=.\SQLExpress;AttachDbFilename=c:\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;

Your choice! :-)

A: If you can run a SQL script that creates the tables, couldn't that same script also INSERT rows?

A: If the base sample data is the same for each installation, you can include a detached MDF/LDF and attach it at the time of the installation to the new SQL Express Instance.  Or you can restore a BAK file of the database after installation...?
Let me know if this helps!
JFV


text:
Q: Cordova plugin not able to call native ios method from javascript interface Cordova plugin not able to call native ios method from javascript interface .
I have created a simple cordova plugin for iOS platform and added it into a cordova project. But somehow I am not able to call native code from JS layer of plugin. I have tried all possible solution given in the stackoverflow and cordova.apache.org site.
below is my code please check it and let me know if I am missing any step -
index.html

Apache Cordova

Connecting to Device

Device is Ready

    <button onclick="testInit()">Click</button>

index.js
var app = {
initialize: function() {
 document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},

 onDeviceReady: function() {
    this.receivedEvent('deviceready');
},

// Update DOM on a Received Event
receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');

    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');

    console.log('Received Event: ' + id);
   }
 };

 app.initialize();

testXyz.js
function testInit() {
  "use strict";
  var sign = "xyz";
  var environ = "S1";
  var mp = cordova.require("cordova_Plugin_xyzPlugin.xyzPlugin");
  var success  = function() { alert('win!');  }
  var fail = function() { alert('fail!'); }
  mp.coolMethod(sign, environ, true, true, success, fail);
}

plugin.xml
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova_Plugin_xyzPlugin" version="0.0.1"
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>xyzPlugin</name>
<js-module name="xyzPlugin" src="www/xyzPlugin.js">
    <clobbers target="cordova.plugins.xyzPlugin" />
</js-module><platform name="ios">
    <config-file parent="/*" target="config.xml">
        <feature name="xyzPlugin">
            <param name="ios-package" value="xyzPlugin" />
        </feature>
    </config-file>
    <source-file src="src/ios/xyzPlugin.h" />
    <source-file src="src/ios/xyzPlugin.m" />
 </platform>
</plugin>

xyzPlugin.js
cordova.define("cordova_Plugin_xyzPlugin.xyzPlugin", function(require, exports, module) {

var exec = require('cordova/exec');
var xyzPlugin = {};

xyzPlugin.coolMethod = function(arg0, arg1, arg2, arg3, success, error)
 {
   alert(JSON.stringify(cordova));
  //Here I am getting Alert.

   cordova.exec(success, error, "xyzPlugin", "coolMethod", [arg0, arg1, arg2, arg3]);

  // This is not working, from here I am not able to call native method.

 };
  module.exports = xyzPlugin;

});

Native ios plugin -
xyzPlugin.h
#import <Cordova/CDV.h>

@interface xyzPlugin : CDVPlugin
- (void)coolMethod:(CDVInvokedUrlCommand*)command;
@end

xyxPlugin.m
#import "xyxPlugin.h"

@implementation xyxPlugin

-(void)coolMethod:(CDVInvokedUrlCommand*)command
 {
   CDVPluginResult* pluginResult = nil;
   NSString* echo = [command.arguments objectAtIndex:0];

   if (echo != nil && [echo length] > 0) {
    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
  } else {
    pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
 }

  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 }
@end

Please help to resolve this issue.
Thanks in advance :)


text:
Q: Why python is not following my sequence of print statement calls I am learning python and just tried out the os.walk() function.I am using python 3.4.4 (64-bit) on windows platform.According to my understanding python should execute my statements line by line.
In this code i have iterated over a directory.The directory structure is

I need to print all the files first followed by the directory names.The code written is:
import os
dir_path = r"D:\\python_os_walk_check"

for root,dirs,files in os.walk(dir_path):
    for file_name in files:
        print(file_name)
    for dir_name in dirs:
        print(dir_name)

The ouput printed is:
first_folder
second_folder
test1.txt
test2.txt

According to me the output should be:
test1.txt
test2.txt
first_folder
second_folder

Where am i going wrong?

A: You first get the contents of dir_path, which is only the two directories. The files are inside the directories, so you get to them later, in a second and third iteration of your loop. Add a print(root) as the first thing inside the loop and you'll see more clearly what's happening.

A: You could store the names of files/directories and print them once your for loop completes.
import os
dir_path = "D:\\python_os_walk_check"

file_list = []
dir_list = []

for root,dirs,files in os.walk(dir_path):
    for file_name in files:
        file_list.append(file_name)
    for dir_name in dirs:
        dir_list.append(dir_name)

for x in file_list:
    print(x)

for i in dir_list:
    print(i)

A: You might get a bit more like what you seem to want if you use the topdown parameter in os.walk like so:
import os
dir_path = r"C:\Python34\Tools\pynche"

for root,dirs,files in os.walk(dir_path, topdown=False):
    for file_name in files:
        print(file_name)
    for dir_name in dirs:
        print(dir_name)

Unfortunately I think this is only good for two-level folders.
As a more up-to-date solution you could consider the abilities offered in the pathlib module, Python 3 doc 11.1.


text:
Q: Show a UINavigationBar back button without pushing a view controller In the iPad's Photos app, when you tap an album the stack of pictures expands to fill the screen - you're in the same view, it's just rearranged the grid a little. But at the top, a left-arrow-style Back button appears, as if pushViewController had been used - except it fades in neatly, rather than sliding in. When you tap that, it fades out again, rather than sliding out.
Is there a way to replicate this behaviour? I've tried a few options so far, and might just be missing something. What I've tried:

*

*Setting self.navigationItem's leftBarButtonItem works, but gives me a square button rather than an angled Back-style one - there are a few hacks online to make this work, such as using pictures for the button, but I'd rather only use them if there's definitely no "official" way to do this.

*Setting self.navigationItem.backBarButtonItem - this is generally used to customise the back button when a view controller is pushed, so it has no effect.

*[self.navigationController.navigationBar setItems::] - this works, although it gives me the sliding animation rather than fading. As a result, I use animated:NO to make it just appear. Downside: when tapping Back, you do get the sliding out animation, which looks weird because the rest of the UI stays still.
Has anyone managed to replicate this effect?
Thanks in advance!

A: Your first approach is probably the best.
It doesn't have to be super-hacky, you can use a normal UIButton and customize it to look like  a back-button using backgroundImageForState: and titleForState: (etc.), then set the UIButton object as the customView of your UIBarButtonItem.
Many apps these days customize the look & feel of the buttons anyway, so using a custom background image is quite normal. If you use resizableImageWithCapInsets: (or stretchableImageWithLeftCapWidth:topCapHeight: if you need to support iOS earlier than 5.0) then the button can still stretch to fit whatever text goes inside, and as it's a normal UIButton the text is localizable, etc. I don't consider this approach to be hacky, it is a perfectly sensible way to get around the limited functionality of UIBarButtonItem objects.

A: Better late than never.
To show a back button without pushing a view controller, use pushNavigationItem:animated: and popNavigationItemAnimated: on UINavigationBar. These result in the standard slide animation and creation of a back button. However, there is no way to ensure your content animation runs for the same time as the bar animation other than making an educated guess at the duration.
Since iOS 7 there is a better API for achieving this effect, where you still push and pop view controllers but you provide a custom transition animation through navigationController:animationControllerForOperation:fromViewController:toViewController: from UINavigationControllerDelegate. This allows the animations between the bar and content to be perfectly coordinated.
Finally, if your content before and after is managed by UICollectionViewController, you can use useLayoutToLayoutNavigationTransitions, which is designed for use-cases like Photos.


text:
Q: "http* " regular expression does match URLs I have the following code which use C# Regex to find all "http://..... " from my input.
This is my code, but I don't find anything. Please tell me what am I missing?
 Match m = Regex.Match(input, "http* ");
 while (m.Success)
 {
   Console.WriteLine("'{0}' found at index {1}.",
     m.Value, m.Index);
   m = m.NextMatch();
 }

This is my input text (wrapped for readability):
I recently moved and have a buI recently moved and have a bunch of stuff for sale.
Most prices are based on my research from CL and ebay. Let me know or make an offer
if you like something from the list. Thanks. IKEA RAMBERG bed frame and Sultan
mattress - $150 http://seattle.craigslist.org/est/fuo/4688883554.html Sanus Platinum
Foundations TV Stand - $75 http://seattle.craigslist.org/est/fuo/4687613962.html
Staples Mission Coffee table and 2 sets of nesting/side tables - $90
http://seattle.craigslist.org/est/fuo/4687499215.html
Like new Hoover SteamVac Carpet Cleaner with Clean Surge, F5914900 - $100
http://seattle.craigslist.org/est/hsh/4687474666.html Hauppauge WinTV-HVR-1600
ATSC/NTSC/QAM Tuner Video Card + Remote - $35
http://seattle.craigslist.org/est/sop/4687372003.html Computer with core 2 quad, 2GB
RAM, nforce MB, 1.5TB HDD and more - $200 http://seattle.craigslist.org/est/sys/4687362266.html
LINKSYS CM100 Cable Modem (works with Comcast) - $15
http://seattle.craigslist.org/est/ele/4687639722.html Various computer parts for sale - $1 I
recently moved and have a buI recently moved and have a bunch of stuff for sale. Most prices
are based on my research from CL and ebay. Let me know or make an offer if you like something
from the list. Thanks. IKEA RAMBERG bed frame and Sultan mattress - $150
http://seattle.craigslist.org/est/fuo/4688883554.html Sanus Platinum Foundations TV Stand - $75
http://seattle.craigslist.org/est/fuo/4687613962.html Staples Mission Coffee table and 2 sets of
nesting/side tables - $90 http://seattle.craigslist.org/est/fuo/4687499215.html Like new Hoover
SteamVac Carpet Cleaner with Clean Surge, F5914900 - $100
http://seattle.craigslist.org/est/hsh/4687474666.html Hauppauge WinTV-HVR-1600 ATSC/NTSC/QAM
Tuner Video Card + Remote - $35 http://seattle.craigslist.org/est/sop/4687372003.html Computer
with core 2 quad, 2GB RAM, nforce MB, 1.5TB HDD and more - $200
http://seattle.craigslist.org/est/sys/4687362266.html LINKSYS CM100 Cable Modem (works with
Comcast) - $15 http://seattle.craigslist.org/est/ele/4687639722.html Various computer parts for
sale - $1 "

A: The problem is that you put an asterisk * after p in your expression "http* ", so your possible matches look like this:
htt
http
httpp
httppp
httpppp

and so on. Since there's no space after p in the input string, your expression does not get any matches.
This expression should match:
Match m = Regex.Match(input, "http\\S* ");

(\S means "any non-whitespace character").

A: For starters, check this previous answer on Stack Overdlow.  What is the best regular expression to check if a string is a valid URL?
It appears you misunderstood what * means in regex terms.
"http* "

Means htt followed by 0 or more p followed by a space.
* is not a wildcard fileglob as in DOS or UNIX shell.
* in regex means zero or more of the token it follows (in this case that is p)
For the purpose of your input, you could write:
https?://(\S*)

\S captures all non-space
? makes the s optional so you can grab https as well
But for arbitrary input, space is not always the only thing that follows a URL. It could be enclosed in a quoted string, for example, in HTML or Javascript. The follow should allow a URL followed by a space or a non-escaped quote.
https?://([^ "']*)

Using the ^ at the start of the [] means the pattern is an exclusive pattern (anything but these characters) and many times is the easiest way to write a pattern. The alternative is to write a fully inclusive pattern, which means you have to craft a pattern for every legal input you expect to handle.
I can't remember an actual regex for a compliant URL, it is non-trivial, but you can find a few on Google or Stack Overflow. Just for the general idea, I might write something like the following to be an inclusive pattern:
https?://([-+a-zA-Z0-9._&?]*)

As noted in comment below by Lukos, keep in mind the C# escaping. I usually use verbatim strings in C# for regexes.
var pattern = @"https?://\S*";

A: Your source code is looking to match this pattern
"http* "

which say to look for the sequence htt, followed by zero or more occurrences of the character p, followed by a literal space (' ') character. You might try matching "http:[^\s]*" which will match the literal text http:, followed by zero or more non-whitespace characters.

A: There is an important question before choosing the regex to use. Do you want to find anything that looks like a URL (perhaps starting with http or https) or do you want to only match valid URLs? A valid URL regex is very complicated, a basic one is easier but you risk collecting matches on non-URLs in the text or perhaps invalid ones made to look like real ones!


text:
Q: Foreground Service with Timer problem I am developing an application that checks connectivity to a server at given interval.
I use a foreground service with notifications for this. The problem is that everything works fine as long as the phone is awake (screen turned on). From the moment I turn of the screen by pressing the power button the service starts to behave strange.
I made a stripped down version of my service to show you.
ForegroundService.java:
package service.App;
import android.R.drawable;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.IBinder;
import android.util.Log;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Timer;
import java.util.TimerTask;

public class ForegroundService extends Service {
static final String ACTION_FOREGROUND = "com.example.android.apis.FOREGROUND";
static final String ACTION_BACKGROUND = "com.example.android.apis.BACKGROUND";
private static final Class<?>[] mStartForegroundSignature = new Class[] {int.class, Notification.class };
private static final Class<?>[] mStopForegroundSignature = new Class[] { boolean.class };
private Method mStartForeground;
private Method mStopForeground;
private Object[] mStartForegroundArgs = new Object[2];
private Object[] mStopForegroundArgs = new Object[1];
private Timer timer = new Timer();
long interv=10000;
int timeout=3000;
Intent notificationIntent;
PendingIntent contentIntent;
Notification notification;
CharSequence text;
SimpleDateFormat df;

void invokeMethod(Method method, Object[] args) {
    try {
        mStartForeground.invoke(this, mStartForegroundArgs);
    } catch (InvocationTargetException e) {
        Log.w("ApiDemos", "Unable to invoke method", e);
    } catch (IllegalAccessException e) {
        Log.w("ApiDemos", "Unable to invoke method", e);
    }
}

void startForegroundCompat(int id, Notification notification) {
    Scan();
    if (mStartForeground != null) {
        mStartForegroundArgs[0] = Integer.valueOf(id);
        mStartForegroundArgs[1] = notification;
        invokeMethod(mStartForeground, mStartForegroundArgs);
        return;
    }
}

void stopForegroundCompat(int id) {
    if (mStopForeground != null) {
        mStopForegroundArgs[0] = Boolean.TRUE;
        try {
            mStopForeground.invoke(this, mStopForegroundArgs);
        } catch (InvocationTargetException e) {
            Log.w("ApiDemos", "Unable to invoke stopForeground", e);
        } catch (IllegalAccessException e) {
            Log.w("ApiDemos", "Unable to invoke stopForeground", e);
        }
        return;
    }
}

@Override
public void onCreate() {

    notificationIntent = new Intent(this, ForegroundService.class);
    contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,0);
    try {
        mStartForeground = getClass().getMethod("startForeground",mStartForegroundSignature);
        mStopForeground = getClass().getMethod("stopForeground",mStopForegroundSignature);
    } catch (NoSuchMethodException e) {
        return;
    }
}

@Override
public void onDestroy() {
    stopForegroundCompat(R.string.foreground_service_started);

    if (timer != null) {

        timer.cancel();
    }
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    handleCommand(intent);
    return START_STICKY;
}

void handleCommand(Intent intent) {
    if (ACTION_FOREGROUND.equals(intent.getAction())) {
        text = getText(R.string.foreground_service_started);

        notification = new Notification(R.drawable.icon, text, System
                .currentTimeMillis());

        contentIntent = PendingIntent.getActivity(this, 0, new Intent(this,
                Start.class), 0);

        notification.setLatestEventInfo(this,
                getText(R.string.local_service_label), text, contentIntent);

        startForegroundCompat(R.string.foreground_service_started,
                notification);

    } else if (ACTION_BACKGROUND.equals(intent.getAction())) {
        stopForegroundCompat(R.string.foreground_service_started);
    }

}

@Override
public IBinder onBind(Intent intent) {
    return null;
}

private void Scan() {
    timer.scheduleAtFixedRate(new TimerTask() {

        @Override
        public void run() {

            Socket s = null;
            int p = 81;
            long time;
            String url="www.google.com";
            SimpleDateFormat df;
            InetAddress ipaddress;
                try {

                    ipaddress = InetAddress.getByName(url);

                    try {
                        s = new Socket();
                        s.connect(new InetSocketAddress(url, p), timeout);
                        time = System.currentTimeMillis();
                        df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        Log.i("Server Monitor",
                                "A server is running on port " + p + " "
                                        + "@ IP address "
                                        + ipaddress.getHostAddress()
                                        + ". Date/Time: "
                                        + df.format(new Date(time)));
                        s.close();
                    } catch (IOException e) {
                        String ns = Context.NOTIFICATION_SERVICE;
                        NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
                        long when = System.currentTimeMillis();
                        Notification notification = new Notification(drawable.ic_dialog_alert,"Server Monitor", when);
                        Context context = getApplicationContext();
                        CharSequence contentTitle = "Server Monitor";
                        CharSequence contentText = "No server on port." + p;
                        notification.setLatestEventInfo(context,contentTitle, contentText, contentIntent);
                        notification.defaults |= Notification.DEFAULT_SOUND;
                        final int HELLO_ID = 1;
                        mNotificationManager.notify(HELLO_ID, notification);

                    }
                } catch (UnknownHostException e) {
                    String ns = Context.NOTIFICATION_SERVICE;
                    NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
                    long when = System.currentTimeMillis();
                    Notification notification = new Notification(drawable.ic_dialog_alert,"Server Monitor", when);
                    Context context = getApplicationContext();
                    CharSequence contentTitle = "Server Monitor";
                    CharSequence contentText = "Could not find host.";
                    notification.setLatestEventInfo(context,contentTitle, contentText, contentIntent);
                    notification.defaults |= Notification.DEFAULT_SOUND;
                    final int HELLO_ID = 1;
                    mNotificationManager.notify(HELLO_ID, notification);

                }

                if (s != null) {
                    try {
                        s.close();
                    } catch (IOException ioEx) {
                        Log.i("Server Monitor", "Unable to close socket "+ s);
                    }
                }
    }

    }, 0, interv);
}
}

So this service checks connectivity with www.google.com at port 81 every 10 seconds. I put this on port 81 to make it fail and test the notifications. When it fails it shows a notification. From the moment I turn of the screen there are no notifications for one or more minutes, and then it gives me all the notifications at once. Below is the activity that starts the service.
Start.java:
package service.App;
import service.App.R;
import service.App.ForegroundService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Start extends Activity{
private Button ButtonStartService;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ButtonStartService = (Button)findViewById(R.id.ButtonStartService);

    ButtonStartService.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent intent = new Intent(ForegroundService.ACTION_FOREGROUND);
            intent.setClass(Start.this, ForegroundService.class);
            startService(intent);
        }

    });
}
}

So i am doing anything wrong here? This is a really important piece of my application so this bug really has to be fixed. Can someone help me please?

A: When in sleep mode (CPU powered off), Android will not execute application code.
To avoid it, you could use the AlarmManager class to schedule an intent to be launched by the phone weakening it from sleep, catching it using a custom broadcast receiver:
http://developer.android.com/reference/android/app/AlarmManager.html
Then, you should acquire a WakeLock using the PowerManager class, to ensure that at least the CPU will be maintained on in order to allows your application code to be performed, and releasing it when not needed anymore (this will allows the phone to returns in sleep mode to avoid a useless battery usage):
http://developer.android.com/reference/android/os/PowerManager.html
Of course, you could also simply obtain a WakeLock as soon as your service is started keeping it until your service is closed, but this approach isn't very battery friendly.


text:
Q: TikZ: Inexplicable whitespace when predefining shapes Assumed we want to predefine some shapes for later usage in a TikZ-picture.

Minimum Working Example (MWE):
\documentclass{standalone}
\usepackage{tikz}

\begin{document}

    \def\testone#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testtwo#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testthree#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testfour#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testfive#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \begin{tikzpicture}
        \testone{(0,0)}{0};
    \end{tikzpicture}
\end{document}

Screenshot of the result:

Description of the issue:
As you can see, there is a lot of whitespace on the left side of the draw. It seems that each \def\figure causes a little shift to the right which in summary produces this big one.
Where does this undesirable space come from? How can I avoid it?

A: It is not coming from the TikZ environment itself. For example, this code works fine:
\documentclass{standalone}
\usepackage{tikz}

    \def\testone#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testtwo#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testthree#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testfour#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

    \def\testfive#1#2{
        \begin{scope}[shift={#1}, rotate=#2]
            \draw(0,0) rectangle (2,1);
        \end{scope}}

\begin{document}
    \begin{tikzpicture}
        \testone{(0,0)}{0};
    \end{tikzpicture}
\end{document}

In other words, the blank lines are producing line breaks or spaces, which are included in the standalone PDF output.
What I recommend here is not to define a command, but a TikZ pic.
\documentclass[tikz]{standalone}
\tikzset{
    myrectangle/.pic={
        \begin{scope}[rotate=#1]
            \draw (0,0) rectangle (2,1);
        \end{scope}
    }
}
\begin{document}
\begin{tikzpicture}
\pic at (0,0) {myrectangle=0};
\end{tikzpicture}
\end{document}


text:
Q: Fix program freeze with ram buffer I'm using program with small bug. It's closed - source, so i cant change it code. It's very good for what its doing, and there is no apps like that one. So i can't use other programs.
But that program has very big problem - that is how she works with disk. It has 2 files - main file where it saves evrything, and backup of that file. That "small" bug - she makes backup byte by byte ( read byte - write byte ). And it does that very five minutes. I'm having SSD disk, and that should be a problem beacos that file is very small (6898 bytes). But , for some stupid reason it frezes when its saving. Its not just small 100 ms freeze, that is very big , 10 second freeze.
So i'm having question: can i do someting about it ? Can i maybe use buffers, or even ram disk (14 mb of memory isnt a problem at all). If i would do ram disk - i need to make sure that info in files are saved to actual disk. That information isnt that big , so if it will be rolled back for 5 minutes - its not that big a problem at all ( its saves it evry 5 minutes , so that really should be a problem at all).
So , question is: how can i speed it up, and what is better to do: buffer, cache, or maybe RAM disk?
And, just so you know: one of the biggest problems with it, there is more files in root folder - so it should be only that one folder if i would use RAM disk.