text:
Q: XCode 3.2 configuration still accessing OS X 10.4 framework when 10.5 is selected I wanted to try and use some features introduces in 10.5 (like Core Text), so I set the Base SDK and Deployment target both to Mac OS X 10.5
I am also certain that all referenced Frameworks have a path relative to the selected SDK, and the tooltip also currently says it is looking in the 10.5 folder.
When I try to compile it however, I get various warninings and errors that make it look like it is still referencing 10.4:
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1492:0 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1492: warning: 'OTSetNBPEntityFromAddress' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1172)
.../code/utils/modules/Skins/SkinFont.h:36:0 .../code/utils/modules/Skins/SkinFont.h:36: error: 'CTFontRef' does not name a type
What's even stranger is that this is not working in the 'Debug' configuration, but it is successfully working in another configuration.
I compared all configuration settings, but I couldn't find any difference.
Does anyone know if there is another place I should be looking for this?
Edit: I did found one similar problem from someone else, but unfortunately there are no useful replies yet:
http://lists.apple.com/archives/xcode-users/2009/Sep/msg00200.html
Edit2: Here is the compiler output, I've removed some of the warnings since there were about 50 deprecated functions mentioned.
CompileC build/Test10_4.build/Debug/djDecks_Mac.build/Objects-normal/i386/DJDecksVideoRenderer.o ../code/utils/modules/djDecks/DJDecksVideoRenderer.cpp normal i386 c++ com.apple.compilers.llvmgcc42
cd /Users/gwenroelants/Test10_4
setenv LANG en_US.US-ASCII
/Developer/usr/bin/llvm-gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -DHAVE_STRERROR -DUSEFFMPEG -D__MACOSX__ -isysroot /Developer/SDKs/MacOSX10.5.sdk -mfix-and-continue -msse3 -fvisibility-inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -I/Users/gwenroelants/Test10_4/build/Test10_4.build/Debug/djDecks_Mac.build/djDecksForMac.hmap -F/Users/gwenroelants/Test10_4/build/Debug -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks -I/Users/gwenroelants/code/lib/ffmpeg/ffmpeg -I/Users/gwenroelants/code/lib/flac/src/libFLAC/include -I/Users/gwenroelants/code/lib/flac/include -I/Users/gwenroelants/Test10_4/build/Debug/include -I/Users/gwenroelants/Test10_4/build/Test10_4.build/Debug/djDecks_Mac.build/DerivedSources/i386 -I/Users/gwenroelants/Test10_4/build/Test10_4.build/Debug/djDecks_Mac.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.5.sdk -include /var/folders/Hh/Hhx2ce3OHReLY+QJa3OmM++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/Test10_4_Prefix-cqnssmqwhfbgbtdcgyppeyqdmggp/Test10_4_Prefix.pch -c /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksVideoRenderer.cpp -o /Users/gwenroelants/Test10_4/build/Test10_4.build/Debug/djDecks_Mac.build/Objects-normal/i386/DJDecksVideoRenderer.o
Headers/OSServices.h:46,
                 from /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:28,
                 from /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioFile.h:27,
                 from /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.h:22,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/AudioDecoder/AudioDecoder.h:37,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Audio/player.h:10,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Audio/FModPlayer.h:9,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksPlayer.h:9,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksVideoRenderer.h:9,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksVideoRenderer.cpp:7:
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h: In member function 'OSStatus TInternetServices::StringToAddress(char*, InetHostInfo*)':
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:581: warning: 'OTInetStringToAddress' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:504)
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h: In member function 'OSStatus TInternetServices::Query(char*, UInt16, UInt16, char*, OTByteCount, void**, OTByteCount, OTFlags)':
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:596: warning: 'OTInetQuery' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:571)
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:596: warning: 'OTInetQuery' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:571)
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h: In member function 'OSStatus TAppleTalkServices::GetMyZone(TNetbuf*)':
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:903: warning: 'OTATalkGetMyZone' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:846)
OpenTransportProviders.h:1492: warning: 'OTSetNBPEntityFromAddress' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1172)
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1492: warning: 'OTSetNBPEntityFromAddress' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OpenTransportProviders.h:1172)
In file included from /Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinObject.h:15,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinTab.h:10,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinTabGroup.h:11,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinWindow.h:12,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/Skins/Skin.h:12,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DjDecks.h:11,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksPlayer.h:16,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksVideoRenderer.h:9,
                 from /Users/gwenroelants/Test10_4/../code/utils/modules/djDecks/DJDecksVideoRenderer.cpp:7:
/Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinFont.h: At global scope:
/Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinFont.h:36: error: 'CTFontRef' does not name a type
/Users/gwenroelants/Test10_4/../code/utils/modules/Skins/SkinFont.h:37: error: 'CTFontRef' does not name a type

A: In the configuration that's not working, type "10.4" into the Build Settings search field and see what comes up. I expect the Framework Search Paths build setting has an explicit path to the 10.4 SDK somewhere.
It would indeed be helpful to have the text of the compiler invocation, just drag and drop the "Compiling" build step that's failing.
UPDATE
Thanks for posting the log.  It's very clearly in there:
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks

That means that you have a Framework Search Path pointing directly into the 10.4u SDK even when you're using the 10.5 SDK.  You have to go through your target and project Framework Search Path and find this path and delete it.

A: i was having the same problem. And my solution...
Go to Project->Edit project settings...and look for Base SDK (under Architectures). Since i am using 10.6 i changed mine to "Mac OS X 10.6" and things started working.

A: My guess (from my own experience) is that the target, project and configuration don't all agree. I still haven't figured out which one takes precedence over the other...


text:
Q: My Chrome addon for removing Youtube autoplay breaks posting on forums I am trying to make a Chrome addon that removes the autoplay from embedded Youtube videos. However, when I try to post on a forum that has a minimum character limit for posts, I get an error about my post not being long enough. That occurs only when my addon is active. Here is my codes:
manifest.json:
{
   "content_scripts": [ {
      "js": [ "js/replace.js" ],
      "matches": [ "http://*/*" ],
      "run_at": "document_idle"
   } ],
   "description": "some text",
   "manifest_version": 2,
   "name": "No autoplay",
   "permissions": [ "tabs", "http://*/*" ],
   "version": "1.0"
}

replace.js:
var str1 = '&autoplay=1', str2 = '?autoplay=1', empty = '', regex1 = /\\&autoplay=1/gi, regex1 = /\\?autoplay=1/gi;
var ind = document.body.innerHTML.indexOf(str1);
while (ind != -1) {
    console.log("replacing");
    document.body.innerHTML = document.body.innerHTML.replace(regex1, empty);
    ind = document.body.innerHTML.indexOf(str1);
}
ind = document.body.innerHTML.indexOf(str2);
while (ind != -1) {
    console.log("replacing");
    document.body.innerHTML = document.body.innerHTML.replace(regex2, empty);
    ind = document.body.innerHTML.indexOf(str2);
}

A: If a link contains str2, you are deleting ? character. That means, all other $_GET parameters are being moved to url section.
For example:
someurl.com?autoplay=1&movie_id=10 turns into someurl.com&movie_id=10 ... and it is invalid, because it should be someurl.com?movie_id=10...
Safer way would be replacing autoplay=1 with autoplay=0.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ubuntu 14.04 Gnome shell display changed. How to restore default On ubuntu 14.04, default GNOME Terminal, its behavior changed. By example, when I do cd ~/Download/ I expect the following:

But I get the following, without the username@computername:path$

Any idea how to fix this ?

A: Question Solved by Original Poster:
Ubuntu 14.04 Gnome shell display changed. How to restore default
Just forgot to restore the original skin for the Shell.


text:
Q: NSDate by NSCalendar's dateFromComponent I'm having an issue with this code:
+ (NSDate *)dateByMovingToBeginningOfDay:(NSDate *)date
{
    unsigned int flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;

    NSDateComponents* parts = [[NSCalendar currentCalendar] components:flags fromDate:date];
    [parts setHour:0];
    [parts setMinute:0];
    [parts setSecond:0];

    return [[NSCalendar currentCalendar] dateFromComponents:parts];
}

+ (NSDate *)dateByMovingToEndOfDay:(NSDate *)date
{
    unsigned int flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;

    NSDateComponents *parts = [[NSCalendar currentCalendar] components:flags fromDate:date];
    [parts setHour:23];
    [parts setMinute:59];
    [parts setSecond:59];

    return [[NSCalendar currentCalendar] dateFromComponents:parts];
}

+ (BOOL)checkForReportInDate:(NSDate *)date forUser:(User *)user
{
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSManagedObjectContext *context = appDelegate.managedObjectContext;

    NSDate *startDate = [NSDate dateByMovingToBeginningOfDay:date];
    NSDate *endDate = [NSDate dateByMovingToEndOfDay:date];

    NSLog(@"apply date: %@", date.description);
    NSLog(@"start date: %@", startDate.description);
    NSLog(@"end date: %@", endDate.description);

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    fetchRequest.entity = [NSEntityDescription entityForName:@"Report" inManagedObjectContext:context];
    fetchRequest.predicate = [NSPredicate predicateWithFormat:@"user == %@ AND (date > %@ AND date < %@)", user, startDate, endDate];
    fetchRequest.fetchLimit = 1;

    NSError *error = nil;

    NSUInteger reportExist = [context countForFetchRequest:fetchRequest error:&error];

    if(error != nil) {
        NSLog(@"Error: %@", [error localizedDescription]);
        return NO;
    }

    if(reportExist > 0) {
        return 1;
    }
    else {
        return 0;
    }
}

It generates wrong start date... in my console I have
2012-04-12 14:34:46.456 iFood Pro[23820:fb03] Save Report to Database
2012-04-12 14:34:46.458 iFood Pro[23820:fb03] apply date: 2012-04-12 12:34:41 +0000
2012-04-12 14:34:46.458 iFood Pro[23820:fb03] start date: 2012-04-11 22:00:00 +0000
2012-04-12 14:34:46.459 iFood Pro[23820:fb03] end date: 2012-04-12 21:59:59 +0000
start date should be 2012-04-12 00:00:00 +0000 instead of 2012-04-11 22:00:00 +0000
Why of this behavior? I'm getting out of mind!

