text:
Q: Merge my custom model with the pretrained default models Yolov5 Hi I have a custom model pt file (and dataset) for detecting only toy soldiers, and would like to somehow 'slice' the 'car' class detection the yolov5s.pt model and merge it with my own model, or vice versa.
Is there a way to merge the two models together? I basically want to end up with a model that detects two classes, cars and toy soldiers.
Thanks

A: I think there is no way to merge two models. But you can train a new model with your custom dataset and 'Car' class from COCO dataset. You can use this tookit for downloading a specific class from COCO
OID Toolkit
 python3 main.py downloader -y --classes Car --type_csv train

Feel free to ask more doubt. Thanks


text:
Q: LINQ in WCF returning repeating results I've got a LINQ query in a WCF service that runs and returns the correct number of results that I'm looking for, but repeats the first result 25 times instead of showing me all 25 different records.
The weird thing is that when I take the SQL query that it generates from the debugger and plug it into SQL Management studio, I get the correct results.
I have tried refreshing the view I'm querying from the edmx, and I've tried rewriting the query a few different ways, but I'm starting to run out of ideas.
I've included some of the code below. Any suggestions would be helpful. Thanks!
try
        {
            using (Entities db = new Entities())
            {
                var qInventory = db.vw_Web_Store_Inventory_Live
                                    .Where(qi => qi.Sku_Number == inputSKU)
                                    .ToList();

                resultPInventory.SKU = inputSKU;
                resultPInventory.StoreInventory = new List<StoreItem>();

                foreach (var qi in qInventory)
                {
                    resultPInventory.StoreInventory.Add(new StoreItem
                    {
                        StoreNum = qi.Store_Number,
                        Quantity = qi.Curr_Inv
                    });
                }
            }
        }
        catch (Exception e)
        {
            log.Error("[" + e.TargetSite + "] | " + e.Message);
        }

        log.Info("ProductInventory(" + inputSKU + ") returned " + resultPInventory.StoreInventory.Count + " results");

        return resultPInventory;

A: As Gert's link in the comments points out, sometimes LINQ may do that if your primary keys are not set up well, or if there are multiple rows with no unique values in your database.
This link also shows a similar problem.
The solution, other than rewriting your database columns (although that would be better on the long run) with better primary / unique keys, is to select specific values anonymously (later you can assign them easily):
var qInventory = db.vw_Web_Store_Inventory_Live
                    .Where(qi => qi.Sku_Number == inputSKU)
                    .Select(qi => new { qi.Store_Number, qi.Curr_Inv })
                    .ToList();

resultPInventory.SKU = inputSKU;
resultPInventory.StoreInventory = new List<StoreItem>();

foreach (var qi in qInventory)
{
    resultPInventory.StoreInventory.Add(new StoreItem
    {
        StoreNum = qi.Store_Number,
        Quantity = qi.Curr_Inv
    });
}

Of course this won't be the best way if you later need to use qInventory for other things. (In that case you can just select more fields)
PS, here is a way to shorten your code, but I am not sure if LINQ to Entities will allow it, so test it first:
resultPInventory.SKU = inputSKU;
resultPInventory.StoreInventory = db.vw_Web_Store_Inventory_Live
                                  .Where(qi => qi.Sku_Number == inputSKU)
                                  .Select(qi => new StoreItem { StoreNum = qi.Store_Number, Quantity = qi.Curr_Inv })
                                  .ToList();

A: Assign new StoreItem() to a variable before adding it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Build error after Build Pipeline creation - Azure Devops I have uploaded my existing .NET webforms project to Azure Devops and when I run a build definition, I get an error in VSBuild section.
ASPNETCOMPILER thrown an error, The directory doesn't exists.
Thanks for any help...
Here are the build solution log errors -
ASPNETCOMPILER(0,0): Error 1003: The directory 'C:\holmestest\PPS\new123' doesn't exist.
Process 'msbuild.exe' exited with code '1'.
Build Error

A:
Error 1003: The directory 'C:\holmestest\PPS\new123' doesn't exist. Process 'msbuild.exe' exited with code '1'.

According to the error message:

The directory 'C:\holmestest\PPS\new123' doesn't exist

It seems you are using the absolute path C:\holmestest\PPS\new123 in your project, which is the reason of your error message.
When you submit this the absolute path with your code to the Azure devops, Azure devops Will go to the path under the execution machine (agent) to find this folder. If the execution machine (agent) does not have a corresponding folder, Azure devops could not find that path when you build with Azure devops.
To resolve this issue, you could add this new123 into your projects/solution, then use the relative path in your code.
Update:

Can anyone suggest me how to use msbuild.exe command in .yml file?
  msbuild.exe "\website.publishproj" /p:deployOnBuild=true
  /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=1x.0 What is PathToTheFile here i need to refer ?

You could use following msbuild task to build the website project.
- task: MSBuild@1
  displayName: 'Build solution **/*.publishproj'
  inputs:
    msbuildArguments: '/p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=1x.0'

If I understand your "PathToTheFile" correct, you mean the path for publishProfile? If yes, you could switch the repo and find that publishProfile file, then you will get the path in the browser:

Hope this helps.

A: The application i'm trying to integrate Azure Devops Build pipeline is ASP.Net Website application. Azure Devops integration is fully different from compare to normal ASP.Net web forms application. Here is some reference link i found for my issue,
Azure DevOps Continuous Integration with asp.net website project instead of web application
I changed solution file in .yml to,
solution: '**/*.publishproj'
Can anyone suggest me how to use msbuild.exe command in .yml file?
msbuild.exe "\website.publishproj" /p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=1x.0
What is PathToTheFile here i need to refer ?


text:
Q: IE10: 'visibility:visible' on before pseudo-element of 'visibility:hidden' element I have made a DIV with visibility: hidden and attached a ::before pseudo-element of this DIV with visibility: visible. This works as expected in Firefox, Chrome and Safari, but in Internet Explorer 10 the pseudo-element does not render.
Please explain if I'm accomplishing this wrong, or whether this is an issue with Internet Explorer. Are there any work arounds (we only have access to the CSS, not the source HTML)?
JSFiddle demonstrating issue.

A: Filters don't work on pseudo elements in IE.
Read:
msdn
Other specified styling properties apply to the appearance of the inserted content, not to the element's content.

IE sucks, deal with it. I think the only way is to change the "hidden text" color to your background color, and you know the rest...


text:
Q: Removing lowercase letters and moving punctuation at the end of string I have a Pig Latin translator which works, but I must now figure out a way to lowercase any uppercase words in the middle of each word and move any punctuation in the middle of each word to the end.
I have experimented with
if letter_index.isupper():
   new_word = letter_index.lower()

but this does not work.  And I have imported string and created:
punc = string.punctuation

Here is what I have:
import string

    def part2():
      fin = open('Sonnet.txt')
      vowels = 'AEIOUaeiou'
      #punc = string.punctuation
      for line in fin:
        poem = line.split()
        print(poem)
        for word in poem:
          for letter_index in range(len(word)):
            if word[letter_index] in vowels:
              if letter_index == 0:
                if letter_index.isupper():
                  new_word = letter_index.lower()
                  print(new_word + 'way')
              else:
            print(word[letter_index:]+word[0:letter_index] + 'ay')
            break
part2()

Any uppercase words with uppercase letters in the middle should be lowercase but the first letter should now be uppercase.  Any punctuation in the middle of the word should then be moved to the end of the word.

A: Try
sentence = 'pyThon jAva cpP'
words_list = sentence.split(' ')
prpoer_word_list = [w.title() for w in words_list]
print(' '.join(prpoer_word_list))

Output
Python Java Cpp


text:
Q: How to find if user not logged in for 45 days I have created table called Login in sql server where I have the columns usercode, email and login_date (login_date is datetime type)
So, i created web application using .net. whenever user logged in, I am allowing based userLoged table and I am inserting into login table.
Login table:
usercode  email          login_date
001       a@gmail.com    2015-11-18 22:02:41.153
001       a@gmail.com    xxx

I have another table called userLoged where I have the columns usercode, email and web_access
UserLoged table:
usercode email         web_access
001      a@gmail.com   Y

Now, if a@gmail.com (001) is not logged in for 45 days, i need to update web_access to be 'N'
How to know if he /she not logged for 45 days?

A: I think a better thing for you to do, rather than storing a static 'Y' or 'N', is to query the last logged in date each time you need it.
If you really need the 'Y' or 'N' field, you could try a calculated field or have a SQL Job to run every day that runs Aaron D's query.

A: SELECT USERCODE
FROM LOGIN
INTO @TEMP
WHERE MAX(login_date) <= CONVERT(date(getdate()-45,101)

UPDATE USERLOGED
SET web_access = 'N'
WHERE USERCODE in (
    SELECT USERCODE
    FROM @TEMP)

A: create table userLog(
usercode nvarchar(50) null,
email varchar(50),
login_date datetime
)

create table UserLoged(
usercode nvarchar(50),
web_access char
)
insert into UserLoged values
('001', 'Y'),
('002', 'Y')

insert into userLog values
('001', 'user@gmail.com', '2015-09-18 21:02:41.153'),
('001', 'user@gmail.com', '2015-09-18 22:02:41.153'),
('002', 'user@gmail.com', '2015-11-18 22:02:41.153')

update a
    set web_access = 'N'
from UserLoged a
    join userLog b
    on a.usercode = b.usercode
where DATEDIFF(day, login_date, getdate()) >= 45

select * from UserLoged


text:
Q: how to pass traffic for port 80 not through openvpn? Is there a way to configure OpenVPN clients to route traffic for HTTP port 80
and HTTPS port 443 directly (i.e. not through the VPN), but through the regular
default gateway the clients have. All other traffic should go through the VPN.
My client is running OpenVPN on Windows and my current configuration looks like this:
client
dev tun
proto tcp
remote my-server-2 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ../keys/ca.crt
cert ../keys/client1.crt
key ../keys/client1.key
ns-cert-type server
verb 3
route-metric 1
show-net-up
dhcp-renew
dhcp-release
route-delay 0 120
hand-window 180
management localhost 13010
management-hold
management-query-passwords
management-forget-disconnect
management-signal
auth-user-pass

A: OpenVPN isn't able to filter traffic -- it simply sends the IP packets it is passed over the VPN tunnel. The functionality you want needs to be provided by the operating system. The OS needs to decide whether to route a packet using OpenVPN or using the gateway on the local network. On Linux one would accomplish this using iptables to mark certain packets, and iproute2 to select different routing tables. As far as I know this can't be done on Windows however.

A: If your OpenVPN client lives in your LAN gateway, you can do the following.
Mark incoming http-traffic with iptables
(iptables -t mangle -A PREROUTING -p tcp --dport 80 -j MARK --set-mark 0x80.
Then create routing table specially for marked traffic.
echo "80 http" >> /etc/iproute2/rt_tables
ip route add default 11.22.33.44 dev ethX table http
And finally, add the rule for routing marked traffic according to brand new table.
ip rule add fwmark 0x80 lookup 80
You can learn more about Linux policy routing in Linux Advanced Routing and Traffic Control Howto - http://www.lartc.org

A: When you connect to the VPN it makes some changes to your routing table to decide which traffic goes to the openvpn interface and which traffic is sent to the local gateway.
It can be configured a couple of ways, 2 of which are as follows. (i think you need to google for "split tunnel" configurations for more details.)
1) (The default) configuration is for the server to push to the client a routing table entry with the tun interface gateway as the default route, in this scenario all traffic (including port 80 and 443) is routed via the openVPN tunnel.
2) What (I think) you want is to configure that upon connection the openVPN server to push only a route for the private network traffic to the routing table, so everything else is sent to the local gateway. (http, httpd, dns stays local)
Typically this involves setting the directive push in the server.conf file;
 push "route 10.251.69.0 255.255.255.0"

