text:
Q: How to query list of variables in Matlab struct matching a certain pattern? Suppose I have the following struct in Matlab (read from a JSON file):
>>fs.
fs.dichte              fs.hoehe               fs.ts2
fs.temperatur          fs.ts3                 fs.viskositaet
fs.ts1                 fs.ts4

Each one of the fs.ts* components contains another struct. In this particular case, the index of ts goes from 1 to 4, but in another case it could as well be 2 or 7. You get the idea, right? I want the program to be flexible enough to handle any possible input.
So my question comes down to: How to query the maximum index of ts?
In an ideal world, this would work:
who fs.ts*

But unfortunately, it just returns nothing. Any ideas?
(Btw, I'm using Octave and don't have Matlab available for testing; however, there should really be a solution to this which works in both environments.)

A: You can use fieldnames to get all field names of the struct, then use regexp to extract the ones that start with ts and extract the number. Then you can compare the numbers to find the largest.
fields = fieldnames(fs);

number = str2double(regexp(fields, '(?<=^ts)\d+$', 'once', 'match'));
numbers = number(~isnan(number));

[~, ind] = max(number);
max_field = fields{ind};
max_value = fs.(max_field);

A: Not an answer to your exact question but sounds like instead of tsN fields, you should have a single ts field with a list.
Tip: every time you see a number in a variable or field name, think whether you shouldn't be using a vector/array/list instead.
This is true for all languages but more so for Octave since everything is arrays. Even if you have three field named ts1, ts2, and ts3 with scalars values, what you really have is three fields whose values are an array of size 1x1.
In Octave you can have two things. Either the value of ts is a cell array, each element of the cell array a scalar struct; or is a struct array. Use a cell array of structs when each struct has different keys, use a struct array when all structs have the same keys.
Struct array
octave> fs.ts = struct ("foo", {1, 2, 3, 4}, "bar", {"a", "b", "c", "d"});
octave> fs.ts # all keys/fields in the ts struct array
ans =

  1x4 struct array containing the fields:

    foo
    bar

octave> fs.ts.foo # all foo values in the ts struct array
ans =  1
ans =  2
ans =  3
ans =  4

octave> numel (fs.ts) # number of structs in the ts struct array
ans =  4

octave> fs.ts(1) # struct 1 in the ts struct array
ans =

  scalar structure containing the fields:

    foo =  1
    bar = a

octave> fs.ts(1).foo # foo value of the struct 1
ans =  1

Cell array of scalar structs
However, I'm not sure if JSON supports anything like struct arrays, you will probably need to have a list of structs. In that case, you will end up with a cell array of struct scalars.
octave> fs.ts = {struct("foo", 1, "bar", "a"), struct("foo", 2, "bar", "b"), struct("foo", 3, "bar", "c"), struct("foo", 4, "bar", "d"),};
octave> fs.ts # note, you actually have multiple structs
ans =
{
  [1,1] =

    scalar structure containing the fields:

      foo =  1
      bar = a

  [1,2] =

    scalar structure containing the fields:

      foo =  2
      bar = b

  [1,3] =

    scalar structure containing the fields:

      foo =  3
      bar = c

  [1,4] =

    scalar structure containing the fields:

      foo =  4
      bar = d

}
octave-gui:28> fs.ts{1} # get struct 1
ans =

  scalar structure containing the fields:

    foo =  1
    bar = a

octave-gui:29> fs.ts{1}.foo # value foo from struct 1
ans =  1


text:
Q: Change logback level and save to logback.xml So I'm using logback for my java application, now the client wants to be able to change from the GUI the log level (and propagate as soon as possible) I know there is two ways this can be done:
Logger root = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.INFO);
or
<configuration scan="true" scanPeriod="30 seconds">

The thing is I want to update the level in the logback.xml file so that it automatically scans it but also in future sessions it can read the changed level from the xml. I'm tempted to parse the whole file looking for this piece:
<root>
      <level value="debug"/>

and change it manually, but there must be a better way to write it to the conf file.

A: I would suggest to store log level configuration in separate properties file like
root_log_level=INFO

This file can be included and variable from it used in logback.xml
<configuration scan="true">

  <property scope="local" file="logback_root_level.properties" />

  <root level="${root_log_level}">
   ...
  </root>
</configuration>

Note that scope of variable should be local, this will refresh its value on configuration rescan.

A: Changes in separate properties file doesn't reflect back changes. I have found the solution
You need to include separate xml file containing properties like named LOGBackIncludedFile.xml
<property name="LOG_LEVEL" value="OFF"/>

and in logback.xml include this file
<configuration scan="true" scanPeriod="10 seconds">

    <include file="D:/LOGBackIncludedFile.xml" />

     <root>
        <level value="${LOG_LEVEL}" />
        <appender-ref ref="app" />
     </root>
</configuration>

and restart the server once and then onwards dynamic changes to property value would reflect back.

A: Changing separate properties file won't make logback configuration reload. You also need to change logback.xml file modified date to force reload. This will reload property in separate properties file.

A: You can pass the log level as an environment variable
export LOG_LEVEL=INFO
<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
  <property scope="OS environment" />
...
  <root level="${LOG_LEVEL}">
    <appender-ref ref="json"/>
  </root>

in logback.xml

redpajama_set_name: RedPajamaStackExchange


text:
Q: Association references unmapped class: System.Guid I keep getting the exception Association references unmapped class: System.Guid with NHibernate 3.1 and FluentNHibernate 1.2.
I'm not sure how this is possible. Isn't the mapping of Guid handled internally?
I saw several previous mentions of a bug in Fluent NHibernate 1.0 and someone mentioned to use trunk instead where it was fixed, but I'm on 1.2 rather than 1.0, so presumably this issue has been resolved.
Edit: Here's some additional information -- an example HBM I've exported from the Fluent AutoMapper looks like the following
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
  <class xmlns="urn:nhibernate-mapping-2.2" lazy="false" name="Treadmarks.Bus.Frontend.Model.PassType, Frontend, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="`PassType`">
    <id name="PassTypeId" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <column name="PassTypeId" />
      <generator class="guid.comb" />
    </id>
    <property name="Name" type="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <column name="Name" />
    </property>

    <property name="UsageInterval" type="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <column name="UsageInterval" />
    </property>
  </class>
</hibernate-mapping>

And following is the FNH code that generates said HBM:
    private class AutomappingConfiguration : DefaultAutomappingConfiguration
    {
        public override bool ShouldMap(Type type)
        {
            return type.Namespace.StartsWith("Treadmarks.Bus.Frontend.Model");
        }

        public override bool IsId(FluentNHibernate.Member member)
        {
            return member.Name == member.DeclaringType.Name + "Id";
        }
    }

    public static Configuration BuildConfiguration()
    {
        return Fluently.Configure()
            .Database(SQLiteConfiguration.Standard.ConnectionString("Data Source=Treadmarks.db; Compress=true"))
            .Mappings(
                m => m.AutoMappings.Add(AutoMap.Assembly(Assembly.GetExecutingAssembly(), new AutomappingConfiguration())
                                            .Conventions.Add(
                                                DefaultLazy.Never(),
                                                LazyLoad.Never())
                         ).ExportTo("mappings.hbm"))
            .BuildConfiguration();
    }

A: It turns out FNH can't properly generate mapping for List<Guid> like it can for List<int>, etc. I'll report this to the FNH team.

A: I got this error message yesterday when wiring up Fluent on a new project.  It is working now (with Guid keys) but I am not able to reproduce the error now.
The message itself conveys that it is looking for mapping configuration for System.Guid.  My best guess is that it's seeing a property name that is triggering its foreign key logic and that property name is associated with a Guid.
Maybe you could add a new foreign key convention so it no longer makes those assumptions with that default logic?

A: You don't need to specificy the type for id mapping, or if you do specify an nhibernate type like 'Guid' see http://nhforge.org/doc/nh/en/index.html#mapping-types


text:
Q: Displaying posts with only upcoming dates according their custom field date value I got posts that have starting date as a custom field value. I'm displaying few of those posts in my sidebar in ascending order so that the post with closest starting date is shown first. This is what I have and it works great:
<?php query_posts('&post_type=events&posts_per_page=5&meta_key=start_date&orderby=meta_value&order=asc'); ?><?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>

But I was wondering, how could I filter the query so that it won't display posts with their starting dates already gone?
I've experimented with this:
$today = date('d/m/Y', strtotime('+2 hours'));
      query_posts(array(
      'post_type' => 'events',
      'posts_per_page' => 5,
      'meta_key' => 'start_date',
      'orderby' => 'meta_value',
      'order' => 'ASC',
      'meta_query' => array(
         array(
         'key' => 'start_date',
         'meta-value' => $value,
         'value' => 'start_date',
         'compare' => '>=',
         'type' => 'CHAR'
         )
      )
   ));

But it doesen't display anything. One thing to note is that the starting date value is saved in mm/dd/yyy -format, but changing the $today's date format haven't helped either.
UPDATE
So now I got this:
    <?php
$today = date('m/d/Y', strtotime('+2 hours'));
$the_query = new WP_Query( array(
      'post_type' => 'events',
      'posts_per_page' => 5,
      'meta_key' => 'start_date',
      'orderby' => 'meta_value',
      'order' => 'ASC',
      'meta_query' => array(
array(
         'key' => 'start_date',
'meta-value' => 'start_date',
         'value' => $today,
         'compare' => 'DATE',
         'type' => 'CHAR'
))
   ));
?>

Nothing shows up in the sidebar.
Note: the date is in that format since the posts are saved with the start_date custom field in that format. I'm just trying to get this work, then I'll change the date format to a more suitable one.

A: For this to work reliably, the date format in the database should be yyyy-mm-dd. Comparison type should be DATE or NUMERIC. If you take the date of 25-04-2012 in present format and compare it numerically to the date 26-04-1986, you can see what the issue will be: 25042012 < 26041986
ALso- if you're doing these queries in addition to your main loop, use a new instance of WP_Query.
EDIT-
there were a few errors you didn't fix. note that this still won't work quite right until you fix the date format.
<?php
$today = date('m/d/Y', strtotime('+2 hours'));
$the_query = new WP_Query( array(
  'post_type' => 'events',
  'posts_per_page' => 5,
  'meta_key' => 'start_date',
  'orderby' => 'meta_value',
  'order' => 'ASC',
  'meta_query' => array(
  array(
    'key' => 'start_date',
    'value' => $today,
    'compare' => '>=',
    'type' => 'DATE'
  ))
));
?>


text:
Q: Carry Flag Compare, when is the carry flag set? The assembler has this code:
sub$0x22,%eax # %eax = %eax - 22
cmp$0x7,%eax  # %eax > 7 then jump *this is where I have trouble*
ja some address # jump if C = 1 or Z = 1

