text:
Q: When running the app in Tab error is coming 09-15 12:58:52.038: ERROR/dalvikvm-heap(26900): 6025950-byte external allocation too large for this process.
09-15 12:58:52.038: ERROR/GraphicsJNI(26900): VM won't let us allocate 6025950 bytes
09-15 12:58:52.042: DEBUG/AndroidRuntime(26900): Shutting down VM
09-15 12:58:52.042: WARN/dalvikvm(26900): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900): FATAL EXCEPTION: main
09-15 12:58:52.062: ERROR/AndroidRuntime(26900): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.curl/com.android.curl.StandaloneExample}: android.view.InflateException: Binary XML file line #11: Error inflating class com.android.curl.PageCurlView
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.os.Looper.loop(Looper.java:123)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at java.lang.reflect.Method.invokeNative(Native Method)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at java.lang.reflect.Method.invoke(Method.java:521)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at dalvik.system.NativeStart.main(Native Method)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.android.curl.PageCurlView
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:210)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.Activity.setContentView(Activity.java:1647)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.curl.StandaloneExample.onCreate(StandaloneExample.java:26)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     ... 11 more
09-15 12:58:52.062: ERROR/AndroidRuntime(26900): Caused by: java.lang.reflect.InvocationTargetException
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.curl.PageCurlView.<init>(PageCurlView.java:258)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at java.lang.reflect.Constructor.constructNative(Native Method)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     ... 21 more
09-15 12:58:52.062: ERROR/AndroidRuntime(26900): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.Bitmap.nativeCreate(Native Method)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:590)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:564)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:425)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:448)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:474)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     at com.android.curl.PageCurlView.init(PageCurlView.java:345)
09-15 12:58:52.062: ERROR/AndroidRuntime(26900):     ... 25 more
09-15 12:58:52.073: WARN/ActivityManager(2486):   Force finishing activity com.android.curl/.StandaloneExample
09-15 12:58:52.073: WARN/ActivityManager(2486):   Force finishing activity com.android.curl/.AndroidPageCurlActivity

here is my XMl
     <?xml version="1.0" encoding="utf-8"?>
     <RelativeLayout xmlns:android="schemas.android.com/apk/res/android";
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:id="@+id/RootView">

     <com.android.curl.PageCurlView
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:id="@+id/dcgpagecurlPageCurlView1"
     android:background="@drawable/icon">
     </com.android.curl.PageCurlView>
     </RelativeLayout>

A: try to use smaller background image
android:background="@drawable/icon"

A: Increase the amount of RAM as well as the VM Max Memory Heap size in your VM options. Go to Window-->AVD Manager-->Virtual Devices--->Edit, then click Add next to the list of specs at the bottom of the AVD profile.
Hope that helps!


text:
Q: Campus Tour iPhone App I am I want to develop a Campus Map application on iPhone. I am searching for a way to figure out how to sync Current Location from Maps with my campus map. Or is there any other approach for building this app ?
Suggest some good websites/ blogs/ groups working on something similar so that I can get information.

A: CLLocationManager will let you put a pin on your map, check heading, etc.
http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
http://developer.apple.com/iphone/library/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

A: what you look for is the map overlay - check out this tutorial:
http://www.youtube.com/watch?v=eJxdCe9CNYg

redpajama_set_name: RedPajamaStackExchange


text:
Q: HQL / Postgres : ERROR: operator does not exist: timestamp with time zone + integer I am trying to familiarise myself with Hql, Postgres and JDBC queries. I have a simple query to retrieve records from a table that were modified in last week :
String query = "SELECT t.id FROM table t"
        + " WHERE CURRENT_TIMESTAMP <= t.last_modified_timestamp + 7";

but getting this exception:

nested exception is org.postgresql.util.PSQLException: ERROR: operator
does not exist: timestamp with time zone + integer

Did I miss something? I probably missed the right command to do so.


text:
Q: HTML with latex code I'm reading a HTML file, where math related stuffs are written in latex code.
It's just like:

Let A be matrix and b be a vector. Then \|Ax - b\|_2^2 <= \epsilon is
  what we need. Blah blah.

i.e. given bunch of phrases, they have latex syntaxis in the middle.
Is there any way to read this html file as a document with converted math symbol, rather than plane latex code, since it is cumbersome to interprete?


text:
Q: MongoDB C# Driver (2.7) and serialization issues I'm currently having a strange issue with the latest mongodb c# driver (2.7), inheritance and serialization.
Here is a super simplified class hierarchy that I'm using:
public abstract class BaseClass
{
    public Guid Id { get; private set; }

    protected BaseClass(Guid id)
    {
        Id = id;
    }
}

public class DerivedClass : BaseClass
{
    public DerivedClass(Guid id) : base(id) {}
}

When I try to register the class for mongo serialization, I am getting an error:
var type = typeof(DerivedClass);

if (BsonClassMap.IsClassMapRegistered(type))
    return;

var cm = new BsonClassMap(type);
cm.AutoMap();

BsonClassMap.RegisterClassMap(cm);

The error is:
The memberInfo argument must be for class DerivedClass, but was for class BaseClass.
Parameter name: memberInfo

Now, and this is where things start to get weird, when I tried to understand what was happening I made some changes to the BaseClass or the DerivedClass.
ANY of the two changes listed below will make the RegisterClassMap method work without errors...
change 1: adding a second, unused property on BaseClass
public abstract class BaseClass
{
    public Guid Id { get; private set; }
    public string Test { get; }

    protected BaseClass(Guid id)
    {
        Id = id;
    }
}

change 2: changing the Id property to have a non-private setter (any other works)
public abstract class BaseClass
{
    public Guid Id { get; protected set; }

    protected BaseClass(Guid id)
    {
        Id = id;
    }
}

My question is... what is happening? While I may agree that for the serializer you should have an accessible setter for every property on the class that you want to map (in this case, DerivedClass), why the case #1 is actually not giving any error?


text:
Q: htmlspecialchars and ampersand in forms? I have a little static function so that I can easily build html valid urls on my local website, it is below;
public static function url($path = false) {

    // Build return url with special html characters escaped
    return 'http://127.0.0.1/' . htmlspecialchars($path);
}

I have two urls one inside an anchor and another is inside a form action, they are below;
Root::url('test?category=' . $category . '&index=' . $index) // Href

Root::url('test?category=' . $_GET['category'] . '&index=' . $_GET['index']) // Form

GET === $, you can see inside my static function that I use htmlspecialchars to escape special html characters from my url.
The anchor one returns a valid link and works as expected. The form one however returns the following, as in when I click on the form submit, my url in my browser is as follows.
http://127.0.0.1/test?category=innate&index=0

Why is this? My website breaks because it is dependant on the GET parameters being valid.
Thanks for your time, hope this made sense.
EDIT
I insert the return value of the function call straight into my form action,
<form
action="<?= Root::url('test?category=' . $_GET['category'] . '&index=' . $_GET['index']); ?>"
method="post">

EDIT
The form html is as follows;
<form action="http://example.com/test?category=innate&index=0" method="post">

The anchor html is as follows
<a href="http://example.com/test?category=innate&index=0">

Could it be something to do with the server sending a POST request even though I have GET parameters?
EDIT #3
Ok so it has something to do with my function or what I am passing in, I hard typed in the url in the form submit and it worked, no problems, which means it can only be what my function is returning.
I myself cannot see what I may be!
ANSWER
After the form was being submitted, I was redirecting to the same page using header to counter form resubmission. The string for the header was being generated by Root::url().
Two hours this took me to figure out, but boy does it feel good!

