text:
Q: is there a difference from a css point of view between <div>
  <form>
  </form>
</div>

and..
<form>
 <div>
 </div>
</form>

A: This can change inheritance, perceived width, and the selectors you use. So, yes, there is a difference.

A: Aside from the fact to select children one is div > form and the other is form > div no.


text:
Q: Remove images from dhtmlxTree View I want to remove images from the Tree view shown in dhtmlxTree. I know that if we don't give any image file, there won't be any image shown. But, still the place for the image is left blank. I want to reclaim the place of the image. Can we do that in dhtmlxTree ?

A: Try:
tree.enableTreeImages(false);

see this link for more options http://docs.dhtmlx.com/doku.php?id=dhtmlxtree:api_toc_categories

redpajama_set_name: RedPajamaStackExchange


text:
Q: Creating array of class objects of varying sizes I have several sprite objects of different sizes I would like to turn into an array, but cannot get the declarations right. Nothing I search for seems to cover this particular situation.
How do I code circle and square into mySprites[0] and mySprites[1] or Sprite[0].mySprites or ?? Does the variable size of each sprite preclude this? If they were all set to a fixed size how would I code it?
P.S. The Arduino does NOT support vectors.
Current code
sprite.h:
Class Sprite{
    Public:
    Sprite::Sprite (int _width, int _height, row_byte, ...);
     (more code)
}

ArduinoDemo.ino:
#include "sprite.h"

Sprite circle = Sprite {4,4,
 0b0110,
 0b1001,
 0b1001,
 0b0110};

Sprite square = Sprite {6,6,
(and so on)


text:
Q: Calculating time with hours and minutes only I am attempting to create a timesheet calculator which takes calculates the time an employee works and I am close, with one problem.
As I perform the calculation, I only want hours and minutes to display.  I am able to get that done, but that causes an issue.  If the employee punches out before a full minute is elapsed, that minute is not included in the calculation.
For example, if an emp punches in at 12:00:30 and punches out at 5:00:29, that last minute is not counted in the calculation, so the time shows as 4:59 instead of 5:00.
How do I get the calculation to be based on the hours and minutes and exclude seconds completely?
This is the code I have:
    private void btnPunchOut_Click(object sender, EventArgs e)
    {

        DateTime stopTime = DateTime.Now;
        lblPunchOutTime.Text = stopTime.ToShortTimeString();
        TimeSpan timeWorked = new TimeSpan();
        timeWorked = stopTime - startTime;
        lblTimeWorked.Text = timeWorked.ToString(@"hh\:mm");
    }

A: Use TimeSpan.TotalSeconds perhaps...And then add 30 seconds or more, before you convert it to hours by dividing by 3600.
As in
lblTimeWorked.Text = ((timeWorked.TotalSeconds+30)/3600).ToString("0.00") + " hours";

Use Timespan.TotalHours if you want the hours.
But if you want to be accurate, you should create a separate class dedicated to calculating the hours worked by a staff member.  Then you can encapsulate lots of business rules in the dedicated class.  Staff have entitlements and overtime, expenses or penalty rates - so this can get complex if done properly.

A: If you want a calculation that really ignores the seconds, the clearest way to accomplish that is to get rid of the seconds on both the start time and the end time. It might not seem accurate because it allows a difference of one second to become a difference of one minute. But that could still be a valid business rule, that you want to subtract according the the minutes that appeared on the clock rather than the actual elapsed seconds.
In other words,
1:00:01 is adjusted to 1:00:00.
1:00:59 is adjusted to 1:00:00.
1:01:00 is "adjusted" to 1:01:00.
1:01:01 is adjusted to 1:01:00.
You can accomplish that with an extension like this:
public static class TimespanExtensions
{
    public static TimeSpan TrimToMinutes(this TimeSpan input)
    {
        return TimeSpan.FromMinutes(Math.Truncate(input.TotalMinutes));
    }
}

(I'm sure there's a more efficient way of truncating the seconds, but at least this is clear.)
Now instead of having to figure out how to calculate the difference while rounding seconds or adding seconds, you just trim the seconds before calculating the difference. Here's a unit test:
[TestMethod]
public void NumberOfMinutesIgnoresSeconds()
{
    var startTime = TimeSpan.FromSeconds(59).TrimToMinutes();
    var endTime = TimeSpan.FromSeconds(60).TrimToMinutes();
    Assert.AreEqual(1, (endTime - startTime).TotalMinutes);
}

One Timespan represents 59 seconds, and the next one is 60, or the first second of the next minute. But if you trim the seconds and then calculate the difference you get exactly one minute.
In the context of your code,
DateTime stopTime = DateTime.Now;
lblPunchOutTime.Text = stopTime.ToShortTimeString();
var timeWorked = stopTime.TrimToMinutes() - startTime.TrimToMinutes();
lblTimeWorked.Text = timeWorked.ToString(@"hh\:mm");


text:
Q: Android: Json parse in listview Im trying to parse some items in a listview and when I scroll down I want to get more products and add them to the list.
But my code doesnt do that it either refreshes it or crashes.
Any help?
Also adding a footer doesnt work either i get an classcastexception
JSONParser:
 package com.lars.json;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.lars.R.drawable;

import android.R;
import android.util.Log;

/** A class to parse json data */
public class JSONParser {

    // Receives a JSONObject and returns a list
    public List<HashMap<String,Object>> parse(JSONObject jObject){

        JSONArray jProducts = null;
        try {
            // Retrieves all the elements in the 'countries' array
            jProducts = jObject.getJSONArray("products");
        } catch (JSONException e) {
            e.printStackTrace();
        }

         // Invoking getCountries with the array of json object
         // where each json object represent a country
        return getProducts(jProducts);
    }

    private List<HashMap<String, Object>> getProducts(JSONArray jProducts){
        int productsCount = jProducts.length();
        List<HashMap<String, Object>> productList = new ArrayList<HashMap<String,Object>>();
        HashMap<String, Object> product = null;

        // Taking each country, parses and adds to list object
        for(int i=0; i<productsCount;i++){
            try {
                // Call getCountry with country JSON object to parse the country
                product = getJSON((JSONObject)jProducts.get(i));
                productList.add(product);

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        return productList;
    }

    // Parsing the Country JSON object
    private HashMap<String, Object> getJSON(JSONObject f){

        HashMap<String, Object> country = new HashMap<String, Object>();

        String id = "";
        String naam = "";
        String status = "";
        String prijs = "";
        String productnum = "";

        try {
            String priceone = f.getString("prijsex");

            id = f.getString("id");
            naam = f.getString("naam");
            status = f.getString("status");
            prijs = "€" + priceone;
            productnum = f.getString("productnum");

            country.put("id", id);
            country.put("naam", naam);
            country.put("img", com.lars.R.drawable.tlogotrans);
            country.put("prijs", prijs);
            country.put("img_path", "http://www.lars.com/images/" + productnum + ".jpg");

            if(Integer.parseInt(status) > 0){
            country.put("status", com.lars.R.drawable.stock);
            }else{
            country.put("status", com.lars.R.drawable.nostock);
            }

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return country;
    }
}

Download tasks and Listview loaders:
/** A method to download json data from url */
    private String downloadUrl(String strUrl) throws IOException{
        String data = "";
        InputStream iStream = null;
        try{
                URL url = new URL(strUrl);

                // Creating an http connection to communicate with url
                HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

                // Connecting to url
                urlConnection.connect();

                // Reading data from url
                iStream = urlConnection.getInputStream();

                BufferedReader br = new BufferedReader(new InputStreamReader(iStream));

                StringBuffer sb  = new StringBuffer();

                String line = "";
                while( ( line = br.readLine())  != null){
                    sb.append(line);
                }

                data = sb.toString();

                br.close();

        }catch(Exception e){
                Log.d("Exception while downloading url", e.toString());
        }finally{
                iStream.close();
        }

        return data;
    }

    /** AsyncTask to download json data */
    private class DownloadTask extends AsyncTask<String, Integer, String>{
        String data = null;

                @Override
                protected String doInBackground(String... url) {

                        try{

                            data = downloadUrl(url[0]);

                        }catch(Exception e){
                            Log.d("Background Task",e.toString());
                        }
                        return data;
                }

                @Override
                protected void onPostExecute(String result) {

                        // The parsing of the xml data is done in a non-ui thread
                        ListViewLoaderTask listViewLoaderTask = new ListViewLoaderTask();
                        Log.i("Result", result);

                        if(result.equals(" ")){
                            Log.i("No img", "No Img");
                        }else{

                                listViewLoaderTask.execute(result);

                        }
                        // Start parsing xml data

                }
    }

    /** AsyncTask to parse json data and load ListView */
    private class ListViewLoaderTask extends AsyncTask<String, Void, SimpleAdapter>{

        JSONObject jObject;
        private List<HashMap<String, Object>> products;
        // Doing the parsing of xml data in a non-ui thread
        @Override
        protected SimpleAdapter doInBackground(String... strJson) {
            try{

                jObject = new JSONObject(strJson[0]);
                JSONParser jsonpars = new JSONParser();
                jsonpars.parse(jObject);
            }catch(Exception e){
                Log.d("JSON Exception1",e.toString());
            }

            // Instantiating json parser class
            JSONParser jsonpars = new JSONParser();

            // A list object to store the parsed countries list

            try{
                // Getting the parsed data as a List construct
                if(set == 0){
                products = jsonpars.parse(jObject);
                }else{
                    products.addAll(jsonpars.parse(jObject));

                }

            }catch(Exception e){
                Log.d("Exception",e.toString());
            }

            // Keys used in Hashmap
            String[] from = { "img","naam","status","prijs"};
            // Ids of views in listview_layout
            int[] to = { R.id.imPThumb,R.id.tvPRName,R.id.imstock,R.id.tvPRPrijs};

            // Instantiating an adapter to store each items
            // R.layout.listview_layout defines the layout of each item
            SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), products, R.layout.productlijstrow, from, to);

            return adapter;
        }

        @Override
        protected void onProgressUpdate(Void... values) {
            // TODO Auto-generated method stub
             publishProgress();
             Log.i("ListView Loader Task", "Update");
            super.onProgressUpdate(values);
        }

        /** Invoked by the Android on "doInBackground" is executed */
        @SuppressWarnings("unchecked")
        @Override
        protected void onPostExecute(SimpleAdapter adapter) {

            // View v = getLayoutInflater().inflate(R.layout.footerview, null);
            //list.addFooterView(v);
            // Setting adapter for the listview

            list.setAdapter(adapter);

            if(set == 0){
            list.setOnScrollListener(onAnswersScrolled);
            set++;
            }
            list.setOnItemClickListener(onAnswerClicked);

               list.setTextFilterEnabled(true);
           /*    list.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    @SuppressWarnings("unchecked")
                    HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);

                    Bundle extra = new Bundle();
                    Intent i = new Intent("com.lars.productdescription");
                    extra.putString("id", o.get("id"));
                    i.putExtras(extra);
                    startActivity(i);

                    }
                });*/

            for(int i=0;i<adapter.getCount();i++){
                HashMap<String, Object> hm = (HashMap<String, Object>) adapter.getItem(i);
                String imgUrl = (String) hm.get("img_path");
                Log.i("imgurlonPost", imgUrl);
                ImageLoaderTask imageLoaderTask = new ImageLoaderTask();

                HashMap<String, Object> hmDownload = new HashMap<String, Object>();
                hmDownload.put("img_path",imgUrl);

                hmDownload.put("position", i);

                // Starting ImageLoaderTask to download and populate image in the listview
                imageLoaderTask.execute(hmDownload);
                adapter.notifyDataSetChanged();
            }

         /*   list.setOnScrollListener(new OnScrollListener(){

            });*/

        }
    }

    /** AsyncTask to download and load an image in ListView */
    private class ImageLoaderTask extends AsyncTask<HashMap<String, Object>, Void, HashMap<String, Object>>{

        @Override
        protected HashMap<String, Object> doInBackground(HashMap<String, Object>... hm) {

            InputStream iStream=null;
            String imgUrl = (String) hm[0].get("img_path");
            int position = (Integer) hm[0].get("position");
            HashMap<String, Object> hmBitmap = new HashMap<String, Object>();
            URL url;
            try {
                url = new URL(imgUrl);

                // Creating an http connection to communicate with url
                HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                Log.i("imgUrl", imgUrl);
                // Connecting to url
                urlConnection.connect();
          //      Log.i("Response", urlConnection.getResponseMessage());
                // Reading data from url

                if(urlConnection.getResponseMessage().contains("OK")){
                iStream = urlConnection.getInputStream();

                // Getting Caching directory
                File cacheDirectory = getBaseContext().getCacheDir();
                cacheDirectory.delete();
                // Temporary file to store the downloaded image
                File tmpFile = new File(cacheDirectory.getPath() + "/wpta_"+position+".png");

                // The FileOutputStream to the temporary file
                FileOutputStream fOutStream = new FileOutputStream(tmpFile);

                // Creating a bitmap from the downloaded inputstream
                Bitmap b = BitmapFactory.decodeStream(iStream);

                // Writing the bitmap to the temporary file as png file
                b.compress(Bitmap.CompressFormat.PNG,100, fOutStream);

                // Flush the FileOutputStream
                fOutStream.flush();

                //Close the FileOutputStream
                fOutStream.close();

                // Create a hashmap object to store image path and its position in the listview

                // Storing the path to the temporary image file
                hmBitmap.put("img",tmpFile.getPath());

                // Storing the position of the image in the listview
                hmBitmap.put("position",position);

                // Returning the HashMap object containing the image path and position
                return hmBitmap;

               }else{
                    Log.i("nope", "nb");
                    String uriStr = "android.resource://" + "com.lars" + "/" + R.drawable.ic_launcher;
                    hmBitmap.put("img", uriStr);

                    hmBitmap.put("position",position);
                    return hmBitmap;
                }

            }catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        @SuppressWarnings("unchecked")
        @Override
        protected void onPostExecute(HashMap<String, Object> result) {
            // Getting the path to the downloaded image

            String path = (String) result.get("img");

            // Getting the position of the downloaded image
            int position = (Integer) result.get("position");

            // Getting adapter of the listview

            adapter = (SimpleAdapter ) list.getAdapter();

            // Getting the hashmap object at the specified position of the listview
            HashMap<String, Object> hm = (HashMap<String, Object>) adapter.getItem(position);

            // Overwriting the existing path in the adapter
            hm.put("img",path);

            // Noticing listview about the dataset changes
            adapter.notifyDataSetChanged();

        }

        @Override
        protected void onProgressUpdate(Void... values) {
            // TODO Auto-generated method stub
             publishProgress();

             adapter.notifyDataSetChanged();
             Log.i("Image Task", "Update");

            super.onProgressUpdate(values);
        }
    }

    private OnItemClickListener onAnswerClicked = new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position,
                long id) {
            @SuppressWarnings("unchecked")
            HashMap<String, String> o = (HashMap<String, String>) parent.getItemAtPosition(position);

            Bundle extra = new Bundle();
            Intent i = new Intent("com.lars.productdescription");
            extra.putString("id", o.get("id"));
            i.putExtras(extra);
            startActivity(i);
        }

    };

    private OnScrollListener onAnswersScrolled = new OnScrollListener() {

        public void onScroll(AbsListView view, int first, int visibleitems, int totalitemcount) {
            // TODO Auto-generated method stub
            int lastInScreen = first + visibleitems;
            if(lastInScreen == totalitemcount){
            if(kf == 0){
                Log.i("onScroll", ""  + c);
                Log.i("kf", "0");
                String filfinal = keuze.replace(" ", "thisisaspace");
                String strUrl = "http://www.lars.nl/getName.php?name=" + filfinal + "&page=" + c ;
                DownloadTask downloadTask = new DownloadTask();
                    downloadTask.execute(strUrl);
                    c = c + o;
                    Log.i("After Scroll", "" + c);
            }else{
                Log.i("onScroll", "" + c);
                Log.i("kf", "1");
                 String strUrl = "http://www.lars.nl/get.php?id=" + filter + "&page=" + c ;
                    DownloadTask downloadTask = new DownloadTask();
                        downloadTask.execute(strUrl);
                        c = c + o;
                        Log.i("After Scroll", "" + c);
            }
            }
        }

        public void onScrollStateChanged(AbsListView view, int scrollstate) {
            // TODO Auto-generated method stub

        }
    };

    }