There is an example to disable "Should clients' Internet traffic be routed through the VPN?" on the openvpn web admin panel here
You can also make the setting on a per client basis, however according to the blog post linked in the comments, it is hard (impossible??) to unset the routes pushed from the server without running some bash script to wrap that. (Hence easier if you can set this the same for all clients in server.conf).


text:
Q: disable warning 'the thrown object must be an instance of the exception' I'm using phpStorm. And I have the following piece of code written by Kohana framework:
throw HTTP_Exception::factory(404,
    'The requested URL :uri was not found on this server.',
    array(':uri' => $this->request->uri())
)->request($this->request);

The problem is that phpStorm considers this piece of code invalid and displays the following message: the thrown object must be an instance of the exception. I don't like it because it shows the entire project up to first directory invalid.
Is there any way I can work around it without changing the code?

A: i meet the same error
your Exception class must extend from \Exception ;
instead  of extend from Exception ;

A: Seems like PhpStorm gets "stuck" thinking the project is a PHP7 project, even if you change the PHP version in Settings. I solved this by removing the .idea directory altogether, and reopening the directory as a fresh project.

A: You cannot -- this error is produced by Annotator and not individual Inspection (individual inspection can be suppressed).
Accordingly to http://youtrack.jetbrains.com/issue/WI-14734 this is marked as "Won't fix". You can add your comments there or even submit new ticket if so desired.

A: I faced the same issue when having worked on a PHP 7 project and then switched back to a PHP 5.6 project. In "project settings -> Languages & Frameworks -> PHP -> PHP language level" I switched from PHP 5.6 to PHP 5.5 and the error message disappeared. I then switched back to PHP 5.6 and it didn't popup again.

A: In my case (i'm development on laravel framework) you should add slash before extends class Exception or Throwable. It is works for me. See code bellow
class ProcessIncomplete extends \Exception {}

By the way, I'm also using PHPStorm ide


text:
Q: Solution of a linear matrix equation i'm trying to rewrite a linear matrix equation
$$
X=A_1XA_2+A_3X^TA_4+B
$$
where $
X\in\mathbb{R}^{m\times n}
$ and
$
 A_1\text{, }A_2\text{, }A_3\text{, }A_4\text{, }B
$ are matrices of appropriate sizes.
So far i got to express the equation in terms of the components of $X$:
$$
X_{ij}-\sum_{k=1}^{m}\sum_{l=1}^{n}\left(A_{1,ik}\cdot A_{2,lj}+A_{3,il}\cdot A_{4,kj}\right)\cdot X_{kl}=B_{ij}
$$
but is there any neat way to express  this linear system in terms of a coefficient matrix $C$ and unfolded vectors $x$ and $b$
$$
Cx=b
$$
so that i can feed the problem to Matlab? I'd rather avoid for loops, since the matrices are quite big and the linear problem is framed inside a bigger, iterative computation.
Thanks!

A: As the comment states, we can use vectorization.  In Matlab notation, $\operatorname{vec}(X)$ just is $X(:)$, and we can go from $\operatorname{vec}(X)$ to $X$ using the reshape command.
Vectorizing both sides yields
$$
X - A_1 XA_2 - A_3 X^TA_4 = B \implies\\
\operatorname{vec}[X - A_1 XA_2 - A_3 X^TA_4] = \operatorname{vec}(B) \implies\\
\operatorname{vec}(X) - A_2^T \otimes A_1 \operatorname{vec}(X) - A_4^T \otimes A_3\operatorname{vec}(X^T) = \operatorname{vec}(B).
$$
Here, $\otimes$ denotes the Kronecker product, implemented in Matlab with kron. This is almost in the form that we want, but we need to deal with $X^T$.  For that, we need the fact that $\operatorname{vec}(X^T) = P\operatorname{vec}(X)$, where
$$
P = \sum_{i=1}^m \sum_{j=1}^n (e_j \otimes e_i)(e_i \otimes e_j)^T =
\sum_{i=1}^n \sum_{j=1}^m \operatorname{vec}(E_{ij})[\operatorname{vec}(E_{ji})]^T.
$$
$P$ can be built with a quick for-loop and only needs to be put together once (assuming $m,n$ are constant).  I don't know of a nicer approch here, unfortunately.
From there, we can finally write
$$
\operatorname{vec}(X) - A_2^T \otimes A_1 \operatorname{vec}(X) - (A_4^T \otimes A_3)P\operatorname{vec}(X) = \operatorname{vec}(B) \implies\\
(I - A_2^T \otimes A_1 - (A_4^T \otimes A_3)P)\operatorname{vec}(X) = \operatorname{vec}(B) \implies\\
(I - A_2^T \otimes A_1 - (A_4^T \otimes A_3)P)x = b
$$
where $x = \operatorname{vec}(X),b = \operatorname{vec}(B)$.


text:
Q: Equivalent of select or poll in bash Is it possible to do selects or polls on file descriptors in bash? The essence of what I'm trying to do is this:
mkfifo fifo
exec 3<fifo
PROMPT_COMMAND="while read -t 0 line; do echo \$line; done <&3"

The exec is there to keep the pipe open (otherwise it would be closed at the end of each loop). In theory, this would output anything entering the pipe before each prompt. However, it doesn't seem to work, as with -t0 it doesn't even try to read.
-t 1 works like a charm, but that forces a one second delay at every prompt, which is not what I want.
Optimal would be to do a select with .2 seconds timeout (if i'm executing a command which in turn causes something to be written to the pipe, there's bound to be a short delay as I'm working with asynchronous messages), and that delay I can live with. Zero timeout would probably be ok, then I'll just create a program to have a subsecond delay.
Any ideas?

A: I stumbled on this today, and it actually solves my problem quite elegantly. screen allows the current terminal window to be split, where I can reduce one part of the window to just a  couple of lines, where I keep my input, and just cat fifo in the other part of the window.
Screen definitely rocks a lot more than I already knew (detach alone makes it one of the best tools ever).

A: Wouldn't the following be equivalent?
$> tail -f fifo

You can also specify sleep intervals (-s), retries and --max-unchanged-stats, etc.


text:
Q: can we use phabricator for existing svnrepo with 500gb Here small question,
Having 500GB svn data, can we use phabricator for this, and how to configure for that,can we clone phabricatorsvn repo for specific files like normal svn cloning using tortoise svn.

A: Phabricator is able to handle large repositories without any problem. Your server should have enough space for the repositories though. Take a look at Diffusion User Guide (Phabricator Repo Management) for how to configure the server to host repositories.


text:
Q: How would I remove FRM: and MSG: Part when sending SMS from an email I am attempting to send SMS to my Phone but when it gets send it includes FRM: and MSG:

For example
FRM:me@gmail.com
MSG:Hello

I just want it to say
me@gmail.com
Hello

How would I be be able to do that? I am using php mail to send it to the number through sms gateways.
My whole code:

Debugging info:

<?php
$number = trim(strtolower($_GET['number']));
$from = trim(strtolower($_GET['from']));
$message = trim(strtolower($_GET['message']));
$subject = trim(strtolower($_GET['subject']));
$amount = trim(strtolower($_GET['amount']));
$number2 = $number. "@" .$carrier;
print_r($_GET);
require 'PHPMailerAutoload.php';
switch($_GET['carrier']){
    case 'AT&T':
  $carrier = "txt.att.net";
    break;
    case 'Sprint':
  $carrier = "messaging.sprintpcs.com";
    break;
    case 'Verizon':
  $carrier = "vtext.com";
    break;
    case 'T-Mobile':
  $carrier = "tmomail.net";
    break;
    case 'Soufian':
  $carrier = "gin.nl";
    break;
}
$mail = new PHPMailer;
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'swiftserver.ddns.net';                       // Specify main and backup server
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'server@swiftserver.ddns.net';                   // SMTP username
$mail->Password = 'xxxxxxx';               // SMTP password
$mail->Port = 25591;                                    //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom('fbi@fbi.gov',$from);     //Set who the message is to be sent fr
$mail->AddAddress($number2);               // Name is optional
$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
$mail->isHTML(true);                                  // Set email format to HTML
$mail->Subject = ''.$subject;
$mail->Body    = ''.$message;
if ($amount > 50){
print("You can only send 50 messages at a time. Change the message number to 50 and refresh the page.");
}
else if($amount < 50){
for($i=0; $i < $amount; $i++)
{
if(!$mail->send()) {
   echo 'Message could not be sent: ';
   echo '' . $mail->ErrorInfo;
   exit;
}
}
echo 'Your message has been sent ' .$amount;
echo ' time(s).';
}
?>


text:
Q: Xcodebuild Archive Failed with error PhaseScriptExecution Jenkins I am trying to create iOS archive from jenkins. Whereas the Build PC the Build Command is working fine but when I run from jenkins the same command I get this issue. This is a React Native Project
COMMAND:
sh 'xcrun xcodebuild archive -workspace AppName.xcworkspace -scheme Test -sdk iphoneos -configuration release -allowProvisioningUpdates -destination "generic/platform=iOS" arch=x86_64  -archivePath "/Users/ali/Desktop/Test_bulds"'

ERROR:
    /Users/ali/jenkins/workspace/Mobile/MobileAppBuild/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'react-native-blur' from project 'Pods')
** ARCHIVE FAILED **

The following build commands failed:
    PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/ali/Library/Developer/Xcode/DerivedData/Appname-hamnkyelypjutaefdzwfxmvlwith/Build/Intermediates.noindex/ArchiveIntermediates/Test/IntermediateBuildFilesPath/Appname.build/Release-iphoneos/Appname.build/Script-CF1348D5D60844C3DD63C481.sh (in target 'AppName' from project 'AppNAme')

A: You mostly need to change this line in your podfile to a higher version:
#Change this to something like '12'
platform :ios, '12'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}


text:
Q: built / had built
The steam engine is usually thought of as a relatively modern invention, but
  the Greeks had built / built a kind of steam engine in ancient times.

In this sentence, between built and had built, which one would you consider to be more appropriate? I think, while both being correct, had built makes a stronger contrast to the former statement.
This question is from the book Advanced Language Practice (BrE), which chooses built as the more appropriate. The reason I think had built is correct is that the first statement has an implied built in it (invention), and therefore makes it possible to use the past perfect.

A:
The steam engine is usually thought of as a relatively modern
  invention, but the Greeks built a kind of steam engine in
  ancient times.

Yes, mixed tenses but this makes sense and is grammatically correct. On the other hand:

The steam engine is usually thought of as a relatively modern
  invention, but the Greeks had built a kind of steam engine in
  ancient times.