A: Normally you wouldn't add a query string to a POST URL. It's not forbidden, though, it may only be somewhat confusing, especially if you use $_REQUEST (which you don't, it seems).
I don't know why your browser shows an uninterpreted &, it should interpret it.
Your problems are likely due to one of these:

*

*a bad browser - try another one

*bad content of the form input fields

*other

A: This is quite logic.
I assume your url() method looks like this:
url($string){
  echo htmlspecialchars($string);
}

Let's have a look at the $string you are passing:
'test?category=' . $_GET['category'] . '&index=' . $_GET['index'];

As I see in your output, replacing the values, the final string before htmlspecialchars() occur would be:
'test?category=innate&index=0' and after it: test?category=innate&index=0

What happened here? you first concatenated the string, and then htmlspecialchars()'ed the & used to separate the parameters. And to not break the url, you don't want to convert THAT '&'.
Also to sanitize the url you shouldn't use htmlspecialchars() because most html entities would convert to somthing like & + somename + ; for example the Euro symbol would convert to € and you don't want the actual & symbol in your url, the browsers will interpret it as you have another new parameter awaiting.
You should use urlencode(), which will convert your & into: %26 , also, the function's name is self-explanatory, it's encoding a string to use on a URL.

Still, you want the & to separate the parameters, but not in the $GET values. What should we do? to urlencode the values before concatenating the string. I would suggest a method like this one:
function url($page, $get){
    $parameters = array();
    foreach($get as $k => $v) $parameters[] = urlencode($k)."=".urlencode($v);
    //We are concatenating with ? and & the urlencoded() values in the next line:
    echo urlencode($page).'?'.implode('&', $parameters);
}

url('test', $_GET); // outputs: test?category=innate&index=0

This would get rid of the special chars from a form's field names and values.
I noticed you will use 2 fixed parameters, category and index, so the method could be like this:
function url($page, $get){
    $page = urlencode($page);
    $category = urlencode($get['category']);
    $index = urlencode($get['index']);
    echo "$page?category=$category&index=$index";
}

Hope this is what you needed


text:
Q: Magento2 - Failed Data validation at product import I try to update all my Product-images with an import via .csv. I got all the images in pub/media/import and declared them in the csv-file.
Even everything should be valid i get a error:
Data validation failed. Please fix the following errors and upload the file again.

Checked rows: 8832, checked entities: 9041, invalid rows: 0, total errors: 1

Since i cant find the error or it is not visible for me I cant resolve it...
I hope someone can help me.


text:
Q: batch read from different text files and execute cURL I am trying to automate testing a list of RESTful web services by combining Windows BATCH scripts and cURL tool. Being a newbie to BATCH scripting, I am unable to proceed after a certain point.
I have two text files.
one(URLs.properties) to store all the REST webservice URLs and other to store the corresponding input parameters(params.properties).
In essence, I want to read the URLs.properties, fetch the first WebService URL, read the params.propertiesto fetch the corresponding input parameters and call cURL for this set of data.
Currently I have the following approach:
setlocal EnableDelayedExpansion
for /F "tokens=1,2 delims==" %%I IN (URLs.properties) do (
call :fetchParams
)
:fetchParams
for /F "tokens=1,2 delims==" %%K IN (params.properties) do (
REM read the input params and call CURL for first URL
goto :callCURL
)
:callCURL

curl -L -v  -X POST -c cookies.txt -H "Content-Type: application/json %%J -d %%L -o "%%I.json"

pause

This is flawed because it executes all the input parameters for one URL before moving to the next.
But I am looking for a way that executes the cURL statement for one URL from the URLs.properties and the corresponding input from params.properties.
How can I achieve this using a Windows BATCH file?
P.S: I have read a few related questions and solutions and have tried to modify them according to my needs. But I am not able to arrive at a working solution
Thanks for the help


text:
Q: Multiple DHCP REQUESTs from the same box - with address provided Please share how to stop/block/identify the rogue device. Lease time is 1 hour. Eventually I may run out of addresses.
Attached is log data. My DHCP server provides an address to the Windows 2003 Server SARDIS2. I'm not clear on the long (16 byte) MAC address.
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: DHCP REQUEST [en0]: 1,52:41:53:20:d0:67:e5:ed:9f:2:0:0:9:0:0:0 <SARDIS2>
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: dhcpd: 192.168.1.49 lease extended to INIT/REBOOT client
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying using broadcast IP address
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying to 255.255.255.255
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: ACK sent SARDIS2 192.168.1.49 pktsize 300
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: service time 0.001959 seconds
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: DHCP REQUEST [en0]: 1,52:41:53:20:d0:67:e5:ed:9f:2:0:0:8:0:0:0 <SARDIS2>
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: dhcpd: 192.168.1.50 lease extended to INIT/REBOOT client
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying using broadcast IP address
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying to 255.255.255.255
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: ACK sent SARDIS2 192.168.1.50 pktsize 300
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: service time 0.001705 seconds
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: DHCP REQUEST [en0]: 1,52:41:53:20:d0:67:e5:ed:9f:2:0:0:7:0:0:0 <SARDIS2>
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: dhcpd: 192.168.1.51 lease extended to INIT/REBOOT client
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying using broadcast IP address
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying to 255.255.255.255
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: ACK sent SARDIS2 192.168.1.51 pktsize 300
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: service time 0.001372 seconds
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: DHCP REQUEST [en0]: 1,52:41:53:20:d0:67:e5:ed:9f:2:0:0:6:0:0:0 <SARDIS2>
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: dhcpd: 192.168.1.52 lease extended to INIT/REBOOT client
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying using broadcast IP address
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: replying to 255.255.255.255
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: ACK sent SARDIS2 192.168.1.52 pktsize 300
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: service time 0.001852 seconds
Mar 16 11:53:15 croghan.birchard.org bootpd[1700]: DHCP REQUEST [en0]: 1,52:41:53:20:d0:67:e5:ed:9f:2:0:0:5:0:0:0 <SARDIS2>

A: This is not geared to solve your long term problem, but in the short term drop your lease time to something really low. Those requests are coming in quickly.
Next step is to hop on a switch and look at arp tables for the MAC address that is making the request. Then you can identify the switch port. On some switch gear, it is: show arp or show mac-address-table
You are going to have to look it up. You can begin to interrogate your switch gear to pinpoint the offending device.


text:
Q: Stored Procedure - delete from table with joins I'm trying to learn SQL and I've run into a problem with stored procedures. I've got a tables structure like in the picture, where Repair.RepairerId and Repair.CarId are foreign keys for the appropriate tables.

What I need to do is to create a stored procedure that allows a user to delete entities from table Repair where user can select the car model and the repairer name in Microsoft SQL Server 2017.
For now I have the next code:
CREATE PROCEDURE [dbo].[DeleteRepairInfo]
    @Name nvarchar(MAX),
    @Model nvarchar(MAX)
AS
    DELETE Repair.*
    FROM Repair INNER JOIN Repairer ON Repair.RepairerId = Repairer.Id
                INNER JOIN Car ON Repair.CarId = Car.Id
    WHERE Car.Model LIKE @Model AND Repairer.Name LIKE @Name
GO

However SQL Editor in Visual Studio 2017 gives me the error:

SQL46010: Incorrect syntax near ..

Also all the INNER JOIN statements and their = signs are greyed out as well as words LIKE, AND, and the final LIKE. (I'm not sure if this is okay).
You can see this on the next picture:

A: I would write the logic as:
CREATE PROCEDURE [dbo].[DeleteRepairInfo] (
    @Name nvarchar(MAX),
    @Model nvarchar(MAX)
) AS
BEGIN
    DELETE r
    FROM Repair r INNER JOIN
         Repairer rr
         ON r.RepairerId = rr.Id INNER JOIN
         Car c
         ON r.CarId = c.Id
    WHERE c.Model LIKE @Model AND rr.Name LIKE @Name;
END;  -- DeleteRepairInfo

The issues with your query is the syntax Repair.*.  That is not valid.  Note some other things:

*

*This introduces table aliases so the query is easier to write and to read.

*The body of the stored procedure is surrounded by BEGIN/END so it is easy to see.

*The END is commented with the name of the stored procedure.

*The arguments are surrounded by parentheses.

These are all "optional".  But writing clear code is a good habit to learn.

A: How are you?
I think the problem is that you're not using the DELETE properly
The follow example will help you!
CREATE PROCEDURE [dbo].[DeleteRepairInfo]
    @Name nvarchar(MAX),
    @Model nvarchar(MAX)
AS
    DELETE FROM Repair as R
    WHERE R.CarId in (select CarId from Car where Model = @Model)
    and R.RepairerId in (select RepairerId from Repairer where Name = @Name)
GO

Assuming that you can have more than 1 car with the same model and more than one repairer with the same name!
Good luck :)


text:
Q: Countdown timer to Countup Hello guys i have this countdown script but i want it to countup and instead of updating a div span, update the value of a progress bar.
HTML
<progress value="**UPDATE THIS**" max="780"></progress>

SCRIPT
var sec = $('#update span').text(), secInit = sec;
        var timer = setInterval(function() {
            $('#update span').text(--sec);
            if (sec == 0) {
                sec = secInit;
                $.ajax({
                    url: "{{ url('/user/update') }}",
                    type: "GET",
                    data: { 'id' : {{ Auth::user()->id }} }
                });
            }
        }, 1000);

Any idea?
Thanks,
Tiago

A: Give the progress bar an ID such as
<progress id="progress-bar" value="**UPDATE THIS**" max="780"></progress>

and use some javascript to change the value each second, eg.
var timer = setInterval(function() {
            var progbar = document.getElementById("progress-bar");
            progbar.value = progbar.value < 780 ? +progbar.value + 1 : 0;
        }, 1000);

Fiddle


text:
Q: Ring around wire on diagram If this is a repeated question, please let me know.  I'm a hobbyist electronics person, and ran across symbols on a diagram I didn't recognize.  I've attached the image below:

What I'm trying to figure out is what the different rings around the wires mean.  For example, Earphone Pilot has a connection that shows a ring around one of the wires, and then that hits a T connection where all of them have rings around the wires, too.  I've been trying to look it up, but I'm having a really hard time finding info.  The full diagram is part of the wiring diagram for a Becker Avionics AR620X transceiver, and the diagram is on page 77 of the PDF here.

A: Felthry is correct. Normally this would be either small gauge coax cable or shielded hookup wire. Note that the shields are connected to various terminals, jacks, etc. The shield is not just 'floating' and surrounding the central wire. The note regarding isolation is to prevent noise from getting into the system from the airframe. An example is:
https://www.mouser.com/ProductDetail/Alpha-Wire/1703-SL005?qs=%252bd%252bj5ZauFZ%252bci10Syv%252bbmA%3D%3D

A: That's shielded wire. The ring around it is the outer shield around the cable linking the two parts together. The shield also provides the low side of the signal, so it needs to be connected to the ICs as well; it's the other half of the complete circuit. That T connection you mention is just showing that the shields for all the wires are connected together.


text:
Q: How can i export this android application to aar library I want to use FFmpegRecordActivity from Nativescript.
For that I have to export application to aar library and call FFmpegRecordActivity class from javascript via Intent.
I did that part editing build.gradle It worked.
But after FFmpegRecordActivity is displayed it breaks with this error.
java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at org.bytedeco.javacpp.Loader.load(Loader.java:413)
at org.bytedeco.javacpp.Loader.load(Loader.java:381)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1650)

It seems not nativescript problem. Because same thing happened when i import aar from another android studio application.
camera, external storage permissions are given and on for application

I did the trick from https://github.com/bytedeco/javacv/issues/133 : moved *.so files to "app/src/main/jniLibs/armeabi-v7a" and "app/src/main/jniLibs/armeabi" folders and it seems not working

A: Root problem was the library i was using was sdk22.
https://github.com/CrazyOrr/FFmpegRecorder/issues/5
But answer for the question is have to manually copy *.so files
https://github.com/bytedeco/javacpp-presets/issues/303
Does nativescript supports .so file in android platform?


text:
Q: What manifolds are boundaries of euclidian spaces ? I would like to know if there are compact (n-1)-manifolds $N$ that are not spheres but such that there is a manifold with boundary $M$ which satisfies the following two properties:

*

*$\partial M\cong N$

*$M-\partial M\cong \mathbb{R}^n$
I am primarily interested in this question in the category of smooth manifolds but I would be interested to know the answer in the topological case as well.

A: $N$ has to be a homotopy-sphere. So as long as it's dimension isn't $4$, there's a proof that it has to be the standard $S^{n-1}$.
These arguments appear in the Kosinski book on smooth manifolds.  The basic idea goes like this.
1) $N$ is simply connected.  There's the inclusion map $N \to M$, but if $p \in int(M)$ then there's also a retraction map $M \setminus \{p\} \to N$.  Provided $n \geq 3$ removal of a point does not affect the fundamental group.
2) $N$ is a homology sphere by Alexander/Poincare duality of the pair $(M,N)$.   Part (1) technically gives us this as well but this argument works even if $M$ is not contractible.
So by the Whitehead theorem, $N$ is a homotopy sphere.  Moreover, $M$ is a contractible manifold whose boundary is a homotopy sphere.  So $M$ is a disc by the h-cobordism theorem, and the disc has a unique smooth structure (not known in dimension $5$ still).
So that resolves all cases except $dim(N)=4$.

