text:
Q: Event for Handling the Focus of the EditText Can anyone suggest to me any event related to the focus of the EditText?
My application contains an EditText, which accepts a URL in it.
Now my problem is that, that after the user will enter the URL in the field and Move further, without any of the click events, i.e when the focus will move from the EditText, it should detect the entered Url and goes to the server.
If I get the reply using Json Parsing, then it'll be more convenient.

A: Here is the focus listener example.
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
    @Override
    public void onFocusChange(View view, boolean hasFocus) {
        if (hasFocus) {
            Toast.makeText(getApplicationContext(), "Got the focus", Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(getApplicationContext(), "Lost the focus", Toast.LENGTH_LONG).show();
        }
    }
});

A: For those of us who this above valid solution didnt work, there's another workaround here
 searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean isFocused) {
            if(!isFocused)
            {
                Toast.makeText(MainActivity.this,"not focused",Toast.LENGTH_SHORT).show();

            }
        }
    });

A: When in Kotlin it will look like this:
editText.setOnFocusChangeListener { _, hasFocus ->
    if (hasFocus) {
        toast("focused")
    } else {
        toast("focuse lose")
    }
}

A: *

*Declare object of EditText on top of class:
EditText myEditText;

*Find EditText in onCreate Function and setOnFocusChangeListener of EditText:
myEditText = findViewById(R.id.yourEditTextNameInxml);

myEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
             @Override
             public void onFocusChange(View view, boolean hasFocus) {
                 if (!hasFocus) {
                      Toast.makeText(this, "Focus Lose", Toast.LENGTH_SHORT).show();
                 }else{
                     Toast.makeText(this, "Get Focus", Toast.LENGTH_SHORT).show();
                 }

             }
         });

It works fine.


text:
Q: How to Convert Centesimal to Sexagesimal I have this query: I need convert the centesimal value from the database to sexagesimal (minutes)
SELECT
DISTINCT RD_MAT,
SUM(CASE WHEN RD_PD IN ('421') THEN RD_HORAS ELSE 0 END) AS 'ATRASOS',
SUM(CASE WHEN RD_PD IN ('420') THEN RD_HORAS ELSE 0 END) AS 'FALTAS',
SUM(CASE WHEN RD_PD IN ('084') THEN RD_HORAS ELSE 0 END) AS 'H.EXTRA 100%',
SUM(CASE WHEN RD_PD IN ('080') THEN RD_HORAS ELSE 0 END) AS 'H.EXTRA 50% ',
SUM(CASE WHEN RD_PD IN ('082') THEN RD_HORAS ELSE 0 END) AS 'H.EXTRA NOTURNA'
FROM SRD020
INNER JOIN SRV020 ON RD_PD = RV_COD
   AND SRV020.D_E_L_E_T_ <> '*'
   AND SRD020.D_E_L_E_T_ <> '*'
   AND RD_MAT = '000123'
WHERE LEFT(RD_DATPGT,6) = '201304'
GROUP BY RD_MAT

The return of H.EXTRA 100% in centesimal is 16:53. But in minutes is 16:49.
Example: 40 + 40 = 80 in centesimal. 40 + 40 = 1:20 in sexagesimal. I need this value.

A: So, it looks like you're going for something like this.  I'm casting to VARCHAR for output purposes, which you of course do not have to do.
DECLARE @value1 INT, @value2 INT

SET @value1 = 40
SET @value2 = 50

SELECT CAST(FLOOR((@value1+@value2)/60) AS VARCHAR(50)) + ':' +  CAST((@value1+@value2)%60 AS VARCHAR(50))

A: Declare @h Varchar(5)='16:53'

Select Cast(DateAdd(SS,CAST(REPLACE(@h,':','.') as Float)*60,0) as Time)

>>> 00:16:31.0000000

redpajama_set_name: RedPajamaStackExchange


text:
Q: Effective Serre Vanishing Suppose that $X = \mathbb{P}^n_k$ and $G$ is a coherent sheaf on $X$.
Question: Is there a way to determine some integer $n_0$ such that $H^1(X, G \otimes O_X(n)) = 0$ for all $n \geq n_0$?  (obviously $n_0$ depends on $G$)
Of course, the higher cohomologies would be very interesting as well, but perhaps the above is simpler.  One can also ask this for the relative case as well $f : Y \to X$ a projective morphism.
What I'd be particularly interested in is something that can be implemented into a computer.
In my particular case, I know I only have to compute some other things until Serre vanishing hits, at that point, I know I can stop computing.  Unfortunately, I don't know how to tell when I've arrived.  You can assume I have a presentation of my module $G$ if it helps.
PS: Actually, what I really want is vanishing of $$R^1 f_* (G(-nE))$$ for a blow-up $f : Y \to X$ with $E$ the pullback of the blownup ideal.

A: Take $n_0$ as (Castelnuovo–Mumford) regularity of $G$ minus $1$.
This generalizes to higher cohomology: for $H^i$ take the regularity minus $i$
Let $M$ be a module representing $G$.
Then, the (Castelnuovo–Mumford) regularity of $M$ is an upper bound of the regularity of $G$.
So for an implementation you can take the regularity of $M$, which can be computed using a free resolution of $M$.
If you need a better bound then you can compute a "better" module for $G$ by approximating its module of global sections.
However, this is rather expensive to my experience.


text:
Q: Error searching words with Ñ using twitterR in RStudio After the last update of R (v. 3.0.0) I can't search keywords with Ñ, like España, using twitteR.
I suppose is a encoding problem but I can't find a solution. When I search for other words it works fine.
My search line is:
tweetList <- searchTwitter('españa', n=15, lang="es")

And I get the following:
[1] "Unauthorized"
Error en twInterfaceObj$doAPICall(cmd, params, "GET", ...) :
  Error: Unauthorized

My sessionInfo() is:
R version 3.0.0 (2013-04-03)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] twitteR_1.1.6  rjson_0.2.12   ROAuth_0.9.3   digest_0.6.3   RJSONIO_1.0-3  RCurl_1.95-4.1
[7] bitops_1.0-5

loaded via a namespace (and not attached):
[1] tools_3.0.0

I've been updated the packages as you can see. I'm loaded correctly the credentials to use twitter api version 1.1, and I can make other searches without problems.

A: I know this question was asked 3 months ago, but I hope it can help someone who wants solution about this error like me.
After authorizing, I still have problems with the package twitteR. I don't know even if I got authorized actually. I had an error like you when I used searchTwitter(). I just found out how to run it successfully. Try it.
tweetList <- searchTwitter('españa', n=15, lang="es", cainfo="cacert.pem")


text:
Q: How can I overwrite or save an existing local HTML file that's edited in a UIWebView? The app uses a UIWebView to load up local HTML files (which are now just text) for editing. I need to save whats been edited by the user back to the local file. This is the only way I could think of doing that:
Once the text has been edited by the user, I've written a save method that takes the current HTML in the web view and saves it to an HTML file (with the same fileName as the original) which is written to the documents directory. In theory this should overwrite the original. But it doesn't.
-(void)save{
    NSError *err;
    NSString * docsDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
    NSString *oldFile = [self.webView.request.URL lastPathComponent];
    //Above line gets the actual HTML file name that's in the webview
    NSString * path = [docsDir stringByAppendingPathComponent:oldFile];
    //The following line gets what html code is in the actual webview
    NSString *html = [self.webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].innerHTML"];

    [html writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];
}

No file seems to be written. It doesn't overwrite the original nor does it write a new one.
Perhaps I shouldn't be saving it this way, but I can't think of any other methods of doing it.


text:
Q: Can't get AVMutableComposition in loop to play out of loop Xcode for iOS
The issue that I'm having is in the playback of an AVMutableComposition. I'm creating the composition then adding AVURLAssets to it inside a for loop. I'm adding everything as I would similarly add an object to a mutable array and then attempting to play it back afterwards, but playback isn't occuring. Here is my code:
AVMutableComposition *composition = [AVMutableComposition composition];

int count;

count = array.count;

for (int y=0;y<count;y++){

        NSURL *url;

            url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath],[array objectAtIndex:y]]];

        NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey];

        AVURLAsset *sourceAsset = [[AVURLAsset alloc] initWithURL:url options:options];

        //calculate times
        NSNumber *time = [soundArray1 objectAtIndex:1];

        double timenow = [time doubleValue];
        double insertTime = (240*y);

        CMTime douTime = CMTimeMake(240, timenow);
        CMTime staTime = CMTimeMake(0, 1);
        CMTimeRange editRange = CMTimeRangeMake(staTime,douTime);

        CMTime insTime = CMTimeMake(insertTime, timenow);

        NSError *editError;

        [composition insertTimeRange:editRange ofAsset:sourceAsset atTime:insTime error:&editError];

    }

AVPlayer* mp = [AVPlayer playerWithPlayerItem:[AVPlayerItem playerItemWithAsset:composition]];

[mp play];

I'd assume that I am getting it completely wrong, but I then  added this inside the loop instead of after, inside an if and opening a NSRunLoop to check (a little bad, but it was just to test!):
    AVMutableComposition *composition = [AVMutableComposition composition];

int count;

count = array.count;

for (int y=0;y<count;y++){

        NSURL *url;

            url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@.mp3", [[NSBundle mainBundle] resourcePath],[array objectAtIndex:y]]];

        NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey];

        AVURLAsset *sourceAsset = [[AVURLAsset alloc] initWithURL:url options:options];

        //calculate times
        NSNumber *time = [soundArray1 objectAtIndex:1];

        double timenow = [time doubleValue];
        double insertTime = (240*y);

        CMTime douTime = CMTimeMake(240, timenow);
        CMTime staTime = CMTimeMake(0, 1);
        CMTimeRange editRange = CMTimeRangeMake(staTime,douTime);

        CMTime insTime = CMTimeMake(insertTime, timenow);

        NSError *editError;

        [composition insertTimeRange:editRange ofAsset:sourceAsset atTime:insTime error:&editError];

    if(y==3){

    AVPlayer* mp = [AVPlayer playerWithPlayerItem:[AVPlayerItem playerItemWithAsset:composition]];

    [mp play];

    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:20]];

        }
    }