A: fixed, the problem was the timezone... using [parts setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; solves the issue


text:
Q: Why doesn't directive work if I put name as an attribute rather than a tag? In the example from the Angular documentation, a directive can be used by putting its name as an attribute in a
. The example given is

with the js looking like
angular.module('docsSimpleDirective', [])
  .controller('Controller', ['$scope', function($scope) {
    $scope.customer = {
      name: 'Naomi',
      address: '1600 Amphitheatre'
    };
  }])
  .directive('myCustomer', function() {
    return {
      template: 'Name: {{customer.name}} Address: {{customer.address}}'
    };
  });

However, in a similar example, over here, if I change the html code from <tree> to
, the code no longer works.
Why not?
The code from JS Fiddle:

        <tree family="treeFamily">

{{ family.name }}

        </tree>

var module = angular.module('myapp', []);

module.controller("TreeCtrl", function($scope) {
    $scope.treeFamily = {
        name : "Parent",
        children: [{
            name : "Child1",
            children: [{
                name : "Grandchild1",
                children: []
            },{
                name : "Grandchild2",
                children: []
            },{
                name : "Grandchild3",
                children: []
            }]
        }, {
            name: "Child2",
            children: []
        }]
    };
});

module.directive("tree", function($compile) {
    return {
        restrict: "E",
        transclude: true,
        scope: {family: '='},
            template:
            '
' +
                '

' +
                '
' +
                    '<tree family="child">{{family.name}}</tree>' +
                '
' +
            '
',
        compile: function(tElement, tAttr, transclude) {
            var contents = tElement.contents().remove();
            var compiledContents;
            return function(scope, iElement, iAttr) {
                if(!compiledContents) {
                    compiledContents = $compile(contents, transclude);
                }
                compiledContents(scope, function(clone, scope) {
                         iElement.append(clone);
                });
            };
        }
    };
});

tree {
    margin-left: 20px;
    display: block;
}

A: It's because of the restrict option in the directive.
Here it is set to e which means to match only the element name.
More https://docs.angularjs.org/guide/directive

A: The restrict option is used to specify how a directive can be invoked on the page. There are four different ways to invoke a directive, so there are four valid options for restrict:
'A' - attribute -
'E' - element - <ng-sparkline></ng-sparkline>
'C' - class -
'M' - comment -

In your case its not working because it is defined as restrict 'E' - element.


text:
Q: where is admin footer? hi im working on my new wordpress website. and i wanted to add custom order status in my woocommerce order status and i found this code:-
function custom_bulk_admin_footer() {
            global $post_type;

            if ( $post_type == 'shop_order' ) {
                ?>
                    <script type="text/javascript">
                        jQuery(document).ready(function() {
                            jQuery('<option>').val('mark_invoiced').text('<?php _e( 'Mark invoiced', 'textdomain' ); ?>').appendTo("select[name='action']");
                            jQuery('<option>').val('mark_invoiced').text('<?php _e( 'Mark invoiced', 'textdomain' ); ?>').appendTo("select[name='action2']");
                        });
                    </script>
                <?php
            }
        }

the question is , where should i put the code ? should i put it in my theme function.php ? or put it in admin_footer? if so can someone navigate me to the admin_footer section?

A: So the question that you found this code from here says that they added this to the admin_footer action. So you could add that custom_bulk_admin_footer to your functions.php, and then hook it into the admin_footer action with this after the function:
add_action('admin_footer', 'custom_bulk_admin_footer');

Obviously you need to change the jQuery code to do what you want inside the function too ;-)
HTH


text:
Q: Condition for: A simple quotient metric induced by surjective map + equivalence relation Let $X$ be a metric space and let $f:X\rightarrow Z$ be a surjective map onto some set $Z$.  Define the pseudo-metric $d_f$ on $Z$ by:
$$
d_f(z_1,z_2)\triangleq \inf_{\underset{f(x_i)=z_i}{x_i\in X}}
\,
d_X(x_1,x_2),
$$
Under what conditions is $d_f$ a metric on $Z/\sim$ where $z\sim \tilde{z}$ if and only if $f^{-1}[z]\cap f^{-1}[\tilde{z}]\neq \emptyset$?

It seems as though we only need to show that
$d_f([x],[z])\leq d_f([x],[y])+d_f([y],[z])$?


text:
Q: Markov Chain, absorbing probability and expectation Let $\{X_n\}_{n = 0,1,\ldots}$ be a DTMC with state space $S = \{0,\ldots,M-1,M,\ldots,N\}$, where $0,1,\ldots,M-1$ are transient states and $\{M,\ldots,N\}$ are absorbing states. Hence the transition matrix has a block structure:
$P = \begin{pmatrix}  Q & R \\
0 & I \end{pmatrix}$
Let $T:= min\{n \ge 0 : M \le X_T \le N\}$ be the absorbing time, and let $\underline{\alpha_0}$ be the initial distribution.
(1) Find $P(T > k, X_T = j)$ for $k = 0,1,2,\ldots$, $j = M,\ldots,N$
(2) Find $E[T|X_T = j]$ for $j = M,\ldots,N$
Here is my trial for (1): since $P(X_T = j, T > k) = \sum_{n=k+1}^{\infty} P(X_T = j, T = n)$, and for each $n$, $P(X_T = j, T = n) = \sum_{x_0 \in [0,M-1]}\sum_{x_1 \in M-1}\ldots \sum_{x_{n-1} \in [0,M-1]}P(X_0 = x_0,\ldots,X_{n-1} = x_{n-1},X_n = j) \\
= \sum_{x_0 \in [0,M-1]}\sum_{x_1 \in M-1}\ldots \sum_{x_{n-1}} \alpha_{0,x_0} P_{x_0,x_1} \ldots P_{x_{n-2},x_{n-1}} P_{x_{n-1},j} \\
= \underline{\alpha_0}' Q^{n-1} R_j$
Where $\underline{\alpha_{0}}'$ is a row vector consist of the first $M$ entries from the initil distribution and $R_j$ is the $j-th$ column from matrix $R$
Can someone check the correctness of my solution? Thanks! Also, I appreciate your help for part (2)


text:
Q: How can I suspend appstats for a single request on App Engine/Java? I normally run appstats fulltime on my sandbox appid.  However, I have one complicated operation (basically rebuilding the stock database) that causes appstats to blow up my instance, throwing OutOfMemoryErrors.  Even with larger instance sizes, it still fails.  Appstats just wants too much RAM.
I don't need appstats on this request.  Ideally I will call a method on whatever ThreadLocal object is responsible for appstats collection and tell it to twiddle its thumbs for a few minutes.
I've considered extending the AppstatsFilter to ignore certain URLs, but the offending request executes as a deferred task and identifying it by path is somewhat complicated.
How can I tell appstats to pause?
Just in case it isn't clear:  Uploading a version of my app with appstats disabled, running my task, then uploading a version with appstats enabled is what I'm doing now.  I don't want to do this.

A: What I did is write my own CustomAppstatsFilter and exclude certain url's.
public class CustomAppstatsFilter extends AppstatsFilter {

  @Override
  public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain) throws IOException, ServletException {

    if (request instanceof HttpServletRequest) {
        String url = ((HttpServletRequest) request).getRequestURL().toString();

        // We do not want these to show up in appstats
        if ((url.contains("appstats"))
                || url.contains("_ah/")
                || url.contains("cron/")
                || url.contains("batch/")) {
            chain.doFilter(request, response);
            return;
        } else {
            super.doFilter(request, response, chain);
        }
    }
  }
}

EDIT - This can be combined with ZiglioNZ great answer.
<!-- Appstats filter for profiling application -->
<filter>
    <filter-name>appstats</filter-name>
    <filter-class>my.company.filter.CustomAppstatsFilter</filter-class>
    <init-param>
        <param-name>maxLinesOfStackTrace</param-name>
        <param-value>5</param-value>
    </init-param>
</filter>
<filter-mapping>
    <!-- excludes are in CustomAppstatsFilter -->
    <filter-name>appstats</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

A: Good question.  For Python, the answer is simple:
from google.appengine.ext.appstats import recording

class ...(webapp.RequestHandler):
  def get(self):
    recording.dont_record()
    ...

Maybe there's a similar API in Java?
Alternatively, again the Python version has a flexible way of filtering out which requests to record; I think in the Java version you can accomplish a similar thing by using the  and  entries in your web.xml.  (See the Java appstats docs.)

A: Jeff, I wonder whether this can help you reducing the occurence of OutOfMemoryErrors:
How to reduce the memory usage of Appstats on Google App Engine Java
<filter>
  <filter-name>appstats</filter-name>
    <filter-class>com.google.appengine.tools.appstats.AppstatsFilter</filter-class>
    <init-param>
      <param-name>maxLinesOfStackTrace</param-name>
      <param-value>16</param-value>
    </init-param>
</filter>


text:
Q: Buttons not showing in design time in Android Studio Layout Code is like this.
Code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Activities.SocialMediaLogin.GoogleLogin">

    <com.google.android.gms.common.SignInButton
        android:id="@+id/btn_Gmail_SignIn"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"/>

    <Button
        android:id="@+id/btn_sign_out_GMail"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Log Out"/>
    <Button
        android:id="@+id/btn_GMail_RevokeAccess"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Revoke Access"/>

</android.support.constraint.ConstraintLayout>

Due to some reasons it always shows only Revoke Access button and hides the Sign Out button. Below is the screenshot. Am I missing anything?

A: It's because your revoke button is overlapping your Logout button. To show that you need to set constraint properties of these views


text:
Q: ndarray value visualization and overwriting in pandas I have ndarray of shape (3,8,1,1,365) where 3 is count (A,B,C) of product, 8 is count of places(AA,BB,CC,DD,EE,FF,GG,HH), 365 is time frame of data in days. I want to see the values for B and CC combination for 365 days, want to replace these values of A and BB combination. How to do that ?  please help.. tried with ndarray_name.todense()[2][3] to visualize the data but no luck..

A: This task should be tagged rather as Numpy, because Pandas does not
serve 5-D arrays.
To create an example array I used the following code:
import itertools
s1 = ['A', 'B', 'C']
s2 = ['AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH']
s3 = ['1', '2', '3', '4']
arr = np.array([ '_'.join(t) for t in itertools.product(s1, s2, s3) ])\
    .reshape((len(s1), len(s2), len(s3)))

For the time being arr has only 3 dimensions, so to convert it to 5-D
array, run:
arr = arr[:, :, np.newaxis, np.newaxis, :]

When you print(arr.shape), the result is: (3, 8, 1, 1, 4) (4 days instead of 365).
Then, to print your slice, run:
arr[1,2]

The result is:
array(['B_CC_1', 'B_CC_2', 'B_CC_3', 'B_CC_4'], dtype='<U6')

