text:
Q: compose sms task in windows phone 7 c# I am trying to do a composeSMS task in windows phone 7.
And i have a array of data retrieve from isolated storage.
How can i make it loop to get all the data into one message.
Below is my code but it only get the lastest data.
private void sendSmsBtn_Click(object sender, RoutedEventArgs e)
{
    try
    {
        //For sorted time
        StreamReader readFileTime = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\time.Schedule", FileMode.Open, myStore));

        //For time
        StreamReader readFileTime1 = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\time1.Schedule", FileMode.Open, myStore));

        //For title
        StreamReader readFileTitle = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\title.Schedule", FileMode.Open, myStore));

        //For category
        StreamReader readFileCategory = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\category.Schedule", FileMode.Open, myStore));

        //Sorted time list
        String timeText = readFileTime.ReadLine();
        timeSplit = timeText.Split(new char[] { '^' });
            Array.Sort(timeSplit, delegate(string first, string second)
        {
            return DateTime.Compare(Convert.ToDateTime(first), Convert.ToDateTime(second));
        });

        String timeText1 = readFileTime1.ReadLine();

        timeSplit1 = timeText1.Split(new char[] { '^' });
        //Array.Sort(timeSplit1);

        String titleText = readFileTitle.ReadLine();
        titleSplit = titleText.Split(new char[] { '^' });
        Array.Sort(titleSplit);

        String categoryText = readFileCategory.ReadLine();
        categorySplit = categoryText.Split(new char[] { '^' });
        Array.Sort(categorySplit);
    }

    catch (Exception)
    {
    }

    SmsComposeTask composeSMS = new SmsComposeTask();

        for (int i = 0; i < timeSplit.Length; i++)
        {
            timeList = timeSplit[i];
            titleList = titleSplit[i];
            categoryList = categorySplit[i];

            composeSMS.Body = "Below is my schedule: \n" +
                              "Date: " + timeList + "\n" +
                              "Time: " + titleList + "\n" +
                              "End time: " + categoryList + "\n";

        }
        composeSMS.Show();
}

A: TL;DR: You are constantly setting the message body in the loop instead of appending data to it. For it to work, you need to have:
composeSMS.Body += "Below is my schedule: \n" +
                 "Date: " + timeList + "\n" +
                 "Time: " + titleList + "\n" +
                 "End time: " + categoryList + "\n";

Now, let me point out that your code is not optimized and can generally be shortened. For example, look at this:
private void sendSmsBtn_Click(object sender, RoutedEventArgs e)
{
    try
    {
        StreamReader reader;
        string[] timeSplit;
        string[] timeSplit1;
        string[] titleSplit;
        string placeholder;
        string[] categorySplit;

        //For sorted time
        using (reader = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\time.Schedule", FileMode.Open, myStore))
        {
            placeholder = reader.ReadLine();
        }
        timeSplit = placeholder.Split(new char[] { '^' });
        Array.Sort(timeSplit, delegate(string first, string second)
        {
           return DateTime.Compare(Convert.ToDateTime(first), Convert.ToDateTime(second));
        });

        using (reader = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\time1.Schedule", FileMode.Open, myStore))
        {
            placeholder = reader.ReadLine();
        }
        timeSplit1 = placeholder.Split(new char[] { '^' });
        Array.Sort(titleSplit1);

        using (reader = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\title.Schedule", FileMode.Open, myStore)))
        {
            placeholder = reader.ReadLine();
        }
        titleSplit = placeholder.Split(new char[] { '^' });
        Array.Sort(titleSplit);

        using(reader = new StreamReader(new IsolatedStorageFileStream(fullFolderName + "\\category.Schedule", FileMode.Open, myStore)))
        {
            placeholder = readFileCategory.ReadLine();
        }

        categorySplit = placeholder.Split(new char[] { '^' });
        Array.Sort(categorySplit);
    }

    catch (Exception)
    {
    }

    var composeSMS = new SmsComposeTask();
    var sBuilder = new StringBuilder();
    sBuilder.AppendLine("Below is my schedule:");

    for (int i = 0; i < timeSplit.Length; i++)
    {
        sBuilder.AppendLine("Date: " + timeSplit[i]);
        sBuilder.AppendLine("Time: " + titleSplit[i]);
        sBuilder.AppendLine("End time: " + categorySplit[i]);
    }

    composeSMS.Body = sBuilder.ToString();
    composeSMS.Show();
}

NOTE: I edited your code in Notepad without having access to a
  compiler. Some modifications might be needed.

Here are some major differences from what you have.

*

*I am re-using the same reader (instance of StreamReader) over and over instead of creating new instances for every single file.

*Notice the using statement used along the lines where the reader is used. Also notice curly braces - that way, the reader instance will be properly disposed once I am done working with it (reading a file).

*You only need one instance of a placeholder string, since all composite line strings are never used anywhere. That placeholder string is reset with every read.

*I am using a StringBuilder to build the body and only when it's ready, I am setting the Body property.

*No need for intermediary variables inside the loop.

Last but not least - a very important advice. You need to refactor the way you are storing data. Reading four files in this case to build a single entity is wrong and resource-consuming. Consider using a single well-structured format (e.g. XML or JSON) to store the data in a single file. Even better, consider using a database (starting SDK v.7.1 there is support for SQL CE).


text:
Q: EditText in Google Android I want to create the EditText which allow Numeric Values, Comma  and Delete and other values are ignore.
So How I can achieve this by programming code ?
Thanks.

A: I achieved same thing using follwing code, hope you will also find help from it.
editText.addTextChangedListener(controller);

@Override
public void afterTextChanged(Editable s) {
    if(s.trim.length() > 0)
            {
                 int start = s.toString().length() - 1;
                 int a = (int) s.charAt(start);
                 if (!(a >= 48 && a <= 57 || a == 44))
                    s = s.delete(start, start + 1);
            }
}

@Override
public void beforeTextChanged(CharSequence s, int start, int count,
        int after) {
}

@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}

A: To restrict what characters can be typed into an android EditText, you must set them in the android:digits XML attribute. See http://developer.android.com/reference/android/widget/TextView.html#attr_android:digits . Make sure to also validate user input before putting it into storage.

A: just simple ,
you want to create a text-field like that you can enter the new string must have some grammar that you want to allow.
i have some email validation grammar that can help you.
string = "/alphabetics/number/special-character" ;
and another is
user-entered-string = " ";
just compare user-entered-string's lexems and you defined grammar.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to Delete Fields in bulk using Modelbuilder? Is there a way to simultaneously delete fields in Modelbuilder? I want to be able to remove excess fields from an iterative join of near tables. All of the fields I want to delete and keep are similarly named (ex: NEAR_FID). I have 40+ copies of that variables named this way in one table.

A: Just use the Delete Field tool.

This tool deletes one or more fields from a table, feature class,
  feature layer, or raster dataset.

After you get it linked up to your layer, it gives you checkboxes for all the fields you want to delete.  If you they all start off with the same name (ie- NEAR_FID), you will probably end up seeing a series of NEAR_FID_1, NEAR_FID_2, NEAR_FID_3, etc).  You run the Delete Field tool at the end of your model to clean up all of the fields you don't want.

A: Without knowing how all of your fields are created in the model, a possible solution is to make a variable out of a tool parameter and then feed those variables into the Delete Field tool. This avoids the problem of the fields not being selectable directly through the Delete Field tool.
http://resources.arcgis.com/en/help/main/10.1/#/Exposing_tool_parameters_as_variables/002w0000003w000000/


text:
Q: Find the value of $n$ so that $\frac{a^{n+1}+b^{n+1}}{a^n+b^n}$ may be the geometric mean between $a$ and $b$
Question:
Find the value of $n$ so that $\frac{a^{n+1}+b^{n+1}}{a^n+b^n}$ may be the geometric mean between $a$ and $b$.

My approach:
We know geometric mean between any two numbers $a$ and $b$ is given by $\sqrt{ab}$. By some processing in my brain I tried $n=-\frac{1}{2}$ and the result matched with the formula to find the geometric mean.
I wish to know is there any other disciplined approach for this problem?
Kindly guide me in this regard.

A: Notice the following:
\begin{align*}
\forall a,b\in\mathbb{R}^+\,\dfrac{a^{n+1}+b^{n+1}}{a^n+b^n}=\sqrt{ab} &\iff \forall a,b\in\mathbb{R}^+a^{n+1}+b^{n+1}=a^n\sqrt{ab}+b^n\sqrt{ab}\\
&\iff \forall a,b\in\mathbb{R}^+ a^n\sqrt{a}(\sqrt{a}-\sqrt{b})+b^n\sqrt{b}(\sqrt{b}-\sqrt{a})=0\\
&\iff \forall a,b\in\mathbb{R}^+a^n\sqrt{a}(\sqrt{a}-\sqrt{b})=b^n\sqrt{b}(\sqrt{a}-\sqrt{b})
\end{align*}

A: Suppose $a>b$
$\frac{a^{n+1}+b^{n+1}}{a^n+b^n} = \sqrt{ab}\\ \implies a^{n+1} + b^{n+1}= a^{n+1/2}b^{1/2} + a^{1/2}b^{n+1/2}
\\\implies a^{n+1/2}(a^{1/2}-b^{1/2}) - b^{n+1/2}(a^{1/2}-b^{1/2})=0\\
\implies (a^{1/2}-b^{1/2})(a^{n+1/2}-b^{n+1/2})=0
$
Since $a\ne b$, above equation forces $a^{n+1/2} = b^{n+1/2} \implies n+1/2=0$

A: Let $a=2b$ in  $$\frac{a^{n+1}+b^{n+1}}{a^n+b^n} = \sqrt{ab}$$
and simplify you get $$\frac {2^{n+1 }+1}{2^{n}+1} = \sqrt 2$$
$$ 2^{n+1}+1=2^{1/2}+2^{n+\frac {1}{2}} $$
The only solution is $n=-1/2$

A: Hint
For $a,b>0$ and $a\ne b$, the function$${a^{n+1}+b^{n+1}\over a^{n}+b^{n}}={a+b u^n\over 1+u^n}$$is absolutely increasing where $u={b\over a}$. There the answer $n=-{1\over 2}$ is the only such solution.

A: $\left(\frac{a^{n+1}+b^{n+1}}{a^n+b^n}\right)$ is G.M. between $a$ and $b$.
$\Leftrightarrow \frac{a^{n+1}+b^{n+1}}{a^{n}+b^{n}}=a^{(1 / 2)} b^{(1 / 2)} \quad\left[G . M\right.$. between $\left.a \& b=a^{(1 / 2)} b^{(1 / 2)}\right]$
$\Leftrightarrow a^{n+1}+b^{n+1}=a^{n+(1 / 2)} b^{(1 / 2)}+a^{(1 / 2)} b^{n+(1 / 2)}$
$\Leftrightarrow a^{n+1}-a^{n+(1 / 2)} b^{(1 / 2)}=a^{(1 / 2)} b^{n+(1 / 2)}-b^{n+1}$
$\Leftrightarrow a^{n+(1 / 2)}\left[a^{(1 / 2)}-b^{(1 / 2)}\right]=b^{n+(1 / 2)}\left[a^{(1 / 2)}-b^{(1 / 2)}\right]$
$\Leftrightarrow a^{n+(1 / 2)}=b^{n+(1 / 2)} \quad\left[\because a^{(1 / 2)}-b^{(1 / 2)} \neq 0\right.$, since $\left.a \neq b\right]$
$\Leftrightarrow\left(\frac{a}{b}\right)^{n+(1 / 2)}=1=\left(\frac{a}{b}\right)^{0}$
$\Leftrightarrow n+\frac{1}{2}=0$
$\Leftrightarrow n=-\frac{1}{2}$


text:
Q: Should I use 'border: none' or 'border: 0'? Which of the two methods conforms to W3C standards? Do they both behave as expected across browsers?

border: none;
  border: 0;

A: I use:
border: 0;

From 8.5.4 in CSS 2.1:

'border'
Value:      [ <border-width> || <border-style> || <'border-top-color'> ] | inherit

So either of your methods look fine.

A: Well, to precisely see the difference between border: 0 and border: none we can make some experiments.
Experiment:
Lets create three divs, first one whose border can only be disabled by setting its width to zero, second one that can only be disabled by setting its style to none, and a third with a border that can only be "disabled" by setting its color to transparent. Then lets try the effect of:

*

*border: 0;

*border: none;

*border: transparent

    border-style: solid!important;
    border-color: red!important;

    border-width: 2px!important;
    border-color: red!important;

    border-width: 2px!important;
    border-style: solid!important;

var container = document.querySelector('#container');
var btnSetZero = document.querySelector('#setZero');
var btnSetNone = document.querySelector('#setNone');
var btnSetTransparent = document.querySelector('#setTransparent');
var btnReset = document.querySelector('#reset');
btnSetZero.addEventListener('click', () => {
 container.className = "border-zero";
});

btnSetNone.addEventListener('click', () => {
 container.className = "border-none";
});

btnSetTransparent.addEventListener('click', () => {
 container.className = "border-transparent";
});

btnReset.addEventListener('click', () => {
 container.className = "";
});
div div {
  border: 2px solid red;
  margin: 2px;
  font-family: monospace;
  white-space: nowrap;
  width: 250px;
}

div.border-zero div {
  border: 0;
}
div.border-none div {
  border: none;
}
div.border-transparent div {
  border: transparent;
}

    border-style: solid!important;

    border-color: red!important;

    border-width: 2px!important;

    border-color: red!important;

    border-width: 2px!important;

    border-style: solid!important;

<button id="setZero">border: 0;</button>
<button id="setNone">border: none;</button>
<button id="setTransparent">border: transparent;</button>
<button id="reset">reset</button>

My results were the same in both firefox and chrome:
border: 0; Seems to set border-width to 0 and border-style to none, but not change border-color;
border: none; Seems to only change border-style (to none);
border: transparent; Seems to change border-color to transparent and border-style to none;

A: Both are valid. It's your choice.
I prefer border:0 because it's shorter; I find that easier to read. You may find none more legible. We live in a world of very capable CSS post-processors so I'd recommend you use whatever you prefer and then run it through a "compressor". There's no holy war worth fighting here but Webpack→LESS→PostCSS→PurgeCSS is a good 2020 stack.
That all said, if you're hand-writing all your production CSS, I maintain —despite the grumbling in the comments— it does not hurt to be bandwidth conscious. Using border:0 will save an infinitesimal amount of bandwidth on its own, but if you make every byte count, you will make your website faster.

The CSS2 specs are here. These are extended in CSS3 but not in any way relevant to this.
'border'
    Value:      [ <border-width> || <border-style> || <'border-top-color'> ] | inherit
    Initial:    see individual properties
    Applies to:     all elements
    Inherited:      no
    Percentages:    N/A
    Media:      visual
    Computed value:     see individual properties

You can use any combination of width, style and colour.
Here,  0 sets the width, none the style. They have the same rendering result: nothing is shown.

A: (note: this answer has been updated on 2014-08-01 to make it more detailed, more accurate, and to add a live demo)
Expanding the shortand properties
According to W3C CSS2.1 specification ("Omitted values are set to their initial values"), the following properties are equivalent:
border: hidden;    border-style: hidden;
                   border-width: medium;
                   border-color: <the same as 'color' property>

border: none;      border-style: none;
                   border-width: medium;
                   border-color: <the same as 'color' property>

border: 0;         border-style: none;
                   border-width: 0;
                   border-color: <the same as 'color' property>

If these rules are the most specific ones applied to the borders of an element, then the borders won't be shown, either because of zero-width, or because of hidden/none style. So, at the first look, these three rules look equivalent. However, they behave in different ways when combined with other rules.
Borders in a table context in collapsing border model
When a table is rendered using border-collapse: collapse, then each rendered border is shared between multiple elements (inner borders are shared among as neighbor cells; outer borders are shared between cells and the table itself; but also rows, row groups, columns and column groups share borders). The specification defines some rules for border conflict resolution:

*

*Borders with the border-style of hidden take precedence over all other conflicting borders. […]

*Borders with a style of none have the lowest priority. […]

*If none of the styles are hidden and at least one of them is not none, then narrow borders are discarded in favor of wider ones. […]

*If border styles differ only in color, […]

So, in a table context, border: hidden (or border-style: hidden) will have the highest priority and will make the shared border hidden, no matter what.
On the other end of the priorities, border: none (or border-style: none) have the lowest priority, followed by the zero-width border (because it is the narrowest border). This means that a computed value of border-style: none and a computed value of border-width: 0 are essentially the same.
Cascading rules and inheritance
Since none and 0 affect different properties (border-style and border-width), they will behave differently when a more specific rule defines just the style or just the width. See Chris answer for an example.
Live demo!
Want to see all these cases in one single page? Open the live demo!

A: As others have said both are valid and will do the trick. I'm not 100% convinced that they are identical though. If you have some style cascading going on then they could in theory produce different results since they are effectively overriding different values.
For example. If you set "border: none;" and then later on have two different styles that override the border width and style then one will do something and the other will not.
In the following example on both IE and firefox the first two test divs come out with no border. The second two however are different with the first div in the second block being plain and the second div in the second block having a medium width dashed border.
So though they are both valid you may need to keep an eye on your styles if they do much cascading and such like I think.

"Border: 0" and "border-width: 3px"

"Border: 0" and "border-style: dashed"

"Border: none" and "border-width: 3px"

"Border: none" and "border-style: dashed"

A: Using
border: none;

doesn't work in some versions of IE.
IE9 is fine but in previous versions it displays the border even when the style is "none".
I experienced this when using a print stylesheet where I didn't want borders on the input boxes.
border: 0;

seems to work fine in all browsers.

A: While results will most likely be the same (no border), the 0 and none are technically addressing different things.
0 addresses border width and none addresses border style. Obviously a border of 0 width is nonexistent so will therefore have no style.
However, if later on in your stylesheet you intend to override this, you would naturally specifically address one or the other. If I now wanted a 3px border, that would be directly overriding border: 0 in regards to width. If I now wanted a dotted border, that would be directly overriding border: none in regards to styling.

A: Easiest Way to remove border with css
border: 0;

A: They are equivalent in effect, pointing to different shortcuts:
border: 0;
//short for..
border-width: 0;

And the other..
border: none;
//short for...
border-style: none;

Both work, just pick one and go with it :)