A: The answer is in fact given in the question Misha links to in his comment. For completeness, I wanted to give the details in a comment, but that became too long, so I turned it into this answer. The idea is the same as in Ryan Budney's answer, but the arguments are a bit more detailed and direct. I do apologize for the repetition. Please upvote Misha's comment, the answer he links to, and Ryan Budney's answer.$\newcommand{\RR}{\mathbb{R}}
\newcommand{\int}{\operatorname{int}}$
Edit: I have slightly refined the argument below so that it goes through when the interior of the smooth manifold $M$ is only homeomorphic to $\RR^{n+1}$, not necessarily diffeomorphic. By the way, this weaker assumption makes no difference when $n\neq 3$, as the uniqueness (up to diffeomorphism) of differentiable structures on $\RR^{n+1}$ implies that the interior of $M$ is then actually diffeomorphic to $\RR^{n+1}$. So the easier, more elementary argument below assuming the interior of $M$ is diffeomorphic to $\RR^{n+1}$ is enough when $n\neq 3$.
The final answer is: if a compact smooth manifold $M$ has interior homeomorphic to $\RR^{n+1}$, then its boundary $\partial M$ is diffeomorphic to $S^n$, as long as $n>4$. In dimension $n=4$, we get only a homeomorphism between the boundary and $S^n$ by using Freedman's h-cobordism theorem instead of the smooth h-cobordism theorem in the argument below. We still get a diffeomorphism in dimension $n=3$, by the recently proved original Poincaré conjecture.
The argument goes as follows. It is simpler when the interior is actually diffeomorphic to $\RR^{n+1}$, so let us assume that at first. Let $M$ be a compact smooth manifold with interior diffeomorphic to $\RR^{n+1}$. Then removing the interior of the closed unit disc $D$ from $\RR^{n+1}$ (which we identify with the interior of $M$), we get a smooth cobordism $N=M\setminus(\int D)$ between $\partial M$ and $\partial D=S^n$ (the boundary of the removed disc).
On the one hand, the inclusion of $\partial D=S^n$ into $N$ is a homotopy equivalence, as $N$ is actually homotopy equivalent to $N\setminus \partial M=\RR^{n+1}\setminus(\int D)$ (since $\partial M$ has a collaring in $M$ and thus in $N$).
On the other hand, the inclusion of $\partial M$ into $N$ is also a homotopy equivalence. Again, note that $\partial M$ has a collar in $N$, and the complement of this collar is compact in the interior of $M$, i.e. in $\RR^{n+1}$. So by pushing off to infinity radially within $\RR^{n+1}\setminus(\int D)$ (via a suitable homotopy with bounded support starting at the identity of $\RR^{n+1}\setminus(\int D)$), we obtain a deformation of $N$ into the collar of $\partial M$ which fixes $\partial M$ pointwise. Then the collar of $\partial M$ deformation retracts onto $\partial M$, and these two deformations together give a deformation retraction of $N$ onto $\partial M$.
To modify the above argument when the interior of $M$ is only homeomorphic to $\RR^{n+1}$ via a homeomorphism $\varphi:\int M \to \RR^{n+1}$, make the following changes:

*

*$N=M\setminus(\int D)$ is now defined to be $M$ minus the interior of a closed disc $D$ smoothly embedded in the interior of $M$. So $N$ is still a smooth cobordism between $\partial M$ and $\partial D$.

*Importantly, note that the image $\varphi(\partial D)$ need not be a standard sphere in $\RR^{n+1}$. However, $\varphi(\partial D)$ is locally flat in $\RR^{n+1}$ (since $\partial D$ is locally flat in $\int M$), so the Shoenflies theorem implies that it is taken to a standard sphere in $\RR^{n+1}$ via some homeomorphism of $\RR^{n+1}$. By modifying $\varphi$, we can then assume that $\varphi(\partial D)$ is the standard sphere $S^n\subset \RR^{n+1}$.

*Since $\varphi(\partial D)=S^n$ is now the standard sphere in $\RR^{n+1}$, we can apply, essentially unchanged, the above two arguments showing that the inclusions of $\partial M$ and $\partial D$ into $N$ are deformation retracts.
In conclusion, $N$ is a smooth h-cobordism between $\partial M$ and $\partial D$, where $\partial D$ is diffeomorphic to the standard sphere $S^n$. Since $S^n$ is simply connected, the h-cobordism theorem implies that $\partial M$ is diffeomorphic to $S^n$ when $n>4$.
As stated earlier, in dimension $n=4$, we only get a homeomorphism between $\partial M$ and $S^n$ by Freedman's h-cobordism theorem. In dimension $n=3$ we can use the Poincaré conjecture in dimension 3 (recently proved) to conclude that $\partial M$ is diffeomorphic to $S^3$, since those manifolds are homotopy equivalent to $N$ and thus to each other. In dimensions $n<3$, the classification of closed $2$-manifolds and $1$-manifolds shows we get a diffeomorphism again.
Finally, note that the elementary argument above (before the modification requiring Schoenflies theorem) showing that $N$ is a h-cobordism between $\partial M$ and $\partial D$ holds equally well for a compact topological manifold $M$ whose interior is homeomorphic to $\RR^{n+1}$. Then $\partial M\simeq N\simeq \partial D\cong S^n$. Since the Poincaré conjecture holds topologically in all dimensions, we conclude that the boundary of $M$ is homeomorphic to $S^n$.


text:
Q: How to combine two queries? I need to combine the two following queries...
SELECT     Products.ProductId, Products.ProductDescription, SUM(Inventory.QuantityOutstanding) AS Inventory, Products.AverageCost AS Cost

FROM         Products INNER JOIN
                  Inventory ON Products.Product = Inventory.Product
WHERE    (Inventory > 0) AND (Products.ProductId LIKE 'CAS%') OR
                  (Products.ProductId LIKE 'ASY%')
GROUP BY Products.ProductId, Products.ProductDescription, Products.AverageCost
ORDER BY Products.ProductId

Which gives a table like...
ProductID    ProductDescription    Inventory    Cost
-------------------------------------------------------
   AB            CD                  0???       0
   UV            XY                    5        555
   .             .                     .         .
   .             .                     .         .
   .             .                     .         .

And
SELECT Components.ProductId, SUM(SalesOrderItems.QuantityOutstanding) AS Schedule

FROM Structures INNER JOIN
Products AS Components ON  Structures.Component = Components.Product INNER JOIN
Products AS Products ON Products.Product = Structures.Product AND
Structures.StructureVersion = Products.StructureVersion LEFT OUTER JOIN
SalesOrders INNER JOIN
SalesOrderItems ON SalesOrders.SalesOrder = SalesOrderItems.SalesOrder ON
Products.Product = SalesOrderItems.Product

WHERE      ((Components.ProductId LIKE 'CAS%') OR (Components.ProductId LIKE 'ASY%')) AND (SalesOrderItems.DueDate < DATEADD(m, 3, GETDATE())) AND (SalesOrderItems.QuantityOutstanding > 0)
GROUP BY Components.ProductId, Products.ProductId
ORDER BY Components.ProductId

Which gives a table like...
ProductId      Schedule
-------------------------
  AB             360
  UV             3
   .             .
   .             .
   .             .

I basically want to have a table that displays the ProductId, (Inventory - Schedule) AS XSStock, and Cost like this...
ProductId    XSStock (>0 only)    Cost
-------------------------------------------
   UV             2                222
   .              .                 .
   .              .                 .
   .              .                 .

I thought this may be UNION or a subquery but I can't seem to make either work?
I have only begun to use SQL recently so if you could explain your response that would be great!
KATIA EDIT QUERY:
SELECT ProductId, ProductDescription, Inventory, Cost, SUM(Orders) AS Demand, (Inventory - SUM(Orders)) AS XSStock

FROM (SELECT X.ProductId, X.ProductDescription, X.Inventory, X.Cost, SUM(Y.Schedule) AS Orders

    FROM (SELECT     Products.ProductId, Products.ProductDescription, SUM(Inventory.QuantityOutstanding) AS Inventory, Products.AverageCost AS Cost

        FROM         Products INNER JOIN
                            Inventory ON Products.Product = Inventory.Product
        WHERE     (Products.ProductId LIKE 'CAS%') OR
                            (Products.ProductId LIKE 'ASY%')
        GROUP BY Products.ProductId, Products.ProductDescription, Products.AverageCost) AS X,

    (SELECT Components.ProductId, SUM(SalesOrderItems.QuantityOutstanding) AS Schedule

        FROM Structures INNER JOIN
        Products AS Components ON  Structures.Component = Components.Product INNER JOIN
        Products AS Products ON Products.Product = Structures.Product AND
        Structures.StructureVersion = Products.StructureVersion LEFT OUTER JOIN
                SalesOrders INNER JOIN
        SalesOrderItems ON SalesOrders.SalesOrder = SalesOrderItems.SalesOrder ON
        Products.Product = SalesOrderItems.Product

    WHERE      ((Components.ProductId LIKE 'CAS%') OR (Components.ProductId LIKE 'ASY%')) AND (SalesOrderItems.DueDate < DATEADD(m, 3, GETDATE())) AND (SalesOrderItems.QuantityOutstanding > 0)
    GROUP BY Components.ProductId, Products.ProductId) AS Y

WHERE (Y.ProductId LIKE X.ProductId)
GROUP BY X.ProductId, X.ProductDescription, X.Inventory, X.Cost)

WHERE ((Inventory - SUM(Orders)) > 0)
GROUP BY ProductId, ProductDescription, Inventory, Cost

ORDER BY ProductId

I am now getting error message...
Incorrect syntax near the keyword 'WHERE'

This is in line 30, but I don't know why?

A: Also you can try to aliasing both query and Selecting them in the select query
SELECT x.a, y.b FROM (SELECT * from a) as x, (SELECT * FROM b) as y

A: To fix  Inventory = 0 you just need to add brackets here:
`(Inventory > 0) AND *((Products.ProductId LIKE 'CAS%') OR (Products.ProductId LIKE 'ASY%'))`

About query: why don't you want to make selection from Products and join everything there? You have ProductsId in all tables. I tried to combine it into one, maybe it will help you:
SELECT     Products.ProductId, Products.ProductDescription, SUM(Inventory.QuantityOutstanding) AS Inventory, Products.AverageCost AS Cost
 SUM(SalesOrderItems.QuantityOutstanding) AS Schedule
from Products

inner join Inventory ON Products.Product = Inventory.Product
inner join structures AS Components ON  Structures.Component = Products.Product INNER JOIN
inner join structurs as structures.Product = Product.Product and
Structures.StructureVersion = Products.StructureVersion
LEFT OUTER JOIN
SalesOrders INNER JOIN SalesOrderItems ON SalesOrders.SalesOrder = SalesOrderItems.SalesOrder ON
Products.Product = SalesOrderItems.Product
WHERE    (Inventory > 0) AND ((Products.ProductId LIKE 'CAS%') OR (Products.ProductId LIKE 'ASY%'))
and  ((Products.ProductId LIKE 'CAS%') OR (Products.ProductId LIKE 'ASY%'))
AND (SalesOrderItems.DueDate < DATEADD(m, 3, GETDATE())) AND (SalesOrderItems.QuantityOutstanding > 0)

GROUP BY Products.ProductId, Products.ProductDescription, Products.AverageCost
ORDER BY Products.ProductId


text:
Q: Parameter elem of the linking function I've got the following directive:
.directive('confirmOnExit', function () {
    return {link: function ($scope, elem, attrs) {
            window.onbeforeunload = function () {
                if ($scope.contextForm.$dirty) {
                    return "Unsaved data detected.";
                }
            }
        }
    };
})