Here, I just gave my array 4 elements and made it play the composition on the 4th run-through. It worked and played my 4 audio files in perfect order.
What do I need to do to make my composition play after this loop rather than in it? Am I mis-using the system?
EDIT: by sticking my open RunLoop code on the end, it plays. Should I be doing it this way, or is there a better way to do this?

A: So I was going about this the wrong way. I needed to create an AVMutableCompositionTrack for each element and add that to my composition
       NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
                                                            forKey:AVURLAssetPreferPreciseDurationAndTimingKey];

        AVURLAsset *sourceAsset = [[AVURLAsset alloc] initWithURL:url options:options];

        //calculate times
        NSNumber *time = [soundArray1 objectAtIndex:1];

        double timenow = [time doubleValue];

        double insertTime = (240*y);

                    AVMutableCompositionTrack *track =
        [composition addMutableTrackWithMediaType:AVMediaTypeAudio
                                 preferredTrackID:kCMPersistentTrackID_Invalid];

        //insert the audio track from the asset into the track added to the mutable composition
        AVAssetTrack *myTrack = [[sourceAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
        CMTimeRange myTrackRange = myTrack.timeRange;
        NSError *error = nil;
        [track insertTimeRange:myTrackRange
                                      ofTrack:myTrack
                                       atTime:CMTimeMake(insertTime, timenow)
                                        error:&error];

        [sourceAsset release];

followed by
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:composition];
self.player = [[AVPlayer alloc] initWithPlayerItem:playerItem];

        [self.player play];

with player declared as a property in the interface section
@interface SecondViewController ()

@property (nonatomic, assign) AVPlayer *player;

@end


text:
Q: How to force Gstreamer playbin use the jpegparse plugin? On linux platform, I developed a hardware based Jpeg decode plugin named xxxhwjpegdec to replace jpegdec (software based decode),and I adjust xxxhwjpegdec rank to the highest 257. The xxxhwjpegdec pulgin need jpegparse to parse the jpeg header.
When i use:
"gst-launch-1.0 -v filesrc location="/tmp/MJPEG.AVI" ! avidemux name=t t.video_0 ! jpegparse ! xxxhwjpegdec ! waylandsink"

it can play the /tmp/MJPEG.AVI smoothly.
My target is using "gst-launch-1.0 playbin uri=file:///tmp/MJPEG.AVI" to play the file smoothly by my hardware decode.
But i use "gst-launch-1.0 playbin uri=file:///tmp/MJPEG.AVI" it use jpegdec plugin, which based software to decode, so it cause  the /tmp/MJPEG.AVI be played not smoothly. I checked the playbin pipeline "jpegparse" is not used.
If i delete the jpegdec plugin,
then use "gst-launch-1.0 playbin uri=file:///tmp/MJPEG.AVI" , it can't paly the
/tmp/MJPEG.AVI. I checked the key pipeline is "filesink--avidemux--xxxhwjpegdec--waylandsink", no jpegparse inserted.
I judge the playbin Form two different pipeline by above info,
one is
"filesink--avidemux--xxxhwjpegdec--waylandsink(can't play)" ,
another is
"filesink--avidemux-jpegdec--waylandsink(can play)".
Because my xxxhwjpegdec need jpegparse plugin to support it. There is no jpegparse inserted by playbin, So the playbin can't select the first higher priority hardware pipeline to play, it have to select the second lower priority software pipeline to play it instead.
So I think the root cause is the jpegparse plugin can not be select by the playbin automaticly.
So, anyone know how to force Gstreamer playbin use the  jpegparse plugin?
Or other solution is welcome!
Thanks.

A: jpegparse outputs:
Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      image/jpeg
                 format: { I420, Y41B, UYVY, YV12 }
                  width: [ 0, 2147483647 ]
                 height: [ 0, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
                 parsed: true

maybe you can change the sink-caps of your jpegdecoder to inlcude parsed: true to indicate that you need parsed jpeg buffers.


text:
Q: Redirect all subsites to one site I have a website running on Apache. The address is http://helpdesk.example.com/otrs/customer.pl
I would like to create a forward such that if I access http://helpdesk.example.com/otrs/anyname (except customer.pl) this redirects to http://helpdesk.example.com/otrs/customer.pl
Also I'd like to not show the path of the website in the URL:
http://helpdesk.example.com/otrs/customer.pl displayed as http://helpdesk.example.com/
Thanks you for help!


text:
Q: Confidence intervals for median from Wilcoxon signed rank statistic We are given the sample $X_1, ..., X_n$ from a common distribution with median $\mu$. Using Wilcoxon's signed rank statistic, how can I construct a confidence interval in terms of the order statistics of the random samples here?
In particular, I am looking to show $(X_{(3)},X_{(10)})$ gives a 96.21% confidence interval for the median $\mu$ when $n=12$.


text:
Q: AS3: why is this happening? I just encounter a strange problem:
var a:ClassA = new ClassA;
var b:ClassA = a;

The program keeps running sometime, the a = null, b = null.
The program is a complex one, I am sure that no part will touch a, and b. My question is, will  the runtime(garbage collector) to collect the memory of "a" and then assign a and b to null?
I am confused, thanks!

A: The garbage collector will reclaim the memory that this instance of ClassA occupies, only once there is no longer a reference to it.  As long as a OR b references that memory location, the instance will remain.  If these are local variables, then the instance will be picked up by the GC at some point after the function/method exits.  If those are instance variables then they will remain until after the defining class' instance is collected.

A: try
var a:ClassA = new ClassA();
var b:ClassA = a;

The () at the end of the class name calls the constructor so that you actually have your ClassA.


text:
Q: How to hover over data inserted from JSON I have a file where I take information from a JSON and insert it into a div:
document.getElementById('display_area').innerHTML += "
" + jsonData[obj]["name"] + "
";

I want to be able to hover over this data and fade it out, so I have:
$( "p" ).hover(function() {
    $( "p" ).fadeOut( 100 );
  });

The problem is, it doesn't recognize it as a p, so it doesn't do anything.

A: You can append your json data and then add hover dynamically.

var jsonData = { obj : { name : "ARIA Meyer"} }

$(document).ready(function() {
    $("#display_area").append(`

${jsonData['obj']["name"]}

    `);

    $( "p" ).hover(function() {
    $( "p" ).fadeOut(500);
  });
});


text:
Q: Why is len() so slow? I'm running the following code in an ipython session:
# This call is slow, but that is expected. (It loads 3 GB of data.)
In [3]: arc, arc_sub, upls, go = foo_mod.ready_set()

# This call is also slow, as `upls` is huge.
In [4]: upls = list(upls)

# This call is slow in meatspace, but `%timeit` doesn't notice!
In [5]: %timeit -n1 -r1 len(upls)
1 loops, best of 1: 954 ns per loop

%timeit is straight-up lying here. With or without the %timeit, the command takes upwards of 10s to actually run. Only the first time, however; subsequent calls to len are quick.
Even time.time() sings a similar tune:
In [5]: import time

In [6]: s = time.time(); len_ = len(upls); e = time.time()

In [7]: e - s
Out[7]: 7.104873657226562e-05

But it took seconds in the real world for In [6] to actually complete. I just don't seem to be able to capture where the actual time is being spent!
There's nothing terribly unusual about the list, aside from it's huge: it's a real list; it holds ~¼ billion bson.ObjectId objects. (Prior to the list() call, it's a set object; that call is also slow, but that makes sense; list(<set instance>) is O(n), and my set is huge.)
Edit re GC
If I run gc.set_debug(gc.DEBUG_STATS) just prior to ready_set, which itself is a slow call, I see tons of GC cycles. This is expected. gen3 grows:
gc: objects in each generation: 702 701 3289802
gc: done, 0.0000s elapsed.
gc: collecting generation 0...
gc: objects in each generation: 702 1402 3289802
gc: done, 0.0000s elapsed.
gc: collecting generation 0...
gc: objects in each generation: 702 2103 3289802

Unfortunately the console outputs make this runtime of this impossibly slow. If I instead delay the gc.set_debug call until just after ready_set, I don't see any GC cycles, but gc.get_count() claims the generations are tiny:
In [6]: gc.get_count()
Out[6]: (43, 1, 193)

In [7]: len(upls)
Out[7]: 125636395

(but why/how is get_count less objects than what's in the list?; they're definitely all unique, since they just went through a set…) The fact that involving gc in the code makes len speedy leads me to believe I'm paused for a collect-the-world.
(Versions, just in case:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
IPython 3.2.0 -- An enhanced Interactive Python.

)

A: I will summarize the comments to your question to the answer.
As everyone said (and you pointed it out), Python's list object knows its size and it returns just the stored number:
static Py_ssize_t
list_length(PyListObject *a)
{
    return Py_SIZE(a);
}

Where Py_SIZE is defined:

Py_SIZE(o)
This macro is used to access the ob_size member of a Python object. It expands to:
  (((PyVarObject*)(o))->ob_size)

So I can conclude it should not do any calculations. The only suspected is the object you trying to convert to list. But if you swear it is really list without any fake objects simulating its method with some lazy calculations - it is not it.
So I assume that all timeit methods are really showing exact time spent to call len function.
And the only time-wasting process is.. Garbage Collector. At the end of your measurements it discovers that noone uses such large piece of data and starts releasing the memory. Sure, it takes some seconds.


text:
Q: IntelliJ 10/11 AutoComplete broken with SWC dependencies from SWF Project I am working on setting up a project for some developers and helping them componentize some of their code into a swc. I have created an Ant build process for them, but when setting up dependencies in IntelliJ's Flex Facets we are seeing that code that is referenced from the Libraries is not autocompleting nor is it letting us step into classes accross libraries. I am sure this works as I have done it with a Maven setup before. I just wonder if there is some setting I am missing when doing ti manually as these guys are not willing to go the route of Maven yet.
Here is a quick screenshot of our test SWF that depends on two SWC libraries:

Notice that in this sample class the code that lives in the client-core project does not show up as code completed (it's red) but it compiles fine with Ant.

Any ideas as to what we are doing wrong here?

A: answered in InteliJ IDEA forum: http://devnet.jetbrains.net/message/5447354#5447354


text:
Q: Microsoft Master Data Services - When to utilize? I'm wondering if anyone is currently utilizing Microsoft's Master Data Services? How you are utilizing it? Whether you find it useful? When you believe it would be useful? Thanks!

A: I have been working with MDS since it was first released as part of a feature pack for SQL Server 2008 R2.  While MDS has some compelling features - most notably detailed data lineage, I am not confident in recommending it to clients yet.
My reason for this hesitation is the nature of the install and the tendendency to fail on upgrade or system change.  I struggled mightily with the both the SQL Server 2012 RC0 MDS and the RTM installs.  There are simply too many brittle aspects of the install (such as the hard requirement that the service be installed on a domain-joined machine and the need to install the Silverlight 5.0 SDK for the client to work properly).  I also experienced flakiness in the the Excel add-in.
I see where Microsoft is going and I think the product will eventually be useful.  Considering it's purpose (master data repository), MDS must be more 'rock solid' before I would use it in production.

A: We aren't using it currently in our office, however the presentation Microsoft did in town a while back seemed very interesting.  I saw it as sort of a competitor to Oracle's OBAW warehouse.  You've probably already looked at these, but Microsoft has a decent set of webcasts that cover how to install and use MDS out here:
http://www.msdev.com/Directory/SeriesDescription.aspx?CourseId=155
I'm anxious to see if anyone else is using it as well, we tend to have a hard time talking our management into letting us try these types of services without being able to point to other corporations that have successfully implemented said product.

A: We're just starting to investigate the use of MDS to support our consulting practice, specifically around data analytics and ETLs to deduplicate, standardize, and sanitize client data. It's probably just scratching the surface of MDS, but we were led to MDS initially for its inclusion of regular expression capabilities in SQL to transform free-form text data.

A: Before MDS/DQS, part of the sustainability / enduring-success of a custom database application was heavily dependent on one or both of the following items...

*

*Having a full-time technical resource to manually update the master data.  Someone who can work with the Business Experts and make the necessary adjustments to the data in the database.

*Developing (in addition to the database/application/etc) a custom UI that is intuitive enough for the less-technical Business Experts to use for managing the master data themselves.

Neither of these were ideal from a cost-perspective.  With MDS/DQS, a developer/contractor can come in, design an end-to-end Data Warehouse/BI solution including full integration with DQS/MDS (probably via SSIS packages) with relative ease.  The Business-Experts can be trained to manage the master data using a UI they are already very familiar with (ex. Excel), and the developer/contractor can move on to the next project/client.
Also, if the business already has other data sources (via acquisitions or silo'd-yet-overlapping efforts or whatever), MDS can be used to manage all the master data in one centralized location.

A: It might not be the best MDS product available yet however it does come with SQL Server. Compared to most of the bespoke efforts for accommodating meta-data or master data in warehouse loads it's a pretty good option since most of the time is spent concentrating on the warehouse and the mastering of ancillary or other data isn't normally well accommodated for leaving questionable results. I prefer to use it than create some other flaky option that the customers will find it difficult to maintain. If you have budget however I would consider looking around for something more polished.
Like anything though give master data the respect it deserves. If it is going to be used then it's worth spending the time to model the entities, flow of data and usage correctly. The data stewards will need to savvy and will require training (it's not the most usable interface in the world - to say the least).

A: As we are a small consulting and development company we don't use MDS internally but we do implement it at customers with a focus on managing the Golden Record as the customers have a myriad of databases and applications all using the same data (customer, product …)
I agree with Lynn Langit's comment about installation and SilverLight dependency and the general comments about the UI. There are also a lot of smaller companies that don't run SQL Enterprise Edition but whom could benefit from MDS.
Those are the reasons why we are now developing a modern web application which we will host for our customers (probably on Azure).
If you're thinking about MDS I'd recommend to have a look at the API to replace (parts) of the UI.

A: Master Data Service is very useful for managing Master Data,
We have used Master Data Services 2012 and 2016, there are not too many features present in 2012 ,2016 is much better than 2012 with some new features , but I think still Microsoft needs to improve Master Data Services, they should include some flexibility in business rule's area.


text:
Q: Proxysql query rule starting with comment didn't work On proxyql 2.2.0
I've the following rule which isn't working (stats_mysql_query_rules counter always on 0).
INSERT INTO mysql_query_rules (active, match_digest, destination_hostgroup, apply, multiplex) VALUES (1, '/\* Master \*/', 1, 1, 1);
This rule is in number position on my mysql_query_rules table.
The idea is to catch query like this one and push them to my Master node (AWS RDS Aurora writer endpoint).
/* Master */
select * from my_table;

Regex seems OK but the rule didn't (and query is counted on other rules).

A: The documentation isn't explicit about it but it seems that query rules match_digest evaluation is stripping comments (e.g. /* Comments */) within SQL queries. So the pattern used above need to be insert inside the match_pattern field


text:
Q: 'System.Data.Metadata.Edm.EdmFunction' is not an attribute class I am maintaining a visual studio 2008 application (website project). There is no chance to upgrade to higher version of.net framework or upper version of entity framework. Like many IT shops, unless there are major issues, people are not going to allow me to do major upgrade on the system.
The .net framework is 3.5. and the EF version is 1.0
I need to change my program, so my select linq statement will work
Calling a SQL User-defined function in a LINQ query
As you can tell, I need to include stored function as a part of select statement
So I copied the statement.
I have struggled for hours, and I keep getting compilation.
//..various using statement
using System.Data.Objects.DataClasses;
using System.Data.Metadata.Edm;

//..other class
public static class EntityFunctions
{
    [EdmFunction("FBLModel.Store", "SampleFunction")]
    public static int SampleFunction(int param)
    {
        throw new NotSupportedException("Direct calls are not supported.");
    }
}

I keep getting compilation errors
error CS0246: The type or namespace name 'EdmFunctionAttribute' could not be found (are you missing a using directive or an assembly reference?)
I have searched the whole internet include stackoverflow and MSDN blog, the namespace looks correct

Any suggestions? Thank you

A: The problem here is that you have a conflicting reference with your namespaces.
The System.Data.Metadata.Edm namespace contains a class called EdmFunction. The System.Data.Objects.DataClasses namespace contains a class called EdmFunctionattribute (which is the one you are trying to use).
For some reason your code is referencing the EdmFunction class. Try removing the namespace import for System.Data.Metadata.Edm, as you probably didn't want to import this in the first place.


text:
Q: org.hibernate.MappingException: Could not determine type for: java.util.Collection, for columns: [org.hibernate.mapping.Column(lisOfAddresses)] I am  making a hibernate small application in which i am getting the following exception

Exception in thread "main" org.hibernate.MappingException: Could not determine type for: java.util.Collection, for columns: [org.hibernate.mapping.Column(lisOfAddresses)]

I have read several posts but unable to find the solution.
can anyone tell me why the exception is coming. The code is as below:
UserDetails.java
  package com.sdnext.hibernate.tutorial.dto;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Table;

import org.hibernate.annotations.CollectionId;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

@Entity
@Table (name="USER_DETAIL")
public class UserDetails
{
    @Id
    @Column(name="USER_ID")
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int    userId;

    @Column(name="USER_NAME")
    private String userName;

    @ElementCollection
    @JoinTable(name="USER_ADDRESS",
            joinColumns=@JoinColumn(name="USER_ID"))
    @GenericGenerator(strategy="hilo", name = "hilo-gen")
    @CollectionId(columns = { @Column(name="ADDRESS_ID") }, generator = "hilo-gen", type = @Type(type="long"))
    private Collection<Address> lisOfAddresses = new ArrayList<Address>();

    public Collection<Address> getLisOfAddresses() {
        return lisOfAddresses;
    }
    public void setLisOfAddresses(Collection<Address> lisOfAddresses) {
        this.lisOfAddresses = lisOfAddresses;
    }
    public int getUserId() {
        return userId;
    }
    public void setUserId(int userId) {
        this.userId = userId;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String toString()
    {
        return "[User Name: "+userName+"\n Office Address: "+lisOfAddresses+"]";
    }
}

HibernateTestDemo.java
    package com.sdnext.hibernate.tutorial;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import com.sdnext.hibernate.tutorial.dto.Address;
import com.sdnext.hibernate.tutorial.dto.UserDetails;

public class HibernateTestDemo {
      public static void main(String[] args)
        {
          UserDetails user = new UserDetails();
            //user.setUserId(1);
            user.setUserName("Dinesh Rajput");

            Address address1 = new Address();
            address1.setStreet("First Street");
            address1.setCity("First City");
            address1.setState("First State");
            address1.setPincode("First Pin");

            Address address2 = new Address();
            address2.setStreet("Second Street");
            address2.setCity("Second City");
            address2.setState("Second State");
            address2.setPincode("Second Pin");

            user.getLisOfAddresses().add(address1);
            user.getLisOfAddresses().add(address2);

            SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
            Session session = sessionFactory.openSession();
            session.beginTransaction();
            session.save(user);
            session.getTransaction().commit();
            session.close();
        }
    }

Address.java
 package com.sdnext.hibernate.tutorial.dto;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable //for value object it is not is entity object. Value object means does not have real meaning for self individually.
public class Address
{
    @Column(name="STREET_NAME")
    private String street;
    @Column(name="CITY_NAME")
    private String city;
    @Column(name="STATE_NAME")
    private String state;
    @Column(name="PIN_CODE")
    private String pincode;

    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public String getPincode() {
        return pincode;
    }
    public void setPincode(String pincode) {
        this.pincode = pincode;
    }
    public String toString()
    {
        return " {Street: "+street+" City: "+city+" State: "+state+" Pincode: "+pincode+" }";
    }
}

Hibernate.cfg.xml
 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
         <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
         <property name="connection.url">jdbc:mysql://localhost:3306/hibernateDB</property>
         <property name="connection.username">root</property>
         <property name="connection.password"></property>
         <property name="connection.pool_size">1</property>
         <!-- SQL dialect -->
         <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <!-- Enable Hibernate's automatic session context management -->
          <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache -->
         <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Show all executed SQL to stdout -->
         <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
         <property name="hbm2ddl.auto">update</property>

           <mapping class="com.sdnext.hibernate.tutorial.dto.UserDetails"/>

     </session-factory>
 </hibernate-configuration>

A: As per your entity structure you have
UserDetails which can have multiple Address
but Address entity doesn't have any link to UserDetails
Pls change
@ElementCollection
@JoinTable(name="USER_ADDRESS", joinColumns=@JoinColumn(name="USER_ID"))
@GenericGenerator(strategy="hilo", name = "hilo-gen")
@CollectionId(columns = { @Column(name="ADDRESS_ID") }, generator = "hilo-gen", type = @Type(type="long"))
private Collection<Address> lisOfAddresses = new ArrayList<Address>();

to
@OneToMany(mappedBy="userDetails")
Collection<Address> colAddress;

and in Address entity add
@ManyToOne
@JoinColumn(name="USER_DETAIL_ID")
public UserDetails userDetails;

A: In comment it says too long, so iam posting it here, the following is my pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.technicalkeeda</groupId>
    <artifactId>HibernateExamples</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Spring and Hibernate Examples</name>
    <properties>
        <spring.version>4.3.7.RELEASE</spring.version>
        <spring.security.version>4.2.1.RELEASE</spring.security.version>
        <hibernate.version>4.3.9.Final</hibernate.version>
        <servlet.api.version>3.1.0</servlet.api.version>
        <jsp.api.version>2.2</jsp.api.version>
        <jstl.version>1.2</jstl.version>
        <jdk.version>1.8</jdk.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- <dependency> -->
        <!-- <groupId>mysql</groupId> -->
        <!-- <artifactId>mysql-connector-java</artifactId> -->
        <!-- <version>5.1.9</version> -->
        <!-- </dependency> -->

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>

        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
            <version>3.1</version>
        </dependency>

        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache -->
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>2.10.3</version>
        </dependency>
        <!-- <dependency> -->
        <!-- <groupId>org.slf4j</groupId> -->
        <!-- <artifactId>slf4j-api</artifactId> -->
        <!-- <version>1.7.25</version> -->
        <!-- </dependency> -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- JavaConfig need this library -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
        </dependency>

        <!-- Spring AOP + AspectJ -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

    </dependencies>
</project>


text:
Q: CNTK output for image to image comparison I would like to manipulate the CNTK output to show which images were classified incorrectly vs those that were classified correctly.
Currently I have the standard output of: "Final Results: Minibatch[1-190]: errs = 86.053% * 380" after my test run.
Where would I look in order to create my own output report so that I can see the results of what my network labeled each image?

A: You could run the model through the eval function on the learnt model. Get the labels and compare against the test labels.
There is example in CNTK 201: https://github.com/Microsoft/CNTK/blob/master/Tutorials/CNTK_201B_CIFAR-10_ImageHandsOn.ipynb
In the code below, you can provide the test images and compare the generated target values with the ground truth labels.
import PIL
def eval(pred_op, image_path):
    label_lookup =     print("Top 3 predictions:")
    for i in range(top_count):["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
    image_mean   = 133.0
    image_data   = np.array(PIL.Image.open(image_path), dtype=np.float32)
    image_data  -= image_mean
    image_data   = np.ascontiguousarray(np.transpose(image_data, (2, 0, 1)))

    result       = np.squeeze(pred_op.eval({pred_op.arguments[0]:[image_data]}))

    # Return top 3 results:
    top_count = 3
    result_indices = (-np.array(result)).argsort()[:top_count]

        print("\tLabel: {:10s}, confidence: {:.2f}%".format(label_lookup[result_indices[i]], result[result_indices[i]] * 100))


text:
Q: android crash when open gellary My application crashes when I open a gallery before the method "onActivityResult"
val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
startActivityForResult(galleryIntent, GALLERY)
There are no errors in Logcat.
Android 10, 11. The same problem


text:
Q: Не запускается программа написанная с применением PyQt5 После переустановки системы перестала запускаться программа написанная на Python + PyQt5.
При попытке запуска в PyCharm, появляется окно

Код файла main:
"""# -- coding: utf-8 --"""

import sys

from PyQt5.QtWidgets import QCalendarWidget, QMainWindow

from zvk_gui import Ui_MainWindow
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtWidgets import QCalendarWidget

class MyWindow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        date = self.calendarWidget.selectedDate()
        day_of_week = self.calendarWidget.selectedDate().dayOfWeek()
        print(day_of_week)
        format_date = 'dd MMMM yyyy'
        if day_of_week == 1:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(
                date.addDays(7).toString(format_date) + '\n' +
                date.addDays(6).toString(format_date) + '\n' +
                date.addDays(5).toString(format_date)
                )
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 2:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 3:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 4:
            self.label.setText(
                date.addDays(9).toString(format_date) + '\n' +
                date.addDays(10).toString(format_date) + '\n' +
                date.addDays(11).toString(format_date)
            )
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(
                date.addDays(2).toString(format_date) + '\n' +
                date.addDays(3).toString(format_date) + '\n' +
                date.addDays(4).toString(format_date)
            )
        else:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(
                date.addDays(8).toString(format_date) + '\n' +
                date.addDays(9).toString(format_date) + '\n' +
                date.addDays(10).toString(format_date)
            )
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))
        self.calendarWidget.clicked['QDate'].connect(self.show_date_func)

    def show_date_func(self, date):
        format_date = 'dd MMMM yyyy'
        day_of_week = self.calendarWidget.selectedDate().dayOfWeek()
        print(day_of_week)
        if day_of_week == 1:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(
                date.addDays(7).toString(format_date) + '\n' +
                date.addDays(6).toString(format_date) + '\n' +
                date.addDays(5).toString(format_date)
            )
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 2:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 3:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))
        elif day_of_week == 4:
            self.label.setText(
                date.addDays(9).toString(format_date) + '\n' +
                date.addDays(10).toString(format_date) + '\n' +
                date.addDays(11).toString(format_date)
            )
            self.label_6.setText(date.addDays(8).toString(format_date))
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(
                date.addDays(2).toString(format_date) + '\n' +
                date.addDays(3).toString(format_date) + '\n' +
                date.addDays(4).toString(format_date)
            )
        else:
            self.label.setText(date.addDays(9).toString(format_date))
            self.label_6.setText(
                date.addDays(8).toString(format_date) + '\n' +
                date.addDays(9).toString(format_date) + '\n' +
                date.addDays(10).toString(format_date)
            )
            self.label_7.setText(date.addDays(7).toString(format_date))
            self.label_8.setText(date.addDays(2).toString(format_date))

    if __name__ == "__main__":
        app = QtWidgets.QApplication([])
        application = MyWindow()
        application.show()
        sys.exit(app.exec())

