text:
Q: Python code to filter styles from 1000+ pages i have converted the word file in to html file, but there is a problem, the MS-word automatically adds some style to the pages.
for example

i want to output to be as

i dont want the img inline styles to be removed.
thanks in advance
update:  if it is very hard to keep img style in the file. please give me the code excluding that part. it is very urgent for me and i cant edit 1000 pages manually

A: I suggest you to use elementtree. parse the file remove all style attributes you don't need and write the file.
With elementtree this should be a 5 liner.

A: If you want to remove styles for a known list of tags, I don't think its necessary to use a full weight HTML parser. Something like
expr = r'((?<=<div)|(?<=
'
html_text = re.sub(expr,'>',html_text)

works just fine. Of course, you would use an array of tags you want to replace to generate the (?<=

If you have a list of style tags that you want to remove, it's even easier. Just generate an expression like
expr = r' (style|align|myStyleTag)=".*?"'

with re.sub.
If you need a dynamic combination thereof, use a parser.
Edited in response to comments by OP:
Unfortunately, lookbehind needs fixed-size expressions, so <.* or similar won't work. If you don't have a fixed tag list, it's probably better to use a preexisting framework.
An ugly way around this would be something like:
expr = "("
for i in range(1,8): ## or whatever the max/min tag lengths are
    expr += "(?<=<[a-zA-Z]{" + str(i) + "})|"
expr = expr[:-1] + ")[ ]+.*?>"

But that's pretty bad style.


text:
Q: ASP.Net Identity 2.0 and rest API for android I have an MVC website using asp.net identity 2.0 for authentication.
i am also developing a REST API for same DB for android mobile app.
i want to use identity 2.0 hashed password for authentication in REST API, but plain password must not be sent from android app.
Android app must hash the password same way as identity 2.0 user manager does so then i can compare password sent from android app and password present in AspNetUsers table.
Problem is that i can not find any implementation or guidelines to implement PasswordHasher of identity 2.0 in Java/Android.
Here is the c# code of identity 2.0 PasswordHasher https://raw.githubusercontent.com/aspnet/Identity/5480aa182bad3fb3b729a0169d0462873331e306/src/Microsoft.AspNetCore.Identity/PasswordHasher.cs
Please help i am stuck since last two days..

A: Hashing password on the client is a bad idea. How does it make it better then sending just a password in plain text? If MiTM attacker gets the hashed password - he gets all he needs to login into your system. Yes, you are not transmitting the original password, but you are transmitting hash that effectively becomes a password and you store the plain text hash of the password in the database anyway.
Also what about salt? In Identity framework salt is stored in the same field as the hash - they are appended one to another. If you run PasswordHasher.HashPassword() 10 times on the same string, you'll get 10 different results, because this result already include salt. If you try to run this on client, you'll be getting different string every time and you won't be able to compare to hash/salt already stored in your DB. So you'll have to pass salt somehow from the server to be able to hash with the same salt. This makes it overly complex and prone to be done incorrectly.
Don't try to invent security systems yourself. Pass username/password in plain-text over encrypted connection and let the framework do the hashing/persisting for you.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to resolve "no known instance method for selector 'performSelector:withObject:afterDelay:'" when migrating to ARC? The ARC migration tool is refusing to accept this code prior to starting with migration:
[self.delegate performSelector:@selector(overlayDismissed:) withObject:self afterDelay:0];

The delegate is forced to implement this method with a protocol, and it should work fine:
@protocol OverlayDelegate <NSObject>
- (void)overlayDismissed:(Overlay*)overlay;
@end

@interface Overlay : UIImageView {
    id<OverlayDelegate> delegate;
}

@property (nonatomic, assign) id<OverlayDelegate> delegate;

What's wrong with ARC? Why is it telling me that there is "no known instance method for selector 'performSelector:withObject:afterDelay:'?

A: Simple, your object is of type id and conforms to the NSObject protocol. However, this protocol doesn't declare performSelector:withObject:afterDelay:, so ARC doesn't know what the method is doing and if it must retain anything. Either use an NSObject or cast it prior to making the method call.

A: ARC isn't causing this - it is is merely exposing it.  That method is defined on NSObject - but id works for more than just NSObject (so you have to be more specific than just 'id').  Change your code to this:
@interface Overlay : UIImageView {
    NSObject<OverlayDelegate> *delegate;
}

@property (nonatomic, assign) NSObject<OverlayDelegate> *delegate;

A: I've figured out that casting the delegate to NSObject* solves the problem:
[self.delegate performSelector:@selector(overlayDismissed:) withObject:self afterDelay:0];

For some weird reason autocompletion did not even come up with -performSelector:withObject:afterDelay: so I had to type it manually. Instead, it offered only -performSelector: and -performSelector:withObject:withObject:
My guess is that it's just stupid to use id as the type for delegates in Objective-C, and I never really knew why everyone including myself is doing that rather than just defining it as NSObject. However, my protocol even told that whoever conforms to that protocol also has to conform to the NSObject protocol by doing this: OverlayDelegate <NSObject> - and still, the compiler didn't get it.
So for now I'm satisfied it works with the cast, but it feels like eating old fish.

A: I met error:

No known class method for selector conformsToProtocol:

The reason is that : file name is not equal to the class name with @interface and @implementation.


text:
Q: Converting values in a list to their hashed forms (Python) I currently have the following code:
from itertools import permutations
import hashlib

def hash_f(x):
    h = hashlib.md5(x)
    return int(h.hexdigest(),base=16)

value = raw_input("Enter a value: ")
possibleValues = 'a'

for p in permutations(possibleValues):
    if hash_f(value) == hash_f(possibleValues):
        print "MATCH"

(The import and use of permutations is a placeholder for now, it'll be used more once this problem is solved)
What I would like to know is whether or not it's possible to iterate through a list and replace its value with the hashed form of that value. Using my current hash_f(x) function doesn't work with lists, which is the problem here.
Thanks for advance for any help, and let me know if you need more information!

A: I'm not understanding what your snippet is supposed to do, but your question seems like it could be answered with a list comprehension.
from hashlib import md5

input_list = ['a','b','c','d','e']

hashed_list = [int(md5(x).hexdigest(), base=16) for x in input_list]

# Do whatever you wanted to do with the list of hashes....


text:
Q: Is there a way to get the "Pointer" on "OnPointerEnter" in Unity? I am working with VR in Unity trying to get my controllers to vibrate when entering a menu image. I have a test script right now trying to see if I can get the pointer that is entering the image because I need to know which controller my raycast is coming from so I can vibrate that controller.
Currently this is my code for testing and I have checked the documentation for the "PointerEventData" but have not found a way to get the pointer from there. This test script is on the image gameobject.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class OnPointerEnterEvent : EventTrigger
{

    public override void OnPointerEnter(PointerEventData data)
    {
        Debug.Log("OnPointerEnter called.");
    }

}

Is there anything I am missing here or is this just the wrong way to approach this?

A: With VR as there isn't a screen surface, nor there is one pointer, the area can be tricky. I would recommend looking into unity XR framework / examples, there's a new pair of hover enter/exit callbacks:
XRBaseControllerInteractor.OnHoverEnter(XRBaseInteractable)
XRBaseControllerInteractor.OnHoverExit(XRBaseInteractable)
(where basecontrollerinteractor is usually an XRRayInteractor)
After testing pretty much all vr frameworks I could get to work, I found this to be the most reliable way of handling those events

A: With PointerEventData.pointerEnter you recieve the object that received 'OnPointerEnter' event. That gameobject should be your controller in the scene.


text:
Q: android.support.v7.widget.CardView could not be found (Android Studio 1.1 Preview)
I'm trying to add CardView to my activity as the official sample. But it doesn't work.
If I run my project directly, it would lead to java.lang.ClassNotFoundException: android.support.v7.widget.CardView .

A:
With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX

And the support library will be discontinued...
Add the following to buld.gradle:app
dependencies {
    ...
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    ...
}

A: Writing my answer to provide:

1) updated version for compileSdkVersion 27.
2) usage of implementation instead of compile - What's the difference between implementation and compile in Gradle?.
3) a complete version number to heed the Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds.., warning shown by Android Studio.
4) a visual for location of build.gradle (Module:app).
5) And because I was not able to write a comment below @Eun's answer.

You need to paste implementation 'com.android.support:cardview-v7:27.1.1' in build.gradle [Module:app] located at, for example: MyFirstApplication -> app -> build.gradle
Paste in following dependencies clause:
dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar'])
   ...
   implementation 'com.android.support:appcompat-v7:27.1.1'

   implementation 'com.android.support:cardview-v7:27.1.1'

   ...
}