i.e.:

*

*1 (the first index) - limit the first dimension to the second value (B),

*2 (the second index) - limit the second dimension to the third value (CC).

And to replace them with A / BB values, run:
arr[1,2,...] = arr[0,1,...]


text:
Q: error C2064 for Windows but not for Linux I am now compiling an open-source image processing project olena. It is a great image processing library and I have succeeded in compiling it for Linux (4.6.3). Since I am used to Windows, I also try to compile the project in Windows with Visual Studio 2010. However, when I compile it, I have the C2064 error message:
Error   1   error C2064: term does not evaluate to a function taking 0 arguments    C:\olena-2.1\olena-2.1\milena\mln\metal\is_a.hh 101

Following the error message, I come up with this code:
 /*!
      \internal
      \brief "is_a" check.

      Check whether T inherits from _CONCEPT_ M.
    */
    template <typename T, template <class> class M>
    struct is_a : bool_<(
            sizeof( internal::helper_is_a_< T, M >::selector(internal::make_< T >::ptr()) ) //**ERROR**
              ==
              sizeof( internal::yes_ )  )>
    {};

It is a very short code snippet, but I have no clue where the error may come from. Any ideas? Thanks.
NOTES:
The definition of interanl::make_<T>::ptr() is as follows:
  template <typename T>
    inline
    T*
    make_<T>::ptr() // This piece of code is defined to prevent an ICE from g++-2.95.
    {
      T* tmp;
      return tmp;
    }

 template <typename T>
      struct make_
      {
    static T* ptr();
      };

The definiton of iternal::helper_is_a_ is
 template <typename T, template <class> class M>
      struct helper_is_a_
      {

    template<class V>
    static yes_ selector(M<V>*);
    static no_  selector(...);
      };

A: This would work (tested with vs2008).
template <typename T, template <class> class M>
struct is_a
{
  static const bool value = bool_<( sizeof( internal::helper_is_a_< T, M >::selector(internal::make_< T >::ptr()) )
        ==
        sizeof( internal::yes_ )  )>::value;
};

For whatever reasons it tries to evaluate sizeof immediately when it sees it as a base class or a member.
Your original code compiles with VS2013 C++11.


text:
Q: Keep setting the external monitor Every time I turn on my notebook I have to configure the resolution of external monitor with the "grandr." Always turn off the notebook display and change the resolution of external monitor. I wonder if I have some way to configure this setting remain as default every time I turn off the notebook.
Does anyone know how?
I used Ubuntu 11.10.
Thanks

A: You can modify your .xprofile or you can change /etc/X11/xorg.conf.  This is well documented in the wiki at https://wiki.ubuntu.com/X/Config/Resolution#Four_methods_of_setup and also https://wiki.ubuntu.com/X/Config/Resolution#Setting_XRandR_changes_persistently


text:
Q: Selecting only CFSR images in Google Earth Engine with precipitation data I am trying to create cumulative monthly composites of precipitation from CFSR data in Google Earth Engine (i.e. each image would be mm/month for each month)
However, I realised that images ending with 'F00' do not have the precipitation band I need - Total_precipitation_surface_3_Hour_Accumulation - whereas those with 'F03' has that band.
As such, when I try creating an image collection of images with that specific band only, it pulls up the error: 'Pattern 'Total_precipitation_surface_3_Hour_Accumulation' did not match any bands'
How can I go about choosing only the images ending with the name 'F03'?
var dataset = ee.ImageCollection('NOAA/CFSR')
                  .filter(ee.Filter.date('2019-04-01', '2019-05-31'))
                  .map(function (image) { return image.clip(roi)})
                  .select('Total_precipitation_surface_3_Hour_Accumulation');

print(dataset)

A: The hour is saved in the property forecast_hour of every Image. You can use this property and .filterMetadata() to filter only those with forecast_hour: 3. Here's the code:
var dataset = ee.ImageCollection('NOAA/CFSR')
                  .filter(ee.Filter.date('2019-04-01', '2019-05-31'))
                  .filterMetadata("forecast_hour", "equals", 3)
                  .map(function (image) { return image.clip(roi)})
                  .select('Total_precipitation_surface_3_Hour_Accumulation');

print(dataset)


text:
Q: Django filter related objects use ORM Imagine that, I have A Model and B Model.
Class A (models.Model):
 a_name = models.CharField(max_length=100)

Class B (models.Model):
 b_name = models.CharField(max_length=100)
 a_name = models.ForeignKey(A, on_delete=models.CASCADE, to_field="a_name", db_column="a_name")

Then, I want to get A , and every A will have all related B
A.filter(a_name="a_name").all()

But I also want to filter B by b_name when I get the A result above, How can I do that?

A: I think what you are trying to do is reverse query a model ForeignKey relationship. So from the parent class to the child class.
Try this:
# Access the A obj you want to query
a_obj = A.objects.filter(a_name = a_name)

# Query the related B obj's of the above A obj
# filtered by a specifc B obj name
# you can achieve this by calling _set on the child class (B)
# .ie. parentmodel.childmodel_set
b_obj = a_obj.b_set.filter(b_name=b_name)

Note:
When calling _set the model name is written in lowercase .i.e b instead of B.


text:
Q: Hibernate proxy error occurred launch job in Spring Batch Hello I got hibernate error in Spring batch application
ERROR: org.springframework.batch.core.job.AbstractJob - Encountered fatal error executing job
org.springframework.dao.OptimisticLockingFailureException: Attempt to update job execution id=33 with wrong version (0), where current version is 1
    at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.updateJobExecution(JdbcJobExecutionDao.java:210)
    at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:155)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy54.update(Unknown Source)
    at org.springframework.batch.core.job.AbstractJob.updateStatus(AbstractJob.java:383)
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:276)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

According to the error log, I faced proxy error at Abstract Job Class (which provided by Spring Batch)
I guess that since Abstract Job Class do not have any non-parameter Constructor, CGLIB cannot provide any proxy class..
How can I solve this problem?

I'm using spring batch admin now

A: that exception
org.springframework.dao.OptimisticLockingFailureException: Attempt to update job execution id=33 with wrong version (0), where current version is 1

means that for some reason your step transaction locking has failed.
Might be caused your business logic transaction being set as RollbackOnly mode which would cause spring tables to be inconsistent state as well => optimistic locking occurs.
Try to add logging for hibernate and showing of the actual sql. This might help you to figure out where the problem actually is.


text:
Q: AWS NLB set udp idle flow timer to 1 s? I have the application sending a lot of UDP traffic to AWS NLB.
As per documentation:
https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html
While UDP is connectionless, the load balancer maintains UDP flow state based on the source and destination IP addresses and ports, ensuring that packets that belong to the same flow are consistently sent to the same target. After the idle timeout period elapses, the load balancer considers the incoming UDP packet as a new flow and routes it to a new target. Elastic Load Balancing sets the idle timeout value for UDP flows to 120 seconds.
Can we somehow change this timer ? I would like to go down to 1 second....
Thanks,


text:
Q: git cherry-pick -x default In the man page for git cherry-pick:
...

-x
    When recording the commit, append a line that says "(cherry picked
    from commit …)" to the original commit message in order to indicate
    which commit this change was cherry-picked from. ...

-r
    It used to be that the command defaulted to do -x described above,
    and -r was to disable it. Now the default is not to do -x so this
    option is a no-op.

...

Is there a config setting to locally set the default back to -x, and allow -r to disable it?  I couldn't find one, but I may have missed it.

A: add this alias to your ~/.gitconfig by running:
git config --global --replace-all alias.pick "cherry-pick -x"

You can then simply run:
git pick abc123

You may replace the choice of "pick" to whatever word makes sense to you.

A: Short of making an alias for git cherry-pick -x, no, this is not possible.
(Fun fact: The default was changed in commit abd6970.)


text:
Q: Mingw-w64 C versions support? What versions of C does minigw-w64 support? It uses msvcrt.dll so wouldn't it only support ANSI C? But then i see programs like VLC use it but say that they require C11. How is this possible?
EDIT: Some sources: How to printf a size_t without warning in mingw-w64 gcc 7.1?
http://www.mingw.org/wiki/c99

A: MinGW uses msvcrt.dll, but integrates it where needed to support newer/fixed features, in some cases providing complete reimplementations of some functions (e.g. you can opt-in for GNU printf/scanf). Such extras are either linked statically, or provided into a separate dll (mingw1.dll, IIRC).


text:
Q: Object and String parameter I am learning through w3schools. I am confused mainly about the meaning of java syntax. To my understanding, both functions the same except for the String cases.
The thing I don't understand is their parameters; why is the other an Object and the other is String?
public boolean equals(Object anotherObject)

public boolean equalsIgnoreCase(String anotherString)

A: equals(Object) is defined in java.lang.Object and is a method that is available on all object in Java. Therefore it's defined as generically as possible (i.e. it accepts any other object as the argument).
equalsIgnoreCase is only defined in java.lang.String. It's a specific method for comparing strings in a specific way. Since it's about text, it doesn't make sense to accept any non-String object here.

A: Great question! I'm not a Java expert so don't just take my word for it :)
The equals
function is declared in Object, which is the superclass of String. It is declared in a way, to support comparison to any object, not just strings.
In contrast, the equalsIgnoreCase
is a function specific to just strings, it is declared in the String class. It is made for comparison between strings only.

A: Only strings can have both upper and lower case, and in the case of the first one it is checking if 2 objects are equal, no matter if they are string or not so cases do not matter


text:
Q: SharePoint export to excel filtered list data based on row level security In SharePoint I have two lists. The first contains data where each row has row level user/group security permissions defined. The second list has a lookup to the first list in it – creating a one to many relationship between list 1 and 2. The second table has a view which filters based on the lookup not being blank. This then shows the user only the rows that they have permission to view in list 2.
I would like to create some reporting in excel based on the values in the second list. The reporting needs to be viewed by different users and only show data that they have permission to view. Can this be achieved using one excel spreadsheet? i.e. When each different user opens the spreadsheet or refreshes the data only their data is imported from excel, I assume using odata? Or would a copy of the workbook need to be created for each group of users? If so, where would the filtering be defined? Would the odata query need a filter? Or can you make it pull data from a List View instead of the list directly?
The environment is SharePoint 2013 on Office 365. ADFS is configured for single sign on between the domain and office 365.

