text:
Q: Question about coercivity of a functional Hi!
Let $(M,g)$ be a compact Riemannian manifold without boundary of dimension $2m$. Let
$$T:W^{2,2}(M)\rightarrow L^{2}(T^{*}M\otimes TM)$$
be a second order, linear, differential operator (coefficients in local coordinates are bounded smooth functions).
Now consider the fourth order linear operator
$$\Lambda:= T^{*}T: W^{4,2}(M)\rightarrow L^{2}(M)$$
Suppose we know that: $\Lambda$ is Fredholm (finite dimensional kernel and cokernel), is elliptic with index 0 and its principal symbol is equal to that of $\Delta_g^2$.
Let
$$\ker(\Lambda):=span\left[\psi_1,\ldots, \psi_N  \right]$$
with $\psi_i$ a $L^{2}$-orthonormal basis of $\ker(\Lambda)$. Now let
$$\pi_{D}:W^{2,2}(M)\rightarrow W^{2,2}(M)$$
be the continuous projection
$$\pi_{D}(f)=f-\sum_{i=1}^{N}(f,\psi_i)_{L^{2}(M)}\psi_i$$
and define
$$D=\pi_{D}(W^{2,2}(M))$$
Under the above assumptions does exist $C>0$ s.t. $\forall f\in D$ we have
$$\left\| \left|T f\right|_{g}  \right\|_{L^{2}(M)}\geq C\left\|f\right\|_{W^{2,2}(M)}$$
In other words, is $\left\| \left|T f\right|_{g}  \right\|_{L^{2}(M)}^2$
a coercive functional on $D$?

A: I could not quite understand your question due to TeX problems  and here is my best guess. There exists $C>0$ such that for any  $f\in W^{4,2}$  orthogonal to $\ker \Lambda$ we have
$$C \Vert f\Vert_{L^2} \leq \Vert \Lambda f\Vert_{L^2}= \Vert Tf\Vert_{L^2}^2.\tag{1}\label{1} $$
(For a proof of (\ref{1}) check Lemma 10.4.9 of these notes.) Using elliptic estimates  we deduce
$$ \Vert f\Vert_{W^{4,2}} \leq  C'(\Vert f\Vert_{L^2}+ \Vert\Lambda f\Vert_{L^2} ). $$
Using (\ref{1})   we deduce
$$ \Vert f\Vert_{W^{4,2}}\leq C_1 \Vert  Tf\Vert_{L^2}^2$$
Now let
$$\mu =\inf\bigl\lbrace \Vert  Tf\Vert_{L^2};\;\; \Vert f\Vert_{4,2}=1,\;\; f\perp \ker \Lambda\;\bigr\rbrace\geq \frac{1}{\sqrt{C_1}}. $$
We deduce that
$$ \mu \Vert f\Vert_{W^{2,2}}\leq \mu \Vert f\Vert_{W^{4,2} } \leq \Vert Tf\Vert_{L^2},\;\;\forall  f \in W^{4,2},\;\;f\perp \ker \Lambda. $$
Since $W^{4,2}$ is dense in $W^{2,2}$ we obtain the coercivity you were seeking.


text:
Q: How do I groupBy a certain column in laravel Im trying to perfrom a groupBy on my database but I always get an error, Take a look at my code below
public function show($id){
  $building = Building::find($id);
  $offices = Office::where('building_id', $id)->get();
  return view('building')->with('building', $building)->with('offices', $offices)->groupBy('floor',$offices);
}

A: groupBy needs to be called on $offices not on  the view.
Try this way:
public function show($id){
  $building = Building::find($id);
  $offices = Office::where('building_id', $id)->groupBy('floor')->get();
  return view('building')->with('building', $building)->with('offices', $offices);
} }

Also check out the documentation

A: First, yes, the groupBy needs to be added to offices.
Now, the other issue is problably a SQL_MODE problem. Check out your config/database.php, in the connection, change  strict => false like so:
    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', ''),
        'username' => env('DB_USERNAME', ''),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => false,                       // strict to false
        'engine' => 'InnoDB',
    ],

Or....
you can leave strict => true and add modes to mysql like so:
    'mysql' => [
        ...
        'strict' => true,           // keep strict true
        'engine' => 'InnoDB',
        'modes' => [
            //'ONLY_FULL_GROUP_BY', // disable this
            'STRICT_TRANS_TABLES',
            'NO_ZERO_IN_DATE',
            'NO_ZERO_DATE',
            'ERROR_FOR_DIVISION_BY_ZERO',
            'NO_AUTO_CREATE_USER',
            'NO_ENGINE_SUBSTITUTION'
        ],
    ],

You also could change the mode in MySQL. Check out the MySQL docs for more infos in this regard:

*

*https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-strict

*https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by
And there was a pretty good explaination on laravel's modes here: https://github.com/laravel/framework/issues/14997#issuecomment-242129087
Hope that helps

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting a ParseUser from a List using Parse SDK for android? Using the Parse SDK for android, I'm trying to receive a ParseUser from a query, the following code is what I have tried:
ParseQuery<ParseUser> query = ParseUser.getQuery();

Follow.include("author");
query.whereEqualTo("User", "Alex");
query.findInBackground(new FindCallback<ParseUser>() {
public void done(List<ParseUser> objects, ParseException e) {
if (e == null) {
// This is where I want to receive the ParseUser from the List<ParseUser>
ParseUser pu = objects.get("author");
} else {

}

} });

Object.get("author") creates errors.
Thankyou for reading :)

A: ParseUser pu = objects.get("author"); would be incorrect usage. Get method is generally used to get a object at a particular position in the list.

The query returns a list of ParseUsers which you have named as objects.
Now use an iterator to go through the list to access each ParseUser.
like this
for(ParseUser pu : objects){
       //access the data associated with the ParseUser using the get method
       //pu.getString("key") or pu.get("key")
}

Hope this helps!


text:
Q: Write a function in C with linked list Write the C function which receives as input two linked lists with pointers L1 and L2 of float values, and two float values, target1 and target2 and operates as follows:
• Search for elements in L1 with value equal to target1, and elements in L2 with value equal to target2;
• Detaches from L1 the elements with value equal to target1 and connects them in L2 in place of the elements
with value equal to L2; does the opposite for elements of L2 equal to target2. If the number of elements to be
disconnected and reconnected in the two lists are different, the excess elements are connected at the bottom of the list.
i tried to do it but i can't connect the items at the bottom of the list


text:
Q: Buffered/batch serialization in Python? I have an algorithm that iteratively creates a very large, highly nested dictionary. I would like to buffer parts of this dictionary and then periodically stream the buffer to disk so that I can re-create the whole dictionary at another time.
It seems like pickle is intended for one-pass serialization. Is there a way to serialize a dictionary in batches to a single output stream?

A: Ok, it looks like the following will partially solve the problem:
with open('file','ab') as f:
  while <stopping condition>:
    <generate (key,value) pair 'k'>
    pickle.dump(k,f)

Now, to reconstruct the whole dictionary, you just do the following:
with open('file','rb') as f:
    fullMapping = {}
        hasNext = True
        while hasNext:
            try:
                fullMapping.update(pickle.load(f))
            except:
                f.close()
                hasNext = False

This will reconstitute the full dictionary when run.


text:
Q: What parts of Ubuntu are left in ChromeOS? I read that ChromeOS was built on the Ubuntu kernel. So how much of the Ubuntu is left? Is X still available? What about a package manager?

A: No part of ubuntu specifically are included in Chrome (Chromium) OS.  Chrome OS uses a modified, linux kernel.  It uses a custom display manager (so not X) and a minimal shell called cosh, without any advanced features found in bash.
It uses portage to manage packages (the gentoo package manager).


text:
Q: Graphql/Apollo Errors output sometimes data: null sometimes data: { function: null} I'm setting up testing for my graphql. While doing so i realise that sometimes the data object on error cases outputs like that :
{
   errors: [...],
   data: null
}

and sometimes :
{
     errors: [...],
     data: {
        updateCity: null
    }
}

Those test are on mutations. This is an example of both code :
resolver case 1 :
 updateUser(parent, args, context, info) {
      logger.debug('Mutation > updateUser resolver');
      return userController.user.update.user(parent, args.userInfo, context, info);
    },

schema case 1 :
extend type Mutation {
    updateUser(userInfo: UserInfo!): User!
}

controller case 1 :
user: async (parent, args, context, info) => {
    try {
      logger.debug('User Controller : update User');
      await controller.validate(args);
      const userModel = new UserModel('member');
      if (!(await userModel.findOne(args.id))) errorscb.userInputError('User does not exist');
      let id = args.id;
      let newArgs = args;
      delete newArgs.id;
      return userModel.updateById(id, newArgs);
    } catch (e) {
      logger.warn({ stack: e.stack, message: e.message });
      throw e;
    }
  },

schema case 2 :
extend type Mutation {

    updateCity(id: Int!, name: String, countryId: Int): City
}

resolver case 2 :
updateCity(obj, args, context, info) {
      logger.info('City > updateCity resolver');
      return cityController.city.update.city(obj, args, context, info);
    },

controller case 2 :
city: async (parent, args, context, info) => {
    try {
      logger.info('City Controller : update city');

      await controller.validate(args);
      const cityModel = new CityModel('city');
      if (!(await cityModel.findOne(args.id)))
          errorscb.userInputError('City does not exist');
      let id = args.id;
      let newArgs = args;
      delete newArgs.id;
      return cityModel.updateById(id, newArgs);
    } catch (e) {
      logger.warn({ stack: e.stack, message: e.message });
      throw e;
    }

I'd like to obtain a consistent output, anyone knows how to fix that ?

A: This is actually expected behavior.
The difference between updateUser and updateCity in your is that the latter returns a nullable type (City), while the former returns a non-null one (User!). The difference in the responses comes from the fact that errors propagate up the response until they hit a nullable field. From the spec:

If an error is thrown while resolving a field, it should be treated as though the field returned null, and an error must be added to the "errors" list in the response.
If the result of resolving a field is null (either because the function to resolve the field returned null or because an error occurred), and that field is of a Non-Null type, then a field error is thrown. The error must be added to the "errors" list in the response.
...
Since Non-Null type fields cannot be null, field errors are propagated to be handled by the parent field. If the parent field may be null then it resolves to null, otherwise if it is a Non-Null type, the field error is further propagated to it's parent field.

In other words, by throwing an error during a field's resolution, we effectively resolve that field to null. But when we tell GraphQL a field has a Non-Null type, and that field resolves to null, GraphQL cannot return the field with a null value (because that would break the contract of the schema). So it makes the entire parent field null. If the parent field is also non-nullable, it nulls that field's parent field, and so on... until it either reaches a nullable field or the root of the request (the data field).
Compare: Schema 1
type Query {
  a: A
}

type A {
  b: B
}

type B {
  c: String
}

Schema 2
type Query {
  a: A
}

type A {
  b: B
}

type B {
  c: String!
}

Schema 3
type Query {
  a: A!
}

type A {
  b: B!
}

type B {
  c: String!
}

If we request the field c and the resolver for field c throws, the responses are as follows:
Schema 1
{
  "data": {
    "a": {
      "b": {
        "c": null
      }
    }
  }
}

Schema 2
{
  "data": {
    "a": {
      "b": null
    }
  }
}

Schema 3
{
  "data": null
}

A: extend type Mutation {
    updateUser(userInfo: UserInfo!): User!
}

Found the fix, requiring User was unnecessary and removing the exclamation mark fixed my issue (eh... somehow)
updateUser(userInfo: UserInfo!): User!


text:
Q: How can I set transparency of MediaController background in android I want to set the transparency of MediaController background and not controls.
I tried using mediaController.setAlpha(0.6f), but it is applying transparency to controls as well like this

A: Found a tricky solution, that worked for me. The idea is to set background color with desired transparency level only for the specific background layout. This will not have an impact on controls or other MediaController views:
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            public void onPrepared(MediaPlayer mediaPlayer) {
                // get media controller background layout
                LinearLayout viewGroupLevel1 = (LinearLayout)  mediaController.getChildAt(0);
                //Set your color with desired transparency here:
                viewGroupLevel1.setBackgroundColor(getResources().getColor(R.color.transparent));
            }
        });