To open from Android studio itself: (From left side) 1:Project -> Select Android view -> Gradle Scripts -> build.gradle (Module: app)
That is:
(If the image below is not shown You can find the image here.

Using Android Studio 3.1.4
Edit: Updated version numbers.

A: It is all because of dependency and android version problems.
Solution:
For RecyclerView:
<androidx.recyclerview.widget.RecyclerView/>

Instead of: <android.support.v7.widget.CardView..
For CardView:
<androidx.cardview.widget.CardView/>

Instead of: <android.support.v7.widget.RecyclerView..
**Or simply search for and drag and drop, CardView, RecyclerView ..etc from palette panel.
For dependencies that supports AndroidX:
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'

Go To this Article for full description:
https://medium.com/@daryllwong/recyclerview-cardview-is-not-working-properly-dependency-problems-in-2019-e813ab48b3d4

A: dependencies {
    ...
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.android.support:recyclerview-v7:26.+'
    ...
}

A: I was facing this issue because of the corruption of cached cardview aar.
Gradle was picking local cached version of cardview. Also works by changing the library version but make sure you are not overriding configurations.all
Solution:
Close Android Studio,
In windows goto C:\Users\Qamar\.gradle\caches and search cardview delete your version folder, clean and rebuild.
Using: Android Studio 3.3 and gradle:3.2.1

A: You should add it to your build.gradle:
dependencies {
    ...
    implementation 'com.android.support:cardview-v7:21.+'
    implementation 'com.android.support:recyclerview-v7:21.+'
    ...
}

A: In your xml file change
android.support.v7.widget.CardView
to
androidx.cardview.widget.CardView

A: Just click on sync now at right top side

A: To avoid mistakes during adding CardView, you can use Android Studio tools. In the main menu open "Project structure...", then "Dependencies", "+" and "cardview" in the search line.
At the moment Android Studio adds 'androidx.cardview:cardview:1.0.0' line to your build.gradle file. Then you can use "<androidx.cardview.widget.CardView>" in your layouts.
Maybe after a year or two the version or the package name will change.


text:
Q: is there a utility to peek into text files without opening on windows 7
Possible Duplicate:
Windows 7 - Preview other file types as text in Preview Pane

so many times, i have to open config files to confirm they have correct settings.
it would be awesome if there was a quicker way to to see what's inside without having to load the file into a text editor, and than close it.
I am curious if anyone has come across this problem, and if any utilities exist that could offer quick peek on right lick ? i tried a few google searches but nothing interesting came up

A: In Windows Explorer you can press Alt-P to bring up the preview pane that shows you previews of txt files (and various other file types) out of the box. As for text files that have a different suffix, this has been answered in Windows 7 - Preview other file types as text in Preview Pane

A: There's always findstr if you're looking for a command-line utility.
http://www.computerhope.com/findstr.htm
This would allow you to search multiple docs to find out if any of them have the value you're looking for.
If you're looking for something like a preview pane... Dolphin maybe?  Previews are generally used for pictures as they're easier to verify by thumbnail.  text not so much.  You'd either need to find an embedded editor or a file manager that supports this.


text:
Q: PPC clrlwi command - is the value digit included in the mask? I'm reading some code in PPC 750 Big-endian and not clear on the clear statement.
clrlwi.   r12, r12, 28

Is it:
Clear to the Left of bit 28 (leaving 28,29,30,31)
-or-
Clear Left including bit 28 (leaving 29,30,31)?
I've read the PPC docs I have, did my best with Google search but can't find anything that makes this... "clear" to me. (bad pun, I know.)

A: The instruction is a simplified form of rlwinm, which generates a mask from MB to ME, inclusive. MB in this case is 28 and ME is always 31 for clrlwi, so the mask will contain bits from 28 to 31, inclusive.
This is logical. If the bit selected wasn't included you could never select the full range from 0 to 31 and would always be masking away at least one bit from the result.
More information about the masks can be found from IBM.


text:
Q: limit - show that in infinity function grow faster that other function given two function:

*

*$x\:\le\:b\cdot \log\left(x\right)\:$

*$x\:\le\:x\cdot \:\log\left(x\right)\:$
i want to show that $b\cdot \:\log\left(x\right)\:\le \:x\cdot  \log\left(x\right)\:$
I made a graph of these 2 functions, you can clearly see that this is true, at infinity, this equation (2) is always above this equation (1)

I was thinking of showing the limit at infinity:
$\lim _{x\to \infty }\left(\left(b\cdot \:\log\left(x\right)\:\right)/\left(\:x\cdot \:\log\left(x\right)\:\right)\right) = 0$
I'm not sure if this is a correct way to do it, am I right?

A: This is a correct way, which basically states that $b\cdot ln(x)$ gets infinitely smaller than $x\cdot ln(x)$ when $x$ grows infinitely large. Or more informally, the more you blow $x$ up, the value of $b\cdot ln(x)$ will be more negligible than $x\cdot \ln(x)$.
This can be easily shown using the way you stated:
$$\lim_{x\to\infty} \frac{b\cdot \ln(x)}{x\cdot \ln(x)} $$
$$=\lim_{x\to\infty} \frac{b}{x} $$
$$ = 0$$ since $b$ is just a constant.


text:
Q: Backbone.js - Render a collection as HTML option tags A have a collection of items I'd like to render into an existing <select> elment in the template. The problem I have is that the view always wraps the <option> list in a DIV tag. How can I only render the <option> list without any wrapping element?
Template:
<script type="text/template" id="template-select">
    <% _(elements).each(function(element) { %>
            <option value="<%= element.id %>"><%= element.name %></option>
    <% }); %>
</script>

View:
myView = Backbone.View.extend({
    template: template('template-select'),
    render: function() {
        this.$el.html(this.template({
                elements: this.collection.toJSON()
            }));
        return this;
    }
});

A: I assume somewhere else you are creating an instance of that view add rendering/adding it to the <select> element.
You can try something like this instead:
var view = new myView({el: '#id-of-existing-select'});
view.render();

This would make the view use the existing <select> instead of generating the <div>.


text:
Q: Conditional format if one cell is filled and another is an error I have this workbook set up with two formula driven columns.  Rather than seeing #N/A if column B is not filled, however, I have it appear blank.  I am trying to conditional format Column A to turn red if Column B has a value, yet column A is technically error.
The formula I have been trying to get to work is this, but it isn't functioning.
see screenshot
=AND(NOT(ISBLANK(B:B)),ISERROR(A:A))

A: I think two things are going on here:
First, this doesn't work because you are referencing ranges:
=AND(NOT(ISBLANK(B:B)),ISERROR(A:A))

With your mouse or keyboard, manually select the range A2:A100 (or whatever the last row is). Add a conditional formatting rule using cell references like this:
=AND(NOT(ISBLANK(B2)),ISERROR(A2))

A little explanation on relative references in conditional formatting.. When you select a range of cells and apply conditional formatting, it checks the references' positions relative to the top left cell you had selected, then applies those relative positions to the other cells highlighted. So in this case the top left cell is A2, so for all cells, it will consider the cell it self for ISERROR, and the cell to the right for ISBLANK. If that doesn't make sense, ask in the comments and maybe someone can explain it better.
Second, if you have "handled" your error in the A column so that #N/A doesn't show, like if A2 looks something like this: '=IF(ISERROR(function(B2)),"",function(B2))', then the conditional formatting rule won't trigger on ISERROR(A2) since A2 does not resolve to an error. You would have to put the actual function in the conditional formatting formula which evaluates to an error. Something like this:
=AND(NOT(ISBLANK(B2)),ISERROR(function(B2)))

I'm not sure if that's what is going on, but you had mentioned that you make column A appear blank, so it sounds like you are handling the error within the A column. Instead of handling the error in column A, you could just let column A resolve to the error and then turn both the text and the cell color to red in the conditional formatting rule to hide the error text. Just throwing that out there.
Hopefully I understood the question. If not then please let me know so I can update the solution.


text:
Q: Excel VBA select new usedrange portion of a column
Hi All.
I need your help please.
I want to apply a formula to the new rows that I've just added.  I have a line of code I use for a full set of data, but I'm not sure how to modify it, or if there is a better way to do it.
I'm a bit out of my league with this line of code, I understand what it's doing but I didn't write it.
Sheets("Closed Loop").Range(varPastePos).Offset(0, 2).Resize(ActiveSheet.UsedRange.Rows.Count - 1, columnsize:=1).FormulaR1C1 = "My Formula"

varPastePos is the position the new data was pasted, in this case $F$28
Any ideas?

A: .UsedRange would also include formatted blank cells so it is not reliable for finding the last used row.
Set ws = Sheets("Closed Loop")
Set cell1 = ws.Range(varPastePos) ' F28
Set cell2 = cell1.End(xlDown)     ' F32 ? the last cell with data below F28. Similar to clicking on F28 and pressing Ctrl + down
Set rngF = ws.Range(cell1, cell2) ' F28:F32
Set rngH = rngF.Offset(, 2)        ' H28:H32
rngH.FormulaR1C1 = "My Formula"

A: Use Range().FillDown to extend a pre-existing formula.
Dim lastRow As Long
lastRow = Range("F" & Rows.Count).End(xlUp).Row
Range("A2", "A" & lastRow).FillDown

You can FillDown multiple columns at once like this:
 Range("A2", "D" & lastRow).FillDown

You can do it all in one line like this:
Range("A2", Range("F" & Rows.Count).End(xlUp)).FillDown


text:
Q: Some PHP functions work on localhost, but not VPS these lines of code work fine on my localhost, but not on my VPS hosting:
$url = "http://gdata.youtube.com/feeds/api/videos/".$videoID;
$doc = new DOMDocument;
$doc->load($url);
$title = $doc->getElementsByTagName("title")->item(0)->nodeValue;
$description = $doc->getElementsByTagName("description")->item(0)->nodeValue;

I can't figure out why they would work on localhost and not my vps which is set up like the exact same as localhost.

A:
http://199.192.203.137/phpinfo.php

DOM is explicitly disabled there: --disable-dom.
Either contact your host and ask them to enable DOM (unlikely), use a different host or rewrite your code using another DOM/XML library.


text:
Q: Is robocopy a valid tool for publishing sites onto multiple servers? I'm currently trying to find a good solution for publishing a web site onto multiple load balanced servers.
As it stands (from msdn) VS itself does not support it free house without me editing the installation templates. As I want t oavoid that, I'm looking for alternative ideas. One of them was the following:

*

*I publish onto a single server

*I robocopy all changed files to all other servers (automatically)

Now my question there is: Is it enough to just copy the files from one server to all others (and thus robocopy a valid tool there)?  Or does the publish process do more than just copy files onto a server ?
(That I have to initially configure the applications one single time anyway is clear to me).

A: The VS publish process 'just' does

*

*Build and choose the files to publish

*Web config transform

*File Copy

It assumes that the web application you are publishing to is already configured and does no configuration for you.
So I would say yes. If you have published to one server then the first two steps are done for you, and robocopy is all you need for the further servers.
The 'bigger' solution is a CI pipeline using a tool such as Octopus, TeamCity or Jenkins. What they offer over your script is good control of history and ease of rollback. And better control if you have multiple people publishing.


text:
Q: On Ubuntu Server 18.04, can't get my domain to resolve unless www is used I can't get pangeawerks.com to resolve but www.pangeawerks.com works great
I pinged the domain and here are the results:
karmacomposer@PANGEAVERSE:~$ ping pangeawerks.com
ping: pangeawerks.com: Temporary failure in name resolution

karmacomposer@PANGEAVERSE:~$ ping www.pangeawerks.com
PING www.pangeawerks.com(::1 (::1)) 56 data bytes
64 bytes from ::1 (::1): icmp_seq=1 ttl=64 time=0.039 ms
64 bytes from ::1 (::1): icmp_seq=2 ttl=64 time=0.048 ms
64 bytes from ::1 (::1): icmp_seq=3 ttl=64 time=0.053 ms
64 bytes from ::1 (::1): icmp_seq=4 ttl=64 time=0.047 ms
64 bytes from ::1 (::1): icmp_seq=5 ttl=64 time=0.052 ms

--- www.pangeawerks.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4094ms
rtt min/avg/max/mdev = 0.039/0.047/0.053/0.010 ms

I know it has to do with my DNS server (it's our own server here at my office, so not a host).
If anyone could help me get this working, it's causing me a lot of grief.
Thank you.
Mike

A: Problem is with DNS resolution.
dig pangeawerks.com

; <<>> DiG 9.11.3-RedHat-9.11.3-12.fc28 <<>> pangeawerks.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 39391
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pangeawerks.com.       IN  A

;; Query time: 462 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Wed Jul 18 21:02:31 CEST 2018
;; MSG SIZE  rcvd: 44

and
dig www.pangeawerks.com

; <<>> DiG 9.11.3-RedHat-9.11.3-12.fc28 <<>> www.pangeawerks.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36304
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.pangeawerks.com.       IN  A

;; ANSWER SECTION:
www.pangeawerks.com.    604424  IN  A   72.31.51.26

;; Query time: 7 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Wed Jul 18 21:02:49 CEST 2018
;; MSG SIZE  rcvd: 53

Create fallowing records. First A record to point to you ip
pangeawerks.com     A     72.31.51.26

After that make CNAME record to connect www with hostname
www.pangeawerks.com   CNAME    pangeawerks.com

This records must be make on Authority DNS server.
Here are the current results of dig pangeawerks.com:
; <<>> DiG 9.11.3-1ubuntu1.1-Ubuntu <<>> pangeawerks.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57836
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 79cc3057e00d2854be8b8e965b4f92ce402e52c17af6f46e (good)
;; QUESTION SECTION:
;pangeawerks.com.               IN      A

;; Query time: 405 msec
;; SERVER: 72.31.51.26#53(72.31.51.26)
;; WHEN: Wed Jul 18 15:19:42 EDT 2018
;; MSG SIZE  rcvd: 72

Here is the contents of my zone file for pangeawerks.com.db:
; BIND data file for local loopback interface
;
$TTL    604800
@       IN      SOA     pangeawerks.com. PANGEAVERSE.pangeawerks.com. (
                         33         ; Serial
                     604800         ; Refresh
                      86400         ; Retry
                    2419200         ; Expire
                     604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       72.31.51.26
@       IN      AAAA    ::1

;Name Server Information
@       IN      NS      PANGEAVERSE.pangeawerks.com.

;IP address of Your Domain Name Server(DNS)
pangeawerks.com  A      73.31.51.26

;Mail Server MX (Mail exchanger) Record
pangeawerks.com. IN  MX  10  mail.pangeawerks.com.

;A Record for Host names
www     IN       A       72.31.51.26
mail    IN       A       72.31.51.30

;CNAME Record
ftp     IN      CNAME    www.pangeawerks.com.
www.pangeawerks.com     CNAME   pangeawerks.com.

And here is the reverse lookup file db.72:
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     pangeawerks.com. PANGEAVERSE.pangeawerks.com. (
                          6         ; Serial
                     604800         ; Refresh
                      86400         ; Retry
                    2419200         ; Expire
                     604800 )       ; Negative Cache TTL
;
@          IN      NS      pangeawerks.com.
26.51.31   IN      PTR     pangeawerks.com.

;Your Name Server Info
@               IN      NS      PANGEAVERSE.pangeawerks.com.
PANGEAVERSE     IN      A       72.31.51.26

;Reverse Lookup for your DNS Server
26              IN      PTR     PANGEAVERSE.pangeawerks.com.

;PTR Record IP address to HostName
26              IN      PTR     www.pangeawerks.com.
30              IN      PTR     mail.pangeawerks.com.

PANGEAVERSE is the hostname of the server - the FQDN is PANGEAVERSE.pangeawerks.com
Here is the contents of the /etc/hosts file (lots of commenting out of wrong stuff - did not want to get rid of them in case I needed them again or did something wrong):
#127.0.0.1 localhost localhost.pangeawerks.com PANGEAVERSE
#127.0.0.1      localhost PANGEAVERSE
72.31.51.26     PANGEAVERSE.pangeawerks.com     PANGEAVERSE

# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
#72.31.51.26  pangeawerks.com
#72.31.51.26  www.pangeawerks.com

Please suggest proper formatting of any of these files, as it's a bit of a hodge podge of other templates.  I am SURE I did something wrong.
Thanks.


text:
Q: How to connect hibernate with PostgreSQL in eclipse? I try to connect hibernate with PostgreSQL, but I don't know why it is not working.
I have searched many posts about the setting, but they are not working for me.
Thank you very much!
Below is the structure of my files:

hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
   <property name="hibernate.dialect">
      org.hibernate.dialect.PostgreSQLDialect
   </property>
   <property name="hibernate.connection.driver_class">
      org.postgresql.Driver
   </property>
   <property name="hibernate.connection.url">
      jdbc:postgresql://localhost:5432/hibernatedb
   </property>
   <property name="hibernate.connection.username">
      eric
   </property>
   <property name="hibernate.connection.password">
      eric123
   </property>

   <mapping resource="Employee.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Employee.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="Employee" table="EMPLOYEE">
      <meta attribute="class-description">
         This class contains the employee detail.
      </meta>
      <id name="id" type="int" column="id">
         <generator class="native"/>
      </id>
      <property name="firstName" column="first_name" type="string"/>
      <property name="lastName" column="last_name" type="string"/>
      <property name="salary" column="salary" type="int"/>
   </class>
</hibernate-mapping>

Employee.java
package hibernate.application;

    public class Employee {
       private int id;
       private String firstName;
       private String lastName;
       private int salary;

       public Employee() {}
       public Employee(String fname, String lname, int salary) {
          this.firstName = fname;
          this.lastName = lname;
          this.salary = salary;
       }
       public int getId() {
          return id;
       }
       public void setId( int id ) {
          this.id = id;
       }
       public String getFirstName() {
          return firstName;
       }
       public void setFirstName( String first_name ) {
          this.firstName = first_name;
       }
       public String getLastName() {
          return lastName;
       }
       public void setLastName( String last_name ) {
          this.lastName = last_name;
       }
       public int getSalary() {
          return salary;
       }
       public void setSalary( int salary ) {
          this.salary = salary;
       }
    }

ManageEmployee.java
public class ManageEmployee {
   private static SessionFactory factory;
   private static ServiceRegistry serviceRegistry;

   public static void main(String[] args) {
        Configuration configuration = new Configuration();
        configuration.configure();
        serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
        factory = configuration.buildSessionFactory(serviceRegistry);

        ManageEmployee ME = new ManageEmployee();
        Integer empID1 = ME.addEmployee("Zara", "Ali", 1000);
        ...
   }
}

Error Messages
2013/9/26 上午 10:40:56 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
2013/9/26 上午 10:40:56 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.5.Final}
2013/9/26 上午 10:40:56 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2013/9/26 上午 10:40:56 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2013/9/26 上午 10:40:56 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2013/9/26 上午 10:40:56 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2013/9/26 上午 10:40:56 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: Employee.hbm.xml
2013/9/26 上午 10:40:56 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2013/9/26 上午 10:40:56 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Exception in thread "main" org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver org.postgresql.Driver could not be loaded
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:111)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:223)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:89)
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1818)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1776)
    at hibernate.application.ManageEmployee.main(ManageEmployee.java:18)
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.postgresql.Driver]
    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:149)
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
    at java.lang.Class.forName(Class.java:172)
    at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:146)
    ... 12 more