A: The data in the Excel workbook would be cached based on the credentials of the user who ran the queries.  So unless you distributed a copy of the workbook that contained no data at all to each of your coworkers, your scenario wouldn't really work.
A better approach would be to use a Reporting Services report with a live data connection to the SharePoint list.  Each user would get only their data.  If they wanted to export it to Excel to analyze, they could do that by exporting their report.
Appreciate your using Power BI.
Lukasz P.
Power BI Team, Microsoft
Get started using Power BI APIs on the Power BI Developer Center - http://dev.powerbi.com. Keep up to date with the Power BI Developer Blog - http://blogs.msdn.com/b/powerbidev/.


text:
Q: angular typeahead filter: use html tags I'm using a filter with angular typeahead to append an extra item onto the typeahead suggestion list like so:
app.filter('finalAppend', function($sce){
  return function(array, value){
    array.push({
    name: $sce.trustAsHtml('Look for ' + value + ' in other shops'),
    type: 'good'
    });
    return array;
  }
});

I want to return html encoded string, but angular automatically sanitizes it. I tried using $sce as suggested, but it doesn't seem to work. Here's the plunkr: plunkr
thanks in advance.

A: It seems in ui-bootstrap 0.7.0, there is a conflict between typehead highlight filter and your own finalAppend filter.
Just change your tpl.html to this :

And load angular sanitize to prevent secure error automatically been thrown by angular.

inject ngSanitize into your app.
var app = angular.module('myApp', ['ui.bootstrap', 'ngSanitize']);

And it works. Here is the plunker address.
However, if you still want to use the typeahead inner highlight filter, you can change you ui-bootstrap to this(Already change it in the demo):

Hope this can work. Enjoy it. : )


text:
Q: A question of mapping about power sets Let h: A → B be a function from a set A to a set B. The function h can be used to
construct a function H: (A) → (B) as follows: For each X ∈ (A)
, H(X) = h(X) (i.e. the image set of  , by ℎ ).
Show that  is one-to-one ⇔ ℎ is one-to-one.
I've tried "$\Leftarrow$" like following
Suppose that h is injective that h(x)=h(y) $\Rightarrow$ x=y, for x,y belongs to A. Since A $\subseteq$ (A), x and y belongs to (A). While h(x) = H(x) for x ∈ (A), so I prove that H(x)=H(y) $\Rightarrow$ x=y, which implies to H is injective


text:
Q: ASCII Representation of Hexadecimal I have a string that, by using string.format("%02X", char), I've received the following:
74657874000000EDD37001000300
In the end, I'd like that string to look like the following:
t e x t NUL NUL NUL í Ó p SOH NUL ETX NUL  (spaces are there just for clarification of characters desired in example).
I've tried to use \x..(hex#), string.char(0x..(hex#)) (where (hex#) is alphanumeric representation of my desired character) and I am still having issues with getting the result I'm looking for.  After reading another thread about this topic: what is the way to represent a unichar in lua and the links provided in the answers, I am not fully understanding what I need to do in my final code that is acceptable for this to work.
I'm looking for some help in better understanding an approach that would help me to achieve my desired result provided below.
ETA:
Well I thought that I had fixed it with the following code:
function hexToAscii(input)
    local convString = ""
    for char in input:gmatch("(..)") do
        convString = convString..(string.char("0x"..char))
    end
    return convString
end

It appeared to work, but didnt think about characters above 127.  Rookie mistake.  Now I'm unsure how I can get the additional characters up to 256 display their ASCII values.
I did the following to check since I couldn't truly "see" them in the file.
function asciiSub(input)
    input = input:gsub(string.char(0x00), "<NUL>")  -- suggested by a coworker
    print(input)
end

I did a few gsub strings to substitute in other characters and my file comes back with the replacement strings.  But when I ran into characters in the extended ASCII table, it got all forgotten.
Can anyone assist me in understanding a fix or new approach to this problem?  As I've stated before, I read other topics on this and am still confused as to the best approach towards this issue.

A: The simple way to transform a base16-encoded string is just to
function unhex( input )
    return (input:gsub( "..", function(c)
        return string.char( tonumber( c, 16 ) )
    end))
end

This is basically what you have, just a bit cleaner.  (There's no need to say "(..)", ".." is enough – if you specify no captures, you'll automatically get the whole match. And while it might work if you write string.char( "0x"..c ), it's just evil – you concatenate lots of strings and then trigger the automatic conversion to numbers. Much better to just specify the base when explicitly converting.)
The resulting string should be exactly what went into the hex-dumper, no matter the encoding.
If you cannot correctly display the result, your viewer will also be unable to display the original input.  If you used different viewers for the original input and the resulting output (e.g. a text editor and a terminal), try writing the output to a file instead and looking at it with the same viewer you used for the original input, then the two should be exactly the same.
Getting viewers that assume different encodings (e.g. one of the "old" 8-bit code pages or one of the many versions of Unicode) to display the same thing will require conversion between different formats, which tends to be quite complicated or even impossible.  As you did not mention what encodings are involved (nor any other information like OS or programs used that might hint at the likely encodings), this could be just about anything, so it's impossible to say anything more specific on that.

A: You actually have a couple of problems:

*

*First, make sure you know the meaning of the term character encoding, and that you know the difference between characters and bytes. A popular post on the topic is The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

*Then, what encoding was used for the bytes you just received? You need to know this, otherwise you don't know what byte 234 means. For example it could be ISO-8859-1, in which case it is U+00EA, the character ê.

*The characters 0 to 31 are control characters (eg. 0 is NUL). Use a lookup table for these.

*Then, displaying the characters on the terminal is the hard part. There is no platform-independent way to display ê on the terminal. It may well be impossible with the standard print function. If you can't figure this step out you can search for a question dealing specifically with how to print Unicode text from Lua.


text:
Q: What is the impact of deleting a TFS build agent working directory? My build agent working directories are starting to take too much space on the disk. I wonder if it is okay for me to delete some old folders, or if I should back them up.
What is the impact of deleting a TFS build agent working directory?

*

*Are the labels affected?

*Is the build history affected?

A: You can do it if your builds are not incremental (incremental get). If your builds always get all source files for every build it is OK to delete working directories. Build history and labels are not affected. Your build logs are in the drop location and it shouldn't be a problem either.
It is a problem for incremental (at least from incremental get) builds. These builds are getting only the latest changes from the TFS source control before every build, not the whole workspace as defined in the build definition's workspace.
Check your build definition's Process → CleanWorkspace settings. If it is set to All, it should not be a problem to delete the build directory.

A: Assuming I understand your question correctly, make sure you delete the builds through the TFS interface. Don't just delete the folders off the disk if you can help it. The TFS 2010 Build Deletion dialog gives you some options about what to keep and what to delete.
http://blogs.msdn.com/b/jpricket/archive/2009/12/09/tfs-2010-how-about-those-build-delete-options.aspx
You can also set up build retention policies so that old/unused builds automatically get deleted.


text:
Q: How to identify IP address on vercel server I have an app running on https://francerenovation.vercel.app/, but my boss want my the IP of my website, to put it on the internal server. I try to search on vercel documentation but its all I can find https://vercel.com/support/articles/how-to-allowlist-deployment-ip-address. Can anyone of you help me ?

A: Get help from this site to find the IP server or from the ping command in cmd
https://whatismyipaddress.com/?s=https%3A%2F%2Ffrancerenovation.vercel.app%2F


text:
Q: How to pass the checkbox value to apex class method from visualforce page I have a requirement in which when select the checkbox based on the value of checkbox i.e. true or false, I have to pass the value to Apex class method and based on the value of checkbox it should display an status images.
I have modified the code in VF page like this:
    j$('.voCheckbox').click(function() {
        j$('[id$=":selectedVerifiableOutcomeIdInput"]').val(j$(this).data("output"));
        j$('[id$=":currentStageInput"]').val(j$(this).data("stage"));
        completeActionJSCheck();
    });
<apex:actionFunction action="{!completeActionCheck}" name="completeActionJSCheck" >
     <apex:param name="v" value="" assignTo="{!myCheckbox}" />
</apex:actionFunction>

VF code for setting the image based on the value of checkbox:
    {!output.Name}:
    <apex:outputPanel layout="none" rendered="{!currentOpportunity[output.FieldName__c] == true}">

    <input type="checkbox" class="voCheckbox"  Checked="Checked" Value="true" event="onselect" style="vertical-align: middle" data-outcome="{!outcome.Id}" enable="true"/>

    </apex:outputPanel>
    <apex:outputPanel layout="none"  rendered="{!currentOpportunity[output.FieldName__c] == false}">
    <input type="checkbox" Checked="False" class="voCheckbox" event="onselect" style="vertical-align: middle" data-outcome="{!outcome.Id}" enable="true"/>

</apex:outputPanel>
</apex:outputPanel>

in the above code I have used to pass the value to the Boolean variable myCheckbox. But on UI when I select/disselect the checkbox then it thows and error. "Value not of required type".
in Apex class I have modified the below code :
public boolean myCheckbox {get; set;}
ActionResult result = ActionFactory.getInstance(selectedOutputId, oppId).execute(myCheckbox);
 checkActionResult(result);

Can somebody help me what I am missing here?
My target is i

A: I think you should not use an actionFunction, but rather actionSupport. Your checkbox will look something like this;
<apex:inputCheckbox value="{!myCheckbox}>
    <apex:actionSupport event="onchange" action="{!myApexFunction}" />
</apex:inputCheckbox>

In this case the checkbox will be automatically posted to the controller, so there's no need to pass it as a parameter. For reference; the documentation of the actionSupport element.


text:
Q: Drawbacks to nesting of child windows? Just for fun I'm developing a native Win32 port of Mozilla XUL. XUL allows to create complex nested structures of all kinds of layout boxes (hbox, vbox, grid, deck..). For my Windows implemenation it would be convenient to implement them as STATIC child windows. Because then I can position their child windows using x & y offsets independent of the position of the parent box.
However, this approach may lead to certain windows having a lot of nested child windows. And I wonder if there would be any disadvantages to such a situation. Does anyone here know?

A: I've been down this path, and I don't recommend you actually make deep hierarchies of windows.  Lots of Windows helper functions (e.g., IsDialogMessage) work better with "traditional" layouts.  Also, windows in Windows are relatively heavy objects, mostly for historical reasons.  So if you have tons of objects, you could run into limitations, performance problems, etc.
What I've done instead is to represent the deeply-nested layout as a tree of regular C++ objects that parallels the flatter hierarchy of actual windows.  Some nodes of the object hierarchy have the HWNDs of the "real" windows they represent.  You tell the hierarchy to lay out, and the nodes apply the results to the corresponding windows.
For example, the root of the hierarchy may represent a dialog window, and the leaf nodes represent the child windows.  But the hierarchy has several layers of non-window objects in between that know about layout.

A: A rough take on this:

*

*memory overhead for the window management on application- and os-side

*reduced speed due to calls to external library / os which do way more for windows than needed for your application

*possibly quite some overhead through long window message paths in complex layouts

It probably depends on wether you want a very fast implementation and do efficient buffered drawing by yourself or want it to work more reliably and with less time invested.


text:
Q: WISE - COM Server registration option "Do not register" doesn't work? I created an installer in wise, for a Delphi application which using an in-proc (DLL) COM-Server.
I configured the DLL in the Wise project as "Do not register", but after a test installation it is registered anyway?

Is this an "undocumented feature" of WISE or am I doing something wrong?
Does anyone have a workaround or a fix for this issue?
P.S. The reason that I don't want to register the DLL is that on target PC that COM server already may be registered for another application with specific settings (threading model, path, etc) which I don't want to touch.

A: I'm trying to avoid this turning into a "what tool should I use thread".  That said,  WiX/IsWiX is free open source and should meet your needs.  (It's hard to say for sure since I have no idea what other requirements this MSI would have.)
That said,  is there any chance that the DLL was already registered?  Are you testing on a snapshotted VM or other reproducible environment where you can be 100% certain that it was not?
If so, are there any other actions in the wise script that could be causing the registration to happen.  I'm not aware of a bug/feature in wise but if there is, you are SOL because that product has long been dead and there is no support or updates available.
One last note.  You're comment about the DLL might already be there and registered... that's called DLL hell.  What if it's not there... now you aren't registered.  You've got some design problems you need to resolve before you ever hope to have a high quality installation experience regardless of what tool you use.