As you can see, the directive is not really well written as it directly references the form contextForm.
What I wanted to do is something a bit more generic (so I could also use it on other forms):
.directive('confirmOnExit', function ($window) {
    return {link: function ($scope, elem, attrs) {
            // Make sure code is only executed if directive is place on a form
            // Should I even do this here??
            if (elem[0].tagName == "FORM") {
                var form = elem[0];
                $window.onbeforeunload = function () {
                if (form.className.indexOf("ng-dirty") > -1) {
                    return "Unsaved data detected.";
                }
            }
        }
    };
})

You'll notice that the code is still pretty ugly since form.hasClass("ng-dirty") or form.$dirty() didn't work... I also think that accessing elem[0] is not correct...
I'd really appreciate some help!
Thanks!!

A: You should rely on FormController ( http://docs.angularjs.org/api/ng.directive:form.FormController )
So what you can do:

*

*Add "require: '^ngForm'" to request form controller as parameter to you linking function

*Add another parameter to your linking function (kind of formCtrl)

*use formCtrl.$dirty
If it is not clear for you, create plunker example with directive and I'll try to make these changes on it.

A: From the AngularJS form doc:

If name attribute is specified, the form controller is published onto
  the current scope under this name.

So you can access that controller by using $eval on the name attribute:
.directive('confirmOnExit', function () {
    return {
        link: function ($scope, elem, attrs) {
            var formCtrl = $scope.$eval(attrs.name);
            window.onbeforeunload = function () {
                if (formCtrl.$dirty) {
                    return "Unsaved data detected.";
                }
            }
        }
    };
});


text:
Q: replace a string with an hyperlink in a file Word powershell i want to replace a string with an hyperlink
i try with something like this
Update:
$FindText = "[E-mail]"
$email ="asdadasd@asdada.com"
$a=$objSelection.Find.Execute($FindText)
$newaddress = $objSelection.Hyperlinks.Add($objSelection.Range,$email) )

but this insert the email at beginnig of file word don't replace the string "[E-mail]"

A: Add-Type -AssemblyName "Microsoft.Office.Interop.Word"
$wdunits = "Microsoft.Office.Interop.Word.wdunits" -as [type]
$objWord = New-Object -ComObject Word.Application
$objWord.Visible = $false
$findText = "[E-mail]"
$emailAddress = "someemail@example.com"
$mailTo = "mailto:"+$emailAddress
$objDoc = $objWord.Documents.Open("Path\to\input.docx")
$saveAs = "Path\to\output.docx")
$range = $objDoc.Content
$null = $range.movestart($wdunits::wdword,$range.start)
$objSelection = $objWord.Selection
$matchCase = $false
$matchWholeWord = $true
$matchWildcards = $false
$matchSoundsLike = $false
$matchAllWordForms = $false
$forward = $true
$wrap = 1
$format = $False
$wdReplaceNone = 0
$wdFindContinue = 1
$wdReplaceAll = 2

$wordFound = $range.find.execute($findText,$matchCase,$matchWholeWord,$matchWildCards,$matchSoundsLike,$matchAllWordForms,$forward,$wrap)

if($wordFound)
{
    if ($range.style.namelocal -eq "normal")
    {
        $null = $objDoc.Hyperlinks.Add($range,$mailTo,$null,$null,$emailAddress)
    }
}

$objDoc.SaveAs($saveAs)
$objDoc.Close()
$objWord.Quit()
Remove-Variable -Name objWord
[gc]::Collect()
[gc]::WaitForPendingFinalizers()

Kinda ugly, but this script will do what you need. It loads the .docx specified with $objDoc, finds all instances of $findText, and replaces it with a mailto link for $emailAddress and then saves the changes to $saveAs.
Most of this based on a "Hey, Scripting Guy" Article


text:
Q: Show that the subsets of the plane are open I know that this set is open but I just don't know how to prove it.
$A = \{(x,y) | -1< x <1, -1< y <1\}$
I looked at all the problems in my book but it only had problems like $B = \{(x,y)|y>0\}$ that involves only one variable?

A: Hint: Write down the basis for product topology on $\mathbb{R}\times\mathbb{R}$.
In general, a basic open set for product space $X\times Y$ is of the form $U\times V$, where $U$ open in $X$ and $V$ open in $Y$.

A: Let $(x,y)\in A$. Then let $d=\text{min}\{1-x, x+1, 1-y, y+1\}$.
The shortest distance from a point in $A$ to the boundary of $A$ will be one of the orthogonal projections from the point onto the lines $x=\pm 1, y=\pm 1$. So the distance from $(x,y)$ to the boundary of $A$ is $d$. (Why?)
So $B_d((x,y)) \subset A$.


text:
Q: tar and if-statement I have a script that check if a file exist inside a tar file but something's wrong because it always go to the else part of the script. I am pretty sure that it shouldn't be that way.
The date is in "Mon dd" format (Jan 11).
echo "enter date: \c"
read date
tarfile=`tar -tvf tarfile.tar | grep some_file | grep "$date"`

if [ -f "$tarfile" ]; then
    echo "yes"
    else
    echo "no"
fi

A: You're checking if the file exists by using -f, but that's not what you want to do. The file exists in the tar file, but -f has no way of reading inside tar archives by itself. For example, if your file is at "foo/bar" inside the tar file, it will look for "foo/bar" relative your current directory, which doesn't exist.
The better way is to just check the exit status of grep, instead of trying to parse the output.
printf 'enter date: '
read date
if tar -tvf tarfile.tar | grep some_file | grep -q "$date"; then
    echo yes
else
    echo no
fi


text:
Q: Getting Error while using razorpay in file Whenever I do
const Razorpay = require('razorpay');
There's an error coming up in node_modules/razorpay during running the server
node_modules\request-promise-core\configure\request2.js:34
var originalInit = options.request.Request.prototype.init;
^
TypeError: Cannot read property 'prototype' of undefined
at module.exports (node_modules\request-promise-core\configure\request2.js:34:48)
at Object. (node_modules\request-promise\lib\rp.js:28:1)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (node_modules\razorpay\dist\api.js:7:15)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (node_modules\razorpay\dist\razorpay.js:7:11)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)


text:
Q: What is preventing my code from getting the JSON? I'm trying to attach ajax data to my $scope object with Angular JS using the Angular JS http service so I can add a success handler to update my $scope and view when the data arrives. In a previous post, the solution I was given for this was a modification of my original code. This is the solution I was given was:
function getStuff(num) {
$http.jsonp('http://whateverorigin.org/get?url=' + encodeURIComponent('http://www.mysite.com/api' + num) + '&callback=JSON_CALLBACK')
    .success(function (contents) {
        alert(contents); //I just want to check and see if the contents arrived
        $scope.shows = contents;
    });
};
getStuff(6387);

For some reason, it's not doing anything and I've injected it into my controller too. What am I missing?


text:
Q: How to get all checked items from a ListView? I've a couple of question I haven't been able to figure out.
I'm trying to get all the checked elements from a ListView but:

*

*If I check and then uncheck an element, it's returned as "checked" by the getCheckedItemPositions() function

*I don't know how can I iterate through this:
SparseBooleanArray checked = list.getCheckedItemPositions();

A: The other answers using SparseBooleanArray are nearly correct, but they are missing one important thing: SparseBooleanArray.size() will sometimes only return the count of true values. A correct implementation that iterates over all the items of the list is:
SparseBooleanArray checked = list.getCheckedItemPositions();

for (int i = 0; i < list.getAdapter().getCount(); i++) {
    if (checked.get(i)) {
        // Do something
    }
}

A: Jarett's answer is great, but this should be a bit faster, since it's only checking the elements in the sparse array that are present in the underlying array (only those can be true):
SparseBooleanArray checkedItemPositions = listView.getCheckedItemPositions();
    final int checkedItemCount = checkedItemPositions.size();
    for (int i = 0; i < checkedItemCount; i++) {
        int key = checkedItemPositions.keyAt(i);
        if (checkedItemPositions.get(key)) {
            doSomething(key);
        } else {
            // item was in the sparse array, but not checked.
        }
    }

Pro tip: look at the source of SparseBooleanArray, it's a pretty simple class:
http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/util/SparseBooleanArray.java/?v=source