На ноутбуке, где все по старому все запускается.
Поискал таблетку в интернете. Прочитал, что надо папку platforms создать в папке с программой и туда скопировать файл qwindows.dll - не помогло. Что еще можно сделать?

A: Попробуйте запускать так:
if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    ex = MyWindow()
    ex.show()
    app.exec_()


text:
Q: Do we need to write code to sort a gridView? I've read some articles online where they say you just need to set the "AllowSorting" property to true, while there are others that have code written in the Sorting event. So my question is- To sort a gridviwe in ASP.NET, do we need to write any code in the sorting event or does setting "AllowSorting" to true enable the sorting?
Also, will anything change if I set my datasource programmatically as opposed to setting it directly as a SqlDataSource in the .aspx file itself?

A: As requested, my comment as answer:
That depends on what you're using as DataSource. If you use a declarative datasource control like SqlDataSource or ObjectDataSource you're done, otherwise you need to write the code yourself.

A: I've recently accomplished what you're asking by using something along the following lines:
DataTable dt = YourOwnWayOfCreatingADataTable();
dt.DefaultView.Sort = "ColumnNameToSort"; // You can append ASC or DESC to this
gridView1.DataSource = dt;
gridView1.DataBind();

I hope that helps you out.  Obviously, this is sorting the results before you display them, but you can sort again by changing the .Sort property and rebinding.  If you need something more specific or multiple columns, this may not work.