No, unfortunately the first part of the sentence is in the present tense, meaning that the (pluperfect tense) had built cannot refer to it,, Ill show you how it might be made to relate, though. If we start out in the past tense..

In 1606, Spaniard Jerónimo de Ayanz y Beaumont built what was thought
  to be the first steam engine - but the Greeks had built a kind of
  steam engine in ancient times.

~or you could say `

The steam engine is usually thought of as a relatively modern
  invention. In 1781 James watt unveiled his wonderful machine but  in
  ancient times the Greeks had built a kind of steam engine.

See what I mean? You have to be speaking in the past to be able to use the word "had" before the verb about something as having already happened even earlier.
The words "in ancient times" also get in the way and make it awkward. To make it really simple:

James Watt claimed he invented the steam engine but the ancient Greeks
  had built them long beforehand.


text:
Q: Force date sorting in string properties in wpf datagrid I have a datagrid, that has all columns binded to string properties.
I create these columns in runtime, so I need to make the bind programmatically:
var c = new DataGridTextColumn();
c.Header = myProperty;
c.Binding = new Binding(myProperty);
if (thisColumnsIsDate())
    c.Binding.StringFormat = "{0:dd/MM/yyyy}";
myGrid.Columns.Add(c);

The problem is that the grid sorts these date columns like string, not DateTime.
This is the grid definition:
<DataGrid
            Grid.Row="1"
            Margin="2"
            Name="myGrid"
            AutoGenerateColumns="False"
            IsEnabled="True"
            IsReadOnly="True"
            ItemsSource="{Binding Path=Rows}"
            SelectedItem="{Binding Path=SelectedRow}"
            HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent" AlternatingRowBackground="WhiteSmoke"
            PreviewKeyDown="gridResult_OnKeyDown">

What´s missing?

A: This should correct the sorting for Date columns:
c.SortMemberPath = myProperty;

But if your property is a string you need to convert it to a DateTime first:
var c = new DataGridTextColumn();
c.Header = myProperty;

if (thisColumnsIsDate())
{
    myDateTimeProperty = DateTime.Parse(myProperty);
    c.Binding = new Binding(myDateTimeProperty);
    c.Binding.StringFormat = "{0:dd/MM/yyyy}";
    c.SortMemberPath = myDateTimeProperty;
}
else
{
    c.Binding = new Binding(myProperty);
    c.Binding.StringFormat = "{0:dd/MM/yyyy}";
    c.SortMemberPath = myProperty;
}
myGrid.Columns.Add(c);

Moreover, you can implement your own comparer: How can I apply a custom sort rule to a WPF DataGrid?


text:
Q: Rational number that contains the sequence "$0123456789$" Let $n$ be a rational number that contains the sequence "$0123456789$" in its decimal representation.
Prove or disprove that there are
$p,q \in \mathbb{N}$ such that $n = \frac{p}{q}$
and $q$ is a factor of $81$.
 For example:
\begin{align}
p &= 182 \\
q &= 5265 = 65 \cdot 81\\
n &= \frac{182}{5265}= 0.0345679\textbf{0123456789}79278851272738393
\end{align}

A: We have, for instance, $0.\overline{01234567899} = \frac{137\,174\,211}{11\,111\,111\,111}$, where the donominator has prime factorization
$$
11\,111\,111\,111 = 21\,649 \cdot 513\,239
$$
and is therefore not divisible by $81$. So $q$ is not necessarily divisiblle by $81$.
However, any rational number can be written as a fraction where the denominator is divisible by $81$: Take the rational number $\frac pq$, and write it as $\frac{81p}{81q}$.

A: Do you mean $q$ is a multiple of $81$?
Then $0.0123456789=\cfrac {123456789}{10^{10}}$ but I can always multiply this by $\cfrac {81}{81}$ to get a fraction which is not in its lowest terms.


text:
Q: Какую структуру использовать для построения точек на лице? есть выборка из 300 фотографий (это с учётом аугментации, больше не получилось выжать) изображений лиц и 300 этих же лиц, только с отмеченными опорными точками
Задача научить машину находить эти самые точки на любом лице
Не было в этом опыта, но очевидно дело за сверткой, только вот как грамотно построить процесс и обучить машину?


text:
Q: Setting default value in QGIS field I would like to add in a layer's field a default value. I mean, every time a new feature is created, that field would be automatically filled with the default value.
In my case the default value would be the @project_filename variable (project's file name).
I can't find this functionality anywhere.

A: You can define a function which adds the project filename as an attribute and connect this function with the event that adds features. You can use the following code, change the name of the field to whatever you choose (I used Name) and paste it into the Python Console. Now whenever you add a new feature, the field will be populated with the current project name:
import os

# Get project name
project = QgsProject.instance()
project_name = os.path.basename(project.fileName())

# Set active layer
layer = qgis.utils.iface.activeLayer()

# Define function to select added feature and add attribute to field "Name"
def update(featureAdded):
    idx = layer.fieldNameIndex('Name')
    layer.changeAttributeValue(featureAdded, idx, project_name)

# Connect "featureAdded" event to "select" function
layer.featureAdded.connect(update)

A: Since QGIS 2.18, go to the layer properties / field properties and set an expression (@project_filename in this case) as the default value.

https://www.qgis.org/en/site/forusers/visualchangelog218/index.html#feature-client-side-default-field-values

A: In QGIS 3.x, you can find the "Default Values" section in Layer Properties > Attributes Form ("Manage forms and fields...") section.
Just choose your field, then scroll down to the "Default Values" section on the right hand side.


text:
Q: Webworker for a recursive function I have already some elements for my answer, coming from an old post (Trying to implement inline Webworker for a recursive function).
Now I take over this little code implying this issue. This little code uses inline webworkers since I use a recursive function which computes the best hit to play (this is the "computer" Hit). If I don't use webworker and I take a depth too high, the game is hanging in browser.
the source of code is available on [this link][1]
I would like to get a working code. Indeed, I am near to the solution since several bugs have been fixed (for example, the fact to include different functions in webworker to make it do its computations without calling external functions. If I don't include all necessary functions, the webworker will not be able to work since it has its own scope.
So I would like to get help to debug my current version.
The game is available on [this link][2]
I am interested only into "computer vs player" mode (black begins to play). Here below you can find the part when I call the recursive function.
Once computation is done with this recursive function, I would like to get back the object representing the current map of game (positions of black/white circles).
To get back the object or the coordinates suggested for hit (Here we are in main function), I did the following code :
// Call the recursive function and get final (a,b) results
    new Promise( resolve => {
        let HitTemp = JSON.parse(JSON.stringify(HitCurrent));
        let firstWorker = new Worker( workerScript );
        firstWorker.onmessage = function ( event ) {
            resolve( event.data ); //{ result: XXX }
            console.log('here5');
        }
        firstWorker.postMessage([HitTemp, HitTemp.playerCurrent, maxNodes]);
    } ).then( ( { result } ) => {
        //let [ a, b ] = result.coordPlayable;
        let [ a, b ] = HitTemp.coordPlayable;
        console.log('result3 : ', result);
        console.log('here3 : ', a, b);
    } );

  // HERE I TRY TO USE a and b in exploreHitLine function
  // who needs the variables a and b BUT I DON'T KNOW
  // IF a AND b ARE KNOWN HERE FROM CODE ABOVE

  for (k = 0; k < 8; k++) {
   exploreHitLine(HitCurrent, a, b, k, 'drawing');
  }

and below the recursive function (inside inline webworker part) :
window.onload = function() {

  // Inline webworker version
  workerScript = URL.createObjectURL( new Blob( [ `
  "use strict";

...
...
// All other variables and functions necessary for inline webworker
...
...
...

        function negaMax(HitCurrent, colorCurrent, depth) {
          // Indices
          var i, j, k;
          // Evaluation
          var arrayTemp, evalFinal, e;
          // Set current color to HitCurrent
          HitCurrent.playerCurrent = colorCurrent;
          // Deep copy of arrayCurrent array
          arrayTemp = JSON.parse(JSON.stringify(HitCurrent.arrayCurrent));
          // If depth equal to 0
          if (depth == 0)
            return evaluation(HitCurrent);
          // Starting evaluation
          evalFinal = -infinity;
          // Compute all playable hits and check if playable hits
          if (computeHit(HitCurrent, 'playable')) {
            // Browse all possible hits
            for (i = 0; i < 8; i++)
              for (j = 0; j < 8; j++)
            if (HitCurrent.arrayPlayable[i][j] == 'playable') {
              for (k = 0; k < 8; k++) {
                // Explore line started from (i,j) with direction "k"
                exploreHitLine(HitCurrent, i, j, k, 'drawing');
              }
              // Recursive call
              e = -negaMax(JSON.parse(JSON.stringify(HitCurrent)), ((JSON.stringify(HitCurrent.playerCurrent) == JSON.stringify(playerBlack)) ? playerWhite : playerBlack), depth-1);
              if (e > evalFinal) {
                HitCurrent.coordPlayable = [i,j];
                evalFinal = e;
              }
              if (e == -infinity) {
                HitCurrent.coordPlayable = [i,j];
              }
              // Restore arrayCurrent array
              HitCurrent.arrayCurrent = JSON.parse(JSON.stringify(arrayTemp));
            }
            // Clean playable hits once double loop is done
            cleanHits('playable', HitCurrent);
          }
              console.log('here2 :', evalFinal);
          return evalFinal;
             }
        onmessage = function ( event ) {
          let params = event.data;
          //postMessage( { result: recursiveFunction(  HitCurrent, HitCurrent.playerCurrent, maxNodes ) } );
          postMessage( { result: negaMax( ...params ) } );
        };
        ` ], { type: "plain/text" } ) );

     main();
    }

I expect to get back the coordinates "a" and "b" of computed value by recursive function but it seems to return nothing.
I don't know how to receive the object HitTemp object or more directly get a and b suggested coordinates ?
Feel free to ask me more precisions if you don't understand my problem in this algorithm.

A: There are two problems with the code that you presented:
Problem #1: Assuming that postMessage passes a reference, but instead it serializes/deserializes it.
When you are using postMessage from within main js into the WebWorker, you are passing the HitTemp object, and later on, in the WebWorker you assume, that if you set properties of that object, the the original object would be modified as well. By that I mean the following code:
firstWorker.postMessage([
    HitTemp // <-- here you are sending the object to the WebWorker
, HitTemp.playerCurrent, maxNodes]);

workerScript = URL.createObjectURL( new Blob( [ `
// ...
    if (e > evalFinal) {
        HitCurrent.coordPlayable = [i,j]; // <-- here you access the object
        evalFinal = e;
    }
//...

Unfortunately, according to the documentation, when calling postMessage, the original object is serialized by the caller and then deserialized in the WebWorker, so effectively, the WebWorker is operating on a copy. Fortunately, this can be easily avoided by posting the data you are most interested in inside the postMessage back from the WebWorker.
Problem #2 : Using the a and b variables outside the scope
I noticed that you are trying to access values that are defined in the .then() result callback outside that callback, like so:
//...
} ).then( ( { result } ) => {
    let [ a, b ] = //here you define a and b
} );