A: I finally find the way to solve it!!!
I have to import JDBC file of PostgreSQL (postgresql-9.2-1003.jdbc4.jar). This file can let eclipse know how to connect with PostGreSQL.

A: It seems like you need to include PosgreSQL in your project. I suggest using a dynamic dependency system like Maven, but you can of course download postgreSQL yourself.
How to set up posgreSQL with Maven


text:
Q: XSLT templates: change the order of processing nodes from source I am learning XSLT and how to use templates.
I have the following (simplified) input:
<root>
    <parent1 num="123" />
    <parent2 type="ABC">
        <child1>702</child1>
    </parent2>
</root>

I would like to use a template to transform this to:
<item>
    <childentry>702</childentry>
    <parententry>ABC</parententry>
</item>

with the help of a template.
And more as a general question: how can you change the order of processing nodes from source by using templates.
Suggestions are really appreciated.

A: Since you are using XSLT 1.0, there is an explanation in the XSLT 1.0 specification here:
https://www.w3.org/TR/xslt-10/#section-Applying-Template-Rules
See the paragraph starting "Multiple xsl:apply-templates elements can be used within a single template to do simple reordering."
Some general tips:

*

*Are you really constrained to use XSLT 1.0? Later versions (2.0 and 3.0) are much more powerful and make some common operations much easier.

*Is StackOverflow the right place for this kind of question? What resources are you using for learning the language? There are plenty of good books available and they surely cover this.


text:
Q: fabric.js rotate object around canvas center smoothly I try to rotate an object around the canvas center smoothly using a slider,
I use fabric.util.rotatePoint to find the new center point and set the new angle,but it seems not exactly around the center point and the object position is jumping.
https://jsfiddle.net/j0g1tLsb/26/
here is my code doing this:
const canvas = new fabric.Canvas('c', { width: innerWidth, height: innerHeight });
canvas.controlsAboveOverlay = true;
canvas.preserveObjectStacking = true;

const rect = new fabric.Rect({
    width: 300,
  height: 150,
  left: 400,
  top: 400,
  fill: "lightgray",
    originX: 'center',
  originY: 'center'
});

const centerPoint = new fabric.Circle({
   originX: 'center',
   originY: 'center',
   top: innerHeight/2,
   left: innerWidth/2,
   radius: 10,
   fill: 'red',
   hasControls: false,
   selectable:false
});

const log = new fabric.Text('', {
    left: 30,
  top: 30,
  originX: 'left',
  originY: 'top',
  fontSize: 18,
  evented: false,
  selectable: false
});

canvas.add(rect, centerPoint, log);

document.getElementById('img-rotation').oninput = function() {
      rect.set('angle', this.value);

      var posNewCenter = fabric.util.rotatePoint(
                            rect.getCenterPoint(),
                            canvas.getVpCenter(),
                            fabric.util.degreesToRadians(this.value)
                        );

                        rect.set({
                            left: posNewCenter.x,
                            top: posNewCenter.y,
                            angle: this.value
                        });

      log.set('text', `angle: ${Math.round(rect.angle)} \nleft: ${rect.left} \ntop: ${rect.top}`);
      canvas.requestRenderAll();
    };

rect.on('modified', () => {
    log.set('text', `angle: ${Math.round(rect.angle)} \nleft: ${rect.left} \ntop: ${rect.top}`);
  canvas.renderAll();
});

A: Your problem is in getting center point from the rectangle every time. You need just set new Point from the original rectangle position.
var posNewCenter = fabric.util.rotatePoint(
    new fabric.Point(400, 400), //here is your mistake
    canvas.getVpCenter(),
    fabric.util.degreesToRadians(this.value)
);
rect.set({
    left: posNewCenter.x,
    top: posNewCenter.y,
    angle: this.value
});