A: I found a possible solution or workaround (possible because I did't understand it till the end, but it's working).
COM DLL will be registered on target PC, even if it is marked with "Do not register", in case if it is registered on deployment PC.
Solution:

*

*unregistered DLL from local (deployment) PC

*Remove it from installation package, save (and compile) package

*re-Add COM DLL to package,  mark it with "Do not register", save and compile.

After these steps it works as expected - DLL is not registered on target PC.
It seems this is happening because of windows installer advertising (which still i didn't understand properly), but from WISE documentation I found:

"How Self-Registration Information is Captured
    When you add a .DLL
  or .OCX file containing COM self-registration information to an
  installation, its registration information is scanned and the
  appropriate registry keys are added to the installation. This system
  of registration is more robust than letting the file self-register at
  installation time because it does not depend on the presence of other
  files on the destination computer or on how well the .OCX or .DLL file
  adheres to self-registration conventions."

For this reason as additional measure, before above described steps, I changed WISE Advertising options:

For Advertising Setting: selected Do not scan advertising information option.
Unchecked option Automatically add self-registration.

All this written is actual solution, but thanks to @Christopher Painter response I was introduced in "DLL Hell" terminology, especially for COM DLLs, so that as LONG-TERM solution (in perspective) i would check for Registration-Free Activation of COM Components (link).


text:
Q: How to use BundleWiring.findEntries() on system bundle? I am trying to find a set of package names in all OSGi modules by using BundleWiring's findEntries() method. For all other modules, I can simply run
bundleWiring.findEntries("/" + packageName, "*.class", 2)
to get the URL's to all classes in that package.
The problem is this approach doesn't work for OSGi System Bundle (bundle 0). Through the classloader I was able to see that the classes I want are in tomcat/webapps/ROOT/WEB-INF/lib/x.jar, but how can I find the path to those classes if I am only given System Bundle as a bundle?
The packages are exported in system.packages.extra.mf

A: This is not possible because the system bundle is just the "outside" of OSGi. You can use an arbitrary ClassLoader to load the OSGi Framework, and ClassLoaders don't have a way to iterate the packages or classes that they know about.


text:
Q: How do you write this covariance equation in matlab without any loops How would you implement the following in Matlab without loops:
$$
\Sigma = \frac{1}{m}\sum_{i=1}^{m}(\mathbf x_i - \mu_{yi})(\mathbf x_i - \mu_{yi})^T
$$
Where $\mathbf x \in \mathbb{R}^{m\times n}$ is your input matrix, $\mathbf y \in \{0,1\}$ is your label column vector. Additionally, you need to have already calculated parameters $\mu_0$ and $\mu_1$ which are the means of $\mathbf x$ for samples of class 0 and 1 (according to vector $\mathbf y$). The tricky part is $\mu_{yi}$. In the equation, you cannot simply multiply the input with its mean, since $\mu_{yi}$ is a conditional mean. If class of $\mathbf x_i$ is 0, then $\mu_{yi}=\mu_0$, otherwise $\mu_{yi}=\mu_1$.
How can you do this elegantly in Matlab without loops and checking for $y_i$ at every sample?

A: The two sexy ideas are matrix indexing and bsxfun.
y1_logical = y==1;
u1 = mean(X(y1_logical,:));
u2 = mean(X(~y1_logical,:));

X_demean = zeros(size(X));
X_demean(y1_logical,:)  = bsxfun(@minus, X(y1_logical,:), u1);
X_demean(~y1_logical,:) = bsxfun(@minus, X(~y1_logical,:), u2);

Sigma = X_demean' * X_demean / m;


text:
Q: spring mvc + mybatis + mysql5.7 save less time for 8 hours spring mvc + mybatis + mysql 5.7 + jdk8
I use mysql 5.7 for save json data.
I use jdk8 time API LocalDateTime now = LocalDateTime.now(); to get datetime and save to database.
But I fund the result of database are less time for about 8 hours.
My treatment process
1、Code problems, debug it, and I find the time in the object is right before it save to the database.
2、System time zone problem, the investigation of the local computer system, server system, database system and other computer systems, time zones are all East eight district no problem. (I am Chinese)
3、View console print SQL
DEBUG [ 2017-08-23 12:42:35 970 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - ==>  Preparing: insert into log_user_operation (pk_id, user_code, user_name, login_ip, url, operation_type, operation_content, remark, create_time) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
DEBUG [ 2017-08-23 12:42:36 005 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - ==> Parameters: null, admin(String), Admin(String), 127.0.0.1(String), http://localhost:8080/bi/login-check(String), SELECT(String), 用户登录(String), (String), 2017-08-23 12:42:32.9(Timestamp)
DEBUG [ 2017-08-23 12:42:36 016 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - <==    Updates: 1
DEBUG [ 2017-08-23 12:42:36 020 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - ==>  Preparing: SELECT LAST_INSERT_ID()
DEBUG [ 2017-08-23 12:42:36 021 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - ==> Parameters:
TRACE [ 2017-08-23 12:42:36 039 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.trace(BaseJdbcLogger.java:151) - <==    Columns: LAST_INSERT_ID()
TRACE [ 2017-08-23 12:42:36 039 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.trace(BaseJdbcLogger.java:151) - <==        Row: 47
DEBUG [ 2017-08-23 12:42:36 042 ]: org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:145) - <==      Total: 1
DEBUG [ 2017-08-23 12:42:36 047 ]: org.mybatis.spring.SqlSessionUtils.closeSqlSession(SqlSessionUtils.java:193) - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@516c8654]
DEBUG [ 2017-08-23 12:42:36 048 ]: org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:332) - Returning JDBC Connection to DataSource

I feel that everything is OK, but the database save is wrong.
the test result of right now

A: The problem that has been bothering for two days is finally settled this evening.
This is due to the URL specification of the new MySQL drive package:
jdbc:mysql://localhost:3306/ss?characterEncoding=utf8&useSSL=true&serverTimezone=UTC&nullNamePatternMatchesAll=true

Modify serverTimezone=UTC to serverTimezone=Hongkong can solve the problem successfully。


text:
Q: How do I test out my program in the main method? This will probably sound like a dumb question to many of you but I'm a new student and I am trying to learn. This is a program that takes a roman numeral input from a user and converts it to it's decimal value. I am trying to test out this program, but I don't know exactly what I have to do in my main method in order to do so. I have the other methods for the calculating but now how am I supposed to test it out? Let me show you what I have:
public class RomanNumeralConverter {

public String getUserInput() {
    Scanner numberInput = new Scanner (System.in);
    System.out.print("Enter a roman numeral in uppercase: ");
    String userInput = numberInput.next();
    numberInput.close();
    return userInput;
}

public static void romanToDecimal(String userInput) {
int decimal = 0;
int lastNumber = 0;
userInput = userInput.toUpperCase();
for (int x = userInput.length() - 1; x >= 0 ; x--) {
    char convertToDecimal = userInput.charAt(x);

    switch (convertToDecimal) {
        case 'M':
            decimal = processDecimal(1000, lastNumber, decimal);
            lastNumber = 1000;
            break;

        case 'D':
            decimal = processDecimal(500, lastNumber, decimal);
            lastNumber = 500;
            break;

        case 'C':
            decimal = processDecimal(100, lastNumber, decimal);
            lastNumber = 100;
            break;

        case 'L':
            decimal = processDecimal(50, lastNumber, decimal);
            lastNumber = 50;
            break;

        case 'X':
            decimal = processDecimal(10, lastNumber, decimal);
            lastNumber = 10;
            break;

        case 'V':
            decimal = processDecimal(5, lastNumber, decimal);
            lastNumber = 5;
            break;

        case 'I':
            decimal = processDecimal(1, lastNumber, decimal);
            lastNumber = 1;
            break;
    }
}
System.out.println(decimal);
}

public static int processDecimal(int decimal, int lastNumber, int lastDecimal) {
if (lastNumber > decimal) {
    return lastDecimal - decimal;
} else {
    return lastDecimal + decimal;
}
}

public static void main(String[] args) {

romanToDecimal(getUserInput);

}
}

You could see that I tried plugging in getUserInputin to romanToDecimal but I know that I don't have those parameters in the main method, and I don't even think Java allows me to do that. But, I think this represents what I'm trying to do. Really what I want to do is:
System.out.println("The number you entered is " + userInput
System.out.println("The converted number is " + romanToDecimal

Maybe I am supposed to put this in a separate method?

A: There are a few changes you need:

*

*If you're going to call your getUserInput method from main, you either need to make it static or create an instance of your class. I'd suggest making it a static method.

*Currently your romanToDecimal method prints out the result - but it would be neater (in my view) if instead it returned the result, so you can print it in main

*In romanToDecimal(getUserInput) you're trying to use getUserInput as if it's a variable, but it's a method.

After changing getUserInput to be static, and changing romanToDecimal to return a String instead of printing it, your main method could look like this:
public static void main(String[] args) {
    String input = getUserInput();
    String result = romanToDecimal(input);
    System.out.println("The number you entered is " + input);
    System.out.println("The converted number is " + result);
}

That would be fine as a program. Once you've got romanToDecimal as a method returning the result, you could also easily write unit tests for it, where the input was hard-coded into the test, and you checked the result. For example:
public void test5() {
    String result = RomanNumeralConverter.romanToDecimal("V");
    Assert.assertEquals(5, result);
}

... and lots more tests for everything you can think of. (Depending on the unit test framework you choose, you might be able to write a single piece of test code, and specify the input and expected results very compactly as parameters.)

A: Do this in the main method:
String input = getUserInput();
romanToDecimal(input);

This should get the code working like it should.

A: Just write unit tests testing out the romanToDecimal method with various inputs.
In Java JUnit is the most popular framework for doing this.
The test would look something like this:
@Test
public void testMyMethod() {

   assertEquals("expected result", romanToDecimal("input"));
}

PS: In order to do this successfully you will need to return a String in your romanToDecimal method!

A: try this:
public static void main(String[] args) {
    RomanNumeralConverter rnc = new RomanNumeralConverter();
    String userInput = rnc.getUserInput(); // get user input
    System.out.println(userInput); // print user input
    Tests.romanToDecimal(userInput); // call the romanToDecimal static method to convert and print converted decimal
}

A: getUserInput is a function name. getUserInput() is a call to the function, called getUserInput, passing no arguments to it (empty parenthesis). That's what you want: call that function, and use the string it returns.
romanToDecimal(getUserInput()); in your main function should work.
You can also assign it to a variable first, so that you could print it out before calling romanToDecimal, and also, make romatToDecimal return a String rather than just printing it out. Then you could do something like this:
public static void main(String argv[]) {
    String input = getUserInput();
    String output = romanToDecimal(input);
    System.out.ptinln("You enetered: " + input + "\nThe converted number is: " + output);
}

Oh, and as someone has pointed out, you need to make both methods you are calling static.

A: If you put the userInput method into your main method then pass userInput to romanToDecimal(getUserInput); in the main method it will work here is the code for the main method
public static void main(String[] args) {
Scanner numberInput = new Scanner (System.in);

System.out.print("Enter a roman numeral in uppercase: ");
String userInput = numberInput.next();
numberInput.close();
romanToDecimal(userInput);`

  }
}


text:
Q: How to fix my macro to create excel tabs based on a table I created a macro to copy a template macro as many times as there are rows in my table.
However I get the following error:

Error 429 ActiveX Component Can't Create Object.

It was working fine when I created it a year ago
The part of the code that is giving an issue is the first line starting with lastcell (see code below)
Anybody any idea why it is not working?
Googled on the answer, but could not find why it is not working.
Maybe it has to do with the fact that I created the macro in an older office version (2013) then I am working in right now (2016)
Sub Aanmaaktabbladen()
lastcell = ThisWorkbook.Worksheets("Bonussen").Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To lastcell

With ThisWorkbook

newname = ThisWorkbook.Worksheets("Bonussen").Cells(i, 1).Value

Set wsVOORBEELD = ActiveSheet
wsVOORBEELD.Copy After:=Sheets(Sheets.Count)

ActiveSheet.Name = newname

End With
Next
ThisWorkbook.Worksheets("Bonussen").Activate
ThisWorkbook.Worksheets("Bonussen").Cells(1, 1).Select

End Sub


text:
Q: Show one table's row info in place of other using data from two tables Ok lets say it looks like this in table users_chars i have
pos_zone
255

in table two
zone_id | name
 255    | This_Area

how would i go about comparing them and showing the name row instead of the id
Ok using the method @missdefying posted I came up with this is this ok?
  ////Zone id to name
        $zoneid=myQ(myF("SELECT t.zoneid
FROM users_chars c
INNER JOIN zone_settings t ON c.pos_zone = t.zoneid"));

        $result=mysql_query("SELECT t.name
FROM users_chars uc
INNER JOIN zone_settings t ON uc.pos_zone = t.zoneid");
while($row = mysql_fetch_array($result))
        {
            $zonename = "";
if (($row['pos_zone'] == $zoneid)) {
$zonename = "" . $row['name'] . "	";}
echo "" . $zonename ."	";}

@missdefying Thank you


text:
Q: Comparing String Iterator to Char Pointer I have a const char * const string in a function.
I want to use this to compare against elements in a string.
I want to iterate through the string and then compare against the char *.
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main()
{

  const char * const pc = "ABC";
  string s = "Test ABC Strings";

  string::iterator i;

  for (i = s.begin(); i != s.end(); ++i)
  {
    if ((*i).compare(pc) == 0)
    {
      cout << "found" << endl;
    }
  }

How can I resolve a char* to resolve against a string iterator?
Thanks..

A: Look at std::string::find:
const char* bar = "bar";
std::string s = "foo bar";

if (s.find(bar) != std::string::npos)
    cout << "found!";

A: std::string::iterator it;
char* c;
if (&*it == c)

Dereferencing an iterator yields a reference to the pointed-to object. So dereferencing that gives you a pointer to the object.
Edit
Of course, this isn't very relevant as a much better approach is to drop the comparison entirely, and rely on the find function that already exists to do what you want.

A: Not exactly an answer to your question, but it looks like you might be better off with std::string::find method.
Something like that:
const char * const pc = "ABC";
string s = "Test ABC Strings";
size_t pos = s.find(pc);


text:
Q: How to unzip a password-protected file in vbscript? I am fairly new to VBScript. I have done some extensive research on what I am trying to accomplish and have even found examples of what to do, but cannot get it to work properly.
In my perfect world, I need to unzip all zipped files sent to a folder from a third-party vendor, import the unzipped file into a different folder then delete the zipped file.
The script below works properly for non-password protected zip files, but all files sent from the vendor have passwords. As seen in another post, the following lines which I have commented out should insert the password but do not.  "...(pwd+myZipfile)" and "...(pwd+extractTo)".
Thank you in advanced for your help. Please suggest any code improvements or other methods to make this happen.
pathToZipFile = "P:\ZipFiles"
extractTo = "P:\UnZip"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(pathToZipFile)
Set fc = f.Files
Dim myZipFile
Dim intOptions, objShell, objSource, objTarget
Dim pwd
pwd = "password"

For Each f1 in fc
On Error Resume Next

    myZipFile = f1

    '    Create the required Shell objects
    Set objShell = CreateObject( "Shell.Application" )

    '    Create a reference to the files and folders
    'Set objSource = objShell.NameSpace(pwd+myZipFile).Items( )
    Set objSource = objShell.NameSpace(myZipFile).Items( )

    '     Create a reference to the target folder
    Set objTarget = objShell.NameSpace(pwd+extractTo)
    Set objTarget = objShell.NameSpace(extractTo)
    intOptions = 256

    '     UnZIP the file
    objTarget.CopyHere objSource, intOptions

    '     Release the objects
    Set objSource = Nothing
    Set objTarget = Nothing
    Set objShell  = Nothing

    'Delete File from "P:\ZipFiles" after unzipping
    fso.DeleteFile f1, True

Next

A: If you take a closer look at the answer from which the pwd+... came, you'll notice that pwd does not contain a password, but a path. The variable was probably named after the Unix command pwd, which stands for "print working directory".
As far as I know the Shell.Application object does not support unpacking password-protected Zip files. Another answer to the question you referenced suggests the DotNetZip library. Or you could use 7-zip:
Function qq(str)
  qq = Chr(34) & str & Chr(34)
End Function

zipfile  = "..."
password = "..."

Set sh = CreateObject("WScript.Shell")
sh.Run "7za.exe x " & qq(zipfile) & " -p" & qq(password), 0, True


text:
Q: Div width change with Jquery on scroll I'm trying to change my #opacity-div width when the user scrolls down the webpage. If the user scrolls down to .paralax, the #opacity-div should get a width of 200px. When the user scrolls up past .paralax the #opacity-div should get a width of 550px, which is the default width of the div.
Currently .animate is used for a smother transition. The jQuery code works when the user scrolls down and the div gets a width of 200px with a smooth transition, but when the user scrolls back up the width of the #opacity-div will not change to 550px again.
Here is parts of the code used:
HTML

Hem

Meny

Kontakt

PARALAX

jQuery
$(document).ready(function() {
  var targetOffset = $(".paralax").offset().top;
  var $w = $(window).scroll(function() {
    if ($w.scrollTop() > targetOffset) {
      $("#opacity").animate({
        width: "200px"
      });
    } else {
      $("#opacity").animate({
        width: "550px"
      });
    }
  });
});

CSS
#opacity {
width:550px;
position:fixed;
height:100vh;
background: linear-gradient(to right, black, rgba(0, 0, 0, 0));
opacity: 1;
filter: Alpha(opacity=100);
z-index:1;
}

A: The problem is, your comparison if($w.scrollTop() > targetOffset) ignores the window height.
.scrollTop() = hidden pixels above the top-scrollable area.
offset().top = is relative to the document.
What you should be comparing is,
$('.paralax').offset().top - $(window).height() (scrolling needed to make .paralax visible) vs
$(window).scrollTop() current scrolling
so following code will check whether current scrolling is greater than the the scrolling needed to display .paralax
var targetOffset = $(".paralax").offset().top;
var winHeight    = $(window).height();

$(window).scroll(function(){
   var currentScroll = $(window).scrollTop();         // current Window scrollTop
   var scrollNeeded  = (targetOffset - winHeight);    // scroll needed to make .paralax visible
   $("#opacity").width(function(){
      return ( currentScroll < scrollNeeded ) ? 550 : 200 ;
   });

});

Since jQuery scroll() is currently called, attaching animate() to this event will drain the memory out. Let's use css transition property as below (See updated demo as well)
#opacity {
   ...
   -webkit-transition: width 2s;
   transition: width 2s;
   ...

See Demo


text:
Q: Verification of Fourier transformation of Io-sinh function I try to match, but it could not match $I_o-\sinh$ Practical Fourier Transform pair developed by Ben Logan, transform pair  also published in The Practical Application of the Fourier Integral  Campbell, George A
.Sir  J.F. Kaiser describe orally in interview at section What is the spectral window?
 the function Interview of J.F.Kaier  about this function
the Fourier Transform pair

Where
This Fourier transform pair widely used in Signal processing, Spectrum analysis and other Engineering and Science fields.
please suggest me how Bessel function convert into $\sinh$ function by spherically approximation and integral Fourier transform by Ben Logan. Please describe in between steps from $I_o$ to convert into $\sinh$


text:
Q: how to start event loop in shared library for Android? I have created a shared library for Android with qt5.5.1, and it worked well.
but the slots function can not work, because there is no event loop in the library, so the signal-slot has no effect.
Anyone knows the way to solve this question?


text:
Q: Add property to a DeserializeObject instance? I am DeserializeObject json to object.
if this is the json:
{
"IsSuccess":true,
"ErrorDescription":"the descriptions"
}

and I do not know the class.
public T Get<T>(string p1)
{
    var response=JsonConvert.DeserializeObject<T>(str);
    //how to add property to response here?
    return response
}

I want to add a property to response but I do not know if response is null or not.
and I do not know which class is it.
I think it can not so:
If there is BaseClass:
public class BaseResp
{

    public bool IsSuccessStatus{get;set;}
}

and if T is inherited by BaseResp then can I add property to it?
If I can not add property to it then can I return a new instance of BaseResp ?
public T Get<T>(string p1)
    {
        var response=JsonConvert.DeserializeObject<T>(str);
        if(response==null)
       {
            return new BaseResp();
       }
    }


text:
Q: Flask Rest API: how to switch to using sockets from AJAX? I've been trying websocket-client and socketio-client with no luck so far.  The broad picture of what I want to accomplish is this:
Currently, I have a Flask Rest API that has both a web front-end and a command line interface, and it handles several different sets of file uploads/downloads.  Both communicate with the server using HTTP requests, the web one from JQuery AJAX and the CLI uses python requests.  I would like to switch to using sockets so that database changes from one client appear on all of them. I have been able to get Flask-SocketIO working between my JQuery and Flask server, but I'm struggling with getting any client libraries working from the CLI portion.  Is there an easy to use python library for sockets similar to requests I should be using for this transition, or am I going in a totally wrong direction with making this switch?
Another option, unsure of the viability, would be to try and keep both the REST API for the CLI and have sockets for the web interface. Sounds very messy though.

A: After doing a lot of searching and messing around with various libraries, the one that was easiest to get up and running connecting a command line tool with a Flask-SocketIO webapp was socketIO-client.
This repository came in handy for the issues where I was struggling to understand how to correctly use the waits to receive info on the client side.
Once I've finished the project in a few weeks, I will come back and add more details so people finding this in the future can have an easier time getting this set up.


text:
Q: Make IDE/linter ignore a seemingly unused import At my current work we have an enviroment py file contains the following imports:
from core.entities import *
from core.entities.hdr import *
from core.entities.scanner import *

However, all of these imports are seen as "unused" by the ide (Pycharm) and we sometimes experience someone making a commit where these have been removed by the IDE in the process. Is there a way to mark unused imports as not being unused?

A: Try checking in the "Reformat File" dialog (Ctrl+Alt+Shift+L), uncheck "Optimize imports", if already checked.
Alternatively, you can add `PyUnresolvedReferences':
# noinspection PyUnresolvedReferences
import A

# noinspection PyUnresolvedReferences
import B

Although there are some reported issues with the reference, https://youtrack.jetbrains.com/issue/PY-19837 .

A: This is the Unresolved references inspections. you can turn it off by going:
Settings > Editor > General > Inspections > python

then you will see a checkbox in front of it.


text:
Q: WMS GetFeatureInfo JSON error I'm  trying to get informations from geoserver with AjaX jQuery of my spatial data at the clicked point using WMS GetFeatureInfo.
But I have this ERROR :

http://localhost:8082/geoserver/schemas/wms/1.3.0/exceptions_1_3_0.xsd">

        Invalid format 'text/javascript', supported formats are [text/plain, application/vnd.ogc.gml, text/xml,
  application/vnd.ogc.gml/3.1.1, text/xml; subtype=gml/3.1.1, text/html,
  application/json]

var clicked_coord;
var onSingleClick = function(evt){
    var coord = evt.coordinate;
    console.log(coord);
    var str = coord;
    var source1 = urldeep;
    var source2 = urlground;
    var layers_list = source1 + ',' + source2;
    var view = map.getView();
    var viewResolution = view.getResolution();
    url = groundwatertable.getSource().getGetFeatureInfoUrl(
        evt.coordinate, viewResolution,view.getProjection(),
        {
            'INFO_FORMAT': 'application/json',
            'FEATURE_COUNT': 20,
            'LAYERS': layers_list,
            'QUERY_LAYERS': layers_list
        });
    console.log(url);
    if (url) { //call parseResponse(data)
        clicked_coord = coord;
        $.ajax(url,
            {dataType: 'jsonp'}
        ).done(function (data) {
            });
    }


text:
Q: Google App Engine performance setting : Some performance settings must be changed via Module configuration files Google App Engine performance setting is not available for the application, it is displaying as Some performance settings must be changed via Module configuration files.
My question is, in my current application I am not using module, so it should have performance setting sliders displayed? Or I need to set it through configuration file?

A: Google has disabled the performance panel. The only option left is to configure through appengine-web.xml.
Thanks.


text:
Q: What are the formal terms for the properties of an ordering of a number system EDIT:
I suppose the following is also a necessary property of our comparison system - what is its name? I realise it's an extremely basic one but in any abstract order perhaps it is necessary to define it.
$$a=b\implies f(a)=f(b),\forall f:\mathbb{C}\to\mathbb{C}$$
OP:
A video on the proof of the inability to "properly" order the complex numbers stated the following properties as necessary conditions for such an ordering:
$$\begin{align*}
\\&1)\quad a<b\text{ or }a>b\text{ or } a=b
\\&2)\quad a<b,b<c\implies a<c
\\&3)\quad a<b\implies b>a
\\&4)\quad a<b\implies a+x<b+x,\forall x\in\mathbb{C}
\\&5)\quad a<b\implies ax<bx,\forall x>0
\\&6)\quad a<b\implies ax>bx,\forall x<0
\end{align*}$$
I think I am right in saying that the first three conditions are properties of a "total order", but I could find no other term that captured the final three conditions. I believe also that $1)$ is known as the trichotomy property, $2)$ is the transitive property, $3)$ is the reflexive property, but I do not know the names of the last three, or whether the last three are direct conclusions from the first three.
I am asking the formal name for such an ordering under arithmetic as described above (since the only ordering terms I found were to do with sets in general and not arithmetic in those sets) and what the formal names, if any, there are of the last three conditions.
Many thanks.