// a and b are no longer in scope here
for (k = 0; k < 8; k++) {
    exploreHitLine(HitCurrent, a, b, k, 'drawing');
}

Solution
To solve the first problem you need to return the values of HitCurrent (which contain coordPlayable that you are probably most interested in) with the postMessage back from the WebWorker. For the second problem, just move the final for loop using the a and b variables inside the .then() callback. The result code is as follows:
Main js code:
new Promise( resolve => {
    let HitTemp = JSON.parse(JSON.stringify(HitCurrent));
    let firstWorker = new Worker( workerScript );
    firstWorker.onmessage = function ( event ) {
        resolve( event.data );
        console.log('here5');
    }
    firstWorker.postMessage([HitTemp, HitTemp.playerCurrent, maxNodes]);
} ).then( ( { result } ) => {
    var HitResult = result.HitResult;
    let [ a, b ] = HitResult.coordPlayable; // <-- get values from result
    console.log('result3 : ', result.eval);
    console.log('here3 : ', a, b);

    //move for loop inside the callback
    for (k = 0; k < 8; k++) {
        exploreHitLine(HitCurrent, a, b, k, 'drawing');
    }
} );

WebWorker:
window.onload = function() {

// Inline webworker version
workerScript = URL.createObjectURL( new Blob( [ `
"use strict";

// ...
function negaMax(HitCurrent, colorCurrent, depth) {
    // Indices
    var i, j, k;
    // Evaluation
    var arrayTemp, evalFinal, e;
    // Set current color to HitCurrent
    HitCurrent.playerCurrent = colorCurrent;
    // Deep copy of arrayCurrent array
    arrayTemp = JSON.parse(JSON.stringify(HitCurrent.arrayCurrent));
    // If depth equal to 0
    if (depth == 0)
        return evaluation(HitCurrent);
    // Starting evaluation
    evalFinal = -infinity;
    // Compute all playable hits and check if playable hits
    if (computeHit(HitCurrent, 'playable')) {
        // Browse all possible hits
        for (i = 0; i < 8; i++)
            for (j = 0; j < 8; j++)
                if (HitCurrent.arrayPlayable[i][j] == 'playable') {
                    for (k = 0; k < 8; k++) {
                        // Explore line started from (i,j) with direction "k"
                        exploreHitLine(HitCurrent, i, j, k, 'drawing');
                    }
                    // Recursive call
                    e = -negaMax(JSON.parse(JSON.stringify(HitCurrent)).eval, ((JSON.stringify(HitCurrent.playerCurrent) == JSON.stringify(playerBlack)) ? playerWhite : playerBlack), depth-1); //since negaMax returns an object, don't forget to access the value in the recursive call

                    if (e > evalFinal) {
                        HitCurrent.coordPlayable = [i,j];
                        evalFinal = e;
                    }
                    if (e == -infinity) {
                        HitCurrent.coordPlayable = [i,j];
                    }
                    // Restore arrayCurrent array
                    HitCurrent.arrayCurrent = JSON.parse(JSON.stringify(arrayTemp));
                }
        // Clean playable hits once double loop is done
        cleanHits('playable', HitCurrent);
    }
    console.log('here2 :', evalFinal);
    return {eval: evalFinal, HitResult: HitCurrent }; //<-- send the additional HitCurrent as a result here
}
onmessage = function ( event ) {
    let params = event.data;
    postMessage( { result: negaMax( ...params ) } );
};
` ], { type: "plain/text" } ) );
main();
}

I decided to return the whole HitCurrent from inside the WebWorker and passed is as HitResult parameter, because based on the fact that other parameters are modified by the recursive method as well (like arrayPlayable and arrayCurrent), then you would also be able to get the modified values after the calculation.


text:
Q: Number of strings that start and end with the same letter or are palindromes or contain vowels only
In this question, we consider strings consisting of 26 characters, with each character being a uppercase letter. Determine the number of such strings that
  (a) start and end with the same letter, or
  (b) are palindromes, or
  (c) contain vowels only

For this problem, I approached each scenario a, b, c separately. I then joined the 3 with an OR to satisfy the question in the final answer.
a. $26$ characters, if the last letter must be the same as the first, we really only have $25$ characters to choose from, so part a = $26^ {25}$
b. $26$ characters, but if it is a palindrome, the length is cut in half, giving us $26^{13}$.
c. If the characters are vowels only, there are only A E I O U, $5$ characters to choose from. And we have a full 26 characters to pick. $26^{5}$
The three value then gets OR'd together
$26^ {25}$ OR $26^{13}$ OR $26^{5}$
Is what I did correct? I'm working from practice problems and am not given an answer key so it's hard to really practice when I don't know if I'm doing it right or wrong. Thank you!

A: The correct answer is
$$26^{25}+5^{26}-5^{25}$$
There are two key steps in getting the answer.  First, condition (b) is irrelevant: palindromes necessarily start and end with the same letter, so they've already been accounted for under condition (a).  Second is the inclusion-exclusion principle applied to conditions (a) and (c):  After adding together the counts for each condition separately, you subtract the count of their intersection, namely the number of vowel strings that begin and end with the same vowel.
The OP mistakenly got $26^5$ instead of $5^{26}$ for condition (c); $26^5$ counts the number of $5$-character strings, with each character being any letter of the alphabet. (When forming a string of vowels, there are $5$ choices for the first character, $5$ for the second, and so forth, for a total of $5\times5\times\cdots\times5$.)

A: (a) Let me consider that you pick up the first letter is same and the last letter is automatically the same. therefore  $26^{25}$
(b) I think this one is complicated to explain, you need to consider 1 same numbers pair and other 24 letters are the same, 2 pairs of the same numbers and different to other pairs and the rest of 22 letters are the same... 13 pairs of the same numbers and different from other pairs. therefore  $26P1 + 26P2 + 26P3  + 26P4 + 26P5 + 26P6 + 26P7 + 26P8 + 26P9 + 26P10 + 26P11 + 26P12 + 26P13$.
(c) You have only vowels in 26 letters of a string. So, you should consider only vowels for 26 letters in a row. Therefore,
$5^{26}$


text:
Q: Runtime introspection in C++ I have a class that looks like this:
class MyClass {
    public:
    void doSomething() { // nothing here };
}

and it also has a subclass that looks like this
class MyChildClass : MyClass {
    public:
    void doSomething() { // actual code here };
}

As you can see the doSomething() function does nothing in the parent class, but the child class overwrites it and adds actual code. My problem is that I am attempting to do something like this:
MyClass foo = MyChildClass();
foo.doSomething();

I was quite shocked to find that in this case, MyClass, and not MyChildClass's version of doSomething() is called, even though foo is actually of type MyChildClass. I have far more experience in Objective-C than C++ so this is very strange for me. It seems that C++ is determining which version of doSomething() needs to be called at compile-time, rather than inspecting the type of the object at run-time and calling the correct version.
This is problematic for me, because in my actual code what I have is one parent class and multiple different child classes that inherit from it. Each of these child classes overwrites the doSomething() function with their own unique implementation. I end up having an std::vector full of MyClass objects (which is really full of many different types of objects that each inherit from MyClass) and I want to loop through each of these object and invoke their version of doSomething() without actually knowing their type at compile-time. This would be easy in Objective-C, but is there any way for me to accomplish this in C++?

A: You need two things:

*

*A reference or pointer to the created object, so that it isn't copy-sliced.

*Having the member function virtual in the base class.

E.g., off the cuff,
struct MyClass{ virtual void foo() {} };
struct Derived: MyClass { void foo() override { /* ... */ } };

auto main() -> int
{
    MyClass&& o = Derived{};
    o.foo();
}

But why not just use the Derived type for the declaration?

" I end up having an std::vector full of MyClass objects (which is really full of many different types of objects that each inherit from MyClass) and I want to loop through each of these object and invoke their version of doSomething() without actually knowing their type at compile-time.

A vector<MyClass> slices each item to just the MyClass part. You can use a vector of pointers. If these are owning pointers, use a smart pointer like shared_ptr or unique_ptr.

A: If you want to run function based on run time information, you need to declare function as virtual function.


text:
Q: Spring Boot: Jackson won't pick up configuration from "application.properties" I have a multi-module Maven-based Spring Boot Application. In one of my modules' application.properties file, I am setting Jackson to not serialize dates as timestamps (arrays), so that they are always serialized as strings (which is the fallback behavior). The property is this:
spring.jackson.serialization.write_dates_as_timestamps=false

Problem is... the property doesn't seem to be picked up by either Spring Boot/Jackson. The java.time.LocalDate instances I am trying to serialize always get written as timestamps. I have checked the code inside the LocalDateSerializer.serialize(...) method (from Jackson's own JavaTimeModule), and found this:
@Override
public void serialize(LocalDate date, JsonGenerator generator, SerializerProvider provider) throws IOException
{
    if (useTimestamp(provider)) {  // This always returns true
        generator.writeStartArray();
        generator.writeNumber(date.getYear());
        generator.writeNumber(date.getMonthValue());
        generator.writeNumber(date.getDayOfMonth());
        generator.writeEndArray();
    } else {
        String str = (_formatter == null) ? date.toString() : date.format(_formatter);
        generator.writeString(str);
    }
}

The useTimestamp() method always returns true, no matter what my configuration is. :(

A: Maybe you can create a custom MappingJackson2HttpMessageConverter and an ObjectMapper. Here is an example configuration class,
@Configuration
public class MyConfiguration extends WebMvcConfigurerAdapter {
    @Bean
    public MappingJackson2HttpMessageConverter
        getMappingJacksonHttpMessageConverter() {
        MappingJackson2HttpMessageConverter converter =
            new MappingJackson2HttpMessageConverter();
        ...

        ObjectMapper mapper = new ObjectMapper();
        ...
        mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
        //or
        // mapper.configure(
        // SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);

        converter.setObjectMapper(mapper);
        return converter;
    }

}

A: Thanks to Indra's answer, I got an important clue that helped me figure out the issue.
Turns out that my Spring Boot application has multiple instances of RestTemplate in its application context (it is a pretty big system and relies upon some custom proprietary frameworks to work). Most of these RestTemplate instances were there just to support my system's architecture. There is only one RestTemplate instance that I should've cared about: The one that I wrote and allows my business logic to work (by enabling my system to consume remote RESTful APIs).
So, when I was trying to configure Jackson and its ObjectMapper, I wasn't really affecting my RestTemplate instance. By the time my configuration was read, that RestTemplate had long ago been initialized with the default settings provided by Spring Boot.
This is how my final configuration class looks:
@Configuration
public class RestConfiguration {

    @Bean
    public RestTemplate myRestTemplate(HttpMessageConverters customConverters) {
        RestTemplate restTemplate = new RestTemplate();
 restTemplate.setMessageConverters(customConverters.getConverters());
        return restTemplate;
    }

    /*
     * The following custom HttpMessageConverter is injected into myRestTemplate
     * in order to appropriately configure the serialization/deserialization of LocalDate
     * instances into/from strings.
     */
    @Bean
    public HttpMessageConverters customConverters() {
        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JavaTimeModule());
     mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);

        converter.setObjectMapper(mapper);
        return new HttpMessageConverters(converter);
    }

}