Working fiddle
UPDATE:
In order of the modification of the Rectangle you need to use object:modified event to reassign top and left coordinates.
First of all declare top and left variables and use them inside rectangle object:
let top = 400;
let left = 400;
const rect = new fabric.Rect({
  ...
  left: left,
  top: top,
  ...
  targetObj: 'rectangle' //you can use any value or ID, it's only for targeting purpose
});

Then you need to check when object is modified. If event is fired then check if it is rectangle.
canvas.on('object:modified', (e) => {
    if (e.target.hasOwnProperty('targetObj') && e.target.targetObj === 'rectangle') {
    left = e.target.get('left');
    top = e.target.get('top');
  }
})

Finally, use left and top variables inside oninput event of the slider:
var posNewCenter = fabric.util.rotatePoint(
    new fabric.Point(left, top),
    canvas.getVpCenter(),
    fabric.util.degreesToRadians(this.value)
);

Working updated fiddle


text:
Q: Continuation of $W^{1,p}_0$-functions I know that for an open set $\Omega \subset \mathbb{R}^n$ and $1 \leq p \leq \infty$, a function $u \in W^{1,p}_0(\Omega)$ can be continued to a function $v \in W^{1,p}(\mathbb{R}^n)$ by setting $v=u$ in $\Omega$ and $v=0$ in $\Omega \setminus \mathbb{R}^n$.
By Meyers-Serein, we also know that for $1 \leq p < \infty$, the set $C^{\infty}_0(\mathbb{R}^n)$ is dense in $W^{1,p}(\mathbb{R}^n)$ and therefore $W^{1,p}(\mathbb{R}^n) = W^{1,p}_0(\mathbb{R}^n)$. So in this case, we also have $v \in W^{1,p}_0(\mathbb{R}^n)$.
But in the case $p = \infty$, do we also have $v \in W^{1, \infty}_0(\mathbb{R}^n)$ or just $v \in W^{1, \infty}(\mathbb{R}^n)$?

A: The problem is that $C_0^\infty(\mathbb{R}^n)$ is not dense in $W^{1,\infty}(\mathbb{R}^n)$. Particularly, a function in $W^{1,p}(\mathbb{R}^n)$ for $1\leq p<\infty$ must decay "far outside".
As an example, choose $v=1$ which is clearly in $W^{1,\infty}(\mathbb{R}^n)$, but does not have a zero trace or is in the completion of $C_c^\infty(\mathbb{R}^n)$ w.r.t. to the $W^{1,\infty}$- norm

A: The space $W_0^{1,\infty}(\Omega)$ consists of functions that tend to $0$ at the boundary of $\Omega$; the limit is understood in the classical  way because $W^{1,\infty}$ functions have a continuous representative. See the discussion here. When $\Omega=\mathbb R^n$, the role of boundary is played by the point at infinity.
Therefore, the zero extension of a function in $W^{1,\infty}_0(\Omega)$ belongs to $W^{1,\infty}_0(\mathbb R^n)$.


text: Q: Typeahead - Load on Demand How to make Typeahead load on demand? Ex: I do a search and it brings me 6 results (limitTo = 6) and as I go down (Scroll) if I pass the 6 results it will go to the api and return another 6 and so on. Reason for this is not to overload my api by working Asynchronous and neither load all my list in $scope.


text:
Q: useRef and useImperativeHandle type error with typescript I have this code:
const Button = forwardRef<HTMLButtonElement>((props, ref) => {
  const buttonRef = useRef<HTMLButtonElement>(null);

  useImperativeHandle(ref, () => buttonRef.current);

  return <button ref={buttonRef}>CLICK</ button>
});

buttonRef.current us underlined and I get this error:
Type 'HTMLButtonElement | null' is not assignable to type 'HTMLButtonElement'. Type 'null' is not assignable to type 'HTMLButtonElement'

I can't seem to understand why...


text:
Q: ReportViewer to PDF inside div/image/object Been searching for the past couple of days and haven't been able to find what I'm looking for, hopefully I haven't missed it.
I have an ASP.NET (4.0) site that I'm putting together to retrieve payroll information.  Currently I'm using the reportviewer, but because of cross-browser support it doesn't work 100%.  I already have it set up to automatically render the RV into a PDF, turning it into bytes.
I have code to
A)  Open the PDF as a standalone document
B)  Open the PDF in a new window
What I want to accomplish is open the PDF within the same page, within a div/table/image/other object... And that's where I'm stumped.  VB code I currently have is below...
        Dim bytes As Byte()

        Dim warnings As Warning()
        Dim streamIds As String()
        Dim mimeType As String = Nothing
        Dim encoding As String = Nothing
        Dim extension As String = Nothing
        Dim filename As String = "PayDetail"

        bytes = rvPayroll.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamIds, warnings)

        ' ***** AUTOMATICALLY ASK THE USER TO SAVE/OPEN PDF
        'Response.Buffer = True
        'Response.Clear()
        'Response.ContentType = mimeType
        'Response.AddHeader("content-disposition", "inline; filename=" & filename & "." & extension)
        'Response.BinaryWrite(bytes)
        'Response.Flush()

        ' ***** OPEN PDF AS NEW WEB PAGE
        'Response.BufferOutput = True
        'Response.ClearContent()
        'Response.ClearHeaders()
        'Response.ContentType = mimeType
        'Response.AddHeader("Content-Length", bytes.Length.ToString)
        'Response.AddHeader("content-disposition", "inline;filename=PayDetail.pdf")
        'Response.ContentType = "applicatin/pdf"
        'Response.BinaryWrite(bytes)
        'Response.Flush()
        'Response.Clear()

I have tried turning the PDF into an image and display, but received nothing in the image box.  Tried that using:
        Dim base64String As String = Convert.ToBase64String(bytes, 0, bytes.Length)

        Image1.ImageUrl = "data:image/png;base64," & base64String

        Image1.Visible = True