text:
Q: Upgrade apache 2.4.6 to 2.4.12 on CentOS We have following server details and we need to upgrade apache 2.4.6 to apache 2.4.12
OS: CentOS 6
Apache : 2.4.6
PHP : 5.5

I know how to install 2.4.12 from scratch but i just want to upgrade current apache to 2.4.12 because i don't want to loss php settings and other settings of current apache.

A: If you simply upgrade using rpm -U, the binaries will be upgraded, but the configuration files will remain the same. See https://stackoverflow.com/questions/14511334/rpm-upgrade-handling-of-config-files


text:
Q: How to get the inserted path of a file in django? I have written a form which contains a filefield.
Now in my views I want to access the path of file which i inserted using this field....Is it possible and is yes what is the method, which can be used for the same??

A: There are three (main) properties that File fields have in django:
.name = the file name
.path = file's location on the disk
.url = the URL to that file, which a browser can use. Use this when you want to provide a link to a file in the template.

A: In Django files are represented by the File class. This class has a field named name. The documentation for this field says:

The name of file including the relative path from MEDIA_ROOT.

Example
Your MEDIA_ROOT is media and the name of your file is my-test-file.
Then myfile.name would return media/my-test-file.
Feel free to ask further questions.


text:
Q: How to return values from a react component to the calling module? I have the following code for selecting the day, or days, of the week that certain specials will be available.  I will be reusing this code throughout the app.  The issue that I am having is that I'm not able to determine how to return the true/false values to the calling module.
A cut down version of the DOW component:
import React from "react";