A: You can iterate through the SparseBooleanArray using a for loop and the SparseBooleanArray's size() and get(index) methods.
EDIT 3/2/2014: People have pointed out that SparseBooleanArray's size() method returns the number of checked values, rather than the true length of the array, so I have mended my answer to account for that. Essentially it is the same, except that rather than iterating for the length of the array, we iterate until we have found all checked items. Since we only care about the number of checked items, it's irrelevant that with this method, we may not actually get to the end of the array (we won't see anything past the last checked item).
SparseBooleanArray checked = list.getCheckedItemPositions();

int numChecked = checked.size();

for (int i = 0; numChecked > 0; i++){
    if (checked.get(i)){
        //the item at index i is checked, do something
        numChecked--; //We found a checked item, so decrement the number of checked items remaining
    }
    else
        //the item is not checked, do something else
}

A: My brain didn't like looping through the SparseBooleanArray and I didn't need a custom adapter, so the following was a little more intuitive for me:

*

*Don't forget to use CHOICE_MODE_MULTIPLE in onCreate():
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

*Use the following method to get an ArrayList of them:
// This example is to get an ArrayList of names (Strings)
protected ArrayList<String> getNames() {
    ArrayList<String> names = new ArrayList<String>();

    for (int i = 0; i < getListView().getCount(); i++) {
        if (getListView().isItemChecked(i)) {
            // Do whatever you need to in here to get data from
            // the item at index i in the ListView
            names.add(mUsers.get(i).getName());
        }
    }

    return names;
}

A:  final long[] checkedIds = lv.getCheckItemIds();
            for (int i = 0; i < checkedIds.length; i++) {
                Log.d("checkedIds", "id checked: " + checkedIds[i]);
            }

A: I solved my case with this:
public class MyAdapter extends BaseAdapter{
    public HashMap<String,String> checked = new HashMap<String,String>();
....
    public void setCheckedItem(int item) {

        if (checked.containsKey(String.valueOf(item))){
            checked.remove(String.valueOf(item));
        }

        else {
            checked.put(String.valueOf(item), String.valueOf(item));
        }
    }
        public HashMap<String, String> getCheckedItems(){
        return checked;
    }
}

To set an element is checked:
public class FileBrowser extends Activity implements OnClickListener{
private ListView list;

    ...
    list.setOnItemClickListener(new OnItemClickListener(){

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int item,
                long id) {

                        BrowserAdapter bla = (BrowserAdapter) parent.getAdapter();
                        bla.setCheckedItem(item);
                    }
    });

Then to get the checked items from outside the class..
MyAdapter bAdapter;
Iterator<String> it = bAdapter.getCheckedItems().values().iterator();
                    for (int i=0;i<bAdapter.getCheckedItems().size();i++){
                        //Do whatever
                        bAdapter.getItem(Integer.parseInt(it.next());
                    }

Hope it can help someone.

A: Just saw the question and I was facing the same problem.
There is a simpler solution using SparseBooleanArray to exactly count how many items are checked.
This is my onClick procedure:
@Override
public void onClick(View v) {
switch(v.getId()) {
  case R.id.button:
    SparseBooleanArray a = listView.getCheckedItemPositions();
    if(checked(vArray)>0) {
            String vCheckedList = "";
            for (int i = 0; i < nLength; i++) {
                if (a.valueAt(i) && i < nLength-1 && a.size()>1)
                    vCheckedList += listView.getAdapter().getItem(vArray.keyAt(i))+"\n";
                else if (a.valueAt(i))
                    vCheckedList += listView.getAdapter().getItem(vArray.keyAt(i));
            }
            Toast.makeText(getApplicationContext(), vCheckedList+ " is checked", Toast.LENGTH_SHORT).show();
            a.clear();
        } else
            Toast.makeText(getApplicationContext(), "No Item is Selected", Toast.LENGTH_SHORT).show();
        break;
    default:
        break;
        }
}

The checked method:
private int checked(SparseBooleanArray vArray) {
    int vCounter = 0;
    for(int i=0;i<vArray.size(); i++)
        if(vArray.valueAt(i))
            vCounter++;
    return vCounter;

}

It will solve both problem of the checked items.

A: I had the same problem and here is my solution with SparseBooleanArray :
SparseBooleanArray checkedPositions = lv.getCheckedItemPositions ();
int size = checkedPositions.size ();
for (int i=0 ; i<size ; i++) {
     // We get the key stored at the index 'i'
     int key = checkedPositions.keyAt (i);
     // We get the boolean value with the key
     Log.i (Tag, "checkedPositions(" + key + ")=" + checkedPositions.get (key));
}

A: In it's entirety this is the solution I used.
Where pos is the Recyclerview item position
SparseBooleanArray selected = new SparseBooleanArray();

//OnClick listener here or whatever you use to check or uncheck an item
if (selected.get(pos, false)) {
        selected.delete(pos);
    } else {
        selected.put(pos, true);
    }

selected.size() will reveal how many items are selected
selected.get(pos) will return true if it's selected
The following as has been stated, iterates over all those items which were selected:
for (int i = 0; i < list.getAdapter().getCount(); i++) {
    if (selected.get(pos)) {
        // Do stuff
    }
}

A: Here is how I get checked items from recyclerview adapter
fun getAllCheckedItems(outList){
         for (position in spareBooleanArray.keyIterator()) {
            outList.add(mList.get(position)
        }
}


text:
Q: Connection String Authentication Change I changed My Authentication mode to SQL authentication to windows authentication
so this error occurred.
System.ComponentModel.win32Exception:no process on the other end of the pipe
At This Line:tblUser
logedInUser = _dbRepository.GetEntities().FirstOrDefault(m => m.UserName == model.UserName && m.Password == model.Password);

this is my connection string:
connectionString="metadata=res://*/DB.TransportMSDB.csdl|res://*/DB.TransportMSDB.ssdl|res://*/DB.TransportMSDB.msl;provider=System.Data.SqlClient;provider connection string="data source=DESKTOP-DB5NQJ7\RIDDHISH;initial catalog=TMS;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"

And I also enabled pipe, TCP/Ip protocol

A: Please update connection string in edmx (app.config) file and web.config file.


text:
Q: Symfony 3 - Forms - Persist Entity - Choices are NULL I'm new to Symfony and cannot easily find Symfony 3 answers to my question.
Problem :
I have a basic form setup which populates select boxes with basic id+name Entity values (Country, Company, Partner, etc.)
All the select boxes are correctly populated from the DB.
However when I try saving the populated form, all the "choices" are returned as null.
Question :
What am i missing to make sure the selected values in the selectboxes are sent through to the INSERT statement ?
Note : I have looked at the Form documentation but that didn't seem to cover this scenario.
Form :

Result on Submit :

Controller excerpt :
/**
 * @Route("/opportunity/add", name="add_opportunity")
 */
public function addAction(Request $request)
{
    $em = $this->getDoctrine()->getManager();

    $opportunity = new Opportunity();
    $form = $this->createForm(OpportunityType::class, $opportunity);

    $form->handleRequest($request);
    if ($form->isSubmitted() && $form->isValid()) {

        $em->persist($opportunity);
        $em->flush();

        return $this->redirectToRoute('/opportunity/add');
    }

    return $this->render(
        'opportunity/add-opportunity.html.twig',
        array('form' => $form->createView())
    );
}

Build Form from OpportunityType :
public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('name', TextType::class)

        ->add('countries', EntityType::class, array(
            'class' => 'AppBundle:Country',
            'choice_label' => 'name'
        ))

        ->add('partners', EntityType::class, array(
            'class' => 'AppBundle:Partner',
            'choice_label' => 'name'
        ))

        ->add('companies', EntityType::class, array(
            'class' => 'AppBundle:Company',
            'choice_label' => 'name'
        ))

        ->add('users', EntityType::class, array(
            'class' => 'AppBundle:User',
            'choice_label' => 'name'
        ))

        ->add('stages', EntityType::class, array(
            'class' => 'AppBundle:Stage',
            'choice_label' => 'name'
        ))

        ->add('stage_changed_date', DateType::class)
        ->add('target_close_date', DateType::class)
        ->add('contract_value', TextType::class)

    ;
}

Form twig :
{% block body %}

{{ form_start(form) }}

Add Opportunity

    {{ form_row(form.name) }}
    {{ form_row(form.countries) }}
    {{ form_row(form.partners) }}
    {{ form_row(form.companies) }}
    {{ form_row(form.users) }}
    {{ form_row(form.stages) }}
    {{ form_row(form.stage_changed_date) }}
    {{ form_row(form.target_close_date) }}
    {{ form_row(form.contract_value) }}

    <button class="btn btn-raised btn-primary" type="submit">ADD</button>
{{ form_end(form) }}

{% endblock %}

A: Yes, since in your formType, each of your field is an EntityType class, I think Symfony is waiting for an entity.
So you have to create a realtion between entity Oppotunity and its "sub fields".
If you don't want to create relation in your entity, maybe try somthing like Symfony2 Form Builder - creating an array of choices from a DB query

Edit - adding example
You can show a working example here :
https://gitlab.com/gaea44/test-form

A: Resolved, and probably not the best solution, but something which may be helpful to others.
I ended up just assigning the values as needed on the Opportunity object after Form submission before db persistence :
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

    // Get selected values for dropdowns
    $opportunity->setPartnerId($opportunity->getPartners()->getId());
    $opportunity->setCountryId($opportunity->getCountries()->getId());
    $opportunity->setCompanyId($opportunity->getCompanies()->getId());
    $opportunity->setUserId($opportunity->getUsers()->getId());
    $opportunity->setStageId($opportunity->getStages()->getId());

    $em->persist($opportunity);
    $em->flush();

    return $this->redirectToRoute('add_opportunity');
}


text:
Q: MAPI and Outlook address book I'm developing one project using VC++ (MSDEV 2008), which has one function to send EMAIL with some attachments. I used MAPI functions to achieve this task.
I build the project with project setting "Character set: use Unicode character set" for UNICODE compatible support and file type is EXE extension. Here everything works fine.
Same project I build as OCX file extension. And I can display "new send mail" window with some attachments. Here the problem is
When I click address book icon ("To" button) to select the receiver mail id from the list. It displays the Address book dialog with title only "S" instead "Select Name: *". But this also works fine in EXE project.
Code:
HWND hWnd = this->GetSafeHwnd();
MAPIINIT_0 tMapInit = { 0, MAPI_MULTITHREAD_NOTIFICATIONS };
HRESULT hResult = MAPIInitialize( &tMapInit );
HMODULE hMapiMod = LoadLibrary(_T("mapi32.dll"));

ProcMapiLogon = (LPMAPILOGON)GetProcAddress( hMapiMod, "MAPILogon" );

(ProcMapiLogon)( (ULONG)hWnd, NULL, NULL, MAPI_LOGON_UI | MAPI_NEW_SESSION, 0,   &hCurrentSession );

LPMAPISENDMAIL ProcMapiSendMail = NULL;
ProcMapiSendMail = (LPMAPISENDMAIL)GetProcAddress(hMapiMod, "MAPISendMail");
(ProcMapiSendMail)(hCurrentSession, (ULONG)hWnd, &myMsg, MAPI_DIALOG | MAPI_LOGON__UI, 0);

The question is why Address Book dialog's title shows only "S" in OCX project. Same it works in exe project.
Kindly help me how to resolve the issue.
Additional note:
Thanks for your reply.
With Simple MAPI code, everything works fine (means I can display new send mail window and send it when I click 'Send" button) except the "Address Book" dialog's title (caption).
I tried extended MAPI functionalities also. When the project is built as .OCX file extension like "SendMail.ocx" still Address Book dialog's title shows only "S".
Extended MAPI Code:
HMODULE hMapiMod = LoadLibrary(_T("mapi32.dll"));
LPMAPISESSION lppSession;
LPMAPILOGONEX ProcMapiLogonEx = NULL;
ProcMapiLogonEx = (LPMAPILOGONEX)GetProcAddress( hMapiMod, "MAPILogonEx" );
ProcMapiLogonEx)( (ULONG)hWnd, NULL, NULL, MAPI_USE_DEFAULT | MAPI_UNICODE |  MAPI_EXTENDED | MAPI_LOGON_UI | MAPI_NEW_SESSION, &lppSession );

A: Simple MAPI is ANSI only. The external MAPI dll has no idea that you complied as Unicode, all it sees is a string that it expects to be 0x0 terminated. Your Unicode (2 byte) strings have 0x0 for each ANSI character and double 0x0 at the end. Hence your string is terminated at the first 0x0.


text:
Q: User defined public variables yii2 model prints empty value i defined some values in my yii2 frontend user model, my model name is  'PhCabinetUser'
following is code from my model.
class PhCabinetUser extends \yii\db\ActiveRecord
{

public $has_liveaccount;
public $email_verification;
public $account_deposited;
public $document_uploaded;

/**
 * @inheritdoc
 */
public static function tableName()
{
    return 'ph_cabinet_user';
}

Now when i try to get $email_verification in my controller it returns empty value.
following is code from my controller.
$model = PhCabinetUser::find()->all();
    $row = array();

    foreach($model as $obj) {
  echo $obj['email_verification'];
  echo $obj->email_verification;
   }

however when i print $obj array it shows value for email_verification
following is my print_r($obj) result.
crm\models\PhCabinetUser Object ( [has_liveaccount] => [email_verification] => [account_deposited] => [document_uploaded] => [_attributes:yii\db\BaseActiveRecord:private] => Array ( [id] => 29 [company_id] => 1 [first_name] => Super [last_name] => Man [username] => ksdwpfr3.a4q@20email.eu [email] => ksdwpfr3.a4q@20email.eu [registration_email_token] => PXwTu8KULal2_So5U3wVllxfKg1X-Dzh_1468296370 [country] => 2 [country_code] => +355 [phone] => 1234567890 [dob] => [gender] => male [address1] => [address2] => [city] => [state] => [zipcode] => [source] => Website [owner] => 1 [lead_manager] => [has_liveaccount] => 0

[email_verification] => 1

[account_deposited] => 0
[document_uploaded] => 0
[lead_status] => 1
[status] => 10
[created_at] => 1468296369 [updated_at] => 1468296580 )

[_oldAttributes:yii\db\BaseActiveRecord:private] => Array (
[id] => 29
[company_id] => 1
[first_name] => Super
[last_name] => Man
[username] => ksdwpfr3.a4q@20email.eu
[auth_key] => Nc-GABmcqJIpib22L5cuwgBaOKqRvbiQ
[password_hash] => $2y$13$ZHB6IF51LODVqAEwI2zRkuIWbgEZ165acvpIeiVm2SZBFA1kzpp4S
[password_reset_token] =>
[email] => ksdwpfr3.a4q@20email.eu
[registration_email_token] => PXwTu8KULal2_So5U3wVllxfKg1X-Dzh_1468296370
[country] => 2
[country_code] => +355
[phone] => 1234567890
[dob] =>
[gender] => male
[address1] =>
[address2] =>
[city] =>
[state] =>
[zipcode] =>
[source] => Website
[owner] => 1
[lead_manager] =>
[has_liveaccount] => 0
[email_verification] => 1
[account_deposited] => 0
[document_uploaded] => 0
[lead_status] => 1
[status] => 10
[created_at] => 1468296369
[updated_at] => 1468296580
)
[_related:yii\db\BaseActiveRecord:private] => Array ( )
[_errors:yii\base\Model:private] =>
[_validators:yii\base\Model:private] =>
[_scenario:yii\base\Model:private] => default [_events:yii\base\Component:private] => Array ( ) [_behaviors:yii\base\Component:private] => Array ( ) )

now how to get this value in a variable.

A: Be sure that the public vars you added ad the top of your class don't override  your ActiveRecord .. you have already the same var name in active record .. the declaration of a public  var in the model generate a fails in  assignement of the valeu and you get empty result  ..

A: Try it like:
if($obj->email_verification) {
echo "Works";
}

A: try
$model = PhCabinetUser::find()->all();
var_dump($model); exit;


text:
Q: Running powershell script on asp.net site I am trying to run a powershell script and have it output to my asp.net site. I have made it work with a very simple script where the only command in the script was
Get-Service | Out-String
and this output onto my site everything I expected
but when I use the script I actually want info from it doesn't output anything
I can tell it runs (or trys to run) because when my site hits the code that invokes the script it hangs about 10 seconds.
The script I am trying to run is
$user = "user"
$token = "token"

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

$result = Invoke-WebRequest -Method Get -Uri 'https://site.vsrm.visualstudio.com/defaultcollection/product/_apis/release/releases?definitionId=1&api-version=3.0-preview.2&$expand=environments' -ContentType "application/json" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}

$releaseArr = $result.Content | ConvertFrom-Json
[System.Collections.ArrayList]$enviromentName = @()
[System.Collections.ArrayList]$latestRelease = @()

foreach($env in $releaseArr.value[0].environments)
{
    $enviromentName.Add($env.name) | Out-Null
}

foreach($releaseValue in $releaseArr.value)
{
    For($i = 0; $i -lt $enviromentName.Count; $i++)
    {
        if($latestRelease[$i] -eq $null)
        {
            foreach($release in $releaseValue.environments)
            {
                if($release.name -eq $enviromentName[$i] -and $release.status -eq "succeeded")
                {
                    $latestRelease.Add($releaseValue.name) | Out-Null
                }
            }
        }
    }
}

For($i = 0; $i -lt $enviromentName.Count; $i++)
{
    Write-Host $enviromentName[$i] " : " $latestRelease[$i]
}

I know this script runs and outputs, but is there some code in this script that would cause it to not output properly.
The code in my asp.net site I am using to call the script is
ResultBox.Text = string.Empty;

        // Initialize PowerShell engine
        var shell = PowerShell.Create();

        // Add the script to the PowerShell object
        shell.Commands.AddScript(@"C:\Users\user\Desktop\script.ps1");

        // Execute the script
        var results = shell.Invoke();

        // display results, with BaseObject converted to string
        // Note : use |out-string for console-like output
        if (results.Count > 0)
        {
            // We use a string builder ton create our result text
            var builder = new StringBuilder();

            foreach (var psObject in results)
            {
                // Convert the Base Object to a string and append it to the string builder.
                // Add \r\n for line breaks
                builder.Append(psObject.BaseObject.ToString() + "\r\n");
            }

            // Encode the string in HTML (prevent security issue with 'dangerous' caracters like < >
            ResultBox.Text = Server.HtmlEncode(builder.ToString());
        }

A: Change "Write-Host" to "Write-Output." Write-Host only outputs to interactive consoles.
You can see this in action:
Make a new PowerShell file and add a write-host statement to it:
[nick@nick-lt temp]$ New-Item -Type File -Path .\example.ps1 -Force
[nick@nick-lt temp]$ Set-Content .\example.ps1 "Write-Host 'Hello World'"

Then try and set a variable to the result of the script:
[nick@nick-lt temp]$ $what = .\example.ps1
Hello World
[nick@nick-lt temp]$ $what
[nick@nick-lt temp]$

Hello World shows up when the script executes but the variable is empty.
Now change it to write-output:
[nick@nick-lt temp]$ Set-Content .\example.ps1 "Write-Output 'Hello World'"
[nick@nick-lt temp]$ $what = .\example.ps1
[nick@nick-lt temp]$ $what
Hello World

The variable actually contains what it is supposed to now.
One of the cardinal rules of PowerShell is to not use Write-Host except in script that will be run interactively. .NET needs the results in the output stream not the host stream.


text:
Q: PHP Make an Array IF NOT then do something I have come across a client snippet. I want to say IF NOT then do this. So all the items in the Array should NOT work. I dont know why it still does!
$StuddedListArray = array("563_black","564_white","565_black","578_turq","570_black","581_blush","584_white","578_black","570_grey","585_blush","567_black","564_white","580_blush","591_black","578_blush","589_black");
if(!$promocode="gcnow20" && in_array($newitemID, $StuddedListArray)){
    // do nothing
}else {
    $promocode_validate_check = $_POST['promocode'];
}

A: !$promocode="gcnow20" is always false.. if you want to check if the value is equal you have to use !$promocode=="gcnow20"
Also as commented by @Vilx-
!$promocode=="gcnow20"

can be written as:
$promocode!="gcnow20"

A: Maybe because you meant to write
$promocode=="gcnow20"

instead of
$promocode="gcnow20"

A: the !$promocode="gcnow20" will always return false.
while you assign a value to the variable
use
if (!($promocode="gcnow20" && in_array($newitemID, $StuddedListArray))){

A: do you mean to say if (!($promocode == 'gcnow20' && in_array(... ?  Where is promocode set?  You may also mean to write if ($promocode != 'gcnow20' ...

A: If I understand well, you want to check if $promocode is different than "gcnow20" and the $itemID is not in array? Then:
$StuddedListArray = array("563_black","564_white","565_black","578_turq","570_black","581_blush","584_white","578_black","570_grey","585_blush","567_black","564_white","580_blush","591_black","578_blush","589_black");
if($promocode !="gcnow20" && !in_array($newitemID, $StuddedListArray)){
    // do nothing
}else {
    $promocode_validate_check = $_POST['promocode'];
}


text:
Q: Preventing main div from scrolling underneath Header I have this problem where my "main" div which holds the content of the webpage scrolls under header and my nav bar. I've been looking around for solutions and people say to position: fixed position: absolute. However, when I try these the div still scrolls under the header and nav bar. I've also tried to set a top: 980px; To account for the pixel size of these two elements and it will still scroll.

@import url(http://fonts.googleapis.com/css?family=Pacifico);
 body {
  background-image: url("paws1.jpg");
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  font-weight: 300;
}
/*
HEADER ELEMENTS
*/

img {
  display: block;
}
header {
  width: 950px;
  margin: 0 auto;
  height: 250px;
  position: fixed;
  background-color: rgba(144, 214, 32, 1);
  min-width: 950px;
  z-index: 1;
  top: 0px;
}
header div {
  display: inline-block;
}
#nav {
  width: 950px;
  content: "";
  margin: 0 auto;
  display: block;
  height: 30px;
  line-height: 0;
  position: fixed;
  min-width: 950px;
  background: #8BC43F;
  text-align: center;
}
#account {
  position: relative;
  float: right;
  padding-top: 22px;
}
header ul {
  padding-left: 20px;
}
header li {
  display: inline-block;
}
header li a {
  color: white;
  text-decoration: none;
  padding: 5px;
}
header li a:hover {
  background: #571173;
  border-radius: 3px;
}
#current {
  background-color: rgba(255, 102, 0, 1);
  border-radius: 3px;
  z-index: 2;
}
/*
MAIN CONTENT
*/

#main {
  background: rgba(255, 255, 255, 1);
  width: 950px;
  margin: 0px auto;
  min-width: 950px;
  overflow-x: auto;
  top: 980px;
}
li {
  list-style-type: none;
  margin-left: 20px;
  margin-right: 20px;
}
#splash-left {
  float: left;
  width: 590px;
}
#splash-right {
  float: right;
  width: 300px;
  padding-top: 50px;
  padding-left: 10px;
}
#home-image {
  background: url(../images/mainimage.jpg);
  border-radius: 0px;
  width: 900px;
  margin: 0 auto;
  margin-top: 280px;
  text-align: center;
}
.splash-title {
  font-family: 'Pacifico', cursive;
  font-size: 5em;
}
footer {
  position: relative;
  height: 70px;
  padding-left: 230px;
}