A: You may simply use both as per the specification kindly provided by Oli.
I always use border:0 none;.
Though there is no harm in specifying them seperately and some browsers will parse the CSS faster if you do use the legacy CSS1 property calls.
Though border:0; will normally default the border style to none, I have however noticed some browsers enforcing their default border style which can strangely overwrite border:0;.

A: This is the result in Firefox 78.0.2 (64-Bit):
img {
    border: none;
        border-top-color: currentcolor;
        border-top-style: none;
        border-top-width: medium;
        border-right-color: currentcolor;
        border-right-style: none;
        border-right-width: medium;
        border-bottom-color: currentcolor;
        border-bottom-style: none;
        border-bottom-width: medium;
        border-left-color: currentcolor;
        border-left-style: none;
        border-left-width: medium;
}

img {
    border: 0;
        border-top-color: currentcolor;
        border-top-style: none;
        border-top-width: 0px;
        border-right-color: currentcolor;
        border-right-style: none;
        border-right-width: 0px;
        border-bottom-color: currentcolor;
        border-bottom-style: none;
        border-bottom-width: 0px;
        border-left-color: currentcolor;
        border-left-style: none;
        border-left-width: 0px;
        border-image-outset: 0;
        border-image-repeat: stretch;
        border-image-slice: 100%;
        border-image-source: none;
        border-image-width: 1;
}

Date: 20200720

A: In my point,
border:none is working but not valid w3c standard
so better we can use border:0;


text:
Q: OpenGL Layer on top of Video on iPhone? I am trying to display a fullscreen video on the iPhone and overlay it with an OpenGL ES view. So basically, I want a video playing in the background, while there are OpenGL graphics being drawn on top of it.
How do I achieve this and is it even possible?
Thanks for your help!
Florian

A: To display a camera video background with a custom overlay view, you can use UIImagePickerController's cameraOverlayView property. The cameraOverlayView will be displayed on top of the default image picker interface. Use the cameraViewTransform property to make the camera preview full screen.
imagePickerController.cameraViewTransform =
CGAffineTransformMakeScale(1.0, 1.03);

To implement an UIView subclass as the overlay view that supports OpenGL ES rendering, take look at Apple's sample code http://developer.apple.com/iphone/library/samplecode/GLGravity/Listings/Classes_GLGravityView_m.html
The key is to make your overlay view transparent.
overlayView.opaque = NO;
overlayView.alpha = 1.0;
overlayView.backgroundColor = [UIColor clearColor];

In your OpenGL ES rendering code, make sure to clear color with a zero alpha.
glClearColor(0,0,0,0) ;

A: From the small information leaks it seems that the feature you want will be part of OS 3.1, allowing support for augmented reality, see this post on AppleInsider.