What I am doing is to explicitly configure the RestTemplate instance that needed to be configured.
The following documentation was also very helpful: HttpMessageConverters. It describes how to declare custom HttpMessageConverters for use in the application context.


text:
Q: Is there a way to convert a String (character by character) to its ASCII value in Java? I'm currently trying to write an encryption program and I'm trying to figure out how a user can enter a string (a mix of number, letters, and special characters) and have the program convert each character to its numeric ASCII value. I've searched all over the internet and I can't seem to find any method or line of code that can do this. Now before anyone says "Try casting it to an integer" I've tried and it doesn't work. So if anyone could please help me in this matter I would be very appreciative.

A: To turn characters into numbers, you need pick an encoding. US-ASCII is one way to do that, but note, US-ASCII only defines about 95 characters; any character that isn't one of those 95 causes the process of converting to bytes to throw an exception. UTF-8 is the usual go-to choice when you want to be able to convert all characters (from ü to ☃ to emojis). Note in UTF-8, any non-ASCII character ends up being multiple bytes for one character, so a 10-char string might end up being as many as 50 bytes.
String test = "Hello!";
byte[] asBytes = test.getBytes(StandardCharsets.US_ASCII);
String fancy = "Wééé! ☃";
byte[] fancyBytes = fancy.getBytes(StandardCharsets.UTF_8);

A: You can loop through the string and use the charAt() method of the string:
String s = "abcd";

for (int i = 0; i < s.length(); i++) {
    char c = s.charAt(i);
    int value = s.charAt(i);
    System.out.println(c + " " + value);
}

will print:
a 97
b 98
c 99
d 100


text:
Q: Godot iOS touch screen button I'm working on a 2d game and the build works fine on Android but when play it on iOS the touchscreen button does not work as expected:
I have to "long press" the button before the character moves, unlike Android where it works instantly by touch.
Is there any option or something I'm missing that could make the character move instantly by touch on iOS (without having to long press the button)?
I used the movement doc for 2d in the godot official documentation.
Godot version 3.2.2


text:
Q: Scheme length of list using tailrecursion I have been trying to find the length of a list using scheme using tail recursion and so far, I have this
(define num-els2
  (lambda(xs)
    mynum xs 0))

(define mynum
  (lambda (xs empt)
    (if (empty? xs)
        empt
        (mynum (rest xs) (+ empt 1)))))

but it keeps giving me 0. I think for some reason it does not increment my return value. So how do I fix this?

A: There is a problem with the parentheses in the num-els2 procedure, nothing serious. Basically, you are not correctly calling the mynum helper procedure, and the procedure is always returning 0, because that's the last expression in the body. Here, this should fix it:
(define num-els2
  (lambda(xs)
    (mynum xs 0))) ; notice the opening bracket in this line

A: Scheme provides a named let for this:
(define (list-length list)
  (let loop ((list list)
             (length 0))
    (if (null? list)
        length
        (loop (cdr list) (+ length 1)))))

It is part of the standard since R2RS (1985). Earlier it has been called "iterate".
The named let specification is part of the section Iterations.


text:
Q: Why does this while loop not update my mysql query? I'm still new to writing querys to mysql, so I'm sure it is a newbie mistake, but I can't figure it out.
Here is the code (with lots of echos so I can show my output):
while($row = mysql_fetch_array($tempresult, MYSQL_ASSOC)){

$tempStartDate = $StartDate;
$tempEventID = $row['EventID'];
$tempDaysFromEvent = $row['DaysFromEvent'];

echo "Main Event Start Date: ".$tempStartDate."
";
echo "EventID: ".$tempEventID.", Start Date: ".$tempStartDate.", Days From Event: ".$tempDaysFromEvent.", Parent Event ID: ".$tempParentEventID."
";

$newtempStartDate = explode(" ", $tempStartDate);
echo "New Temp Start Date: ".$newtempStartDate[0];
echo "
";

    list($year, $month, $day) = explode("-", $newtempStartDate[0]);
echo $year." ". $month. " ". $day;
echo "
";
$tempStartDate  =  $tempEndDate =  date("Y-m-d", mktime(0,0,0,$month,($day+$tempDaysFromEvent),$year)) . " 00:00:00";
echo "TempStart Date:".$tempStartDate."
";

mysql_query("UPDATE".$eventDatabase." SET StartDate='$tempStartDate',EndDate='$tempEndDate'where EventID ='$tempEventID'");

    error_reporting(E_ALL);

}

Here is my output:
Main Event Start Date: 2011-07-04 15:00:00
EventID: 4876, Start Date: 2011-07-04 15:00:00, Days From Event: 4, Parent Event ID: 4865
New Temp Start Date: 2011-07-04
2011 07 04
TempStart Date:2011-07-08 00:00:00

The output looks correct to me-it looks like I want it to look in the db.  I don't know if the issue is because $tempStartDate is a string?  It is a datetime in mysql, but that shouldn't matter I don't think??

A: As noted in the comment above, it appears that you are missing spaces in your SQL statement.  Replace your mysql_query() call with this:
mysql_query("UPDATE $eventDatabase SET StartDate='$tempStartDate', EndDate='$tempEndDate' WHERE EventID='$tempEventID'");

When in doubt, you can always assign the SQL query to a string variable first, and echo the string so that you can see the full SQL statement, including variable values.

A: Try echoing the actual sql command.  Looks like you need a space there after the "UPDATE" and before 'where EventID= xxx";
Try and execute the actual output from echo in SQL admin page.


text:
Q: How to make multiple HTTP calls in Angular6, using forkJoin and ngrx? Scenario
In my angular6 app, i have three cateories, catA, catB, catC.
Each category needs data from 3 APIs. On clicking any category it loads the CategoryDetailsComponent, i dispatch action (LoadCategoryDetails).
I have implemented forjoin to perform parallel api calls(in service) and also resolver to ensure all the calls are done, only then the component should loaded.
Problem

*

*On clicking catA (or page reload), categoryNames array is empty

*On clicked catB (second routing), CategoryNames array shows list of previous category (catA)

Maybe one of the api call is taking time. and my resolver is not configured properly.
Question
How to configure effects and resolver??
How to use forkjoin to make multiple calls and send data to component?
Code

*

*dipatch action and subscribe to selector

ngOnInit() {
    const id = parseInt(this.route.snapshot.paramMap.get('categoryId'), 10);
    this.store.dispatch(new fromCategory.LoadCategoryDetails(id));

    this.store.select(getCategoryDetails)
              .subscribe((data) => {
                this.categoryDetails = data[0];
                this.journeys = data[1];
                this.categories = data[2];
              });

    // filter only category name
    // problem
    this.categories.forEach( category => {
      this.categoryNames.push(category.name);
    });
}

*effects (look for action and call service)

@Effect()
loadCategoryDetails$ = this.actions$.pipe(
    ofType<fromCategory.LoadCategoryDetails>(CategoryActionTypes.LoadCategoryDetails),
    switchMap((action) => {
    return this.categoryService.getCategoryDetails(action.payload).pipe(
        map(data => new fromCategory.LoadCategoryDetailsSuccess(data))
    );
    })
);

*service func making multiple calls and using forkjoin

import { forkJoin } from 'rxjs';

getCategoryDetails(categoryId) {
    const categoryDetails = this.http.get(url);
    const journeys = this.http.get(url);
    const courses = this.http.get(url);

    return forkJoin([categoryDetails, journeys, courses]);
}

*resolver

export class CategoryDetailsResolver implements Resolve<any> {

    constructor(
        private categoryService: CategoryService,
        private router: Router) {}

    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        const categoryId = route.paramMap.get('categoryId');
        return this.categoryService.getCategoryDetails(categoryId);
    }
}

Thanks in advance.

A: refactor your code to NOT use route.snapshot and see if that fixes it.
ngOnInit() {
this.route.data.subscribe((data) => {

if(data) {
 this.store.dispatch(new fromCategory.LoadCategoryDetails(data.id));

 this.store.select(getCategoryDetails)
          .subscribe((data) => {
            this.categoryDetails = data[0];
            this.journeys = data[1];
            this.categories = data[2];

 this.categories.forEach( category => {
  this.categoryNames.push(category.name);
  });
});

}

});

}

A: Your implementation of forkjoin looks fine to me. But one problem I can see in your code is , you are iterating the categories outside of the getCategoryDetails callback. Since it is asynchronous , you should always ensure you are getting the categories before you do the iteration. For that you should move the code for iterating the categories to the successful callback function.
ngOnInit() {
    const id = parseInt(this.route.snapshot.paramMap.get('categoryId'), 10);
    this.store.dispatch(new fromCategory.LoadCategoryDetails(id));

    this.store.select(getCategoryDetails)
              .subscribe((data) => {
                this.categoryDetails = data[0];
                this.journeys = data[1];
                this.categories = data[2];

this.categories.forEach( category => {
      this.categoryNames.push(category.name);
    });
              });

    // filter only category name
    // problem

}


text:
Q: Rank Arrayformula does not work with COUNTIF I'm using this formula in Google Sheets to RANK rows based on TOT column. It works well if I put the formula in E2 and drag over the column, but I want to put this formula inside an arrayformula and it's not working. How could I arrayformulize this?
=RANK.EQ(I3;$I$3:$I;0)+COUNTIF($I$3:I3;I3)-1

=ARRAYFORMULA(RANK.EQ(I3;$I$3:$I;0)+COUNTIF($I$3:I3;I3)-1) This doesn't work
https://docs.google.com/spreadsheets/d/1D0ralOL6nv5Cv_L5La4x8q5XrlX56oVFJHJqgz-aj94/edit
Note: the CountIf part is important because I don't want duplicated ranking numbers if there's a draw between two rows. Without COUNTIF the arrayformula works well but I don't want to remove it.

A: use:
=INDEX(SORT({SORT(ROW(D2:D); D2:D; )\ROW(D2:D)-1});;2)

update
=SORT(ROW(D2:D)-1; SORT(ROW(D2:D); D2:D;;C2:C;); 1)

or:
=SORT(ROW(D2:D)-1; SORT(ROW(D2:D); D2:D;;C2:C; 1); 1)

A: You can try this approach. It sorts the sequence of numbers (1 to 14 in this case) according to the ascending order of D2:D; and then finds out with MATCH in which order they were left:
=ARRAYFORMULA(MATCH(SEQUENCE(COUNTA(D2:D));SORT(SEQUENCE(COUNTA(D2:D));FILTER(D2:D;D2:D<>"");0);0))

A: The sheet you've shared doesn't match the formula you have.
Here's a formula that works with the sheet you've shared:
=ARRAYFORMULA(RANK.EQ(D2:D;D2:D;0)+COUNTIFS(D2:D;D2:D;ROW(D2:D);"<="&ROW(D2:D))-1)

When using ArrayFormula you have to provide ranges to the functions parameters (and you don't need absolute references since you aren't going to drag the formula).
In this case it was slightly more complex as that COUNTIF you have must be done with a COUNTIFS.


text:
Q: Custom back button icon is misaligned on iOS 16 When checking our app on iOS 16 we realized that our back button with a custom icon has bad alignment. The icon gets pushed down to the bottom of the icon container. The text still is where it should be but the icon is too far down. (See screenshot) How to fix this without breaking layout on iOS 15?