A: It's called an ordered ring (or in this particular case an ordered field). The point of the final three conditions is that the ordering plays nicely with addition and multiplication.
If we didn't have such requirements, then ordering $\Bbb C$ would be no trouble at all. There are plenty of ways to totally order $\Bbb C$. But none that behave the way we expect orderings to behave with respect to arithmetic.


text:
Q: How to loop through objects I'm having a bit of a problem finding a solution to this. I'd like to be able to output some data that I have filtered by datetime, but so that it displays a separate div for each set of objects with a particular date. Is this possible? I couldn't find what would let me do this in the django docs.

A: You want to regroup the sequence based on the date.


text:
Q: Why do clouds appear black? I have noticed clouds appearing black during rain. But I don't know what makes clouds to acquire that colour.

This phenomenon doesn't appear every rainfall. There has to be distinction to white rain clouds.

A: Heavy clouds have condensed to the point of large droplet formation, failing the Rayleigh criterion for visible light and so no longer scatter them. It is a case of absorption being higher than reflection/scattering that causes clouds to look dark.

A: Clouds scatter light by a process called Mie Scattering, meaning all wavelengths are scattered equally, so clouds are always white unless the light source itself is missing some wavelengths (e.g. at sunset, when only the red/yellow end of the spectrum hits). However, depending on where you are relative to the cloud and how thick with water droplets the cloud is, it can block sunlight, so rather than a change of colour it is in fact a lack of brightness that you are seeing.
It's worth checking out the summary section of this page for further information.
You may also notice that sometimes there are dark clouds and light clouds in the same sky, but if you look at the direction of sunlight you'll usually see that the dark clouds are merely in the shadow of other clouds.