A: First, create a Generic Handler called GeneratePDF.ashx. Note I didn't write the below code and I'm not a VB.NET programmer, so I can't guarantee it'll work.
'generate bytes, perhaps based on Request.QueryString parameters
`write bytes to output
Response.Buffer = True
Response.Clear()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "inline; filename=" & filename & "." & extension)
Response.BinaryWrite(bytes)
Response.Flush()

Then on our page, we use one of the techiques from the below link to embed the PDF, making sure to give the URL that points to our generic handler, and passing any parameters needed to generate the PDF via query string.
<embed src="GeneratePDF.ashx?parameter1=asdf&parameter2=qwer" width="500" height="375" type="application/pdf" />

Above code adapted from Recommended way to embed PDF in HTML?


text:
Q: MAPISendMail access violation I have a problem with MapiSendMail function of MAPI32.dll. Everything seems fine, message is completed, then I send it by winapi function, and i get an Access violation error, it happend in MAPISendMail. Here's the fragment of the code:
MAPIModule := LoadLibrary(PWideChar(MAPIDLL));
if MAPIModule = 0 then
  Result := -1
else
  try
    @SM := GetProcAddress(MAPIModule, 'MAPISendMail');
    if @SM <> nil then
    begin
      Result := SM(0, application.Handle, Msg,  MAPI_DIALOG {or  MAPI_LOGON_UI}, 0);
    end
    else
      Result := 1;
  finally

  end;

Also I was trying to change GetProcAddres to MAPISendMailW or MAPISendMailHelper, but then @SM was nil.
@Edit1
function TMail._SendMAPIEmail(const aTo, aAtts: array of AnsiString; const body, subject, SenderName, SenderEmail: string; ShowError: Boolean = true): Integer;
var
  SM: TFNMapiSendMail;
  Msg: MapiMessage;
  lpSender: MapiRecipDesc;
  Recips: array of MapiRecipDesc;
  Att: array of MapiFileDesc;
  TempAttNames: array of pAnsiChar;
  TempAttNamesAnsi: array of AnsiString;
  TempAttPaths: array of pAnsiChar;
  TempRecip: array of pAnsiChar;
  p1, LenTo, LenAtts: Integer;
  MAPIModule: HModule;
  sError: String;
  i: integer;
begin
  try
    FillChar(Msg, SizeOf(Msg), 0);
    { get the length of all arrays passed to this function }
    LenTo := length(aTo);
    if Trim(aAtts[0]) <> '' then
      LenAtts := length(aAtts)
    else
      LenAtts := 0;
    { ... }
    SetLength(Recips, LenTo);
    SetLength(TempRecip, LenTo);
    Setlength(Att, LenAtts);
    SetLength(TempAttNames, LenAtts);
    SetLength(TempAttPaths, LenAtts);
    SetLength(TempAttNamesAnsi, LenAtts);
    { to }
    for p1 := 0 to LenTo - 1 do
    begin
      FillChar(Recips[p1], SizeOf(Recips[p1]), 0);
      Recips[p1].ulReserved := 0;
      Recips[p1].ulRecipClass := MAPI_TO;
      { Upgrade }
      Recips[p1].lpszName := '';
      TempRecip[p1] := pAnsichar(aTo[p1]);
      Recips[p1].lpszAddress := TempRecip[p1];
    end;
    { atts }
    for p1 := 0 to LenAtts - 1 do
    begin
      FillChar(Att[p1], SizeOf(Att[p1]), 0);
      FillChar(TempAttPaths[p1], SizeOf(pAnsiChar), 0);
      FillChar(TempAttNames[p1], SizeOf(pAnsiChar), 0);
      FillChar(TempAttNamesAnsi[01], SizeOf(AnsiChar), 0);
      Att[p1].ulReserved := 0;
      Att[p1].flFlags := 0;
      Att[p1].nPosition := Cardinal($FFFFFFFF);
      { Upgrade }
      TempAttPaths[p1] := pAnsichar(aAtts[p1]);
      Att[p1].lpszPathName := TempAttPaths[p1];
      TempAttNamesAnsi[p1] := AnsiString((ExtractFileName(string(aAtts[p1]))));
      TempAttNames[p1] := pAnsiChar(TempAttNamesAnsi[p1]);
      Att[p1].lpszFileName := TempAttNames[p1];
    end;
    { fill the message }
    with Msg do
    begin
      ulReserved := 0;
      if subject <> '' then
        { Upgrade }
        lpszSubject := pAnsichar(AnsiString(subject));
      if body <> '' then
        { Upgrade }
        lpszNoteText := pAnsichar(AnsiString(body));
      if SenderEmail <> '' then
      begin
        lpSender.ulRecipClass := MAPI_ORIG;
        if SenderName = '' then
          lpSender.lpszName := pAnsichar(AnsiString(SenderEmail))
        else
          lpSender.lpszName := pAnsichar(AnsiString(SenderName));
        lpSender.lpszAddress := pAnsichar(AnsiString(SenderEmail));
        lpSender.ulEIDSize := 0;
        lpSender.lpEntryID := nil;
        lpOriginator := @lpSender;
      end
      else
        Msg.lpOriginator := nil;
      Msg.lpszMessageType := nil;
      Msg.lpszDateReceived := nil;
      Msg.lpszConversationID := nil;
      Msg.flFlags := 0;
      Msg.nRecipCount := LenTo;
      Msg.lpRecips := @Recips[0];
      Msg.nFileCount := LenAtts;
      Msg.lpFiles := @Att[0];
    end;
    MAPIModule := LoadLibrary(PWideChar(MAPIDLL));
    if MAPIModule = 0 then
      Result := -1
    else
      try
        @SM := GetProcAddress(MAPIModule, 'MAPISendMail');
        if @SM <> nil then
        begin
          //Result := MapiSendMail(0, application.Handle, Msg, MAPI_DIALOG, 0);
          Result := SM(0, 0, Msg,  MAPI_DIALOG {or  MAPI_LOGON_UI}, 0);
        end
        else
          Result := 1;
      finally
        if Assigned(Att) and (Msg.nFileCount > 0) then
        begin
          for i := 0 to Msg.nFileCount - 1 do
          begin
            if Assigned(Att[i].lpszPathName) then
              Att[i].lpszPathName := nil;
            if Assigned(Att[i].lpszFileName) then
              Att[i].lpszFileName := nil;
              //FreeMem(Att[i].lpszPathName);
            //Dispose(Att[i].lpszPathname);
            //StrDispose(Att[i].lpszPathName);
            //Dispose(Att[i].lpszFileName);
            //StrDispose(Att[i].lpszFileName);
          end;
          Att := nil;
        end;

        if Assigned(Recips) and (Msg.nRecipCount > 0) then
        begin
          for i := 0 to Msg.nRecipCount - 1 do
          begin
          if Assigned(Recips[i].lpszName) then
            Recips[i].lpszName := nil;
          if Assigned(Recips[i].lpszAddress) then
            Recips[i].lpszAddress := nil;
            //if Assigned(Recips[i].lpszName) then
              //Dispose(Recips[i].lpszName);

            //if Assigned(Recips[i].lpszAddress) then
              //Dispose(Recips[i].lpszAddress);
          end;
          Recips := nil;
        end;
      end;

A: Under Win32
Under Win32 it should not be a problem. Just first try calling MapiSendMail with very simple MapiMessage and if it will work, add complexity little by little. Your code is just too complex to debug it visually. Did you call MapiSendMail with very simple MapiMessage, just for testing? Please try the following code, it works for sure:
procedure TestSendExA(const APath1, ACaption1, APath2, ACaption2: AnsiString);
var
  R: Integer;
  MSG: TMapiMessage;
  F: Array [0..1] of TMapiFileDesc;
  Recipients: array[0..1] of TMapiRecipDesc;
  Originator : array[0..0] of TMapiRecipDesc;
begin
  if not FileExists(APath1) or not FileExists(APath2) then raise Exception.Create('File not found');

  FillChar(Msg, SizeOf(Msg), 0);

  Msg.lpszSubject := 'testo';
  Msg.lpszNoteText := 'Hi there!';
  Msg.lpszDateReceived := '2015/01/25 12:34';
  Msg.lpszConversationId := '1234.test@ritlabs.com';
  Msg.flFlags := MAPI_RECEIPT_REQUESTED;

  FillChar(Recipients, SizeOf(Recipients), 0);
  with Recipients[0] do
  begin
    ulRecipClass := MAPI_TO;
    lpszName := 'Maxim Masiutin';
    lpszAddress := 'maxim.test@ritlabs.com';
  end;
  with Recipients[1] do
  begin
    ulRecipClass := MAPI_CC;
    lpszName := 'Vasilii Pupkin';
    lpszAddress := 'pupkin.test@ritlabs.com';
  end;

  FillChar(Originator, SizeOf(Originator), 0);
  with Originator[0] do
  begin
    ulRecipClass := MAPI_TO;
    lpszName := 'Maxim Masiutin';
    lpszAddress := 'max@ritlabs.com';
  end;

  Msg.lpOriginator := @Originator;
  Msg.nRecipCount := 2;
  Msg.lpRecips := @Recipients;

  Msg.nFileCount := 2;
  Msg.lpFiles := @F;
  FillChar(F, SizeOf(F), 0);
  F[0].lpszPathName := PAnsiChar(APath1);
  F[0].lpszFileName := PAnsiChar(ACaption1);
  F[1].lpszPathName := PAnsiChar(APath2);
  F[1].lpszFileName := PAnsiChar(ACaption2);

  R := MAPISendMail(MapiSession, 0, Msg, 0, 0);
end;

The MapiSession in the above example is a handle to the session returned by MapiLogon.
This sample code requires that you pass two valid file paths to valid files in APath1 and APath2.
Under Win64
It is the record alignment of MapiMessage and other records that it is important when you work with Simple MAPI from Delphi: (1) make sure the records don't have "packed" prefix; and (2) make sure you have {$A8} compiler directive is explicitly specified before first record definition. This will work fine under both Win32 and Win64.


text:
Q: Minishift: Unsupported docker v1 repository request for docker I am getting the following error when trying to deploy a local Docker image to a pod in my local Minishift instance:
Failed to pull image "repo-name:port/app-name:1.0.0-SNAPSHOT-20190103151332485":
rpc error: code = Unknown desc = Error:
Status 400 trying to pull repository app-name:
"{\n \"errors\" : [ {\n \"status\" : 400,\n \"message\" :
\"Unsupported docker v1 repository request for 'docker'\"\n } ]\n}"

I have successfully deployed other pods locally using the same Docker environment.
Running docker images I can confirm my image exists locally.

A: It appears that this error can appear for a variety of reasons. Most commonly it seems to be due to invalid credentials or an issue communicating with a remote repository.
If you are certain your issue is not with remote communication, the problem might be that your image is failing to start. I have not had a chance to look into it but a better error message for this would be a great contribution to Minishift, if possible.
Test Docker Image Manually
To verify your docker image is working, try to run it manually.
Find the Image
Run: $ docker images
You should see a list that contains the image Minishift is trying to deploy. For example:
REPOSITORY                TAG                                IMAGE ID            CREATED             SIZE
repo-name:port/app-name   1.0.0-SNAPSHOT-20190103151332485   3e050126264c        14 minutes ago      704MB
repo-name:port/app-name   1.0.0-SNAPSHOT-20190103150418331   4293956e114f        23 minutes ago      704MB
repo-name:port/app-name   1.0.0-SNAPSHOT-20190103145227835   81fc7783e38f        35 minutes ago      704MB
repo-name:port/app-name   1.0.0-SNAPSHOT-20190103145203603   c5fa4815ee97        35 minutes ago      704MB

Run the Image
Once you have identified the Image ID of the image you are trying to deploy, run:
$ docker run -i -t <Image ID> /bin/bash
For example:
$ docker run -i -t 3e050126264c /bin/bash
Diagnosis
If the image fails with an error, you have likely located the problem with your Minishift deploys. Diagnose the issue until you have a healthy image then try to deploy again.
In my personal instance, I find it most reliable to delete the old application from Minishift before deploying a healthy version.


text:
Q: XSLT: Retain span between xml tag after transformation I have a simple xml and xsl which is as follows:
XML

a b

XSL
<xsl:variable name="output">
   <xsl:apply-templates select="//p"/>
</xsl:variable>

<xsl:value-of select="$output" />

<xsl:template match="p">
    <xsl:apply-templates/>
</xsl:template>

<xsl:template match="span">
    <xsl:if test="string-length(normalize-space(.)) > 0">
        <xsl:apply-templates/>
    </xsl:if>
</xsl:template>

Please note the space between the closing of first span tag and opening of second span tag.
Currently the output of this transformation gives:
Output
ab

Is there a way in XSLT where in we can retain the space between the span tag after transformation.
Desired Output
a b

Tried specifying xml:space="preserve" in both p and span template match tags. It just puts a lot of space.
Also my scenario doesn't give me option to add a place holder tag which could have been translated to empty whitespace.

A: In the absence of any other overriding templates I would expect that fragment of XSLT to produce your desired result, unless you have an xsl:strip-space instruction at the top level of your stylesheet.  If you have one of those declarations then you should remove it, or at least add
<xsl:preserve-space elements="p"/>

to countermand the strip-space for p elements specifically.


text:
Q: Jobs and schedules - how do they work with each other? could please someone enlighten me?
I have a data set and I need this data set to be refreshed on the 5th and 15th of the month.
But there can only be one schedule per Cognos object, right?
Is this the optimal solution?
I setup a schedule on the data set itself for the 5th of Month.
Then I create a job and add that data set as a job step.
I schedule the job containing that data set (which includes its own schedule) for the 15th.
What happens on the 15th and how these two schedules work with each other?
(This could also apply to reports etc).
Many thanks
I went through the documentation and some online articles, but there is no definitive answer if a data set (or a report..) can have multiple schedules set.

A: Lots here about reports and report views explaining how I handle schedules.  Substitute "dataset" and "job" and I think you'll get what you want.
One schedule per object leads to limitations.  I have found for reports that it is better to create a report view to handle the schedule.  I very rarely schedule a report anymore because I often end up needing more than one schedule or set of parameters.
Using a report view provides a means to not only create multiple schedules per report, by creating multiple report views, but also have those schedules send the reports based on independent sets of parameters.  For example, the regional VPs want reports showing their sales revenue for the month, but only for their regions.  I would create one report, then create a report view for the U.S. and a report view for Europe.  Both get sent on the 5th of the month.
Likewise, I could set up 2 report views to work around the scheduling limitations.  Say I want to send the same report on the 5th and the 15th.  I would create the report, then create 2 report views to handle the schedules.
So, to translate this to your need...
To refresh the same dataset on the 5th and the 15th, create 2 jobs that have the dataset as a step -- one job for each schedule.
Using jobs looks like the right thing to do for your use case.  I don't see another scheduling option for datasets.


text:
Q: Undefined expectation for a random variable I am having a bit of trouble with the calculation of an expectation. Solving using the distribution function I get density $2$ but this "breaks" the expectation for $\frac{Z}{1-Z}$ and I get undefined. What am I doing wrong?
~
Let $X$ be random variable $\in U(0,1)$. Let $Z = min(X, 1-X)$. Find $EZ$ and $E(\frac{Z}{1-Z})$
Any help is greatly appreciated
Thanks in advance

A: My guess as to what you've done wrong is that the density of $Z$ isn't $$p_Z(z) = 2$$ but rather $$p_Z(z) = \begin{cases}2 & \text{if} \ 0 \le z \le 1/2 \\ 0 & \text{else} \end{cases}.$$ Hence, the expectations are $$\mathbb{E}[Z] = \int_{-\infty}^{\infty}zp_Z(z)\,dz = \int_{0}^{1/2}2z\,dz$$ and $$\mathbb{E}\left[\dfrac{Z}{1-Z}\right] = \int_{-\infty}^{\infty}\dfrac{z}{1-z}p_Z(z)\,dz = \int_{0}^{1/2}\dfrac{2z}{1-z}z\,dz,$$ both of which are well-defined and finite due to the bounds of the integral.


text:
Q: Highlight long pressed table view cell and unhighlight in iOS using objective-C Highlight table view cell on long press.
I referred the link
Long press on UITableView
Long press is working fine but table view cell is not highlighting. so I added following line to handleLongPress method
[self.myTableView selectRowAtIndexPath:indexPath animated:NO  scrollPosition:UITableViewScrollPositionNone];

After highlight of long pressed cell, also following conditions should be satisfied,

*

*Touching the same long pressed table view cell should unhighlight which is like a second touch of table view cell.

*Touching the other table view cell should highlight like multiple cell selection.

*On second touch of other table view cells should unhighlight.

Long press should behave like touching the table view cell but it should not be actual touching functionality. Please guide me.

A: Try:
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}

A: please use such type of logic.
When you start long press, show row as selected while Long press ended you must deselect row.
-(IBAction)longPressBegan:(UILongPressGestureRecognizer *)recognizer
{
    if (recognizer.state == UIGestureRecognizerStateBegan)
    {
        // Long press detected, Just highlight row
    }
    else
    {
        if (recognizer.state == UIGestureRecognizerStateCancelled
            || recognizer.state == UIGestureRecognizerStateFailed
            || recognizer.state == UIGestureRecognizerStateEnded)
        {
            // Long press ended, deselect row
        }
    }
}

Hope this will help you out...........

A: So I assume all your conditions are only in case when you already long pressed a cell.
It looks like you are able to get long press work . so now

*

*Declare a BOOL in your class.
BOOL isHiglighted;

*in your long press event add
[self.myTableView selectRowAtIndexPath:indexPath animated:NO      scrollPosition:UITableViewScrollPositionNone];

YourCell *cell = [self.myTableView cellForRowAtIndexPath:indexPath];

//I dont't know your model for this tableview so I am using cell tag for it

//using 1 for selected

//2 for unselected

// 3 for long pressed one

cell.tag = 3;

isHiglighted = YES;

*Use following sudo code in your didSelectRowAtIndexPath
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    if(isHiglighted)
    {
        YourCell *cell = [self.myTableView cellForRowAtIndexPath:indexPath];
        if(cell.tag==3)
        {
            [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
            cell.tag = 2;
            isHiglighted = NO;
        }
        else if(cell.tag==1)
        {
            [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
            cell.tag = 2;
        }
        else
        {
            [self.myTableView selectRowAtIndexPath:indexPath animated:NO  scrollPosition:UITableViewScrollPositionNone];
            cell.tag = 1;
         }

    }
    else
    {
        // do your stuff ofr single tap if user never long pressed
    }
}


text:
Q: Set fix day and increment month/year in PHP date() I have this problem where I need to output specific day and will increment month and year only. This is the sample problem
if the day today(2017-12-08 Y-m-D format) is less than the 15th day of the month then output must be
| DATE       |
| 2017-12-15 |
| 2017-12-30 |
| 2018-01-15 |
| 2018-01-30 |
| 2018-02-15 |
| 2018-02-28 |

Wherein the fixed day are the 15th and 30th only and no other dates except 28th of February. And the values that increments are the month and year only. With regards to February, it will only get the last day of the month (28 or 29 if leap year occurred).
Sorry for the confusing problem, hope someone can help. Thank you.

A: for ($i = 0; $i < $whatever; $i++) {
    $fifteenth = mktime(0, 0, 0, 12 + $i, 15, 2017 + floor($i / 12));
    echo date('Y-m-d', $fifteenth), PHP_EOL;
    echo date('Y-m-', $fifteenth), min(date('t', $fifteenth), 30), PHP_EOL;
}

The $whatever in the loop condition is how many months in advance you want to print.
The 12 and 2017 in the mktime call are your starting month and year.
This directly creates a timestamp of the 15th of the month (as opposed to adding 1 month relatively to the last date, that's error prone), using mktime overflow date calculations (12 + 5 = 17 = May; note that that's an explicitly supported feature). It then uses date('t') to get the last day of the month and restricts it to a maximum of 30 using the simple min function.


text:
Q: How to embed image link in drupal? I want to add image from remote server. I have image link such as http://www.qygjxz.com/data/out/114/5095827-image.jpg
But drupal is giving only upload image option. I don't want to store image. I want to display it without storing.

A: Hi if you are running drupal 8, there is a module "Remote Image" to handle this https://www.drupal.org/project/remote_image

A: You cannot do this with the default image field. (Assuming you are using Drupal 8)
What you can do is use a plain text field to input and store the image URL and use the field value later in your template files as image source.
Alternatively you can use ck-editor directly to upload image or use external image urls, to use external URLs only you will need to uncheck "Enable image uploads" option in admin > configuration > text formats and editors > configure(your desired text format basic/full/restricted etc).


text:
Q: alternative to event log for asp.net site running on a webhost When I run a IIS site locally, all site failures (aspx compilation bugs, exceptions in code, etc) are logged to the system event log.  I can check the event log to see the HTTP request path and the exception details.
When I run the site on a webhost, I don't have access to the event log.  How can I get the same level of error information?
I should be using a logging provided that records exceptions to a database or something.  But suppose that code doesn't even get a chance to run, perhaps because a DLL doesn't load.  How could I get information about that failure?

A: On logging:
Did you look at log4net?  It separates the action of logging from the medium log entries are written to.  You can use a configuration file to direct log entries to a file or database when using the hosting service, while keeping logging to event log when developing.
On dealing with errors:
For errors that occur once that application has started, you can use Application_Error to trap exceptions that otherwise aren't handled.  If the application doesn't even start, and you don't have access to the event log, there may not be enough information for you to identify the root cause.  It might be worthwhile to deploy locally, to a server or VM that has very little installed on it, to identify missing DLLs and similar issues.


text:
Q: Comparing data of table in Snowflake database and it's exported CSV using Python pandas dataframe I am trying to compare a Table in Snowflake database with it's exported CSV file, which fails due to numeric columns in CSV exponential and datetime with milliseconds
Converted both the table read from snowflake and CSV to data frame and comparing.
sel_query = "SELECT * FROM X_TABLE"
cur.execute(sel_query)

# making dataframe from ouput of sel_query
df1 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description])
# making datafrmae from csv file
df2 = pd.read_csv("csv_file.csv", encoding="utf-8", sep=',')

dfBool = (df1 != df2).stack()
dfdiff = pd.concat([df1.stack()[dfBool], df2.stack()[dfBool]], axis=1)
dfdiff.columns = ["Snowflake data", "CSV data"]

print(dfdiff)

df1.equals(df2) should return True
and
dfdiff should be empty
Instead the ouput is as below for dfdiff:
                                Snowflake data               CSV data
0   TENURE                               452                      452
    NUMBER                             40379813              4.03798e+07
    TIME                    2018-04-09 11:34:49      2018-04-09 11:34:49.000
1   TENURE                               364                      364
    NUMBER                             40377580              4.03776e+07
    TIME                    2018-04-09 09:11:29      2018-04-09 09:11:29.000


text:
Q: How would I eliminate spacing, line breaks to have a space-delimited string for each string within my list python Hi everyone I am pretty new to python and wanted some help. I have some sample data and wanted to know how would I get rid of spacing for each string within each list.
data = [
 ['In dolore     .'], ['Voluptatum.    '],
 ['Veniam hic non minima.         '],
 ['Dolores       Quis enim'],
 ['     sequi ducimus']
 ]
 print data

The Output I desire:
data = [
 ['In dolore.'], ['Voluptatum.'],
 ['Veniam hic non minima.'],
 ['Dolores Quis enim'],
 ['sequi ducimus']
 ]

Here are the two ways I thought would work but didn't
for i in data:
str = ''.join(data)
final_data = str.replace("  ","")
print final_data

my final attempt was this:
final_data = ''.join(data)
final_data.replace("  ", "")
print final_data

A: You can use regex here
import re
for i in range(len(data)):
    data[i][0] = re.sub(r'(\w)\s\s+(\w)', r'\1 \2', data[i][0])
    data[i][0] = re.sub(r'\s\s+', r'', data[i][0])
    data[i][0] = re.sub(r"(\w)\s([.])", r"\1\2", dat[i][0])

The regex pattern \s\s+ matches all groups of 2 or more whitespace characters. As noted that would eliminate spacing between words if there was more than 1 space between two words. The r'\w\s\s+\w', r'\1 \2' takes care of that by eliminating the spaces between word boundaries with a single space.
Also note that it's data[i][0] because strangely the data is a list of lists.

A: import re
final_data = [[re.sub('\s+\.', '.', re.sub('\s+', ' ', s)).strip()] for l in data for s in l]
print final_data

[['In dolore.'], ['Voluptatum.'], ['Veniam hic non minima.'], ['Dolores Quis enim'], ['sequi ducimus']]

This way leading and trailing whitespaces are removed, while internal spaces are not eliminated entirely.
The inner substitution replaces multiple whitespace characters with a single spaces, and the outer substitution eliminates whitespace characters before a period. The strip function eliminates leading and trailing whitespace.

A: print [[s.replace("  ","")] for l in data for s in l ]


text:
Q: Long-tailed distribution of time events Suppose you have the logs of a web server. In these logs you have tuples of this kind:
user1, timestamp1
user1, timestamp2
user1, timestamp3
user2, timestamp4
user1, timestamp5
...

These timestamps represent e.g. users' clicks. Now, user1 will visit the site multiple times (sessions) during the month, and you'll have bursts of clicks from each user during each session (supposing that when a user visits your site, he'll click on multiple pages).
Suppose you want to partition these burst of clicks in the sessions that generated them, but you don't have any additional source of information, only the list of timestamps. If you compute the distribution of intervals between two consequent clicks from the same user, you will obtain a long-tailed distribution. Intuitively, you'd look for a "cut parameter", e.g. N seconds, where if timestamp_{i+1} - timestamp{i} > N, then your timestamp_{i+1} is the beginning of the new session.
The problem is that this distribution in reality is a mixture of two variables: X = "interval between two consequent clicks in the same session" and Y = "interval between the last click of the previous session and the first of the new one".
The question is, how to estimate this N, that divides the two distributions (with a bit of overlap, possibly) just by looking at the burst of clicks?

A: You really should plot the logarithm of the inter-click intervals instead of the raw values; this will flatten your distribution and might even reveal the multiple modes in your distribution.
More advanced approaches have been developed by neuroscientists to solve a very similar problem in identifying bursts of neuronal spikes. This classic paper or the many other related papers on google scholar.


text:
Q: Unity animations sprite disappearing I was recently making a Unity2D iOS Game with Unity 2D GameKit and it uses Animation to make a robot look like he is walking but I noticed a delay after the animation which makes the bot disappear for a frame!
Is there any way to stop the sprite from disappearing?
Links:
Video of disappearing robot - Google Drive
Screenshot of Animation window with blank "8" Frame! - Google Drive


text:
Q: acceder a una posicion en un json en php sin saber tu nombre soy nuevo en JSON y php mi duda es la siguiente:
como accedo a esto echo($resultado['empleados']['nombre'])
solamente con la posicion, deberia de salir asi: echo($resultado[0][0])
, pero me devuelve un null
este es el codigo:(intentos realizados)
$data= '{"empleados": {{ "nombre":"Jorge" , "apellido":"Mesa", "edad":28 } }}';
$resultado = json_decode($data);

echo($resultado['empleados']['nombre'])//funciona
echo($resultado[0][0]) //No funciona pero deseo acceder con posiciones

A: creo que se te fue una llave en el JSON, de cualquier forma necesitas parsear el JSON como un array de objetos, para hacerlo el método json_decode tiene el parámetro assoc que hace que regrese un array en lugar de un objeto, posteriormente necesitas poder acceder a la propiedad por indice, el método array_values te va a devolver todos los valores de ese nodo en un array con indices numéricos, de esta forma ya podrás acceder a los valores por medio de su posición, ejemplo:
<?php

$data= '{"empleados": { "nombre":"Jorge" , "apellido":"Mesa", "edad":28 }}';
$resultado = json_decode($data, true);

$nombre_by_prop = $resultado['empleados']['nombre'];
$nombre_by_index = array_values(array_values($resultado)[0])[0];

printf("%s\n", $nombre_by_prop);
printf("%s\n", $nombre_by_index);

?>

Documentación:
json_decode https://www.php.net/manual/es/function.json-decode.php
array_values https://www.php.net/manual/es/function.array-values.php


text:
Q: Is KVM performance for Windows guests significantly worse then other hypervisors? I use KVM extensively to run Linux VMs, and have occasionally used it to run Windows, but not heavily.
A new acquaintance who should know advised me that KVM performs really badly under Windows (with respect to using it to provide virtualized Windows desktops). If I understand correctly he put this down to poor emulation of devices/lack of or nonexistence of performant VirtIO drivers.
I'm skeptical of this claim but it is outside my area of expertise.
Is KVM (or was it until recently) markedly less performant then other virtualization platforms for running remote Windows desktops?

A: Windows performs as well as any OS under KVM (or any other hypervisor). The only anomaly is in Windows builds since 2018 which causes the Windows kernel to poll timers excessively. This manifests as high idle CPU usage of Windows VMs, typically around 30%. The linked article explains the details of how to work around it, but the diet version is that if you expose an emulated Hyper-V timer, Windows prefers it over other timers, and that timer implementation in Windows behaves in a way that is sensible in a VM. The net result is that the idle CPU usage goes from 30% down to a much more reasonable 1%.


text:
Q: Auto-Incrementing Sequence Field Mean Stack I have a collection created for maintaining ticket_no, for which document looks like this,
{
  id:"TICKET_ID",
  TICKET_NO:7
}

Now, when I try to findOneAndUpdate for a ticket_id, incrementing TICKET_NO by 1,
function get(){
     var ret = Sequence.findOneAndUpdate(
            {
                query: { _id: 'TICKET_ID' },
                update: { $inc: { TICKET_NO: 1 } },
                new: true
            }
        );

        console.log(ret.TICKET_NO)
        return ret.TICKET_NO;
}

The function returns null value instead of ticket no

A: What you are getting in ret is the findOneAndUpdate function object, not your actual document.
You need to listen to callback or use async/await for the value to be there,
Try one of these,
async function get(){
     var ret = await Sequence.findOneAndUpdate(
          { _id: 'TICKET_ID' },
          { $inc: { TICKET_NO: 1 } },
          { new: true }
     );

     console.log(ret.TICKET_NO) // now the ret is the doc you need
     return ret.TICKET_NO; // prints correctly
}

or,
function get(){
     Sequence.findOneAndUpdate(
          { _id: 'TICKET_ID' },
          { $inc: { TICKET_NO: 1 } },
          { new: true },
          function(err, ret) {
            if (err) {
              console.error(err)
            } else {
              console.log(ret.TICKET_NO) //successful callback returns ret
            }
          });
     );
}


text:
Q: compiling Poco-1.5.1 with MinGW I'm trying to compile Poco-1.5.1 with MinGW (gcc 4.7.0) under Windows 7.
It have the std::copysign issues at Foundation\include\Poco\FPEnvironment_DUMMY.h, but it is easy to solve commenting "std::" at copySignImpl methods.
My next problem comes with file "Foundation\src\EventLogChannel.cpp", that is trying to include "pocomsg.h", that doesn't exist.
I have read that pocomsg.h is generated from pocomsg.mc script. MC is a Message Compiler from Microsoft, and it is not present in my MinGW system. So should I include manually pocomsg.h as say this post?
poco Lib dosnt compile in vs express 9
Is there a better way to solve this?
Thanks.

A: pocomsg.h should be found in ../Foundation/src/
It doesn't contain too much important stuff according to this post, A couple of defines:
#define POCO_CTG_FATAL                   0x00000001L
#define POCO_CTG_CRITICAL                0x00000002L
#define POCO_CTG_ERROR                   0x00000003L
#define POCO_CTG_WARNING                 0x00000004L
#define POCO_CTG_NOTICE                  0x00000005L
#define POCO_CTG_INFORMATION             0x00000006L
#define POCO_CTG_DEBUG                   0x00000007L
#define POCO_CTG_TRACE                   0x00000008L
#define POCO_MSG_LOG                     0x00001000L

Are the guts of the file. Try defining them yourself in Poco.h, possibly.


text:
Q: Parsing XFN data with Jquery, round 2 You guys already helped me on correctly parsing the REL attribute on A tags, but there are two XFN values that I'm not able to match:
"co-worker" and "co-resident". The hyphen causes an error with jquery.
I tried this
xfn_co-worker = $("a[rel~='co-worker']").length;

and this
xfn_co-worker = $("a[rel~='co\-worker']").length;

In both cases the error "Uncaught ReferenceError: Invalid left-hand side in assignment" is returned.
(Being these standard XFN values, I'm forces to use them)
Any idea is appreciated, as usual :-)

A: This isn't an error in you selector. The error lies in your variable name.
You can't use mathematical operators in the variable name. So the problem is your use of the - sign.
Try replacing
xfn_co-worker

with e.g
xfn_co_worker

And it should work alright
xfn_co_worker = $("a[rel~='co-worker']").length;

Note: Your variable name must match the following regex [a-zA-Z_$][0-9a-zA-Z_$]*


text:
Q: MVC 3: What's the most common way of asynchronously loading form fields based on previous choices? Imagine having two list boxes on a form, where the choices in the second depend on what's been picked in the first. What's the most common, or cleanest way of going about this with MVC3?

A: I would say that you would need two things to accomplish this cleanly; Ajax and a Json ActionResult
$('#listbox').change(function() {
  $.ajax({
    url: '/ListBoxChange',
    method: 'POST',
    data: {
      listBoxValue: 'The value'
    },
    success: function(data) {
      alert (data.Result);
    }
  });
});

The Action Result:
[HttpPost]
public ActionResult ListBoxChange(string listBoxValue)
{
   string result = GetResult();
   return Json(new {
     Result = result
   });
}

A: Alternatively can use the MVC framework, directly binding back to view after a partial refresh. I've used the following for complex dynamic searches, works decently.
<script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script>
 <script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script>

    <% using (Ajax.BeginForm("/GetProducts",
        new AjaxOptions()
        {
            InsertionMode = InsertionMode.Replace,
            HttpMethod = "POST",
            OnBegin = "beginSearchLoader",
            OnComplete = "completeSearchLoader",
            UpdateTargetId = "divSelectionResult"
        }
    ))
 { %>

            <div id="divSelectionResult">
                <% Html.RenderPartial(Html.ProductViewPath("ProductContainer") , Model); %>
            </div>

    public ActionResult GetProducts(FormCollection form)
    {
      //search parameters used in Form
      ProductModel modelData = Search(form);
      ViewData.Model = modelData;

      //AJAX Partial View Return
      return PartialView(Constants.VIEW_FOLDER + "ProductContainer" + Constants.PARTIALVIEW_EXTENSION);
    }

FYI: Some of the code is using custom helpers and etc.


text:
Q: Split many CSV files into a few bigger files in Linux I have a bunch of small CSV files (a few hundred files about 100 MB each) that I want to pack into several bigger files. I know how to join all (or a subset) of those files into one file - I simply need to use cat command in Linux and redirect its output to a file. My problem is the result files have to be not bigger than some size (say, 5 GB), i.e. merging all small files into one is not a solution because the resulting file will be too big. So, I am wondering if there is a way to do it in the command line that would be simpler than writing a bash script looping over the directory?
Thanks.

A: The split command does exactly what you need.  You can have it split STDIN to different outputs based on size or number of lines.  You can also specify the output file suffix.


text:
Q: Webpack 2 Code Spliting with Server Side Rendering and React-Router-v4 Using webpack2.2.0-rc1 and react routerv4, and using this gist to make code spliting to work, which states the following
function asyncComponent(getComponent) {
  return class AsyncComponent extends React.Component {
    static Component = null;
    state = { Component: AsyncComponent.Component };

    componentWillMount() {
      if (!this.state.Component) {
        getComponent().then(Component => {
          AsyncComponent.Component = Component
          this.setState({ Component })
        })
      }
    }
    render() {
      const { Component } = this.state
      if (Component) {
        return <Component {...this.props} />
      }
      return null
    }
  }
}

const Foo = asyncComponent(() =>
  System.import('./Foo').then(module => module.default)
)

It actually  works, but  I am using server side rendering. So on the server I require component A, then on the client I System.import component A.
FInally when I access the lazy loaded route I get this react reuse markup warning because the client rendered
initially loaded null from https://gist.github.com/acdlite/a68433004f9d6b4cbc83b5cc3990c194#file-app-js-L21
while loading Component A.

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) CO 0.0.0


text:
Q: Magento 2.3 Punchout Gateway integration issue. Product Price is showing 0 on detail and cart pages I am facing a strange issue, Our site is integrated with Punchout Gateway. While simulating the site using cXML the product price turns into 0 on the detail page as well as in cart page.
The website is working fine individually. Can you please help me with that.

A: You should check the account you're logged in as. It probably doesn't belong to the correct customer group or company in your eCommerce environment.


text:
Q: How can I run Spring Boot service from Android Studio? I am a newbie in Android development and I am currently facing issues to find any relevant reference for running a spring boot service on Android. What I could find was more related to Client-Server architecture. What If I do not want to use it as a Client and run the service locally ? Is there any reference or does someone has an idea about it ?

A: You need to learn Retrofit.
Here is a link that can help you:
         https://www.vogella.com/tutorials/Retrofit/article.html


text:
Q: Using node+express with angularjs For instance, I have index.ejs
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
    $routeProvider
    .when("/banana", {
        template :
    })
    .when("/tomato", {
        template :
    });
});

Question here is how to render banana.ejs and tomato.ejs like SPA? So, when I click on the "banana" it should render banana.ejs(not banana.html) without reloading the page.

A: Hi you may use this following code:
<!DOCTYPE html>

Main

Red
Green
Blue

Click on the links to navigate to "red.htm", "green.htm", "blue.htm", or back to "main.htm"


text:
Q: "Field is required message" before submitting form I am trying to throw 'Field required' messages once the user has submitted a form and they have not filled the required fields.
What is happening is that the error is being showed even before the form has been submitted. Isn't the validation supposed to be done after the submission?
I have the following form:
class LookforPlace(forms.Form):
    name = forms.CharField(required=True,max_length=100,label='Name',error_messages = {'required': "This field is required..."})
    city = forms.CharField(required=False,label='City')
    email = forms.EmailField()

I have the following view:
def newreview(request):
    if request.method == 'GET': # If the form has been submitted...
        form = LookforPlace(request.GET) # A form bound to the GET data
        if form.is_valid(): # All validation rules pass
            return HttpResponseRedirect('/newreview/valid') # Redirect after GET
    else:

        form = LookforPlace() # An unbound form
    return render_to_response('newreview.html', {
        'form': form,
    })

And I have the following HTML code:
 <form action="/newreview/" method="get">
{% for field in form %}
        <div class="fieldWrapper">
            {{ field.errors }}
            {{ field.label_tag }}: {{ field }}
        </div>
    {% endfor %}
<input type="submit" value="Submit" />
</form>

A: A GET is issued when you browse to a page normally, not just when you submit a form with that method - if you want to use the same view to display an initial form and handle submission via GET, you should check for a value from the form having been submitted.
One option is to give the submit button a name...
<input type="submit" name="submit" value="Submit">

...and check for that name having been submitted as a parameter (this is also a good way to handle forms with multiple submit buttons, as only the button which was clicked will count as a successful control and have its name submitted as a parameter in the request):
if 'submit' in request.GET:
    # ...


text:
Q: vimeo direct upload form According to Vimeo it is possible to send the upload directly to their server, without having to use the hosting server of the site.
https://help.vimeo.com/hc/en-us/articles/224970068-Can-I-upload-directly-to-Vimeo-and-skip-my-server-entirely-
With documentation:
https://developer.vimeo.com/api/upload/videos#http-post-uploading
But, I did not find any examples or I could understand how to do this

A: Resolved
Download API Vimeo: API Vimeo
Load API: File: vimeo_init.php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
// Load the autoloader
if (file_exists('/vimeo/autoload.php')) {
    // Composer
    require_once('/vimeo/autoload.php');
} else {
    // Custom
    require_once(__DIR__ . '/vimeo/autoload.php');
}
// Load the configuration file.
if (!function_exists('json_decode')) {
    throw new Exception(
        'We could not find `json_decode`. `json_decode` is found in PHP 5.2 and up, but not found on many Linux ' .
        'systems due to licensing conflicts. If you are running Ubuntu try `sudo apt-get install php5-json`.'
    );
}
$config = json_decode(file_get_contents(__DIR__ . '/vimeo_config.json'), true);
if (empty($config['client_id']) || empty($config['client_secret'])) {
    throw new Exception(
        'We could not locate your client id or client secret in "' . __DIR__ . '/vimeo_config.json". Please create one, ' .
        'and reference config.json.example'
    );
}
return $config;

Config API KEY: File vimeo_config.json
{
    "client_id" : "",
    "client_secret" : "",
    "access_token" : ""
}

File POST PHP: File Upload Video
use Vimeo\Vimeo;
use Vimeo\Exceptions\VimeoUploadException;
$config = require(__DIR__ . '/vimeo_init.php');

$files =  array($_FILES['video_arquivo']['tmp_name']); //array_shift($files);
if (empty($config['access_token'])) {
    throw new Exception(
        'You can not upload a file without an access token. You can find this token on your app page, or generate ' .
        'one using `auth.php`.'
    );
}

$lib = new Vimeo($config['client_id'], $config['client_secret'], $config['access_token']);
$uploaded = array();

foreach ($files as $file_name) {
    try {
        $uri = $lib->upload($file_name, array(
            'name' => 'titulo',
            'description' => 'descricao'
        ));

        $video_data = $lib->request($uri);

        if ($video_data['status'] == 200) {
            $video_vimeo = $video_data['body']['link'];
        }

        $uploaded[] = array('file' => $file_name, 'api_video_uri' => $uri, 'link' => $link);
    } catch (VimeoUploadException $e) {
        $result["is_valid"] = false;
        $result["message"] = $e->getMessage();
    }
}


text:
Q: Get file mouseover text Is there any way to get the filename or mouseover text of a file that is under the cursor in Python? For example, the cursor in the image below is over the file 'twelve'. Is there any way to get the text 'twelve' or the mouseover text of that file? Thanks.

import tkinter as tk

def onKeyPress(event):
    text.config(text='You pressed %s\n' % (event.char, ))

root = tk.Tk()

w = 600
h = 200
x = 50
y = 100
root.geometry("%dx%d+%d+%d" % (w, h, x, y))

frame = tk.Frame(root)
frame.pack(fill='both', expand='yes')

text = tk.Label(frame)
text.place(x=400, y=120)

root.bind('<KeyPress>', onKeyPress)

root.mainloop()


text:
Q: Communication between Azure WebApp and WebJob I've created a webapp that creates a WebJob on azure and the webjob returns its progress to the webapp. This is implemented by using SignalR, by following this link. I can see the progress on localhost but when I upload the webapp, there progress stays at zero, there is no response.
my app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="ProgressNotificationEndpoint" value="http://myapp.azurewebsites.net/Home/ProgressNotification" />
    <!--<add key="ProgressNotificationEndpoint" value="http://localhost:49728/Home/ProgressNotification" />-->
  </appSettings>
  <connectionStrings>
    <!-- The format of the connection string is "DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY" -->
    <!-- For local execution, the value can be set either in this config file or through environment variables -->
    <add name="AzureWebJobsDashboard" connectionString="DefaultEndpointsProtocol=https;AccountName=inawkwebjobstorage;AccountKey=Z332waP6e4wSeWfm8RPoeG9QwSh5fDxOfQv39dKyGVB513COCbNFRHKcRkq7GBIncJXcDVuASdVDze8D6llyew==;BlobEndpoint=https://inawkwebjobstorage.blob.core.windows.net/;TableEndpoint=https://inawkwebjobstorage.table.core.windows.net/;QueueEndpoint=https://inawkwebjobstorage.queue.core.windows.net/;FileEndpoint=https://inawkwebjobstorage.file.core.windows.net/" />
    <add name="AzureWebJobsStorage" connectionString="DefaultEndpointsProtocol=https;AccountName=inawkwebjobstorage;AccountKey=Z332waP6e4wSeWfm8RPoeG9QwSh5fDxOfQv39dKyGVB513COCbNFRHKcRkq7GBIncJXcDVuASdVDze8D6llyew==;BlobEndpoint=https://inawkwebjobstorage.blob.core.windows.net/;TableEndpoint=https://inawkwebjobstorage.table.core.windows.net/;QueueEndpoint=https://inawkwebjobstorage.queue.core.windows.net/;FileEndpoint=https://inawkwebjobstorage.file.core.windows.net/" />

  </connectionStrings>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

my web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <appSettings>

    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="owin:AppStartup" value="inawk.Startup" />
  </appSettings>
  <connectionStrings>
    <add name="QueueStorageConnectionString" connectionString="DefaultEndpointsProtocol=https;AccountName=..." />
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" />

    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>


text:
Q: How do I setup my association for Pages that are moveable/can belong to other Journals? I have 2 models: Journal and Page. I have a couple of things I want to be able to do with this association.

*

*I want to be able to have a MainPage have many Subpages like a Chapter.

*I want to be able to move the MainPage and Subpages or just a single Page over to a different Journal.

*I want to be able to turn a MainPage into a Subpage and vice versa.
Here's my models so far:
class Page < ActiveRecord::Base
  belongs_to :user
  belongs_to :journal
end

class Journal < ActiveRecord::Base
  belongs_to :user
  has_many :pages
end

How would I go about doing the 3 above?

A: to satisfy requirement 1 you'd need a self reference from pages to pages. this problem is already answered here
You'd do something like this
class Page < ActiveRecord::Base
  belongs_to :user
  belong_journal
  has_many :pageRelations, :foreign_key => "page_id", :class_name => "PageRelation"
  has_many :pages, :through => :pageRelations

  def addSubPage(page)
    # TODO: put in check that association does not exist
    self.pages << page
    page.pages << self
  end
end

class PageRelation < ActiveRecord::Base
  belongs_to :parentPage, :foreign_key => "page_id", :class_name => "Page"
  belongs_to :subPage, :foreign_key => "page_id", :class_name => "Page"
end

requirement 2 will be trivial since you already stored the foreign key to the journal
page = Page.new
page.journal= Journal.new

for requirement 3 you have 2 aspects.
1 turning a main page into a subpage
this is simply adding it in a relation to another page
sPage = Page.new
pPage = Page.new
pPage.addSubPage(sPage)

for the second aspect you'd need to remove the page from all the relations where it is a subPage.
You will probably also want to do some bookkeeping to flag wether or not a page is a subpage or a root page.