A: Apply .withBaselineOffset(fromBottom: 0) to the image before setting it as backIndicatorImage.
let image = UIImage(named: "BackIcon")?
    .withBaselineOffset(fromBottom: 0) // <- this fixes the layout
navigationController?.navigationBar.backIndicatorImage = image
navigationController?.navigationBar.backIndicatorTransitionMaskImage = image

Same fix also works when using .appearance().
This will fix the alignment on iOS 16 but won't cause issues with iOS 15 as the applied offset is 0. Makes me wonder why it works on iOS 16 in the first place...


text:
Q: Avoid the planes - the geometry of grassmannians Suppose we have $n$ planes $H_1, \ldots, H_n$ in $\mathbb{R}^m$ of codimension $q$, or equivalently of dimension $d=m-q$. I want to choose a vector which does not belong to the planes in a continuous way. There are two versions of this problem, depending on how we parameterize the planes, and the answer can be actually different.

*

*Unframed version. Let $Gr_q(m) $ be the grassmannian, that is the space of codimension q planes in $\mathbb{R}^m$. Does there exist a function

$$c : Gr_q(m) ^n \to \mathbb{R}^m$$
Such that $c(H_1, \ldots, H_n) \not \in H_i$ for all $i$?

*Framed version. Let $V_{d,m}$ be the Stiefel manifold, that is the space of orthonormal systems in $\mathbb{R}^m$ of cardinality $d$. Does there exist a function

$$c : V_{d,m} ^n \to \mathbb{R}^m$$
Such that $c(H_1, \ldots, H_n) \not \in H_i$ for all $i$?
Note. I slightly changed the notation to agree with Chris one; now $d$ denote the dimension of the planes and $q$ the codimension.

A: This is a partial answer, though its not particularly elementary. (EDIT: I am using d to denote the dimension of the planes, rather than the codimension as stated in the question, so things need to be re-indexed). If $2d+1\geq m$, $d\neq m$ then for any $n$, we cannot find such a map. Assume such a map exists, and consider the real steifel manifolds $V_{m,d}$. These are the space of orthonormal $d$ tuples in $\mathbb{R}^n$, and we have a natural surjective map $V_{m,d}\xrightarrow{\pi} V_{m,d-1}$ given by forgetting the last vector in our list. By restricting a hypothetical $c$ map to the first coordinate (with other coordinates some fixed spaces), it suffices to show that no map can exist when $n=1$.
We claim that a map of the form described will yield a section of the map $$V_{m,d+1}\xrightarrow{\pi}V_{m,d}$$
To see this, first normalise the map $c$ to land in unit one vectors in $\mathbb{R}^n$. Then for a given orthonormal $d$ frame, map it to the orthonormal $d+1$ frame with new vector $c(Span(v_1,..v_{d}))$. This is clearly a section, so now consider mod $2$ cohomology, and in particular the cup product structure.
By results of Borel we know this graded ring, which I read at https://www.researchgate.net/publication/254207624_The_cohomology_rings_of_real_Stiefel_manifolds_with_integer_coefficients
The cohomology ring of $V_{m,d}$ is generated by classes of generators $z_i$ of degree $i$ for $m-d\leq i\leq m-1$, subject to the relation $z_i^2=z_{2i}$ when $2i\leq m-1$, and $z_i^2=0$ else. The map $\pi$ induces the natural inclusion of these rings, so consider $z_{m-d-1}^2=z_{2m-2d-2}$ in $H^*(V_{m,d+1},\mathbb{Z}/2\mathbb{Z})$. On one hand, our section is the identity on this element, since $z_{2m-2d-2}$ is in the image of the natural inclusion, but on the other, the minimal positive degree nonzero cohomology group of $V_{m,d}$ is in degree $m-d$, so $z_{m-d-1}$ must be in the kernel. So since the induced map on cohomology rings is a map of graded rings, no such map $c$ can exist in this case.
On the other side, the case of $d=1$, $m> 2$ is also not possible. Similarly, reduce to the $n=1$ case, and thus we obtain a map $\mathbb{RP}^{m-1}\rightarrow S^{d-1}$ such that when we compose with the natural quotient $S^{d-1}\rightarrow \mathbb{RP}^{m-1}$, the induced endomorphism of $\mathbb{RP}^{m-1}$ has no fixed points. Then consider the trace of this endomorphism on mod $2$ cohomology. Since it has no fixed points, this trace is $0$, and thus this endomorphism is nonzero on some nonzero cohomology group (since its an isomorphism on $H^0$), so induces an isomorphism on $H^{m-1}(\mathbb{RP}^{m-1},\mathbb{Z}/2\mathbb{Z})$, since all the other maps factor through $0$. But a generator for this top cohomology is the $m-1$ fold cup product of the class in $H^1$, so this must be the zero map (since $S^{m-1}$ is simply connected). Thus, no map can exist in this case either.


text:
Q: .NET MVC 4 HttpPost going wrong I got a intresting little problem with .NET MVC 4.
I'm trying to learn how this works and after doing a few tutorials I keep running into the same problem.
Down here is my default Index method wich should be called when the page is loading.
   public ActionResult Index() {
       var result = (from Product in db.Products
                     orderby Product.Id ascending
                     select Product);
       return View(result.ToList());
   }

The method returns a list of product items from my database..
@using (Html.BeginForm("Index", "Stap1", FormMethod.Post, new { id = "form1" }))
{
    <select id="select" size="4" name="product">
        @foreach (var item in Model)
        {
            <option value="@item.Id" >@Html.DisplayFor(modelItem => item.Naam), @Html.DisplayFor(modelItem => item.Prijs)</option>
        }
    </select>
    <input type="submit" value="Voeg Toe!" name="Add" />
}

I added a function to catch the post data of the form. like this..
[HttpPost]
public ActionResult Index(int product = 0) {
                var result = (from Product in db.Products
                              orderby Product.Id ascending
                              select Product);
                System.Diagnostics.Debug.WriteLine("wrong function called!");
                return View(result.ToList());
            }

As you can see it's pretty basic stuff, however, when I try to load the Index page. It calls the 'overloaded httppost Index()" instead of the normal one. Why does it call a HTTPPOST method when nothing is posted?

A: I've checked your code and that is the right behavior.
Your application starts with the HomeController which renders the Index view.
In your view I've found this piece of code:
@using (Html.BeginForm("Index", "Stap1", FormMethod.Post, new { id = "form1" }))
{
   <input type="submit" value="Start!" name="start" />
}

so you're actually posting to the Stap1Controller action Index.
If you want to call (HttpGet) your Index without posting you should do something like this:
@Html.ActionLink("Start!", "Index", "Stap1")


text:
Q: How to detect which div is being dragged I have an inventory div with multiple divs inside it. I need to figure out which slot being dragged, here is my code. When div is dragged I have to set the selected slot to that slot in my inventory class. I can't get it to work.
var numOfSlots = 6;