text:
Q: How can I make a form visible and maximize it to fill a secondary monitor without it activating? I have an application which is designed for multiple monitors. It starts up, and we try to avoid activating windows that do not need to be activated, because the user only does keyboard input in one place, and each time we Activate a new form on a secondary monitor, it grabs keyboard focus, something we wish to avoid.
Our in-house base TForm class has a method like this, which is using the Win32 ShowWindow function directly, avoiding the VCL framework's internal visibility change system which grabs focus:
procedure TOurForm.ShowWithoutActivate;
begin
    ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
    Self.Visible := true;
end;

If I just did this, it would grab focus:
 Self.Visible := true; // TWindow.Visible = true, will grab focus, plus make window visible.

This works, but the next thing I'd like to be able to do is set Maximized state so that the
form will maximize itself on the Monitor that it is currently on.  How do we get it onto a particular monitor?  The same way it always worked, with modification of the Left and Top properties of the Form. We have to take care that if we store Left/Top/Width/Height on form, and then restore it, that the results are still valid when we reload it. That is NOT what I'm asking about.
I'm specifically asking about how to maximize the form now that I have "showed" it using the above custom function.  One hack begets another hack. Here is how far down this rabbit hole I've gone:

*

*When a TForm, which is also a TWinControl's private field FShowing is false, setting Form.Maximized has no effect.

*When a TForm has its TWinControl.FShowing field set true, setting the windowState to wsMaximized also causes the form to activate.

Is it possible to both make this form visible and make it take the window state I want it to take without activating?  If I can't do this, then users are going to lose their keyboard focus when I show this form on a secondary monitor, something that I really want to avoid.
What I tried is to use Win32 ShowWindow API to do SW_SHOWMAXIMIZED:
  ShowWindow(Self.Handle, SW_SHOWMAXIMIZED);

The above seems to grab focus (activate).

A: When you create the top-level window set the extended window style to
WS_EX_NOACTIVATE | WS_EX_APPWINDOW

WS_EX_NOACTIVATE stops the window activating.  This also makes it disappear from the taskbar, so you need WS_EX_APPWINDOW to fix that problem.
Call ShowWindow(hWnd, SW_MAXIMIZE) and the window will be maximized but not activated.
You need to be able to activate the window once it is visible, so in the WM_ACTIVATE handler (the irony!) you need to clear the WS_EX_NOACTIVATE flag thus:
case WM_ACTIVATE:
    {
        DWORD exstyle = GetWindowLong(hWnd, GWL_EXSTYLE);
        if (exstyle & WS_EX_NOACTIVATE)
        {
            SetWindowLong(hWnd, GWL_EXSTYLE, exstyle & ~(DWORD)WS_EX_NOACTIVATE);
        }
    }