class DOW extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      daily: true,
      sun: false,
      mon: false,
      tue: false,
      wed: false,
      thu: false,
      fri: false,
      sat: false
    };

    this.handleInputChange = this.handleInputChange.bind(this);
  }

  handleInputChange(event) {
    const target = event.target;
    const value = target.type === 'checkbox' ? target.checked : target.value;
    const name = target.name;

    this.setState({
      [name]: value
    });
  }

  render() {
    return (

          Daily:
          <input
            name="daily"
            type="checkbox"
            checked={this.state.daily}
            onChange={this.handleInputChange} />

          Sun:
          <input
            name="sun"
            type="checkbox"
            checked={this.state.sun}
            onChange={this.handleInputChange} />

          Mon:
          <input
            name="mon"
            type="checkbox"
            checked={this.state.mon}
            onChange={this.handleInputChange} />

 ...

          Sat:
          <input
            name="sat"
            type="checkbox"
            checked={this.state.sat}
            onChange={this.handleInputChange} />

    );
  }
}

export default DOW;

=======
Snip of the calling component:
import React, { Component } from "react";
import Nav from "../../components/Nav";
import Location from "../../components/Location";
import DeleteBtn from "../../components/DeleteBtn";
import Jumbotron from "../../components/Jumbotron";
import DOW from "../../components/DOW";
import API from "../../utils/API";
import { Link } from "react-router-dom";
import { Col, Row, Container } from "../../components/Grid";
import { List, ListItem } from "../../components/List";
import { Input, TextArea, FormBtn } from "../../components/Form";

class FoodSpecials extends Component {
  state = {
    foodSpecial: [],
    special: "",
    price: "",
    details: ""
  };

  componentDidMount() {
    this.loadfoodSpecial();
  }

  handleInputChange = event => {
    const { name, value } = event.target;
    this.setState({
      [name]: value
    });
  };
  handleFormSubmit = event => {
    event.preventDefault();
    if (this.state.special && this.state.price) {
      console.log(this.state.special, this.state.price, this.state.daily, this.state.mon);
    }
  };

  render() {
    return (

      <Container fluid>
...
              <Col size="md-12">

                  Day of week:

                <DOW />
              </Col>
...
          </Col>
        </Row>
      </Container>
    );
  }
}

export default FoodSpecials;

I have looked around for an NPM that will display just the days of the week with check boxes, but have been unable to locate one which is why I am attempting this code.
Thanks in advance.

A: In your FoodSpecials class, add a function:
getDOWs = days => {
  console.log(days.wed); //etc...
}

Then pass this function to the child component:
<DOW onInputChange={this.getDOWs} />

And then finally call your function from the DOW class:
handleInputChange(event) {
  const target = event.target;
  const value = target.type === 'checkbox' ? target.checked : target.value;
  const name = target.name;

  this.setState({
    [name]: value
  });

  this.props.onInputChange(this.state); //This is where you call the function.
}


text:
Q: I want to use scrollTo I work on a project in React Native and I would like to set my ScrollView position. So I search and I found we should do this with scrollTo but I have an error:

TypeError: Cannot read property 'scrollTo' of undefined

My code:
export default class Index_calendar extends Component {
 componentDidMount() {
   const _scrollView = this.scrollView;
   _scrollView.scrollTo({x: 100});
 }

 render() {
   return (
     <ScrollView ref={scrollView => this.scrollView = scrollView}>
       {this.renderCalandar()}
     </ScrollView>
   );
 }
}

A: You can use the InteractionManager to solve this issue.
For instance
InteractionManager.runAfterInteractions(() => this.scroll.current.scrollTo({ x }));

A: Why not just scrollTo in the render method?
export default class Index_calendar extends Component {
constructor(props) {
   super(props);
   this.scrollView = null;
}
render() {
   return (
   <ScrollView ref={scrollView => {
       //Sometimes ref can be null so we check it.
       if(scrollView !== null && this.scrollView !== scrollView){
           this.scrollView = scrollView
           scrollView.scrollTo({x: 100});
       }}>
       {this.renderCalandar()}
  </ScrollView>
 );
}
}

A: I found the solution ! we need to use setTimeout like that :
setTimeout(() => {
    this.scrollView.scrollTo({x: 100});
}, 1);

A: You seem to make correct reference. But I suggest to init the reference and make it less error prone:
export default class Index_calendar extends Component {
 constructor(props) {
   super(props);
   this.scrollView = null;
 }