A: try setting the background color with a transparent color instead of alpha.
For example, with color hex #99CC00:
In your colors.xml:
<resources>
  <color name="NoTransparent">#FF99CC00</color>
  <color name="AlmostTransparent">#4499CC00</color>
  <color name="FullTransparent">#0099CC00</color>
</resources>

Then in your activity:
mediaController.setBackgroundColor(getResources().getColor(R.color.AlmostTransparent));

Or in your layout file:
<MediaController
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/media_controller"
    android:background="@color/AlmostTransparent" />


text:
Q: Why didn't this person kill this other person in Kick-Ass 2? In 'Kick-Ass 2' The Motherf***er and his gang go to Colonel Stars and Stripes living quarters and they proceed to:

 kill Colonel Stars and Stripes and cut off his head

But, when they go to 'Night Bitches' house The Motherf***er and his gang

 only injure 'Night Bitch'

After they did what they did to Colonel Stars and Stripes The Motherf***er issued a warning to all other members of the when 'Battle Guy' says:

We better start walking in pairs, The Motherf***er's Tweet said that this is  just the beginning...

It not like they needed her for the plot (maybe only as happily ever after with love interest Kick Ass) and The Motherf***ers intention were clear that he wanted to kill Kick-Ass and those around him, so I can't see why they spared her?
Was this just a plot issue or did I miss something as to why they left her alive?

A: Absent Word of God, or some explanation from a novelization or the comics, I suspect this falls under the tropes of Spare A Messenger (warning! TVTropes will ruin your life!). If they kill everyone, there's no one to tell the story of how badass they are, and that they're coming after the others.
Other possibilities include appealing to the trope that, for women, the specter of sexual assault is more disturbing for some people than the idea that they might be killed. Or it could be battlefield pragmatism. Wounding a soldier takes them off of the field and forces their compatriots to devote mental and physical resources to their recovery, potentially sidelining multiple people. If Night Bitch had been killed, the others might have moved straight to revenge. As it is, now they have it nagging in the back of their mind as to how Night Bitch is recovering, providing a distraction.


text:
Q: Google Apps Script - Change authorization account Google Apps Scripts may run on behalf of a selected account granting access to resources.
Once development is done, what steps are required to allow running the script on behalf of another user account?


text:
Q: python importing in cmd however not when launching a .py file Seeking advice. Using Anaconda or the standard python prompt i can import packages fine. When making a .py file and double clicking it the script inside will not import any installed packages.
Pre installed such as tkinter, json work fine however manually installed ones such as pandas will not import.
im using the following to test.
try:
  import pandas
except:
    f = open("errorlog.txt", "a")
    f.write("could not import")
    f.close()

I may be missing something here but cant understand why it will work on one but not the other.