for(var i = 1; i <= numOfSlots; i++){
  $("#slot"+i ).draggable({
      zIndex: UIlayer++
      start: function(){
         var thestring = $(this).attr('id');
         var thenum = thestring.replace(/^\D+/g, '');
         self.setSelectedSlot(thenum);
    }

  $("#slot" + i).data({
      'initLeft': $("#slot" + i).css('left'),
      'initTop': $("#slot" + i).css('top')
  });
}

A: not sure I get your requirement fully, but how about
html:

1

2

js:
$(".slot" ).draggable();

$(".slot").on("dragstop", function() {
   console.log($(this).data("id"));
});

will log either 1 or 2 to the console depending on which div you drag. fiddle

A: Something like this
$("#slot"+i ).draggable({
zIndex: UIlayer++,
start: function(event){
    var element = event.target;
     var thestring = $(this).attr('id');
     var thenum = thestring.replace(/^\D+/g, '');
     self.setSelectedSlot(thenum);
}

$("#slot" + i).data({
'initLeft': $("#slot" + i).css('left'),
'initTop': $("#slot" + i).css('top')
});


text:
Q: Trying to compare objects to determine change and update scope based on that Sorry I'm not sure how to ask this question but the code is pretty straight forward I think. I want to check if the data being returned from the DB has changed and if so update the scope. However when I do the compare it always comes back as different and does the update:
$scope.tickets = Ticket.tickets.query();

updateTickets = $interval(function(){
 var deferred = $q.defer();
 $scope.curTickets = $scope.tickets;
 deferred.resolve(Ticket.tickets.query());
 var promise = deferred.promise;

 promise.then(function(newTickets){
  $scope.newTickets = newTickets;
  if($scope.curTickets != $scope.newTickets){
    $scope.tickets = $scope.newTickets;
    console.log('newtickets!');
  } else {
    console.log('no newtickets');
  }
 });

},90000);

A: As mentioned in https://stackoverflow.com/a/201471/3878940, there is no definite way of comparing the equality of 2 objects in JavaScript. So, you may need to look for an alternative approach to recursively compare the values of the response object by writing a custom method.


text:
Q: Can i use Amazon Kinesis to connect to amazon redshift for data load in every couple of mins From lots of sources i am planning to use Amazon kinesis to catch the stream and after certain level of data transformation i want to direct the stream to Redshift Cluster in some table schema. Here i am not sure as is it right way to do this or not ?
From the Kineis documentation i have found that they have direct connector to redshift. However i have also found that Redshift looks better if we take bulk upload as data ware house system needs indexing. So the recommendation was to store all stream to S3 and then COPY command to make bulk push on redshift . Could someone please add some more view ?

A: When you use the connector library for Kinesis you will be pushing data into Redshift, both through S3 and in batch.
It is true that calling INSERT INTO Redshift is not efficient as you are sending all the data through a single leader node instead of using the parallel power for Redshift that you get when running COPY from S3.
Since Kinesis is designed to handle thousands of events per second, running a COPY every few seconds or minutes will already batch many thousands of records.
If you want to squeeze the juice from Kinesis and Redshift, you can calculate exactly how many shards you need, how many nodes in Redshift you need and how many temporary files in S3 you need to accumulate from Kinisis, before calling the COPY command to Redshift.


text:
Q: Joint density multivariate normal distribution Let $X_1,\cdots,X_n$ be independent normal random variables with finite expectation and variance. Then for each $i$ we have $f_{X_i}(x)=\frac{1}{\sqrt{2\pi\sigma^2}}exp(-\frac{(x_i-\mu)^2}{2\sigma^2})$, for all $x\in\mathbb{R}$.
Derive the joint density function of $X_1,\cdots X_n$ and the conditional expectation of $X_n$ given $X_1=x_1,\cdots X_{n-1}=x_{n-1}$ for any $x_1,\cdots x_{n-1}\in\mathbb{R}$.
For the first part I have $f_{X_1,\cdots X_n}=f_{X_1}\times\cdots\times f_{X_n} $ due to independence and this gives an overall joint density of $\frac{1}{\sqrt(2\pi\sigma^2)^n)}exp(-\frac{1}{2\sigma^2}[(x_1-\mu)^2+\cdots +(x_n-\mu)^2])$.
I have no idea about the second part.

A: You are assmuing that $X_i$'s are also identically distributed. Is that given to you? If so your answer for the first part is correct. [Otherwise, the means and variances can  depend on $i$].
Since $X_i$'s are independent we have $E(X_n|X_1=x_1,...,X_{n-1}=x_{n-1})=EX_n$.


text:
Q: Memory usage of a single process with psutil in python (in byte) How to get the amount of memory which has been used by a single process in windows platform with psutil library? (I dont want to have the percentage , I want to know the amount in bytes)
We can use:
psutil.virtual_memory().used

To find the memory usage of the whole OS in bytes, but how about each single process?
Thanks,

A: Call memory_info_ex:
>>> import psutil
>>> p = psutil.Process()
>>> p.name()
'python.exe'

>>> _ = p.memory_info_ex()
>>> _.wset, _.pagefile
(11665408, 8499200)

The working set includes pages that are shared or shareable by other processes, so in the above example it's actually larger than the paging file commit charge.
There's also a simpler memory_info method. This returns rss and vms, which correspond to wset and pagefile.
>>> p.memory_info()
pmem(rss=11767808, vms=8589312)

For another example, let's map some shared memory.
>>> import mmap
>>> m = mmap.mmap(-1, 10000000)
>>> p.memory_info()
pmem(rss=11792384, vms=8609792)

The mapped pages get demand-zero faulted into the working set.
>>> for i in range(0, len(m), 4096): m[i] = 0xaa
...
>>> p.memory_info()
pmem(rss=21807104, vms=8581120)

A private copy incurs a paging file commit charge:
>>> s = m[:]
>>> p.memory_info()
pmem(rss=31830016, vms=18604032)


text:
Q: Oracle build order and PL/SQL package dependencies I'm trying to build up a list of PL/SQL package dependencies so that I can help set up an automated build script for my packages to run on the test server. Is there a way to start with a single package (a "root" package identified by name, ideally) and then find all of the dependencies, and the order they must be compiled in?
Dependencies are already fully resolved in my personal schema (so at least I have somewhere to start - but where do I go next?).
(Oracle 10.2)
EDIT:
The build tool that is being used will use the build order and will retreive those files in order from source control, and then pass them to Oracle to compile (the actual build tool itself is written in Python or Java or both - I don't have access to the source). Basically, the build tool needs as input a list of files to compile in the order they must be compiled in, and acces to those files in source control. If it has that, everything will work quite nicely.
EDIT:
Thanks for the neat scripts. Unfortunately, the build process is mostly out of my hands. The process is based around a build tool which was built by the vendor of the product we are integrating with, which is why the only inputs I can give to the build process are a list of files in the order they need to be built in. If there is a compiler error, the build tool fails, we have to manually submit a request for a new build. So a list of files in the order they should be compiled is important.
EDIT:
Found this: http://www.oracle.com/technology/oramag/code/tips2004/091304.html
Gives me the dependencies of any object. Now I just need to get the ordering right... If I get something working I'll post it here.
EDIT: (with code!)
I know that in general, this sort of thing is not necessary for Oracle, but for anyone who's still interested...
I have cobbled together a little script that seems to be able to get a build order such that all packages will be built in the correct order with no dependency-related errors (with respect to pacakges) the first time around:
declare

    type t_dep_list is table of varchar2(40) index by binary_integer;
    dep_list t_dep_list;
    i number := 1;
    cursor c_getObjDepsByNameAndType is
    --based on a query found here: http://www.oracle.com/technology/oramag/code/tips2004/091304.html
        select lvl, u.object_id, u.object_type, LPAD(' ', lvl) || object_name obj
        FROM (SELECT level lvl, object_id
               FROM SYS.public_dependency s
               START WITH s.object_id = (select object_id
                                         from user_objects
                                         where object_name = UPPER(:OBJECT_NAME)
                                               and object_type = UPPER(:OBJECT_TYPE))
               CONNECT BY s.object_id = PRIOR referenced_object_id
               GROUP BY level, object_id) tree, user_objects u
        WHERE tree.object_id = u.object_id
              and u.object_type like 'PACKAGE%' --only look at packages, not interested in other types of objects
        ORDER BY lvl desc;

    function fn_checkInList(in_name in varchar2) return boolean is
    begin
        for j in 1 .. dep_list.count loop
            if dep_list(j) = in_name then
                return true;
            end if;
        end loop;
        return false;
    end;

    procedure sp_getDeps(in_objID in user_objects.object_id%type, in_name in varchar2) is
        cursor c_getObjDepsByID(in_objID in user_objects.object_id%type) is
        --based on a query found here: http://www.oracle.com/technology/oramag/code/tips2004/091304.html
            select lvl, u.object_id, u.object_type, LPAD(' ', lvl) || object_name obj
            FROM (SELECT level lvl, object_id
                   FROM SYS.public_dependency s
                   START WITH s.object_id = (select uo.object_id
                                             from user_objects uo
                                             where uo.object_name =
                                                   (select object_name from user_objects uo where uo.object_id = in_objID)
                                                   and uo.object_type = 'PACKAGE BODY')
                   CONNECT BY s.object_id = PRIOR referenced_object_id
                   GROUP BY level, object_id) tree, user_objects u
            WHERE tree.object_id = u.object_id
                  and u.object_id <> in_objID --exclude self (requested Object ID) from list.
            ORDER BY lvl desc;
    begin
        --loop through the dependencies
        for r in c_getObjDepsByID(in_objID) loop
            if fn_checkInList(trim(r.obj)) = false and (r.object_type = 'PACKAGE' or r.object_type = 'PACKAGE BODY') and
               trim(r.obj) <> trim(in_name) then
                dbms_output.put_line('checking deps of: ' || r.obj || ' ' || r.object_id || ' level: ' || r.lvl);
                --now for each dependency, check the sub-dependency
                sp_getDeps(r.object_id, trim(r.obj));
                --add the object to the dependency list.
                dep_list(i) := trim(r.obj);
                i := i + 1;
            end if;
        end loop;
    exception
        when NO_DATA_FOUND then
            dbms_output.put_line('no more data for: ' || in_objID);
    end;

begin

    for r in c_getObjDepsByNameAndType loop
        dbms_output.put_line('top-level checking deps of: ' || r.obj || ' ' || r.object_id || ' level: ' || r.lvl);
        sp_getDeps(r.object_id, trim(r.obj));
    end loop;

    dbms_output.put_line('dep count: ' || dep_list.count);
    for j in 1 .. dep_list.count loop
        dbms_output.put_line('obj: ' || j || ' ' || dep_list(j));
    end loop;
end;

I know it's not the prettiest code (globals all over the place, etc... ugh), and I'll probably repost it if I can get a chance this afternoon to clean it up, but right now, it produces a build order that seems to run the first time with no problems.
:OBJECT_NAME should be the root object that you want to trace all dependencies and build order of. For me, this is a main package with a single method that is the entry point to the rest of the system.
:OBJECT_TYPE I have mostly restricted to PACKAGE BODY, but it shouldn't be too much work to include other types, such as triggers.
One last thing, the object specified by :OBJECT_NAME will not appear in the output, but it should be the last item, so you'll have to add that to your build list manually.
UPDATE: I just discovered user_dependencies and all_dependencies, this code could probably be made much simpler now.

A: Look at the following script from http://www.oracle-base.com/articles/misc/RecompilingInvalidSchemaObjects.php
SET SERVEROUTPUT ON SIZE 1000000
BEGIN
  FOR cur_rec IN (SELECT owner,
                         object_name,
                         object_type,
                         DECODE(object_type, 'PACKAGE', 1,
                                             'PACKAGE BODY', 2, 2) AS recompile_order
                  FROM   dba_objects
                  WHERE  object_type IN ('PACKAGE', 'PACKAGE BODY')
                  AND    status != 'VALID'
                  ORDER BY 4)
  LOOP
    BEGIN
      IF cur_rec.object_type = 'PACKAGE' THEN
        EXECUTE IMMEDIATE 'ALTER ' || cur_rec.object_type ||
            ' "' || cur_rec.owner || '"."' || cur_rec.object_name || '" COMPILE';
      ElSE
        EXECUTE IMMEDIATE 'ALTER PACKAGE "' || cur_rec.owner ||
            '"."' || cur_rec.object_name || '" COMPILE BODY';
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
        DBMS_OUTPUT.put_line(cur_rec.object_type || ' : ' || cur_rec.owner ||
                             ' : ' || cur_rec.object_name);
    END;
  END LOOP;
END;
/

A: If you're really dealing with just PL/SQL packages you do not need to sweat the build order.  Just build all the package specifications first.  Then you can deploy all the package bodies and they will compile, because their dependencies are the package specs.
If you happen to have some package specs which do depend on other specs - if you have packages which declare, say, constants, subtypes or ref cursors which are used in the signatures of packaged procedures - then you need to build those package specs first.  But there should be few enough of them that you can arrange them in the build script by hand.
edit

It looks like they wil be doing
  incremental AND "clean-sweep" builds,
  so the build order will matter most
  for when they clean out the
  environment and rebuild it.

That doesn't alter anything.
Here is an extended example.  I have a schema with three packages....
SQL> select object_name, object_type, status
  2  from user_objects
  3  order by 1, 2
  4  /

OBJECT_NAME     OBJECT_TYPE     STATUS
--------------- --------------- -------
PKG1            PACKAGE         VALID
PKG1            PACKAGE BODY    VALID
PKG2            PACKAGE         VALID
PKG2            PACKAGE BODY    VALID
PKG3            PACKAGE         VALID
PKG3            PACKAGE BODY    VALID

6 rows selected.

SQL>

The interesting thing is that a procedure in PKG1 calls a procedure from PKG2, a procedure in PKG2 calls a procedure from PKG3 and a procedure in PKG3 calls a procedure from PKG1.
Q.  How does that circular dependency work?
A.  It's not a circular dependency....
SQL> select name, type, referenced_name, referenced_type
  2  from user_dependencies
  3  where referenced_owner = user
  4  /

NAME            TYPE            REFERENCED_NAME REFERENCED_TYPE
--------------- --------------- --------------- ---------------
PKG1            PACKAGE BODY    PKG1            PACKAGE
PKG1            PACKAGE BODY    PKG2            PACKAGE
PKG2            PACKAGE BODY    PKG2            PACKAGE
PKG2            PACKAGE BODY    PKG3            PACKAGE
PKG3            PACKAGE BODY    PKG3            PACKAGE
PKG3            PACKAGE BODY    PKG1            PACKAGE

6 rows selected.

SQL>

All the dependent objects are the package bodies, all the referenced objects are the packaged specs.  Consequently, if I trash'n'rebuild the schema it really doesn't matter what order I use.  First we trash ...
SQL> drop package pkg1
  2  /

Package dropped.

SQL> drop package pkg2
  2  /

Package dropped.

SQL> drop package pkg3
  2  /

Package dropped.

SQL>

Then we rebuild ...
SQL> create or replace package pkg3 is
  2      procedure p5;
  3      procedure p6;
  4  end pkg3;
  5  /

Package created.

SQL> create or replace package pkg2 is
  2      procedure p3;
  3      procedure p4;
  4  end pkg2;
  5  /

Package created.

SQL> create or replace package pkg1 is
  2      procedure p1;
  3      procedure p2;
  4  end pkg1;
  5  /

Package created.

SQL> create or replace package body pkg2 is
  2      procedure p3 is
  3      begin
  4          pkg3.p5;
  5      end p3;
  6      procedure p4 is
  7      begin
  8          dbms_output.put_line('PKG2.P4');
  9      end p4;
 10  end pkg2;
 11  /

Package body created.

SQL> create or replace package body pkg3 is
  2      procedure p5 is
  3      begin
  4          dbms_output.put_line('PKG3.P5');
  5      end p5;
  6      procedure p6 is
  7      begin
  8          pkg1.p1;
  9      end p6;
 10  end pkg3;
 11  /

Package body created.

SQL> create or replace package body pkg1 is
  2      procedure p1 is
  3      begin
  4          dbms_output.put_line('PKG1.P1');
  5      end p1;
  6      procedure p2 is
  7      begin
  8          pkg2.p4;
  9      end p2;
 10  end pkg1;
 11  /

Package body created.

SQL>

The order of the individual objects is irrelevant.  Just build the package specs before the package bodies.  Although even that does not really matter...
SQL> create or replace package pkg4 is
  2      procedure p7;
  3  end pkg4;
  4  /

Package created.

SQL> create or replace package body pkg4 is
  2      procedure p7 is
  3      begin
  4          dbms_output.put_line('PKG4.P7::'||constants_pkg.whatever);
  5      end p7;
  6  end pkg4;
  7  /

Warning: Package Body created with compilation errors.

SQL> show errors
Errors for PACKAGE BODY PKG4:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/9      PL/SQL: Statement ignored
4/43     PLS-00201: identifier 'CONSTANTS_PKG.WHATEVER' must be declared
SQL>

PKG4 is INVALID because we have not built CONSTANTS_PKG yet.
SQL> create or replace package constants_pkg is
  2      whatever constant varchar2(20) := 'WHATEVER';
  3  end constants_pkg;
  4  /

Package created.

SQL> select object_name, object_type, status
  2  from user_objects
  3  where status != 'VALID'
  4  order by 1, 2
  5  /

OBJECT_NAME     OBJECT_TYPE     STATUS
--------------- --------------- -------
PKG4            PACKAGE BODY    INVALID

SQL>
SQL> set serveroutput on size unlimited
SQL> exec pkg4.p7
PKG4.P7::WHATEVER

PL/SQL procedure successfully completed.

SQL> select object_name, object_type, status
  2  from user_objects
  3  where status != 'VALID'
  4  order by 1, 2
  5  /

no rows selected

SQL>

Anything built using CREATE OR REPLACE is always created, it is just marked as INVALID if there are errors.  As soon as we execute it, directly or indirectly, the database compiles it for us.  So, order does not matter.  Really it doesn't.
If the idea of finishing a build with invalid objects concerns you - and I have some sympathy with that, we are told not to live with broken windows - you can use the utlrp script or in 11g the UTL_RECOMP package; either approach requires a SYSDBA account.
edit 2

The process is based around a build
  tool which was built by the vendor of
  the product we are integrating with,
  which is why the only inputs I can
  give to the build process are a list
  of files in the order they need to be
  built in. If there is a compiler
  error, the build tool fails, we have
  to manually submit a request for a new
  build.

This is a political problem not a technical one.  Which isn't to say that political problems can't be resolved with a technical fix, just that the technical fix is not the best tool for the job.  Good luck.

A: One little thing to watch out for when walking the dependency tree.  Dependencies for uncompiled programs don't show...
SQL> drop package constants_pkg
  2  /

Package dropped.

SQL> create or replace package body pkg4 is
  2      procedure p7 is
  3      begin
  4          dbms_output.put_line('PKG4.P7::'||zzz_constants_pkg.whatever);
  5      end p7;
  6  end pkg4;
  7  /

Warning: Package Body created with compilation errors.

SQL> show errors
Errors for PACKAGE BODY PKG4:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/9      PL/SQL: Statement ignored
4/43     PLS-00201: identifier 'ZZZ_CONSTANTS_PKG.WHATEVER' must be
         declared

SQL>

So, the body for PKG4 is INVALID because ZZZ_CONSTANTS_PKG doesn't exist.
SQL> create or replace package zzz_constants_pkg is
  2      whatever constant varchar2(20) := 'WHATEVER';
  3  end zzz_constants_pkg;
  4  /

Package created.

SQL>

But the body for PKG4 is still INVALID so the following query does not return its dependency on ZZZ_CONSTANTS_PKG  ....
SQL> select name, type, referenced_name, referenced_type
  2  from user_dependencies
  3  where referenced_owner = user
  4  /

NAME            TYPE            REFERENCED_NAME   REFERENCED_TYPE
--------------- --------------- ----------------- ---------------
PKG1            PACKAGE BODY    PKG1              PACKAGE
PKG1            PACKAGE BODY    PKG2              PACKAGE
PKG2            PACKAGE BODY    PKG2              PACKAGE
PKG2            PACKAGE BODY    PKG3              PACKAGE
PKG3            PACKAGE BODY    PKG3              PACKAGE
PKG3            PACKAGE BODY    PKG1              PACKAGE
PKG4            PACKAGE BODY    PKG4              PACKAGE

7 rows selected.

SQL>

Now let's compile PKG4 and re-query the dependencies ....
SQL> alter package pkg4 compile body;

Package body altered.

SQL> select name, type, referenced_name, referenced_type
  2  from user_dependencies
  3  where referenced_owner = user
  4  /

NAME            TYPE            REFERENCED_NAME   REFERENCED_TYPE
--------------- --------------- ----------------- ---------------
PKG1            PACKAGE BODY    PKG1              PACKAGE
PKG1            PACKAGE BODY    PKG2              PACKAGE
PKG2            PACKAGE BODY    PKG2              PACKAGE
PKG2            PACKAGE BODY    PKG3              PACKAGE
PKG3            PACKAGE BODY    PKG3              PACKAGE
PKG3            PACKAGE BODY    PKG1              PACKAGE
PKG4            PACKAGE BODY    PKG4              PACKAGE
PKG4            PACKAGE BODY    ZZZ_CONSTANTS_PKG PACKAGE

8 rows selected.

SQL>

A: You don't need a build order - just build the packages with "CREATE OR REPLACE..." on a file-by-file basis and then compile them in a two-level nested loop - each pass in the inner loop compiles everything that is still invalid and the outer loop is used to check the count of remaining invalid objects and set some sort of threshold for maximum executions of the inner loop.  In practice, I've never seen the number of passes needed be higher than three.
If you have multiple schemas involved in the dependencies, look into running Oracles utlrp.sql script, which works across schemas and sets up some infrastructure to manage the process - this needs a privileged account however.
Also, if you extend your source control to include views, be sure that the scripts use "CREATE OR REPLACE FORCE VIEW... " to create views which have unmet dependencies at the time of their creation.
Example script that I use:
set serveroutput on
declare
 cursor invalidObjCur is
  select object_name, object_type
    from user_objects
    where status <> 'VALID'
    ;
 compileStmt varchar2(4000);
 passCount pls_integer := 0;
 maxPasses pls_integer := 5;
 lastInvalidCount pls_integer := 32000;
 objectCount pls_integer;
 continue boolean := TRUE;

begin
 dbms_output.enable(1000000);
 while (continue) loop
   passCount := passCount + 1;
   dbms_output.put_line('Pass '||passCount);
   objectCount := 0;
   for curRow in InvalidObjCur loop
    if curRow.object_type = 'PACKAGE BODY' then
        compileStmt := 'alter PACKAGE '||curRow.object_name||' compile body';
    else
        compileStmt := 'alter '||curRow.object_type||' '||
        chr(34)||curRow.object_name||chr(34)||' compile';
    end if;
    begin
      execute immediate compileStmt;
    exception when others then
      null;
    end;
   objectCount := objectCount + 1;
   end loop;
   dbms_output.put_line('Recompilations attempted: '||objectCount);
   continue := (passCount < maxPasses) and (objectCount < lastInvalidCount);
   lastInvalidCount := objectCount;
 end loop;
dbms_output.put_line('***** Remaining Invalid ********');
for curRow in InvalidObjCur loop
 dbms_output.put_line(curRow.object_type||' '||curRow.object_name);
end loop;
dbms_output.put_line('********************************');
end;
/

A: Add the following command to the top of your script:
SET VERIFY OFF
this will allow your scripts to run without validation and therefore can be run in any order.
You can later query DBA_ERRORS to get all errors and warnings in your packages, views and types.

A: Try this instead for 11.1 and up.  Run the script in any order.
At the end issue the following command:
(Change the command parameters to suit your needs)
-- Compile invalid objects
EXEC DBMS_UTILITY.compile_schema(USER, FALSE);

More details on DBMS_UTILITY.compile_scema

A: Actual solution: The script above seems to give the correct build order. Could probably be rewritten "nicer", but I'll leave that as an exercise to the reader. ;)
After some discussion, the build tool will perform n (4, actually) builds in a row before reporting errors. This would also help resolve dependency compile errors if the build order is wrong, but I'd rather just get the build order right the first time around.


text:
Q: Vertical slideshow-type of menu Click me to see schematic
I'm trying to build a simple sliding vertical menu - several divs (#sliderOption_) inside a div container (sliderContainer). Two arrows (up/down) will control the sliding effect.
I need the divs inside the slider to move 80px (#optionMenu_* height) vertically, up or down. I want the css (namely border radius) for the divs, that are actually inside the visible area of the sliderContainer, to change according to their order (1st, 2nd and 3rd - see picture). The middle item will be the one that will trigger other stuff to happen - the #btn? corresponding should appear for that purpose.
Ive been checking other posts, but can't get a solution for my case...
Html structure:

Up

Down

 Option menu 1
1

 Option menu 2
2

 Option menu 3
3

 Option menu 4
4

 Option menu 5
5

 Option menu 6
6

 Option menu 7
7

I really want the most possible simple thing - no external libraries (if possible).
Here's a jsFiddle with all the elements.
Any help appreciated.
Thanx.
Pedro

A: I have updated your example check it here.
i just add one div that contain your optionMenu and some jQuery magic.
explanation :

//add just wrapper to your .optionMenu divs
    ......
    ......

//end div #sliderContainerInside

in css add the following :
.sliderContainerInside {
    position:absolute;
    top:10px;
}
#sliderContainer{
      ......
      ......
      position:relative;
}

In JS :
$("#upBtn").on('click', function () {
    // slide all optionMenu_* up by 80px
    var maxUp = ($('div.optionMenu').length - 3) * 90;//now get the max px that our .sliderContainerInside can have as top(css) value. Notice that (3) represent the number of divs that 'll be visible to the user and (90) is the optionMenu height plus the value of top padding(10)
    if (-maxUp < parseInt($('.sliderContainerInside').css('top')) - 10) {
        $('.sliderContainerInside').css('top', parseInt($('.sliderContainerInside').css('top')) - 90 + 'px');
    }
    //console.info($('.sliderContainerInside').css('top') - 80);
});