 componentDidMount() {
   const _scrollView = this.scrollView;

   if (_scrollView) {
     _scrollView.scrollTo({x: 100});
   }
 }

A: InteractionManager.runAfterInteractions(() => {
    this.scrollRef.scrollTo({
      x: 0,
      y: 0,
      animated: true,
    });
  });

This worked for me to reset the scroll to top


text:
Q: Use SVN Revision to label build in CCNET I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.
I would like to use the latest revision number to generate AssemblyInfo.cs while compiling.
How can I retrieve the latest revision from subversion and use the value in CCNET?
Edit: I'm not using NAnt - only MSBuild.

A: CruiseControl.Net 1.4.4 has now an Assembly Version Labeller, which generates version numbers compatible with .Net assembly properties.
In my project I have it configured as:
<labeller type="assemblyVersionLabeller" incrementOnFailure="true" major="1" minor="2"/>

(Caveat: assemblyVersionLabeller won't start generating svn revision based labels until an actual commit-triggered build occurs.)
and then consume this from my MSBuild projects with MSBuildCommunityTasks.AssemblyInfo :
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name="BeforeBuild">
  <AssemblyInfo Condition="'$(CCNetLabel)' != ''" CodeLanguage="CS" OutputFile="Properties\AssemblyInfo.cs"
  AssemblyTitle="MyTitle" AssemblyCompany="MyCompany" AssemblyProduct="MyProduct"
  AssemblyCopyright="Copyright ©  2009" ComVisible="false" Guid="some-random-guid"
  AssemblyVersion="$(CCNetLabel)" AssemblyFileVersion="$(CCNetLabel)"/>
</Target>

For sake of completness, it's just as easy for projects using NAnt instead of MSBuild:
<target name="setversion" description="Sets the version number to CruiseControl.Net label.">

    <foreach item="File" property="filename">
        <in>
            <items basedir="..">
                <include name="**\AssemblyInfo.cs"></include>
            </items>
        </in>
        <do>
            <setversion-task />
        </do>
    </foreach>
</target>

A: I found this project on google code. This is CCNET plugin to generate the label in CCNET.
The DLL is tested with CCNET 1.3 but it works with CCNET 1.4 for me. I'm successfully using this plugin to label my build.
Now onto passing it to MSBuild...

A: If you prefer doing it on the MSBuild side over the CCNet config, looks like the MSBuild Community Tasks extension's SvnVersion task might do the trick.

A: I have written a NAnt build file that handles parsing SVN information and creating properties. I then use those property values for a variety of build tasks, including setting the label on the build. I use this target combined with the SVN Revision Labeller mentioned by lubos hasko with great results.
<target name="svninfo" description="get the svn checkout information">
    <property name="svn.infotempfile" value="${build.directory}\svninfo.txt" />
    <exec program="${svn.executable}" output="${svn.infotempfile}">
        <arg value="info" />
    </exec>
    <loadfile file="${svn.infotempfile}" property="svn.info" />
    <delete file="${svn.infotempfile}" />

    <property name="match" value="" />

    <regex pattern="URL: (?'match'.*)" input="${svn.info}" />
    <property name="svn.info.url" value="${match}"/>

    <regex pattern="Repository Root: (?'match'.*)" input="${svn.info}" />
    <property name="svn.info.repositoryroot" value="${match}"/>

    <regex pattern="Revision: (?'match'\d+)" input="${svn.info}" />
    <property name="svn.info.revision" value="${match}"/>

    <regex pattern="Last Changed Author: (?'match'\w+)" input="${svn.info}" />
    <property name="svn.info.lastchangedauthor" value="${match}"/>

    <echo message="URL: ${svn.info.url}" />
    <echo message="Repository Root: ${svn.info.repositoryroot}" />
    <echo message="Revision: ${svn.info.revision}" />
    <echo message="Last Changed Author: ${svn.info.lastchangedauthor}" />
</target>

A: I am currently "manually" doing it through a prebuild-exec Task, using my cmdnetsvnrev tool, but if someone knows a better ccnet-integrated way of doing it, i'd be happy to hear :-)

A:
Customizing csproj files to autogenerate AssemblyInfo.cs
http://www.codeproject.com/KB/dotnet/Customizing_csproj_files.aspx
Every time we create a new C# project,
  Visual Studio puts there the
  AssemblyInfo.cs file for us. The file
  defines the assembly meta-data like
  its version, configuration, or
  producer.

Found the above technique to auto-gen AssemblyInfo.cs using MSBuild. Will post sample shortly.

A: I'm not sure if this work with CCNET or not, but I've created an SVN version plug-in for the Build Version Increment project on CodePlex.  This tool is pretty flexible and can be set to automatically create a version number for you using the svn revision.  It doesn't require writing any code or editing xml, so yay!
I hope this is helps!

A: My approach is to use the aforementioned plugin for ccnet and a nant echo task to generate a VersionInfo.cs file containing nothing but the version attributes. I only have to include the VersionInfo.cs file into the build
The echo task simply outputs the string I give it to a file.
If there is a similar MSBuild task, you can use the same approach. Here's the small nant task I use:
<target name="version" description="outputs version number to VersionInfo.cs">
  <echo file="${projectdir}/Properties/VersionInfo.cs">
    [assembly: System.Reflection.AssemblyVersion("$(CCNetLabel)")]
    [assembly: System.Reflection.AssemblyFileVersion("$(CCNetLabel)")]
  </echo>
</target>

Try this:
<ItemGroup>
    <VersionInfoFile Include="VersionInfo.cs"/>
    <VersionAttributes>
        [assembly: System.Reflection.AssemblyVersion("${CCNetLabel}")]
        [assembly: System.Reflection.AssemblyFileVersion("${CCNetLabel}")]
    </VersionAttributes>
</ItemGroup>
<Target Name="WriteToFile">
    <WriteLinesToFile
        File="@(VersionInfoFile)"
        Lines="@(VersionAttributes)"
        Overwrite="true"/>
</Target>

Please note that I'm not very intimate with MSBuild, so my script will probably not work out-of-the-box and need corrections...

A: Based on skolimas solution I updated the NAnt script to also update the AssemblyFileVersion. Thanks to skolima for the code!
<target name="setversion" description="Sets the version number to current label.">

        <foreach item="File" property="filename">
            <in>
                    <items basedir="${srcDir}">
                            <include name="**\AssemblyInfo.cs"></include>
                    </items>
            </in>
            <do>
                    <setversion-task />
            </do>
        </foreach>
    </target>

A: No idea where I found this.  But I found this on the internet "somewhere".
This updates all the AssemblyInfo.cs files before the build takes place.
Works like a charm.  All my exe's and dll's show up as 1.2.3.333 (If "333" were the SVN revision at the time.) (And the original version in the AssemblyInfo.cs file was listed as "1.2.3.0")

$(ProjectDir)   (Where my .sln file resides)
$(SVNToolPath)  (points to svn.exe)
are my custom variables, their declarations/definitions are not defined below.

http://msbuildtasks.tigris.org/
and/or
https://github.com/loresoft/msbuildtasks
has the ( FileUpdate and SvnVersion ) tasks.

  <Target Name="SubVersionBeforeBuildVersionTagItUp">

    <ItemGroup>
      <AssemblyInfoFiles Include="$(ProjectDir)\**\*AssemblyInfo.cs" />
    </ItemGroup>

    <SvnVersion LocalPath="$(MSBuildProjectDirectory)" ToolPath="$(SVNToolPath)">
      <Output TaskParameter="Revision" PropertyName="MySubVersionRevision" />
    </SvnVersion>

    <FileUpdate Files="@(AssemblyInfoFiles)"
            Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)"
            ReplacementText="$1.$2.$3.$(MySubVersionRevision)" />
  </Target>

EDIT --------------------------------------------------
The above may start failing after your SVN revision number reaches 65534 or higher.
See:
Turn off warning CS1607
Here is the workaround.
<FileUpdate Files="@(AssemblyInfoFiles)"
Regex="AssemblyFileVersion\("(\d+)\.(\d+)\.(\d+)\.(\d+)"
ReplacementText="AssemblyFileVersion("$1.$2.$3.$(SubVersionRevision)" />

The result of this should be:
In Windows/Explorer//File/Properties…….
Assembly Version will be 1.0.0.0.
File Version will be 1.0.0.333 if 333 is the SVN revision.

A: You have basically two options. Either you write a simple script that will start and parse output from
svn.exe info --revision HEAD
to obtain revision number (then generating AssemblyInfo.cs is pretty much straight forward) or just use plugin for CCNET. Here it is:

SVN Revision Labeller is a plugin for
  CruiseControl.NET that allows you to
  generate CruiseControl labels for your
  builds, based upon the revision number
  of your Subversion working copy. This
  can be customised with a prefix and/or
  major/minor version numbers.
http://code.google.com/p/svnrevisionlabeller/

I prefer the first option because it's only roughly 20 lines of code:
using System;
using System.Diagnostics;

namespace SvnRevisionNumberParserSample
{
    class Program
    {
        static void Main()
        {
            Process p = Process.Start(new ProcessStartInfo()
                {
                    FileName = @"C:\Program Files\SlikSvn\bin\svn.exe", // path to your svn.exe
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    Arguments = "info --revision HEAD",
                    WorkingDirectory = @"C:\MyProject" // path to your svn working copy
                });

            // command "svn.exe info --revision HEAD" will produce a few lines of output
            p.WaitForExit();

            // our line starts with "Revision: "
            while (!p.StandardOutput.EndOfStream)
            {
                string line = p.StandardOutput.ReadLine();
                if (line.StartsWith("Revision: "))
                {
                    string revision = line.Substring("Revision: ".Length);
                    Console.WriteLine(revision); // show revision number on screen
                    break;
                }
            }

            Console.Read();
        }
    }
}

A: Be careful.  The structure used for build numbers is only a short so you have a ceiling on how high your revision can go.
In our case, we've already exceeded the limit.
If you attempt to put in the build number 99.99.99.599999, the file version property will actually come out as 99.99.99.10175.


text:
Q: Randomly Select Data from A Large Text File I am working with 8GB RAM in 64 bit Windows7.
I have a text file of 30GB with one column of numeric data.
I have to randomly select 5% of its lines randomly.
I started as follows:
fi = "data.txt"
lines = fi.read().splitlines()

Memory Error...

Do you have any ideas, guys?

A: If "about 5 %" is good enough for you, you could read the file line by line, and give each line a 5 % chance to be included in your list:
import random
result = []
with open("data.txt") as f:
    for line in f:
        if random.random() < 0.05:
            result.append(line)


text:
Q: Express: unable to set cookie I use the below to set a cookie using express.
app.use(require('cookie-parser')());
app.get('/a', function (req, res) {
    console.log(req.cookies);
    res.cookie('aaa', 'bbb');
    res.send('something');
});

app.post('/b', function (req, res) {
    console.log(req.cookies);
    res.cookie('ccc', 'ddd');
    res.send('something');
})

I can get cookie when get 'a', but can not when post 'b'


text:
Q: How to use secondary indexes for a "contains" query Rethinkdb docs has this example to improve getAll/contains queries with a secondary index:
// Create the index
r.table("users").indexCreate("userEquipment", function(user) {
    return user("equipment").map(function(equipment) {
        return [ user("id"), equipment ];
    });
}, {multi: true}).run(conn, callback);

// Query equivalent to:
// r.table("users").getAll(1).filter(function (user) {
//     return user("equipment").contains("tent");
// });
r.table("users").getAll([1, "tent"], {index: "userEquipment"}).distinct().run(conn, callback);

My questions is if there's a way to do the same but for querying with multiple tags. What would be the equivalent to make this query possible with a secondary index?
r.table("users").getAll(1).filter(function (user) {
    return user("equipment").contains("tent", "tent2");
});

A: Probably we can do this
r.table("users").getAll([1, "tent"]).filter(function (user) {
    return user("equipment").contains("tent2");
});

So build a multi index as you did, and try to getAll first, so that part is efficient with index, then filter to continue ensure that equipment contains array we want.


text:
Q: Conditional class probabilities in YOLOv1 In YOLO v1, authors defines conditional class probabilities (P(Class_i/Object))
I don't understand that authors can define the head output to conditional class probabilities. When the model finishes training, can it be concluded that the value of the output is a probability value?


text:
Q: Locked out of SSIS Package I tried to access one of my SSIS packages only to be presented with the error message (Text in square brackets is not literal):

Error 1:    Error loading Package.dtsx: Failed to decrypt a package that
    is encrypted with a user key. You may not be the user who encrypted
    this package, or you are not using the same machine that was used to
    save the package. [path to file].[Package].dtsx
Error:  2   Error loading 'Package.dtsx' : Failed to remove package
  protection with error 0x8009000B "Key not valid for use in specified
  state.". This occurs in the CPackage::LoadFromXML method.[path to file].[Package].dtsx

It also prevents me entering the package completely
Screen When opening package:

A: The problem is that your package was encrypted by a user.  This could have been you are you loging in to the pc with a diffrent login or from a diffrent machine?   Your not going to be able to open it until you figure out who encrypted it or from what account it was encrypted from.


text:
Q: Java email received from standalone class, but not when executed within a servlet Using Java, I can send email from a toy standalone class (with hard-coded data) perfectly fine, and I receive the email within seconds.
When the exact same code is called in the context of a servlet, however, the code executes without failure, but I don't actually receive the email.
How could that be? Is there something special about the servlet environment?
I'm running Tomcat 6, JRE 1.5.
Here is the code (I have edited my data):
public void sendEmail(String aSubject, String aBody){
Properties props = new Properties();
props.put("mail.host", "smtp.blah.ca");
props.put("mail.from", "from-blah@blah.ca");
Session session = Session.getDefaultInstance(props, null /*no authenticator*/);
System.out.println("JRE" + System.getProperty("java.version"));
System.out.println(session.getProperties());
MimeMessage message = new MimeMessage(session);
try {
  message.addRecipient(
    Message.RecipientType.TO, new InternetAddress("to-blah@blah.com")
  );
  message.setSubject(aSubject);
  message.setText(aBody);
  Transport.send(message);
}
catch (MessagingException ex){
  System.err.println("Cannot send email. " + ex);
}

}
Edit: the email is recieved when the content (email body) is small. When the content is large, it's not recieved.

A: This is not java-related at all.
I tested a large email with a normal email client. The same behavior was seen: the email is sent fine, but I'm not receiving it in a timely manner, for some reason. (I haven't seen this kind of behavior before, but there it is...)


text:
Q: Core Data Inheritance and Relationships I´m a little confused about inheritance and relationships in core data, and I was hopping someone could drive to the right path. In my app i have created 3 entities, and none of them have (and are not suppose to have) common properties, but there´s gonna be a save and a load button for all the work that the user does.  From my understanding I need to "wrap" all the entities "work" into an object which will be used to save and load, and my question is, do I need to create relationships between the entities?  Because I have to relate them somehow and this is what make sense to me.  Is my logic correct?
I'm implementing a budget calculator, and for the purpose of everyone understand what my issue is, I´m going to give an practical example and please correct me if my logic is incorrect:
Let´s just say you are a fruit seller, and because of that it´s normal to have a database of clients and also a fruit database with the kinds of fruit you sell. From my understanding I find two entities here:
Client with properties named: name, address, phone, email, etc.
Stock with properties named: name, weight, stock, cost, supplier, etc.
TheBudget with properties named: name, amount, type, cost, delivery, etc.
I didn´t put all the properties because I think you get the point.  I mean as you can see, there´s only two properties I could inherit; the rest is different. So, if I was doing a budget for a client, I can have as many clients I want and also the amount of stock, but what about the actual budget?
I´m sorry if my explanation was not very clear, but if it was..what kind of relationships should I be creating?  I think Client and TheBudget have a connection. What do you advise me?

A: That's not entirely correct, but some parts are on the right track. I've broken your question down into three parts: relationships, inheritance and the Managed Object Context to hopefully help you understand each part separately:
Relationships
Relationships are usually used to indicate that one entity can 'belong' to another (i.e. an employee can belong to a company). You can setup multiple one-to-many relationships (i.e. an employee belongs to a company and a boss) and you can setup the inverse relationships (which is better described with the word 'owns' or 'has', such as 'one company has many employees).
There are many even more complicated relationships depending on your needs and a whole set of delete rules that you can tell the system to follow when an entity in a relationship is deleted. When first starting out I found it easiest to stick with one-to-one and one-to-many relationships like I've described above.
Inheritance
Inheritance is best described as a sort of base template that is used for other, more specific entities. You are correct in stating that you could use inheritance as a sort of protocol to define some basic attributes that are common across a number of entities. A good example of this would be having a base class 'Employee' with attributes 'name', 'address' and 'start date'. You could then create other entities that inherit from this Employee entity, such as 'Marketing Rep', 'HR', 'Sales Rep', etc. which all have the common attributes 'name', 'address' and 'start date' without creating those attributes on each individual entity. Then, if you wanted to update your model and add, delete or modify a common attribute, you could do so on the parent entity and all of its children will inherit those changes automatically.
Managed Object Context (i.e. saving)
Now, onto the other part of your question/statement: wrapping all of your entities into an object which will be used to save and load. You do not need to create this object, core data uses the NSManagedObjectContext (MOC for short) specifically for this purpose. The MOC is tasked with keeping track of objects you create, delete and modify. In order to save your changes, you simply call the save: method on your MOC.
If you post your entities and what they do, I might be able to help make suggestions on ways to set it up in core data. You want to do your best to setup as robust a core data model as you can during the initial development process. The OS needs to be able to 'upgrade' the backing store to incorporate any changes you've made between your core data model revisions. If you do a poor job of setting up your core data model initially and release your code that way, it can be very difficult to try and make a complicated model update when the app is in the wild (as you've probably guessed, this is advice born out of painful experience :)


text:
Q: How can I read the directory contents on a remote server with PHP? I have a url, http://www.mysite.com/images and the images directory allows Directory Listings. How can I get the files in that directory with PHP?

A: Here is an example if you need to read the images over HTTP and the server is Apache:
<?php
$url = 'http://www.mysite.com/images';

$html = file_get_contents($url);

$count = preg_match_all('/[^<]*<\/a><\/td>/i', $html, $files);

for ($i = 0; $i < $count; ++$i) {
    echo "File: " . $files[1][$i] . "
\n";
}

?>

If it is the same server you are running your PHP on, you can use opendir() and readdir().

A: I know this question is very old, but just to get me into the swing of using this forum I thought I'd add my view. I found the following happened (referring to the original answer to use regex.
My html turned out to be formatted like this:

bricks.php

So I ended up using this:
$count = preg_match_all('/[^<]*<\/a>/i', $html, $files);

I wanted to use the following (which tested ok in the online generator testers, but it failed to find a match in the php code):
$count = preg_match_all('/(?:[\w\n\f])[^<]*<\/a>(?:[\w\n\f])<\/td>/i', $html, $files);

A: You can use regex to take urls from listing. (No you can't use DOMDOCUMENT as it's not a valid HTML)

A: You need FTP access (an FTP account to that URL).  If you have this, then you can log into the server with FTP and use:
opendir()

and
readdir()

to accomplish what you are trying to do.

If you do not have access to the server, you will need to scrape the site's HTML, and it gets more complex -> so I can let somebody else tackle that one... but google search "scrape html site" or something similar, there are plenty of pre-written functions that can do similar things.
i.e.
http://www.thefutureoftheweb.com/blog/web-scrape-with-php-tutorial
http://www.bradino.com/php/screen-scraping/

A: // tho a late-comer, this one seems a bit more reader-friendly if not faster
$url = 'http://whatevasite/images/';
$no_html = strip_tags(file_get_contents($url));
$arr = explode('Parent Directory', $no_html);
$files = trim($arr[1]);
$files = explode("\n ", $files);
var_dump($files);


text:
Q: Linq query with many to many relations using entity framework I have two tables: tbA and tbB .Between them I have a relationship n to n, so a table tbAB was generated in the database. I am using an Entity Framework Database First, then when I mapped these tables , it does not generate a specific entity for tbAB. Thus , I'm not seeing how I can create a query relating the two tables if I can't call directly thetbAB.
What I want to do in SQL would be as follows :
 SELECT *
 FROM tbA
 INNER JOIN tbAB
 ON tbAB.idA = tbA.idA
 INNER JOIN tbB
 ON tbB.idB = tbAB.idB

That's what I'm trying to do with Linq:
  var table = (from l in db.tbA
                                            join k in db.tbB on l.? equals k.?
                                            where ?.IDCONCESSAO == objectTbB.IDCONCESSAO
                                            select l).ToList();

The question is how can I do this in a Linq expression ?
Thanks in advance.

A: Following the model proposed by @Michal, you could do this:
var query= from a in db.TableAs
           from b in a.TableBs
           where b.Id==10
           select new{A_Id=a.Id,a.Name, B_Id=b.Id,b.Price,...};

In the select you can choose the properties you need from both entities(I also select a Name from TableA and a Price from TableBto help you understand better this example).From each direction of the relationship, you don't ever interact with the junction table, you just follow a relationship from each direction as if it were a one-to-many. The query that I show above will be translated in a sql query where the joins between the tables will be made this way:
{SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Name] AS [Name],
[Join1].[Id] AS [Id1],
[Join1].[Price] AS [Price]
FROM  [dbo].[TableAs] AS [Extent1]
INNER JOIN  (SELECT [Extent2].[TableA_Id] AS [TableA_Id], [Extent3].[Id] AS [Id], [Extent3].[Price] AS [Price]
    FROM  [dbo].[TableBTableAs] AS [Extent2]
    INNER JOIN [dbo].[TableBs] AS [Extent3] ON [Extent3].[Id] = [Extent2].[TableB_Id] ) AS [Join1] ON [Extent1].[Id] = [Join1].[TableA_Id]
WHERE 10 = [Join1].[Id]}