A: I'd like to introduce you to CWAC-ENDLESS by non other than the brilliant mark murphy (commonsware).  Not only is it a fine example of the power of putting an adapter inside another adapter, it handles all the background tasks for you as well as scrolling so that your data list may be added to very easily by following the demo
I sincerely hope this helps you as much as its helped me.


text:
Q: How do I install Secondlife? How the heck do I install the latest version of Secondlife for natty? I have it in archive manager and now I am stuck, I have tried tutorials and nothing helps.
I am new to ubuntu and need much help. If someone could tell me commands to run that would help I have secondlife for linux version SecondLife-i686-2.7.4.235167 I have it downloaded now what do I do?

A: 1) You need to unpack the packet you downloaded. You can do it with archive manager. You can also do it from command line - since the linux packet available for download from Second Life looks like a tar-bzip2 archive, the command to unpack it is:
tar -xjvf SecondLife-i686-2.7.4.235167.tar.bz2
That will create a directory where all the files are unpacked.
2) You may perform an installation by running the install.sh within the unpacked directory. But it seems that just running the application will do this automatically, so this isn't required.
3) You can run the application directly by running the binary file secondlife in the unpacked directory. To do this from command line, enter the directory and just run ./secondlife.
Also note that in the README-linux.txt file of the package it says

For in-world MOVIE and MUSIC PLAYBACK, you will need (32-bit) GStreamer 0.10
  installed on your system.  This is optional - it is not required for general
  client functionality.

Hope this helps!


text:
Q: How to use self join in sequlize nodejs How to use joins inside find function in sequlize. Below I have attached raw Mysql query. I'm new to sequelize help me in converting this raw query into sequelize format using 'include'.
SELECT child.name,child.position,child.image,child.description, parent.name AS parentName FROM `categories` child
INNER JOIN `categories` parent ON
child.parentId = parent.id OR child.parentId = null
WHERE child.id = 9


text:
Q: use javascript to read a link resource without ajax Not sure if it's possible but how do I read a resource from a url using javascript without ajax?
for example, the following url is a static text file containing json encoded text
http://mysite.s3.amazonaws.com/jsonencodedcontent.txt
I'd like to use javascript to read the content from above link, read the json content into a javascript variable.
I can't use ajax because of cross site and I have no control over amazon S3 domain.
anyway to achieve this?