text:
Q: How to raname some specific key name in a multidimensional array there
I have a question in array manipulate.
I have a source array like this
 array:6 [
  0 => array:13 [
    "id" => 1
    "name" => "companyName"
    "code" => "1"
    "orderNumber" => 1
    "enabled" => true
    "createSpace" => false
    "description" => "description"
    "lft" => 1
    "lvl" => 0
    "rgt" => 4
    "createdAt" => DateTime {#911
      +"date": "2017-05-04 01:51:22.000000"
      +"timezone_type": 3
      +"timezone": "Asia/Shanghai"
    }
    "updatedAt" => DateTime {#909
      +"date": "2017-05-04 01:51:22.000000"
      +"timezone_type": 3
      +"timezone": "Asia/Shanghai"
    }
    "children" => array:1 [
      0 => array:13 [
        "id" => 7
        "name" => "departmentName"
        "code" => "7"
        "orderNumber" => 7
        "enabled" => true
        "createSpace" => false
        "description" => null
        "lft" => 2
        "lvl" => 1
        "rgt" => 3
        "createdAt" => DateTime {#914
          +"date": "2017-05-09 05:36:55.000000"
          +"timezone_type": 3
          +"timezone": "Asia/Shanghai"
        }

and now I use array_map function to rename the key name for my requirement, "name" to "text",
PHP code is here
$trees = array_map(function($tree) {
                return array(
                    'id' => $tree['id'],
                    'text' => $tree['name'],
                    'children' => $tree['children']
                );
            }, $trees);

and the result is
    array:6 [
      0 => array:3 [
        "id" => 1
        "text" => "departmentName"
        "children" => array:1 [
          0 => array:13 [
            "id" => 7
            "name" => "departmentName"
            "code" => "7"
            "orderNumber" => 7
            "enabled" => true
            "createSpace" => false
            "description" => null
            "lft" => 2
            "lvl" => 1
            "rgt" => 3
            "createdAt" => DateTime {#914
              +"date": "2017-05-09 05:36:55.000000"
              +"timezone_type": 3
              +"timezone": "Asia/Shanghai"
            }
            "updatedAt" => DateTime {#903
              +"date": "2017-05-09 05:36:55.000000"
              +"timezone_type": 3
              +"timezone": "Asia/Shanghai"
            }
            "children" => []
          ]
        ]
      ]
      1 => array:3 [
        "id" => 2
        "text" => "departmentName"
        "children" => []
      ]
      2 => array:3 [
        "id" => 3
        "text" => "departmentName"
        "children" => []
      ]
      3 => array:3 [
        "id" => 4
        "text" => "departmentName"
        "children" => []
      ]
      4 => array:3 [
        "id" => 5
        "text" => "departmentName"
        "children" => []
      ]
      5 => array:3 [
        "id" => 6
        "text" => "departmentName"
        "children" => []
      ]
]

as you can see, it's not work in the sub array that's in the "children" key, how could I change it with the unknown multidimensional array. Thank you.

A: add new key-value pair to your array, then remove the old pair. refer here
$arr[$newkey] = $arr[$oldkey];
unset($arr[$oldkey]);


text:
Q: When to .removeObserver ? The app should load only locally made posts.
Using GeoFire a have a branch "posts_location" in FB.
I want to populate 'nearbyPostsKeys' array first, then load those specific posts from FB's branch posts that has reference REF_POSTS.
In viewDidLoad, I call for a func that has a completion handler(data from FB).
Here is func declaration that takes the completion handler:
func populateNearbyAndPassIt(completion:@escaping ([String])->()) {

    let theGeoFire = GeoFire(firebaseRef: DB_BASE.child("posts_location"))
    let location = CLLocation(latitude: Location.sharedInstance.currentLatitude, longitude: Location.sharedInstance.currentLongitude)
    let circleQuery = theGeoFire!.query(at: location, withRadius: 6.0)

     let newRefHandle: FIRDatabaseHandle = circleQuery!.observe(.keyEntered, with: { (key, location) in

        self.nearbyPostsKeys.append(key!)
        completion(self.nearbyPostsKeys)
    })
}

And here's how I call for that func in 'viewDidLoad':
 populateNearbyAndPassIt{(nearbyPostsKeys) in

        //populate 'posts' based on 'nearby..'

        for key in nearbyPostsKeys {
            let postRef = DataService.ds.REF_POSTS.queryOrdered(byChild: key)
            postRef.observe(.value, with: { (snapshot) in
                self.posts = []
                if let snapshot = snapshot.children.allObjects as? [FIRDataSnapshot] {
                    for snap in snapshot {
                        if let postDict = snap.value as? Dictionary<String, AnyObject> {
                            let key = snap.key
                            let post = Post(postKey: key, postData: postDict)
                            self.posts.append(post)
                        }
                    }
                }
                self.posts.reverse()

                print("Zhenya: here are all local posts data: \(self.posts)")
            })
        }
    }

While having 3 posts on specified location here is what happened:
The .observe is called. 1 posts being retrieved and appends to nearbyPostsKeys -> the completion handler is called. and array with 1 element is passed... and the loop continues.
I wish i could wait until 'nearbyPostsKeys' array is populated and only then pass it as completion handler.
I also learned about .removeObserver func that can stop .observe func but wherever i put it like this:
    let newRefHandle: FIRDatabaseHandle = circleQuery!.observe(.keyEntered, with: { (key, location) in

        self.nearbyPostsKeys.append(key!)
        completion(self.nearbyPostsKeys)
    })
    circleQuery!.removeObserver(withFirebaseHandle: newRefHandle)

it looks as nearbyPostsKeys aren't passed at all.
Please advice on either better logic or on how to use .removeObserver.
Thank you.

A: You should remove observers when your view controller deinitializes:
deinit {
    circleQuery!.removeObserver(withFirebaseHandle: newRefHandle)
}

Just make circleQuery a property of your viewcontroller.


text:
Q: Why doesn't my CSS pop-up message span the width of the browser viewport in IE? I have this for my popup message (like stackoverflow has, you know the "You have earned a badge" "You have new responses" at the top):
#message {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 105;
    background-color:blue;
    font-family:Arial,Helvetica,sans-serif;
    font-size:100%;
    text-align:center;
    font-weight:bold;
  height: 26px;
  width: 100%;
}

Now, I am not good with CSS, but I would like to have an fix for IE. With Firefox, the message box spans the viewport from left to right:
+------------------------------------+
|<---------------------------------->|
|                                    |

...but with IE it reaches the left edge of the viewport, but then it stops like 2 cm before the right edge:
+------------------------------------+
|<---------------------------------> |
|                                    |

Any idea why?

A: If the body (or some other relevant container) might scroll — that is, if it does not have the style overflow: hidden — then IE will (often, at least) pre-reserve space on the right hand side for the scrollbar.  Try setting overflow: hidden on your body tag just to see what happens - that may not be what you need to do overall to get the problem to go away.

A: try setting right:0 aswell as left:0. You can simultaneously set left and right when positioning absolute.


text:
Q: How to scan a folder containing an EMF resource for sibling resources I have developed a DSL with xText and recently add somme enhanced completion.
In a xText-generated editor when calling completion by Ctrl-Space, the completion handler has to perform a folder scanning to look for symbols in another text file of the same DSL.
The entry point is :
public class TypesProposalProvider extends AbstractTypesProposalProvider
{
   public void completeQualifiedName_Path(
      EObject                     model,
      Assignment                  assignment,
      ContentAssistContext        context,
      ICompletionProposalAcceptor acceptor )
   {
      super.completeQualifiedName_Path( model, assignment, context, acceptor );

I use:
      Model root = (Model) context.getRootModel();
      Resource rootRc = root.eResource();

to obtain the emf.ecore container of the model.
And now, how can I look for sibling resources, the other files in the same folder, in term of ecore resource?
With the another resources, I'll call Resource.load() to populate the underlaying emf.ecore model of the siblings.
I hope you understand my approximative English (I'm French)...

A: I am assuming that the sibling models dont refer each other. In that case you can use WorkspaceSynchronizer to get the file from the resource.
Example
Resource rootRc = root.eResource();
IFile file = WorkspaceSynchronizer.getFile(rootRc);

IResource parent = file.getParent();

Iresource[] childern = parent.members();

for(<iterate over children>)
     load the children resources.

Hope this helps.

A: Here is the final version, compact as usual ;-) :
Resource   rootRc = root.eResource();
String     rcPath = rootRc.getURI().toPlatformString( true );
IFile      file   = (IFile)ResourcesPlugin.getWorkspace().getRoot().findMember( rcPath );
IContainer parent = file.getParent();
for( IResource member : parent.members())
{
   String ext = member.getFileExtension();
   if( ext != null && ext.equals( "types" ))
   {
      String prefix     = member.getName();
      String path       = member.getLocation().toString();
      URI    uriSibling = URI.createFileURI( path );
      prefix = prefix.substring( 0, prefix.length() - ".types".length());
      if( ! rcPath.endsWith( '/' + prefix + ".types" )
         && ( context.getPrefix().isEmpty() || prefix.startsWith( cntxtPrefix )))
      {
         Resource types  = rs.createResource( uriSibling );
         types.load( null );
         for( EObject rc : types.getContents())
         {
            ...
         }
      }
   }
}


text:
Q: audio (tag?) info via cmd line or .NET? I know formats such as mp3, ogg and flac have tags such as artist, album etc.
I would like to extract that information if available. Right now i am using ffmpeg to conv the audio so a way to do it within ffmpeg is convenient but not required. My website is writing in C# ASP.NET. I dont mind parsing cmd line output or using a lib call.
What can i use to read the tags for all of these formats?

A: For the specific three you asked, there are two different tagging schemes.
MP3 is typically tagged with ID3; ID3v2 is the most flexible of the bunch.  There are quite a few versions of ID3, and you'll find varying player support. id3lib is the reference library for ID3, and I'm sure there is a managed solution -- since "ID3" is pretty good Google fodder.  By searching StackOverflow with "ID3" I found a lot of recommendations for TagLib Sharp.
Ogg Vorbis (be careful to point out Vorbis) and FLAC share a tagging format called Vorbis Comments.  More Google fodder.
Long and short: You're not looking at one solution, depending on how many formats you want to support.  Each tends to do things their own way.  Another thing you'll run into as you deploy is player inconsistencies -- for a long time when I wrote code that tackled this, iTunes and foobar2000 did Album Artist differently.  I haven't coded this stuff in a while, so it's tough to say where players are today with compatibility.
Best thing to do is grab a few representative samples and jump into your favorite binary editor, to see how different players save their tags.  Don't worry, though: many before you have ventured into tagland.


text:
Q: Definition of increasing functions with $2$ variables $f : \mathbb{R}^2 \to \mathbb{R}$ is increasing if $(x,y) \leq (z,w) \iff f(x,y) \leq f(z,w)$ where $(x,y) \leq (z,w) \iff (x \leq z) \land (y \leq w)$. Is this equivalent to saying $\min\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right) \geq 0$?
Intuitively, if we fix $x$ or $y$, then the equivalence seems to hold. I am trying to verify if that's all I need to do or I am missing cases.

A: Assume $f$ has partial derivatives at all points.
If $f$ is increasing then
$${f(x+h,y)-f(x,y)\over h}\ge 0,\qquad h>0$$ therefore
$${\partial f\over \partial x}(x,y)=\lim_{h\to 0^+}{f(x+h,y)-f(x,y)\over h}\ge 0$$
Similarly
$${\partial f\over \partial y}(x,y)=\lim_{h\to 0^+}{f(x,y+h)-f(x,y)\over h}\ge 0$$
Conversely, assume the partial derivatives are nonnegative at every point. Let $(x,y)\le (w,z).$ Then
$$(x,y)\le (x,z)\le (w,z)$$ Next by the mean value theorem we get
$$f(w,z)-f(x,y)=[f(w,z)-f(x,z)]+[f(x,z)-f(x,y)]\\ =
(w-x){\partial f\over \partial x}(a,z)+(z-y){\partial f\over \partial y}(x,b)\ge 0$$ where $a$ and $b$ are some intermediate points $x\le  a\le  w,$ $y\le  b \le z.$
Remark The same proof gives that if the partial derivatives are positive, the function $f$ is strictly increasing. But the converse is not true: $f(x,y)=x^3+y^3$ is strictly increasing, but both partial derivatives at $(0,0)$ vanish.


text:
Q: Creating new user welcome tips I'd like to create a tooltip bubbles for my site for new users - many other sites do this (most google apps). I'd like to show them for all accounts created within the last week, unless the user specifically 'dismisses' the tip.
I thought about doing this with cookies - ie. set a "-dismissed=True" value that I could check as well as the account creation date and determine whether to show the tips.
However - this doesn't work across browsers, since cookies aren't shared between browsers. So if a user logs into chrome, dismisses the tip then logs in in FF the tip will reappear.
Does anyone know if there is common way to do this sort of thing? Or at least a better way than what i've described?
I'm using browser length sessions so I can't store it in the session.

A: You could have a user preferences model, with a one-to-one relationship to the main user model, which stores preferences like this. Create an instance when the user entry itself is created, and default the 'show tips' field to True.
You could also use the new custom user model functionality in 1.5 to store this in the user model itself, but that seems like overkill here.


text:
Q: Excel VBA- how to carry values from one Userform spreadsheet to another I have a workbook with a purchase order spreadsheet and an invoice spreadsheet. Purchase orders are put into the sheet via a UserForm, which then populates the sheet for me. Works great.
Then I have another worksheet for invoices. This information is also put into its spreadsheet via a UserForm.
The common denominator in both is the purchase order number that is given during the first phase.
I would like to find some way, if possible, to hinge my second spreadsheet and UserForm on this purchase order number. This way, data entry doesn't have to re-enter identifying information and only has to add to that of which is already there.

A: This can be done given UserForm1 is still loaded.  Once finished with the UserForm1 sub routine do not close/unload the userform.  Instead use the following code,
UserForm1.Hide

Then Load UserForm2 and then use the code,
UserForm2.TextBox1.Value = UserForm1.TextBox1.Value
Unload UserForm1

Some issues may arise if the user is able to edit the sheet before starting UserForm2, but if the User starts UserForm2 immediately after finishing UserForm1 this should work.


text:
Q: Sequelize: Custom Method with Where statement I have two Models, a User Model and a Event Model. A user can have many Events.
I am still learning Sequelize and I'm wondering if it's possible to create like a custom method that easily get's me the upcoming Events (column date), so that I can do something like
User.getUpcomingEvents().then(() => {})
I'm coming from Laravel and Eloquent, and that was pretty easy to achieve over there but I'm struggeling to do it in Sequelize and the documentation is still a bit confusing for me.
Appreciate your tips :)

A: If you want to return events independent on the userId value, then you can use classMethods property when defining Model so that later you can call Model.<methodName>. In this case it would be User.getUpcomingEvents()
let User = sequelize.define('User', {
    // attributes...
}, {
    classMethods: {
        getUpcomingEvents: function(userId){
            return sequelize.models.Event.findAll({
                where: {
                    date: { $gt: new Date() },
                    UserId: userId // optional, if you want to return only events of given user
                }
            }).then(events => {
                return events;
            });
        }
    }
});

Otherwise, if you want to return upcoming events of given user, you can also use classMethod that would get userId as parameter, or, you can use instance method so that you can use it like userInstance.<methodName> like user.getUpcomingEvents()
instanceMethods: {
    getUpcomingEvents: function() {
        return this.getEvents({ where: { date: { $gt: new Date() } } }).then(events => {
            return events;
        });
    }
}

Please read the documentation concerning instance and class methods.


text:
Q: Build basic Qt interface with QML I am working on a program which uses an user interface created in QML. The program at it's core have two threads: the main thread in which UI is running and the second thread which will handle all the rest of the work. So program have once class for interfacing with UI and a second class which it's the backend process. The problem is with connecting the slots/signals from UI class to the second class on the second thread.
The code is the following:
main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>

#include "QmlInterface.h"
#include "MainClass.h"

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    qmlRegisterType<QmlInterface>("CppInterface",1,0,"CppInterface");

    /* Ui Stuff */
    QmlInterface qml;
    qml.SetupUI();

    /* Main class */
    MainClass work;
    QObject::connect(&qml, SIGNAL(onButtonClicked()), &work, SLOT(on_ButtonClicked()) );

    return app.exec();
}

QmlInterface.h
#ifndef QMLINTERFACE_H
#define QMLINTERFACE_H

#include <QObject>
#include <QDebug>
#include <QQmlApplicationEngine>

class QmlInterface : public QObject
{
    Q_OBJECT
public:
    explicit QmlInterface();
    virtual ~QmlInterface();
    void SetupUI();

public slots:
    Q_INVOKABLE void buttonClicked();
signals:
    void onButtonClicked();
private:
    QQmlApplicationEngine *engine;
};

#endif // QMLINTERFACE_H

QmlInterface.cpp
#include "QmlInterface.h"

QmlInterface::QmlInterface()
{

}

QmlInterface::~QmlInterface()
{

}

void QmlInterface::SetupUI()
{
    engine = new QQmlApplicationEngine;
    engine->load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine->rootObjects().isEmpty())
    {
        qDebug() << "Failed to load UI";
    }
}

void QmlInterface::buttonClicked()
{
    qDebug() << "Button clicked! Signal to be emited!";
    emit onButtonClicked();
}

MainClass.h
#ifndef MAINCLASS_H
#define MAINCLASS_H

#include <QThread>
#include <QtDebug>

class MainClass : public QThread
{
    Q_OBJECT
public:
    MainClass();
    virtual ~MainClass() {}

public slots:
    void on_ButtonClicked();

private:
    void run();
};

#endif // MAINCLASS_H

MainClass.cpp
#include "MainClass.h"

MainClass::MainClass()
{

}

void MainClass::on_ButtonClicked()
{
    qDebug() << "Button click received in main class!";

}

void MainClass::run()
{
    while(1)
    {
        QThread::sleep(1);
    }
}

And finally main.qml
import QtQuick 2.11
import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Window 2.1

import CppInterface 1.0

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    CppInterface
    {
        id: cpp
    }

    Button
    {
        text: "Click me"
        onPressed: {
            cpp.buttonClicked();
        }
    }

}

The connection between QML and QmlInterface works fine! The problem is with connection between QmlInterface and MainClass.
To be more specific, the problem is that connect() function called in main.cpp seems not to be able to link given signal with given slot from MainClass:
QObject::connect(&qml, SIGNAL(onButtonClicked()), &work, SLOT(on_ButtonClicked()) );

A: The problem is that you have created 2 instances of QmlInterface:
QmlInterface qml;
qml.SetupUI();

and
CppInterface
{
    id: cpp
}

And you have connected the signal of the first instance, and you are emitting the signal using the second instance.
So instead of creating 2 QmlInterface just create one, for convenience you do not create the object in QML and only export the object created in C++ using setContextProperty():
// ...
#include <QQmlContext>
// ...
void QmlInterface::SetupUI()
{
    engine = new QQmlApplicationEngine;
    engine->load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine->rootObjects().isEmpty())
        qDebug() << "Failed to load UI";
    else
        // export
        engine->rootContext()->setContextProperty("cpp", this);
}

*.qml
import QtQuick 2.11
import QtQuick.Controls 2.1
import QtQuick.Window 2.1

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Button
    {
        text: "Click me"
        onPressed: cpp.buttonClicked();
    }
}

On the other hand it is not necessary to register as a type to QmlInterface so you can remove it:
int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    /* Ui Stuff */
    QmlInterface qml;
    qml.SetupUI();

    /* Main class */
    MainClass work;
    QObject::connect(&qml, &QmlInterface::onButtonClicked, &work, &MainClass::on_ButtonClicked );

    return app.exec();
}


text:
Q: How to calculating time difference I'm trying to make a program where i put in to different times and get the difference in minute after clicking the "calculate" button. I'm not sure if my approach is correct, there may be some typo's.
I'v tried to make the different input values to number but it seems like there is another underlying problem which I can't see.

var hour1=document.getElementById("hour1");
var min1=document.getElementById("min1");
var hour2=document.getElementById("hour2");
var min2=document.getElementById("min2");