A:     public void Test()
    {
        var db = new DbContext();

        // This will automatically do you inner join for you.
        db.TableAs.Include(a => a.TableBs);
    }

Context:
    public class DbContext
    {
        public IDbSet<TableA> TableAs { get; set; }
        public IDbSet<TableB> TableBs { get; set; }
    }

Models:
    public class TableA
    {
        public int Id { get; set; }
        public virtual List<TableB> TableBs { get; set; }
    }
    public class TableB
    {
        public int Id { get; set; }

        public virtual List<TableA> TableAs { get; set; }
    }

A:   var table = from a in db.tbA
              join ab in db.tbAB on a.idA  equals ab.idA
              join b in db.tbB on ab.idB  equals b.idB
              where a.Anything = 10
              select a;

  var results = table.ToList();


text:
Q: Passing model to javascript through view bag coming empty I am passing my class object after being serialized into json then accessing it into javascript which is coming blank.
my class
public class PMICheckListWrapper
        {
            public PMIMachine Machine { get; set; }
            public List<PMICheckListResponse> CheckResponseList { get; set; }
        }

controller Code:
public ActionResult GetViewEditData(int machineID)
        {
          var result = Json(PMIComputerModel.GetViewEditDetails(machineID), JsonRequestBehavior.AllowGet);
          ViewBag.MachineData = result.Data;
          return View("PMIComputerList");
        }