A: Try @Ben's suggestion first. If for any reason that doesn't work in your case, here's two options I've both seen and used, which may or may not be available in your case (I'm providing two overly simplified examples just to clarify my points):
Create a server side resource that resides in your domain and retrieves and returns the cross site content for you:
<?php
die(file_get_contents('http://mysite.s3.amazonaws.com/jsonencodedcontent.txt'));

Use mod_rewrite (or something similar) to create a virtual resource in your domain that resolves to the remote content behind the scenes:
RewriteEngine On
RewriteRule ^jsonencodedcontext\.txt$ http://mysite.s3.amazonaws.com/jsonencodedcontent.txt [P]


text:
Q: How to check for cloud-code generated errors on parse My app is running on parse.com and all the cloudcode errors have code 141.
When I'm running a certain function, in some rare cases I get this exception trown by the cloudcode: Error: User isn't in the database. (Code: 141, Version: 1.2.19)
However, when I'm trying to segue the user back to the home screen with this code, nothing gets called:
if(error){
   NSLog(@"Error logged: %@", error); //loggs: Error logged refreshtokencoinbase: Error Domain=Parse Code=141 "The operation couldn't be completed. (Parse error 141.)" UserInfo=0x10ae0e460 {error=User isn't in the database., code=141}

   if([error  isEqual:@"User isn't in the database." ]){
       [self performSegueWithIdentifier:@"moveToStart" sender:self];
   }
}

How do I handle cloudcode generated errors like this one?

A: Parse errors have the description text in error.userInfo[@"error"]. It may not be a good idea to check the error type by the text, but here you have no other chance.


text:
Q: php adding up numbers I think this might be an easy question for the professionals out there, but here goes.
Basically I want to get the total word count of a bunch of paragraphs. Right now I can get the word count of each paragraph, but I can't figure out how to add them all up.
$para // an array of paragraph strings

$totalcount = '';
foreach ($para as $p)
{
$count = str_word_count($p, 0);
 echo $count . "
";
 }
 print_r($totalcount);

this prints a list of 41 numbers, representing the word count of each pagraphs
but the $totalcount is an array of all these numbers. How can I get the sum of all 41 paragraphs?

A: $totalcount = 0;
foreach(...) {
    $totalcount += $count;
}
echo $totalcount;

A: You need to add to the total count each loop:
$para // an array of paragraph strings

$totalcount = 0;
foreach ($para as $p)
{
   $count = str_word_count($p, 0);
   echo "Count: ".$count . "
";
   $totalcount += $count;
}
echo "Total Count: ".$totalcount;


text: Q: Eclipse Debug Configuration error "program not specified" I get an error message while configuring the Snapdragon Debugger on an instance of Eclipse. I am using the instructions here and here is the error I get:  Can anyone advise how to select the correct and relevant program?


text:
Q: Update Manager Error - Authentication Error When I run Update Manager I get this error:

This is what the error box says:

W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used.GPG error: http://linux.dropbox.com lucid Release: The following signatures were invalid: NODATA 1 NODATA 2
W: Failed to fetch http://linux.dropbox.com/ubuntu/dists/lucid/Release
W: Some index files failed to download, they have been ignored, or old ones used instead.

A: You need to add the public key for the Dropbox repository, instructions from https://www.dropbox.com/downloading?os=lnx:

We have also authenticated our Ubuntu repositories. Please run
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E to install Dropbox's public key.

A: *

*Click System>>Administration>>Software Sources

*Click the Download From menu and choose Main Server

*Type the following in terminal.
sudo apt-get update

*Run the update manager again.

A: You don't need to be too worried about that error. It simply means that some files could not be found (probably the keys that are used to "sign" the repository). If you added the keys, then don't worry about it. If you have not added them however, you may need to get them from http://linux.dropbox.com/ and add them to your system.

A: In Software Sources
GO to authentication and  restore defaults. Type the following in terminal:
sudo apt-get update


text:
Q: String formatting in C#? I have some problems to format strings from a List<string>
Here's a picture of the List values:

Now I managed to manipulate some of the values but others not, here's what I used to manipulate:
string prepareStr(string itemToPrepare) {
    string first = string.Empty;
    string second = string.Empty;
    if (itemToPrepare.Contains("\"")) {
        first = itemToPrepare.Replace("\"", "");
    }
    if (first.Contains("-")) {
        int beginIndex = first.IndexOf("-");
        second = first.Remove(beginIndex, first.Length - beginIndex);
    }
    return second;
}

Here's a picture of the Result:

I need to get the clear Path without the (-startup , -minimzed , MSRun , double apostrophes).
What am I doing wrong here?
EDIT my updated code:
void getStartUpEntries() {

    var startEntries = StartUp.getStartUp();

    if (startEntries != null && startEntries.Count != 0) {

        for (int i = 0; i < startEntries.Count; i++) {

            var splitEntry = startEntries[i].Split(new string[] { "||" }, StringSplitOptions.None);

            var str = splitEntry[1];
            var match = Regex.Match(str, @"\|\|""(?<path>(?:\""|[^""])*)""");
            var finishedPath = match.Groups["path"].ToString();

            if (!string.IsNullOrEmpty(finishedPath)) {

                if (File.Exists(finishedPath) || Directory.Exists(finishedPath)) {

                    var _startUpObj = new StartUp(splitEntry[0], finishedPath,
                                                 "Aktiviert: ", new Uri("/Images/inWatch.avOK.png", UriKind.RelativeOrAbsolute),
                                                 StartUp.getIcon(finishedPath));

                    _startUpList.Add(_startUpObj);

                }
                else {

                    var _startUpObjNo = new StartUp(splitEntry[0], finishedPath,
                                           "Aktiviert: ", new Uri("/Images/inWatch.avOK.png", UriKind.RelativeOrAbsolute),
                                            StartUp.getIcon(string.Empty));

                    _startUpList.Add(_startUpObjNo);
                }
            }

            var _startUpObjLast = new StartUp(splitEntry[0], splitEntry[1],
                                         "Aktiviert: ", new Uri("/Images/inWatch.avOK.png", UriKind.RelativeOrAbsolute),
                                          StartUp.getIcon(string.Empty));

            _startUpList.Add(_startUpObjLast);

        }
        lstStartUp.ItemsSource = _startUpList.OrderBy(item => item.Name).ToList();
    }

A: You could use a regex to extract the path:
var str = @"0Raptr||""C:\Program Files (x86)\Raptr\raptrstub.exe"" --startup"
var match = Regex.Match(str, @"\|\|""(?<path>(?:\""|[^""])*)""");
Console.WriteLine(match.Groups["path"]);

This will match any (even empty) text (either an escaped quote, or any character which is not a quote) between two quote characters preceeded by two pipe characters.

A: Similarly, you could simply split on the double quotes as I see that's a repeating occurrence in your examples and take the second item in the split array:
var path = new Regex("\"").Split(s)[1];

A: This is and update to your logic without using any Regex:
private string prepareStr(string itemToPrepare)
{
    string result = null;
    string startString = @"\""";
    string endString = @"\""";

    int startPoint = itemToPrepare.IndexOf(startString);

    if (startPoint >= 0)
    {
        startPoint = startPoint + startString.Length;

        int EndPoint = itemToPrepare.IndexOf(endString, startPoint);

        if (EndPoint >= 0)
        {
            result = itemToPrepare.Substring(startPoint, EndPoint - startPoint);
        }
    }

    return result;
}


text:
Q: Is using the \bf command for bolding text OK? I see many questions where the macro \bf is used to generate a bold output. Is this a good use of \bf?

A: No, it is not a good use and should not be used at all in any modern LaTeX (post 1993) document.
BEGIN EDIT re comments
Other questions have been asked about this, for example about using \bf when typesetting maths, and with specific answers. This is an attempt to provide a generic answer not dependant on the particular desired typography.
END EDIT
\bf has not been defined in LaTeX2e since 1993, although it is still defined if you use TeX, not LaTeX.
Instead use:
I say \textbf{boldly go} onwards or I say {\bfseries boldly go} onwards. In math use \mathbf{boldly go}
Some classes or packages may define \bf or suggest using something else. For example the book, report and article classes define their version of \bf for compatibilty reasons with pre-1993 created documents.
The memoir class, and maybe many others, does not recognise \bf and will give warnings if it is used (although there is a class option that lets you use it).
Essentially, do not employ \bf. And package writers should certainly avoid it.


text:
Q: Backbone.Marionette - passing variable to composite view tag UPDATE (RELEVANT DETAIL): This composite view is within a collection of composite views.
How can I construct the following HTML using a Backbone.Marionette composite view?
    <optgroup label="Group 1">
        <option>Item 1</option>
        <option>Item 2</option>
        <option>Item 3</option>
    </optgroup>
    <optgroup label="Group 2">
        <option>Item 4</option>
        <option>Item 5</option>
        <option>Item 6</option>
    </optgroup>

Since I want to avoid the <div> wrapper, I will have to specify <optgroup> as the tagName.
view = Backbone.Marionette.CompositeView.extend({
    collection: some_collection,
    itemView: some_itemview,
    template: '#some_template', <!-- What goes inside the template? -->
    itemViewContainer: 'optgroup',
    tagName:'optgroup', <!--specify to avoid the default div-->

    <!-- What should I specify in order to pass label="Group1" to the optgroup tag-->
});

A: Don't use a CompositeView for this. You don't need a wrapper template since the wrapper in this case is only the <optgroup> tag.
Use a CollectionView instead, which doesn't render a wrapper template.
For the group #, use the onRender method

view = Backbone.Marionette.CollectionView.extend({
    collection: some_collection,
    itemView: some_itemview,
    tagName:'optgroup',

    onRender: function(){
      this.$el.attr("label", "Group 1");
    }

});

A: You could set the view element attributes in for example the initialize or onRender function, eg:
view = Backbone.Marionette.CompositeView.extend({
    ...

    initialize: function() {
        this.$el.attr('label', 'foobar');
    }
});

or replace initialize with:
    onRender: function() {
        this.$el.attr('label', 'foobar');
    }

OR
If you have an existing element such as:
<optgroup id="myGroup" label="Group 1">
</optgroup>

You can set the element of the view as such:
view = Backbone.Marionette.CompositeView.extend({
    el: $('#myGroup'),

    ...
});

A: A combination of Derick and Lasse's answers lead me to the solution. The onRender was what I was missing. Below is a summary for future readers.
The structure of the nested collection views:
Collection of Collections --> Collection --> Item
                          --> Collection --> Item
                          --> ... etc.

CollectionOfCollections =
Backbone.Marionette.CollectionView.extend({
    collection: myCollectionOfCollections,
    itemView: Collection <!--this refers to the next Collection view below-->
});

Collection =
Backbone.Marionette.CollectionView.extend({
    collection: myCollection,
    itemView: ItemView, <!-- again... the next view below -->
    tagName: 'optgroup',

Nested collections with Backbone.Marionette
    <!-- IF YOU ARE PASSING A SIMPLE ARRAY,
    IT MUST BE CONVERTED TO A REAL COLLECTION FIRST -->

    initialize: function(){
       var xyz = this.model.get('abc');
       this.collection = new Backbone.Collection.extend({});
    });

    onRender: function(){

       <!-- Here's where you insert the attribute into the tag -->

       this.$el.attr('label', this.model.get('name'));
     }
   });
});

ItemView =
ModalDropdownEntryView = TourView.extend({
    model: myModel,
    template: '#myTemplate',
    tagName: 'option',
});


text:
Q: Downloading video file from UIWebView In my application I want to download video say .MP4 format from any downloadable link clicked by user from UIWebView and save in applications Document folder.
Following is the code:-
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSURL *url = [[webView request] URL];
NSURLRequest *request = [NSURLRequest requestWithURL: url];
 [NSURLConnection connectionWithRequest: request delegate:self];

return YES;
}

and response is received
- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)theResponse{
NSString* content_type = [[(NSHTTPURLResponse*)theResponse allHeaderFields] valueForKey:@"Content-Type"];
NSLog(@"Content type = %@",content_type);
if ([content_type isEqualToString:@"mp4"]) {
    NSData *urlData = [NSData dataWithContentsOfURL:[theResponse URL]];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString  *documentsDirectory = [paths objectAtIndex:0];
    NSString *dataPath_ = [documentsDirectory stringByAppendingPathComponent:@""];
    NSString *newStr = [@"testVideo" stringByAppendingString:[NSString stringWithFormat:@".mp4"]];
    NSString *FilePath = [NSString stringWithFormat:@"%@/%@",dataPath_,newStr];
    [urlData writeToFile:FilePath atomically:YES];

}
}

The first time when clicked on Download link The MIME type is always 'text/html', the video plays and when clicked on back, then MIME type 'video' is received and video starts downloading.
I want the video to download on first click.
I'd appreciate some help or sample code.


text:
Q: Spring Boot's embedded Tomcat ignores access log configuration I've enabled the access log as follows:
server.tomcat.basedir=/var/log/my-server/tomcat
server.tomcat.accesslog.directory=.
server.tomcat.accesslog.enabled=true