Home

DIY Dog Bath House

Professional Services

Products

Contact Us

Brockport, NY Dog Groomer

The Dog Wash "Do-It-Yourself" Bath House

Keep your best friend clean and your house cleaner with our DIY dog bathing services! No appointments are necessary - just bring in your dog and we'll supply the rest. Bring your pooch into The Dog Wash "Do-It-Yourself" Bath House
        today!

You'll have your own gated room equipped with a waist high tub, professional shampoos and conditioners, clean towels, an apron and more!

Professional, certified dog grooming services

We love your dog almost as much as you do! Certified groomer Patti Francisco has 7 years of experience, and will provide your dog with a gentle, professional trimming to help him look his best.

Get to know The Dog Wash!

DIY Dog Bath House - No appointments necessary - leave the mess with us!

Professional Services - We also offer professional dog grooming by a certified groomer

Products - Professional shampoos and conditioners, brand name collars and leads, and more

Cleanliness is king!

Sanitation is very important to us. That's why all of the tubs and equipment are fully cleaned and sanitized after each use.

Keep your dog clean without the mess! Call The Dog Wash at 585-637-7098 for a grooming appointment, or bring him into 4612 Lake Rd S. for DIY bathing services.

Here is the website link for a quick visual:
http://www.itss.brockport.edu/~rsiss1/cis442/ADogWash/Home

A: http://jsfiddle.net/t5fouf4u/1/. I can't see all your issues in the fiddle. So let me know if you have something else.
header {
  width: 950px;
  margin: 0 auto;
  height: 250px;
  background-color: rgba(144, 214, 32, 1);
  min-width: 950px;
  z-index: 1;
  top: 0px;
}
header div {
  display: inline-block;
}
#nav {
  width: 950px;
  content: "";
  margin: 0 auto;
  display: block;
  height: 30px;
  line-height: 0;
  min-width: 950px;
  background: #8BC43F;
  text-align: center;
}
#nav ul {
    margin:0px;
}