function calc(){
    var minutt1=Number(hour1)*60+Number(min1);
    var minutt2=Number(hour2)*60+Number(min2);
    var resultat=0;
    resultat = Number(minutt1) - Number(minutt2);
    document.getElementById("result").innerHTML="Time differance is:" + Number(resultat);
}
<input type="number" id="hour1">:
<input type="number" id="min1"> -
<input type="number" id="hour2">:
<input type="number" id="min1">
<button type="button" onclick="calc()">Regn ut</button>

I expect getting a number which represents the time difference in minutes, but the actual output is "NaN".

A: You need to get the value of hour1, min1, hour2, and min2. You also don't have an element min2:
var hour1=document.getElementById("hour1").value;
var min1=document.getElementById("min1").value;
var hour2=document.getElementById("hour2").value;
var min2=document.getElementById("min2").value;

What your code was trying to do was multiply and subtract HTML elements (never a good idea).

var hour1 = document.getElementById("hour1").value;
var min1 = document.getElementById("min1").value;
var hour2 = document.getElementById("hour2").value;
var min2 = document.getElementById("min2").value;

function calc() {
  var minutt1 = Number(hour1) * 60 + Number(min1);
  var minutt2 = Number(hour2) * 60 + Number(min2);
  var resultat = 0;
  resultat = Number(minutt1) - Number(minutt2);
  document.getElementById("result").innerHTML = "Time differance is:" + Number(resultat);
}
<input type="number" id="hour1">:
<input type="number" id="min1"> -
<input type="number" id="hour2">:
<input type="number" id="min2">
<button type="button" onclick="calc()">Regn ut</button>

A: Other answers are close, but you need to get the value of the inputs after you click the button

var hour1 = document.getElementById("hour1");
var min1 = document.getElementById("min1");
var hour2 = document.getElementById("hour2");
var min2 = document.getElementById("min2");

window.calc = function () {
  var minutt1 = parseInt(hour1.value) * 60 + parseInt(min1.value);
  var minutt2 = parseInt(hour2.value) * 60 + parseInt(min2.value);
  var resultat = minutt1 - minutt2;
  document.getElementById("result").innerHTML = "Time differance is:" + resultat;

  console.log({minutt1:minutt1,minutt2:minutt2,resultat:resultat,
  hour1:hour1,min1:min1,
  hour2:hour2,min2:min2
  })
};
<input type="number" id="hour1">:
<input type="number" id="min1"> -
<input type="number" id="hour2">:
<input type="number" id="min2">
<button type="button" onclick="calc()">Regn ut</button>


text:
Q: Stitched ripped clothes vs stitched and ripped clothes I think that stitched ripped clothes are clothes whose the ripped part is stitched and stitched and ripped clothes are clothes whose the stitched part is ripped. Am I right?
In this context, the clothes are one pair of clothes.

A: As is often the case with this sort of list, the reality is always going to be ambiguous.
"Stitched, ripped clothes" implies clothes that have been ripped, but then repaired. (Note that I added a comma.)
"Stitched and ripped clothes" similarly implies clothes that have been repaired, but if contrasted with the first example, suggests that further ripping has occurred AFTER the repair. This is quite a weak implication though.
Clothes can generally be assumed to have been stitched as part of the process of creation, however the context here pretty much precludes the possibility that "Stitched" refers to that process.


text:
Q: Java implementation of C++ encrypt decrypt function(Cryptix toolbox) Hi I am trying to encrypt and decrypt data that is used in 2 systems( The one is C++ and the other Java) I found a Demo project from code project : Encryption  this is the c++ encrypt decrypt functions and it works when I implement the code using the functions :
void main()
{
    try
    {
        CRijndael oRijndael;
        oRijndael.MakeKey("abcdefghabcdefgh", "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, 16);
        char szDataIn[] = "Password12345678";

        char szDataOut[17] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";

        oRijndael.EncryptBlock(szDataIn, szDataOut);

        cout << "[" << szDataIn << "]" << endl;
        cout << "[" << szDataOut << "]" << endl;
        memset(szDataIn, 0, 16);

        oRijndael.DecryptBlock(szDataOut, szDataIn);
        cout << "[" <<  szDataIn << "]"  << endl;

    }
    catch(exception& roException)
    {
        cout << roException.what() << endl;
    }
}

This gives me the following output in the console :

The data is encrypted end decrypted..
Could any one please help me or point me in the right direction for the Java implementation to encrypt and decrypt the same data getting the same results ( encrypt in C++ and then decrypt in Java and encrypt in java decrypt in c++)? In the post they talk about  Cryptix toolkit?
Thanks in advance.

A: This Java code will encrypt/decrypt and produce the same output as your example encoded to hex. The output appears to be identical (and should be), but to be 100% sure you'll need to hex encode the output in your C++ example.
Do note though that your example will only encrypt and decrypt a single block (16 bytes). If you want more than that you'll need to use the CRijndael Encrypt and Decrypt methods (instead of EncryptBlock and DecryptBlock). The Java code below will work with both, no need to modify it.
public static void main(String[] args) throws DecoderException, InvalidKeyException,
        NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException,
        IllegalBlockSizeException, BadPaddingException {
    //Hex encoding/decoding done with Apache Codec
    byte[] key = "abcdefghabcdefgh".getBytes();
    String text = "Password12345678";

    byte[] encrypted = encrypt(key, text.getBytes());
    byte[] decrypted = decrypt(key, encrypted);

    System.out.println("Text: " + text);
    System.out.println("Encrypted: " + Hex.encodeHexString(encrypted));
    System.out.println("Decrypted: " + new String(decrypted));
}

public static byte[] encrypt(byte[] key, byte[] unencrypted) throws NoSuchAlgorithmException,
        NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException,
        IllegalBlockSizeException, BadPaddingException{
    //Set up the cipher and encrypt
    Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
    cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
    byte[] encrypted = cipher.doFinal(unencrypted);

    return encrypted;
    }

public static byte[] decrypt(byte[] key, byte[] encrypted) throws NoSuchAlgorithmException,
        NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException,
        IllegalBlockSizeException, BadPaddingException{
    //Decrypt the encrypted text
    Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
    cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
    byte[] decrypted = cipher.doFinal(encrypted);

    return decrypted;
}

Output
Text: Password12345678
Encrypted: 6c7d800fad2bb8593db92847bbbdbeff
Decrypted: Password12345678

A big word of warning to you though, this encryption (ECB, no padding) is highly insecure and you should never use it in a real system. You should really be using CBC with an Initialization Vector and PKCS5 padding.

A: Be sure not to export encrypted data from char array directly. Either use fixed size output or use byte buffer. It's mandatory because in encrypted string you may have byte combinations that could be interpreted as controll characters, f.e. \0 mark. If that, printing output to file using ...<< szDataOut; may corrupt your encrypted string and unable to full read it by second application (no matter if java or c++).


text:
Q: FloatingActionBar cannot show out I have face the problem that I cannot use these 2 rows in my apps. I want to make the FloatingActionBar show between the CollapsingToolbarLayout and the RecycleView. Anyone know what is the problem of this? If I didn't put these 2 rows it's by default place at top left and can show out after run in phone. If I put it and run, it cannot show on my phone.
<!--app:layout_anchor="@+id/appbar"-->
<!--app:layout_anchorGravity="bottom|right|end"-->

XML File
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/purplewhite"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

            <ImageView
                android:id="@+id/header"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/header2"
                android:fitsSystemWindows="true"
                android:scaleType="fitXY"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/anim_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycle_menu"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/search_item"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clickable="true"

        android:src="@drawable/ic_search_black_24dp"
        app:backgroundTint="@color/alice_blue" />

    <!--app:layout_anchor="@+id/appbar"-->
    <!--app:layout_anchorGravity="bottom|right|end"-->

</android.support.design.widget.CoordinatorLayout>

Image1

A: <android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

        <ImageView
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/header2"
            android:fitsSystemWindows="true"
            android:scaleType="fitXY"
            app:layout_collapseMode="parallax" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/anim_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    </android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycle_menu"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/search_item"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@drawable/ic_search_black_24dp"
    app:backgroundTint="@color/alice_blue" />

<!--app:layout_anchor="@+id/appbar"-->
<!--app:layout_anchorGravity="bottom|right|end"-->


text:
Q: How to search a specific transaction in all blocks quickly How can I search a transaction in a blockchain quickly, which may contains thousands of blocks?

A: A block explorer is what you need.
A block explorer allows you to search and navigate through the blockchain.
How does a block explorer accomplish this? It does all this work:

*

*Connects to blockchain nodes and listens for blocks Parses blocks and

*Indexes the block, tarnsaction information into a Database

*Provides a webservice that allows you to query this database

Also look at this wonderful answer


text:
Q: Django ModelChoice Field Conditional ForeignKey I've surfed most of the afternoon and have been at this particular quandry for a while.
I am trying to figure out how to essentially present a foreign key as a dropdown choice if the user has driven that type of car.  For example purposes and to keep this as easy as possible...
Let's say I have  aCars, Manufacturers and a UserProfile model.
I have a model for Cars as so...
class Cars(models.Model):

    car_name = models.CharField(max_length=80)
    class = models.ForeignKey(Manufacturer,null=True,on_delete=models.DO_NOTHING,related_name='car_manufacturer')

I have a model for Manufacturers as so...
class Manufacturers(models.Model):

        manu_name = models.CharField(max_length=80)

Then I have a UserProfile model....
class Userprofile(models.Model):

   user = models.OneToOneField(User,on_delete=models.CASCADE)
   user_name = models.CharField(max_length=80)
   car_owned = models.ForeignKey(Car,null=True,on_delete=models.DO_NOTHING,related_name='car_owned')

All good so far...
I have a view where I am listing all of the Manufacturers and this works fine as well.  It shows all of the manufacturers that I would expect in the form view below.
class ManufacturerForm(forms.Form):

    dropdown = forms.ModelChoiceField(queryset=Manufacturer.objects.all())

    def __init__(self, *args, **kwargs):
        super(ManufacturerForm, self).__init__(*args, **kwargs)
        self.fields['dropdown'].widget.attrs['class'] = 'choices1'
        self.fields['dropdown'].empty_label = ''

I'm using the FORMVIEW below to display the form...
class ManufacturerView(LoginRequiredMixin,FormView):
    form_class = ManufacturerForm
    template_name = 'Directory/HTMLNAME.html'

    def get_form_kwargs(self):
        kwargs = super(ManufacturerView, self).get_form_kwargs()
        kwargs['user'] = self.request.user
        return kwargs

    def form_valid(self, form):
        manufacturer = form.cleaned_data['dropdown']
        return HttpResponseRedirect(reverse("NAME:manufacturer",kwargs={'pk':manufacturer.pk}))

This all works fine.  However, I can't figure out how to limit the manufacturer dropdown to only the cars the user has driven.  I'm trying to essentially limit the dropdown display to only the manufacturers that are pertinent to the cars the user has owned based on their profile.  I've researched reverse look ups and have also tried something similar to what is outlined below to solve my problem...
class ManufacturerForm(forms.Form):

    dropdown = forms.ModelChoiceField(queryset=Manufacturer.objects.filter(car_manufacturer=1)

    def __init__(self, *args, **kwargs):
        super(ManufacturerForm, self).__init__(*args, **kwargs)
        self.fields['dropdown'].widget.attrs['class'] = 'choices1'
        self.fields['dropdown'].empty_label = ''

But this obviously only gives me record 1 for the Manufacturer model.  I am trying to figure out how to display only the records that are relevant to an individual user based on their car_owned data.  I can list all of the manufacturers and then just display the records that are relevant in a ListView, but I am trying to limit the dropdown to only where there are relevant records in a ListView.  Thanks in advance for any thoughts.

A: You missed just couple of points:
1) Pass UserProfile as kwargs['user']:
kwargs['user'] = UserProfile.objects.get(user=self.request.user)

2) Add user parameter in form's __init__ signature and override dropdown.queryset there:
class ManufacturerForm(forms.Form):
    dropdown = forms.ModelChoiceField(queryset=Manufacturer.objects.all())

    def __init__(self, user, *args, **kwargs):
        super(ManufacturerForm, self).__init__(*args, **kwargs)
        self.fields['dropdown'].widget.attrs['class'] = 'choices1'
        self.fields['dropdown'].empty_label = ''
        self.fields['dropdown'].queryset = Manufacturer.objects.filter(car_manufacturer__car_owned=user)