text:
Q: Object: is not a known Entity type. Eclipselink I am new to eclipselink or jpa. I was following a tutorial of eclipselink from  here. I am getting the following exception when I run the Test.java class. I am using oracle database over network. Please help me.
[EL Info]: connection: 2016-09-14 15:13:33.562--ServerSession(271944754)--/file:/D:/Developer/EclipseLink/bin/_TestPersistence login successful
[EL Warning]: metamodel: 2016-09-14 15:13:33.577--The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units.  Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
Exception in thread "main" java.lang.IllegalArgumentException: Object: Employee [name=Mukesh, email=m@gmail.com , department=Finance] is not a known Entity type.
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4226)
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:507)
    at com.assignment.Test.main(Test.java:28)

persistence.xml
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="TestPersistence"
transaction-type="RESOURCE_LOCAL">
<class>com.assignment.Employee</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@ipaddress:port/servicename" />
<property name="javax.persistence.jdbc.user" value="username" />
<property name="javax.persistence.jdbc.password"
value="password" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
</properties>
</persistence-unit>
</persistence>

Employee.java
package com.assignment;
public class Employee {
        private Long id;
        private String name;
        private String email;
        private String department;

        public Long getId() {
            return id;
        }
        public void setId(Long id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getEmail() {
            return email;
        }
        public void setEmail(String email) {
            this.email = email;
        }
        public String getDepartment() {
            return department;
        }
        public void setDepartment(String department) {
            this.department = department;
        }
        public String toString() {
            return "Employee [name=" + name + ", email=" + email + " , department="
                    + department + "]";
        }
}

Test.java
package com.assignment;

import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

public class Test {
    private static final String PERSISTENCE_UNIT_NAME = "TestPersistence";
      private static EntityManagerFactory factory;
      public static void main(String[] args) {
        factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
        EntityManager em = factory.createEntityManager();
        em.getTransaction().begin();
        Employee emp = new Employee();
        emp.setName("Mukesh");
        emp.setEmail("m@gmail.com");
        emp.setDepartment("Finance");
        em.persist(emp);
        em.getTransaction().commit();
        em.close();
      }
    }

Package structure

A: Try to use javax.persistence.Entity annotation for Employee class.
More information and examples of EclipseLink usage:
https://wiki.eclipse.org/EclipseLink/Examples/JPA

A: Give @Entity annotation to your class. You may also require a primary key Id, specify @Id to one of the attribute.
package com.assignment;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Employee {
        @Id
        private Long id;
        private String name;
        private String email;
        private String department;

        public Long getId() {
            return id;
        }
        public void setId(Long id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getEmail() {
            return email;
        }
        public void setEmail(String email) {
            this.email = email;
        }
        public String getDepartment() {
            return department;
        }
        public void setDepartment(String department) {
            this.department = department;
        }
        public String toString() {
            return "Employee [name=" + name + ", email=" + email + " , department="
                    + department + "]";
        }
}


text:
Q: Get Clicked Row of GridView I have an RadGridView and a HyperLink button attached to each row. I want to get the value of column ID on Hyperlink's Click event. I tried this but got NullReferenceException because SelectedItem contains null.
private void OnGetDetailsClick(object sender, RoutedEventArgs e)
{
   ProductDetail productDetail = new ProductDetail();
   Product product = this.grdProductGrid.SelectedItem as Product;
   productDetail.ProductId = product.ProductID
}

Xaml for RadGridView
<telerik:RadGridView HorizontalAlignment="Left"
                          Height="278"
                          VerticalAlignment="Top"
                          Width="1220"
                          Margin="20,0,0,0"
                          Name="grdProductGrid"
                          ColumnWidth="*"
                          AutoGenerateColumns="False" >

                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn x:Name="ID"
                                                DataMemberBinding="{Binding Path=ProductID}"
                                                Header="ID"
                                                IsReadOnly="True"
                                                IsVisible="False"/>

                    <telerik:GridViewDataColumn x:Name="Name"
                                                DataMemberBinding="{Binding Path=Name}"
                                                Header="Name"
                                                IsReadOnly="True" />

                    <telerik:GridViewDataColumn x:Name="Description"
                                                DataMemberBinding="{Binding Path=Description}"
                                                Header="Description"
                                                IsReadOnly="True" />

                    <telerik:GridViewColumn Header="Details" Width="*">
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <HyperlinkButton Content="Details"
                                                     Tag="Hyperlinkbutton"
                                                     HorizontalAlignment="Center"
                                                     Click="OnGetDetailsClick"/>
                                </StackPanel>
                            </DataTemplate>
                        </telerik:GridViewColumn.CellTemplate>
                    </telerik:GridViewColumn>
                  </telerik:RadGridView.Columns>
</telerik:RadGridView>

Whats wrong with my code? How can I access the row on Click event?

A: You can use CommandParameter to pass a Product to the click event
  <HyperlinkButton Content="Details"
    Tag="Hyperlinkbutton"
    HorizontalAlignment="Center"
   Click="OnGetDetailsClick" CommandParameter={Binding .}/>

and in your code behind you have
Product product=((Product)((HyperlinkButton)sender).CommandParameter)


text:
Q: How to make Paging work with Jquery tablesorter i am using Jquery tablesorter .
I want to show initailly 3 records in the table
I tried with the option as shown below
 $(document).ready(function() {
    $(".testtable").tablesorter({
        widgets: ["filter", "scroller"],
        widgetOptions: {

        }
    }).tablesorterPager({
        container: $(".pager"),
        size: 3
    });
});

But why the paging is not working in this case ??
This is my fiddle
http://jsfiddle.net/99p3yvv6/8/

A: The problem isn't the table sorter, it's the loading of the data.
You are loading the data only on click of the tabs, you should add a load of first tab in the ready function or such.
EDIT
You can use the code from your click handler to fix the issue. See here
 $(document).ready(function() {
  var datatoselect = myjsonresponse1;
  var html = "";
  html += '';
  for (var e = 0; e < datatoselect.length; e++) {
    html += "
" + datatoselect[e].name + "	" + datatoselect[e].date_time + "
"
  }

  $(".testtable tbody:visible").html(html);
  $(".testtable").tablesorter({
  ...

You would need to comment out this one:
$(document).ready(function() {
  //$('.ui-tabs-panel').css('display','none');
})

since by setting display:none you won't find any tbody:visible, which is the selector used for loading the data.

A: Your problem is with the pagers. You need to define seperate pagers for each tables adding

after the tables then your tablesorter code should be like:
$(".testtable").each(function(){
     $(this).tablesorter({
       widgets: ["filter", "scroller"],
       widgetOptions: { }
     }).tablesorterPager({
       container: $(this).parent().find(".pager"),
       size: 3
     });
});

UPDATED FIDDLE


text:
Q: If AssertionError in python I want to execute the code block under "if AssertionError:". But it is not working. My objective is for any Assertion error found for the previous assertion statements, I need to report the same in the log file. Where I have done wrong in the following code?
I dont want to use try-except because using try except, I can make the above code work but the actual failures are not reported in the test report and its showing 100% pass even if there are assertion failures.
            else:
                assert context.json_response is not None
                assert float(context.json_response[0]['base_premium']) > float(1)
                assert float(context.json_response[0]['total_premium']) < float(1)
                assert float(context.json_response[0]['tax']) > float(1)
                print(context.json_response[0]["tax"])
                if AssertionError:
                    json_data = context.payload
                    sys.stdout = open("OD_Plans.log", "a")
                    print("Test case failed due to assertion error")
                    print("Previous Policy Status=" + " " + status)
                    print("expiry date=" + " " + exp_date)
                    print("Owner=" + " " + owner)
                    print("Registration Date=" + " " + reg_date)
                    print("Manufacturing Year=" + " " + man_yr)
                    print("Veichle Maker=" + " " + vchl_make)
                    print("Maker Code=" + " " + vchl_code)
                    print(json.dumps(json_data, indent=2))


text:
Q: I can receive data from controller but cannot send to controller from view with AJAX call .NET CORE I want to send a string type id from View to the controller, do some calculations in the relevant action in the controller, and return a string back to the view. I can receive the returnData from controller, however the parameter of the action which is 'String data' is always null. It means i cannot send data from view to controller.
Thank you for your help.
View Side:
var data= "some string";

        $.ajax({

            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(data),
            url: "/Identities/Ajax",
            success: function (data) {
                alert("data: " + data);
            },
            error: function (result) {
                alert("error!!");
            }

        })

Controller Side:
public JsonResult Ajax(String data)
    {
        var returnData= "some string";
        Console.WriteLine(data); // Always Null
        return Json(returnData);
    }

A: You must create object first, then stringify object to pass object value to controller. Example:
var data= "some string";

    $.ajax({

        var objParam = new Object();
        objParam.data = data;

        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(objParam),
        url: "/Identities/Ajax",
        success: function (data) {
            alert("data: " + data);
        },
        error: function (result) {
            alert("error!!");
        }

    })

Also you have to change in your controller
public ActionResult Ajax(String data)
    {
        var returnData= "some string";
        Console.WriteLine(data); // Always Null
        return Json(returnData);
    }

A: Use FromBody attribute on your parameter.
public ActionResult Ajax([FromBody]String data)
and name parameter in your jquery part:
data: {data: JSON.stringify(data)},


text:
Q: How to run a minified Express.js server I have a minified Express.js project in the 'dist' folder.
Grunt uglifies the entire 'dist' folder and places the results in a 'build' folder.
Up to this point everything is fine. But, nothing runs afterwards without manually copying the 'package.json' file and then running npm install.
All I get is Error: Cannot find module 'dotenv' .
Am I missing something here?
Does a minified Express server suppose to run differently?
Or are my configurations faulty?
The Gruntfile is as follows -
module.exports = function (grunt) {
    const folder = 'some/path';
    grunt.initConfig({

    uglify: {
        files: {
            src: 'dist/**/*.js',
            dest: folder,
            expand: true,
            flatten: false,
            ext: '.min.js'
        },
    },
});
grunt.loadNpmTasks('grunt-contrib-uglify');

};

Edit:
package.json -
{
  "name": "name",
  "version": "1.0.0",
  "description": "Description",
  "main": "src/ser.ts",
  "scripts": {
    "dev": "nodemon",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Someone",
  "license": "",
  "dependencies": {
    "dotenv": "^16.0.1",
    "express": "^4.18.1",
    "nodemailer": "^6.7.5",
    "ts-node": "^10.8.1",
    "typescript": "^4.7.3"
  },
  "devDependencies": {
    "@types/express": "^4.17.13",
    "@typescript-eslint/eslint-plugin": "^5.28.0",
    "@typescript-eslint/parser": "^5.28.0",
    "eslint": "^8.17.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-plugin-import": "^2.26.0",
    "grunt": "^1.5.3",
    "grunt-contrib-uglify": "^5.2.1"
  }
}


text:
Q: mkvmerge add stream (e.g. subtitles) without copying entire file / in place merge The title says it all. I frequently add subtitle .srt files to .mkv files and every time I use mkvtoolnix / mkvmerge, the entire input .mkv is copied to the otput file. Is there a way to do the merge in place, i.e. write the .srt file into an additional stream in the existing file?

A: No, there is not. Adding of new streams increases the size of the file, even if it is something small as a subtitle. This has to be done by muxing/demuxing the file(ie, opening the mkv container and closing it after adding the stream). It has many other reasons too, few are fault tolerance and buffer optimization(optimize the file size after adding the stream).
Whereas you can add/change meta-data in-place as the mkv container allocates/consumes space for them whether or not it is present.
In general no tool can do what you require in place as it goes against the mkv container specifications.


text:
Q: Event? for TimeChanged in Windows In the previous version of my Application to enable capture that the time had been changed in Windows I implemented an IMessageFilter to capture WM_ that is sent by windows when the time has changed.
I know that now with .NET 4 (previously I was using .NET 2 (with reflection) to "ResetTimeZone" I can just call ClearCachedData.
What I'm hoping is that there is some Event that I can attach to in the BCL which I may not have seen that can report the Time has been changed.
If not, I'll just stick with my existing Filter. Does such an event exist? Similar to the System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements
    System.Windows.Forms.IMessageFilter.PreFilterMessage
    Select Case m.Msg
        Case 30
            System.Globalization.CultureInfo.CurrentCulture.ClearCachedData()
            'ResetTimeZone()
            RaiseEvent TimeChanged(Me, EventArgs.Empty)
        Case Else
    End Select
End Function

A: I think this is what you're looking for:
SystemEvents.TimeChanged


text:
Q: Understanding React Rendering It seems that React components always run their render method when their parent component renders, even if no state or props changed for the child component, even if the child component has no state or props.
Is this supposed to be? Is there any inefficiency in this? Switching the child component to a PureComponent fixes this, and the child component will not reRender. Should I favor PureComponents over regular Components?

A: If you are wanting to control what makes a component rerender then you should be using shouldComponentUpdate which can be used on all react components unless they are stateless functional components. The PureComponent basically uses a shouldComponentUpdate automatically and does a shallow check on past and current props/state and if there was a change it will rerender.
Sometimes you might be dealing with more complex data structures and want to be in control of the shouldComponentUpdate yourself, in that case just follow the life cycle method instructions here.
https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate
Here is also the info for PureComponent
https://facebook.github.io/react/docs/react-api.html#react.purecomponent


text:
Q: Adding a country tag separate from acts as taggable list My goal is to find a way to add a new field in the submission form to gather what country the picture is from. I want to make the country searchable the same way any tag can lead to a page just with items containing that tag when using the acts-as-taggable-on gem. I made a few very, very misguided attempts with my early October attempts at https://github.com/harrisongill/whatyoutheat/commits/master.
Ideally, I want it to look like when you go to a page like http://community.whatyoutheat.com/pins/10, there are not only lines like description, author, and tags, but also one for country that works similar to how a tag works.
Any help would be appreciated. I'm open to something involving acts-as-taggable-on or anything else.

A: Easy peasy.  And looking at your code, there's not much to do.
First of all, you need a virtual attribute for country since it's a field that doesn't exist in your database and as far as I can tell, doesn't need to.  And because it's rails 3, you'll need to make it accessible.  Next you'll merge the country name with the tags list before you submit.
That's it.
Step 1 - Add a virtual attribute in the model
attr_accessor :country

Step 2 - Make the attribute accessible in the model
attr_accessible :description, :image, :image_remote_url, :tag_list, :country

Step 3 - Append the country name to the tag list before submit in the controller#create
params[:pin][:tag_list] = params[:pin][:tag_list] + ", " + params[:pin][:country]
params.delete :country
@pin = current_user.pins.new(params[:pin])

Also remember to replace the tag list in Show to create links to the tags.

Tags: <%= raw @pin.tag_list.map { |t| link_to t, tag_path(t) }.join(', ') %>


text:
Q: Deploying war into OSGI at Runtime My requirement is to deploy war files into OSGI at runtime.
For to achieve that I am trying through below codes:
BundleContext bundlecontext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
Bundle b = bundlecontext.installBundle("file:" + "./war/testwar.war");
b.start();

But I am unable to achieve that, by using the above codes.
As I am new to OSGI I have very less idea of OSGi.
So I need help on this to achieve.

A: OSGi runtime is not an application server but environment that manages modules (bundles). A war is not (usually) an OSGi bundle and can not be installed the way you do it.
There are many different ways to achieve what you want and it's hard to suggest something. Here are some of the them:

*

*Convert the WAR to WAB (Web Application Bundle). This way you can install it into any OSGi runtime. You would also need to install other bundles that can handle web requests (HTTP Whiteboard implementation for example)

*Use an OSGi based product that can automatically convert wars to bundles. Liferay Portal does that but it may be too much to learn it if all you want is to run one app.

*If you tagged the question with apache-karaf because that is your environment, then have a look at War deployer. That feature will allow you to install war files in Karaf. If you want to do it from code, you can have a look at the code of that feature and follow the same approach.


text:
Q: WPF MediaElement performance Are there any general advices on how to use MediaElement component in order not to decrease performance?
The point is, I have MediaElement with subtitles over it. And when video is playing I have bad overall performance of the application (jerks even in simple control's animations, though CPU is loaded about 20%).
I compare performance of my application with Windows Media Player, where they also have subtitiles, shadow effects and other components over the video and where everything works very smoothly.
Thanks.


text:
Q: Safe to delete old "Macintosh HD - Data" partition? I did a clean install of MacOs today, and when choosing where to install it chose "Macintosh HD". It now seems there is a new "Macintosh HD - Data" partition, where MacOS currently references, as well as my old "Macintosh HD - Data" with all my data still there.
Assuming I don't need any of the data on it, is it safe to delete the old -Data partition?
EDIT:
diskutil list returns the following:
/dev/disk0 (internal, physical):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *500.3 GB   disk0
1:                        EFI EFI                     314.6 MB   disk0s1
2:                 Apple_APFS Container disk1         371.0 GB   disk0s2
3:       Microsoft Basic Data BOOTCAMP                128.0 GB   disk0s3
4:           Windows Recovery                         920.6 MB   disk0s4

/dev/disk1 (synthesized):
#:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +371.0 GB   disk1
                                 Physical Store disk0s2
1:                APFS Volume Macintosh HD - Data     269.1 GB   disk1s1
2:                APFS Volume Preboot                 634.7 MB   disk1s2
3:                APFS Volume Recovery                1.2 GB     disk1s3
4:                APFS Volume VM                      2.1 GB     disk1s4
5:                APFS Volume Macintosh HD - Data     42.1 GB    disk1s5
6:                APFS Volume Macintosh HD            15.1 GB    disk1s7
7:              APFS Snapshot com.apple.os.update-... 15.1 GB    disk1s7s1

diskutil apfs listVolumeGroups returns the following:
APFS Container (1 found)
|
+-- Container disk1 9A012B72-C05A-43FB-9A22-F7DC25CC2E05
    |
    +-> Volume Group 94245471-6F9F-3BB6-A6B7-37F3B9A771D5
    |   =================================================
    |   APFS Volume Disk (Role):   disk1s1 (Data)
    |   Name:                      Macintosh HD - Data
    |   Volume UUID:               94245471-6F9F-3BB6-A6B7-37F3B9A771D5
    |   Capacity Consumed:         269121105920 B (269.1 GB)
    |
    +-> Volume Group A7914E12-F1B5-415F-A537-6942D294B6E8
        =================================================
        APFS Volume Disk (Role):   disk1s5 (Data)
        Name:                      Macintosh HD - Data
        Volume UUID:               A7914E12-F1B5-415F-A537-6942D294B6E8
        Capacity Consumed:         42299822080 B (42.3 GB)
        -------------------------------------------------
        APFS Volume Disk (Role):   disk1s7 (System)
        Name:                      Macintosh HD
        Volume UUID:               5ABDE43A-2F43-414F-8BCE-1AA92D42D887
        Capacity Consumed:         15050797056 B (15.1 GB)

A: It's important to be certain that you're deleting the correct data volume since they're named identically:

*

*In Terminal run the following command: diskutil apfs listVolumeGroups.

*Find the volume group that contains both a System and a Data disk. That's the one you're going to keep.

*The remaining volume group, which only has a Data disk, will be erased. Verify its name ("Macintosh HD - Data"). Note its device node (it will look like disk8s9 except the 8 and 9 will be different). Be sure to be VERY careful about writing this node down exactly.

*Run the following: sudo diskutil apfs deleteVolume diskXsY, replacing the X and Y with the actual device node from Step 3. Again, be very careful with your typing here.

A: Yes, it is safe to delete it if you no longer want the data stored in it.

A: Mac OS (that is, Disk Utility.app) will warn you if you try to delete half of a volume group. so if you get a warning about deleting the volume you want to delete and another one, you have chosen the wrong volume. If you delete the actual old volume that is fine, as TJ said, as long as you are sure you do not need any of that data.

A: The Data partition is where the user-files are. You will not be able to get rid of the partition. You can delete the files if you want, but it will delete your preferences, etc.


text:
Q: Facebook Native Share Dialog in swift I am trying to create  share button which will share a link on Facebook. The problem is that I do not want to have a login button before share button in my app, I just need to have a share button.
I think one solution may be to use custom buttons for login and share buttons and merge these buttons in one. In that way if the user has not log in when he click share button he will be asked to login. However during the time that I was trying to achieve this I found that Native Share Dialog is even better solution because it dose not request to login at all.
But I am struggling to find any references/tutorial/examples or anything where Native Share Dialog is used with swift. There are examples and stuffs on Obj-c but I have never used Obj-c and I do not know anything about it.
I was hopping if anyone has any examples or can anyone point me in the right direction how to achieve Facebook Native Share Dialog in Swift.
If not dose anyone has any example of using custom share buttons on Swift

A: Actually I figure out a solution.
These lines of code would implement Facebook Native Share Dialog in Swift:
let content: FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: self.contentURL)
content.contentTitle = self.contentTitle
content.contentDescription = self.contentDescription
content.imageURL = NSURL(string: self.contentURLImage)
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: nil)

A: You don't need to handle login by yourself actually, in iOS if you're using iOS SDK's UIActivityViewController, iOS will handle for you.
from documentation :
Declaration (SWIFT)
init(activityItems activityItems: [AnyObject], applicationActivities applicationActivities: [AnyObject]?)

Parameters

activityItems  The array of data objects on which to perform the
  activity. The type of objects in the array is variable and dependent
  on the data your application manages. For example, the data might
  consist of one or more string or image objects representing the
  currently selected content.
Instead of actual data objects, the objects in this array can be
  objects that adopt the UIActivityItemSource protocol, such as
  UIActivityItemProvider objects. Source and provider objects act as
  proxies for the corresponding data in situations where you do not want
  to provide that data until it is needed.
This array must not be nil and must contain at least one object.
  applicationActivities  An array of UIActivity objects representing the
  custom services that your application supports. This parameter may be
  nil.

a code snipped :
let so:NSURL = NSURL(string:"http://stackoverflow.com")
let activityVC = UIActivityViewController(
            activityItems: ["Some text here...", so],
            applicationActivities: nil)
self.navigationController.presentViewController(activityVC,
   animated: true,
   completion: nil)

Alternatively you can use Facebook's SDK for this (you need to add in your project). Also SDK will handle login.
Here is prerequisites :

Before you can share to Facebook from your app, you'll need to:
Add the Facebook SDK for iOS to your mobile development environment
  Get a Facebook app ID, properly configured and linked to your iOS app
  Add your app id and display name to your app's .plist file. Link the
  FBSDKShareKit.framework to your project.

here is Facebook SDK page :
https://developers.facebook.com/docs/sharing/ios
here is some code snippet for URL sharing :
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: self.short_string)
content.contentTitle = self.title_text
// ... etc.

let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content


text:
Q: Can I use the same text file in two separate forms within the same project? Edit: I've found a work around, thanks for all your help :)
I'm working on a computer science project and I'm in the prototype stage right now. I will eventually switch this entire thing to a database once everything for it is sorted on the campus computers but for now I'm using text files. It's written on visual studio using VB (Required by my college). I'm trying to use the same text file in two different forms at different times but I keep getting the same error when I run it, saying that the file is open elsewhere. I assume this is because it reads from that file in the next form but I have made it so that the file isn't even opened until a specific button click on that other window. It reaches this error when I attempt to write data to the file from the first window, I never get to the stage where I read from the file in the next form.
Context:
It's a booking system for a youth hostel, the booking text file is written to, from the booking page and saved. This opens up a booking confirmation page where data is read from the last line of the file and necessary information is taken out (Name, checkin/checkout dates, booking reference etc.) to be inserted into the booking confirmation message so it's sort of tailored to each booking but keeps the same structure. I have a button to "save booking" which would write the data to the file but this is where the error occurs. The other form isn't open, the text file isnt open anywhere else and after writing to the file, it's closed.
Is there a workaround? should I just try using variables to hold the input data to use it in the next form? I'm not too worried about it being perfect because this is just a prototype until my college sorts out its issue with databases but I'd still like it to function the way I want it to.
Thank you :)
From booking page:
Private Sub btnBook_Click(sender As Object, e As EventArgs) Handles btnBook.Click
        Dim NewBooking As Bookings
        Dim errorFlag As Boolean
        Dim bookingID As Integer
        errorFlag = False
        If txtID.Text = "" Or drpNumGuests.Text = "Please Select" Or txtCheckin.Text = "" Or txtCheckout.Text = "" Or txtRoomNo.Text = "" Then
            errorFlag = True
        End If
        If errorFlag = True Then
            MsgBox("Error with data entered, please try again.")
        Else
            Dim sw As New System.IO.StreamWriter("Bookings.txt", True)      'fix
            Dim Booking() As String = File.ReadAllLines("bookings.txt")
            If UBound(Booking) < 0 Then
                bookingID = 0
            Else
                bookingID = Str(Int(Booking(UBound(Booking)).Substring(0, 8)) + 1)      'Automatic BookingID assignment
            End If
            NewBooking.GuestID = LSet(txtID.Text, 9)
            NewBooking.BookingID = LSet(bookingID, 9)
            NewBooking.Name = LSet(txtName.Text, 25)
            NewBooking.GuestNum = LSet(drpNumGuests.Text, 2)
            NewBooking.CheckIn = LSet(txtCheckin.Text, 11)
            NewBooking.CheckOut = LSet(txtCheckout.Text, 11)
            NewBooking.RoomNum = LSet(txtRoomNo.Text, 3)
            NewBooking.Requests = txtRequests.Text

            sw.WriteLine(NewBooking.GuestID & NewBooking.BookingID & NewBooking.Name & NewBooking.GuestNum & NewBooking.CheckIn & NewBooking.CheckOut & NewBooking.RoomNum & NewBooking.Requests)
            FileClose()
            MsgBox("Booking complete")

        End If

    End Sub

    Private Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click
        Booking_Confirmation.Show()
        Me.Hide()

From booking confirmation page:
Private Sub btnGen_Click(sender As Object, e As EventArgs) Handles btnGen.Click
        Dim Bookconfirm() As String = File.ReadAllLines("bookings.txt")
        Dim Name As String
        Dim CheckIn As String
        Dim CheckOut As String
        Dim NumGuests As String
        Dim RoomNum As String
        Dim ID As String
        Dim BookingID As String
        Dim Count As Integer = UBound(Bookconfirm)
        ID = Mid(Bookconfirm(Count), 1, 8)
        BookingID = Mid(Bookconfirm(Count), 10, 8)
        Name = Mid(Bookconfirm(Count), 19, 25)
        CheckIn = Mid(Bookconfirm(Count), 46, 10)
        CheckOut = Mid(Bookconfirm(Count), 57, 10)
        NumGuests = Mid(Bookconfirm(Count), 44, 2)
        RoomNum = Mid(Bookconfirm(Count), 68, 2)

        txtConfirmation.Text = ID & "  Thank you " & Name & " for booking your stay with us. Your booking of " & NumGuests & " has been made for " & CheckIn & "to " & CheckOut & "
                               We look forward to your arrival. Your booking ID is:" & BookingID
End Sub

A: Here's an alternate version you can try. As suggested by Hursey in the comments, a Using statement will make sure the file is completely closed and released.
bookingID = 0
Dim lastLine As String = File.ReadAllLines("bookings.txt").LastOrDefault()
If Not IsNothing(lastLine) Then
    bookingID = Str(Int(lastLine.Substring(0, 8)) + 1) 'Automatic BookingID assignment
End If

NewBooking.GuestID = LSet(txtID.Text, 9)
NewBooking.BookingID = LSet(bookingID, 9)
NewBooking.Name = LSet(txtName.Text, 25)
NewBooking.GuestNum = LSet(drpNumGuests.Text, 2)
NewBooking.CheckIn = LSet(txtCheckin.Text, 11)
NewBooking.CheckOut = LSet(txtCheckout.Text, 11)
NewBooking.RoomNum = LSet(txtRoomNo.Text, 3)
NewBooking.Requests = txtRequests.Text

Using sw As New System.IO.StreamWriter("Bookings.txt", True)
    sw.WriteLine(NewBooking.GuestID & NewBooking.BookingID & NewBooking.Name & NewBooking.GuestNum & NewBooking.CheckIn & NewBooking.CheckOut & NewBooking.RoomNum & NewBooking.Requests)
End Using

MsgBox("Booking complete")

If all of the information is already in NewBooking then either PASS that to the secondary form, or simply move it's declaration out to FORM level so that it's accessible. Then you won't need to read the file again to retrieve the information you literally just had?...


text:
Q: DataBinding in Windows Phone is blocking UI threading I am trying to do the standard - bind a list of data (including images) received from REST API calls in a very quick and smooth manner - a paradox in itself.  I have 2 service calls that each take about 2 seconds to complete so I can async/await those, but based on the data returned, I then build other lists (observableCollection) in memory and bind them back to ListBox's in the page.
Problems:

*

*This actual binding seems to lock up the UI thread, how can I asynchronously load my page - listBox by listBox (or even item by item) in a lazy fashion?  I'd like to put a placeholder image in place and when finally bound, the placeholder is replaced by the bound image.  Any ideas?  Frameworks?  Tools?

*When binding the actual images, the other data in my DataTemplate, actually jumps around the screen while the Image is rendered.  It looks terrible...  I'd like to be able to, at the very least, bind the image first and then the other controls in the dataTemplate after?  Anything that would make it appear a bit smoother would help.
Thanks in advance.

A: I suspect your problem in (2) will be solved with the placeholder image (assuming that it is the same size as the downloaded images).
I suspect that your "lock up" problem in (1) is that you are calling Wait or Result on a Task returned by an async method. In many cases, this results in a deadlock, as I explain in a recent MSDN article and on my blog.
I think what you really want is a way to start a Task and get a data-binding notification when it completes. I've developed a set of types (TaskCompletionNotifier) that helps out in this situation. Check out the end of my blog post on async properties for a sample. You may also be interested in my blog post on async constructors.

A: (1) If the list of items is large, binding them all at once will cause some stalling on the UI thread. One fix is to add the items a few at a time and pause so that the UI thread can get a new frame to the compositor before continuing.
public async void AddObjects(List<object> objects)
{
    for(int i = 0; i < objects.Count; i++)
    {
        _myObservableCollection.Add(objects[i]);
        if(i % 10 == 0) await Task.Delay(100);
    }
}

(2) You should set a fixed width and height on the images in the DataTemplate, so that it does not change as the image is actually downloaded. Alternately, if you can fetch the width and height from your service in the API calls, bind the image width/height to those values before it gets downloaded.


text:
Q: Writing nicely formatted text in Python In Python, I'm writing to a text file with code like:
f.write(filename + type + size + modified)

And of course the output looks really ugly:
C:/Config/ControlSet/__db.006  file          56 KB   2012-Apr-30 10:00:46.467 AM
C:/Config/ControlSet dir       68881 KB   2012-Apr-30 10:00:46.396 AM
C:/Config/DataStore.avlocate file           0 KB   2012-Apr-30 09:57:42.440 AM
C:/Config/DataStoreLocate.bak file           0 KB   2012-Apr-30 09:57:42.470 AM
C:/Config/DeviceConnections/devconn.bak file          41 KB   2012-Apr-30 10:39:50.181 AM
C:/Config/DeviceConnections/devconn.cfg file          41 KB   2012-May-29 10:12:45.288 AM

But I want to align the entries so it looks like this:
C:/Config/ControlSet/__db.006                                            file          56 KB   2012-Apr-30 10:00:46.467 AM
C:/Config/ControlSet                                                      dir       68881 KB   2012-Apr-30 10:00:46.396 AM
C:/Config/DataStore.avlocate                                             file           0 KB   2012-Apr-30 09:57:42.440 AM
C:/Config/DataStoreLocate.bak                                            file           0 KB   2012-Apr-30 09:57:42.470 AM
C:/Config/DeviceConnections/devconn.bak                                  file          41 KB   2012-Apr-30 10:39:50.181 AM
C:/Config/DeviceConnections/devconn.cfg                                  file          41 KB   2012-May-29 10:12:45.288 AM

My issue is similar to this question except I don't know how long the filenames will be beforehand. How should I approach this?

A: If you can get a list of all filenames first, then you could do something like:
max_width = max(len(filename) for filename in filenames)
for filename in filenames:
    f.write(filename.ljust(max_width+1)+..whatever else..)

If you can't get a list of all filenames first, then there's no way to make sure that everything will line up, because there's no way to know if you'll later get a file whose name is really long.
In a case like this, though, I would usually just assume that N columns is generally sufficient, for some N, in which case you can just do something like:
f.write('%-40s %6s %10s %2s\n' % (filename, type, size, modified))

A: I think what you're looking for is the str.ljust() method and maybe str.rjust() too.
As it says in the docs, the original string is returned if it's too long, so you will never truncate away any data, but you would have to find out the longest lengths ahead of time in order to get really perfect formatting.  I would suggest just using a reasonably large number for the values unless it has to be perfect.
Something like...
f.write(
    "{0} {1} {2} {3}".format(
        filename.ljust(max_filename),
        type.rjust(max_type),
        size.rjust(max_size),
        modified.rjust(max_modified)
        )
    )

would do the trick.


text:
Q: Why doesn't GCC throw a warning in this example With -Wsequence-point enabled, GCC should warn user when undefined behavior code is spotted. For example
b = a + ++a;

should be noticed by GCC and should be reported as "undefined behavior" code (because ISO C doesn't specify the order of evaluating operands for addition).
However, I played with the syntax and I tried this one:
int *a = malloc(sizeof(int) * 2);
a[0] = 1;
printf("%d\n", *(a + (*a)++ - *a));

Of course, I got the warning

warning: operation on '*a' may be undefined [-Wsequence-point]

which is what I expected, because the value of *a (which is a[0]) may be incremented or may not be while processing the third operand. But, I tried the following one:
int *a = malloc(sizeof(int) * 2);
a[0] = 1;
printf("%d\n", *(a + (*a)++ - 1));

I was surprised because I got no warnings. Shouldn't this be UB too? I mean, according to ISO C99, post increment operation may be evaluated at any point durring expression evaluation (except for comma operators and ternary operators). In my latter example, I am not incrementing pointer, but instead the integer it points to. So, accordning to the standard, it can be incremented at any point (which means that it can be incremented after whole expression is evaluated), so the program may print both 1 or 2, right?
Why doesn't GCC throw any warnings? Or did I miss something? Did I wrongly understand the specs?

A: Static analysis tool of gcc does not handle this situation.
The expression *(a + (*a)++ - x) is too hard for static analysis of gcc, because it results in undefined behavior due to lack of sequence point under some very specific circumstances - namely, when *a contains x. This is when (*a)++ - x "undo" each other, so overall expression becomes equivalent to *a plus some side effects.
In order for gcc code analysis to spot this error, the compiler must track the content of *a throughout its lifetime. Although it looks simple in your example, a more complex program, say, where data is read into a from user input, renders such analysis impossible.


text:
Q: Third-Party Mac Admin Tools What tools have you found useful for managing Macs that didn't come with the system?  I'm interested in both CLI and GUI tools, a synopsis and a link.
If binaries aren't provided, are their any tricks to compiling it?
Lastly, can you give an indication of the licence or cost of the software?

A: Apple Remote Desktop. It's by far the most useful tool that's out there. You can do screen sharing, remote control, installing files and pkg remotely, doing hard- and software inventory and lot of other stuff. There are few tools that made my job so much more easier than this. If you have more than 3 macs in more than 2 rooms, get it. It's not very cheap though, with $299 for 10 client computers and $499 for unlimited clients.
And if you have to manage OS X Server, make sure to read the CLI admin guide, there is lot of valuable info in it which isn't very obvious because the differences to other *nixes.

A: The CLI that comes with OS X Server is pretty powerful and can do everything and more than what's provided via user interface.  There isn't a tremendous amount of information on the web for managing OSX compared to windows or linux, but I found this blog to be quite helpful and a good place to start: http://managingosx.wordpress.com.
Otherwise, get MacPorts and you can get almost every mainstream unix tool out there.  sudo port install X does it.  It requires you have the developer tools for mac installed, but those are easily downloaded (or on your installation DVDs if they're handy) with a login to ADC.

A: TextWrangler, a freeware tool from Bare Bones Software, is a great text editor.  It has a panel for accessing all your open files, lets you run scripts and capture output easily, change file encoding, does syntax highlighting, offers to unlock files you don't have permission to, and does everything you'd expect from a general-purpose text editor.  [And no, I'm not affiliated with them.]
Of late, I've really enjoyed the fact that on the command-line, you can type:
edit /some/file

and it'll open it up the file.  Better still, you can pipe to it:
ls /Applications | edit

where there is a lot of output, this is really a nicer way to go through it.

A:
iftop does for network usage what top(1) does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts. Handy for answering the question "why is our ADSL link so slow?".

iftop is a GPL CLI tool that I wish I had on all of our machines.  It was a piece of cake to compile from source.  It lets you see what network connections are active and which way they are going.  [You don't even seem to need to be root to use it in normal mode].  It also has a promiscuous mode that'll show all the traffic going through a hub or mirrored switch port.


text:
Q: How to Load HighChart dynamically within angular UI Accorion(uib-Accordion)? I'm getting data, but I have to bind those to highchart on the basis of ID, if i click on accordion it should show highchart and table on the basis of ID like given below

Here is my code
<uib-accordion close-others="oneAtATime">
   <uib-accordion-group is-open="isopen" ng-init="isOpen = $first" class="acc-group" style="margin-bottom:0">
      <uib-accordion-heading ng-click="isopen=!isopen" class="header">

{{board.city}}  {{board.name}}  {{board.date | date:'MM/dd/yyyy'}}₹{{board.price}}({{board.change}})

      </uib-accordion-heading>

                    Date
                     In ₹

                  {{data.date | date:'MM/dd/yyyy'}}
                  ₹{{data.price}}({{board.change}})

       </uib-accordion-group>
  </uib-accordion>

And the Controller
           $http({
                method: "GET",
                url: "/api/Board/getMapdataOnId",
                params: {
                    id: parseInt(id)
                }
            }).then(function (response) {
                var boardData = response.data;
                var dateData = [],
                  rateData = [];
                for (var i = 0; i < boardData.gData.length; i++) {
                    dateData.push(Date.parse(boardData.gData[i].date));
                    rateData.push(boardData.gData[i].maxRate);
                }
                Highcharts.chart('container' + parseInt(id), {
                    chart: {
                        zoomType: 'x'
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: document.ontouchstart === undefined ?
                          'Click and drag in the plot area to zoom in' : 'Pinch the chart to zoom in'
                    },
                    credits: {
                        enabled: false
                    },
                    xAxis: {
                        categories: dateData,
                        type: 'datetime',
                        labels: {
                            autoRotation: [-90],
                            formatter: function () {
                                return Highcharts.dateFormat('%b', this.value) + ', ' + Highcharts.dateFormat('%d', this.value);
                            }
                        },
                        title: {
                            text: 'Date'
                        }
                    },
                    yAxis: {
                        allowDecimals: true,
                        gridLineWidth: 1,
                        labels: {
                            formatter: function () {
                                return this.value;
                            }
                        },
                        //       minorTickInterval: 1,
                        title: {
                            text: 'Price in ' + boardData.gData[0].currency
                        }
                    },
                    tooltip: {
                        formatter: function () {
                            return 'Rates on
' +
                              Highcharts.dateFormat('%b', this.x) + ', ' + Highcharts.dateFormat('%d', this.x) + '
' + boardData.gData[0].currency + '' + this.y;
                        }
                    },
                    plotOptions: {
                        area: {
                            fillColor: {
                                linearGradient: {
                                    x1: 0,
                                    y1: 0,
                                    x2: 0,
                                    y2: 1
                                },
                                stops: [
                                  [0, Highcharts.getOptions().colors[0]],
                                  [1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
                                ]
                            },
                            marker: {
                                radius: 2
                            },
                            lineWidth: 1,
                            states: {
                                hover: {
                                    lineWidth: 1
                                }
                            },
                            threshold: null
                        }
                    },
                    series: [{
                        data: rateData,
                        type: 'area',
                        showInLegend: false
                    }]
                });
            }, function (response) {
                console.log(response.statusText);
            });

A: Shouldn't be ng-click passing the data like this
<uib-accordion-heading ng-click="open({{data.id}})" class="header">

Then in open function,
function open(id) {
    $http({ ..... });
}

A: How about creating a new directive for the chart where you create the chart option and the chart container there.
<example-highchart></example-highchart>

exampleHighchart.js
(function() {
  'use strict';
  angular
    .module('yourModule')
    .directive('exampleHighchart', exampleHighchart);

function exampleHighchart() {
  return {
    templateUrl: 'example-highchart.template.html',
    restrict: 'E',
    scope: {
      id: '='
    },
    replace: 'true',
    link: linkFn
  };

  function linkFn(scope, element) {
    element.find('.highchart-element').highcharts(createOptions());

    function createOptions() {
      // your chart option goes here
    }

    function updateChartData() {
      // you can start the loading animation here
      // and then hide it in the the then block

      // get the highchart element reference to update the properties.
      var chart = element.find('.highchart-element').highcharts();
      $http({
        method: "GET",
        url: "/api/Board/getMapdataOnId",
        params: {
          id: parseInt(id)
        }
      }).then(function (response) {
        var boardData = response.data;
        var dateData = [], rateData = [];
        for (var i = 0; i < boardData.gData.length; i++) {
          dateData.push(Date.parse(boardData.gData[i].date));
          rateData.push(boardData.gData[i].maxRate);
        }
        // update the categories info and the series data
        chart.xAxis[0].setCategories(dateData);
        chart.series[0].setData(rateData);
      });
    }
  }
}

})();

highchart-example.template.html:

A: Don't call ng-click as
<uib-accordion-heading ng-click="open({{data.id}})" class="header">

it should be as
<uib-accordion-heading ng-click="open(data.id)" class="header">


text:
Q: Cant send Ajax to localhost in Apache Cordova. Get ajax error status 0 White-list already installed.
CORS on server enabled.
use in config.xml:
<plugin name="cordova-plugin-whitelist" spec="1" />
<platform name="android">
    <allow-intent href="market:*" />
    <access origin="*" />
    <allow-intent href="*" />
    <allow-navigation href="*" />
    <access launch-external="yes" origin="*" />
</platform>

Ajax:
 $.ajax({
    url : "http://127.0.0.1",
    type : "POST",
    data : {},
    crossDomain: true,
    dataType: 'json',
    success : formSuccessAuth,
    error: function(xhr, status, error) {
              alert(`${xhr.status} ${status} ${error}`);
           }

});

meta in index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

After sending req I get the message: 0 error


text:
Q: Can't execute "stat" on android 2.3.4 command not found So I am currently connected to my android phone using adb shell. When I do "stat file"
I get this message:
stat: not found

Do I need to install this script or what? Im on a 2.3.4 Gingerbread.

A: stat does not come with Android/AOSP.
If you run ls /system/bin you will get a list a lot shorter than what you are probably used to being able to do in most *NIX environments:
ATFWD-daemon
abcc
adb
am
app_process
applypatch
atrace
bdAddrLoader
bmgr
bootanimation
bridgemgrd
btnvtool
bu
bugreport
cat
chcon
chmod
chown
clatd
clear
cmp
conn_init
content
cp
dalvikvm
date
dd
debuggerd
dexopt
df
dhcpcd
diag_klog
diag_mdlog
dmesg
dnsmasq
drmserver
ds_fmc_appd
du
dumpstate
dumpsys
e2fsck
efsks
fsck_msdos
getenforce
getevent
getprop
getsebool
grep
gzip
hci_qcomm_init
hd
hostapd
id
ifconfig
iftop
ime
input
insmod
installd
ioctl
ionice
ip
ip6tables
iptables
keystore
kill
ks
linker
ln
load_policy
log
logcat
logwrapper
ls
lsmod
lsof
make_ext4fs
md5
mdnsd
media
mediaserver
mkdir
mksh
mm-qcamera-daemon
monkey
mount
mpdecision
mtpd
mv
nandread
ndc
netcfg
netd
netmgrd
netstat
newfs_msdos
nl_listener
notify
ping
pm
port-bridge
pppd
printenv
ps
qcks
qmuxd
qseecomd
racoon
radish
reboot
renice
requestsync
restorecon
rild
rm
rmdir
rmmod
rmt_storage
route
run-as
runcon
schedtest
schedtop
screencap
screenshot
sdcard
sendevent
sensors.qcom
sensorservice
service
servicemanager
setconsole
setenforce
setprop
setsebool
settings
sh
sleep
smd
start
stop
surfaceflinger
svc
sync
system_server
tc
thermald
toolbox
top
touch
uiautomator
umount
uptime
usbhub
usbhub_init
v4l2-qcamera-app
vdc
vmstat
vold
watchprops
wipe
wm
wpa_supplicant

No stat, as you can see. If you have root privileges, a simple solution is to install something like BusyBox which adds some such bread-and-butter scripted functions as stat to your environment:
[
[[
acpid
addgroup
adduser
adjtimex
ar
arp
arping
ash
awk
basename
beep
blkid
brctl
bunzip2
bzcat
bzip2
cal
cat
catv
chat
chattr
chgrp
chmod
chown
chpasswd
chpst
chroot
chrt
chvt
cksum
clear
cmp
comm
cp
cpio
crond
crontab
cryptpw
cut
date
dc
dd
deallocvt
delgroup
deluser
depmod
devmem
df
dhcprelay
diff
dirname
dmesg
dnsd
dnsdomainname
dos2unix
dpkg
du
dumpkmap
dumpleases
echo
ed
egrep
eject
env
envdir
envuidgid
expand
expr
fakeidentd
false
fbset
fbsplash
fdflush
fdformat
fdisk
fgrep
find
findfs
flash_lock
flash_unlock
fold
free
freeramdisk
fsck
fsck.minix
fsync
ftpd
ftpget
ftpput
fuser
getopt
getty
grep
gunzip
gzip
hd
hdparm
head
hexdump
hostid
hostname
httpd
hush
hwclock
id
ifconfig
ifdown
ifenslave
ifplugd
ifup
inetd
init
inotifyd
insmod
install
ionice
ip
ipaddr
ipcalc
ipcrm
ipcs
iplink
iproute
iprule
iptunnel
kbd_mode
kill
killall
killall5
klogd
last
length
less
linux32
linux64
linuxrc
ln
loadfont
loadkmap
logger
login
logname
logread
losetup
lpd
lpq
lpr
ls
lsattr
lsmod
lzmacat
lzop
lzopcat
makemime
man
md5sum
mdev
mesg
microcom
mkdir
mkdosfs
mkfifo
mkfs.minix
mkfs.vfat
mknod
mkpasswd
mkswap
mktemp
modprobe
more
mount
mountpoint
mt
mv
nameif
nc
netstat
nice
nmeter
nohup
nslookup
od
openvt
passwd
patch
pgrep
pidof
ping
ping6
pipe_progress
pivot_root
pkill
popmaildir
printenv
printf
ps
pscan
pwd
raidautorun
rdate
rdev
readlink
readprofile
realpath
reformime
renice
reset
resize
rm
rmdir
rmmod
route
rpm
rpm2cpio
rtcwake
run-parts
runlevel
runsv
runsvdir
rx
script
scriptreplay
sed
sendmail
seq
setarch
setconsole
setfont
setkeycodes
setlogcons
setsid
setuidgid
sh
sha1sum
sha256sum
sha512sum
showkey
slattach
sleep
softlimit
sort
split
start-stop-daemon
stat
strings
stty
su
sulogin
sum
sv
svlogd
swapoff
swapon
switch_root
sync
sysctl
syslogd
tac
tail
tar
taskset
tcpsvd
tee
telnet
telnetd
test
tftp
tftpd
time
timeout
top
touch
tr
traceroute
true
tty
ttysize
udhcpc
udhcpd
udpsvd
umount
uname
uncompress
unexpand
uniq
unix2dos
unlzma
unlzop
unzip
uptime
usleep
uudecode
uuencode
vconfig
vi
vlock
volname
watch
watchdog
wc
wget
which
who
whoami
xargs
yes
zcat
zcip

Great stuff - you won't need any computer but your phone, anymore!

A: the stat command is not available on the device. There is a very limited set of commands available. They are listed here:
http://developer.android.com/guide/developing/tools/adb.html
What are you trying to do?


text:
Q: Using the select-case statement with cells within ranges My idea is to fill the cells on column H depending on what the corresponding cell in the range A:A,D:D,F:F contains.
I'm getting the run-time error 13 (type mismatch) on the line Case "Done", though I'm not sure why, as both the selected range and the variable input are strings. I've always used if-loops, this is the first time I'm using select case, but despite having read the reference I still don't know what am I doing wrong.
The second question is how to define the last filled row of a range as the end of a new range. Right now with newRange.Value I'm attributing a value to the entire column, but I'm trying to make sure it only applies to the corresponding cell.
(For clarification, if for example cell A3 contains a value, that means D3 and F3 are empty, so each row in the range A:A,D:D,F:F only contains one value.)
Sub setStatus()

Dim dataRange As Range
Dim newRange As Range

Set dataRange = Range("A:A,D:D,F:F")
Set newRange = Range("H:H")

Select Case dataRange.Value

        Case "Done"
            newRange.Value = "Completed"
        Case "WIP"
            newRange.Value = "In Progress"
            'In reality there are many different cases,
            'hence the select case instead of an if loop
        End Select
    Next

End Sub

A: Application.Match Applied on Array Instead of Select Case
Sub SetStatus()

    ' Constants
    Const SOURCE_FIRST_ROW As Long = 2
    Const DESTINATION_COLUMN As Long = 8
    ' Arrays
    Dim sCols() As Variant: sCols = VBA.Array(1, 4, 6) ' only one column has data
    Dim Cases() As Variant: Cases = VBA.Array( _
        "Done", "WIP")
    Dim Values() As Variant: Values = VBA.Array( _
        "Completed", "In Progress")

    ' Worksheet
    Dim ws As Worksheet: Set ws = ActiveSheet ' improve!

    ' Write the values from the source range to an array.

    Dim srg As Range: Set srg = ws.UsedRange
    Dim rOffset As Long: rOffset = SOURCE_FIRST_ROW - 1
    Dim rCount As Long: rCount = srg.Rows.Count - rOffset
    Set srg = srg.Resize(rCount).Offset(rOffset)
    Dim Data As Variant: Data = srg.Value

    Dim cUpper As Long: cUpper = UBound(sCols)

    ' Write the matching results to the 1st column of the array.

    Dim r As Long
    Dim c As Long
    Dim cString As String
    Dim cIndex As Variant
    Dim HasDataInRow As Boolean

    For r = 1 To rCount ' rows of the array
        For c = 0 To cUpper ' given columns of the array
            cString = CStr(Data(r, sCols(c)))
            If Len(cString) > 0 Then
                cIndex = Application.Match(cString, Cases, 0)
                If IsNumeric(cIndex) Then
                    Data(r, 1) = Values(cIndex - 1) ' found in Cases
                Else
                    Data(r, 1) = Empty ' not found in Cases
                End If
                HasDataInRow = True
                Exit For
                'Else ' is blank; do nothing
            End If
        Next c
        If HasDataInRow Then
            HasDataInRow = False
        Else
            Data(r, 1) = Empty ' the row was blank
        End If
    Next r

    ' Write the values from the first column of the array
    ' to the destination range.

    Dim drg As Range: Set drg = srg.Columns(DESTINATION_COLUMN)

    drg.Value = Data

    MsgBox "Status set.", vbInformation

End Sub


text:
Q: TestDriven.io Tutorial "Scalable FastAPI Applications on AWS": adding Docker CI/CD image fails with exit code 28 I'm going through the TestDriven.io tutorial "Scalable FastAPI Applications on AWS" in the "Deployment" chapter:
https://testdriven.io/courses/scalable-fastapi-aws/deployment/
I've just created the Docker image file for building and pushing a Docker image for the application. When I commit the code and the pipeline runs, it fails on the Dockerfiles first RUN command, which just installs AWS CLI, Python and Poetry. The result is "ERROR: Job failed: exit code 28".
The command in the Dockerfile that fails is:
    RUN apk --no-cache add \
            binutils \
            curl \
        && curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
        && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
        && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
        && apk add --no-cache \
            glibc-${GLIBC_VER}.apk \
            glibc-bin-${GLIBC_VER}.apk \
        && curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
        && unzip awscliv2.zip \
        && aws/install \
        && rm -rf \
            awscliv2.zip \
            aws \
            /usr/local/aws-cli/v2/*/dist/aws_completer \
            /usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \
            /usr/local/aws-cli/v2/*/dist/awscli/examples \
        && apk --no-cache del \
            binutils \
            curl \
        && rm glibc-${GLIBC_VER}.apk \
        && rm glibc-bin-${GLIBC_VER}.apk \
        && rm -rf /var/cache/apk/*

I've found a few different results just by googling "Exit code 28" but I'm not sure which one applies and how to fix this. Has anyone else done this tutorial, and can provide some insight?

A: Exit code 28 in curl means "Operation Timeout" (see https://everything.curl.dev/usingcurl/returns). I have seen similar errors today when docker images on gitlab tried to connect to the internet, for instance when doing an apt-get install. It wasn't really reproducable though, it happend on different connections each try.
Although I couldn't find someone one Twitter who was able to confirm this, I suspect gitlab is having some issues today. Maybe if you try it later it will work.
I assume you copy & pasted the contents from the tutorial. It worked for me when I was doing that step, so there is no real error in these commands.

A: I ran the job again two more times: each time, it got a little further in the script and eventually to the end, where it passed, without me changing anything in the script.


text:
Q: Is there a way to ensure template argument is a container? What are mechanisms for ensuring that template arguments are containers?
Alternatively, how can i make different specialisations for class/function depending on whether its argument is container or not?

A: Testing for a full blown container is difficult and ambiguous.  Personally, I consider something a container if and only if it owns its immediate contents, but this may not line up with other people's use of the term.
Testing for iterability is neither difficult nor ambiguous, and is often what you want to test for when taking an object in a function argument.  There are iterable things that aren't very container like (C++1y's or C++1z's string_view, as an example).
In my opinion, in C++11, an instance c of a type X is iterable iff:
for( auto&& a : c ) {}

is well formed.  The wording chosen for the above means that you can extend any type with begin and end free function overloads to make it iterable.
A decent approximation if the above will work would be to test if, in an argument dependent enabled lookup context, that std::begin and std::end return something that has a valid std::iterator_traits<>.
As a quick sketch, I get something like this:
template<typename T, typename=void>
struct is_iterable : std::false_type {};

namespace aux {
  using std::begin;
  // note: no implementation
  template<typename C>
  auto adl_begin( C&& c )->decltype( begin( std::forward<C>(c) ) );
  using std::end;
  // note: no implementation
  template<typename C>
  auto adl_end( C&& c )->decltype( end( std::forward<C>(c) ) );
}
template<typename T>
struct is_iterable<T,
  typename std::enable_if<
    std::is_same<
      typename std::iterator_traits< typename std::decay<decltype( aux::adl_begin( std::declval<T>() ) )>::type >::iterator_category,
      typename std::iterator_traits< typename std::decay<decltype( aux::adl_end( std::declval<T>() ) )>::type >::iterator_category
    >::value
  >::type
> : std::true_type {};

Live example
Containers, meanwhile, rarely are as uniform.  Their most basic "common" processes, like adding elements, differ from one to another in ways that differ in signature and semantics.  erase(iterator) and ::allocator_type are the two most common features of container-like structures, but a std::array<T,N> and T[N] are arguably containers and have neither property.
In short, beyond their common property of iterability, containers differ too much for there to be a highly useful is_container<C> traits class.  Instead, you should work out what properties of the container you are looking for (ability to delete elements?  Ability to insert elements?  Random access?) and test for those instead.

A: Another way is to use boost::spirit::traits::is_container<>

Returns mpl::true_ if T has the following embedded types defined: value_type, iterator, size_type, and reference. Otherwise it will return mpl::false_.

Works in C++03 and above.


text:
Q: Poorly Formatted Hard Drive: cannot install XCode/C++? Background
Using a refurbished Macbook.  I need to update my current version of C++ - currently using /usr/include/c++/4.2.1.  I understand the easiest way to update is to simply download the latest version of XCode (currently not downloaded).
When I try and install from the App Store, I get:

My drive is formatted as shown below:
 MacBook-Pro: pwd
/

 MacBook-Pro: ls
Applications              Users                     dev                       net                       tmp
Library                   Volumes                   etc                       opt                       usr
Network                   bin                       home                      private                   var
System                    cores                     installer.failurerequests sbin

 MacBook-Pro: cd Volumes

 MacBook-Pro: ls
Data OS

 MacBook-Pro: cd Data

 MacBook-Pro: ls
Applications           Library                Pictures               downloads              repos
Desktop                Movies                 calibrationResearch    iCloud Drive (Archive) screenshots
Google Drive           Music                  documents              miniconda2

Question

*

*Is there a way I can move my system and home folders (Data and OS?) to the same directory?

*If not, is there another easy way to get C++ 11?

A: try downloading from here instead of going through the store
https://developer.apple.com/download/more/
if that doesn't work install the xcode command line tools from the same link and install gcc from homebrew like the following article shows
http://www-scf.usc.edu/~csci104/20142/installation/gccmac.html


text:
Q: Artificial TCP reordering in WireShark In the process of testing a software product, the question is to test the scope of allowable share TCP reordering, which can sustain the program
Does Wireshark or other similar software Product Sheet possibility of artificial introduction TCP reordering the existing pcap-file
That is, the challenge is to introduce distortion into an existing pсap-file and specify, for example, that it is necessary to rearrange forcedly 20% or 30% of the packets in the general case N packets
Unfortunately, a search in Google gave no adequate results
Thanks in advance
=================
Expert survey showed that there is a special tool to re-sort TCP traffic in pcap-file called TcpReplay
(TcpReplay site)
Surprising that it is impossible to find in Google on any keyword about PCAP, TCP reordering, and so on, but TcpReplay does exactly what you need
=================
In fact, to solve this problem by means of network tools and failed, apparently because this problem is rare in network testing software
The result is a small utility in the language Perl, which performs predetermined resorting for TCP-packets at random; there is only one variable parameter $rand_factor, showing the percentage of the random permuted packages
In fact, the utility re-sorts Ethernet-frames, that is actually sorting touch-and UDP-packets, and service traffic, but it has no negative impact on the practice, for the ultimate goal - a random permutation for TCP-packets - properly executed
Use of health:
Artificial TCP reordering tool in Perl

A: The short answer: No
Wireshark is a tool to dissect captures; Wireshark itself has no capability to re-arrange frames.
The Wireshark suite does have some tools to randomize certain bytes of a capture files and to do things like removing duplicate frames from a capture file, but no capability to re-arrange the order of TCP PDUs.

A: I've used NEWT on Windows (google it) in the past. It doesn't permit modification of existing pcap files but there's nothing to stop you using NEWT to stress the network and then wireshark to capture the results of your test for analysis.


text:
Q: In Jason X, does his son have similar characertistics? In the horror comic book series Jason X, The iconic slasher is re-imagined as an unstoppable cyborg in the future.
My question is does Jason's genetic son, Free Jefferson have his fathers abilities? More specifically regeneration and immortality. And would Jason be able to be reborn through Jefferson as he is a a Voorhees through blood?

A: It looks like Free Jefferson has currently only shown up in one place, the tie-in novel, ''Jason X: to the Third Power''. I looked around a handful of reviews of the book and it appears that Free shows no special powers. It's also unknown whether Jason's powers would be transmitted either down his bloodline or through his genetics since it seems they are supernatural in nature, but might result from his distant ancestor, Jebediah Voorhees, who possessed a copy of the Necronomicon and passed it on to his descendants.
It is also unknown whether he counts as "part of the bloodline" for the purpose of killing Jason.


text:
Q: How can I install Bootstrap into this Vue.js project using vue-router? I have a Vue project I'm building on, following a tutorial. This project uses Vue Router and I am trying to use Bootstrap. This is the current layout:
main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

createApp(App).use(router).mount('#app')

index.js
import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'
import MovieDetail from '../views/MovieDetail.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/movie/:id',
    name: 'Movie Detail',
    component: MovieDetail
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router

I've tried changing the following in Main.js to initialise Bootstrap:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { BootstrapVue} from 'bootstrap-vue'

createApp(App).use(router, BootstrapVue).mount('#app')

I am getting the warning: ""export 'default' (reexported as 'Vue') was not found in 'vue'". What do I need to do in order to get BootStrap working?

A: You can use bootstrap by linking bootstrap css in head blocks in
'index.html' which file is located on the root directory of your project.
And make sure that 'bootstrap.min.css' file is located on the static folder

<link rel="stylesheet" href="/static/bootstrap.min.css" />


text:
Q: BigQuery : Returning timestamp from JS udf throwing "Failed to coerce output value to type TIMESTAMP" I have a bigquery code.
CREATE TEMP FUNCTION to_struct_attributes(input STRING)
RETURNS STRUCT<status_code STRING, created_time TIMESTAMP>
LANGUAGE js AS """
    let res = JSON.parse(input);
    res['created_time'] = Date(res['created_time'])
    return res;
""";

SELECT
5 AS ID,
to_struct_attributes(
    TO_JSON_STRING(
        STRUCT(
           TIMESTAMP(PARSE_TIMESTAMP('%Y%m%d%H%M%S', '20220215175959','America/Los_Angeles')) AS created_time
        )
    )
) AS ATTRIBUTES;

When I execute this, I'm getting the following error:
Failed to coerce output value "2022-02-16 01:59:59+00" to type TIMESTAMP

I feel this is quite strange, since BigQuery should be able to interpret it correctly and I haven't had this issue with any other datatypes. Also, if I do:
SELECT TIMESTAMP("2022-02-16 01:59:59+00")

It returns:
2022-02-16 01:59:59 UTC

So BigQuery can indeed parse it correctly. I'm not sure why it doesn't happen for the UDF. On searching the internet, I found this question and as the answer suggests, if I change the return statement to:
return Date(res.created_time);

It resolves the issue. But for a project of mine, doing it for every timestamp is not feasible due to the high number of struct columns.
So, I wanted to know if someone has a better alternative to it?
PS : I have removed a lot of non-essential parts from the above example, so this might look a bit abstract. Also, the actual use-case is a bit different and complex that's why I need that JS udf.

A: The best way to do what you want is to implement the following code.
return Date(res.created_time);

This happens when you pass a TIMESTAMP to a UDF, it is represented as a DATE object, as stated in the documentation. This is like a return of a TIMESTAMP from a JavaScript UDF, where you need to construct and return a DATE object.


text:
Q: Java - problems with Runtime.getRuntime().exec(command) I have a small little program, that uses exec("notepad /P print.txt") to print a text file. The problem, is that if it runs once, runs ok, but if I use while(true) or run it in a loop, the printer doesn't print - so Runtime.getRuntime().exec("notepad /P print.txt"); isn't executed (right).
Where is the problem ?
Thank you !