JavaScript where i am accessing it.
$(function(){
  if('@ViewBag.MachineData' != null)
        {
         var data = '@ViewBag.MachineData';
         alert(data);//this is coming empty
         alert(jQuery.parseJSON(data)); // this is coming null
        }

});

A: Try using
var data = @Html.Raw(@ViewBag.MachineData);

A: How sure are you that GetViewEditDetails is actually getting something? Try:
public ActionResult GetViewEditData(int machineID)
    {
      var result = new JsonResult();
      var data = PMIComputerModel.GetViewEditDetails(machineID);
      if(data != null){
            result.Data = data;
      }
      else {
         // give some kind of feedback that there is no result
      }
      ViewBag.MachineData = result;
      return View("PMIComputerList");
    }


text:
Q: Probability of completing N events I'd like to calculate the probability that at least N independent events out of a set of M events complete successfully.  Each event Ei has a probability of success of Pi.
For example, if there are four independent events each with a unique probability of success:
E1: P1
E2: P2
E3: P3
E4: P4
How do I calculate that probability that at least 1 event will be successful?  At least 2 events?  3 events?  The order of successes does not matter.  Thanks for any help!

The best answer I could find is here:
http://mathbits.com/MathBits/TISection/Statistics2/binomialAtMost.htm
Unfortunately for me, it doesn't look like there's an easy way to get rid of the looping (summation) to solve the problem.

A: The probability that no event occurs is$$\prod_i (1-p_i)$$hence the probability that at least one event occurs is$$1-\prod_i (1-p_i)$$The probability that exactly one event occurs is$$\sum_{j=1}^m p_j\prod_{i\ne j}(1-p_i)$$and so on. The probability of exactly $k$ events is thus
$$\sum_{1\le i_1<i_2<\cdots<i_k\le m} \prod_{j=1}^k p_{i_j} \prod_{j=k+1}^m (1-p_{i_j})$$where the second product is on the indices that are not in the first group $\{i_1,\ldots,i_k\}$


text:
Q: Code Igniter OR AND multiple Where clause Using CodeIgniter, I'd like to do a multiple search using OR in the Where clause.. something like this:
$sql = "select employee.first_name, employee.last_name, employee.phone_number, job.title,
FROM employee, job
WHERE employee.jobID = job.jobID
AND employee.deleted = 0
AND (employee.first_name = $searchPara OR employee.last_name= $searchPara)
ORDER BY employee.last_name";
return $this->db->query($sql, $searchPara);

the query above gives an error message, and also I am not sure how to include the search on the job.title = $searchPara... in the same SQL statement
Can someone please help me with this?
Thanks heaps

A: Error in SQL because of comma after job.title
$sql = "select employee.first_name, employee.last_name, employee.phone_number, job.title
    FROM employee, job
    WHERE employee.jobID = job.jobID
    AND employee.deleted = 0
    AND (employee.first_name = ? OR employee.last_name = ?)
    ORDER BY employee.last_name";
return $this->db->query($sql, array($searchPara, $searchPara));


text:
Q: Make Django pass int value request param as int rather than unicode I remember coming across such a question some time ago, but couldn't find a link n the internet, so asking this question possibly for the second time. It is very iriitating that Django transforms int value into unicode having to transform the value to integer on every occasion. Is there any native syntax to stop Django doing this ?
url(r'some_url/(?P<some_param>\d+)/$', some_view, name = 'some_url')

def some_view(request, some_param):
        a = int(some_param) # Having to write this surplus int is very very irritating

JS
$.get('/some_url/6545/', function(response){...


text:
Q: QML ShaderEffectSource does not refresh on childrens visibiliy change When using the ShaderEffectSource as preview for another qml element not yet visible, the rendering is not refreshed when the sourceItem's childs are set visible.
In the example press the toggle Button and the text does not appear in the preview until the sourceItem is made visible. On the other hand setting the sourceItems child invisible instantly refreshes the ShaderEffectSource.
Small working example main.qml:
import QtQuick 2.5
import QtQuick.Extras 1.4

Item {
    id: main
    visible: true
    width: 800
    height: 600
    Rectangle {
        id: preview
        width: 533
        height: 400
        // Preview render
        ShaderEffectSource {
            anchors.fill: parent
            anchors.margins: 25
            sourceItem: liveView
        }
        // Click on preview
        MouseArea {
            anchors.fill: parent
            onClicked: {
                liveView.visible = true;
                preview.visible = false;
            }
        }
    }
    Rectangle {
        id: liveView
        visible: false
        anchors.fill: parent
        border.width: 2
        border.color: "black"
        Text {
            id: liveText
            visible: false
            color: "black"
            text: "Live"
            width: parent.width
            font.pointSize: 60
        }
        MouseArea {
            width: parent.width
            height: parent.height
            onClicked: {
                liveView.visible = false;
                preview.visible = true;
            }
        }
    }
    ToggleButton {
        anchors.bottom: parent.bottom
        anchors.right: parent.right
        text: "liveText visible"
        onClicked: {liveText.visible = checked;}
    }
}

I filed this under https://bugreports.qt.io/browse/QTBUG-66301 but I hope someone can assist me on developing a workaround or tell me if I'm using it completely wrong.
Edit 1: A first workaround is to never make the sourceItem invisible and hide it with a low z behind other objects.


text:
Q: AreYouSure jquery plugin does not show error message if partial postback happens We have a page with all the controls inside a Update Panel. If any data changes inside the form and user tries to leave the page without saving then he gets a warning message.
There is a DropDownList with AutoPostBack=true inside UpdatePanel.
Whenever selection changes on this dropdown, areyousure does not work.
Code
$('#form1').areyousure();

How could this be handled?

A: You should have below script at the end of page,
$('#form1').areyousure();

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args) {
    $('#form1').areyousure();
}


text:
Q: Keep session open from Android app to website in a webview I have an android app that I am creating and I have a log in page as the first intent. This will then open a tabholder and bring the user to the first tab which brings up a webview. The website is a big part of the app and requires the user to be logged in. The website and the app use the same sign in script that is run off the same server so the login information is the same. I want to use the session that was created when logging into the app inside of the webview so that when the user goes to the webview they are still logged in. I tried using shared preferences to re-login on the webview but that isn't working. Im able to pass the shared preferences to it but it still tells me i'm not logged in on the website. Any help on this topic would be greatly appreciated.
Here is my code:
Connection class to create defaultHttpRequest that I will pass between all classes.
import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;

public class Connection1 {

    public static HttpClient httpclient = new DefaultHttpClient();
    private static HttpPost httpPost;

    public Connection1(){
    }

    public HttpPost getHttpPost(){
        return httpPost;
    }
    public HttpResponse getResponse() throws ClientProtocolException, IOException{
        return httpclient.execute(httpPost);
    }
    public void setEntity(UrlEncodedFormEntity entity){
        httpPost.setEntity(entity);
    }
    public void setHttpPost(String script){
        httpPost = new HttpPost(script);
    }
}

Webapp class that will display the website pages:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class WebApp extends Activity {

    public static final String PREFS_NAME = "myPrefsFile";
    private static final String PREFS_USERNAME = "username";
    private static final String PREFS_PASSWORD = "password";

    String username = "";
    String password = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        setContentView(R.layout.webapp);
        SharedPreferences pref = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
        username = pref.getString(PREFS_USERNAME, null);
        password = pref.getString(PREFS_PASSWORD, null);
        System.out.println(username + "-" + password);
        postLoginData();

    }

    public void postLoginData() {

        // Create a new HttpClient and Post Header
        Connection1 connection = new Connection1();
        connection
                .setHttpPost("script.php");

        try {

            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("username", username));
            nameValuePairs.add(new BasicNameValuePair("password", password));
            connection.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            String str = inputStreamToString(
                    connection.getResponse().getEntity().getContent())
                    .toString();

            if (str.toString().equalsIgnoreCase("success")) {
                WebView webapp = (WebView) findViewById(R.id.webView1);
                webapp.loadUrl("URL");
                webapp.setWebViewClient(new WebViewClient());
                webapp.getSettings().setJavaScriptEnabled(true);
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private StringBuilder inputStreamToString(InputStream is) {
        String line = "";
        StringBuilder total = new StringBuilder();
        // Wrap a BufferedReader around the InputStream
        BufferedReader rd = new BufferedReader(new InputStreamReader(is));
        // Read response until the end
        try {
            while ((line = rd.readLine()) != null) {
                total.append(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        // Return full string
        return total;
    }
}

A: On your WebView instance, call this.
webView.setHttpAuthUsernamePassword(url,"", "@"+username, password);

And override the following method:
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url+"?name="+username+"&password="+password);
    view.loadUrl(url);
    return true;
}

A: webView = (WebView) findViewById(R.id.webview);
webView.clearCache(true);
WebViewDatabase.getInstance(this).clearHttpAuthUsernamePassword();
webView.setWebViewClient(new PasswordWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);

public class PasswordWebViewClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        //view.loadUrl(url+"?name="+username+"&password="+password);
        view.loadUrl(url);

        //webView.loadUrl("https://www.google.com/accounts/ServiceLoginAuth? continue=http://mail.google.com/gmail&service=mail&Email=username&Passwd=password&null=Sign+in");

        return true;
    }

    public void onReceivedHttpAuthRequest (WebView view,
         HttpAuthHandler handler, String host, String realm){
         System.out.println("Entered into onReceivedHttpAuthRequest");

         handler.proceed(username, password);
    }

    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
         Toast.makeText(getApplicationContext(), description, Toast.LENGTH_SHORT).show();
    }

}