Also I would like to recommend to rewrite your Car - User relationship to ManyToMany. If I understand correctly your message, User can have multiple cars:

limit the dropdown display to only the manufacturers that are
  pertinent to the cars the user has owned

Also if I understand correctly, you want to track cars that user used to have (but doesn't have anymore).
If you rewrite Car - User relationship, then you won't probably have any reason to keep UserProfile model only to hold additional username. If so, your models.py should look like this:
class Manufacturer(models.Model):
    name = models.CharField(max_length=80)

class Car(models.Model):
    name = models.CharField(max_length=80)
    klass = models.ForeignKey(Manufacturer, null=True, on_delete=models.DO_NOTHING, related_name='car_manufacturer')
    owners = models.ManyToManyField(User, through='Ownership')

class Ownership(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    car = models.ForeignKey(Car, on_delete=models.CASCADE)
    active = models.BooleanField(default=True)   # True if user owns the car at the moment

A: I think it all hinges on your order and relationships between models, perhaps try adding in a ManyToMany relation between Manufacturer and Car, so one manufacturer can make many cars:
class Manufacturer(models.Model):
name = models.CharField(max_length=80)
car = models.ManyToManyField(Car)

Then it may be a case of doing something such as:
qs = Manufacturer.objects.all(car=user.car_owned)

dropdown = forms.ModelChoiceField(qs)

And in your views.py file:
form = ManufacturerForm(request.POST, user=request.user)

(You may need to look up if the above is valid, as I'm not sure if Forms can have the request object passed in).
Disclaimer: I see you're using a class based view...so I may need to tweak the above.


text:
Q: getting error org.springframework.beans.BeanInstantiationException:      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PNLResultDAOImpl' defined in file [C:\EclipseWS1\SpringJDBCExample\target\classes\com\synechron\tom\pnl\dao\impl\PNLResultDAOImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.synechron.tom.pnl.dao.impl.PNLResultDAOImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    ... 24 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.synechron.tom.pnl.dao.impl.PNLResultDAOImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

Can you help me to know why this error occurred?

A:
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.synechron.tom.pnl.dao.impl.PNLResultDAOImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException

Check your constructor for class com.synechron.tom.pnl.dao.impl.PNLResultDAOImpl , it throws NullPointerException so spring is unable to initialize that bean

A: If you are using default constructor in PNLResultDAOImpl class and from that you are calling the pnlBucketDAO.find(pnlBucket) method then you can use @Qualifier in the default constructor to inject the bean for pnlBucketDAO.
For ex.
@Autowired(required = true)
public PNLResultDAOImpl(@Qualifier("pnlBucketDAO") BasketBallGameModel model) {
       pnlBucketDTDIndex = pnlBucketDAO.find(pnlBucket);
}


text:
Q: Issue with full HDD I "thought " I did everything correctly.
I have 2 HDDs
Dev/sda
     sda1
     sda2
Dev/sdg
   sdg1

sdg1 "should" have a folder on it called backup3tb in its root
When I look in /mnt/backup3tb I see the files I am looking for.
However my sda2 appears to be full.
How do I verify that in fact the backup3tb is on the 3TB /dev/sdg1 and not an incorrect resource to the main hdd?

A: From a terminal (stat one with the keys:  ctrl + alt + t ) type
df

and the first and last columns will tell you if you have mounted sdg1 at /mnt/...  If there is no such entry, then the directory in /mnt is in the root filesystem.

To list all the (mounted and unmounted) filesystems, type:
sudo blkid

The output will also tell you the filesystem type on the partition.

A: There are a few options that list mount points together with their backing drive, each with more or less nicely formatted, human-readable output and contextual information:

*

*Gnome Disks

*GParted

*KDE Partition Manager

*lsblk (or sudo lsblk -f for more info)

*df

*mount

*cat /proc/mounts


text:
Q: Difficulty reading SOAP response due to special chars I have been dealing with SOAP Request/Responses, using C#. I am given how both the request and response format should be. I have successfully created a [WebMethod] that sends a request and I can retrieve the XML response from it. The problem is that the response I get looks like this
<soapenv:Header>
<v1:ResultStatus xmlns:v1="http://group.com/contract/vho/header/v1">
<bf:Timestamp xmlns:bf="http://docs.oasis-open.org/wsrf/bf-2">27-Nov-17 1:42:24 PM</bf:Timestamp>
<bf:ErrorCode xmlns:bf="http://docs.oasis-open.org/wsrf/bf-2">OK</bf:ErrorCode>
<bf:Description xmlns:bf="http://docs.oasis-open.org/wsrf/bf-2">Integration Id cannot be retrieved for this user</bf:Description>
<v11:Message xmlns:v11="http://group.com/schema/common/v1">FAILURE</v11:Message>
</v1:ResultStatus>
</soapenv:Header>

<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<v1:CheckAuthenticationCredentialVBMResponse xmlns:v1="http://group.com/schema/vbm/identity/authentication-credential/v1">
<v1:AuthenticationCredentialVBO actionCode="ADD">
<v11:IDs xmlns:v11="http://group.com/schema/common/v1">
<v11:ID schemeName="Authentication Credential ID">5535</v11:ID>
</v11:IDs>
</v1:CheckAuthenticationCredentialVBMResponse>
</SOAP-ENV:Body>

And when I try to read it using XmlDocument xmldoc.GetElementsByTagName("bf:ErrorCode"); or XmlDocument xmldoc.GetElementsByTagName("v11:Message"); it considers : as special char and therefore cannot continue the execution, throwing this exception:
The ':' character, hexadecimal value 0x3A, cannot be included in a name.

I have tried to find some kind of documentation about this, but I cannot seem to find something similar. Can someone help?
Please comment if further information is needed.

A: bf:ErrorCode is xml element ErrorCode in namespace indicated by prefix bf. What namespace is represented by this prefix you can see in declaration:
xmlns:bf="http://docs.oasis-open.org/wsrf/bf-2"

So bf:ErrorCode is element ErrorCode in namespace http://docs.oasis-open.org/wsrf/bf-2. Note that prefix name ("bf") is irrelevant, all that matters is namespace itself ("http://docs.oasis-open.org/wsrf/bf-2"). For that reason you should not search elements by namespace prefix, because it might change any time without changing meaning of xml document. You should only search by namespace.
With that knowledge you can get such elements like this:
string targetNamespace = "http://docs.oasis-open.org/wsrf/bf-2";
var elements = doc.GetElementsByTagName("ErrorCode", targetNamespace);

Note that documentation of GetElementsByTagName suggests to not use this method and instead use SelectNodes. You can do the same with SelectNodes like this:
var doc = new XmlDocument();
doc.LoadXml(xml);
var nsManager = new XmlNamespaceManager(doc.NameTable);
// note that prefix doesn't _need_ to be "bf"
// (though it could be "bf" if you wish)
nsManager.AddNamespace("anyPrefixHere", "http://docs.oasis-open.org/wsrf/bf-2");
// use the same prefix here you used in `AddNamespace` call above
var elements = doc.SelectNodes("//anyPrefixHere:ErrorCode", nsManager);


text:
Q: A vector map for South East Asia I am trying to come up with a jVectorMap for South East Asian countries. I used following links as reference:

*

*http://techslides.com/creating-maps-for-jvectormap/

*china jVectorMap - Kibana

*few more jVectorMaps - Kibana
from the 1st link's example of South America, I understand that scaling of co-ordinates is needed. with China as reference, Following is my js code for SEAsia:
    $.fn.vectorMap('addMap', 'asean',{"insets": [{"width": 900.0, "top": 0, "height": 440.7063107441331, "bbox": [{"y": -12671671.123330014, "x": -20004297.151525836}, {"y": 3930392.025135122, "x": 10026572.394749384}], "left": 0}], "paths": {
"MM": {"path": "M670.1,233.39l-1.46,1.11l-1.68,0.11l-0.26,0.19l-1.1,2.7l-0.95,0.42l-0.14,0.42l1.21,2.27l1.61,1.92l0.94,1.55l-0.82,1.99l-0.77,0.42l-0.13,0.39l0.64,1.35l1.62,1.97l0.26,1.32l-0.04,1.15l0.02,0.13l0.92,2.18l-1.3,2.23l-0.79,1.69l-0.1,-0.77l0.74,-1.87l-0.02,-0.26l-0.8,-1.42l0.2,-2.68l-0.06,-0.2l-0.98,-1.27l-0.8,-2.98l-0.45,-3.22l-1.11,-2.22l-0.45,-0.1l-1.64,1.28l-2.74,1.76l-1.26,-0.2l-1.27,-0.49l0.79,-2.93l0.0,-0.14l-0.52,-2.42l-1.93,-2.97l0.26,-0.8l-0.22,-0.39l-1.37,-0.31l-1.65,-1.98l-0.12,-1.5l0.41,0.19l0.42,-0.26l0.05,-1.7l1.08,-0.54l0.16,-0.34l-0.24,-1.0l0.5,-0.79l0.05,-0.15l0.08,-2.35l1.58,0.49l0.36,-0.15l1.12,-2.19l0.15,-1.34l1.35,-2.18l0.04,-0.17l-0.07,-1.35l2.97,-1.71l1.67,0.45l0.38,-0.33l-0.18,-1.46l0.7,-0.4l0.15,-0.32l-0.13,-0.72l0.94,-0.13l0.74,1.41l0.11,0.12l0.95,0.56l0.07,1.89l-0.09,2.08l-2.28,2.15l-0.09,0.19l-0.3,3.15l0.35,0.32l2.37,-0.39l0.53,2.17l0.2,0.21l1.3,0.42l-0.63,1.9l0.14,0.36l1.86,0.99l1.1,0.49l0.24,0.0l1.45,-0.6l0.04,0.51l-2.01,1.6l-0.56,0.96l-1.34,0.56Z", "name": "Myanmar"},
"SG": {"path": "M103.97,1.331L103.82,1.265L103.65,1.326L103.705,1.423L103.818,1.447L103.909,1.416L103.961,1.392L103.996,1.365L103.97,1.331z","name": "Singapore"}
"TH": {"path": "M677.42,253.68l-1.7,-0.88l-0.14,-0.03l-1.77,0.04l0.3,-1.64l-0.3,-0.35l-2.21,0.01l-0.3,0.28l-0.2,2.76l-2.15,5.9l-0.02,0.13l0.17,1.83l0.28,0.27l1.45,0.07l0.93,2.1l0.44,2.15l0.08,0.15l1.4,1.44l0.16,0.09l1.43,0.27l1.04,1.05l-0.58,0.73l-1.24,0.22l-0.15,-0.99l-0.15,-0.22l-2.04,-1.1l-0.36,0.06l-0.23,0.23l-0.72,-0.71l-0.41,-1.18l-0.06,-0.11l-1.33,-1.42l-1.22,-1.2l-0.5,0.13l-0.15,0.54l-0.14,-0.41l0.26,-1.48l0.73,-2.38l1.2,-2.57l1.37,-2.35l0.02,-0.27l-0.95,-2.26l0.03,-1.19l-0.29,-1.42l-0.06,-0.13l-1.65,-2.0l-0.46,-0.99l0.62,-0.34l0.13,-0.15l0.92,-2.23l-0.02,-0.27l-1.05,-1.74l-1.57,-1.86l-1.04,-1.96l0.76,-0.34l0.16,-0.16l1.07,-2.63l1.58,-0.1l0.16,-0.06l1.43,-1.11l1.24,-0.52l0.84,0.62l0.13,1.43l0.28,0.27l1.34,0.09l-0.54,2.39l0.05,2.39l0.45,0.25l2.48,-1.45l0.6,0.36l0.17,0.04l1.47,-0.07l0.25,-0.15l0.41,-0.73l1.58,0.15l1.76,1.93l0.15,2.44l0.08,0.18l1.94,2.15l-0.1,1.96l-0.66,0.93l-2.25,-0.34l-3.24,0.49l-0.19,0.12l-1.6,2.12l-0.06,0.24l0.48,2.46Z", "name": "Thailand"},
"VN": {"path": "M690.8,230.21l-2.86,1.93l-2.09,2.46l-0.06,0.11l-0.55,1.8l0.04,0.26l4.26,6.1l2.31,1.63l1.46,1.97l1.12,4.62l-0.32,4.3l-1.97,1.57l-2.85,1.62l-2.09,2.14l-2.83,2.13l-0.67,-1.19l0.65,-1.58l-0.09,-0.35l-1.47,-1.14l1.67,-0.79l2.57,-0.18l0.22,-0.47l-0.89,-1.24l3.88,-1.8l0.17,-0.24l0.31,-3.05l-0.01,-0.13l-0.56,-1.63l0.44,-2.48l-0.01,-0.15l-0.63,-1.81l-0.08,-0.12l-1.87,-1.77l-3.64,-5.3l-0.11,-0.1l-2.68,-1.39l0.45,-0.59l1.53,-0.65l0.16,-0.39l-0.97,-2.27l-0.27,-0.18l-2.89,-0.02l-1.04,-2.21l-1.28,-1.83l0.96,-0.46l1.97,0.01l2.43,-0.3l0.13,-0.05l1.95,-1.29l1.04,0.85l0.13,0.06l1.98,0.42l-0.32,1.21l0.09,0.3l1.19,1.07l0.12,0.07l1.88,0.51Z", "name": "Vietnam"},
"MY": {"path": "M717.6,273.52l-1.51,0.7l-2.13,-0.41l-2.88,-0.0l-0.29,0.21l-0.84,2.77l-0.9,0.82l-0.08,0.12l-1.23,3.34l-1.81,0.47l-2.29,-0.68l-0.14,-0.01l-1.2,0.22l-0.14,0.07l-1.36,1.18l-1.47,-0.17l-0.12,0.01l-1.46,0.46l-1.51,-1.25l-0.24,-0.97l1.26,0.59l0.2,0.02l1.93,-0.47l0.22,-0.22l0.47,-1.98l0.9,-0.4l2.97,-0.54l0.17,-0.09l1.8,-1.98l1.02,-1.32l0.9,1.03l0.48,-0.04l0.43,-0.7l1.02,0.07l0.32,-0.27l0.25,-2.72l1.84,-1.67l1.23,-1.89l0.73,-0.01l1.12,1.11l0.1,0.99l0.18,0.24l1.66,0.71l1.85,0.67l-0.09,0.51l-1.45,0.11l-0.26,0.4l0.35,0.97ZM673.78,269.53l0.17,1.14l0.35,0.25l1.65,-0.3l0.18,-0.11l0.68,-0.86l0.31,0.13l1.41,1.45l0.99,1.59l0.13,1.57l-0.26,1.09l0.0,0.15l0.24,0.84l0.18,1.46l0.11,0.2l0.82,0.64l0.92,2.08l-0.03,0.52l-1.4,0.13l-2.29,-1.79l-2.86,-1.92l-0.27,-1.16l-0.07,-0.13l-1.39,-1.61l-0.33,-1.99l-0.05,-0.12l-0.84,-1.27l0.26,-1.72l-0.03,-0.18l-0.45,-0.87l0.13,-0.13l1.71,0.92Z", "name": "Malaysia"},
"ID": {"path": "M756.56,287.86l0.69,4.02l0.15,0.21l2.59,1.5l0.39,-0.07l2.05,-2.61l2.75,-1.45l2.09,-0.0l2.08,0.85l1.85,0.89l2.52,0.46l0.08,15.44l-1.72,-1.6l-0.15,-0.07l-2.54,-0.51l-0.29,0.1l-0.53,0.62l-2.53,0.06l0.78,-1.51l1.48,-0.66l0.17,-0.34l-0.65,-2.74l-1.23,-2.19l-0.14,-0.13l-4.85,-2.13l-2.09,-0.23l-3.7,-2.28l-0.41,0.1l-0.67,1.11l-0.63,0.14l-0.41,-0.67l-0.01,-1.01l-0.14,-0.25l-1.39,-0.89l2.05,-0.69l1.73,0.05l0.29,-0.39l-0.21,-0.66l-0.29,-0.21l-3.5,-0.0l-0.9,-1.36l-0.19,-0.13l-2.14,-0.44l-0.65,-0.76l2.86,-0.51l1.28,-0.79l3.75,0.96l0.32,0.76ZM758.01,300.37l-0.79,1.04l-0.14,-1.07l0.4,-0.81l0.29,-0.47l0.24,0.31l-0.0,1.0ZM747.45,292.9l0.48,1.02l-1.45,-0.69l-2.09,-0.21l-1.45,0.16l-1.28,-0.07l0.35,-0.81l2.86,-0.1l2.58,0.68ZM741.15,285.69l-0.16,-0.25l-0.72,-3.08l0.47,-1.86l0.35,-0.38l0.1,0.73l0.25,0.26l1.28,0.19l0.18,0.78l-0.11,1.8l-0.96,-0.18l-0.35,0.22l-0.38,1.52l0.05,0.24ZM741.19,285.75l0.76,0.97l-0.11,0.05l-0.65,-1.02ZM739.18,293.52l-0.61,0.54l-1.44,-0.38l-0.25,-0.55l1.93,-0.09l0.36,0.48ZM728.4,295.87l-0.27,-0.07l-2.26,0.89l-0.37,-0.41l0.27,-0.8l-0.09,-0.33l-1.68,-1.37l0.17,-2.29l-0.42,-0.3l-1.67,0.76l-0.17,0.29l0.21,2.92l0.09,3.34l-1.22,0.28l-0.78,-0.54l0.65,-2.1l0.01,-0.14l-0.39,-2.42l-0.29,-0.25l-0.86,-0.02l-0.63,-1.4l0.99,-1.61l0.35,-1.97l1.24,-3.73l0.49,-0.96l1.95,-1.7l1.86,0.69l3.16,0.35l2.92,-0.1l0.17,-0.06l2.24,-1.65l0.11,0.14l-1.8,2.22l-1.72,0.44l-2.41,-0.48l-4.21,0.13l-2.19,0.36l-0.25,0.24l-0.36,1.9l0.08,0.27l2.24,2.23l0.4,0.02l1.29,-1.08l3.19,-0.58l-0.19,0.06l-1.04,1.4l-2.13,0.94l-0.12,0.45l2.26,3.06l-0.37,0.69l0.03,0.32l1.51,1.95ZM728.48,295.97l0.59,0.76l-0.02,1.37l-1.0,0.55l-0.64,-0.58l1.09,-1.84l-0.02,-0.26ZM728.64,286.95l0.79,-0.14l-0.07,0.39l-0.72,-0.24ZM732.38,310.1l-1.89,0.49l-0.06,-0.06l0.17,-0.64l1.0,-1.42l2.14,-0.87l0.1,0.2l0.04,0.58l-1.49,1.72ZM728.26,305.71l-0.17,0.63l-3.53,0.67l-3.02,-0.28l-0.0,-0.42l1.66,-0.44l1.47,0.71l0.16,0.03l1.75,-0.21l1.69,-0.69ZM722.98,310.33l-0.74,0.03l-2.52,-1.35l1.42,-0.3l1.19,0.7l0.72,0.63l-0.06,0.28ZM716.24,305.63l0.66,0.49l0.22,0.06l1.35,-0.18l0.31,0.53l-4.18,0.77l-0.8,-0.01l0.51,-0.86l1.2,-0.02l0.24,-0.12l0.49,-0.65ZM715.84,280.21l0.09,0.34l2.25,1.86l-2.25,0.22l-0.24,0.17l-0.84,1.71l-0.03,0.15l0.1,2.11l-2.27,1.62l-0.13,0.24l-0.06,2.46l-0.74,2.92l-0.02,-0.05l-0.39,-0.16l-2.62,1.04l-0.86,-1.33l-0.23,-0.14l-1.71,-0.14l-1.19,-0.76l-0.25,-0.03l-2.78,0.84l-0.79,-1.05l-0.26,-0.12l-1.61,0.13l-1.8,-0.25l-0.36,-3.13l-0.15,-0.23l-1.18,-0.65l-1.13,-2.02l-0.33,-2.1l0.27,-2.19l1.05,-1.17l0.28,1.12l0.1,0.16l1.71,1.41l0.28,0.05l1.55,-0.49l1.54,0.17l0.23,-0.07l1.4,-1.21l1.05,-0.19l2.3,0.68l0.16,0.0l2.04,-0.53l0.21,-0.19l1.26,-3.41l0.91,-0.82l0.09,-0.14l0.8,-2.64l2.63,0.0l1.71,0.33l-1.19,1.89l0.02,0.34l1.74,2.24l-0.37,1.0ZM692.67,302.0l0.26,0.19l4.8,0.25l0.28,-0.16l0.44,-0.83l4.29,1.12l0.85,1.52l0.23,0.15l3.71,0.45l2.37,1.15l-2.06,0.69l-2.77,-1.0l-2.25,0.07l-2.57,-0.18l-2.31,-0.45l-2.94,-0.97l-1.84,-0.25l-0.13,0.01l-0.97,0.29l-4.34,-0.98l-0.38,-0.94l-0.25,-0.19l-1.76,-0.14l1.31,-1.84l2.81,0.14l1.97,0.96l0.95,0.19l0.28,0.74ZM685.63,299.27l-2.36,0.04l-2.07,-2.05l-3.17,-2.02l-1.06,-1.5l-1.88,-2.02l-1.22,-1.85l-1.9,-3.49l-2.2,-2.11l-0.71,-2.08l-0.94,-1.99l-0.1,-0.12l-2.21,-1.54l-1.35,-2.17l-1.86,-1.39l-2.53,-2.68l-0.14,-0.81l1.22,0.08l3.76,0.47l2.16,2.4l1.94,1.7l1.37,1.04l2.35,2.67l0.22,0.1l2.44,0.04l1.99,1.62l1.42,2.06l0.09,0.09l1.67,1.0l-0.88,1.8l0.11,0.39l1.44,0.87l0.13,0.04l0.68,0.05l0.41,1.62l0.87,1.4l0.22,0.14l1.71,0.21l1.06,1.38l-0.61,3.04l-0.09,3.6Z", "name": "Indonesia"},
"PH": {"path": "M737.11,263.82l0.25,1.66l0.14,1.34l-0.54,1.46l-0.64,-1.79l-0.5,-0.1l-1.17,1.28l-0.05,0.32l0.74,1.71l-0.49,0.81l-2.6,-1.28l-0.61,-1.57l0.68,-1.07l-0.07,-0.4l-1.59,-1.19l-0.42,0.06l-0.69,0.91l-1.01,-0.08l-0.21,0.06l-1.58,1.2l-0.17,-0.3l0.87,-1.88l1.48,-0.66l1.18,-0.81l0.71,0.92l0.34,0.1l1.9,-0.69l0.18,-0.18l0.34,-0.94l1.57,-0.06l0.29,-0.32l-0.1,-1.38l1.41,0.83l0.36,2.06ZM734.94,254.42l0.56,2.24l-1.41,-0.49l-0.4,0.3l0.07,0.94l0.51,1.3l-0.54,0.26l-0.08,-1.34l-0.25,-0.28l-0.56,-0.1l-0.23,-0.91l1.03,0.14l0.34,-0.31l-0.03,-0.96l-0.06,-0.18l-1.14,-1.44l1.62,0.04l0.57,0.78ZM724.68,238.33l1.48,0.71l0.33,-0.04l0.44,-0.38l0.05,0.13l-0.37,0.97l0.01,0.23l0.81,1.75l-0.59,1.92l-1.37,0.79l-0.14,0.2l-0.39,2.07l0.01,0.14l0.56,2.04l0.23,0.21l1.33,0.28l0.14,-0.0l1.0,-0.27l2.82,1.28l-0.2,1.16l0.12,0.29l0.66,0.5l-0.13,0.56l-1.54,-0.99l-0.89,-1.29l-0.49,0.0l-0.44,0.65l-1.34,-1.28l-0.26,-0.08l-2.18,0.36l-0.96,-0.44l0.09,-0.72l0.69,-0.57l-0.01,-0.47l-0.75,-0.59l-0.47,0.14l-0.15,0.43l-0.86,-1.02l-0.34,-1.02l-0.07,-1.74l0.49,0.41l0.49,-0.21l0.26,-3.99l0.73,-2.1l1.23,0.0ZM731.12,258.92l-0.82,0.75l-0.83,1.64l-0.52,0.5l-1.17,-1.33l0.36,-0.47l0.62,-0.7l0.07,-0.15l0.24,-1.35l0.73,-0.08l-0.31,1.29l0.16,0.34l0.37,-0.09l1.21,-1.6l-0.12,1.24ZM726.66,255.58l0.85,0.45l0.14,0.03l1.28,-0.0l-0.03,0.62l-1.04,0.96l-1.15,0.55l-0.05,-0.71l0.17,-1.26l-0.01,-0.13l-0.16,-0.51ZM724.92,252.06l-0.45,1.5l-0.7,-0.83l-0.95,-1.43l1.44,0.06l0.67,0.7ZM717.48,261.28l-1.87,1.35l0.21,-0.3l1.81,-1.57l1.5,-1.75l0.97,-1.84l0.23,1.08l-1.56,1.33l-1.29,1.7Z", "name": "Philippines"}
},
"height": 250, "projection": {"type": "mill", "centralMeridian": 0.0},
"width": 320});

But, the output map is empty. Where am I going wrong?Is it the bbox values? Any pointers on this will help.


text:
Q: keeping values after adding an appendchild I have a problem... this is my code

            Ingrese preguntas

                <INPUT type="button" value="Remover" onclick="remover()" />
                <INPUT type="button" value="Agregar" onclick="add()" />

and every time that you add a text field with the buttons + or "agregar pregunta" all the other values disappear, how can i add text fields without lossing the existent fields values?

A: You destroy elements previously created when you do this:
panel.innerHTML += "...";

Instead use insertAdjacentHMTL() if you want to append using HTML markup.
panel.insertAdjacentHTML("beforeend", "...");

Now instead of going through this destructive process...

*

*serialize the existing DOM nodes to HTML

*concatenate the new HTML fragment to the serialized nodes

*destroy the old nodes

*recreate the nodes with the new nodes

...it simply creates the new content and places it before the close of the body element.
Basically, remove element.innerHTML += ... from your coding practices. It's never necessary, it's inefficient and it causes problems like what you've described.

FYI, the .insertAdjacentHTML() method receives 4 different string possibilities as the first argument. Each one designates a position relative to the element on which you're calling it.
The strings are...

*

*"beforebegin"

*"afterbegin"

*"beforeend"

*"afterend"
The labels are pretty self-explanatory. They position the new content before the current element, inside the current element at the beginning, inside the current element at the end, or after the current element, respectively.


text:
Q: Drop option in Python in not working for me In my data set there is a column "Unnamed: 0". I have tried to drop using --- data.drop(['unnamed: 0'], axis=1, inplace=True) but it's not working. It's still showing the same: "Unnamed: 0".
And again whenever I am restarting the kernel the "Unnamed: 0" is getting dropped automatically. This is going off an on. Please suggest me what shall I do.


text:
Q: How to patch a method in Classes.pas I need to patch a method in Classes.pas
(TReader.ReadString - I want to force it to use a specified codepage, not the system default).
If I copy Classes.pas into my project,I will end up having to rebuild the entire VCL. Is there any (easy) way to patch a method at runtime?

A: I found VCLFixPack:
https://www.idefixpack.de/blog/bugfix-units/vclfixpack-10/
I used the techniques from this to replace the method I wanted to patch at runtime.

A: Modifying the implementation side of Classes.pas will not require recompiling everything. Delphi figures out if a unit needs to be recompiled by an algorithm that looks roughly like this:

*

*If DCU found:

*

*Is DCU format out of date (old version of compiler)? If so, need source to recompile or compile-time error.

*Is the source on the path? If so, if it's newer than the DCU, recompile

*For each used unit:

*

*Repeat analysis when loading

*For each used symbol ("import": type, variable, routine, initialized constant etc.) from that unit:

*

*Is symbol version of import different to symbol found in used unit? If so, recompile needed.

*If DCU is not found, source will need to be found and compiled, otherwise compile-time error

The important concept is that of symbol version. When saving a DCU, Delphi calculates a hash based on the interface declaration of the symbol and associates it with the symbol. Other units that use the symbol also store the symbol version. In this way, link-time conflicts caused by stale symbols are avoided, unlike most C linkers.
The upshot of this is that you should be able to add Classes.pas to your project and modify its implementation section almost to your heart's content, and still be able to statically link with the rest of the RTL and VCL and third-party libraries, even those provided in object format only.
Things to be careful of:

*

*Inlined routines; the body of inlined routines are part of the symbol version

*Generics; the implementation side of generic types and methods are part of the respective symbol versions


text:
Q: Child table not updating during Parent update using EF I have two tables with one to many relationship.
TableA, properties and ICollectionof TableB items
TableB with properties
In the EF,
TableAobjectref.ICollection<TableB>ref.Add(new tableBobject)

_tableAservice.Update(tableA).

this only updating tableA not tableB. Any advice?
This is my update method in generic repository, I can see its updating parent table but not child. How ever have added child to parent in the update operation shouldn't that sufficent to update child table?
public virtual void Update(T entity)
{
    dbset.Attach(entity);
    dataContext.Entry(entity).State = EntityState.Modified;
}


text:
Q: Format Excel file to Export data to Excel in ashx in vb.net I write an ashx to build an excel file to export some datas from my database.
When I Open file, I've message saying : format of the file youy try to open is different from file extension specified...
Here my code:
Imports System.Web

Imports System.Web.Services
Imports System.IO
Public Class DowloadClient
    Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

    'set header
    context.Response.Clear()
    context.Response.AddHeader("content-disposition", "attachment; filename=Clients.xls")
    context.Response.ContentType = "application/ms-excel"
    context.Response.ContentEncoding = Encoding.UTF8

    Dim exportContent As String = ExportToExcel()
    context.Response.Write(exportContent)

    'write the file
    context.Response.End()

End Sub

Private Function ExportToExcel() As String

    Dim _exportContent As String = ""

    Dim q = GetClientsCRM(New NatCallEntities)
    Using sb As New IO.StringWriter()

        Using htmlWriter As New HtmlTextWriter(sb)

            Dim table As New WebControls.Table()
            table.GridLines = GridLines.Horizontal
            table.BorderWidth = New Unit(1)

            Dim header As New TableRow()
            header.BackColor = Drawing.Color.Gray

            Dim h As New TableCell()
            h.BorderWidth = New Unit(1)
            h.Text = "Nom"
            header.Cells.Add(h)
            Dim h1 As New TableCell()
            h1.BorderWidth = New Unit(1)
            h1.Text = "PreNom"
            header.Cells.Add(h1)
            Dim h2 As New TableCell()
            h2.BorderWidth = New Unit(1)
            h2.Text = "Conjoint"
            header.Cells.Add(h2)
            Dim h3 As New TableCell()
            h3.BorderWidth = New Unit(1)
            h3.Text = "Proprietaire Adresse"
            header.Cells.Add(h3)
            Dim h4 As New TableCell()
            h4.BorderWidth = New Unit(1)
            h4.Text = "Mention Adresse"
            header.Cells.Add(h4)
            Dim h5 As New TableCell()
            h5.BorderWidth = New Unit(1)
            h5.Text = "Adresse"
            header.Cells.Add(h5)
            Dim h6 As New TableCell()
            h6.BorderWidth = New Unit(1)
            h6.Text = "Complement Adresse"
            header.Cells.Add(h6)
            Dim h7 As New TableCell()
            h7.BorderWidth = New Unit(1)
            h7.Text = "Code Postale"
            header.Cells.Add(h7)
            Dim h8 As New TableCell()
            h8.BorderWidth = New Unit(1)
            h8.Text = "Ville"
            header.Cells.Add(h8)
            Dim h9 As New TableCell()
            h9.BorderWidth = New Unit(1)
            h9.Text = "Telephone"
            header.Cells.Add(h9)
            Dim h10 As New TableCell()
            h10.BorderWidth = New Unit(1)
            h10.Text = "Representant"
            header.Cells.Add(h10)

            table.Rows.Add(header)

            If q IsNot Nothing AndAlso q.Count > 0 Then
                Dim i As Integer = 0
                For Each clt In q

                    Dim row As New TableRow()
                    Dim cell As New TableCell()
                    cell.BorderWidth = New Unit(1)
                    cell.Text = HttpUtility.HtmlEncode(clt.Nom)
                    row.Cells.Add(cell)
                    Dim cell1 As New TableCell()
                    cell1.BorderWidth = New Unit(1)
                    cell1.Text = HttpUtility.HtmlEncode(clt.Prenom)
                    row.Cells.Add(cell1)
                    Dim cell2 As New TableCell()
                    cell2.BorderWidth = New Unit(1)
                    cell2.Text = HttpUtility.HtmlEncode(clt.Conjoint)
                    row.Cells.Add(cell2)
                    Dim cell3 As New TableCell()
                    cell3.BorderWidth = New Unit(1)
                    cell3.Text = HttpUtility.HtmlEncode(clt.Proprietaire)
                    row.Cells.Add(cell3)
                    Dim cell4 As New TableCell()
                    cell4.BorderWidth = New Unit(1)
                    cell4.Text = HttpUtility.HtmlEncode(clt.Mention)
                    row.Cells.Add(cell4)
                    Dim cell5 As New TableCell()
                    cell5.BorderWidth = New Unit(1)
                    cell5.Text = HttpUtility.HtmlEncode(clt.Adresse)
                    row.Cells.Add(cell5)
                    Dim cell6 As New TableCell()
                    cell6.BorderWidth = New Unit(1)
                    cell6.Text = HttpUtility.HtmlEncode(clt.Complement)
                    row.Cells.Add(cell6)
                    Dim cell7 As New TableCell()
                    cell7.BorderWidth = New Unit(1)
                    cell7.Text = clt.CP
                    row.Cells.Add(cell7)
                    Dim cell8 As New TableCell()
                    cell8.BorderWidth = New Unit(1)
                    cell8.Text = HttpUtility.HtmlEncode(clt.Ville)
                    row.Cells.Add(cell8)
                    Dim cell9 As New TableCell()
                    cell9.BorderWidth = New Unit(1)
                    cell9.Text = clt.Tel
                    row.Cells.Add(cell9)
                    Dim cell10 As New TableCell()
                    cell10.BorderWidth = New Unit(1)
                    cell10.Text = HttpUtility.HtmlEncode(clt.Representant)
                    row.Cells.Add(cell10)
                    table.Rows.Add(row)
                Next
            End If

            table.RenderControl(htmlWriter)
            _exportContent = sb.ToString()
        End Using
    End Using
    Return _exportContent

End Function

ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
        Return False
    End Get
End Property

End Class

When I open file, all is good.
What can I do to not have this message?

A: Finally I find a good librairy : EPPLUS


text:
Q: How to insert text in TinyMCE Editor where the cursor is? I am trying to use angular2-tinymce library in my project. I have successfully integrated tinymce in my module. But i could not find any way to insert text from where the cursor is in the tinymce editor.
// in add-progress-note.module.ts file
@NgModule({
  declarations: [
    AddProgressNotePage,
  ],
  imports: [
    IonicPageModule.forChild(AddProgressNotePage),
    TinymceModule.withConfig({
      menubar: false,
      plugins: ['textcolor'],
      toolbar: 'forecolor',
      resize: false,
      statusbar: false
    })
  ]
})

// in add-progress-note.html file
<ion-row class="note-editor" id="noteArea">
            <app-tinymce class="note-input-textarea" [(ngModel)]='noteText' (ngModelChange)="onChangeNote()"></app-tinymce>
</ion-row>

// in add-progress-note.ts file
  onChangeNote(): void {
    console.log(this.noteText);
  }

I have see these links: link1 and link2. But i could not write the callback in setup config of TinymceModule
How to incorporate text inserting from cursor in tinymce editor in my code?

A: I could insert text from cursor position in tinymce editor using below approach:
     this.tinyMce.editor.execCommand('mceInsertContent', false, 'text');


text:
Q: How to create an update after insert Trigger hello please i want to creat a trigger after insert on a table, the purpose of this trigger is to update a row on the same table, here is the code i wrote, im using phpmyadmin :
 UPDATE commande SET NEW.CodeLivreurClient= SHA1(concat(NEW.IdCommande,"_",NEW.DateCommande,"_",NEW.HoraireCommande,"_",NEW.IdClient))

the table is the following :
  CREATE TABLE `commande` (
     `IdCommande` int(11) NOT NULL,
     `DateCommande` date NOT NULL,
     `HoraireCommande` time NOT NULL,
     `MethodePaiement` varchar(256) NOT NULL,
     `StatusPaiement` tinyint(1) NOT NULL,
     `StatusCommande` varchar(256) NOT NULL,
     `CodeLivreurRestaurant` varchar(6) DEFAULT NULL,
     `CodeLivreurClient` varchar(6) DEFAULT NULL,
     `IdLivreur` int(11) NOT NULL,
     `IdClient` int(11) NOT NULL
   )

The trigger is:
CREATE DEFINER=root@localhost TRIGGER Apres_Insert_Commande
    AFTER INSERT ON commande
    FOR EACH ROW
UPDATE commande
    SET NEW.CodeLivreurClien t= SHA1(concat(NEW.IdCommande,"", NEW.DateCommande,"", NEW.HoraireCommande, "_", NEW.IdClient));


text:
Q: Clean way to duplicate stdin - for use by git pre-push? I want to pass stdin to two different processes. What are some nice clean ways to do this?
(I'm proposing a tempfile based way as an answer below, but maybe there are better ways?)
GitHub's "git lfs pre-push" pre-push hook reads stdin. I want to install a second pre-push check, e.g. the WIP check I find in pre-push.sample. This means I need to save stdin in some reasonable way, so that the commits can be read by both "git lfs pre-push" and by the "while read local_ref local_sha remote_ref remote_sha" loop.

A: You could use tee with an output process substitution.
Here I'll put the individual check code into functions for clarity:
check1() {
  git lfs pre-push "$@"
}

check2() {
  while read -ra variables; do
    : ...
  done
}

# redirecting to /dev/null so you don't get the original input as well
tee >(check1) >(check2) >/dev/null

I'm not sure of the limitations, but you can do an arbitrarily large number of checks this way:
tee >(check1) \
    >(check2) \
    >(check3) ...

A demo:
check1() { while IFS= read -r n; do echo $((n*5)); done; }
check2() { while IFS= read -r line; do echo ">>>$line<<<"; done; }
seq 101 100 1101 | tee >(check1) >(check2) >/dev/null

output
505
>>>101<<<
1005
1505
2005
2505
3005
3505
>>>201<<<
4005
4505
>>>301<<<
5005
>>>401<<<
5505
>>>501<<<
>>>601<<<
>>>701<<<
>>>801<<<
>>>901<<<
>>>1001<<<
>>>1101<<<

Since both checks are running in subshells, the output order is indeterminate.

A: One way (which I currently have in my git pre-push hook) is to save the input to a temporary file. The relevant lines from my .git/hooks/pre-push (skipping the unrelated ones):
TMPFILE=`mktemp`
tee $TMPFILE | git lfs pre-push "$@"
cat $TMPFILE | while read local_ref local_sha remote_ref remote_sha ; do
    # ...etc...
done
rm $TMPFILE

Just because the buffer with which the data is duplicated is temporarily given a filename, a handle in the filesystem, doesn't necessarily mean it's a dirty solution! ;-)


text:
Q: Foreach with reference causing array's last element to repeat I ran into a weird issue and could reproduce it with this snippet:
<?php

$arr = [];

for($i = 0; $i <= 3; $i++) {
    $arr[] = [
        $i
    ];
}

foreach ($arr as &$item) {
    $item[] = $item[0];
}

foreach ($arr as $item) {
    print_r($item);
}

It is outputting (notice the last element had been replaced with a copy of its previous one):
Array
(
    [0] => 0
    [1] => 0
)
Array
(
    [0] => 1
    [1] => 1
)
Array
(
    [0] => 2
    [1] => 2
)
Array
(
    [0] => 2
    [1] => 2
)

However, here's the expected result:
Array
(
    [0] => 0
    [1] => 0
)
Array
(
    [0] => 1
    [1] => 1
)
Array
(
    [0] => 2
    [1] => 2
)
Array
(
    [0] => 3
    [1] => 3
)

If I use array_map instead of the first foreach, it works:
<?php

$arr = [];

for($i = 0; $i <= 3; $i++) {
    $arr[] = [
        $i
    ];
}

$arr = array_map(function ($item) {
    $item[] = $item[0];
    return $item;
}, $arr);

foreach ($arr as $item) {
    print_r($item);
}

Tested under PHP 8.0.0.
What could be causing this difference? Is there something about array pointers I'm missing?

A: $arr = [];

for($i = 0; $i <= 3; $i++) {
    $arr[] = [
        $i
    ];
}
/** Output
* $arr = [[0],[1],[2],[3]]
*/

In this foreach loop you are just selecting the existing value of item and setting it into a new index of referenced item
foreach ($arr as &$item) {
    $item[] = $item[0];
}

Type of $item is array, $item[0] is referred to its 0 index
$item[] means a new array index inside item that is currently referenced to.

A: In your first example, the $item variable still holds a reference to the last value of the $arr when the loop is done.
foreach ($arr as &$item) {
    $item[] = $item[0];
}

If you use print_r(get_defined_vars()); you can see that there is a key in the array with name item
The behaviour of the double value at the end of the foreach is described here and It is recommended to destroy the specified variables using unset($item)
You can also use a different variable name.

Using array_map, the callback gets a function argument passed by name, which is bound to the function scope.
If you run print_r(get_defined_vars()); after using array_map you can see that there is no key named item


text:
Q: Why is spring boot project showing red marker? I made a new project from https://start.spring.io/.But when i used to import project 1 month ago there was no any error and any spring boot project used to run fine.But today I dont know what is wrong and I am seeing this:

Why is this error coming? I am using intelliJ and how can I solve this?

A: Try to Invalidate the Cache and restart the IntelliJ.

File > Invalidate Caches/ Restart > Click on Invalidate Caches Restart

After the restart, it takes time to reindex the project.


text:
Q: Is it possible to center the contents of a variable width, auto overflow div purely from CSS? I've read through several similar questions, but none of them apply to this case.
There's a div, which contains cells. Each cell is the same size. The div should be variable width, and allow overflow. There will be more cells that can fit into one row. The problem is, the contents are left-aligned. Please see the example here: http://jsfiddle.net/gpcpfbmb/

Caption

This could be fixed from JavaScript: write a function which measures the screen width, calculate the number of columns, then set the width of the div to columns * cell width pixels. (E.g., in the example, if you're seeing 3 columns, and the cell width is 170 pixels in this case, 3 * 170 = 510, setting the width to 510px would give the "perfect" result. However, as soon as the browser window is resized, all the benefits of variable width and auto overflow are lost.)
So: is it possible to have the cells centered, using only CSS?

A: Change the cell from float:left; to display:inline-block; and add  text-align:center; to the parent.
http://jsfiddle.net/gpcpfbmb/2/


text:
Q: how to generate fake data using moq for unit test? I need to generate some data to unit test my repositories. i was using a loop to generate a list of objects, see codes below.  I learned moq is a great mocking library, Can I use moq to generate that and how do I do it?
public IQueryable<Category> GetCategories()
{
    IList<Category> result = new List<Category>();

    for (int i = 1; i <= 2; i++)
    {
        Category c = new Category();
        c.ID = i;
        c.Name = "Parent" + i.ToString();
        c.ParentID = 0;

        for (int x = i*10; x < i*10+5; x++)
        {
            Category sub = new Category();
            sub.ID = x;
            sub.Name = "Sub" + x.ToString();
            sub.ParentID = i;
            result.Add(sub);
        }

        result.Add(c);
    }

    return result.AsQueryable<Category>();
}

A: You can't use Moq to create the data, but you can use AutoFixture:
public IQueryable<Category> GetCategories()
{
    return fixture.CreateMany<Category>().AsQueryable();
}

However, this will not give you a hierarchical tree. It will return objects like this:
Object 1:
- ID = 0
- ParentID = 1
Object 2:
- ID = 2
- ParentID = 3

etc.
If you really need to have this hierarchical data, you would need to use the following code:
public IQueryable<Category> GetCategories()
{
    var result = new List<Category>();

    // Create the parents
    var parents = fixture.Build<Category>()
                         .Without(x => x.ParentID)
                         .CreateMany());
    result.AddRange(parents);

    result.AddRange(parents.SelectMany(p => fixture.Build<Category>()
                                                   .With(x => x.ParentID, p.ID)
                                                   .CreateMany()));

    return result.AsQueryable();
}

This will add multiple parents with multiple subs for each parent.

A: You can use faker.net to generate fake data. for Example: for dotnet core project its Faker.NETCore.

dotnet add package Faker.NETCore -v 1.0.1

and then use the same in your code in the following manner:-
public void GetStudent()
{
   var st = new Student()
   st.FirstName = Faker.Name.First();
   st.LastName = Faker.Name.Last();
   st.Mobile = Faker.Phone.Number();
}


text:
Q: How to write a function that will execute itself at the given time and date. discord.py (background tasks) So, I tried this,but I am getting the error: saying sys:1: RuntimeWarning: coroutine 'sometask' was never awaited
date_time_str = 30/5/21 03:48:00
time_for_thing_to_happen = time(21,20)

async def sometask():

    valid_channel = client.get_channel(814734276439441461)
    while True:

        now = datetime.datetime.utcnow()
        date = now.date()
        if now.time() > time_for_thing_to_happen:
            date = now.date() + datetime.timedelta(days=1)
            await valid_channel.send('its time')

        then = datetime.datetime.combine(date, time_for_thing_to_happen)
        await discord.utils.sleep_until(then)
        print("it's 12 o'clock")

A: I suggest using background tasks.
In your on_ready event, put this line:
client.bg_task = client.loop.create_task(sometask())

This will allow you to run your coroutine at the correct times.