My goal is to not make the jump.
I have tried the cases where %eax = 30, 14, 28, 16, 0 , 22
Question:
I don't understand why c=0 and z=0 with all the cases I have tried.

A: 0x22, which is 34 decimal, is larger than all of those sample eax values (assuming they're decimal).  Thus, the result of the subtraction is negative.  But a "negative" integer is just an integer where the most significant bit is a 1, and can also be interpreted as a large unsigned number.
It's probably easier to think of ja in terms of what it means conceptually rather than the actual logic on the flags.  (see this answer)  You can think of ja as an unsigned comparison.  So those negative numbers look like really big numbers that are larger than 7.  If you used a jg instruction instead, it should behave more like what you're expecting.  It can be thought of as a signed comparison.


text:
Q: Help to compute $\mathrm{Tor}_{n}^{\mathbb{Z}_{4}}(\mathbb{Z}_{2},\mathbb{Z}_{2})$? Consider $\mathbb{Z}_{2}$ as a $\mathbb{Z}_{4}$-module. How to compute $\mathrm{Tor}_{n}^{\mathbb{Z}_{4}}(\mathbb{Z}_{2},\mathbb{Z}_{2})$?

A: You need a free (or projective) resolution of $\mathbb{Z}_2$. One is
$$\dots\to\mathbb{Z}_4\to\mathbb{Z}_4\to\mathbb{Z}_4\to\mathbb{Z}_4$$
where every arrow is multiplication by $2$. Now you tensor this complex (over $\mathbb{Z}_4$) with $\mathbb{Z}_2$ and you get
$$\dots\to\mathbb{Z}_2\to\mathbb{Z}_2\to\mathbb{Z}_2\to\mathbb{Z}_2$$
where the arrows are now zero. Your Tor's are the cohomology of this complex. As a result, they are $\mathbb{Z}_2$ for every $n$.


text:
Q: Adding timeout in subprocess.check_output I am developing a small tool in Python 2.7 and using subprocess module. I am using this module to run commands on remote devices using its check_output function. There might be a situation in which the remote device is not functioning and therefore I am getting the following response:
Timeout: No Response from 10.xxx.xxx.xxx
Following is my code:
try:
    x=subprocess.check_output(command, shell=True)
except Exception:
    print ("Some issues in fetching details")
    exit()
else:
    print (x)

I want to put timeout into this function so that if after a certain amount of time, no response is recieved, my code goes in the Exception part and prints the given message. I tried using timeout argument in the check_output command but after running my script with timeout argument, it is immediately printing the message given in the Exception part.
What I tried:
try:
    x=subprocess.check_output(command, shell=True, timeout=5)
except Exception:
    print ("Some issues in fetching details")
    exit()
else:
    print (x)

A: My guess is that you are running your code in Python 2.
If that is the case, subprocess.check_output() does not accept a timeout parameter, and the function will fail immediately with:
TypeError: __init__() got an unexpected keyword argument 'timeout'

But, because you are catching all exceptions and printing a generic message, you don't see the actual exception, and you assume that the command is timing out immediately.
One way to fix this problem is to run your code in Python 3.
Whether you are running Python 2 or 3, I recommend that you do not catch all exceptions, or that you at least print the value of the exception so that you can see the actual cause, e.g.
try:
    x=subprocess.check_output(command, shell=True, timeout=5)
except subprocess.TimeoutExpired as exc:
    print("Command timed out: {}".format(exc))
    exit()
else:
    print (x)

which explicitly checks for a timeout exception. All other exceptions are propagated as usual and so are not masked by your "catch all" code. Or,
try:
    x=subprocess.check_output(command, shell=True, timeout=5)
except Exception as exc:
    print("Command failed: {}".format(exc))
    exit()
else:
    print (x)

but the former is preferred.
Edit
OP can't use Python 3. If you are using Linux then you could use the timeout command, e.g.
x = subprocess.check_output('timeout 5 {}'.format(command), shell=True)

On timeout this will raise an exception with a particular exit status value of 124:
subprocess.CalledProcessError: Command 'timeout 5 sleep 10' returned non-zero exit status 124

BTW you shouldn't use the shell=True option as there are security implications as mentioned in the documentation. Instead you should pass a list of strings to check_output() like this:
from shlex import shlex

command = shlex('timeout 5 {}'.format(command))
try:
    x = subprocess.check_output(command)
except subprocess.CalledProcessError as exc:
    if exc.returncode == 124:
        print "Command timed out"
    else:
        raise

If you are using another OS (or you don't want to use timeout) then you can run your subprocess in a separate thread and have your main thread time it out if required. See this other question, Using module 'subprocess' with timeout, for details about how to do that.

A: Python 2.7 does not support timeout parameter. You can instead use EasyProcess. This is a layer on top of subprocess module and pretty easy to use.


text:
Q: Delete my account in B2C tenant for social logged in user I have a B2C tenant which is used for social login to the web app, I wanted to check regarding delete my account flow.
How can I invoke it for each user who want to delete their account?
When they click delete, it should delete their entry from B2C tenant.
I tried with Graph API but that requires admin role to do that, I want social users to delete their account.
Can user delete its account from B2C tenant directory?
I found this link but not sure how to implement it or use it.
https://github.com/azure-ad-b2c/samples/tree/master/policies/delete-my-account

A: This sample uses a custom policy.
If you look in the policy, you'll see it inherits from "B2C_1A_TrustFrameworkExtensions". You can find this file in the starter pack.
If you haven't set up the custom policy framework, this utility will help.


text:
Q: My laptop automatically shuts down when I play CSGO As the title says my laptop immediately shuts down when I enter CS:GO game.
I launch steam with "launch with dedicate graphic card" and play CS:GO from the library everything works fine in the lobby until I enter the game then my laptop shuts down.

A: After a "sudden shutdown", aka "system crash", and reboot, the terminal  command sudo journalctl  -b -1 -e will show you the end of the previous boot's log's. If there is no hint there, suspect power/ overheating.
Read man journalctl to see how to extract information from the logs.
You can find how I make use of journalctl easier at https://askubuntu.com/users/25618/waltinator.


text:
Q: Pandas and differential/derivative for non-uniform samples? Let's say I have the following data:
import pandas as pd
df_data = pd.DataFrame(data={'time': [0, 0.1, 0.3, 0.4, 0.7], 'vals': [1, 3, 5, 7, 9]})
df_data
   time  vals
0   0.0     1
1   0.1     3
2   0.3     5
3   0.4     7
4   0.7     9

If we take this to represent samples of some variable in time, it is quite obvious that the sampling period is not even - ergo, the sampling is non-uniform. So we cannot really just use .diff() in order to calculate the "differential" of vals:
df_data.diff()
   time  vals
0   NaN   NaN
1   0.1   2.0
2   0.2   2.0
3   0.1   2.0
4   0.3   2.0

So, instead, here I'd go through the definition of finite difference, manually like so:
df_data.diff()["vals"]/df_data.diff()["time"]
0          NaN
1    20.000000
2    10.000000
3    20.000000
4     6.666667
dtype: float64

And indeed, the growth of vals per unit time is stronger in the time from 0.0 to 0.1, than from 0.1 to 0.3 etc.
So, I was wondering: is there a built in "switch" in pandas, so I can tell it "calculate differential/derivative of this column in respect to that column" - or should I just do it manually?

A: AFAIK, there is no such "switch". See also this related SO post. I'd stick to your own solution for the sake of readability:
dx = df_data["vals"].diff()
dt = df_data["time"].diff()
x_dot = dx/dt

Better specify the column of interest before calling diff() to avoid unnecessary/repeated work.


text:
Q: Show that if $f$ is analytic then $g(z)=\overline{f(\overline{z})}$ is analytic and find its derivative
Let $f:\mathbb{C}\to\mathbb{C}$ be an analytic function. Show that $g(z)=\overline{f(\overline{z})}$ is analytic and find its derivative.

$f$ is analytic then C-R equations hold. Suppose $f=u+iv$.
Then $g(z)=u(x,-y)+i(-v(x,-y))$. We can observe that C-R equations hold for $g$ as well since if we set $\hat{u}(x,y):=u(x,-y)$ and $\hat{v}(x,y)=-v(x,-y)$ we get
$$
\hat{u}_x=u_x=-v_y=-\hat{v}_y
\\-\hat{u}_y=u_y=v_x=-v_x
$$
But this is not enough for to show that $g$ is analytic.

A: If $f(z) = \sum\limits_{k=0}^{\infty} a_nz^{n}$ then $g(z)=\sum\limits_{k=0}^{\infty} \overline {a}_n z^{n}$. You can differentiate the series for $g$ term by term.
$g'$ is obtained from $f'$ the same way $g$ is obatined from $f$.


text:
Q: Should a LineSegment class disallow approximately equal endpoints in its constructor? Imagine a LineSegment class that represents a line segment using two arbitrary endpoints.
Should the constructor throw if it is passed two approximately equal endpoints? Obviously this would require some arbitrary floating point comparison. For example, test the Euclidean distance between the endpoints is less than ε.
An advantage is users aren't going to get nonsense answers to certain questions if they construct a LineSegment with floating point noise, or two points that "should" be equal but diverged due to error in floating point calculations. For example, it would otherwise be dangerous if the user asked the direction a line segment was pointed.
A disadvantage is that the class now needs to try to encapsulate and maintain this requirement on the state of the two endpoints. Moving an endpoint of the LineSegment would have the potential to throw.
Imagine a PolyLine class that uses these LineSegment under the hood. If the user wants to insert a new point in the PolyLine it could throw if that point is within ε of another point. Would a SafeInsert need to delete all nearby points? Could users tolerate a SafeInsert that potentially reduced the size of their PolyLine? Even deleting a point could throw, because it could bring together two approximately equal points.
The alternative to throwing in the constructors is to skip validation, and rely on users to call a Douglas-Peucker or related algorithm if there is risk their LineSegment or PolyLine data would provide unreasonable answers. Users would provide their own ε when they used this function.
Is anyone familiar with existing implementations of LineSegment or PolyLine classes that prefer one approach to the other?

A: Depends on context, but just generally speaking, if you don't know the answers to these questions, I would suggest to seek to make your LineSegment allow this case without throwing, and if possible, even find a way to allow your PolyLine cases to also work without throwing.


text:
Q: How to do hierarchical configuration in .NET's app.config app.config configuration sections are nice, but I often need multiple configuration sets, but with small difference.
what I want is:

*

*Have one section with default configuration (this one is created with the designer, and thus has the auto-generated strongly-typed accessors in the Settings class

*Another section with only the "new" items, and all other items get their values from the original section.

(note - it is also would be nice to place that "other section" in a separate file, but this is a different issue.)
Edit: the application is plain executable (or a service) - it is not a web service.
Also, I know there is a "machine.config" to inherit from, but its too global: its for all apps together

A: I think you'd have to use a custom handler to manage this.
The second part is easy as you can use an configSource Attribute in the original config file to point to a file that contains the xml source.
<system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true" />
    </diagnostics>
    <bindings configSource="web.shared.bindings.config" ></bindings>
    <client configSource="web.shared.client.config" ></client>
</system.serviceModel>

Here is how we link parts of the Service.ServiceModel XML into our Web Config so we can keep them seperate and easily edited.


text:
Q: computing kernel of ring homomorphism from polynomial rings Is there a simple way to find the kernel of maps from polynomial rings?
Specifically, let $k$ be a field and let us consider the map $$\Psi: k[X,Y]\longrightarrow k[T],$$ defined by $$f(X,Y)\rightsquigarrow f(T^2-1,T(T^2-1)).$$
We observe that $(0)\subset(Y^2-X^2-X^3) \subseteq \ker\Psi\subset (X,Y)$, and all are prime ideals in $k[X,Y]$. But $k[X,Y]$ has dimension 2 (transcendence degree = 2), therefore the chain above should have length at most $3$, implying $(Y^2-X^2-X^3)=\ker\Psi$.
However I wonder that there must be a better (in a sense I don't discern myself), perhaps more elementary solution. Indeed, this is an exercise in Shafarevich appearing before dimension has been introduced. Also any answers/comments regarding any method to solve this sort of problems (which abound!) are welcome. Thank you very much!!

A: Let $I = (Y^2 - X^2 - X^3)$ and $J = \ker \Psi$. Let $h(X,Y) \in J$. We wish to show that $h(X,Y) \in I$. $h(X,Y)$ is congruent modulo $I$ to some polynomial $j(X,Y) = f(X) + Yg(X)$, which must also belong to $J$. So it is enough to prove that $j(X,Y) = 0$.
We have $f(T^2 - 1) + T(T^2 - 1)g(T^2 - 1) = 0$. The right-hand term, if nonzero, has odd degree, while the left-hand term has even degree. Therefore we must have $f(X) = g(X) = 0$.


text:
Q: Apply styling with pseudoclass :focus-visible on PrimeNG Components I am using PrimeNG Components like Checkboxes, Radiobuttons etc. in my application.
I want to apply CSS on these components, but only, when they are focused by pressing Tab and want to use the pseudo class :focus-visible.
I was able to apply CSS with something like
body .ui-chkbox .ui-chkbox-box.ui-state-active.ui-state-focus {
  border-color: red
}

But then style applies also, when focused by mouse click as well.
What would be the CSS syntax with :focus-visible pseudo class to style PrimeNG Components?


text:
Q: Append query Access not working as expected I have 2 tables, both equal. For the example let's call them Table A and Table B.
Table B is an exact copy of Table A - but without the data.
Table A holds engineering data and a DATE field.
I have written some code that does some calculations etc. and after those calculations, it should APPEND the data from Table A to Table B so as to keep a historical reference to the data.
Now, I can append from Table A to Table B with the following Query:
INSERT INTO [Table B] SELECT [Table A].* FROM [Table A]

This works once. The second time I run it (whith another date in Table A) Table B is not updated. Why? What am I missing here?
Probably something silly.. But I can't seem to figure it.
Of course I can do a loop in code and fill it record for record.. but that's slow.
*tables have autonumber key fields and duplicates are allowed on all other fields.

A: nvr mind..
"INSERT INTO [Table B] SELECT * FROM [Table A]"
works.
Still strange though that the original query works once.. but ok. Solved


text:
Q: TeamCity + NuGET - can't revert back to .NET 4.0 I have a .NET application that depends on many projects/builds. We are using TeamCity as our continuous integration server. I successfully set up the order of builds, based on dependencies and got the application compiling at the end correctly. This was using Visual Studio 2010. We recently switched to 2012 and I made the mistake of trying to move the build from .NET 4.0 to .NET 4.5 at the same time that I switched the builds to use VS 2012. Everything still worked, but the customer couldn't use .NET 4.5 in his environment. Now I'm trying to still use VS 2012, but revert everything back to 4.0.
DLL 1 is successfully compiling and I'm creating a .NUPKG to be used by DLL2. I see the artifacts for DLL1 and they show that the .NUPKG is indeed .NET 4.0. But when I try to compile DLL2, it can't 'find' DLL 1. I look in my packages folder and what seems to have been installed was .NET version 4.5 of DLL1.
I have tried installing  the dll directly, as a 'dependency', found it was being erased (went into bin/Release and I was doing a Clean/Build), fixed that, but the system still didn't seem to think it was the right version. I have tried using the NUGET installer, and the 4.5 version seems to be what I get. I have tried using 'restore of missing packages', set up from VS 2012, and I still get 4.5.
From the logs:
[install] NuGet command: C:\TeamCityBuildAgent\tools\NuGet.CommandLine.2.1.0.nupkg\tools\NuGet.exe install C:\TeamCityBuildAgent\work\52d92aca0070dc48\OurLibrary\packages.config -OutputDirectory C:\TeamCityBuildAgent\work\52d92aca0070dc48\packages -Source http://localhost/guestAuth/app/nuget/v1/FeedService.svc/
[install] Starting: C:\TeamCityBuildAgent\temp\agentTmp\custom_script2900382890103739900.cmd
[install] in directory: C:\TeamCityBuildAgent\work\52d92aca0070dc48\OurLibrary
[install] All packages listed in packages.config are already installed.

If I run this command and the package has been deleted, it is correctly reinstalled. But the version reinstalled is net45.
Yes, my package.config does require 4.0:
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="MyCompany.Metadata.Interfaces" version="1.0.0" targetFramework="net40" />
</packages>

Suggestions??

A: If I understood the problem correctly, can you try running update-package -reinstall -Source http://localhost/guestAuth/app/nuget/v1/FeedService.svc/ from the package manager console and see if it's updated correctly?


text:
Q: Suppressing reduction in fraction box size in multi-level fractions Mathematica display complex fractions like this,

the second x look smaller, I want it look like this, how can I get it in Mathematica?

A: Start with
HoldForm[1/(1 + 1/x)] // TraditionalForm

which produces the fraction box in reduced size.

Now open the output cell with Cmnd+Shift+e and add FractionBoxOptions->{AllowScriptLevelChange->False} at the end.
Cell[BoxData[
  FormBox[
    TagBox[
      FractionBox["1",
        RowBox[{"1", "+",
        FractionBox["1", "x"]}]],
      HoldForm], TraditionalForm]], "Output",
  FractionBoxOptions->{AllowScriptLevelChange->False}]

Close close the cell with Cmnd+Shift+e and you will see

Note. I think on Windows it is Ctrl+Shift+e
Another way is to use the Option Inspector. Select the output cell and make the following change in the Option Inspector.

A: Just an extended comment to the answer of m_goldberg.
Without changing the standard settings in Option Inspector:
fractionStyle = Style[#, DefaultOptions -> {FractionBoxOptions -> {AllowScriptLevelChange -> False}}] &;
HoldForm[1/(1 + 1/x)] // fractionStyle // TraditionalForm

An additional advantage using DefaultOptions is i.e. having a list of fractions, or any other bigger programming construct, fractionStyle is applied only once at the end (like TraditionalForm).


text:
Q: Java getBytes does not return the same in test than in injectMock I am trying to compare the result of this function:
public  Map<String, Object> addToMap(List<String> keys, Map<String, Object> data) {
    Map<String, byte[]> map = new HashMap();
    emptyIfNull(keys).forEach(key -> {
      if (data.containsKey(key)) {
        map.put(key, data.get(key).toString().getBytes(StandardCharsets.UTF_8));
      }
    });
    return map;
  }

with this:
@Test
public void testAddToMap(){
    byte[] data = "data".getBytes(StandardCharsets.UTF_8);
    Map<String, byte[]> map = Map.of("label", data);
    List<String> keys = list("label","key");
   assertThat(mapping.addToMap(keys, map)).isEqualTo(map);
}

But Mockito says that they are not the same bytes.
The first one returns : [B@75bdf892}
while the second one returns: [B@597d8aad}
How come so?

A: Your addToMap doesn't copy the values from the input map into the output map - it processes them (data.get(key).toString().getBytes(StandardCharsets.UTF_8)).
Your unit test has to account for that:
@Test
public void testAddToMap() {
    String testString = "data";
    byte[] resultData = testString.getBytes(StandardCharsets.UTF_8);

    Map<String, Object> inputMap = Map.of("label", testString);
    Map<String, byte[]> outputMap = Map.of("label", resultData);
    List<String> keys = list("label","key");

    assertThat(mapping.addToMap(keys, inputMap)).isEqualTo(outputMap);
}

The problem is that in addToMap() you do data.get(key).toString().getBytes(StandardCharsets.UTF_8)
In your test method you have
byte[] testData = "data".getBytes(StandardCharsets.UTF_8);
Map<String, byte[]> map = Map.of("label", testData);

In addToMap() you have
data.get(key).toString().getBytes(StandardCharsets.UTF_8)

which is (if we insert testData for data.get(key))
testData.toString().getBytes(StandardCharsets.UTF_8)

But String.getBytes(StandardCharsets.UTF_8) and byte[].toString() are not inverse operations!
For almost all Strings str
str.equals(str.getBytes(StandardCharsets.UTF_8).toString())

will return false (except for some rare cases where str starts with "[B@" and happens to be followed by some hex characters so that str forms a string like "[B@597d8aad"

A: Working example without casts:
` private static Map<String, byte[]> addToMap(List<String> keys, Map<String, byte[]> data) {
    Map<String, byte[]> map = new HashMap<String, byte[]>();
    keys.forEach(key -> {
      if (data.containsKey(key)) {
        map.put(key, data.get(key));
      }
    });
    return map;
}

public static void main(String[] args) {
    byte[] data = "data".getBytes();
    Map<String, byte[]> map = new HashMap<>();
    map.put("label", data);

    List<String> keys = new ArrayList<String>();
    keys.add("label");
    Map<String, ?> result = addToMap(keys, map);

    System.out.println(result.get("label") == map.get("label"));
}


text:
Q: How to identify that the input String has a is variable or not One of my tasks is to identify the input string has a variable or not.
For example: User might enter a string #define int a,ab; and in this string i want to identify which is one is variable
example 2 : User might also enter '#anything float a,b,c;' and now here i again want to identify that what variable did user entered
How to identify this, in C language?

A: So you want to create a new variable based on an input string?
So the types to search a string for would include ("char","int","short","long","float","double"). This is a nice basic set of types to check a string for.
Now iterate through the input string and check if any word from the set is contained in the string. To do this I would suggest strcmp(str1,str2)
If any of the types is found in the input, you can assume whatever comes after it is the identifier.
Read about string iteration and string comparison and apply these methods and you should have this program finished in no time.


text:
Q: Hipaa Compliant Server I have an instance in Amazon EC2 and need to be Hipaa compliant. I have two doubts,

*

*Should I need to do a block level encryption of the database storage.

*Should I need to encrypt sensitive data before storing in the database.

*Best database software to handle with the encryption

Any help will be highly appreciable,
Thank You.

A: The problem with HIPAA is that it's relatively subjective and has been interpreted differently by individuals to suit their purposes - see here for a quick primer on HIPAA.
The general approach you should take is one of trying to maximize the security of your user's PHI (protected health information). Generally HIPAA recommends / requires that you encrypt PHI data at rest and in-transit covered under 164.312 of the HIPAA Omnibus act.
So you are free to interpret that ruling for:

*

*At-rest encryption: by encrypting the disk/block on which the data is stored. or encrypting the data before it is stored on disk. The latter will obviously be very expensive CPU wise. Any encryption / decryption process will be more CPU intensive so you should expect to take a performance hit anyway. We overcame this by using SSDs everywhere. The approach we also took was to encrypt the block rather than the database read write ops. That is more than sufficient to address HIPAA's needs. If you encrypt the block, you don't need to use any DB specific tools for encryption etc. That will definitely simplify your life.

*In transit encryption: Covered under 164.312(e)(1) of the Act. Generally this applies to any movement of PHI. So if you're to and from your app and to and from your db, you must at a very minimum encrypt the data (SSL/https). So ensure any data over the web is done over https. Transmissions between your app and db technically still fall into the "in-transit" requirement. However, you can easily make the argument that this is within your VPC and thus not required. We chose to encrypt this as well to simplify our audit process.

Hope all this helps.
I'm sure you know this already but this only covers a small subset of things that HIPAA needs. There's a whole lot involved in terms in documentation, training etc. See here for documenting how you comply with HIPAA, here for how you have set up the actual policies within your organization and here re your HIPAA training as starting points you could use. Also check out Accountable HQ to perhaps help you get a quick head start.

A: AWS HIPAA center is a good start: HIPAA in AWS.
As mentioned on that page:

You can use any AWS service in your HIPAA-compliant applications. However, only the HIPAA-eligible services defined in our BAA can be used to process, store, and transmit personally-identifiable patient data.

Read the two AWS HIPAA FAQs: Part 1 and Part 2. You will also need to understand the shared responsibility model.
EC2, EBS are HIPAA-eligible services. However you need turn on EBS encryption, and run them on dedicated instance. The price tag for that is not small, may be overkill for a single instance/small system.
Regarding your questions:

*

*Should I need to do a block level encryption of the database storage.

If you run database on EC2 + EBS, then yes; and this is just one click on AWS.
If you use RDS (a managed service) then this is handled for you by AWS.
 Note: only MySQL and Oracle are HIPAA-eligible RDS at the time of writing (Sept/2016). However you can run MS SQL Server on your HIPAA-eligible EC2 & EBS.

*Should I need to encrypt sensitive data before storing in the database.

Not really needed. I would say Yes only if you need this as an extra security layer, but it doesn't improve your HIPAA-compliance status.

*Best database software to handle with the encryption

It depends on your specific architecture. If you use encrypted EBS or RDS, then the encryption is already handled for you.
I would suggest to contact AWS support and get a BAA, then do a TCO calculation for entire solution before moving forward.


text:
Q: Greenplum Database service running on docker consumes high disk space I have a greenplum database instance running on docker. There is very little data in the tables+indexes (approx. 550 MB).
I checked the size of all tables using the query below:
SELECT *, pg_size_pretty(total_bytes) AS total
    , pg_size_pretty(index_bytes) AS INDEX
    , pg_size_pretty(toast_bytes) AS toast
    , pg_size_pretty(table_bytes) AS TABLE
  FROM (
  SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
      SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
              , c.reltuples AS row_estimate
              , pg_total_relation_size(c.oid) AS total_bytes
              , pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS index_bytes
              , pg_total_relation_size(reltoastrelid) AS toast_bytes
          FROM pg_class c
          LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
          WHERE relkind = 'r'
  ) a
) a
order by total_bytes desc

The docker image is 4.7 GB. So approximate usage for this greenplum docker image should be (4.7 + 0.5 ) = 5.2 GB. But, the docker container consumes 13GB disk space.
The disk usage is as below:
[gpadmin@mdw ~]$ df -h
Filesystem                           Size  Used Avail Use% Mounted on
overlay                               17G   13G  4.7G  73% /
tmpfs                                2.0G     0  2.0G   0% /dev
tmpfs                                2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/centos_greenplum01-root   17G   13G  4.7G  73% /etc/hosts
shm                                   64M     0   64M   0% /dev/shm
tmpfs                                2.0G     0  2.0G   0% /proc/acpi
tmpfs                                2.0G     0  2.0G   0% /proc/scsi
tmpfs                                2.0G     0  2.0G   0% /sys/firmware

The host machine and docker are both CentOS.
As part of testing my application, I stop/start the docker container multiple times through the day.

A: Debug steps to identify if the root cause was docker or greenplum.
Login to docker:
cd /
df -schk *

Iteratively check the largest directories:
The cause for the issue is huge log files in /data/primary/gpseg1/pg_log.
I removed all logs older than 2 days.


text:
Q: How to partial transform in XSLT I have done XSLT transformation on the XML and now would like to apply XSLT to alter some of the content.
How to wrap all the tr element in table element? I am was using XSLT 1.0 in C#.
XML
<?xml version="1.0" ?>

A

B

C

C1

C2

C3

D

D1

D2

D3

Expected Result:

A: Simply start with the identity transformation template and then add a template for elements containing tr children to wrap them in a table:
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="*[not(self::table) and tr]">
      <xsl:copy>
          <xsl:apply-templates select="@*"/>

              <xsl:apply-templates/>

      </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

https://xsltfiddle.liberty-development.net/6qVRKwV


text:
Q: Highlight selected references with asterisk I'm using Biblatex/Biber with the phys style. I would like to highlight selected references in the text with an asterisk, i.e. the number should be marked. A \cite{key1,highlightedkey,key2} should result in something like [13,78*,99] in the text.
I found this solution to a similar problem: Is it possible to mark designated entries in a bibliography with an asterisk? But there, the entry is highlighted in the bibliography. Is there a way to achieve what I'm looking for?

A: A solution that works quite well for me:
added to preamble:
\renewcommand{\postnotedelim}{}
\DeclareFieldFormat{postnote}{#1}

then use:
\cites{key1}[][$^\ast$]{highlightedkey}{key3}

gives me the output I was looking for.
Please note that this solution may not apply to anyone as the postnote behavior is changed for the entire document. (No problem in my case.)

A: If we use the category approach we can automate this behaviour.
\DeclareBibliographyCategory{asterisk}

We use a macro to avoid having to type too much
\newcommand*{\addcat}{%
  \ifcategory{asterisk}%
    {*}%
    {}%
}

Then we add the asterisk to the bibliography with
\renewbibmacro*{begentry}{\addcat}

Finally, we patch relevant numeric-comp macros to also include the asterisk if need be (you will need the xpatch package for that).
Which macros we need to modify heavily depends on the style, phys is based on numeric-comp. A rule of thumb is that every \printfield{labelnumber} needs an additional \addcat.
\xpatchbibmacro{cite:comp:comp}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:end}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:inset}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

Works to be marked with an asterisk are handed over to \addtocategory{asterisk}{<citekey>} as in
\addtocategory{asterisk}{geer,knuth:ct:b}

MWE
\documentclass[12pt,a4paper]{article}
\usepackage[style=numeric-comp]{biblatex}
\usepackage{xpatch}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{asterisk}
\newcommand*{\addcat}{%
  \ifcategory{asterisk}%
    {*}%
    {}%
}
\renewbibmacro*{begentry}{\addcat}

\xpatchbibmacro{cite:comp:comp}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:end}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

\xpatchbibmacro{cite:comp:inset}
  {\printfield{labelnumber}}{\printfield{labelnumber}\addcat}
  {}{\typeout{failed to patch cite:comp:comp macro}}

\addtocategory{asterisk}{geer,knuth:ct:b}

\begin{document}
This is just filler text \cite{geer}. This is just filler
text \cite{worman}. This is just filler
text \cite{geer}.

Text \cite{knuth:ct:a} an \cite{knuth:ct:b} again \cite{knuth:ct:a,geer,worman}.

\printbibliography
\end{document}

You can also let the asterisk only appear at the first citation if you enable citetracker=true and change \addcat to
\newcommand*{\addcat}{%
  \ifboolexpr{(not test {\ifciteseen} or test {\ifbibliography})
              and test {\ifcategory{asterisk}}}
    {*}%
    {}%
}


text:
Q: overpass api too many requests I want to get specific users data from OpenStreetMap. I use Overpass API, but I get an error:

overpy.exception.DataIncomplete: ('Data incomplete try to improve the
query to resolve the missing data', 'Resolve missing nodes is
disabled')

The solution from here says to get nodes by the get_nodes(resolve_missing=True) function and parameter, however now I get the error

overpy.exception.OverpassTooManyRequests: Too many requests

Code:
api = overpy.Overpass()
result = api.query("[out:json];way(user:'{}')({}, {}, {}, {})(changed:'{}T{}Z', '{}T{}Z');out;".format(user, max_coords['south'], max_coords['west'], max_coords['north'], max_coords['east'], start_date, start_time, end_date, end_time))
for way in result.ways:
    way_nodes_list = []
    nodes = way.get_nodes(resolve_missing=True)
    for node in nodes:
        way_nodes_list.append((float(node.lon), float(node.lat)))


text:
Q: What does this mean/what is the ^ operator? Finished an online C++ course and was looking at some code, what does this mean?
DWORD remark(array<String^>^ args);

Specifically this part, I get the rest: array<String^>^ args
I don't have access to the rest of the code, it's compiled, but this is one of the functions I'm able to use.
It's like... converting an array pointer of a string of arrays XOR to an argument or something...


text:
Q: How to set system wide PATH in ubuntu:20.04 docker image? Dockerfile
FROM ubuntu:20.04
RUN apt-get update && \
    apt-get install --no-install-recommends sudo && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists
COPY mybin /mybin
# Add mybin to system wide path
ENV PATH=/mybin:$PATH

$ docker run --rm myimg sudo printenv
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=10adc6c192f4
HOME=/root

want to get
PATH=/mybin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

How to set mybin to system wide PATH in Dockerfile?

A: You can add
RUN echo "PATH=/mybin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
" > /etc/environment

to your dockerfile


text:
Q: Is it possible to change the log level of a package in log4j? Currently I have a library that is logging certain information as ERROR. If I change my log4j settings like this:
log4j.logger.com.company.theirpackage.foo=OFF

that will completely disable the library's logging altogether. However, what I'd really like is to still see the information, but have it logged at a WARN or INFO level. In other words, when that particular code calls log.error(), I want it to be as if they had called log.warn() or log.info() instead.
Is there a way to do this with log4j?

A: Not directly, but you could write a custom appender that intercepts the calls, checks the levels, and then prints them at whatever level you want. Or, you could do some aspect oriented programming and intercept/change their calls.
But why would you want to change the level they log it at?

A: I think this is possible, by implementing a Filter, in which the level inside a LoggingEvent is changed when it matches certain conditions.

A: There are multiple ways to do that. I think the easiest way to do that is to use custom Appender.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="console-> %-5p %c{1}:%L - %m%n" />
        </Console>
        <Console name="CUSTOM_ERROR_STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="dependent-> %-5p{ERROR=WARN} %c{1}:%L - %m%n" />
        </Console>
    </Appenders>
    <Loggers>
        <!-- Root logger referring to console appender -->
        <Root level="INFO">
            <AppenderRef ref="STDOUT"/>
        </Root>

        <Logger name="com.my.LogTest" level="INFO" additivity="false">
            <AppenderRef ref="CUSTOM_ERROR_STDOUT" />
        </Logger>
    </Loggers>
</Configuration>

Here I convert all the error logs into warning for that specific class com.my.LogTest. You can find more info about Appender Layouts here. It has pattern selector option which allows you to choose different pattern based on your condition.


text:
Q: XML validation using XSD I have an XML with following format.
<RootNode>
    <Parent>
        <Child1>Some text about child 1</Child1>
        <Child2>Some text about child 2</Child2>
        ....
        ....
        <Child5>Some text about child 5</Child5>
        ....
        ....
        <Childn>Some text about child n</Childn>
    </Parent>
</RootNode>

Now I want to validate this xml against xsd.
But the problem is the number and node name of children are not fixed.
Please check following samples of my file
Sample 1: Two children with node name Child1 and Child2
<RootNode>
    <Parent>
        <Child1>Some text about child 1</Child1>
        <Child2>Some text about child 2</Child2>
    </Parent>
</RootNode>

Sample 2: Three children with node name Child4 Child5, and Child8
<RootNode>
    <Parent>
        <Child4>Some text about child 4</Child4>
        <Child5>Some text about child 5</Child4>
        <Child8>Some text about child 8</Child8>
    </Parent>
</RootNode>

I want a to validate the text inside the Child node (which is shown as "Some text about child n") with following rule
Rule: The xml is invalid if any Child node - (Children of Parent) has iner text length more then 256.
It means consider the xml invalid if any child of the "Parent" node has inner text longer then 256 characters
Is this possible using XSD schema validation? Could you please help me creating .XSD file to validate this?
Thanks in advance

A: It's not possible to validate this automatically because the maximum number of child nodes is unknown. You may be able to get by writing some manual validation.
If you are able to change the format of this XML, you should, because it's badly designed (not least of all because it's not validatable...). You should shoot for something more like:
<RootNode>
    <Parent>
        <Child num="1">...</Child>
        <Child num="2">...</Child>
    </Parent>
</RootNode>

or, if the parent can contain other things as well as the children, then having a container for the children is useful:
<RootNode>
    <Parent>
        <OtherStuff/>
        <Children>
            <Child num="1">...</Child>
            <Child num="2">...</Child>
        </Children>
        <MoreStuff/>
    </Parent>
</RootNode>

A: You can't solve that with XSD as said before simply because you don't know what all the element names will be in advance. If you are not totally tied to XSD validation you may wish to take a look at Schematron which can do exactly this sort of validation.


text:
Q: Use OneNote GraphAPI to insert handwritten notes Good Evening,
I am trying to insert handwritten notes into OneNote pages (specifically OneNote for Windows 10) using the OneNote GraphAPI. Basically i'm looking for a way to insert a set of points or splines depending on how OneNote represents them internally. With handwritten notes being the main feature of OneNote, and images and text begin well supported, i'm sure there is a way to insert notes into pages. Since i couldn't find anything related to handwritten notes in the official documentation, i'm asking you:

*

*Is it possible to insert handwritten notes into OneNote pages via the
GraphAPI and if so how exactly does that work?

*If its impossible, i'd be very glad to hear about other programmatic ways of inserting
handwritten notes aswell (although at first glance it would be
extremely odd for such a basic feature to be missing). Is there maybe
some way to embed it into HTML and serve it via the clipboard?

Otherwise, the application will have to resort to dragging the mouse pointer using the Windows API which is really error-prone, inefficient and doesn't work on phones.
Thank you in advance and i'm looking forward to your takes,
Erik

A: How to do this is documented here.
The limitations of using the ink APIs is documented here.
Unfortunately, as far as I know, you still cannot append ink to a page using the GraphAPI - it can only be added at page creation.


text:
Q: Bind9 minimal zone configuration seems not working I have installed bind9 on debian squeeze. This is my named.conf.local file:
options {
    directory "/var/cache/bind";
    auth-nxdomain no;
    listen-on { any; };
    listen-on-v6 { any; };
};

zone "devhub.pl" IN {
    type master;
    file "db.devhub";
};

And this is my zone file:
$TTL 3h

devhub.pl. IN SOA ns1.devhub.pl. root.devhub.pl. (
    2012051201 ; serial
    3h ; refresh
    1h ; retry
    1w ; expire
    1h ) ; negative caching

    IN NS ns1.devhub.pl.
    IN NS ns2.devhub.pl.

ns1.devhub.pl. IN A 193.93.207.231
ns2.devhub.pl. IN A 193.93.207.231

www IN CNAME devhub.pl.

named-checkconf and named-checkzone report that all it's ok, but when I'm trying to setup external DNS as
ns1.devhub.pl -> 193.93.207.231
ns2.devhub.pl -> 193.93.207.231

my provider's admin panel show some error like this:
dns1: ns1.devhub.pl server isn't configured for devhub.pl domain. Please contact admin...
dns2: ns2.devhub.pl server isn't configured for devhub.pl domain. Please contact admin...

What I'm missing? Any suggestions?
And logs:
starting BIND 9.7.3 -u bind -t /var/jail/bind
built with '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc/bind' '--localstatedir=/var' '--enable-threads' '--enable-largefile' '--with-libtool' '--enable-shared' '--enable-static' '--with-openssl=/usr' '--with-gssapi=/usr' '--with-gnu-ld' '--with-dlz-postgres=no' '--with-dlz-mysql=no' '--with-dlz-bdb=yes' '--with-dlz-filesystem=yes' '--with-dlz-ldap=yes' '--with-dlz-stub=yes' '--with-geoip=/usr' '--enable-ipv6' 'CFLAGS=-fno-strict-aliasing -DDIG_SIGCHASE -O2' 'LDFLAGS=' 'CPPFLAGS='
adjusted limit on open files from 1024 to 1048576
found 2 CPUs, using 2 worker threads
using up to 4096 sockets
loading configuration from '/etc/bind/named.conf'
reading built-in trusted keys from file '/etc/bind/bind.keys'
using default UDP/IPv4 port range: [1024, 65535]
using default UDP/IPv6 port range: [1024, 65535]
listening on IPv6 interfaces, port 53
binding TCP socket: address in use
listening on IPv4 interface lo, 127.0.0.1#53
binding TCP socket: address in use
listening on IPv4 interface eth0, 172.16.7.1#53
binding TCP socket: address in use
listening on IPv4 interface eth1, 193.93.207.231#53
binding TCP socket: address in use
generating session key for dynamic DNS
set up managed keys zone for view _default, file 'managed-keys.bind'
automatic empty zone: 254.169.IN-ADDR.ARPA
automatic empty zone: 2.0.192.IN-ADDR.ARPA
automatic empty zone: 100.51.198.IN-ADDR.ARPA
automatic empty zone: 113.0.203.IN-ADDR.ARPA
automatic empty zone: 255.255.255.255.IN-ADDR.ARPA
automatic empty zone: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
automatic empty zone: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
automatic empty zone: D.F.IP6.ARPA
automatic empty zone: 8.E.F.IP6.ARPA
automatic empty zone: 9.E.F.IP6.ARPA
automatic empty zone: A.E.F.IP6.ARPA
automatic empty zone: B.E.F.IP6.ARPA
automatic empty zone: 8.B.D.0.1.0.0.2.IP6.ARPA
couldn't add command channel 127.0.0.1#953: address in use
couldn't add command channel ::1#953: address in use
zone 0.in-addr.arpa/IN: loaded serial 1
zone 127.in-addr.arpa/IN: loaded serial 1
zone 255.in-addr.arpa/IN: loaded serial 1
zone localhost/IN: loaded serial 2
zone devhub.pl/IN: loaded serial 2012051201
managed-keys-zone ./IN: loading from master file managed-keys.bind failed: file not found
managed-keys-zone ./IN: loaded serial 0
zone devhub.pl/IN: sending notifies (serial 2012051201)
running

What about this address in use - is it problem?
BTW bind is chrooted and running /etc/init.d/bind9 start and then /etc/init.d/bind9 status says could not access PID file for bind9 ... failed!

A: Have you checked your logs in /var/log/syslog?
Also, Have a look at http://wiki.debian.org/Bind9#Configuration.
Finally, one thing that I have in my /etc/named.conf that you don't have is an Options section, like this: (Granted, I'm running CentOS, not Debian, but Bind9 is Bind9. You probably need to tell it the actual path (with the directory set inside options) of your zone files, if they're in a different directory).
    options
{
                directory "/var/named"; // the default
                recursion no;
                listen-on { localhost; 127.0.0.1; My Public IP Address; };
                allow-transfer {My Slave DNS Server;};
};

                zone "domain.com" {
                type master;
                file "domain.com.db";
                };

And then of course, my zone files (I have lots of domains I provide NS for) are in /var/named/.

A: May 12 22:11:17 mango named[22583]: zone devhub.pl/IN: loading from master file db.devhub failed: file not found

Specify the full path to your file (e.g.: /etc/bind/master/db.devhub is where I would place my file)


text:
Q: Accessing existing partitions on SDHC card using FatFs I've been trying to transfer all my code from the STM32 Arduino library to ST Hal library, but I've been running into a problem with the SD-card. I'm using a SDHC sd card that has two partitions (one for factory reset and the other for normal settings)
They show up on my PC as drive D and E.
So when setting up FATFS for my STM32F1 chip everything worked fine when using SD Bus one bit mode. Using standard code I could write into the factory reset partition:
  FRESULT res = f_open(&SDFile, (const TCHAR *)"Test2.txt", FA_CREATE_ALWAYS | FA_WRITE);
  if(res == FR_OK){
    HAL_GPIO_WritePin(DASH_LED_1_GPIO_Port, DASH_LED_1_Pin, GPIO_PIN_SET);
    res = f_putc('S', &SDFile);
    if(res != -1){
      HAL_GPIO_WritePin(DASH_LED_2_GPIO_Port, DASH_LED_2_Pin, GPIO_PIN_SET);
    }
    res = f_write(&SDFile, (const void*)buffer, sizeof(buffer), &byteswritten );
    if(res == FR_OK){
      HAL_GPIO_WritePin(DASH_LED_3_GPIO_Port, DASH_LED_3_Pin, GPIO_PIN_SET);

    }
    f_close(&SDFile);
  }

When initializing the code and mounting a drive everything seemed fine, even when I wanted to mount the second partitions (i'm not really sure if thats what i'm doing with the code) the returns in my debugger were all FR_OK:
uint8_t retSD;    /* Return value for SD */
char SDPath[4];   /* SD logical drive path */
char OtherPath[4];
FATFS SDFatFS;    /* File system object for SD logical drive */
FIL SDFile;       /* File object for SD */

/* USER CODE BEGIN Variables */
PARTITION VolToPart[2] = {
  {0,0},
  {0,1}
};
/* USER CODE END Variables */

void MX_FATFS_Init(void)
{
  /*## FatFS: Link the SD driver ###########################*/
  retSD = FATFS_LinkDriver(&SD_Driver, SDPath);

  /* USER CODE BEGIN Init */
  FRESULT res = f_mount(&SDFatFS, SDPath, 0 );
  if(res != FR_OK){
    Error_Handler();
  }
  res = f_mount(&SDFatFS, OtherPath, 0);
  if(res != FR_OK){
    Error_Handler();
  }

  /* additional user code for init */
  /* USER CODE END Init */
}

I will admit that even though I did my research I found the mounting and the subsequent VolToPart array that you apparently need to be a little bit vague.
After debugging the code while mounting twice (see code above), I tested the code using the drive identifiers (I turned on _FS_RPATH, which I don't think has an effect, but just to be sure) I could write Hello World to 0:Test2.txt but got an invalid drive error for 1:Test2.txt.
I want to be able to switch between drives, but I feel like I'm missing something that I need to initiliaze or do. At this moment I'm not sure if FatFs can see the SDCard partitions and I'm just not initializing it or if its a completely seperate drive that the SD card cannot see. I hope someone it able to help me with this, let me know if you need more info.
Edit: I found out some stuff after debugging for a while:
SDPath is getting defined as "0:/"in link driver, so it makes sense for that this drive works. Other path does not get defined (as far as I can tell, and just gets the default value of "0:/", which means I'm doing the same mount twice. When I tried to add a seperate driver and intialize that one, it still ended up being an invalid disk error.
extern Diskio_drvTypeDef  SD_Driver;
extern Diskio_drvTypeDef  Other_Driver;

const Diskio_drvTypeDef  SD_Driver =
{
  SD_initialize,
  SD_status,
  SD_read,
#if  _USE_WRITE == 1
  SD_write,
#endif /* _USE_WRITE == 1 */

#if  _USE_IOCTL == 1
  SD_ioctl,
#endif /* _USE_IOCTL == 1 */
};

const Diskio_drvTypeDef  Other_Driver =
{
  SD_initialize,
  SD_status,
  SD_read,
#if  _USE_WRITE == 1
  SD_write,
#endif /* _USE_WRITE == 1 */

#if  _USE_IOCTL == 1
  SD_ioctl,
#endif /* _USE_IOCTL == 1 */
};

I then ran link driver twice and received a FR_INVALID_DRIVE message on the second mount. I tried this both with the same FATFS object and different ones.
uint8_t retSD;    /* Return value for SD */
char SDPath[4];   /* SD logical drive path */
char OtherPath[4];
FATFS SDFatFS;    /* File system object for SD logical drive */
FATFS OtherFatFS;
FIL SDFile;       /* File object for SD */

/* USER CODE BEGIN VolToPart */
/* Volume - Partition resolution table should be user defined in case of Multiple partition */
/* When multi-partition feature is enabled (1), each logical drive number is bound to arbitrary physical drive and partition
listed in the VolToPart[] */
PARTITION VolToPart[] = {
  {0,0},
  {1,0}
};
/* USER CODE END VolToPart */

/* USER CODE BEGIN Variables */
/* USER CODE END Variables */

void MX_FATFS_Init(void)
{
  /*## FatFS: Link the SD driver ###########################*/
  retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
  retSD = FATFS_LinkDriver(&Other_Driver, OtherPath);
  /* USER CODE BEGIN Init */
  FRESULT res = f_mount(&SDFatFS, SDPath, 1 );
  if(res != FR_OK){
    Error_Handler();
  }
  res = f_mount(&SDFatFS, OtherPath, 1);
  if(res != FR_OK){
    Error_Handler();
  }


text:
Q: CSS transform: scale not working as wanted I want to have text directly below an image that I am scaling with transform: scale(0.50, 0.50);
The issue is that the height and width of the bounding box of the image don't scale with the image. There was another post from which I got this image example of scaled image, but it is not the answer I'm looking for.  How can I make the borders of the larger, pre-scaled image match the smaller, new scale of the image?  My code is as follows:
.content #imagediv {
    background-color: blue;
}
.content #imagediv img {
    transform: scale(0.50, 0.50);
    transform-origin: top left;
    display: inline-block;
}

This looks like this

A: I think you'll have to change the image size using another method. I don't think  transfrom: scale will work in this case. Why not just set the image width and let the height be dynamic?? The text will sit right under the image at that point. You could also use js to change the width of the image to 50% of its original if you need it to be 50%.

var img = document.getElementById('image');
//or however you get a handle to the IMG
var width = img.clientWidth;
img.style.width = (width / 2) + 'px';
.content #imagediv {
    background-color: blue;
    line-height:0; //used to get rid of extra space after the image.
}
.content #imagediv img {
    width:400px; //changes to 200px with js. Even if this is not set it will still get set to 200px because the js is calulating based off the image size.
}

    Random Text I want right below the image


text:
Q: Create git diff between two directories and apply patch to directory My goal is to create a diff between two folders so that file changes can be applied easily.
My current command:
git diff --no-index --binary 20140902/ 20141227/ > 01.diff

The diffs of each file look like this:
diff --git a/20140902/Documents/sheet.xlsx b/20141227/Documents/sheet.xlsx
index 3d0d2c8acd53eb068ac5d390048e7f624dd012b9..fe5a87dd3b99874746e137d752fa6b151544c0ca 100644
GIT binary patch
delta 11480
...

How can I apply this diff to a folder current which has the same contents as 20140902 (or if necessary, to a folder named 20140902)?
When I try
cd current/
git apply ../01.diff

I get
error: git diff header lacks filename information when removing 1 leading pathname component (line 3)

where line 3 is line "GIT binary patch". Maybe the lines in diff file should look like
diff --git a/Documents/sheet.xlsx b/Documents/sheet.xlsx

?

A: TL;DR: try git apply -p2 ....
Description
The right setup is not completely clear to me from your posting, so I will show my setup:
$ mkdir tpatch
$ cd tpatch
$ mkdir -p 20140902/Documents 20141227/Documents
$ printf 'binary\0stuff' > 20140902/Documents/foo
$ printf 'different\0binary' > 20141227/Documents/foo
$ git diff --no-index --binary 20140902/ 20141227/ > 01.diff

(The resulting patch is indeed a GIT binary patch thanks to the NULs in the printf output above, though mine has two literals instead of a delta.)
Next, I created a repository in the directory current.  If your repository is at a different level, you might need a different -p value:
$ mkdir current; cd current; git init
Initialized empty Git repository in .../tmp/tpatch/current/.git/
$ cp -r ../20140902/Documents .
$ ls
Documents
$ git add . && git commit -m initial
[master (root-commit) ee60bbe] initial
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 Documents/foo

Note that at this point I get the same error with a plain git apply, becuase stripping a/ from the diff leaves Git with 20140902/Documents/foo, not Documents/foo:
$ git apply ../01.diff
error: git diff header lacks filename information when removing 1 leading pathname component (line 3)

However, by using -p2, we tell Git to remove two components (a/20140902/) from the path, after which the file name Documents/foo matches the one in the repository and work-tree:
$ git apply -p2 ../01.diff
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   Documents/foo

no changes added to commit (use "git add" and/or "git commit -a")

If you have a more complex situation, you might need to use the --src-prefix and/or --dst-prefix options in the git diff command in the first place, but probably just -p2 will do the trick.


text:
Q: SpreadsheetGear Format Conditions to a Cell In my MVC project I'm using SpreadsheetGear to generate an excel document. I've got a column that has a validation rule against it that only allows the user to select from the following options: A,B,C,D. I need to be able to set different background colours for each of the options. For example:

*

*A - Green

*B - Yellow

*C - Orange

*D - Red

I've arrived to this error when running the code:

Maximum number of FormatConditions already exists.

My code is as follows:
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "A", null).Interior.Color = Color.LightGreen;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "B", null).Interior.Color = Color.Yellow;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "C", null).Interior.Color = Color.Orange;
conditions.Add(FormatConditionType.CellValue, FormatConditionOperator.Equal, "D", null).Interior.Color = Color.Red;

It seems that 3 is the maximum amount of Format conditions you can have for a cell. Is there anyway around this limitation?

A: You must be using an older version of SpreadsheetGear, as SpreadsheetGear 2012 and prior versions only supported Conditional Formatting features that were available in Excel 2003, which among many other limitations included a limit of 3 CF rules per cell.
The release of SpreadsheetGear 2017 enhanced support for Conditional Formats to a level that is compatible with the latest versions of Excel, including specifying more than 3 rules in a cell, so it sounds like you just need to upgrade your application to the latest version.  Assuming you have a recent / active subscription, you can download SpreadsheetGear 2017 from the Licensed User Downloads page.


text:
Q: Internet explorer is generating an extra element. Suggest me how to get rid of it Please use IE for this. Im using IE 9.
Just a side project http://www.somesite.lt
You can find almost at the bottom of the site an element .gallerywrapper
For some reason IE is generating two of them. Please, help me find the problem as I am sitting with this almost for three hours for know. Thanks.

A: you have an error in your file
SCRIPT438: Object doesn't support property or method 'livequery'
wp-e-commerce.js?ver=3.8.6.1.438283, **line 273 character** 2

that stopping your script.


text:
Q: The easiest way for paging with MVC3 C#? Have a website project in MVC3 C # where I retrieve information from the database and presents in a table in my view. I want to use paging to show up to five lines per page. Have been looking for tutorials on Internet but they all seem very advanced to achieve it. What is the easiest way for paging with MVC3?
Look in the lower left corner of the picture to see what I mean by paging
paging http://www.syncfusion.com/content/en-US/products/feature/user-interface-edition/aspnet-mvc/grid/img/Paging_Larger.jpg

A: Try PagedList. There's a NuGet package for MVC.
@{
    ViewBag.Title = "Product Listing"
}
@using PagedList.Mvc; //import this so we get our HTML Helper
@using PagedList; //import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic)

<link href="/Content/PagedList.css" rel="stylesheet" type="text/css" />

List of Products

    @foreach(var product in ViewBag.OnePageOfProducts){

@product.Name

    }

@Html.PagedListPager( (IPagedList)ViewBag.OnePageOfProducts, page => Url.Action("Index", new { page }) )

A: Alternatively, this NuGet package is also very useful and easy to implement. I would highly recommend going through this utility.
https://github.com/martijnboland/mvcpaging
NuGet [PM> Install-Package MvcPaging ]


text:
Q: Can't print dots after authors names when using gost780s citation package Writing thesis in Math, I use ProTex and citation package called GOST (file gost780s.bst) by Igor Kotelnikov. Problem is when I build PDF, not all the dots after the journal author`s name initials are produced. I have tried to produce bibtex and pdflatex several times, but some citations are not OK.
It looks like: Author, J. Name of work. // JF AuthorOne, JH Author // Journal name - Year....
And I need initials like J.F., J.H.
Is there any PDF editor to put the dots in PDFLatex or a tool for converting MathType embedded equations to a clean Word? I have tried Infty and NitroPDF but results are not perfect.
Thank you, I hope you understand the question and can help
Here is .bst file code:
%%
%% This is file `gost780s.bst',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gost.dtx  (with options: `bst,sort')
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This file has the LPPL maintenance status "maintained".
%% Maintained by Igor A. Kotelnikov.
%% Current version: 2012.02.02
%%
%% Please, send bug report via e-mail:
%%   kia999 at mail dot ru <Igor Kotelnikov>
%% or
%%   polyama at yahoo dot com <Maksym Polyakov>
%%

%%
%% This bibstyle attempts to format bibliography according to
%% GOST 7.80-2000 for bibliographic records.

ENTRY
  { address
    annote
    author
    booktitle
    bookauthor
    chapter
    edition
    editor
    compiler
    howpublished
    institution
    journal
    key
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    medium % new in v.2.
    type
    volume
    year
    language
    booklanguage
    numpages
    url
    urldate
    isbn
    doi
    eprinttype   % = archivePrefix
    eprintclass  % = primaryClass
    eprint
  }
  {}
  { label }

INTEGERS { output.state before.all mid.sentence after.sentence after.block
after.dblslash after.slash after.column after.semicolumn }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #4 'after.dblslash :=
  #5 'after.slash :=
  #6 'after.column :=
  #7 'after.semicolumn :=
}

STRINGS { s t }

STRINGS { curlanguage }

FUNCTION {change.language}
{ booklanguage empty$
    { "" }
    { booklanguage  'curlanguage :=
      "\selectlanguageifdefined{"
      curlanguage *
      "}" *
    }
  if$
}

FUNCTION {output.nonnull}
{
  swap$
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
          " " quote$ "--- " * *  write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { output.state after.dblslash =
                { "~//" * change.language * " " * write$ }
                { output.state after.slash =
                    { "~/ " * write$ }
                    { output.state after.column =
                        { ": " * write$ }
                        { output.state after.semicolumn =
                            { "; " * write$ }
                        { add.period$ " " * write$ }
                       if$
                        }
                      if$
                    }
                  if$
                }
              if$
            }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

FUNCTION {fin.entry}
{ add.period$
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {new.dblslash}
{ output.state before.all =
    'skip$
    { after.dblslash 'output.state := }
  if$
}

FUNCTION {new.slash}
{ output.state before.all =
    'skip$
    { after.slash 'output.state := }
  if$
}

FUNCTION {new.column}
{ output.state before.all =
    'skip$
    { after.column 'output.state := }
  if$
}

FUNCTION {new.semicolumn}
{ output.state before.all =
    'skip$
    { after.semicolumn 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state := }
      if$
    }
  if$
}

FUNCTION {add.blank}
{ " " * before.all 'output.state :=
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

FUNCTION {non.stop}
{ duplicate$
   "}" * add.period$
   #-1 #1 substring$ "." =
}

FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.dblslash.checka}
{ empty$
    'skip$
    'new.dblslash
  if$
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "\BibEmph{" swap$ * "}" * }
  if$
}

FUNCTION {enclose.square.brackets} { }

FUNCTION {bracify}
{ duplicate$ empty$
    { pop$ "{}" }
    { "{" swap$ * "}" * }
  if$
}
FUNCTION {bracketise}
{ duplicate$ empty$
    { pop$ "[]" }
    { "[" swap$ * "]" * }
  if$
}
FUNCTION {parenthesify}
{ duplicate$ empty$
    { pop$ "()" }
    { "(" swap$ * ")" * }
  if$
}

FUNCTION {space.word}
{ " " swap$ * " " * }

FUNCTION {bbl.edby}    %  { "\bbledby{}" }
{ curlanguage "english" =
   {"Ed.\ by"}
   { curlanguage "ukrainian" =
      {"{\cyr\CYRP\cyrii\cyrd\ \cyrr\cyre\cyrd.}"}
      { curlanguage "russian" =
         {"{\cyr\CYRP\cyro\cyrd\ \cyrr\cyre\cyrd.}"}
         { curlanguage "german" =
            { "ed." }
            {"language is not defined: " language "edby" * * warning$ "Ed.\ by"}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.cmplr}
{ curlanguage "english" =
   { "Compiler"}
   { curlanguage "german" =
      { "Hrsg." }
      { curlanguage "ukrainian" =
         {"{\cyr\CYRU\cyrk\cyrl.}"}
         { curlanguage "russian" =
            {"{\cyr\CYRS\cyro\cyrs\cyrt.}"}
            {"language is not defined: " language  "cmplr" * * warning$ "Compiler"}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.edition} %  { "\bbledition{}" }
{ curlanguage "english" =
   {"edition"}
   { curlanguage "ukrainian" =
      {"{\cyr\cyrv\cyri\cyrd.}"}
      { curlanguage "russian" =
         {"{\cyr\cyri\cyrz\cyrd.}"}
         { curlanguage "german" =
            {" {aus.}" } %%%% { "Aufl." } ??
            { curlanguage "italian" =
               {"edizione"}
               { curlanguage "french" =
                  {"\'{e}dition"}
                  {"language is not defined: " language  "edition" * * warning$ "edition"}
               if$}
            if$}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.vvolume} %  { "\bblVolume{}" }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"Volume"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      { "\CYRT\cyro\cyrm" }
      { curlanguage "german" =
         {"{Band}"} %%%% { "Volumen" }
         {"language is not defined: " language  "vvolume" * * warning$ "Volume"}
      if$}
   if$}
if$}

FUNCTION {bbl.vvol}    %  { "\bblVol{}" }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"Vol."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"\CYRT."}
      { curlanguage "german" =
         {"{Bd.}"} %%%% { "Vol." }
         {"language is not defined: " language  "vvol" * * warning$ "Vol."}
      if$}
   if$}
if$}

FUNCTION {bbl.iissue}  %  { "\bblIssue{}" }
{ curlanguage "english" =
   {"Issue"}
   { curlanguage "ukrainian" =
      {"\CYRV\cyri\cyrp\cyru\cyrs\cyrk"}
      { curlanguage "russian" =
         {"\CYRV\cyrery\cyrp\cyru\cyrs\cyrk"}
         { curlanguage "german" =
            {"{Heft}"} %%%% { "Ausgabe" }
            {"language is not defined: " language "iissue" * * warning$ "Issue"}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.iiss}  %  { "\bblIss{}" }
{ curlanguage "english" =
   {"Iss."}
   { curlanguage "ukrainian" =
      {"\CYRV\cyri\cyrp."}
      { curlanguage "russian" =
         {"\CYRV\cyrery\cyrp."}
         { curlanguage "german" =
            {"{H.}"}
            {"language is not defined: " language "iiss" * * warning$ "Iss."}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.of}      %  { "\bblof{}" }
{ curlanguage "english" =
   {"of"}
   { curlanguage "german" =
      { "von" }
      { curlanguage "ukrainian" =
         { "{\cyr\cyrii\cyrz}" }
         { curlanguage "russian" =
            { "{\cyr\cyri\cyrz}" }
            {"language is not defined: " language "of" * * warning$ "of"}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.etal}      %  { "\bblof{}" }
{ curlanguage "english" =
   {"et~al."}
   { curlanguage "german" =
      { "u.~a." }
      { curlanguage "ukrainian" =
         {"{\cyr\cyrt\cyra~\cyrii\cyrn.}"}
         { curlanguage "russian" =
            {"{\cyr\cyri~\cyrd\cyrr.}"}
            {"language is not defined: " language  "et~al" * * warning$ "et~al."}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.nnumber} %  { "\bblNumber{}" }
{ curlanguage "english" =
   {"Number"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      { "\CYRN\cyro\cyrm\cyre\cyrr" }
      { curlanguage "german" =
         {"{Heft}"} %%% { "Anzahl" }
         {"language is not defined: " language  "nnumber" * * warning$ "Number"}
      if$}
   if$}
if$}

FUNCTION {bbl.number}  %  { "\bblnumber{}" }
{ curlanguage "english" =
   {"number"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"{\cyr\cyrn\cyro\cyrm\cyre\cyrr}"}
      { curlanguage "german" =
         {"{Heft}"} %%% { "anzahl" }???
         {"language is not defined: " language  "number" * * warning$ "number"}
      if$}
   if$}
if$}

FUNCTION {bbl.nr}     %   { "\bblno{}" }
{ curlanguage "english" =
   {"№"}                     %change here
   { curlanguage "italian" =
      { "no" }
      { curlanguage "ukrainian" = curlanguage "russian" = or
         { "{\cyr\textnumero}" }
         { curlanguage "german" =
            {"{H.}"} %%% { "an." }
            {"language is not defined: " language "nr" * * warning$ "№"}
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.nnr}     %   { "\bblno{}" }
{ curlanguage "english" =
   {"№"}                            % сhange here
   { curlanguage "ukrainian" = curlanguage "russian" = or
      { "{\cyr\textnumero}" }
      { curlanguage "german" =
         {"{H.}"} %%% { "an." }
         {"language is not defined: " language  "nnr" * * warning$ "№"}
      if$}
   if$}
if$}

FUNCTION {bbl.in}    %    { "\bblin{}" }
{ curlanguage "english" = curlanguage "german" = or
   {"in"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      { "{\cyr\cyrv}" }
      {"language is not defined: " language  "in" * * warning$ "in"}
   if$}
if$}

FUNCTION {bbl.iin}  %     { "\bblIn{}" }
{ curlanguage "english" = curlanguage "german" = or
   {"In"}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      { "\CYRV" }
      {"language is not defined: " language  "iin" * * warning$ "In"}
   if$}
if$}

FUNCTION {bbl.pages}    % { "\bblpp." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"p."} %%% {"pp."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"{\cyr\cyrs.}"}
      { curlanguage "german" =
         {"S."} %%%% { "s." }
         {"language is not defined: " language  "pages" * * warning$ "p."}
      if$}
   if$}
if$}

FUNCTION {bbl.page}   %   { "\bblp."
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"p."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"{\cyr\cyrs.}"}
      { curlanguage "german" =
         {"S."} %%%% { "s." }
         {"language is not defined: " language  "page" * * warning$ "p."}
      if$}
   if$}
if$}

FUNCTION {bbl.ppages}%    { "\bblPp." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"P."} %%%% { "Pp." }
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"{\cyr\CYRS.}"}
      { curlanguage "german" =
         {"S."}
         {"language is not defined: " language "ppages" * * warning$ "P."}
      if$}
   if$}
if$}

FUNCTION {bbl.ppage}  %   { "\bblP." }
{ curlanguage "english" = curlanguage "french" = or curlanguage "italian" = or
   {"P."}
   { curlanguage "ukrainian" = curlanguage "russian" = or
      {"{\cyr\CYRS.}"}
      { curlanguage "german" =
         {"S."}
         {"language is not defined: " language  "ppage" * * warning$ "P."}
      if$}
   if$}
if$}

FUNCTION {bbl.urldate}
{ curlanguage "english" =
   {"online; accessed"}
   { curlanguage "ukrainian" =
      { "{\cyrd\cyra\cyrt\cyra\ \cyrz\cyrv\cyre\cyrr\cyrn\cyre\cyrn\cyrn\cyrya}" }
      { curlanguage "russian" =
         { "{\cyrd\cyra\cyrt\cyra\ \cyro\cyrb\cyrr\cyra\cyrshch\cyre\cyrn\cyri\cyrya}" }
         { curlanguage "german" =
            { "{online; abgerufen}" }
            { "language is not defined: " language "urldate" * * warning$ "online; accessed" }
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.techreport} % rename to bbl.techreport
{ curlanguage "english" =
   { "Rep." }
   { curlanguage "german" =
      { "Bericht" }
      { curlanguage "russian" =
         { "{\cyr\CYRO\cyrt\cyrch\cyre\cyrt}" }
         { "language is not defined: " language "techrep" * * warning$ "Rep." }
      if$}
   if$}
if$}

FUNCTION {bbl.mthesis}
{ curlanguage "english" =
   { "Master's thesis" }
   { curlanguage "german" =
      { "Diss.~Mag." }
      { curlanguage "russian" =
        { "{\cyr\CYRK\cyrv\cyra\cyrl\cyri\cyrf\cyri\cyrk\cyra\cyrc\cyri"
          "\cyro\cyrn\cyrn\cyra\cyrya\ \cyrr\cyra\cyrb\cyro\cyrt\cyra\ " *
          "\cyrm\cyra\cyrg\cyri\cyrs\cyrt\cyrr\cyra}" * }
         { "language is not defined: " language "mthesis" * * warning$ "Master's thesis" }
      if$}
   if$}
if$}

FUNCTION {bbl.phdthesis}
{ curlanguage "english" =
   { "Ph.\,D. thesis" }
   { curlanguage "german" =
      { "Diss.~Ph.\,D." }
      { curlanguage "russian" =
         { "{\cyr\CYRD\cyri\cyrs\cyrs\ldots\ \cyrk\cyra\cyrn\cyrd\cyri"
           "\cyrd\cyra\cyrt\cyra\ \cyrn\cyra\cyru\cyrk}" * }
         { curlanguage "french" =
           { "Th\`{e}se de doctorat" }
           { "language is not defined: " language "phdthesis" * * warning$ "Ph.\,D. thesis" }
         if$}
      if$}
   if$}
if$}

FUNCTION {bbl.dscithesis}
{ curlanguage "english" =
   { "Dr.\,Sci. dissertation" }
   { curlanguage "german" =
      { "Diss.~Dr." }
      { curlanguage "russian" =
         { "{\cyr\CYRD\cyri\cyrs\cyrs\ldots\ \cyrd\cyro\cyrk\cyrt\cyro"
           "\cyrr\cyra\ \cyrn\cyra\cyru\cyrk}" * }
         { "language is not defined: " language "dscithesis" * * warning$ "Dr.\,Sci. dissertation" }
      if$}
   if$}
if$}

FUNCTION {bbl.nnoaddress}
{ curlanguage "english" =
   { "S.\ l." }
   { curlanguage "russian" =
      { "{\cyr\CYRB.\ \cyrm.}" }
      { "language is not defined: " language "nnoaddress" * * warning$ "S.\ l." }
   if$}
if$}

FUNCTION {bbl.nopublisher}
{ curlanguage "english" =
   { "s.\ n." }
   { curlanguage "russian" =
      { "{\cyr\cyrb.\ \cyri.}" }
      { "language is not defined: " language "nnopublisher" * * warning$ "s.\ n." }
   if$}
if$}

FUNCTION {bbl.nnopublisher}
{ curlanguage "english" =
   { "S.\ n." }
   { curlanguage "russian" =
      { "{\cyr\CYRB.\ \cyri.}" }
      { "language is not defined: " language "nnopublisher" * * warning$ "S.\ n." }
   if$}
if$}

FUNCTION {bbl.medium.text}
{ curlanguage "english" =
   { "Text" }
   { curlanguage "russian" = curlanguage "ukrainian" = or
      { "{\cyr\CYRT\cyre\cyrk\cyrs\cyrt}" }
      { "language is not defined: " language "medium" * * warning$ "Text" }
   if$}
if$}

FUNCTION {bbl.medium.elres}
{ curlanguage "english" =
   { "Electronic resource" }
   { curlanguage "russian" =
      { "{\cyr\CYREREV\cyrl\cyre\cyrk\cyrt\cyrr\cyro\cyrn\cyrn\cyrery\cyrishrt\ \cyrr\cyre\cyrs\cyru\cyrr\cyrs}" }
      { curlanguage "ukrainian" =
        { "{\cyr\CYRE\cyrl\cyre\cyrk\cyrt\cyrr\cyro\cyrn\cyrn\cyri\cyrishrt\ \cyrr\cyre\cyrs\cyru\cyrr\cyrs}" }
        { "language is not defined: " language "medium" * * warning$ "Electronic resource" }
      if$}
   if$}
if$}

FUNCTION {bbl.chief}
{ curlanguage "english" =
   { "chief" }
   { curlanguage "russian" =
      { "\cyrr\cyru\cyrk." }
      { curlanguage "ukrainian" =
        { "\cyrr\cyru\cyrk." }
        { "language is not defined: " language "chief" * * warning$ "chief" }
      if$}
   if$}
if$}

FUNCTION {bbl.executor}
{ curlanguage "english" =
   { "Executor" }
   { curlanguage "russian" =
      { "{\cyr\cyri\cyrs\cyrp\cyro\cyrl\cyrn.}" }
      { curlanguage "ukrainian" =
        { "{\cyr\cyrv\cyri\cyrk\cyro\cyrn\cyra\cyrv\cyre\cyrc\cyrsftsn}" }
        { "language is not defined: " language "medium" * * warning$ "Executor" }
      if$}
   if$}
if$}

FUNCTION {bbl.medium}
{ type$ "online" =
   { bbl.medium.elres }
   { bbl.medium.text  }
if$}

INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{
  #1 "{vv~}{ll}{~jj}{,~f.}" format.name$
}

FUNCTION {format.names.rev}
{
  's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr
      %"{f.}{~vv}{~ll}{, jj}" format.name$ 't :=
      "{ff}{~vv}{~ll}{, jj}" format.name$ 't :=
      nameptr #1 >
        { nameptr #4 =
          numnames #4 > and
            { "others" 't :=
              #1 'namesleft := }
            'skip$
          if$
          namesleft #1 >
            { ", " * t * }
            { t "others" =
          t "~others" =
          or
                { " " * bbl.etal * }
                { ", " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names emphasize}
  if$
}

FUNCTION {format.bookauthors}
{ bookauthor empty$
    { "" }
    { bookauthor format.names}
  if$
}

FUNCTION {format.authors.after}
{ author empty$
    { "" }
    { author format.names.rev}
  if$
}

FUNCTION {format.bookauthors.after}
{ bookauthor empty$
    { "" }
    { bookauthor format.names.rev}% always cuts to 4 persons
  if$
}

FUNCTION {format.editors.after}
{ editor empty$
    { "" }
    { bbl.edby "\ " * editor format.names.rev * }
  if$
}

FUNCTION {format.chief.after}
{ editor empty$
    { "" }
    { bbl.chief "\ " * editor format.names.rev * }
  if$
}

FUNCTION {format.executor.after}
{ author empty$
    { "" }
    { bbl.executor ": " * author format.names.rev * }
  if$
}

FUNCTION {format.compiler.after}
{ compiler empty$
    { "" }
    { bbl.cmplr "\ " * compiler format.names.rev * }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$ }
  if$
}

FUNCTION {format.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$
          month
        }
      if$
    }
    { month empty$
        'year
        { year ". " quote$ "--- " month * * * * }
      if$
    }
  if$
}

FUNCTION {output.address.publisher}
{
  address empty$
    'skip$
    { address output
      publisher empty$
        'skip$
        { new.column }
      if$
    }
  if$
  publisher output
}

FUNCTION {output.address.publisher.date}
{
  output.address.publisher
  format.date output
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem" write$
  cite$ bracify write$
  newline$
  language empty$
    { "english" 'curlanguage := }
    { language  'curlanguage := }
  if$
  "\selectlanguageifdefined" curlanguage bracify * write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

A: The formatting of the author's names is controlled by the function format.names.rev in the provided bst file.
Currently the function includes the following lines
  %"{f.}{~vv}{~ll}{, jj}" format.name$ 't :=
  "{ff}{~vv}{~ll}{, jj}" format.name$ 't :=

To achieve the desired effect (i.e., initials followed by period) one has to uncomment the first of the above two lines, and comment the second; namely:
  "{f.}{~vv}{~ll}{, jj}" format.name$ 't :=
  %"{ff}{~vv}{~ll}{, jj}" format.name$ 't :=

Finally, it is better to make a copy of the bst file, rename it, modify it and use the new file.


text:
Q: Output in desired format $values = array();
while($root = mysql_fetch_array($res)){

$root["prefix"] = $this->get_prefix($root['position']);
}
return $values;

I am getting the output as >>,position name
But I want... >>position name... is it possible to remove the comma.

A: Doesn't knowing the original code...
$root["prefix"] = preg_replace('/^>>,/','>>', $this->get_prefix($root['position']));