This usally works in my Spring Boot projects, but not in my current project (Spring Boot 2.6.6), where I'm not using @SpringBootApplication due to some limitations.
I'm currently using the following annotations for my main class:
@SpringBootConfiguration
@ComponentScan
@ServletComponentScan(basePackageClasses = { /* ... */})
@ImportAutoConfiguration({WebMvcAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
                ServletWebServerFactoryAutoConfiguration.class})
public class ...

Is there any autoconfiguration I need to import explicitly to configure the embedded tomcat? (server.address as well as server.port gets already respected).

A: You need to import EmbeddedWebServerFactoryCustomizerAutoConfiguration as well.


text:
Q: PHP array_merge with numerical keys How can make it so array_merge() overwrites two keys with different values but same key index from two arrays?
for example, merging:
[0] => 'whatever'
with
[0] => 'whatever', [1] => 'a', [2] => 'b'
should produce
[0] => 'whatever', [1] => 'a', [2] => 'b'
Basically I want array_merge to bahave the same way it behaves if the arrays have string keys...

A: Use the + operator.
Compare array_merge to + operator:
<?php

$a1 = array(0=>"whatever",);
$a2 = array(0=>"whatever",1=>"a",2=>"b");

print_r(array_merge($a1,$a2));
print_r($a1+$a2);
?>

Output:
Array
(
    [0] => whatever
    [1] => whatever
    [2] => a
    [3] => b
)
Array
(
    [0] => whatever
    [1] => a
    [2] => b
)

The + operator still works if your associative array has the numerical keys out-of-order:
<?php

$a1 = array(0=>"whatever",);
$a2 = array(1=>"a",0=>"whatever",2=>"b");

print_r(array_merge($a1,$a2));
print_r($a1+$a2);
?>

Output:
Array
(
    [0] => whatever
    [1] => a
    [2] => whatever
    [3] => b
)
Array
(
    [0] => whatever
    [1] => a
    [2] => b
)

Notice array_merge in this case creates a new key.  Not desirable...

A: Pretty easy to write manually:
function array_merge_custom($first, $second) {
    $result = array();
    foreach($first as $key => $value) {
        $result[$key] = $value;
    }
    foreach($second as $key => $value) {
        $result[$key] = $value;
    }

    return $result;
}

Update: This behaves differently than the union operator (return $first + $second;) because in this case the second array wins when both have elements with the same key.
However, if you switch the places of the arguments and place the array that you want to "win" in case of conflicts as the first operand, you can get the same behavior. So the function above behaves exactly like return $second + $first;.

A: In my project I use my own function
function array_merge_custom(){
    $array = [];
    $arguments  = func_num_args();
    foreach($arguments as $args)
        foreach($args as $key => $value)
            $array[$key] = $value;
    return $array;
}

Usage
$a = array_merge_custom($b, $c, $d, ... .. )

A: array_replace does exactly this!

A: You should use $a2+$a1 to get same result with array_merge($a1,$a2);
$a1 = array(
    'k1' => 1,
    'k2' => 2,
    'k3' => 3,
);

$a2 = array(
    'k1' => 11,
    'k2' => 22,
    'k4' => 44,
);

Code:
print_r(array_merge($a1,$a2));

Output:
Array (
    [k1] => 11
    [k2] => 22
    [k3] => 3
    [k4] => 44
)

Code:
print_r($a1+$a2);

Output:
Array (
    [k1] => 1
    [k2] => 2
    [k3] => 3
    [k4] => 44
)

Code:
print_r($a2+$a1);

Output:
Array (
    [k1] => 11
    [k2] => 22
    [k4] => 44
    [k3] => 3
)

A: You could use array_merge() and then use array_unique().

A: the solution could be this:
function array_merge_custom($array1, $array2) {
    $mergeArray = [];
    $array1Keys = array_keys($array1);
    $array2Keys = array_keys($array2);
    $keys = array_merge($array1Keys, $array2Keys);

    foreach ($keys as $key) {
        $mergeArray[$key] = array_merge_recursive(isset($array1[$key]) ? $array1[$key] : [], isset($array2[$key]) ? $array2[$key] : []);
    }

    return $mergeArray;
}

$array1 = [
    '66_' => [
        'k1' => 1,
        'k2' => 1,
    ],
    '67_' => [
        'k1' => 1,
        'k2' => 1,
    ],
    '68_' => [
        'k1' => 1,
        'k2' => 1,
    ],
    68 => [
        'k1' => 1,
        'k2' => 1,
    ]
];
$array2 = [
    '66_' => [
        'a1' => 1,
        'a2' => 1,
    ],
    '68_' => [
        'b1' => 1,
        'b2' => 1,
    ],
    68 => [
        'b1' => 1,
        'b2' => 1,
    ]
];
echo '<pre>';
print_r(array_merge_custom($array1, $array2));

A: $arrA = [10, 11, 12];
$arrB = [12, 13];

$arrCommon = array_keys(array_flip($arrA) + array_flip($arrB));

print_r($arrCommon);
Array
(
    [0] => 10
    [1] => 11
    [2] => 12
    [3] => 13
)

Compare to WRONG use of "+"
$arrCommon = $arrA + $arrB;

print_r($arrCommon);
Array
(
    [0] => 10
    [1] => 11
    [2] => 12
)


text:
Q: Magento 2 : How Can I Add custom.less File For Only Specific Page? how can i add custom.less file for any specific page in child theme? means don't need genrate inside my custom css code in style-l.css or style-m.css and i have already 2 methods used.
Method 1.
create _custom.less and add css code
app/design/frontend/Vendor/theme/web/css/source/_custom.less

_source.less (import in _cutom.less)
app/design/frontend/Vendor/theme/web/css/source/_source.less

@import'_custom.less';

Method 2.
create "_custom.less" and "_extend.less" on same location
app/design/frontend/Vendor/theme/Magento_Theme/web/css/source/_custom.less
app/design/frontend/Vendor/theme/Magento_Theme/web/css/source/_extend.less

import _custom.less in _extend.less
@import'_custom.less'

both of methods generate in style-l.css or style-m.css. but i want generate on browser css with specific css link.

A: You can make your changes in your theme Less file then they will merge automatically into styles-m.css and styles-l.css
If you are generating browser CSS like custom.css so you can create a custom.css file at app/design/frontend/Vendor/theme/web/css/
Or you can not create CSS files only use Less file for the specific page you can create _module.less file for the specific module for your requirement.
For example, create module.less at Vendor_Module/web/css/source/ path and put your style into this less file.
And if you want to view your created file on the browser then according to the custom.css module.less than use grunt and refer to the below link
Compile LESS with Grunt

A: You can do something like this, for example:
app/code/Vendor/Custom//view/frontend/layout/cms_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Vendor_Custom::css/custom.css" />
    </head>
</page>

app/code/Vendor/Custom/view/frontend/web/css/custom.less
   #maincontent {
        padding: 0;
   }


text:
Q: Loop on a PHP array and ignore some entries I get some random PHP arrays generated by a backend, and I want to loop in it, and ignore all entries where weight > 5000.
Some array example:

array(4) {
  [0]=>
  object(stdClass)#72 (3) {
    ["weight"]=>
    string(2) "80"
    ["added_date"]=>
    string(19) "2016-10-02 11:49:27"
    ["etid"]=>
    string(1) "3"
  }
  [1]=>
  object(stdClass)#68 (3) {
    ["weight"]=>
    string(4) "6760"
    ["added_date"]=>
    string(19) "2016-10-04 14:30:25"
    ["etid"]=>
    string(1) "3"
  }
  [2]=>
  object(stdClass)#63 (3) {
    ["weight"]=>
    string(4) "1360"
    ["added_date"]=>
    string(19) "2016-10-04 14:56:21"
    ["etid"]=>
    string(1) "3"
  }
  [3]=>
  object(stdClass)#122 (3) {
    ["weight"]=>
    string(4) "1040"
    ["added_date"]=>
    string(19) "2016-10-25 16:52:25"
    ["etid"]=>
    string(1) "3"
  }

And my desired output will be:

array(1) {
  [0]=>
  object(stdClass)#72 (3) {
    ["weight"]=>
    string(2) "6760"
    ["added_date"]=>
    string(19) "2016-10-02 11:49:27"
    ["etid"]=>
    string(1) "3"
  }

How will look a PHP for loop to only filter the array values with weight >5000. Thank you.

A: Many approaches exist, but this is probably the most simple and straight forward:
<?php
$outputArray = [];
foreach ($inputArray as $inputElement) {
  if (5000 <= (int)$inputElement->weight) {
    $outputArray[] = $inputElement;
  }
}
var_dump($outputArray);

A: You can use array_filter fonction :
function BigWeight($value)
{
    return (is_object($value) && $value->weight >= 5000);
}

 $filtered_array = array_filter($your_array, "BigWeight");
 print_r($filtered_array);