text:
Q: Vector Data Loss When Leaving A Loop I wouldn't consider myself a programming newbie, but I have been struggling to understand vectors for the better part of six months now.
I've tried to use vectors in "production" code, but it never seems to function how I would expect. This example is one of the many problems I have with them, as is stated in the title, Vectors seem to mysteriously lose data after leaving a while loop. This will probably boil down to I'm simply using the vector all wrong, but I would like to think my process is at least somewhat sound. As you will notice, this is a vector of objects, which is probably pivotal to the issue as well.
In this example I've made, a char pointer with a random character inside of it is added to the vector, exactly ten times. Each time, the contents of the char pointer are erased and new content is added to ensure the data is unique. After leaving the loop, and starting another to print out the contents of the vector, none of the data that was just added to the vector is there anymore. Why?
Additionally, the initialization of the vector is non-standard from the examples I've seen, but seems to be the only way to get the vector to work without crashes.
Apologies for my poor formatting, the style in the code-block is not exactly how I format the code (Bracket spacing was screwed up slightly) Thanks in advance!
#include <stdio.h>
#include <vector>
#include <stdlib.h>

int main( int argc, char * argv[ ] ) {

    std::vector<char *> avector( 0 );
    avector.reserve( 400 );
    int counter = 0;
    char * place;
    bool ok;

    Back:
    if( counter == 10 ) {
        counter = 0;
        while( counter != 10 ){
            printf( "Element %d: %s\n", counter,  avector.at( counter ) );
            ++counter
        }
        ok = false;
    }
    while( counter != 10 ) {
        ok = true;
        place = (char *)malloc( 10 * sizeof( char ) );
        *place = (char)( ( rand( ) % 26 ) + 65 );
        printf("Pre-placement, element %d: %s\n", counter, place );
        avector.push_back( place );
        printf("Post-placement element %d: %s\n", counter, avector.at( counter ) );
        free( place );
        ++counter;

    }
    if( ok == true ) {
        goto Back;
    }

    exit( 0 );
}

A: place = (char *)malloc( 10 * sizeof( char ) );
You're allocating data with malloc
avector.push_back( place );
You're pushing it to the vector
free( place );
And then, you delete it. So, the pointer is still in the vector, but the memory address does not belong anymore to you.
Also, you are programming in C++, not C, so don't use printf, goto, malloc and free.
And try to not use new and delete, use smart pointers instead (C++11)

A: The main bug in your code is that you're adding a pointer to your vector, but then invalidate the pointer you had stored in it.
place = (char *)malloc( 10 * sizeof( char ) );
avector.push_back( place );
free( place );   // <<--- BUG; you destroyed what's pointed to by place

The bug is that both place and the position to which place was added in avector (say, at avector[avector.size() - 1]) are pointing to the same memory location, so freeing place is the same as freeing the avector[avector.size() - 1] on a given iteration of the loop.
You've basically pulled the rug from under your own feet.
I think a simpler example can help you see more clearly. This is a refactored version of your code, using proper C++ instead of a mix of C++ and C:
#include <iostream>
#include <vector>

using namespace std;

int main( int argc, char * argv[ ] ) {
    vector<char *> my_char_pointers;

    cout << "Filling up vector ..." << endl;
    for(int i = 0; i < 5; ++i) {
        cout << "Adding address of " << char(65 + i) << " to vector ..." << endl;
        my_char_pointers.push_back(new char(65 + i));
    }

    cout << "Printing vector ..." << endl;
    for(int i = 0; i < my_char_pointers.size(); ++i)
        cout << my_char_pointers.at(i) << endl;

    cout << "Deleting char pointer vector elements ..." << endl;
    for(int i = 0; i < my_char_pointers.size(); ++i)
        delete my_char_pointers[i];

    cout << "Printing vector of now-INVALID pointers ..." << endl;
    for(int i = 0; i < my_char_pointers.size(); ++i)
        cout << my_char_pointers.at(i) << endl;

    cout << "Removing the now invalid pointers from vector ..." << endl;
    my_char_pointers.clear();

    return 0;
}

Running it in my Linux PC, you get the following output:
$ g++ -o test test.cpp
$ ./test
Filling up vector ...
Adding address of A to vector ...
Adding address of B to vector ...
Adding address of C to vector ...
Adding address of D to vector ...
Adding address of E to vector ...
Printing vector ...
A
B
C
D
E
Deleting char pointer vector elements ...
Printing vector of now-INVALID pointers ...

 ��
`��
@��
���
Removing the now invalid pointers from vector ...

A few differences to notice between your version and mine, including bug fix and other details:

*

*I create, but don't delete, the vector inputs inside the same loop (this is the fix);

*Your code is hard to follow, making errors more difficult to catch/debug;

*It uses new and delete, which are the proper ways to allocate/deallocate memory in C++ (malloc and friends are for C)

*It uses cout from <iostream>, which is the proper way to print output in C++ (printf is for C)

*It uses properly structured code and does not rely on goto[1], which leads to spaghetti code;

*And my code is easier to follow/understand, making any errors easier to find/fix

You need to work on your code structure, simplified logic, and other details if you really want to come across as not being a "programming newbie".
Also notice that you don't really have a vector of "objects"; you have a vector of pointers to chars. The vector named my_char_pointers is an object, but its contents are primitive types. (Yes, terminology does make a difference.)
[1] Why on Dijkstra's name would you use goto statements? They cause lots of headaches to yourself and those that will inevitably need to read your code in the future.


text:
Q: VBScript Autoit programming file upload
Hi guys, our company's website has this file upload button for uploading multiple images. How can I create a script that automatically selects the images then uploads them? I already know the path of each images on the client's PC. I just don't want to script a click on the file upload button since I get a headache trying to make that work. My current goal is to script it in Autoit with something like:
$files1 = "C:\TeamBuilding\Team Games.jpg"
$files2 = "C:\TeamBuilding\Team Prayer.jpg"
$oIE.getelementbyid("file").upload $files1, $files2

Then after the image upload the form is submitted. Obviously the code above is a fantasy :D I just need the part to script uploading the images instead of clicking the upload button. My Autoit script will modify the innerHTML of this form to add the script for auto-upload. Is this doable?
Summary: Instead of clicking the "Upload File" button I want a script to upload certain .jpg files. Right now what I'm doing is manually clicking the "Upload File" button then selecting all the JPEG files. Somebody suggested a script that will click the upload button then types the path of each images but I already tried those, was a headache, I'm asking for a script in VB (since Autoit seem to be VBScript language). Once I get that script, what I will do is just modify the innerHTML of my company's site so instead of a plain <input type="file" name="file" multiple=""> it will automatically upload the pictures without having the user manually placed the pictures

A: This is where you start.
        #RequireAdmin ;Will give your script a permission elevation (sometimes its needed)

        #include <IE.au3>
        Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
        Opt("WinSearchChildren", 1) ;0=no, 1=search children also

        $oIE = _IEAttach("MyUploadPageTitle","windowtitle"); do _IEAttach()
        oInputFile = _IEGetObjByName($oIE, "file");get an object of a file input field

        _IEAction($oInputFile, "focus")

        $hIE = _IEPropertyGet($oIE, "hwnd")
        ControlSend($hIE, "", "Internet Explorer_Server1", " ")

        WinWait("Choose File", "", 30)
        Sleep(1000)
        WinActivate("Choose File")
        ControlSetText("Choose File", "", "[CLASS:Edit; INSTANCE:1]", $FileToUpload )
        Sleep(1000)
        WinActivate("Choose File")
        ControlSend("Choose File", "", "", "{ENTER}")

        WinWaitClose("Choose File", "", 5)
...


text:
Q: Use Laravel to update columns in a database for all IDs How do I update all rows in a table (all IDs) at once, with a database query in Laravel? My current controller code is as follows:
public function updateSchedule(Request $request, $id)
{
    $timein = $request->input('timeIn');
    $timeout = $request->input('timeOut');

    DB::table('schedules')
        ->where('id', 1)
        ->update(['time_in' => $timein, 'time_out' => $timeout]);
}

A: To update the whole table (the WHOLE TABLE), you would do the following (removing the condition that you only want to update matches where id = 1):
public function updateSchedule(Request $request, $id)
{
    $timein = $request->input('timeIn');
    $timeout = $request->input('timeOut');

    DB::table('schedules')
        ->update(['time_in' => $timein, 'time_out' => $timeout]);
}

If you want to see something afterwards, you either need to return that value, or a view, or a redirect to the prior page.
For example, the following (although it's not good practice to use back() as you don't know where they came from. It's better to go to a specific route / url).
public function updateSchedule(Request $request, $id)
{
    $timein = $request->input('timeIn');
    $timeout = $request->input('timeOut');

    DB::table('schedules')
        ->update(['time_in' => $timein, 'time_out' => $timeout]);

    return back();
}


text:
Q: How to deal with not being allowed to define types in an interface in c# I often find the need to do something along these lines:
public class OperationResult
{
  bool succes;
  SomeOtherObject someobject;
}

public interface ICanDoSomethingWeird
{
  OperationResult DoMyThing();
}

Where the OperationResult is really a class that belongs to the ICanDoSomethingWeird interface. I find it very annoying I cannot place it in the namespace of the interface.
I'm wondering how other people deal with this. Do you just stick it in the global namespace?  or just one namespace up from the namespace where the interface sits?
My current approach is to do rename the OperationResult class to ICanDoSomethingWeird_OperationResult, but am not very impressed by how pretty that is :)
Anybody have a better solution?

A: If OperationResult is a type used solely by ICanDoSomethingWeird and clients of ICanDoSomethingWeird, then it belongs in the same "context" as ICanDoSomethingWeird. That is, it belongs in the same namespace as ICanDoSomethingWeird:
namespace MyNamespace
{
    public class OperationResult {}

    public interface ICanDoSomethingWeird
    {
        OperationResult DoMyThing();
    }
}

Think about the client code. Would you prefer this:
using MyNamespace;

ICanDoSomethingWeird myWeirdThing = ...;
ICanDoSomethingWeird.OperationResult result = myWeirdThing.DoMyThing();

or this:
using MyNamespace;

ICanDoSomethingWeird myWeirdThing = ...;
OperationResult result = myWeirdThing.DoMyThing();

The latter makes more sense to me, and is the only option where interfaces are concerned. You cannot declare inner types in interfaces. And do note the general advice regarding nested types:

DO NOT use nested types if the type is
  likely to be referenced outside of the
  containing type.

A: An interface does not define any implementation.  By including a class your interface is effectively including some implementation.  Nested classes have the purpose of assisting the class implementation that defines it.
Nested classes should not be used as if the class has merit outside of its use with the containing class.  A class should not be used as a surrogate for a namespace to define other classes.
If an interface defines some behaviour that requires the use of a class that as yet does not exist it would make sense to create that class in the same namespace to which the interface belongs.

A: You could define the interface as an abstract class instead and then define a public inner class.
 public interface ICanDoSomething

 public abstract class AbstractCanDoSomething
 {
     public class OperationResult
     {
          public bool SomeValue { get; set; }
          public int SomeOherVAlue { get; set; }
     }

     public abstract OperationResult DoMyThing();
 }


text:
Q: Swift Core Data preset values Is there a way to set some preset values to core data?
Basically adding some default values not editable and equal for everyone?
Thank you!
This is how I am fetching data:
func attemptFetch(){
    let fetchRequest: NSFetchRequest<Course> = Course.fetchRequest()
    let dataSort = NSSortDescriptor(key: "title", ascending: true)
    fetchRequest.sortDescriptors = [dataSort]

    let controller = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: context, sectionNameKeyPath: nil, cacheName: nil)

    controller.delegate = self
    self.controller = controller

    do {
        try controller.performFetch()
    } catch {
        let error = error as NSError
        print("\(error.debugDescription)")
    }
}

and this is how i am getting the array:
if let objs = controller.fetchedObjects, objs.count > 0 {
        ....
}

A: So you have two options that I can think of. Just display it or actually add it.

*

*Display it. Take the array your using for CoreData display and add the data with static values. I think this is the easiest.

var CoreDataStringArray = [String]()
var CoreDataImage1Array = [UIImage]()

func fetchData() {

//Static values

CoreDataStringArray = ["Item 1", "Item 2", Item 3", "Item 4", "Item 5"]
CoreDataImage1Array = [UIImage(named: "item1"),UIImage(named: "item2"),UIImage(named: "item3"),UIImage(named: "item4"),UIImage(named: "item5")]

//Now fetch the Core Data Values and the user will see a full list of them mixed together.

    }

*You can add them on the first launch of the app. This how I save them, I run a for loop to siphon through each one.

//Inside Class (import CoreData above)
    let moc = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext

    override func viewDidLoad() {
        super.viewDidLoad()

        let openedbefore = UserDefaults.standard.bool(forKey: "openedbefore")

if openedbefore == false {
 //Add data

    var CoreDataStringArray = ["Item 1", "Item 2", Item 3", "Item 4", "Item 5"]
    var CoreDataImage1Array = [UIImage(named: "item1"),UIImage(named: "item2"),UIImage(named: "item3"),UIImage(named: "item4"),UIImage(named: "item5")]

     for index in 0...CoreDataStringArray.count-1 {
        let entityDescription = NSEntityDescription.entity(forEntityName: "Entity", in: moc)

        let item = Entity(entity: entityDescription!, insertInto: moc)

        item.name = "\(CoreDataStringArray[index])"
        item.image = UIImagePNGRepresentation(CoreDataImage1Array[index]) as! NSData

        do {
            try moc.save() // Save the static values to CoreData
        } catch {
            return
        }
     }
  }

  UserDefaults.standard.set(true, forKey: "openedbefore")
}


text:
Q: Need help on compiling FFTW on visual studio I need to use the FFTW on visual studio 2008 with C++. I'm new to programming and I need your instruction on how to get it compiled and how to create the .lib files to use with my program. Thanks.

A: just follow the instructions
http://www.fftw.org/install/windows.html
and then if you get specific questions, ask them here.

A: http://www.fftw.org/fftw3_doc/Installation-on-non_002dUnix-systems.html#Installation-on-non_002dUnix-systems


text:
Q: How do i write to a program that show system`s time in java language? import java.util.Date;
public class Time {
    public static void main(String args[]) {
        Date myDate=new Date();
        int hours=myDate.getHours();
        int minutes=myDate.getMinutes();
        int seconds=myDate.getSeconds();
    }
}