Apologies for the C++.  This should be simple to translate into Delphi.

A: EnumDisplayMonitors API enumerates the monitors and their coordinates on the joint desktop, area into which a particular monitor maps to its specific position.
To find out which monitor is "current" you would want to compare the current window position against monitor coordinates rcMonitor/rcWork. Or, you have MonitorFromPoint and friends to help you.
Once to decided which monitor you want, you can either move your window (MoveWindow, SetWindowPos) to monitor's work area, or use this rectangle in response to WM_GETMINMAXINFO message to send the window to this position as a part of standard maximization.
To add to this, this small C++ application [1, 2, 3] demos the concept mentioned above, shows monitor information, and changes position where the window would be maximized to.


text:
Q: Plot results from the model returned by lm Sorry if this is trivial, have not found a solution.
To keep this simple, I have 5 points (say, d0 = c(1,2,3,4,5)) and 5 values (say f0 = c(0.8950514, 1.240066, 1.410252, 1.494778, 1.514794)).
I want to generalize this and find a function f such that f(d0) = f0. Pretty simple. For this, if I got it right, I need to do some trial and error to find the right structure for f; then I can extract its parameters with lm. Right?
So, I start trying a simple linear model:
model <- lm(f0 ~ d0)$coefficients

Then I want to plot it to see the actual fit:
lines(d0, model[[1]] + d0*model[[2]])

Issue
Things get boring when trying other kinds of dependencies. For example, I can guess a log log dependency between the two:
model <- lm(log(f0) ~ log(d0))$coefficients

But then to plot the real function I need to alter the call to lines to
lines(d0, exp(model2[[1]] + model2[[2]]*log(d0)))

Now if I were to try another kind of formula, I would have to use a different line of code for lines.
Questions

*

*Is there a way to automatically plot the results of lm (in the form of lines(d0, predicted.f)), perhaps using the information in lm$call?

My wish is something like:
model <- lm(f0 ~ d0)
plotFromModel(d0, model)
model <- lm(log(f0) ~ log(d0))
plotFromModel(d0, model)

*Is there something I am missing here? Should this simple task be done with lm and different formulas or is there a more obvious path?

Edit
Looks like there's no more obvious path. I clarify here that this question comes out of necessity to find the best-fit 1d curve for these 5 points. So, while we are forced to use lm, one has to be open to all kinds of formulas, like
f0 ~ d0

log(f0) ~ d0

f0 ~ d0 + I(log(d0)^2)

And so on. On top of that, I am still looking for a one dimensional function, i.e. an y = f(x) where both x and y are scalars and there's no other parameter involved.
Other typical requirements in a curve-fitting problem would be that, once you have found the model from the 5 points, you can see its real curve (-> use d's of arbitrary lengths), and you can compare it with other models you are testing. I'd like to replicate the following behavior:
d0 <- c(1,2,3,4,5)
f0 <- c(0.8950514, 1.240066, 1.410252, 1.494778, 1.514794)
d <- seq(from = 1, to = 5, length.out = 200)

windows(w=700,h=500)
plot(d0, f0, type='b',col='black', log='xy',lwd=4)
grid()

m <- lm(f0 ~ d0)$coefficients
lines(d, m[1] + m[2]*d, col='orange', lwd=3)

m <- lm(log(f0) ~ log(d0))$coefficients
lines(d, exp(m[1] + m[2]*log(d)), col='blue', lwd=3)

m <- lm(log(f0) ~ log(log(d0)))$coefficients
lines(d, exp(m[1] + m[2]*log(log(d))), col='green', lwd=3)

m <- lm(log(f0) ~ log(d0) + I(log(d0)^2))$coefficients
lines(d, exp(m[1] + m[2]*log(d) + m[3]*log(d)^2), col='red', lwd=3)

m <- lm(f0 ~ d0 + I(d0^2))$coefficients
lines(d, m[1] + m[2]*d + m[3]*d^2, col='pink', lwd=3)

From this I can tell that red is better.
From the great answer below this turned out to be non-trivial so personally I'll just stick with the manual approach. This should be possible, since the formula is kept in model$call, but I can live without it.

A: plotFromModel assumes a model with a possibly transformed y value and a single x value; however, the x value can be involved in multiple lm terms and each may transform x.  finv must specify the inverse transformation of the LHS (or can be omitted if y is not transformed).  If add is FALSE (the default) it plots y vs x and then the fit. If add is TRUE it only plots the fit overplotting any existing plot. ... are passed to the lines command that plots the fit.   Note that it refits the model.
Also, note that the different fits are not comparable using conventional linear regression tests since they are using the sums of the squares of different funcdtions of y.
plotFromModel <- function(x, fm, finv = identity, add = FALSE, ...) {

   # DF's columns are y and x
   DF <- cbind(finv(fm$model[1]), x)
   names(DF) <- all.vars(terms(fm))

   if (!add) plot(DF[2:1]) # plot y vs. x
   fm.new <- lm(terms(fm), DF) # refit using new x
   lines(finv(fitted(fm.new)) ~ x, ...)
}

d0 = c(1,2,3,4,5)
f0 = c(0.8950514, 1.240066, 1.410252, 1.494778, 1.514794)

fm0 <- lm(f0 ~ d0)
fm1 <- lm(log(f0) ~ log(d0))
fm2 <- lm(log(f0) ~ log(d0) + I(log(d0)^2))
fm3 <- lm(f0 ~ d0 + I(d0^2))

plotFromModel(d0, fm0, col = 1)
plotFromModel(d0, fm1, exp, add = TRUE, col = 2, lty = 2)
plotFromModel(d0, fm2, exp, add = TRUE, col = 3, lty = 3)
plotFromModel(d0, fm3, add = TRUE, col = 4, lty = 4)

A: You can use predict to apply the model to your data. Here is an example:
d0 = c(1,2,3,4,5)
f0 = c(0.8950514, 1.240066, 1.410252, 1.494778, 1.514794)
model <- lm(f0 ~ d0)

plot(d0, f0)
lines(d0, predict(model, data.frame(d0 = d0)))

Maybe there is some more elegant way than creating a data frame as an argument for predict but it should be at least a sufficient solution.


text:
Q: Python module, pyttsx3 not recognised in VS code or pycharm I am trying to make a bot that responds to certain question asked like 'what is the time' . I am trying to use pyttsx3 module to make it work but this error is coming:
Traceback (most recent call last):
  File "/Users/HarAd MAC/Desktop/Projects/Python_Work/bot.py", line 1, in <module>
import pyttsx
ImportError: No module named pyttsx3

I have download the module and checked it in VS code Terminal. It is also showing Requirement already satisfied. Can someone help me in this problem. Same error was shown when I was trying to run it in pycharm. These type of problems have also occurred when using modules that have to be download manually.
I am using MacBook Air big Sur and python 3.9.
Thanks.

A: I don't know for sure but I believe when your import the library you have to do import pyttsx3 while what you were doing is import pyttsx. Here's some more info on usage and how to import


text:
Q: back button scroll position After I submit a form the position will return to the top of the window. Instead of going to the previous position.
Looking at using scrolltop to rememeber the positon or do you have a better idea?
I'm using stuff like PHP5, jQuery and MySQL.

A: First create an anchor in your page where you want the visitor to get to when they submit the form.
Then in your form action or redirect point to file with the anchor
e.g.
 <div id="view_from_here" >.....

then
 <form action="myfile.php#view_from_here" ....

A: Check this out:
<script type="text/javascript" src="der/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="der/jquery.cookie.js"></script>
<script type="text/javascript">
function get_position(){
    var top_position = document.documentElement.scrollTop;
    $.cookie('pos', top_position);
};
function set_position(){
    var top_position = $.cookie('pos');
    window.scrollTo(0,top_position)
    $.cookie('pos', null);
};
</script>
</head>
<body onload="set_position();">
.
.
.
<form method="post" action="" onsubmit="return get_position();">
</form>

A: If you submit you Form via Ajax it won't change anything (maybe that is an option, if you redirect to the same page anyway). You can also save the position in a Cookie via JavaScript before submitting and retrieve and set the value when the new page is loaded (e.g. with jQuery scrollTo). Or you just set an anchor on your Form field (which is very likely to be the last position the user scrolled to) and scroll back to the form after submit.


text:
Q: activerecord find and update Is there a method find_and_update method on ActiveRecord::Base that will basically find a record by it's id and update a given key? This will avoid having to query and then update resulting in 2 queries instead of 1.
Thanks

A: User.where(id: id).update_all(foo: bar)

This generates only one query.

A: There is an update method in active record, which finds by id and updates attributes. But this will make two sql queries.
update(id, attributes)

eg
 Post.update(params[:id], {:title => 'Hello world'})

If you dont want validations to happen, you could use
Post.update_all({:title => 'hello1'}, {:id => params[:id]})

This will make only one sql query


text:
Q: Can I use something other than $ to prevent conflict between jQuery plugins? I have two plugins, both which use their own .swipe() function: ex: $("div").swipe();
Is it possible to give one of the plugins a different variable instead of $?
For example, could I use jQ("div").swipe(); for plugin A and $("div").swipe(); for plugin B?

A: Yes, however it would be better to instead rename the plugin.
<script src="jquery.swipe.js"></script>
<script>
    $.fn.swipeOne = $.fn.swipe;
</script>
<script src="jQuery.swipeTwo.js"></script>
<script>
$(document).ready(function(){
    $("#swipeone").swipeOne();
    $("#swipetwo").swipe();
});
</script>

Otherwise you would have to include jQuery twice.

A: Yes, you want the noConflict option.
http://api.jquery.com/jQuery.noConflict/
Better example of how to use it:
http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/

A: If both jQuery plugins need to be bound to the same jQuery object, go in either one plugin, and look for $.fn.swipe. Change the word "swipe" to anything you like (e.g. $.fn.mySwipe), bearing in mind that its internal references to the word "swipe" might also need to change.

A: you can use
jq(function) {

})

and then just refer to jq

A: You can change the $ by using
var $j = jQuery.noConflict();

Now you'd use $j whenver you'd use $ before, e.g.,
$j(document).ready(function() {
    //stuff
}