text:
Q: How to open links that don't belong to my domain in browser - React Native Webview Hi I am using react native's webview to display a website url.
I want that when a user clicks a link inside the website(a line that doesn't belong to my domain), it will open the user's browser with that link.
If I have this domain example.com and if it change to something like that when I click a button example.com/about-us (This is ok)
But if I have this domain example.com and if it change to something like that when I click a button anotherdomain.com (This is should open in the user browser not in my webview app).
I have seen this subject but it don't give me what I need. I am using Expo in my webview app.
https://stackoverflow.com/a/40382325/9776729
This is my code at now
This is a live demo https://snack.expo.io/@maher-aldous/webview
const appurl = 'https://github.com/facebook/react-native';

function UrlApp() {
  return (
      <WebView
        ref={(ref) => { this.webview = ref; }}
        source={{uri: appurl}}
        onNavigationStateChange={(event) => {
          if (event.url !== appurl) {
            this.webview.stopLoading();
            Linking.openURL(event.url);
          }
        }}
        startInLoadingState
        scalesPageToFit
        javaScriptEnabled
        style={{marginTop: Constants.statusBarHeight}}
      />
  );
}

No errors

A: You can inject JavaScript that will prevent links from opening and send the link back to RN instead using window.ReactNativeWebView.postMessage and then open it with Linking.openURL.


text:
Q: POI formula evaluator not working I use poi-ooxml 3.9 to generate invoice report from an excel template I store in db. I have formulas at the end of the sheet that will do sum and other tax calculations.

cell D30 =SUM(D22:D28)
cell D31 =D30*0.12
cell D32 =D31*0.02
cell D33 =D31*0.01
cell D35 =SUM(D30:D33)

Before I write the sheet to a new file I evaluate the formulas, but nothing works. The code below is used to evaluate the formulas. Do I need to evaluate the formulas whenever I write the values into the cells or only at the end of the operation?
String formulaCells[] = { "D30", "D31", "D32", "D33", "D35" };
FormulaEvaluator formulaEvaluator = workBook.getCreationHelper()
        .createFormulaEvaluator();
Sheet sheet = workBook.getSheetAt(0);
for (String cellRef : formulaCells) {
CellReference ref = new CellReference(cellRef);
Row actualRow = sheet.getRow(ref.getRow());
Cell cell = actualRow.getCell(ref.getCol());
if (cell != null) {
// here I evaluate the formula
formulaEvaluator.evaluateFormulaCell(cell);

anything I have missed?
Note: Only after I open the generated sheet and press enter in every cells the formulas are evaluated!

A: Are you sure that your cell are added as number?
if not, try to do something like this:
if(type.equals("String")) {
   cell.setCellValue (value.toString());
} else if (type.equals("int")) {
   cell.setCellValue(Integer.parseInt(value.toString()));
} else if (type.equals("double")) {
   cell.setCellValue(Double.parseDouble(value.toString()));
}


text:
Q: MySQL update fields of a record based on field designation from another table I have a "Master" table that I am trying to apply a table of changes to.  The "Master" is a table is from a point in time from the past.  Changes that have been made to the "Master" since that time are listed in "Changes", and I am given the record number, the name of the field that needs to be updated, the new value of the field, and the date/time it was changed.  If I cannot take the latest change, that is not an issue, as I can just change the table so that it only has the latest update.  My issue is getting a query to update a field in a record, where I am getting the field name to update from a different table.
Any ideas?  I started my code off hard coding equations but wonder if there is a dynamic way to do this.
UPDATE MASTER
INNER JOIN MASTER b
   ON a.Id = b.Id
SET b.description = a.New_Value
WHERE a.change_field = "Description"

......(then I need it to do the same for any instance of one of the other 3 fields)

;

Table "MASTER":
    Id        | Description | Brand   | Cost   | Mapping
    --------------------------------------------------
    123       |  A Desc     |   Any   |  0.01  | Candy
    456       |  B Desc     |   Old   |  0.02  | Baking
    789       |  C Desc     |   Brand |  0.03  | Season

Table "CHANGES":
    Id           | Change Field   |   New Value  | Change Time
    -----------------------------------------------------------
    123          | Description    |   AA Desc    |  01:15:00
    123          | Description    |   AAA Desc   |  12:15:00
    456          | Brand          |   Good       |  01:15:00
    456          | Brand          |   Best       |  12:15:00
    789          | Cost           |   0.44       |  01:15:00
    789          | Mapping        |   Salt       |  01:15:00
    789          | Mapping        |   Sugar      |  12:15:00

Table "MASTER", updated with "CHANGES":
    Item Code | Description | Brand   | Cost   | Mapping
    --------------------------------------------------
    123       |  AAA Desc   |   Any   |  0.01  | Candy
    456       |  B Desc     |   Best  |  0.02  | Baking
    789       |  C Desc     |   Brand |  0.44  | Sugar

Many thanks!

A: What I would do if there is no enough time,
Copy/export all rows from CHANGES table to excel sheet.
Then build query there on excel using CONCATENATE formula, Check snap below.

Once your formula is perfect, just drag it up-to all rows below.
Then just copy paste the whole bunch from the Excel column to your query browser and execute it.
One more thing : if you want to update with latest value by time (in your case there are 2 rows for the description,branch and mapping fields with different Change Time) then you need to copy only those records which needs to be processed. e.g. While selecting the records from the Changes table you need to use group by Change Time and Max
You also need to handle other data type then string with slight change when you generate formula - i mentioned on the snap.
Let me know if it does not help or you need more help.
Mark it as answer if it helps.


text:
Q: On $(0,\infty)$, the metrics $d(x,y)=|x-y|+|\frac1x-\frac1y|$ and $d_e(x,y)=|x-y|$ are equivalent. Problem

Let $Y=(0,\infty)$ and define the metric $d(x,y)=|x-y|+|\displaystyle\frac1x-\displaystyle\frac1y|$ on $Y$. Let $d_e(x,y)=|x-y|$ be the usual Euclidean metric on $Y$, then show that both the metrics $d$ and $d_e$ are topologically equivalent on $Y$.

What I want to show is, any $d$ open ball is $d_e$ open ball and vice versa. Now $B_d(x;r)\subseteq B_{d_e}(x;r)$ proves that any $d_e$ open ball is $d$ open. But for the converse, I could not prove it.
Any hint please!! Or, is there any easy way to look at this problem? Because $d$ is sum of two matrics. Thank you.

A: Consider the following

Let $f:X\to \Bbb R$ be continuous on a metric space $(X,d)$. Then, $(X,\sigma)$, where
$\sigma:X\times X\to [0,\infty)$ defined by
$\sigma(x,y)=d(x,y)+\big|f(x)-f(y)\big|$, is topologically equivatent
to $(X,d)$.

One side is clear, namely $B_\sigma(a,\epsilon)\subseteq B_d(a,\epsilon)$. To prove the other side, let $a\in X$ and $\epsilon>0$ be given. Using continuity of $f$ at $a$, there is $\delta$ with $\frac{\epsilon}{2}>\delta>0$ such that $d(x,a)<\delta\implies \big|f(x)-f(a)\big|<\frac{\epsilon}{2}$. Now, $B_d(a,\delta)\subseteq B_\sigma(a,\epsilon)$. This is because of the fact that $x\in B_d(a,\delta)\implies \sigma(x,a)=d(x,a)+\big|f(x)-f(a)\big|<\delta+\epsilon/2<\epsilon/2+\epsilon/2=\epsilon.$ So, we are done.


text:
Q: Openlayers text symbology is not being shown I have a Vector Layer in a .json file:
{
    "type" : "FeatureCollection",
    "features": [
        { "type": "Feature", "properties": { "Station_Id":107, "NAME":"ARDEBIL(F)","ELEVATION":"1314.3"}, "geometry": { "type": "Point", "coordinates": [ 48.24 , 38.19 ] } }
    ]
}

For symbology I use an SLD, and the SLD File is following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
  xmlns="http://www.opengis.net/sld"
  xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NamedLayer>
    <Name>me</Name>
    <UserStyle>
      <Title>GeoServer SLD Cook Book: Rotated square</Title>
      <FeatureTypeStyle>
        <Rule>
          <Name>salam Bar Mahdi 2</Name>
          <Title>Title 2</Title>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#00FFFF</CssParameter>
                  <CssParameter name="fill-opacity">1.0</CssParameter>
                </Fill>
                <Stroke>
                 <CssParameter name="stroke">#000000</CssParameter>
                 <CssParameter name="stroke-width">2</CssParameter>
                 <CssParameter name="stroke-opacity">1.0</CssParameter>
               </Stroke>
             </Mark>
             <Size>6</Size>
             <Rotation>0</Rotation>
           </Graphic>
         </PointSymbolizer>
         <TextSymbolizer>
           <Label>
             <ogc:PropertyName>NAME</ogc:PropertyName>
           </Label>
           <Font>
             <CssParameter name="font-family">Arial</CssParameter>
             <CssParameter name="font-size">120</CssParameter>
             <CssParameter name="font-style">normal</CssParameter>
             <CssParameter name="font-weight">bold</CssParameter>
           </Font>
           <LabelPlacement>
             <PointPlacement>
               <AnchorPoint>
                 <AnchorPointX>0.5</AnchorPointX>
                 <AnchorPointY>0.0</AnchorPointY>
               </AnchorPoint>
             </PointPlacement>
           </LabelPlacement>
           <Fill>
             <CssParameter name="fill">#000000</CssParameter>
           </Fill>
         </TextSymbolizer>
       </Rule>
     </FeatureTypeStyle>
   </UserStyle>
 </NamedLayer>
</StyledLayerDescriptor>

I can see only a circle symbology and I can't see the text symbology.


text:
Q: 'UITableViewCell' does not have a member named 'businessLabel' I am encountering a strange error while trying to configure a prototype cell for use with a couple of arrays. I have set up a table view controller that is governed by 'BDTableViewController', and contains one prototype cell which is governed by the class 'BDTableViewCell'. However, Xcode is complaining that

'UITableViewCell' does not have a member named 'businessLabel'

when the businessLabel outlet is clearly linked up to my BDTableViewCell. Included are the files themselves. Any idea as to what is going wrong?

BDTableViewController:
import UIKit

class BDTableViewController: UITableViewController, UITableViewDelegate {

var BusinessNameArray = [String]()
var BusinessLogoArray = [String]()
var BusinessAddressArray = [String]()
var BusinessNumberArray = [String]()
var BusinessWebsiteArray = [String]()

override func viewDidLoad() {
    super.viewDidLoad()

    BusinessNameArray = ["Premiere Dance"]
    BusinessLogoArray = ["PD.tiff"]
    BusinessAddressArray = ["30 Brower Lane, Hillsborough, NJ 08844"]
    BusinessNumberArray = ["(908) 281-9442"]
    BusinessWebsiteArray = ["http://premieredancenj.com/"]

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

// MARK: - Table view data source

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    // #warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    // #warning Incomplete method implementation.
    // Return the number of rows in the section.
    return BusinessNameArray.count
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! UITableViewCell

    let item = BusinessNameArray[indexPath.row]

    cell.businessLabel.text = item

    return cell
}
}

BDTableViewCell:
import UIKit

[![enter image description here][1]][1]class BDTableViewCell: UITableViewCell {

@IBOutlet weak var businessLogo: UIImageView!
@IBOutlet weak var businessLabel: UILabel!
@IBOutlet weak var businessAddress: UILabel!
@IBOutlet weak var businessPhone: UILabel!
@IBOutlet weak var businessWebsite: UILabel!

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override func setSelected(selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

}

A: With this line
var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! UITableViewCell

you let the compiler know that cell is (just) a UITableViewCell, but a regular UITableViewCell doens't have a property called businessLabel. When you change the line to
var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! BDTableViewCell

the code will compile.


text:
Q: The entire answer is moving when hovering the bounty button It's just a minor CSS issue. See the following gif:

A: This has been resolved as part of design overhaul MSE went through not long ago. Now both normal and hovered states have blue square background of the same size, as it should be.

A: Looks like the problem is that there class .bounty-vote-off, which is used to style the un-awarded bounty button when you're not hovering the cursor over it, has an extra padding: 2px 4px 3px style that doesn't match the padding: 0.2em 0.5em style for the .bounty-award class.
Simply removing the padding style from .bounty-vote-off should fix this bug.
Ps. I'm pretty sure this also affects several other SE sites besides MSE, including (at least) the recently graduated Academia.SE and graphicdesign.SE.

Actually, the real cause of this bug seems to be that the bounty icon styling on this site (and on Academia / Graphic Design / etc.) is a Frankenstein hybrid of two entirely different styles:
SOFU style (SO):

Beta style (crypto.SE):

Frankenstein style (meta.SE):

Frankly, I suspect that whoever designed these stylesheets simply started from the beta styles and tweaked them to look more like SO, but forgot to modify or test the unawarded bounty appearance.
Ps. Looks like the CSS fix included in the Stack Overflow Unofficial Patch user script for this related design issue also fixes this bug as a side effect.


text:
Q: Android - Share file from sd using bluetooth Im trying to send a file from my SD using Bluetooth. I'm using Share intent, I wanna send a file from my SD (.mp3). ok when I open the share menu, I can send file to email, dropbox, whatsapp, but if I select Bluetooth, My device shows a message "File null was not sent to ..."
My steps are:
1. Create SEND intent.
2. Copy my file from res/raw to SD
3. Add my file to putExtra
4. Delete the file (is temporal file)
The code:
Intent shareIntent=new Intent(android.content.Intent.ACTION_SEND);
        shareIntent.setType("audio/mp3");
        //Copiamos archivo a compartir en la sd
        String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
        String fileName = sonidoActual+"-temp.mp3";

        File newSoundFile = new File(baseDir, fileName);

        try {
            byte[] readData = new byte[1024*500];
            InputStream fis = getResources().openRawResource(contexto.getResources().getIdentifier(sonidoActual,"raw", contexto.getPackageName()));
            FileOutputStream fos = new FileOutputStream(newSoundFile);
            int i = fis.read(readData);

            while (i != -1) {
                fos.write(readData, 0, i);
                i = fis.read(readData);
            }

            fos.close();
        } catch (IOException io) {
        }

        ////
        shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(newSoundFile.getAbsolutePath())/*Uri.parse("file:///sdcard/"+fileName)*//*Uri.parse("android.resource://com.genaut.instantbuttonsfreak/raw/"+texto)*/);
        startActivity(Intent.createChooser(shareIntent,getString(R.string.share)));
        //
        newSoundFile.delete();

Anybody can help me with this? I read a lot but not found a working method, sorry my english.

A: I think your file is not release by File-I/O.
SO.. try flush() the FileOutPutStream.. like,
fos.flush();
fos.close();

then, use Uri.fromFile(File file) for uri to pass with Intent.. But before passing Uri to Intent just check whether file is exist or not..
like,
if(newSoundFile.exist())
{
 shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(newSoundFile))
 startActivity(Intent.createChooser(shareIntent,getString(R.string.share)));
 newSoundFile.delete();
}


text:
Q: How to get data from 2 entities in MVC ? I am developing MVC application and using razor syntax. I have used model first method.
I have two entities, Customer and Lead. Lead is inherited from Customer.
When IsActive property is true then Customer treated as a Lead, otherwise it will be a customer.
Please check edmx file image.

Now, In regular entities we just deal with single entity and single table.
In this case how can I handle , Save and Load process. beacuse I have to store and load the record from 2 tables of DB.
Is Regular Index View will work here ?

A: When using inheritance in the Entity Framework you will have a single DbSet on your DbContext that exposes your hierarchy. In your database you have several options for configuring your table structure. For example you can use:

*

*Table per Hierarchy

*Table per Type

*Table per Concrete type

(See this blog for a nice explanation: Inheritance in the Entity Framework.
In your queries however, you don't have to think about this. Your queries will have the following structure:
var leads = from l in dbcontext.Leads.OfType<Customer>()
            select l;

The OfType() filters your collection to a subtype in your hierarchy. If you skip the OfType you will get both customers and leads in your resulting query.


text:
Q: Enlarge the size of multiple polygons contained in a shapefile QGIS I have a shapefile which contains many polygons and because I work on a large geographical extent, I'd like the polygons to be slightly bigger, for presentation purposes. Basically keep their extent and enlarge them by, say, 30% for example. I was thinking of using the SAGA "transform vector layer" tool. However I get lost when I need to put the X and Y coordinates, as shown in the picture below:

I understand that the scale factor will enlarge the polygons by whatever factor I want, but when it comes to the X and Y I wonder what I should put. I can't seem to find the x and y coordinates of my shapefile. I read this post Enlarge a Polygon without changing its shape or position but it gives details for doing so for just on polygon.

A: The simplest approach would be to increase the size of the polygon outline in the appearance of the layer, or buffer the polygons by an amount that would give the look you're going for. You could put the buffer on the map for the images, but provide the original data for the people who actually need to work with it.


text:
Q: Visual Studio debugger slows down in in-line code Since I upgraded to Visual Studio 2008 from vs2005, I have found a very annoying behaviour when debugging large projects.  If I attempt to step into inline code, the debugger appears to lock up for tens of seconds.  Each time that I step inside such a function, there is a similar pause.  Has anyone experienced this and is anyone aware of a work around?
Postscript:
After learning that MS had a service pack for vs2008 and needing to get it because of other compiling issues, the problem that I was encountering with the debugger was resolved.

A: I used to get this - I think it's a bug with the 'Autos' debug window:
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/eabc58b1-51b2-49ce-b710-15e2bf7e7516/

A: I get delays like this when debugging ASP.NET apps and it seems to happen when a symbol(pdb) file is getting accessed in the background. The larger the library, the longer the wait. My delay is at most about 10 seconds, but it does seem to happen with symbols that have already been accessed.
I do get a lot of 1-3 second waits when i try to step over items that cause VS to give me the "Step into Specific" message (http://blogesh.wordpress.com/category/visual-studio-2008/ #3). Perhaps this may be causing a real blow up for you.

A: For what it's worth, this issue appears to be addressed in the visual studio 2008 service pack 1.

A: As a workaround, you could use something like this for debugging purposes:
#ifdef _DEBUG
  #define INLINE
#else
  #define INLINE inline
#endif

For extra neatness you can place the functions in a separate .inc file that is included either in the header or the cpp file depending on build type.


text:
Q: Recovered Ubuntu, but it still launches corrupt version I am Ubuntu newbie, so this one may be obvious.
While playing with some Ubuntu themes, I have messed something up with my Ubuntu 14.04 (keyboard stopped working and Unity looks damaged too - no bars etc.), so i used Advanced options in GRUB Menu and picked up one of the previous versions. Recovery was successful.
However, when i restart my laptop, it loads the corrupt version of Ubuntu, where i can't even launch the Terminal.
I can repeat the whole process and recover it again, but is there a way to set the "recovered Ubuntu" as a default one ?

A: It appears that you have a problem with a recent kernel version. I have seen this happen before. I think an easy way to resolve this is with grub customizer. First install it. information is here: https://launchpad.net/~danielrichter2007/+archive/grub-customizer
When you run it you'll get something similar to this:

Simply uncheck the boxes for the kernel that is giving you problems and keep the ones you want to use checked.
Then click Save and Then File and Install to MBR
This should get you through until the next kernel update by which time you may find the problem is resolved.


text:
Q: What causes angular delay specially in UI? The page takes a bit longer to load and for around 2-3 seconds the UI is destroyed as you can see on the screenshot 1 before it loaded , I have checked the data and the data is not that heavy.
What causes that issue that when the page loaded it is destroyed for around 2-3 seconds and after that the UI is already okay ?
Why is that it took 2-3 seconds for the UI to be loaded ? is there something wrong from my implementation ?
I hope someone can enlighten me with this one , it was bugging me for a couple of days. Thanks.
#This is how it longs every time the page is loaded but only for 2-3 seconds
SCREENSHOT 1
#after 2 - 3 seconds the UI is now is normal see screenshot 2
SCREENSHOT2
#html code snippet

Settings

Manage Users & Teams

User Profile: {{fullName}}

    <button mat-button class="back-button" (click)="navigateBack()">
        <mat-icon>arrow_back</mat-icon>
        Back to Users
    </button>

User Profile

{{fullName}}

{{this.data.title}}

                    <button (click)="scrollTo(generalCard)" mat-button>
                        General
                    </button>

                    <button (click)="scrollTo(securityCard)" mat-button>
                        Security Role and SSO
                    </button>

                    <button (click)="scrollTo(passwordCard)" mat-button>
                        Password and Login
                    </button>

                    <button (click)="scrollTo(teamsCard)" mat-button>
                        Teams
                    </button>

                    <button (click)="scrollTo(transactionsCard)" mat-button>
                        Transactions
                    </button>

            <mat-divider></mat-divider>

                <button (click)="activateUserDialog(this.data.status)" mat-button class="w100 deactivate-user">
                    <mat-icon> {{this.data.status === 'Deactivated' ? 'play_circle_filled' : 'pause_circle_filled'}}
                    </mat-icon>
                    {{this.data.status === 'Deactivated' ? 'Reactivate user' : 'Deactivate user'}}
                </button>

                <mat-icon
                    [ngClass]="{'card-icon':currentTabElement !== 'general', 'active-icon':currentTabElement === 'general'}">
                    {{generalForm.enabled ? 'supervised_user_circle' : 'supervised_user_circle'}}</mat-icon>

GENERAL

                <button mat-button *ngIf="generalForm.disabled" (click)="editGeneralInfo()">
                    <mat-icon>edit</mat-icon> Edit
                </button>
                <button mat-button *ngIf="generalForm.enabled" (click)="generalForm.disable()">
                    Cancel
                </button>
                <button mat-stroked-button
                    [disabled]="userStatus !== 'USER_ON_NO_ACCOUNT' && generalForm.get('emailAddress').value !== this.data.emailAddress"
                    *ngIf="generalForm.enabled" (click)="saveGeneralFormChanges()">
                    Save Changes
                </button>
                <button mat-icon-button *ngIf="generalForm.disabled" (click)="foldGeneral = !foldGeneral">
                    <mat-icon *ngIf="foldGeneral">keyboard_arrow_down</mat-icon>
                    <mat-icon *ngIf="!foldGeneral">keyboard_arrow_up</mat-icon>
                </button>

                <ng-template [ngIf]="generalForm.disabled">

EMAIL

{{this.data.emailAddress}}

                        <mat-icon [class.mr-90]="this.data.emailAddress.length > 25" class="active"
                            [style.color]="(this.data.status == 'Accepted' || this.data.status == 'Active' ) ? '#00B0DB' : '#BDBDBD'">
                            {{ (this.data.status == 'Accepted' || this.data.status == 'Active' ) ? 'check_circle' :
                            'check_circle_outline' }}</mat-icon>
                        <button
                            *ngIf="this.data.status !== 'Active' && this.data.status !== 'Deactivated'  && this.data.status !== 'Accepted'"
                            (click)="resendWelcomeEmailDialog()" mat-button class="detail active">Resend welcome
                            email</button>

FIRST NAME

{{this.data.firstName}}

LAST NAME

{{this.data.lastName}}

PHONE NUMBER

+1 {{this.data.phoneNumber}}

COMPANY NAME

{{this.data.companyName || 'None'}}

TITLE

{{this.data.title || 'None'}}

                </ng-template>

#typescript code
export class UserDetailsComponent implements OnInit {
  isLoading: boolean;
  userId: number;
  isInProgress: boolean;
  data: any;  role:string;
  foldGeneral = false;
  foldSecurity = false;
  foldPassword = false;
  foldTeams = false;
  foldTransactions = false;

  panelOpenState = false;
  @ViewChild(MatAccordion) accordion: MatAccordion;
  AccountRoleIsInProgress: boolean;
  accountRoles: Array<any> = [];
  selectedRole: any;
  defaultRole: any;
  roleId: FormControl;
  fullName: string;
  constructor(
    private _activatedRoute: ActivatedRoute,
    private _notificationService: NotificationService,
    private _userProfileService: UserProfileService,
    private builder: AnimationBuilder,
    private _router: Router,
    private fb: FormBuilder,
    private _userService: UserService,
    private _teamService: TeamService,
    private _accountService: AccountService,

    private scroller: ViewportScroller,

    public dialog: MatDialog
  ) {
    this.generalForm.disable();
    this.securityForm.disable();
    this.passwordForm.disable();
    this.roleId = new FormControl();

  }

  pageHeaderTitleData = {
    title:{
      primary: "User Profile"
    }
  }
  breadCrumbsData = {
    paths:[
      {
        text: "Settings",
      }
    ],
    currentPage: 'Manage Users & Teams'
  }

  generalForm = new FormGroup({
    emailAddress: new FormControl(),
    firstName: new FormControl(),
    lastName: new FormControl(),
    phoneNumber: new FormControl(),
    companyName: new FormControl(),
    title: new FormControl(),
  });

  securityForm = new FormGroup({
    isSso: new FormControl(),
    ssocredentials: new FormControl(),
    roleId: new FormControl(),
  });

  passwordForm = new FormGroup({
    id: new FormControl(),
  });

  ngOnInit(): void {
    this.pageHeaderTitleData.title.primary = "User Profile"
    const currentAccountDetails = localStorage.getItem('currAcct') as any;
    if (currentAccountDetails) {
      this.accountId = JSON.parse(currentAccountDetails).accountId;
    }

    this._activatedRoute.queryParams.subscribe((params) => {
      this.userId = params.id;
      this.getUserGeneralDetails();
      this.getAccountRoleDropdown();
    });
  }

#code for getting the data
getUserGeneralDetails() {
    this.isInProgress = true;
    this._userProfileService
      .getUserGeneralDetails(this.userId, this.accountId)
      .pipe(finalize(() => (this.isInProgress = false)))
      .subscribe({
        next: (res) => {
          if (res.isSuccess) {
            this.data = res.data;
            this.fullName = this.data.firstName + " " + this.data.lastName;
            this.userProfileIcon = `https://ui-avatars.com/api/?size=48&name=${this.data.firstName}+${this.data.lastName}&rounded=true&background=bdbdbd&color=ffffff`;
            this.AccountRoleDetails = this.accountRoles.find(o=>o.id == this.data.roleId);
          }
        },
        error: (err) => this._notificationService.showError(err),
        complete: noop,
      });
  }

#data being loaded
{
    "id": 92,
    "emailAddress": "adasdas@gmail.com",
    "firstName": "asdasd",
    "lastName": "asdasd",
    "phoneNumber": null,
    "associatedAccount": "WLG",
    "status": "Invited",
    "lastLogIn": null,
    "invitedById": null,
    "invitedByDate": "08/19/2021 11:09 AM",
    "identityId": "75312f0d-96dc-497b-a321-81dcae56b0d0",
    "title": "asdasd",
    "companyName": "asdasd",
    "isSso": null,
    "ssocredentials": "",
    "userAccountDto": [
        {
            "id": 96,
            "accountId": 4,
            "accountName": "Wasdas",
            "displayName": "asdas",
            "userRoleDto": {
                "id": 2,
                "roleName": "Broker"
            },
            "accountDto": {
                "accountId": 4,
                "accountName": "sfdsds"
                "displayName": "asdas
                "isActive": true,
                "contactFirstName": null,
                "contactLastName": null,
                "contactPhone": null,
                "contactEmailAddress": null,
                "accountRoleDto": [
                    {
                        "id": 2,
                        "accountId": 4,
                        "roleName": "Broker"
                    },
                    {
                        "id": 1,
                        "accountId": 4,
                        "roleName": "Admin"
                    },
                    {
                        "id": 5,
                        "accountId": 4,
                        "roleName": "Transaction Manager"
                    },
                    {
                        "id": 6,
                        "accountId": 4,
                        "roleName": "Transaction Super User"
                    },
                    {
                        "id": 7,
                        "accountId": 4,
                        "roleName": "Unlicensed User"
                    }
                ]
            }
        }
    ],
    "accountId": 0,
    "roleId": 2,
    "isVerified": false,
    "securityRole": "Broker",
    "ssoEnabled": "No",
    "passwordLastChanged": "",
    "lastLoggedIn": "",
    "teamsDto": [],
    "associatedTransactionDetailsDto": []
}

A: I think use loading, so when your all data is fetched then and only then you will get the UI and it's the way.
show loading in the getUserGeneralDetails() function's first line and then hide loading after subscribe.


text:
Q: 2 Lists - Linking together, having trouble Company description - Widget Rental Services
2 Lists -
List 1 = Customer Order/Scheduler (Non Calendar)
List 2 = Inventory/Asset List
When inputting customer order on list one, we would like to book an asset.  We need to pull available asset from List 2.  When asset is booked or rented out, we need it to show dates next to asset when pulling up asset availability in Customer Order (list 1).
We are stuck and can not get it figured out.  I understand this question is most likely confusing.  I am available for a direct message or call if needed.

A: This seems to be a many-to-many relationship and you need three lists:

*

*Customers

*Assets

*AssetReservation

AssetReservation will have two lookup columns, one pointing to Customers and the other to Assets. It will have [Booking] or [Reservation] date plus any other columns as needed by the business requirements.
Customers list (simplified): LastName and FirstName Single Line and FullName Calculated column with formula =LastName&", "&FirstName .
Make Title column not required.
Assets list: Rename Title to AssetName, Add AssetDescription as Single Line column, and Add TotalQuantity as a Number column
AssetReservation List: Title column may not required and can be set optional. Add ReservationDate as a Date column. For lookup columns, refer to the screenshots below.
Customer Lookup column

Asset Lookup column

Data Entry form for AssetReservation


text:
Q: No symbol for COMDAT section Been working on my own language for some time now and I've been implementing implicit and explicit casts. Went back to check what happens when invoking them. Everything went well, until I tried to invoke a cast from a double. Passing doubles to functions for some reason results in clang giving me an error when linking the obj file to the cpp file that invokes it, namely:"clang.exe: error: linker command failed with exit code 1143 (use -v to see invocation)program.obj : fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section 0x5"
I've then noticed this also happens with floats, but does not occur with integers and the likes. I've written a short function (takes a double by value and returns it) to check whether the problem was related to parameters of types float/double. The error only occurs when invoking the function, when defining the function but not invoking it, everything functioned properly. I've also tried to simply store a double literal in memory (alloca) and that worked as well, so the problem has to be with actually passing the argument to the function.

Simple LLVM IR for a function that takes a double by value and returns it, then being invoked from main (main is names _mainCRTStartup as to not confuse it with the symbol for the main function from the cpp file that then invokes it (extern "C"))
Thanks for any help in advance! :D


text:
Q: Pagefile cannot be located on any drive but C I'm facing a rather weird issue with Windows 10 Pro 21H1 19043.1151: apparently, it refuses to allocate the pagefile on any drive but C.
I'm using a custom-built configuration that includes a 240 GiB scratch disk in addition to 32 GiB of physical memory. Said scratch disk is partitioned into two equal parts, with one of them being intended to be occupied by the Windows pagefile. However, despite me setting a system-managed pagefile for the drive, or setting it to a specific size, after a reboot, the pagefile is gone from the scratch disk, and only the nominal pagefile I left on the system partition remains. If I disable the pagefile on C, the usual error about a missing pagefile pops up.
Not sure what gives here, why the system isn't respecting the pagefile settings I specify. Any ideas?


text:
Q: mongod runs but only outputs all output going to path and that's it I am completely lost at the moment and would greatly appreciate your assistance.  I installed mongoDB through Homebrew and created a data/db directory on my hardrive at the root. Everything seemed fine so far.  I then proceeded to run mongod and I was met with the following :
all output going to: /usr/local/var/log/mongodb/mongo.log

Here is the contents of the log file (the latest section of it) on my last run:
Wed Sep 26 18:46:19 [initandlisten] MongoDB starting : pid=7720 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=Notionworks-MacBook-Pro.local
Wed Sep 26 18:46:19 [initandlisten]
Wed Sep 26 18:46:19 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Wed Sep 26 18:46:19 [initandlisten] db version v2.2.0, pdfile version 4.5
Wed Sep 26 18:46:19 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Wed Sep 26 18:46:19 [initandlisten] build info: Darwin bs-osx-106-x86-64-1.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Wed Sep 26 18:46:19 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log" }
Wed Sep 26 18:46:19 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Wed Sep 26 18:46:19 [initandlisten] recover : no journal files present, no recovery needed
Wed Sep 26 18:46:19 [websvr] admin web console waiting for connections on port 28017
Wed Sep 26 18:46:19 [initandlisten] waiting for connections on port 27017

As far as I can tell, everything looks like it is running correctly (however I don't really know what I'm looking at).  The only thing that seems amis is the dbpath, which according to the documentation defaults to /data/db/
Any help would be greatly appreciated!
EDIT:
Sorry I forgot to mention that I did try to run mongo after running mongod.  Here's the code:
Notionworks-MacBook-Pro:locomotivecms Notionwork$ mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
mongo
db.test.save( { a: 1} )
db.test.find()

Does this look normal to you?  It doesn't return anything...
UPDATE:
Solved it!  I was being silly and trying to enter the command mongo in the same terminal window. I did not realize that you had to open a new window in order to run it.  There was no mention of having to open a new window in mongoDB's set-up tutorial, and I didn't put two and two together.  I was confounded, as I thought that mongoDB was just sitting there thinking...  It works great now!  All I have to figure out now is how to change mongoDB's default path permanently so that I wont have to change it every time with -- dbpath.  Right now it defaults to usr/local/var/mongodb.  I just have to find the config file and change that if possible...  Just found it in the log!  Yay!  I'll see if I can change it! Thanks again for your prompt replies!

A: If you want to start playing around with that instance just type
mongo

in a new terminal or run mongod with --fork

A: Type mongo in the new terminal.

A: The you need to change the limit of your files which is 266 right now.
** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Enter the following in the command-line to change it:
ulimit -n 1000
You might get maxproc error which changing it, you can find out more on this post


text:
Q: Flask request waiting for asynchronous background job I have an HTTP API using Flask and in one particular operation clients use it to retrieve information obtained from a 3rd party API. The retrieval is done with a celery task. Usually, my approach would be to accept the client request for that information and return a 303 See Other response with an URI that can be polled for the response as the background job is finished.
However, some clients require the operation to be done in a single request. They don't want to poll or follow redirects, which means I have to run the background job synchronously, hold on to the connection until it's finished, and return the result in the same response. I'm aware of Flask streaming, but how to do such long-pooling with Flask?

A: Tornado would do the trick.
Flask is not designed for asynchronization. A Flask instance processes one request at a time in one thread. Therefore, when you hold the connection, it will not proceed to next request.


text:
Q: Can't see some properties in Excel Interop from F# I'm using the Microsoft.Office.Interop.Excel library (version 14.0) from an F# application and I can't seem to be able to reference some of the properties defined in Interop's interfaces/classes.
For example, if I have a Worksheet object I can't do the following:
let sht = // Get the Worksheet
sht.PageSetup.CenterHeader <- // Set the header

It can't find CenterHeader as a property of the PageSetup interface, even though it's there if I view the Interop dll in the object browser.
Just for reference, the Interop dll that I'm using is from the VS directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll
Update:
I actually spoke too soon. Unfortunately the suggested solution with the cast didn't work either. VS thinks it's OK but it fails at runtime with the following error:
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.IPageSetup'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208B4-0001-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

A: As I said in the comments, F# doesn't support type equivalence for embedded interop types, so if a C# project has Embed Interop Types enabled then the F# compiler may be unable to determine which version of the interop type to use.  Since the type embedded in the C# output assembly has been stripped down to only the members used, this can make it so that the F# compiler is unable to see members that are present in the version of the type from the primary interop assembly.
The workaround is to turn off Embed Interop Types on the C# project.

A: This works for me:
#if INTERACTIVE
#r "office"
#r "Microsoft.Office.Interop.Excel"
#endif

open Microsoft.Office.Interop.Excel

let setCenterHeader fileName worksheet header =
    let file = System.IO.FileInfo(fileName)
    let excel = ApplicationClass()
    try
        // Make sure to use full path since this will
        // be interpreted as relative to Excel's process,
        // not currently executing one
        let workbook = excel.Workbooks.Open(file.FullName)
        let sheet = workbook.Worksheets.[worksheet] :?> Worksheet

        sheet.PageSetup.CenterHeader <- header

        workbook.Save()
    finally
        excel.Application.Quit()

setCenterHeader "TestWorksheet.xlsx" "Sheet1" "My header 1"
setCenterHeader "TestWorksheet.xlsx" "Sheet2" "My header 2"
setCenterHeader "TestWorksheet.xlsx" "Sheet3" "My header 3"

You might want to make sure you have matching versions of PIA and Office installed/used.


text:
Q: Accessing Store's value inside loop in SvelteJS v3 i am building a dashboard from an array of objects that have store as some of its property. each store are updated independently from different source.
my problem is i am unable to read the store value inside each loop.
to simplify the following code sample, i use tweened instead of store
the following code also available in Svlete REPL
https://svelte.dev/repl/9a17102e7d32471a940ba007e5b56db0?version=3.6.7

    {#each data as item}

{item.label} ({item.$value})

    {/each}

the {item.$value} part returns undefined

A: This isn't currently possible — there's an issue open for 'contextual stores' (#2016) which would let you do this sort of thing...

  {#each data as { label, value }}

{label} ({$value})

  {/each}

...but we're not there yet. In the meantime the workaround is to pass the store to a component:

  {#each data as item}
    <ListItem label={item.label} value={item.value}/>
  {/each}

Inside the component, you'd have export let label, value, and you could use $value as intended.


text:
Q: Delphi abstract function calls with different name than base class Say I've got a function
function GetFieldName(FieldIndex: Integer; FieldName: PChar;
    Len: Integer): Integer; virtual; abstract;

and I'm trying to add
function GetFieldNameA(FieldIndex: Integer; FieldName: PAnsiChar;
    Len: Integer): Integer;

Which will temporarily bridge my database connection for unicode.
I want to continue to call GetFieldName, make it not abstract, and do some bit typecasting to call GetFieldNameA, which will become a technically abstract version of the first GetFieldName.  (I don't want to change the base class at all)
Is there a way, like adding the 'name' keyword for external references, to have an abstract function with a different name in the subclass?
What I'm imagining ending up with is something like:
function GetFieldName(FieldIndex: Integer; FieldName: PChar;
    Len: Integer): Integer;
function GetFieldNameA(FieldIndex: Integer; FieldName: PAnsiChar;
    Len: Integer): Integer name 'GetFieldName Virtual Abstract';

A: No, you can't do what you're proposing.
Instead, override GetFieldName. Have it convert the PChar to a PAnsiChar (if necessary) before calling GetFieldNameA. The latter doesn't have to be (and can't, actually) be marked override. It can be an ordinary non-virtual function.
The unfortunate part of that suggestion is that you'd have to do it in every descendant class. The alternative is to add a virtual abstract GetFieldNameA to the base class and then change all the descendants to override that instead of GetFieldName. Change GetFieldName in the base class to call GetFieldNameA. But that's a non-starter if you can't change the base class.

A: If I understood your question correctly you can trick Delphi by injecting replaced base class.
If the class that declares original GetFieldName is called TClass1 declared in Unit1(pas or dcu), then:

*

*make a new unit (TrickUnit.pas).

*In the TrickUnit.pas add unit of the old class in the uses section (TrickUnit.pas uses Unit1)

*In the TrickUnit.pas declare the class with the same name as the original class, and make it inherit the original class type TClass1 = class(Unit1.TClass1)

*override GetFieldName and add your custom implementation.

*Just add TrickClass.pas at the end of uses section (interface part) of each unit that expects original class

As long as TrickUnit.pas is at the end of uses section, all of your descendants will end up inheriting your replaced class with no code changes other than adding using ......, TrickUnit


text:
Q: Bat file working from terminal not working from Java I found my command line tool gets stuck in between and needs a enter to process and I found that it's because of "QUICKEDIT" mode in cmd and we want to disable it to avoid that. So I searched for Java options to disable quick edit mode on my app launch but I got only bat file from here quickedit.bat.
And this bat file works perfect when I run from my command prompt it disable quick edit mode in the current session itself which is the same I want. So I kept that bat file in my folder via installer and run it first on every launch but it's not turning off the quick edit mode for current session.
I have tried using both process builder and runtime.exec.
Below is my code
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "quickedit.bat");
File dir = new File(System.getProperty("user.home")+File.separator+"AppData"+File.separator+"Local"+File.separator);
pb.directory(dir);
Process p=null;
try {
    p = pb.start();
} catch (IOException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
}

BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
try {
    while ((line = in.readLine()) != null) {
        System.out.println(line);  // ----Here i get the same output i get when i run the bat file
        }
} catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}
BufferedReader inerr = new BufferedReader(new InputStreamReader(p.getErrorStream()));

try {
    while ((line = inerr.readLine()) != null) {
        System.out.println(line);
    }
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

It gives me this:

When I run my bat file directly like this:

But through Java it didn't disable quick edit in my current command prompt whereas it disables at once I run the actual bat file. So can anyone say the reason or how to fix it or any other way to disable it for ever from Java?

A: I didn't look at your bat file the most common issue on this kind of think is that process run from java did'nt share the environnement variable of your local setup nor jvm a quick fix to verify that is :
pb.environment().putAll(System.getenv());

hoping this will work :) then you just have to found which specific environnment variable is missing :)

A: Try pb.inheritIO(); before you call its start method. What you seem to have is a hybrid batch/Powershell script that that relies on stderr to determine which of the two it executes so this should require correct processing of stderr.


text:
Q: Pandas removing rows with incomplete time series in panel data I have a dataframe along the lines of the below:
    Country1  Country2    Year
1    Italy       Greece   2000
2    Italy       Greece   2001
3    Italy       Greece   2002
4    Germany      Italy   2000
5    Germany      Italy   2002
6    Mexico      Canada   2000
7    Mexico      Canada   2001
8    Mexico      Canada   2002
9    US          France   2000
10   US          France   2001
11   Greece      Italy    2000
12   Greece      Italy    2001

I want to keep only the rows in which there are observations for the entire time series (2000-2002). So, the end result would be:
    Country1  Country2    Year
1    Italy       Greece   2000
2    Italy       Greece   2001
3    Italy       Greece   2002
4    Mexico      Canada   2000
5    Mexico      Canada   2001
6    Mexico      Canada   2002

A: One idea is reshape by crosstab and test if rows has not 0 values by DataFrame.ne with DataFrame.all, convert index to DataFrame by MultiIndex.to_frame and last get filtered rows in DataFrame.merge:
df1 = pd.crosstab([df['Country1'], df['Country2']], df['Year'])

df = df.merge(df1.index[df1.ne(0).all(axis=1)].to_frame(index=False))
print (df)
  Country1 Country2  Year
0    Italy   Greece  2000
1    Italy   Greece  2001
2    Italy   Greece  2002
3   Mexico   Canada  2000
4   Mexico   Canada  2001
5   Mexico   Canada  2002

Or if need test some specific range is possible compare sets in GroupBy.transform:
r = set(range(2000, 2003))

df = df[df.groupby(['Country1', 'Country2'])['Year'].transform(lambda x: set(x) == r)]
print (df)
  Country1 Country2  Year
1    Italy   Greece  2000
2    Italy   Greece  2001
3    Italy   Greece  2002
6   Mexico   Canada  2000
7   Mexico   Canada  2001
8   Mexico   Canada  2002

A: One option is to pivot the data, drop null rows and reshape back; this only works if the combination of Country* and Year is unique (in the sample data it is ):
(df.assign(dummy = 1)
   .pivot(('Country1', 'Country2'), 'Year')
   .dropna()
   .stack()
   .drop(columns='dummy')
   .reset_index()
)

  Country1 Country2  Year
0    Italy   Greece  2000
1    Italy   Greece  2001
2    Italy   Greece  2002
3   Mexico   Canada  2000
4   Mexico   Canada  2001
5   Mexico   Canada  2002