A: You can use Calendar for this. Don't use java.util.Date for getHours() since those are deprecated.
  Calendar calendar=Calendar.getInstance();
  System.out.println(calendar.getTime()); // get time will give you current time

Out put:
  Fri Sep 19 12:23:48 IST 2014

You should read about Calendar, you can find all you need there.
For your comment. If you only want Time part you can use DateFormat
Eg:
Calendar calendar=Calendar.getInstance();
DateFormat df=new SimpleDateFormat("HH:mm:ss");
System.out.println(df.format(calendar.getTime()));

Out put:
12:32:08

Or you can get current hour, minute and seconds too.
Eg:
Calendar calendar=Calendar.getInstance();
System.out.println("current hour: "+calendar.get(Calendar.HOUR_OF_DAY));
System.out.println("current minute: "+calendar.get(Calendar.MINUTE));
System.out.println("current second: " +calendar.get(Calendar.SECOND));

Out put:
current hour: 12
current minute: 48
current second: 8


text:
Q: Assignment of energy functions to flows is "equivariant"? I am trying to understand the 2012 blog post What is a symplectic manifold, really?
It says (with correction of a typo in the second point):

*

*If $f: M \to \mathbb{R}$ is a smooth compactly supported function, then there is a time evolution $a_f:M\times R \to M$ such that $a_f(a_f(x,u),t)=a_f(x,u+t)$. Physically, we think of this as the energy function specifying how the system evolves over time.

*Conservation of energy: $f(a_f(x,t))=f(x)$.

*...

*The assignment from energy functions to flows is equivariant under any of the flows: $a_{f(a_g(-,t))}(x,u)=a_f(a_g(x,u),t)$.

  All of these are hopefully intuitive properties for a physically system to have.

I do not understand the last bullet point ("equivariance").
First of all, when $g=f$ it seems to contradict the first two points.
Secondly, calculating in the plane $\mathbb{R}^2$ with coordinates $x=(q,p)$: for $f=\tfrac{1}{2}q^2$ and $g=\tfrac{1}{2}p^2$ (okay, not compactly supported, but I doubt that is the biggest issue here), I get the Hamiltonian vector fields $X_f=-q\frac{\partial}{\partial p}$ and $X_g=p\frac{\partial}{\partial q}$ which integrate to $a_f((q,p),t) = (q,p-tq)$ and $a_g((q,p),u) = (q+up, p)$. The right-hand side of the desired equality is $a_f(a_g(x,u),t)=(q+up,p-t(q+up))$. The left-hand side is the evolution of the Hamiltonian vector field associated to $h:=f(a_g((q,p),t))=\tfrac{1}{2}(q+tp)^2$, i.e. of the vector field $X_h=t(q+tp)\frac{\partial}{\partial q}-(q+tp)\frac{\partial}{\partial p}$, hence it is $a_h((q,p),u)=(q+ut(q+tp),p-u(q+tp))$, which is not the same as the right-hand side.
What am I doing wrong and/or what is the correct statement?
It should be related to the Jacobi identity, but that seems more like an infinitesimal version of this.

A: The condition I was trying to write in that last bullet point is that the symplectic form itself is invariant under these flows.  Indeed, this is equivalent to the Poisson bracket satisfying the Jacobi identity.
For fixed $u$, we can think about $a_f(a_g(x,u))$ as integrating the vector field $X_f$ (defined by $\langle X_f,\omega\rangle=df$) starting at the point $a_g(x,u)$.  This is equivalent to considering the vector field $X'$ which is the pushforward of $X_f$ by the map $a_g(-,-u)$, flowing by that starting at $x$, and then applying $a_g(-,u)$.  The point of invariance is that $X'$ is uniquely defined by $\langle X', a_g(-,u)^*\omega\rangle= df(a_g(-,u))$; by the invariance of the symplectic form (by Cartan's magic formula, $L_{X_g}\omega=d^2g+\iota_{X_g}d\omega=0$), this says that $X'=X_{f(a_g(-,u))}$.
So, at least one correct version of the statement is $a_g(a_{f(a_g(-,u))}(x,t),u)=a_f(a_g(x,u),t).$  The Jacobi identity for Poisson bracket is obtained by taking $\frac{\partial^2}{\partial u \partial t}h$ for some function $h$; the RHS  gives $\{\{ h, f\},g\}$ and the left hand side gives $\{\{h,g\},f\}+\{h,\{f,g\}\}$.


text:
Q: Remove trailing slash from real directories how are you? please one very little question if you don't mind.
after the previous episode of redirecting and rewriting rules in this thread: redirect to default language except for /amp/ Urls, our SEO agency recommended us to change the URLs site.com/fr, site.com/be to site.fr and site.be
I already set the 301 redirections for old URLs as follow:
RewriteRule ^[a-z]{2}$ / [R=301,L]
RewriteRule ^[a-z]{2}/(.*)$ /$1 [R=301,L]

I know this can be achieved in one rule but didn't manage to make it work :/
since I now removed the language folder, removing the trailing slash does't really work well. site.com/test adds the slash because the folder "test" exists and is a real folder. I tried DirectorySlash Off but it returns a forbidden 403 error.
please any idea how to solve this?
Thanks a lot

A: Following my comments:
Combining those 2 shown rules into one:
RewriteRule ^[a-z]{2}(?:/(.*))?$ /$1 [R=301,L,NE]


text:
Q: if(isset($_FILES)) Not working in PHP i can't get the input type file value from an html form using $_FILES  , the isset($_FILES['NAME'])  to get the uploaded image  value from  the form , i have put an echo 'string' in  the first line of the isset condition  and it's not displaying it
 <form role="form" id="contact_form" class="contact-form" method="post" enctype="multipart/form-data">

                          <input type="text" class="form-control" name="newpseudo" id="name" placeholder="php">

                          <input type="email" class="form-control" name="newmail" id="email" placeholder="*EMAIL">

                          <input type="password" class="form-control" name="newmdp1" id="company" placeholder="*MOT DE PASSE">

                          <input type="password" class="form-control" name="newmdp2" id="company" placeholder="*CONFIRMER VOTRE MOT DE PASSE">

                                                        Ajouter Photo de profil
                                                        <input type="file" name="avatar" >

                                                    <button type="submit" value="submit" class="btn" id="btn_submit" onClick="proceed();" name="modifier">Mettre a jour</button>

                                </form>

the PHP code  i'm trying to get it the file input value :
  if (isset($_FILES['avatar']) AND !empty($_FILES['avatar']['name'])) {
         echo "string";
         $taillemax = 2097152;
         $extensionsvalides = array('jpg','jpeg','gif','png');
         if ($_FILES['avatar']['size'] <= $taillemax) {
             $extensionsUpload = strtolower(substr(strrchr($_FILES['avatar']['name'],'.'),1));
             if (in_array($extensionsUpload, $extensionsvalides)) {
                     $chemin ="membres/avatars/".$_SESSION['id'].".".$extensionsUpload;
                     $resultat = move_uploaded_file($_FILES['avatar']['tmp_name'], $chemin);
                     if ($resultat) {
                         $updateavatar = $bdd->prepare('UPDATE memebre SET avatar = :avatar WHERE id = :id');
                         $updateavatar->execute(array('avatar'=>$_SESSION['id'].".".$extensionsUpload,'id' => $_SESSION['id']));
                               header("Location: userProfile.php?id=".$_SESSION['id']);

                     }
                     else
                     {
                        $msg = "Erreur de l'importation de votre photo de profil";
                     }
             }
             else
             {
                $msg = "votre photo de profil  doit etre de format jpg , jpeg ou png";
             }
         }

A: add action for form and send data to file execute phpcode and save file
this mean you should change this line:
 <form role="form" id="contact_form" class="contact-form" method="post"
 enctype="multipart/form-data">

to:
 <form role="form" id="contact_form" class="contact-form" method="post"
 enctype="multipart/form-data" action="example.php">