text:
Q: Trouble with implementing random words in a char array I've been working on a program that creates a word search based on user inputted words and parameters. Basically the idea is to create something similar to this:
Enter number of rows
8
Enter number of columns
7
Enter words
cat
dog
the program would then generate a word search with 8 rows, 7 columns, and would include the words cat and dog. The program would generate these words diagonally, horizontally and vertically within the given constraints.
I don't want an answer or for this to be done for me, but rather am interested in being pointed in the right direction.
Attached below is the most recent code that I have to give everyone an idea.
Again, all that I am asking for is for is a start in the right direction.
Thanks for any and all help!
public void fillArray() {Scanner sc = new Scanner(System.in);

    System.out.println("How many rows would you like? >");
    int row = sc.nextInt();

    System.out.println("How many columns would you like? >");
    int col = sc.nextInt();

    String word = sc.next();
    String testString = word;
    char[] stringToCharArray = testString.toCharArray();

    System.out.println(testString.toCharArray());

    int[][] arrayRC = new int[row][col];

    for (int i = 0; i < row + 1; i++) {
        for (int j = 0; j < col + 1; j++) {
            if (j < col && i < row) {
                arrayRC[i][j] = (int) ((Math.random() * 26) + 1);

                char alphabet;
                switch (arrayRC[i][j]) {
                    case 1:
                        alphabet = 'a';
                        break;
                    case 2:
                        alphabet = 'b';
                        break;
                    case 3:
                        alphabet = 'c';
                        break;
                    case 4:
                        alphabet = 'd';
                        break;
                    case 5:
                        alphabet = 'e';
                        break;
                    case 6:
                        alphabet = 'f';
                        break;
                    case 7:
                        alphabet = 'g';
                        break;
                    case 8:
                        alphabet = 'h';
                        break;
                    case 9:
                        alphabet = 'i';
                        break;
                    case 10:
                        alphabet = 'j';
                        break;
                    case 11:
                        alphabet = 'k';
                        break;
                    case 12:
                        alphabet = 'l';
                        break;
                    case 13:
                        alphabet = 'm';
                        break;
                    case 14:
                        alphabet = 'n';
                        break;
                    case 15:
                        alphabet = 'o';
                        break;
                    case 16:
                        alphabet = 'p';
                        break;
                    case 17:
                        alphabet = 'q';
                        break;
                    case 18:
                        alphabet = 'r';
                        break;
                    case 19:
                        alphabet = 's';
                        break;
                    case 20:
                        alphabet = 't';
                        break;
                    case 21:
                        alphabet = 'u';
                        break;
                    case 22:
                        alphabet = 'v';
                        break;
                    case 23:
                        alphabet = 'w';
                        break;
                    case 24:
                        alphabet = 'x';
                        break;
                    case 25:
                        alphabet = 'y';
                        break;
                    case 26:
                        alphabet = 'z';
                        break;
                    default:
                        alphabet = '-';
                        break;
                }
                System.out.print(alphabet);

            } else {
                System.out.println();
            }
        }
    }
}

A: I believe the following will work (as you can guess, I have not tried it out).
I would use a 2D array of char, not int. The initial value of each field will be '\0', we are going to use that. I would fit in the words first and the random fill letters afterwards. To fill in a word, first select a random direction or orientation (vertical, horizontal or diagonal). It's not clear to me whether you want 3, 5 or 8 directions, but as long as you know… The direction sets some limits on where a word can begin, e.g., a horizontal word of length 3 may begin in the bottom row, but at least 3 positions from the right edge; a vertical word cannot begin at the bottom. Pick a random start square from within the possible ones. See if there is a conflict with letters already filled in. Remember: you may fill in 'c' in a field if either it already contains 'c' or '\0', not if it contains another letter. Only if no letter in the word conflicts, fill in all the letters. In case of a conflict, try another start square. If after, say, 100 attempts you still cannot fill in the word, give up and tell the user you cannot fill in all the words.
After you've filled in all the words, put a random letter in all fields that don't already hold a letter.
An issue is that the final filling in of random letters may accidentally spell, say, cat in one more place so it ends being in there twice. Decide if you can live with that.
EDIT: To choose a letter at random, rather than you long switch statement I would recommend something like
private static final char[] LETTERS = "abcdefghijklmnopqrstuvwxyz".toCharArray();
private static final Random RAND = new Random();

private static char getRandomLetter() {
    int randomIndex = RAND.nextInt(LETTERS.length);
    return LETTERS[randomIndex];
}


text:
Q: Controlling the decimal position of the uncertainty while using multi-part-units in siunitx How can I write the following without \pm?

(66 ± 4.4) s

I can achieve the same result with \SI[separate-uncertainty=true]{66 \pm 4.4}{\second}, but I thought the plus-minus symbol could be inserted automatically by using multi-part-units. Here's what I tried:
\SI[separate-uncertainty=true,multi-part-units=brackets]{66(4.4)}{\second}
\SI[separate-uncertainty=true,multi-part-units=brackets]{66(44e-1)}{\second}
\SI[separate-uncertainty=true,multi-part-units=brackets]{66(44)}{\second}
\SI[separate-uncertainty=true,multi-part-units=brackets]{66.0(4.4)}{\second}

The problem seems to be getting the decimal in there. I can't seem to find the relevant information in the siunitx documentation.

A: The 'short' uncertainty format understood by siunitx is based around the idea that the magnitude of the bracketed value is relative to the number of figures in the main value. Thus \num{66(44)} is equivalent to \num{66 \pm 44}, while \num{66.0(44)} is the same as \num{66.0 \pm 4.4}. Notice the additional significant figure in the second pairing.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Preg_match for exact phone number match expected_Phone_number: (888) 888-8888
actual_phone_number: (888) 888-8888

How do I use Preg_match to check if the 2 numbers match.(I need to check if the 2 phone numbers match exactly)

A: If php supports \Q .. \E,  something like
'~^\Q' . $phone_number_expected . '\E$~';

otherwise regex escape the phone number
'~^' . preg_quote($phone_number_expected, '~') . '$~';

or just do a string compare


text:
Q: bazel build target that collects multiple libraries I am not able to archive multiple libraries into a single library, for example :
cc_library(
name = "lib1",
srcs = ["src1.c"]
)

cc_library(
name = "lib2",
srcs = ["src2.c"]
)

cc_library(
name = "release-lib",
srcs = [":lib1",":lib2"]

when I run bazel build //release-lib
it will through INFO: Found 1 target...
target //release-lib up-to-date
but the target is never built in bazel-out
of course lib1,lib2 are added to linking command if I ever use release-lib as a dep for a cc_binary rule, however my final target is to have a whole archive of multiple libraries
is there a way to forcibly make bazel create and build this target !?

A: As a rule of thumb, cc_library is only useful for including into a top-level target that performs the fully transitive link such as cc_binary. Building a transitive static library is not currently within the repertoire of the builtin Bazel C++ rules. However, there is a an extension rule to do it available here: https://gist.github.com/oquenchil/3f88a39876af2061f8aad6cdc9d7c045 One can also follow along https://github.com/bazelbuild/bazel/issues/1920 for the full sordid history.


text:
Q: Django - Edit templates from django admin Can I save templates in my db and edit them from django-admin?
My idea is to create a model for templates:
class DbTemplate(models.Model):
    css_class = models.CharField(max_length=200)
    name = models.CharField(max_length=200)
    content = models.TextField()

    class Meta:
        verbose_name = "Database Template"
        verbose_name_plural = "Database Templates"

    def __str__(self):
        return self.name

and register it in django-admin:
from .models import DbTemplate

admin.site.register(DbTemplate)

in my urls.py set a default view for r"^page/" that load the correct template, is this possible?
Thanks!

A: You might need to render templates manually in your views and return the resulting HttpResponse. Here is a rough example (which you should modify according to your use case):
from django.template import Context, Template
from django.http import HttpResponse

def my_view(request):
    ...
    context = {'value': something, 'another_var': something_else}
    # Here, instead of returning `render`, render the template using the context manually
    template_content = DbTemplate.objects.get(name='my_template').content
    template = Template(template_content)
    return HttpResponse(template.render(Context(context)))


text:
Q: Will it work long term? (Induction cooker 16 amp to 10 amp adaptor) Is it safe if I use two adaptors (13 amp and 10 amp) for my 16 amp induction cooker?  I can only plug it on a 220 v outlet.  The first adaptor has a switch though.  The induction cooker worked when I tried but I'm not sure if it can last a long time or if the cooker remains on for long periods.

A: No. It likely won't even work SHORT-term.
We have no clue what you mean by "adapter". Even if your question were properly detailed, the answer would probably remain a solid NO.

A: The only way this could work is if your induction cooker can be configured to draw only 13A. This would make it possible to use without an adaptor. Anything else is quite likely to cause a fire.


text:
Q: GRANT PROCESS with Ansible mysql_user module I need to grant ALL PRIVILEGES on a specific database as well as PROCESS rights to a mysql user.
I have tried a number of combinations, but none of them work:
mysql_user: priv="{{ item.name | regex_replace ('[.-]', '_') }}.*:ALL/PROCESS" login_host="{{mysql.endpoint.address}}" login_port=3306 login_user="{{mysql_root_user}}" login_password="{{mysql_root_password}}" name="{{item.user}}" password="{{item.password}}" host=% state=present

Result: "invalid privileges string: list index out of range"
mysql_user: priv="{{ item.name | regex_replace ('[.-]','_') }}.*:ALL/{{ item.name | regex_replace ('[.-]','_') }}.*:PROCESS" login_host="{{mysql.endpoint.address}}" login_port=3306 login_user="{{mysql_root_user}}" login_password="{{mysql_root_password}}" name="{{item.user}}" password="{{item.password}}" host=%  state=present

Result: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
mysql_user: priv="{{ item.name | regex_replace ('[.-'_') }}.*:ALL,PROCESS" login_host="{{mysql.endpoint.address}}" login_port=3306 login_user="{{mysql_root_user}}" login_password="{{mysql_root_password}}" name="{{item.user}}" password="{{item.password}}" host=%  state=present

(from https://stackoverflow.com/a/50785241/123594 - I'm feeling desperate)
Result: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PROCESS ON ...
How do I GRANT PROCESS rights to a user with Ansible mysql_user?

A: Your issue is coming from the fact that, unlike the other question your are pointing at, you are trying to GRANT the PROCESS privilege to a specific database, and this is not possible in MySQL.
An example from the MySQL command line right away:
mysql> GRANT PROCESS ON my_db.* TO usr;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

This happens because the PROCESS privilege is a global one, so it can only be granted to *.*.

Administrative privileges enable users to manage operation of the MySQL server. These privileges are global because they are not specific to a particular database.

Source: https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html
So you will have to separate the GRANT for PROCESS and for ALL.

This can still be achieved in a single task using this syntax:

Multiple privileges can be specified by separating each one using a forward slash: db.table:priv/db.table:priv.

Source: https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_user_module.html#parameter-priv
So your privileges ends up being:
"{{ item.name | regex_replace ('[.-]', '_') }}.*:ALL/*.*:PROCESS"

Here is a playbook demonstrating this:
- hosts: all
  gather_facts: no

  tasks:
    - mysql_user:
        priv: >-
          {{ item.name | regex_replace ('[.-]', '_') }}.*:ALL/
          *.*:PROCESS
        login_host: "{{ mysql.endpoint.address }}"
        login_port: 3306
        login_user: "{{ mysql_root_user }}"
        login_password: "{{ mysql_root_password }}"
        name: "{{ item.user }}"
        password: "{{ item.password }}"
        host: "%"
        state: present
      loop:
        - name: my.db
          user: usr
          password: pwd
      vars:
        mysql_root_user: root
        mysql_root_password: root
        mysql:
          endpoint:
            address: mysql

Which give the recap:
PLAY [all] **********************************************************************************************************

TASK [mysql_user] ***************************************************************************************************
changed: [localhost] => (item={'name': 'my.db', 'user': 'usr', 'password': 'pwd'})

PLAY RECAP **********************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

And with the privileges:
mysql> show grants for usr;
+------------------------------------------------+
| Grants for usr@%                               |
+------------------------------------------------+
| GRANT PROCESS ON *.* TO `usr`@`%`              |
| GRANT ALL PRIVILEGES ON `my_db`.* TO `usr`@`%` |
+------------------------------------------------+
2 rows in set (0.00 sec)

A: It's looks not so bad, but not easy to help you and debug with your variables.
Here is what I have to create MySQL users:
  mysql_user:
    name: "{{ db_user }}"
    host: "{{ item }}"
    login_password: "{{ rootpw }}"
    login_unix_socket: /var/lib/mysql/mysql.sock
    login_user: root
    password: "{{ db_pwd }}"
    priv: '{{ db_name }}.*:ALL,GRANT'
    state: present


text:
Q: Is $\mathcal{V}\otimes\mathcal{W}$ defined as a double dual? I've been working through Tensor Spaces and Exterior Algebra by Yokonuma, and he first defines the tensor product of two $k$-vector fields $\mathcal{V}$ and $\mathcal{W}$ as the unique (up to isomorphism) $k$-vector field $\mathcal{U}$ with bilinear mapping $\otimes:\mathcal{V}\times\mathcal{W}\rightarrow\mathcal{U}$ through which we can factor any other bilinear mapping from $\mathcal{V}\times\mathcal{W}$ into a $k$-vector field $\mathcal{U}'$.
He then goes on to offer the definitions (abbreviated for our purposes here) $$\mathcal{V}\otimes\mathcal{W}=\mathscr{L}(\mathcal{V}^*,\mathcal{W}^*;k),$$ together with the mappings $_v\otimes_w\in\mathcal{V}\otimes\mathcal{W}$ defined by $$_v\otimes_w=\langle\phi(v)\psi(w):\phi\in\mathcal{V}^*\wedge \psi\in\mathcal{W}^*\rangle$$ for all $v\in\mathcal{V}$ and $w\in\mathcal{W}$, grouped into the mapping $\otimes:\mathcal{V}\times\mathcal{W}\rightarrow\mathcal{V}\otimes\mathcal{W}$ defined by $$\otimes=\langle_v\otimes_w:(v,w)\in\mathcal{V}\times\mathcal{W}\rangle.$$ He then asserts that $(\mathcal{V}\otimes\mathcal{W},\otimes)$ is a canonical choice for the tensor product of $\mathcal{V}$ and $\mathcal{W}$, as all other choices would be isomorphic in all the important ways mentioned above.
It occurred to me that since $$\mathcal{V}^*=\mathscr{L}(\mathcal{V};k)$$ for any $k$-vector field $\mathcal{V}$, we have that $$\mathcal{V}\otimes\mathcal{W}=\mathscr{L}(\mathcal{V}^*,\mathcal{W}^*;k)=\mathscr{L}\big(\mathscr{L}(\mathcal{V};k),\mathscr{L}(\mathcal{W};k);k\big),$$ so it seems like we are actually defining $\mathcal{V}\otimes\mathcal{W}$ here as a kind of double dual for $\mathcal{V}$ and $\mathcal{W}$.  I was just wondering if this was a correct interpretation, and if so whether there is somewhere I might be able to read more about it -- (finite dimensional) vector spaces are canonically isomorphic to their double duals, but it seems like we are actually taking a double-dual as the definition of a tensor product here, which is of course a vector space. It seems to me like this kind of definition would naturally give rise to the unique factoring properties mentioned at the top in Yokonuma's first definition, but some more in-depth reading on the topic would be greatly appreciated.


text:
Q: Using Enigmail encryption on mutiple devices So I'm relatively new to email encryption and thought I would start out using thunderbird + enigmail to get me started. I've managed to set it up and work with it properly but I'm not sure what to do for me next situation:
I have mutiple computers that I use to access the same email account.
I currently have one key-pair generated for that mail account on computer A
Now I also want to use that same mail account on computer B
How can I have encryption work and have one public key that people can use to communicate with me?
Do I export my private key and import it into my mail client on computer B?
Do I generate a new key-pair for each device? If so how do I prevent encumbiring people with keeping mutiple key pairs so they can decrypt my mail depending on the device I'm using?
Any form of help is greatly appreciated :)

A: "How can I have encryption work and have one public key that people can use to communicate with me? Do I export my private key and import it into my mail client on computer B?"
Yes. Like you & DragonLord said. One public key only has one private key, if you want to decrypt your messages on a (any) device, you need the private key on that device too.


text:
Q: Two entrance times associated with Brownian motion are equal almost surely Let $(W_t)_{t \in \mathbb{R+}}$ be a Wiener process and define two random times for fixed $a>0$.
$S_a = \inf\{t > 0: W_t> a\}$
$T_a = \inf\{t > 0: W_t \geq a\}$
It is well known that $T_a$ is a stopping time with respect to the filtration generated by $(W_t)_{t \in \mathbb{R+}}$, while $S_a$ is not. Anyway the question is to show that $S_a=T_a$ almost surely.
I tried as follows; since $S_a \geq T_a$, we need to show that $P\{S_a > T_a\} = 0$. But $\{S_a > T_a \} = \bigcup_{q \in \mathbb{Q}} \{S_a \geq q\} \cap \{T_a < q\} $ and $\{S_a \geq q\}= \bigcap_{r \in [0,1], r \in \mathbb{Q}}\{W_{qr} \leq a\}$. But I'm stuck as it is sophisticated to express the event $\{T_a < q\}$ as above(a union or intersection of countable events). Any help would be greatly appreciated!

A: As you already noted, it suffices to show that $\mathbb{P}(S_a>T_a)=0$.
Step 1: Show the assertion for $a=0$, i.e. prove that $$S_0 = \inf\{t>0; W_t>0\}$$ satisfies $$\mathbb{P}(S_0>0)=0.$$
Possible approach: Apply Blumenthal's 0-1-law to show that $\mathbb{P}(S_0>0) \in \{0,1\}$. Use the symmetry of Brownian motion (i.e. the fact that $(-W_t)_{t \geq 0}$ is also a Brownian motion) to prove that $\mathbb{P}(S_0>0)=1$ cannot hold true. Hence $\mathbb{P}(S_0>0)=0$.
There are many other possibilites to prove this; it depends a lot on what you know about Brownian motion.
Step 2: Use the strong Markov property and Step 1 to prove the assertion for any $a>0$.


text:
Q: Customised Data Detection with UITextView How can I detect custom data pattern in UITextView, for an example say I have this text in the  UITextView
textView.text = @"Finally you guys won !! @Chock @Sanda #winners #amazing";

I want to get notified when a user tap on word starting with @ or #. Thank You

A: I hope this library will solve your problem :
Reference: https://github.com/rootd/AMAttributedHighlightLabel
AMAttributedHighlightLabel *tweetLabel = [[AMAttributedHighlightLabel alloc] initWithFrame:CGRectMake(..,..,..,..)];
tweetLabel.delegate = self;
tweetLabel.userInteractionEnabled = YES;
tweetLabel.numberOfLines = 0;
tweetLabel.lineBreakMode = NSLineBreakByCharWrapping;
[tweetLabel setString:@"This #is a @test for my #@new http://AMAttributedHighlightLabel.class"];

tweetLabel.textColor = [UIColor lightGrayColor];
tweetLabel.mentionTextColor = [UIColor darkGrayColor];
tweetLabel.hashtagTextColor = [UIColor darkGrayColor];
tweetLabel.linkTextColor = [UIColor colorWithRed:129.0/255.0 green:171.0/255.0 blue:193.0/255.0 alpha:1.0];
tweetLabel.selectedMentionTextColor = [UIColor blackColor];
tweetLabel.selectedHashtagTextColor = [UIColor blackColor];
tweetLabel.selectedLinkTextColor = UIColorFromRGB(0x4099FF);

NSError *error;
regex = [NSRegularExpression regularExpressionWithPattern:@"((@|#)([A-Z0-9a-z(é|ë|ê|è|à|â|ä|á|ù|ü|û|ú|ì|ï|î|í)_]+))|(http(s)?://([A-Z0-9a-z._-]*(/)?)*)" options:NSRegularExpressionCaseInsensitive error:&error];

tweetLabel.regex = regex;

[self.view addSubview:tweetLabel];


text:
Q: Insert/Update Table Locks on SQL Server I have a big table with around 70 columns in SQL Server 2008. A multithreaded .NET application is calling a stored proc on database to insert into / update the table. Frequency is around 3 times a second.
I have made weekly partitions on table since almost every query has a datetime constraint on the table.
Sometimes it takes a long time to insert/update the table. I am suspicious that sometimes INSERTION makes UPDATE wait; sometimes UPDATE makes INSERTION wait. Is it possible?
How can I design the table to avoid such locks? Performance is the main issue here.

A: You're right that you're probably hitting deadlocks causing things to wait. A couple things to check first;

*

*Are your indexes correct?

*If your DB is in 'Full' recovery mode do you need it? Simple recovery really speeds up inserts/updates, but you loose point-in-time restores for backups.

*Are you likely to have multiple threads writing the same record? If not, NOLOCK might be your friend here, but that would mean your data might be inconsitent for a second or two on occasion.


text:
Q: Mono for Android - OpenFileOutput - IllegalArgumentException I'm trying to call OpenFileOutput() function but I'm getting an IllegalArgumentException from the StreamWriter constructor.
The function is called within the method LogFile() of a regular class (not an Activity or Service) which shall be used afterwards by an Activity.
In order to compile the code, I passed to the method an extra Context as a parameter:
public void LogFile(string msg, Context _context)
{
   using (var f = new StreamWriter(
                  _context.OpenFileOutput(filename, FileCreationMode.Append | FileCreationMode.WorldReadable)
                ))
            {
               f.Write(msg);
            }
}// end LogFile().

This context parameter is previously handed over from the Activity to the method using the constructor the method's class:
LogClass flog = new LogClass(this.ApplicationContext);

Any suggestions of what could be missing ?


text:
Q: AjaxControlToolkit Unhandled Exceptions in Asp.net I use a few different AjaxControlToolkit controls. The 4 I use mostly are FilteredTextBoxExtender, CalendarExtender, TextBoxWatermarkExtender, and MaskedEditExtender. Everything works fine once uploaded to the Development Server. However, once on the production server, I get about 3 to 5 emails daily of an unhandled exception and the AjaxControlToolkit is the thing that is always in question. From the looks of it, it usually happens when another control is clicked or if the page is just "sitting" there and not in use. It says that it "Could not Load AjaxControlToolkit.TextBoxWatermarkExtender" or something of that sort.  It doesn't happen to everyone every single day, but enough to think that there is a problem and that it needs to be addressed. As the only developer, I have tried testing this out and the only way I have made it "crash" was by making the page reload as much as possible. After about 100 clicks, it finally said that one of the AjaxControlToolkits extenders couldn't be loaded. Here is the last error message I have received today.
Source:
AjaxControlToolkit
Date and Time:
11/14/2013 1:45 PM
Message:
Could not load control AjaxControlToolkit.TextBoxWatermarkExtender. The script reference(s) of this control was not loaded correctly. If AjaxControlToolkit.config is used, probably this control is not registered properly.
Stack Trace:
at AjaxControlToolkit.ToolkitScriptManager.ValidateScriptReferences() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I have realized that when an error like this occurs, 8-10 times, it's on a PC that is running IE 8.
This is another error that occurs and also looks like that it has something to do with the AjaxControlToolkit because of the Stack Trace.
Source:
mscorlib
Date and Time:
11/14/2013 7:48 AM
Message:
Collection was modified; enumeration operation may not execute.
Stack Trace:
at System.Collections.Generic.List1.Enumerator.MoveNextRare() at System.Linq.Enumerable.All[TSource](IEnumerable1 source, Func`2 predicate) at AjaxControlToolkit.ToolkitScriptManagerCombiner.LoadScriptReferences(HttpContextBase context, String[] bundles) at AjaxControlToolkit.ToolkitScriptManager.LoadScriptReferences(HttpContextBase context, String[] bundles, Boolean forCombineAndMinify) at AjaxControlToolkit.ToolkitScriptManager.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I have researched both of these types of errors but haven't found anything of use. I do know that the 2nd one is caused often when going through a loop and value was changed or something of that sort.
I am using the AjaxControlToolKit extenders in a few gridviews, so is it possible that it fails to load because they are in gridviews? Does anyone have a solution to this? My absolute last resort is to use jQuery to do these functions, but I do not want to do that. Any suggestions are greatly appreciated!

A: I've got the same random errors in production after upgrading a legacy project using an old AjaxControlToolkit (version 7.0725) from .NET 4.0 to .NET 4.8.

Could not load control AjaxControlToolkit.TabContainer. The script  reference(s) of this control was not loaded correctly. If AjaxControlToolkit.config is used, probably this control is not registered properly.

After some troubleshooting we managed to fix the problem changing the code as follows:
From:
        <cc1:ToolkitScriptManager EnablePartialRendering="true" ScriptMode="Release" ID="TSM" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" AsyncPostBackTimeout="360000" LoadScriptsBeforeUI="false" CombineScripts="true" CombineScriptsHandlerUrl="~/CombineScriptsHandler.ashx">
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Path="~/Scripts/jquery-3.2.1.slim.min.js" />
                    <asp:ScriptReference Path="~/bootstrap-3.3.7-dist/js/bootstrap.min.js" />
                </Scripts>
            </CompositeScript>
        </cc1:ToolkitScriptManager>

To:
        <cc1:ToolkitScriptManager ScriptMode="Release" ID="TSM" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" AsyncPostBackTimeout="360000" LoadScriptsBeforeUI="false" CombineScripts="False" />

And moved the JS scripts files to <HEAD>:
<head>
    <script type="text/javascript" src="/Scripts/jquery-3.2.1.slim.min.js"></script>
    <script type="text/javascript" src="/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>

To summarize: removed the attributes EnablePartialRendering, CombineScriptsHandlerUrl and set CombineScripts to false; and moved the individual scripts to the <head> section.


text:
Q: What are the Justice League members' weaknesses? So, I started reading the Justice League comics, and Batman, being Batman, apparently keeps a hidden bunker with a sample of everyone's weakness except Wonder Woman.
Superman's weakness is obviously kryptonite, Wonder Woman's weakness appears to be Superman, and Batman's only known weakness is Batman. What are the weaknesses of the other Justice League members?
Specifically:

*

*Aquaman

*The Flash

*Green Lantern

*Cyborg

Bonus:

*

*Anything else Superman may be vulnerable to

*Any weakness Wonder Woman has had in past/alternate canons

Ultra Mega Bonus:

*

*Batman's weakness

Any canon is fine, but comics would be preferred. The JL from that canon also need not have the same member makeup to count.

A: Batman

*

*Concussions: unless his mask happens to have the inertial dampers of the Starship Enterprise strapped to it, no armour can stop his brain from bouncing around his skull. Area of effect attacks that release large amounts of concussive force will be extremely effective on him, rendering him unconscious or worse.  Repeated head trauma will result in cognitive impairment, rendering him progressively less capable after every such incident.

*Mask: leaves half his face unprotected.  A long-range sniper could easily put a high-velocity bullet (faster than the speed of sound) through his brain stem before he has the chance to react.  Best combined with flash suppressor and a non-reflective lens for the scope.

*Requires air: as a human, Batman needs to breathe, making chemical weapons an obvious choice, Sarin Gas in particular.  Colourless and odourless, the Bat won't have any inkling of being exposed until it's too late.  Carbon monoxide (also odourless) is a viable alternative.

A: This has also been covered somewhat in the animated movie Justice League: Doom, where Batman's computer is hacked by Mirror Man after hiding in the rear view mirror of his Batmobile. Cyborg plays a role in this movie, but he is not a member of the Justice League during the movie, and so is not included in the plans to take advantage of each member's weakness. Aquaman does not appear in the film at all.
Mirror Man uncovers Batman's files on the Justice League's weaknesses, including plans to neutralize them, while acting on orders from Vandal Savage. Vandal Savage modifies these plans to permanently eliminate the Justice League, and then enlists the help of several others to carry out the plans: Cheetah, Star Sapphire, Mirror Man, Bane, Ma'alefa'ak, and Metallo.

*

*Superman is lured to a man holding a gun to his own head on a rooftop, surrounded by a crowd below. The man turns out to be Metallo in disguise. Little did Superman know, the gun Metallo was holding contained a kryptonite round. Metallo shoots Superman with the gun and he falls from the roof to the ground, unable to be operated on by first responders due to his skin being impervious to their medical tools. From this we can deduce that Superman's weakness is kryptonite. We know from other material that Superman is also weak to magic, though that weakness is not exploited in this movie.

*The Flash is lured to a train heist, where Mirror Man has devised a special cage with a woman trapped inside. Flash can reach in and open the cage, but in so doing, triggers a metal spike that gets shot through Flash's wristbone. Attached to this spike is a bomb with a timer and an accelerometer; if Flash does nothing, the bomb will explode. If Flash runs off, and then slows down at all when he's at a safe distance, the bomb will explode. From this we can deduce that The Flash's weakness is his urge to help others, even at the cost of his own safety/life.

*Wonder Woman is lured to a crime scene on a dock where Cheetah lies in wait. Cheetah has nanobots of some kind painted onto her claws in a form of high-tech poison. When this nano poison enters Wonder Woman's bloodstream via a scratch attack from Cheetah, it causes her to hallucinate and see everyone around her as Cheetah. She therefore goes on the attack against everyone she sees. This is dangerous to Wonder Woman because, due to her warrior upbringing, she won't stop fighting until she killed or her heart gives out due to exhaustion/exertion (or wins). From this we can deduce that Wonder Woman's weakness is her lust for battle and disdain for giving up a fight, which could lead to her death by a superior foe or exhaustion.

*The Martian Manhunter is in his human form and out to drink at a bar on the pier with coworkers. A lovely woman (Ma'alefa'ak shape-shifted in disguise) offers him a drink, which he accepts, only to find out that it is laced with magnesium carbonate (a chalky salt). This compound is harmful to Martian biology, and highly flammable, even in water. Ma'alefa'ak uses a lighter to set the Martian Manhunter on fire. This combination will keep him ablaze for days, if not weeks, with no apparent way to put out the fire, and no one around knows anything about Martian physiology to offer any help. From this we can deduce that the Martian Manhunter's weakness is fire. Especially chemical fire.

*Green Lantern is lured to a hostage situation at a mine, where he first attempts to negotiate the miners' release, and then attempts to rescue them by force. In the process, one of the hostage takers is able to detonate a bomb, killing all the miners, including a woman that looks a lot like Carol Ferris (who becomes Star Sapphire, and who was the love interest of Hal Jordan, this movie's Green Lantern). This causes Green Lantern to question his ability to do his job to protect the galaxy and those in need, and to doubt his own willpower (the trait that gives Green Lanterns their strength). Little did he know, the mine was filled with thin vapors of a refined form of Scarecrow's fear gas, and the miners were all robots designed to look like humans. From this we can deduce that Green Lantern's weakness is fear, or anything that can shake his will to continue fighting.

*Batman did not have a plan to neutralize himself stored on his computer in the Batcave, so the plan enacted to kill him must have been one of Bane's and/or Vandal Savage's making. A gardener rushes to the Wayne Manor to tell Alfred and Bruce Wayne (Batman) that someone has vandalized/destroyed the mausoleum holding Batman's parents. Batman is immediately moved into a frenzy and rushes out to the mausoleum. The gardener then reveals himself to be Bane, and proceeds to beat the crap out of Batman, who is both completely unarmed/unprepared and also still in psychological shock after seeing his parents' resting place so desecrated. Bane knocks Batman unconscious, and then buries him alive in his father's casket. From this we can deduce that Batman's weakness is his psychological trauma from the past, specifically involving his parents and their death. Of course, we all know the real truth is that Batman has no weakness, so he was able to overcome Vandal Savage's plans and save the team from their own potential demises.
Since Cyborg and Aquaman are not covered by the movie, I can only posit that Cyborg, being a cyborg and largely an electronic being, could be disabled via an EMP or some kind of advanced computer virus/nanobot technology. Aquaman probably overestimates and isolates himself, seeing himself as above others due to his status as King of Atlantis, whose domain covers nearly 75% of the Earth's surface, and covers much more depth than the realms of Earthlings.
All the Justice League mentioned above are susceptible to magic, especially Superman. Without Doctor Fate or Zatara (or Zatara's daughter) on the team, they don't have much of a defense against magic. Shazam (Captain Marvel) utilizes magic, but as far as I know it's only to transform from his normal child self into Shazam, and to call down magic lightning bolts.

A: Historically, Aquaman was only able to be away from water for an hour.
Exactly what "away from water" means has generally been left up to the writer. I believe some stories from the 1960s and 1970s have shown him "saved" by splashing a glass of water in his face. Also, the actual consequences and mechanism surrounding this were never clear, either. The way it was played, he would presumably just keel over dead once the hour was over, as opposed to beginning to have difficulty breathing, or his (presumed) gills being damaged, or something.
I don't believe this is true in the comics at present - at the very least, I can't recall any recent stories to use this.

A: The basic scenario behind this was covered in the JLA: Tower of Babel storyline, as Jason Baker's comment mentioned. As with most such storylines, plausibility has to be stretched in order to maintain the premise of "X kills the Y group." This leads to some of these things not being true "weaknesses," in the sense of something that negates or bypasses a characters powers, rather than something to which they were never immune in the first place.

*

*The Martian Manhunter's vulnerability is to fire. This is a straightforward sort of weakness, as normally he is inhumanly tough.

*Superman, naturally, is vulnerable to Kryptonite. He is also susceptible to magic. He loses his powers when exposed to a red sun, or pieces of Krypton, depending on the writer.

*The Green lantern is vulnerable to wood or the color yellow, depending on the incarnation.

*Plastic Man is susceptible to very high temperatures (melting) or very low temperatures (freezing). He has also been shown to be vulnerable to chemical agents such as acetone (and possibly other solvents). Whether these are true weaknesses is debatable.

*The Flash has on occasion slipped on ice, been restrained, or been taken out through a variety of other methods. Some make more sense than others. Depending on the writer, when caught unawares the Flash may be as vulnerable as any normal human.

As for Wonder Woman's weaknesses, this answer suggests a very early one, but canonically she does not have weaknesses in the sense that Superman or the Green Lantern do.
Batman is an ordinary human being (most of the time). His strengths and weaknesses come from his psychology, rather than some external source. Is being unwilling to use firearms a weakness?

A: These weaknesses were deduced from YouTube videos about heroes, "Justice League Doom", and common scientific, general, and superhero knowledge.
Aquaman: A silicon puddy about the size as him. The silicon would slowly dehydrate him. A puddy would be hard to move out of.
Green Lantern: There are three ways to defeat him.

*

*Some how distort his vision or blind him.

*Use fear gas to make his ring useless.

*Trap him in a yellow room, in many incarnations of green lantern, he is weak to the color yellow. This is because yellow repres
ents Parralax, the respresentative of fear.
Batman: Use his parents as a distraction to deliver a blow to the windpipe.
Flash: A paralyzing agent like a neurotoxin would make him  unable to dodge projectiles.
Cyborg: Emails containing viruses(Spam) should severely weaken him.
Wonder Woman: A hologram of a villain, her warrior upbringing will tell her to defeat it, yet she can't making her continue to fight it untill exhaustion.
Superman: A red solar lamp would take away his powers.


text:
Q: How does a newly connected client get old messages in AWS IOT Pretty simple scenario.
A message gets published on a topic (by a master device), to which no clients are currently subscribed.
 I am hoping messages published can have a custom expiry time.
So say within this expiry time, a client now connects to this topic.
How would this client receive the message published earlier?
What i am hoping to get as an answer, if it is possible and if so, what does AWS IOT provide to achieve the same.

A: Overall, above answer of @sanket has been true, with one change as follows:
Right now, AWS IoT supports MQTT persistent sessions. Please see following relevant snippet from AWS.
"Persistent sessions store subscription information and pending Quality of Service (QoS) 1 messages in case your devices become disconnected. When a device reconnects, its persistent session resumes and its subscriptions are automatically reinstated. Also, any stored messages are delivered."
Moreover, "Persistent sessions have a default expiry period of one hour. The expiry period begins when the message broker detects that a client disconnects (MQTT disconnect or timeout)."
Reference - How does a newly connected client get old messages in AWS IOT

A: With Any Standard MQTT Broker
You should connect the client with the broker using clean_session flag as False so that after this the broker will maintain your state with itself.
Refer this:- https://www.hivemq.com/blog/mqtt-essentials-part-7-persistent-session-queuing-messages/
This document will fulfill your all queries.
NOTE:
As per standard MQTT spec, above-mentioned rules should be followed by MQTT broker but AWS-IoT broker does not follow this.
AWS-IoT message broker does not support persistent sessions (connections made with the cleanSession flag set to false). The AWS IoT message broker assumes all sessions are clean sessions and messages are not stored across sessions. If an MQTT client attempts to connect to the AWS IoT message broker with the cleanSession set to false, the client will be disconnected.
Possible Solution:
AWS-IoT provides something similar to cleansession flag using DeviceShaddow functionality.
AWS Device Shadows

A: The IOT Core Message Broker supports Persistent session expiry period. By default the messages associated with the session will be stored for 1 hour in case of session disconnects:

The duration for which the message broker stores an MQTT persistent session. The expiry period begins when the message broker detects the session has become disconnected. After the expiry period has elapsed, the message broker terminates the session and discards any associated queued messages. You can adjust this to a value from 1 hour to 7 days by using the standard limit increase process.


text:
Q: rails Routing Error in Rails 3.1 I want to see a list of all companies when pass by reference /users
users_controller.rb:
  def index
    @companies = Company.all
    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @companies }
    end
  end

users/index.html.haml:
%div{:style => "margin:10px" }
  %table{ :class => "table table-striped"}
    %thead
      %tr
        %th
          = t("Logo")
        %th
          = t("company_name")
        %th
          = t("website")
        %th
    %tbody
      - @companies.each do |company|
        %tr
          %td
            - if company.logo?
              = link_to image_tag( company.logo.url, :width => "60", :height => "60"), company
            - else
              = link_to image_tag( "/lg.png", :width => "60", :height => "60"), company
          %td
            = link_to company.name, company_path
          %td
            - if company.website?
              = link_to company.website, company.website
            - else
              = link_to company.name, company_path
          %td
            - if can? :read, company
              = link_to ' '.html_safe + t('Show'), company, :class => 'btn btn-small btn-info'
            - if can? :update, company
              = link_to ' '.html_safe + t('Edit'), edit_company_path(company), :class => 'btn btn-small btn-pencil'
            - if can? :destroy, company
              = link_to ' '.html_safe + t('Destroy'), company, confirm: t('Are you sure'), method: :delete, :class => 'btn btn-small btn-danger'

but when the link get the error:
No route matches {:action=>"show", :controller=>"companies"}

A: Defining a controller won't automatically create a route which can reach that controller. You will need to add the necessary definitions to config/routes.rb. Here's the routing guide.

A: in your users_controller.rb' write
def show
  respond_to do |format|
    format.html{}
    format.json{}
  end
end

and in your route file write
resources :users


text:
Q: #define SOMETHING of type int16_t How does one define different types of ints?
I have the following
struct movCommand
{
    uint8_t type;
    uint8_t order;
    int16_t height;
    uint16_t distance;
    int16_t yaw;
};

and need to define these according to the types they are.
What is the correct syntax for #define when selecting the type for the define?
EDIT :
It looks like my question has been misunderstood.
I want to do this #define LANDING_COMMAND "2"
But I want to set the type of the landing command because it needs to be int16_t

A: You do not use #define for this. You #include <stdint.h>

A: Rather than using the #define directive, I'd use a typedef, which is how the standard-library would define them inside of <stdint.h> (at least on a C99-compatible platform).  If you look in that header, you'll see how they're defined specifically on their platform.  Typical typedefs will be:
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef int int32_t;
//... etc., etc.

There's a lot more typedef's defined inside the header file, including 64-bit types, etc.

A: If you are working with C99, you can use the typedefs from <stdint.h> or <inttypes.h> (and <inttypes.h> might be available even if <stdint.h> is not - in non-C99 compilers).
If they are available (they usually are), all the types you show will be provided by those headers.
In general, a typedef is preferable to a #define.

A: With regards to your new question, the #define is replaced literally with the text you provide. So
#define LANDING_COMMAND "2";

Will replace all uses of LANDING_COMMAND with "2"; in the program text. This is probably not what you want.
First, preprocessing directives are not part of the C language, they're part of the preprocessor. Since they're not part of C, they're not statements, so they don't end with ;. If you leave that in, it will likely cause problems if you intend to do things like func(LANDING_COMMAND);.
Second, "2" is of type char *, which is not convertible to int16_t with any safety. You need to use a literal 2 for the numeric value.
Lastly, to make it type int16_t, you'll need to provide either a cast (((int16_t)2)) or use the macro INT16_C(2) which expands to a literal with the appropriate suffix to make it of size (and type) int16_t. I recommend the latter, but the former should work. The macro INT16_C(2) could be used, but it expands to a literal (with the appropriate suffix) of type int_least16_t, which is close but no cigar. stdint.h only provides macros to make integer constant literals of the [u]int_leastN_t types and the [u]intmax_t types, not more generally for the [u]intN_t or [u]int_fastN_t types. Why they don't is beyond me.

A: include stdint.h gives you 8, 16, 32, and 64 signed and unsigned.
http://en.wikipedia.org/wiki/Stdint.h

A: You can't do what you describe.  Other answers have indicated workarounds.  As for your specific question, from the MSDN site:

Expressions must have integral type
  and can include only integer
  constants, character constants, and
  the defined operator.
The expression cannot use sizeof or a
  type-cast operator.

A: #define doesn't have a type. It's exactly the same as find/replace in your editor.
You can do
#define LANDING_COMMAND 2
...
my_movCommand.yaw = LANDING_COMMAND;

The compiler will do the right type conversions for you, but if you insist on a type int16_t then
#define LANDING_COMMAND ((int16_t)2)


text:
Q: @Pattern , JSR303 bean validation : regex check max 5 words and not blank I use JSR303 bean validation annotations in my spring-mvc managed bean to validate text input.
I need to check

*

*if a string contains max 5 words (Here a word is an alphabetic or alphanumeric string)
and this string can't be blank (one space)

I try with this : ( just to match 5 words)
@Pattern(message="max 5 words please" , regexp="^[a-zA-Z+#\-.0-9]{1,5}(\s[a-zA-Z+#\-.0-9]{1,5}){0,4}$")
String keywords;

but my Eclipse IDE says  :
Invalid escape sequence (valid ones are  \b  \t  \n  \f  \r  \"  \'  \ )

A: Use double backslashes (\), to escape the special character backslash.

A: You could try this shorter version if you want.
regexp="^(\\b[a-zA-Z\\d+#.-]+\\b(?:\\s+|$)){0,5}$")

Should work.
Btw in your regex you say :
Match one to five chars (word of max 5 chars?), (followed by space, followed by zero to four chars. ) zero or four times. Is this what you want? :)


text:
Q: SQL Filter Issues I'm sorry for not being more clear in the title but I didn't know what to put there, if anyone has a suggestion based on my question, please let me know so I can change it. I have also included an SQL Fiddle below, it might be helpful to understand my explanation.
I'm currently creating a query that is supposed to return information about some report documents. These documents have a status which is saved in another table. Every time a document's status is updated a new record will be created in the Report_Status table. My goal is to show all these report documents with the current status together with some relevant information. This information is included in my fiddle but the problem lies mainly with the Report_Status table.
The solution I have right now gives the following output:
|        Study |           Site | Visit |         Report |              Status |
|--------------|----------------|-------|----------------|---------------------|
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_GSG | Authoring (Default) |
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_GSG | Authoring (Default) |
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_GSG | Authoring (Default) |
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_CoE | Authoring (Default) |
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_CoE | Authoring (Default) |
| Tester (UAT) | Mercy Hospital |   SQV | SQV Report_GSG |      Under Revision |

I actually only need 1 entry for each report i.e. SQV Report_GSG with Status 'Under Revision', and SQV Report_CoE with Status 'Authoring Default' but I'm not able to manupilate the data accordingly.
I have already tried filtering for the MAX(id) but apparently there is an inconsistency in the data which causes the latest record to NOT have the highest ID. The inspiration for this action came from the second answer in this question: SELECT DISTINCT on one column
Please find my current "solution" in the SQLFiddle: http://sqlfiddle.com/#!7/9983a/22
The data you find in the Report_Status table in the example contains data that corresponds with the actual data i.e. id, create_date and update_date.
Please keep in mind that the software I'm using to create this query on does NOT support T-SQL or PL/SQL commands.
I hope I was clear, if not, please don't hesitate to ask!


text:
Q: How can i check if there is in an item in one list that isn't in the other list? List<string> equipment = new List<string>();
equipment.Add("Football");
equipment.Add("Golf Ball");
equipment.Add("Baseball");

List<string> myEquipment = new List<string>();
myEquipment.Add("Football");
myEquipment.Add("Golf Ball");
myEquipment.Add("Basketball");

If i have the above, how would i check if there is an item in myEquipment that isn't in equipment?

A: You can use Linq to do this pretty easily
myEquipment.Any(c => !equipment.Contains(c));

If you need the items you could do
var notInEquipment = myEquipment.Where(c => !equipment.Contains(c));

A: The simplest solution is to use Except method
var diff = myEquipment.Except(equipment);

Another solution is to use HashSet and ExceptWith. It has almost the same complexity with previous solution (both O(n)), but HashSet will skip the duplicated values
var set = new HashSet<string>(equipment);
var mySet = new HashSet<string>(myEquipment);

mySet.ExceptWith(set);

Contains method also work, but has some performance overhead
var item = equipment.FirstOrDefault(e => !myEquipment.Contains(e));

You'll get the first item, which isn't present in a second list, or null value

A: You can use the Linq Except method:
void Main()
{
    List<string> equipment = new List<string>();
    equipment.Add("Football");
    equipment.Add("Golf Ball");
    equipment.Add("Baseball");

    List<string> myEquipment = new List<string>();
    myEquipment.Add("Football");
    myEquipment.Add("Golf Ball");
    myEquipment.Add("Basketball");

    var missingEquipment = myEquipment.Except(equipment);
}

A: Here's two way look up to get items that don't exist in other from both lists:
    var b = equipment.Concat(myEquipment).ToLookup(x => x)
            .Select(x => new { x.Key, Count = x.Count()})\
            .Where(x => x.Count == 1);


text:
Q: flex effect on visible event I would like to create a component that apply a resize effect when the it is visible:
I did this:
<s:Panel id="loginPanel" title="Connect" creationCompleteEffect="customResize"
                             showEffect="customResize" hideEffect="fadeOut"
                             width="400" height="300" includeIn="login">

with:
    <fx:Declarations>
            <!--  Effects declaration  -->
            <s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500"/>
            <s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500"/>
            <s:Animate id="customResize" duration="1000">
                <s:SimpleMotionPath property="percentWidth" valueFrom="0" valueTo="100"/>
                <s:SimpleMotionPath property="percentHeight" valueFrom="0" valueTo="100"/>
            </s:Animate>
        </fx:Declarations>

The problem is that when the component is displayed for the first time, the effect is correctly played but when the state change for example from "login" to "working" then back to "login", the effect isn't played anymore.
I thought that a visibility event would have been dispatched and the showEffect applied but it seems that the state changes don't work like I was expecting.
How can I apply the effect each time the component is visible?

A: are you sure the states are toggling the visible property?
Try to force Visible property to change:
<s:Fade id="fadeIn" alphaFrom="0.0" alphaTo="1.0" duration="500" effectStart="loginPanel.visible = true"/>

<s:Fade id="fadeOut" alphaFrom="1.0" alphaTo="0.0" duration="500" effectEnd="loginPanel.visible = false"/>


text:
Q: some queries regarding updates/inserts rate limits for a database(SQL-based or NoSQL based) In an app, I need to update a large number of records/insert a large number of records near-simultaneously into a database.
Is there any such insert/update limit which will act as a bottleneck for my app? Is there something I can do to maximise the insert/update rates.
Also, regarding the updates, the same record will not be updated-- many records in one table (clearly identifiable by a key) will be updated-- does this mean that the rate of updates can be significantly higher?
My questions above apply to relational as well as NoSQL databases.
I am now considering using a relational database like SQL Server/MySQL-- however at this stage I am willing to consider noSQL databases like Mongo DB/Dynamo DB as well- my final selection of db depends on which database offers higher insert/update limits.

A: General considerations
The maximum R/W capacity will highly depend on the hardware (HDD vs SSD) and the number of nodes. Also, I believe, it's easier to scale NoSQL for write operations as ACID and consistency are not enforced.
For the DynamoDB part of the question
DynamoDB is a managed service. You reserve a given R/W capacity (the so called 'units') and Amazon scales your database for you. But still, there is a couple of points to take into account :

*

*Maximum reserved Throughput is 10,000 for Read

*Maximum reserved Throughput is 10,000 for Write

Basically you consume 1 unit per consistent read or write per second and per indivisible kB. (Well, actually, it's even trickier).
BUT, in order to scale, your table is split among partitions. So is the reserved Throughput. SO, to reach the maximum possible throughput, you requested Keys needs to be as evenly spread as possible.
These were the database side considerations.
On the client side, there are multiple factors to take into account as well:

*

*TCP/HTTP latency

*maximum open socket at a time

You may use batch_get_item and/or batch_write_items were grouping is possible to reduce the latency impact.
For example, I've never been able to reach the provisioned 1000 write from my office computer, so, you'd better use multiple instances/server to issue your databases request.
TL;DR (DynamoDB)

*

*you reserve throughput, Amazon scales to deliver it

*still some gotchas related to the internal implementation

*need to optimize latency

*need to carefully parallelize

I'm not an expert for the other databases types so, I can only guess that the client side considerations will somehow be same, maybe less for MySQL as it uses a binary protocol. Also, you probably will have to manage the databases.


text:
Q: Implementar um Layout no Android Studio estou querendo implementar um layout assim no Android Studio, procurei já no Google, mas não soube me referir a esse tipo de barra que quero fazer, ai fiz essa imagem. Acho que está bem auto explicativo na imagem, quando o usuário clickar vai abrir o texto daquela barra onde ele clickou e quando clickar novamente vai fechar minimizando a barra.

A: Eu acho que você esta procurando por algo assim
https://www.youtube.com/watch?v=jZxZIFnJ9jE

A: Pelo que entendi você está procurando uma recyclerview expandable, esse componente funciona bem para tal: https://github.com/thoughtbot/expandable-recycler-view


text:
Q: Changing application culture changes the capitalization of resource strings I have an application which parses xml documents.  I store the expected xml tag names in an RESX file.  The first letter of the tag name is always lowercase.  This works fine (and has done for several years) for my default culture of en-IE.
I've been building an application which will also run the pt-BR culture.
The code works in en-IE.  But when I change the culture to pt-BR it is failing because when it retrieves the tag names using My.Resources.ParameterCollectionTag the first letter is now capitalized and thus the tag cannot be found in the xml document.
There is only one resource file, it is not localized itself. I've debugged into the Resources.Designer.vb file and resourceculture in the property
    Friend ReadOnly Property ParameterCollectionTag() As String
        Get
            Return ResourceManager.GetString("ParameterCollectionTag", resourceCulture)
        End Get
    End Property

is set to nothing.  The CurrentThread.CurrentCulture though is set to pt-BR.
To be clear, My.Resources.ParameterCollectionTag returns 'paramters' in en-IE and 'Paramters' pt-BR.
I'm new to localization and am stuck at this point.  Is there a way to turn off this behavior.  I want the ResourceManager to return the strings exactly as theyare in the RESX file.
Any tips would be gratefully received.
Thanks for you time.

A: As a work around I am setting My.Resources.Culture = New CultureInfo("en") before I start to use My.Resources.


text:
Q: Pie Graph Generator: Generates incorrect size/angle ONLY for some values I have made a very simple Pie Graph generator using Javascript & SVG graphics. You just enter the angle of the pie graph you want then click the button.
My Problem: It generates graphs that are too big for the angles 100 degrees, 180 degrees & many others. It does generate the correct pie for the angle 277. For an angle such as 180 which should be a half circle it shows a pie of 270 degrees for some reason.
Whats wrong with my simple algorithm that leads to the wrong pie shapes/values?
The JSFiddle is here (for some reason the JSFiddle wont update but if you copy the HTML below it all works): http://jsfiddle.net/mabg3/1/
<html>
<head>
    <script type="text/javascript">
    <!--
function createPieGraph()
{
   var angle    = parseInt(document.getElementById("angleVal").value, 10);
   var path     = document.getElementById("pie"); //document.createElement("path");
   var diameter = 200
   var rad      = diameter/2;
   var point    = resolveToPoint(angle, diameter);
   var d        = "M"+diameter+","+diameter+" L"+point.mX+","+point.mY+" A"+rad+","+rad+" "+determineDisplayType(angle)+" "+determineArcEnd(angle, diameter, rad)+" z";
   path.setAttribute("d", d);
}

function resolveToPoint( /*int*/ deg, /*int*/ diameter )
{
   var rad  = Math.PI * deg / 180;
   var r    = diameter / 2;
   var x    = r * Math.cos(rad);
   var y    = r * Math.sin(rad);
   var midX = diameter;
   var midY = diameter;

   if (deg <= 90)
   {
      console.log("1");
      x = midX + x;
      y = midY - y;
   }
   else if (deg <= 180)
   {
      console.log("2");
      x = midX + x;
      y = midY + y;
   }
   else if (deg <= 270)
   {
      console.log("3");
      x = midX - x;
      y = midY + y;
   }
   else if (deg <= 360)
   {
      console.log("4");
      x = midX - x;
      y = Math.abs(y);
   }

   return {mX: x, mY: y};
}

function determineDisplayType( /*int*/ deg )
{
   if (deg <= 90)
      return "0 0,0";
   else if (deg <= 180)
      return "0 1,0";
   else if (deg <= 270)
      return "0 1,0";
   else if (deg <= 360)
      return "1 1,1";

   return "0 0,0";
}

function determineArcEnd( /*int*/ deg, /*int*/ diameter, /*int*/ rad )
{
   if (deg >= 270)
      return ""+rad+","+diameter;

   return ""+diameter+","+rad;
}
    -->
    </script>
</head>
<body>

    <svg id="main" width="400" height="400" style="background-color: red;">
        <path id="pie" fill="blue" stroke="white"></path>
    </svg>

    <input type="text" id="angleVal" value="Enter angle"></input>
    <input type="button" onclick="createPieGraph();" value="Show Pie Graph"></input>
</body></html>

A: http://jsfiddle.net/mabg3/11/
Firstly, the fiddle didn't work because your javascript was being wrapped, but your inline click handler was looking for a global function. I unwrapped it (see the drop box on the left), which isn't a good idea for real code, but solves the problem easily enough in this example.
I also made the code much shorter. Not sure what all those functions were for; the only flag that needs changing is the large-arc if the angle is more than half the circle. The sweep flag is constant because we always render in one orientation.
My code can be easily improved and generalised (you can handle negative and >360 angles differently, you can make the initial angle different, etc.), but it works well enough.


text:
Q: $f_n \to f$ implies $\frac{1}{2^n}\sum_{x \in A_n} f_n(x) \to \int_{-\frac{1}{2}}^{\frac{1}{2}} f(x)dx$ Let $A_n:=\{ -\frac{1}{2}, -\frac{1}{2}+\frac{1}{2^n}, \cdots , 0, \cdots, \frac{1}{2}-\frac{1}{2^n}, \frac{1}{2} \}$ for each $n \in \mathbb{N}$.
Then, $A_n \subset A_{n+1}$ and $\cup_{n \in \mathbb{N}}A_n$ is a dense subset of $[-\frac{1}{2}, \frac{1}{2}]$.
Think of a sequence of functions $\{ f_n : A_n \to \mathbb{C} \}$ such that
\begin{equation}
f_n \to f
\end{equation}
pointwise on $\cup_{n \in \mathbb{N}} A_n$ as $n \to \infty$, where $f :[0,1] \to \mathbb{C}$ is a smooth function.
Now, I want to establish the limit
\begin{equation}
\frac{1}{2^n}\sum_{x \in A_n} f_n(x) \to \int_{-\frac{1}{2}}^{\frac{1}{2}} f(x)dx
\end{equation}
as $n \to \infty$.
What additional conditions on $f_n \to f$ do I need in order to establish this limit of the sum and integral? This turns out to be much trickier than expected...Could anyone please help me?


text:
Q: How to use Binary Search to find duplicates in sorted array? I am attempting to expand a function to find the number of integer matches through Binary Search by resetting the high variable, but it gets stuck in a loop. I am guessing a workaround would be to duplicate this function to obtain the last index to determine the number of matches, but I do not think this would be such an elegant solution.
From this:
public static Matches findMatches(int[] values, int query) {
    int firstMatchIndex = -1;
    int lastMatchIndex = -1;
    int numberOfMatches = 0;

    int low = 0;
    int mid = 0;
    int high = values[values.length - 1];
    boolean searchFirst = false;

    while (low <= high){
        mid = (low + high)/2;

        if (values[mid] == query && firstMatchIndex == -1){
            firstMatchIndex = mid;

            if (searchFirst){
                high = mid - 1;
                searchFirst = false;
            } else {
                low = mid + 1;
            }

        } else if (query < values[mid]){
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }

    if (firstMatchIndex != -1) { // First match index is set
        return new Matches(firstMatchIndex, numberOfMatches);
    }
    else { // First match index is not set
        return new Matches(-1, 0);
    }
}

To something like this:
public static Matches findMatches(int[] values, int query) {
    int firstMatchIndex = -1;
    int lastMatchIndex = -1;
    int numberOfMatches = 0;

    int low = 0;
    int mid = 0;
    int high = values[values.length - 1];
    boolean searchFirst = false;

    while (low <= high){
        mid = (low + high)/2;

        if (values[mid] == query && firstMatchIndex == -1){
            firstMatchIndex = mid;

            if (searchFirst){
                high = values[values.length - 1]; // This is stuck in a loop
                searchFirst = false;
            }
        } else if (values[mid] == query && lastMatchIndex == -1){
            lastMatchIndex = mid;

            if (!searchFirst){
                high = mid - 1;
            } else {
                low = mid + 1;
            }
        } else if (query < values[mid]){
            high = mid - 1;
        } else {
            low = mid + 1;
        }

    }

    if (firstMatchIndex != -1) { // First match index is set
        return new Matches(firstMatchIndex, numberOfMatches);
    }
    else { // First match index is not set
        return new Matches(-1, 0);
    }
}

A: There is a problem with your code:
high = values[values.length - 1];

should be
high = values.length - 1;

Also you do not need variables like numberOfMatches and searchFirst, we can have rather simple solution.
Now coming to the problem,I understand what you want I think Binary Search is appropriate for such query.
The Best way to do the required is once a match is found you just go forward and backward from that index until a mismatch occurs and this would be both elegant and efficient in calculating the firstMatchIndex and numberOfMatches.
So your function should be:
public static Matches findMatches(int[] values, int query)
{
 int firstMatchIndex = -1,lastMatchIndex=-1;
 int low = 0,mid = 0,high = values.length - 1;
 while (low <= high)
 {
      mid = (low + high)/2;

      if(values[mid]==query)
      {
          lastMatchIndex=mid;
          firstMatchIndex=mid;
          while(lastMatchIndex+1<values.length&&values[lastMatchIndex+1]==query)
           lastMatchIndex++;
          while(firstMatchIndex-1>=0&&values[firstMatchIndex-1]==query)
           firstMatchIndex--;
          return new Matches(firstMatchIndex,lastMatchIndex-firstMatchIndex+1);
      }
      else if(values[mid]>query)
       high=mid-1;
      else low=mid+1;
 }
 return new Matches(-1,0);
}

A: Couldn't you just use something like a set to find duplicates?
Something like this:
package example;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class DuplicatesExample {

    public static void main(String[] args) {
        String[] strings = { "one", "two", "two", "three", "four", "five", "six", "six" };
        List<String> dups = getDups(strings);
        System.out.println("DUPLICATES:");
        for(String str : dups) {
            System.out.println("\t" + str);
        }
    }

    private static List<String> getDups(String[] strings) {
        ArrayList<String> rtn = new ArrayList<String>();
        HashSet<String> set = new HashSet<>();
        for (String str : strings) {
            boolean added = set.add(str);
            if (added == false ) {
                rtn.add(str);
            }
        }
        return rtn;
    }

}

Output:
DUPLICATES:
    two
    six

A: I have split your problems into two parts - using binary search to find a number and counting the number of matches. The first part is resolved by the search function while the second part is resolved by the findMatches function:
public static Matches findMatches(int[] values, int query) {

    int leftIndex = -1;
    int rightIndex = -1;
    int high = values.length - 1;

    int matchedIndex = search(values, 0, high, query);

    //if at least one match
    if (matchedIndex != -1) {

        //decrement upper bound of left array
        int leftHigh = matchedIndex - 1;
        //increment lower bound of right array
        int rightLow = matchedIndex + 1;

        //loop until no more duplicates in left array
        while (true) {

            int leftMatchedIndex = search(values, 0, leftHigh, query);

            //if duplicate found
            if (leftMatchedIndex != -1) {
                leftIndex = leftMatchedIndex;
                //decrement upper bound of left array
                leftHigh = leftMatchedIndex - 1;
            } else {
                break;
            }
        }

        //loop until no more duplicates in right array
        while(true){
            int rightMatchedIndex = search(values, rightLow, high, query);

            //if duplicate found
            if(rightMatchedIndex != -1){
                rightIndex = rightMatchedIndex;
                //increment lower bound of right array
                rightLow = rightMatchedIndex + 1;
            } else{
                break;
            }

        }

        return new Matches(matchedIndex, rightIndex - leftIndex + 1);

    }

    return new Matches(-1, 0);

}

private static int search(int[] values, int low, int high, int query) {

    while (low <= high) {
        int mid = (low + high) / 2;

        if (values[mid] == query) {
            return mid;
        } else if (query < values[mid]) {
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }

    return -1;

}

A: I found a solution after correcting a mistake with resetting high variable that caused an infinite loop.
public static Matches findMatches(int[] values, int query) {
    int firstMatchIndex = -1;
    int lastMatchIndex = -1;
    int numberOfMatches = 0;

    int low = 0;
    int mid = 0;
    int high = values.length - 1;

    while (low <= high){
        mid = (low + high)/2;

        if (values[mid] == query && firstMatchIndex == -1){

            firstMatchIndex = mid;
            numberOfMatches++;
            high = values.length - 1;
            low = mid;

        } else if (values[mid] == query && (lastMatchIndex == -1 || lastMatchIndex != -1)){

            lastMatchIndex = mid;
            numberOfMatches++;

            if (query < values[mid]){
                high = mid - 1;
            } else {
                low = mid + 1;
            }

        } else if (query < values[mid]){
            high = mid - 1;
        } else {
            low = mid + 1;
        }
    }

    if (firstMatchIndex != -1) { // First match index is set
        return new Matches(firstMatchIndex, numberOfMatches);
    }
    else { // First match index is not set
        return new Matches(-1, 0);
    }
}

A: Not having any knowledge of the data other than sorted a priori is tough.
See this:
Binary Search O(log n) algorithm to find duplicate in sequential list?
This will find the first index of duplicates of k in a sorted array.
Of course this is related to knowing the value of duplicate first but very useful when it is known.
    public static int searchFirstIndexOfK(int[] A, int k) {

     int left = 0, right = A.length - 1, result = -1;
     // [left : right] is the candidate set.
     while (left <= right) {
       int mid = left + ((right - left) >>> 1); // left + right >>> 1;
       if (A[mid] > k) {
         right = mid - 1;
       } else if (A[mid] == k) {
         result = mid;
         right = mid - 1; // Nothing to the right of mid can be
                                               // solution.
      } else { // A[mid] < k
      left = mid + 1;
      }
     }
     return result;
    }

This will find a dupe in log(n) time but is fragile in that the data must be sorted as well as increasing by 1 and in the range 1..n.
static int findeDupe(int[] array) {
int low = 0;
int high = array.length - 1;
while (low <= high) {
    int mid = (low + high) >>> 1;
    if (array[mid] == mid) {
    low = mid + 1;

    } else {
    high = mid - 1;

    }

}
System.out.println("returning" + high);
return high;

}


text:
Q: How do i use the extraParams in Jquery Autocomplete? Am using Django and i want to access extraParams data of Jquery Autocomplete.
my Autocomplete code looks like this .
$("#power-search").autocomplete("/power_search_lookup/",{
type:"post",
extraParams:{model_name:function(){ return PMS.power_search_model_name;}},
width:320,
muliple:false,
multipleSeparator:",",
scroll:true,
scrollHeight:300,
delay:10,
formatResult:format_power_search
});

From django how do i get to read model_name
Gath

A: Its working ...
This Parameter was empty when i was sending it to the server! when it has a value it works well.
PMS.power_search_model_name;

Thanks.


text:
Q: moving background with parallax I am making a webpage that uses layers with a bit of parallax scrolling. I had this working. Then I don't know what happened because it stopped working. Any help would be appreciated.
Here is the code.
<!DOCTYPE html>

    <meta charset="utf-8">
    <title> 'Test'</title>
    <link rel="stylesheet" href="/css/21.css">

And Javascript
var initParallax = function() {

    // Setup variables
    var el = document.getElementById("parallax");
    var layerDistanceToHorizon = [50, 30, 10, 5];
    var horizonDistance = 200;

    // Simplified ways to get the background size (we should use all of them in our calculation)
    var style = window.getComputedStyle(el, null);
    var backgroundSize = style.getPropertyValue("background-size")
        .split(",")[0].split(" ")
        .map(function(x) {
            return parseInt(x)
        });
    var backgroundOffset = style.getPropertyValue("background-position")
        .split(",")[0].split(" ")
        .map(function(x) {
            return parseInt(x)
        });

    //  The original viewer offset (set to the center of the element here.)
    var viewerOffset = [el.offsetWidth / 2, el.offsetHeight / 2];

    // Determine the offsets of the element for the mouse-cursor
    // coordinates
    elOffsets = Utility.getPosition(el);

    // Function : Calculate all new offsets according to the viewer x/y
    var calculateOffsets = function(x, y) {
        var xTan = -1 * x / horizonDistance;
        var yTan = -1 * y / horizonDistance;
        return layerDistanceToHorizon.map(function(value) {
            return [value * xTan, value * yTan];
        });
    };

    // Function : Actually move the viewer
    var moveViewer = function(x, y) {
        var offsets = calculateOffsets(x, y);

        el.style.backgroundPosition = offsets.map(function(off) {
            var x = backgroundOffset[0] - off[0];
            var y = backgroundOffset[1] - off[1];
            return x + "px " + y + "px";
        }).join(", ");
    };

    //  Add the mouse-move event
    document.addEventListener("mousemove", function(e) {
        var mouse = getEventMousePosition(e);
        moveViewer(mouse[0] - (elOffsets[0] + viewerOffset[0]), mouse[1] - (elOffsets[1] + viewerOffset[1]));
    });
};

// Get the mouse coordinates from an event
var getEventMousePosition = function(e) {
    var x = 0;
    var y = 0;

    if (!e) var e = window.event;
    if (e.pageX || e.pageY) {
        x = e.pageX;
        y = e.pageY;
    } else if (e.clientX || e.clientY) {
        x = e.clientX + document.body.scrollLeft;
        y = e.clientY + document.body.scrollTop;
    }
    return [x, y];
}


text:
Q: read excel files in jupyter however some rows missing I'm reading an excel file in jupyter, however some rows missing, can someone help?
Cheers.
here is the code:
import pandas as pd
data=pd.read_excel("/Users/sudd2010126.com/Desktop/2019_semester_1/FIT_5147/Project_source/causes_of_death_australia.xlsx")
data

enter image description here

A: Rows are not missing, it's just not printed on display because it has too many rows. If you want to change this option and display all the rows, you can do so by changing Pandas Options and Settings:
pd.set_option('display.max_rows', None)


text:
Q: React doesn't have access to the actual error object in development. This error occurs when Paypal component re renders I am using Paypal react hosted fields to accept credit card payments so i created a common Paypal component to use wherever we need it for payment, this paypal component is inside other parent components so whenever a state changes in the parent the child components also re renders at this time this error is thrown
A cross-origin error was thrown. React doesn't have access to the actual error object in development.
I have used same code for implementation as in this codesandbox https://codesandbox.io/s/paypal-custom-payment-integration-b9il3r?file=/pages/components/cardForm.js:1039-1123
Here is the code for paypal component
<PayPalScriptProvider
          options={{
            'client-id': client_id,
            components: 'hosted-fields',
            'data-client-token': clientToken,
          }}
        >
          <PayPalHostedFieldsProvider
            styles={{
              '.invalid': { color: '#dc3545' },
            }}
            createOrder={() =>
              props.createPaypalOrder().then((resp) => resp)
            }
          >

                <PayPalHostedField
                  id="card-number"
                  style={CUSTOM_FIELD_STYLE}
                  className="input focused normal"
                  hostedFieldType="number"
                  options={{ selector: '#card-number' }}
                />

                <input
                  type="text"
                  ref={cardHolderName}
                />

                <PayPalHostedField
                  id="expiration-date"
                  style={CUSTOM_FIELD_STYLE}
                  hostedFieldType="expirationDate"
                  className="input focused normal"
                  options={{ selector: '#expiration-date', placeholder: 'MM/YY' }}
                />

                <PayPalHostedField
                  id="cvv"
                  style={CUSTOM_FIELD_STYLE}
                  className="input focused normal"
                  hostedFieldType="cvv"
                  options={{ selector: '#cvv', maskInput: true }}
                />

            <SubmitPayment />
          </PayPalHostedFieldsProvider>
        </PayPalScriptProvider>

Also the hosted fields gets cleared when any state in paypal component changes. That should not happen.
A quick response will be really helpful as i am stuck due to this issue, Thanks!


text:
Q: My xamarin application will not redirect after logging in to facebook I am new to xamarin forms, I've done plenty of searching on SO and google and cannot solve this problem that has had me stuck for a few days now.
I want the users of my mobile application to be able to login with Facebook.
I've followed the code example on https://github.com/xamarin/Xamarin.Auth/.
I have also setup my application of developers.facebook.com
I am debugging using an Android emulator via VS2017 with Xamarin.
I am writing a X platform app, so I have a PCL, Android and iOS project.
When I click my facebook login button, the facebook web UI displays as expected, when I log in, control does not return to the app.  It just sits on the facebook newsfeed for my facebook profile in an embedded browser.  The OAuth2Authenticator.Completed event never fires.  If I press the back button on my android device, it then DOES fire, but e.IsAuthenticated is false.
This is the code to launch the Facebook login
var auth = new OAuth2Authenticator(FaceBookAppId, "",
            new Uri("https://m.facebook.com/dialog/oauth/"),
            new
Uri("https://www.facebook.com/connect/login_success.html"));

        auth.Completed += Auth_Completed;
        auth.Error += Auth_Error;

        var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
        presenter.Login(auth);

I have a breakpoint sat on the event handler, but it never hits.
async void Auth_Completed(object sender, AuthenticatorCompletedEventArgs e)
{
    if(e.IsAuthenticated)
    {
        //do some magic
    }
}

Not sure what I have done wrong.  Please help.

A: After a few more days of trying to solve this, it is quite clear that the Xamarin.Auth package is out of date.
I found that by deploying the release to an actual device, the login worked fine, but it did not function on an emulator.
I decided to go down the "manual" web based approach which is detailed in facebook dev docs here
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
much more simple solution.


text:
Q: Sort a string in alphabetical order without arrays in java What I need to do is take a string that has random letters and take the letters and put them in alphabetical order. For example, lidfj, would be; dfijl.
What I am having trouble figuring out is how I should start the code. I know that I may need to use compare to, since I am not allowed to use arrays, but I'm not sure if that would be the best approach. And I'm not sure how I would start that either.
Thanks in advance.
Edit: I think I'm done for the night, since I can't seem to think of anything else.
public class PP426 {
    public static String alphabetize (String input) {
        String sorted = ";
        for (int i = 0; i < input.length(); i++) {
            char c = input.charAt(i);
            if () {
                sorted += character;
            }
        }

        return sorted;

    }
    public static void main(String[] args) {
        System.out.println(alphabetize("iunaselfksdf"));
    }
}

A: From your questions and comments, seems that it is a homework assignment, for which you are allowed to use only String class for sorting (it is obviously not efficient but... well... it is a homework anyway).
Here I assume you already have idea on how to do sorting (e.g. bubble sort) with array. If not, search for the simplest sorting algorithm like insertion sort and learn it.
If you know how to sort with an array, you can simply translate your logic to use String's methods.
For example:

*

*accessing character at position: yourString.charAt(i)

*setting character at position: yourString = yourString.substring(0, i) + charToSet + yourString.substring(i+1)

*appending a character: yourString += charToSet

If you don't even have knowledge in sorting, here is one method that works which involves only String:
I am not going to give you actual code.  Learn it by yourself:
for currentChar in 'a' to 'z'
  loop through each char in inputString
    if you encounter any char = currentChar then
       append that character to resultString
    end if
  end loop
end for

resultString contains the result you need

A: Use a for loop and String.charAt() to traverse the string. Use a StringBuilder (for efficiency, concatenating Strings works as well but is meh performance wise) to assemble the letters in the order. WIth this knowledge, now implement you preferred sorting algorithm (which, I guess, is part of the excersise, so I won't do it here ;) )


text:
Q: How to declare Datetime type column with DDMMYYYY format in MSSQL Below is my table structure:
DECLARE @FinalTable TABLE
(
[BranchID]          BIGINT          NULL,
[BranchName]        NVARCHAR(MAX)   NULL,
[Date]              DATETIME        NULL
)

My MSSQLSERVER is too crazy. It is saving the datetime in MMDDYYYY format, not knowing I required SELECT statement output in DDMMYYYY format. I am tired of using that CONVERT() and CAST() functions each and every time to in SELECT statement.
Is there any way to declare table column with my datetime format ( i.e. DDMMYYYY) so that I don't need to use CONVERT() or CAST() functions every time.

A: No, it's not. There is no formatting information at all associated with the field.
The value is not formatted by the database, it's returned only as a point in time. Formatting that value into it's textual representation is done by the applcation that is getting the data from the database.
So, there is nothing that you can do in the database to change how the date/datetime value is formatted, you have to change that where the data is displayed.

A: Date Time gets stored in database with the default format based on selected default language for the user. However you can manipulate the format when fetching the date time.
Following is the way to fetch the data with different defined formats:
All Formats for DateTime
But, if you still want to store the Date-Time of your own choice format then you have to create a column with Varchar DataType and later convert into date when fetching it (Not recommended)
Convert(datetime, Expression, FormatStyle)
For more information View the following answers:
Answer1
Answer2


text:
Q: Getting the Order of Taskbar Buttons I'd like to be able to get a list of the buttons in the taskbar in the order that they appear to the user. The reason for this is because I'd like to position windows on the screen based on the order they appear in the taskbar.
I'm able to get the handle of the taskbar using
HWND hDesktop = GetDesktopWindow();
HWND hTray    = FindWindowEx( hDesktop, 0, "Shell_TrayWnd" , 0);
HWND hReBar   = FindWindowEx( hTray   , 0, "ReBarWindow32" , 0);
HWND hTask    = FindWindowEx( hReBar  , 0, "MSTaskSwWClass", 0);

but I can't find anything that lets me interate through the buttons on the taskbar.
I feel it may have something to do with SendMessage() and TB_GETBUTTONINFO, but even then I can't understand how I could interate through all the existing buttons.


text:
Q: How to optimize number of threads needed I am building an UDP port scanner in C.
This is a scheme of the code
Create Socket
Structure raw UDP packet with port i
Send packet and wait n miliseconds for reply

I need to perform those tasks X times, depending on the number of ports to be scanned. It may be up to 65535 times.
My goal is to optimize resources, considering  an i386 machine running under a 3.5.0-17-generic Linux kernel.

*

*How many threads should be created?

*How many packets should be sent inside a single thread?

Thanks for your attention.

A: *

*One thread, using select, epoll or similar.

*All of them. Remember to rate limit since that doesn't happen automatically with UDP.


text:
Q: Selenium Python 3 How i can push on :

*Monitoring
Thanks
I try collect information from Huawei Power System temperature value.
I tried: driver.find_element_by_partial_link_text("Monitoring").click()
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"partial link text","selector":"Monitoring"}

A: Try finding the link by an attribute like value or onclick, the value must be unique in the entire html
By value:
driver.find_element_by_xpath("//a[@value='tree_monitor.asp']").click()

By onclick:
driver.find_element_by_xpath("//a[@onclick='goToTree(\'tree_monitor.asp\')']").click()


text:
Q: SELECT sql statement with two different tables and condition Having two tables in my database, it's like
Department
//Department
D#      DNAME
---------------
1      RESEARCH
2        IT
3       SCIENCE

PROJECT
//Project
Budget      D#
---------------
22500       1
22300       1
50000       2

So i using this statement
SELECT D#,DNAME and sum(budget) as total budget
    FROM DEPARTMENT,PROJECT
GROUP BY D#;

my output should be like, if a department don't have any project budget mean display 0
D#      DNAME      total budget
-------------------------------
1       RESEARCH      44800
2          IT         50000
3        SCIENCE        0

A: You are missing your where clause:
SELECT d.D#,DNAME and sum(budget) as total budget
FROM DEPARTMENT d, PROJECT p
where d.d# = p.dt#
GROUP BY d.D#;

Or to include departments without budget:
SELECT d.D#,DNAME and sum(budget) as total budget
FROM DEPARTMENT d
left outer join PROJECT p
on d.d# = p.d#
GROUP BY d.D#;

A: This might help you
   SELECT `D#`,`DNAME`,
   IFNULL((SELECT sum(`budget`)
          FROM `project` WHERE `project.`D#` = `Department`.`D#` ),0) AS `total budget`
   FROM `Department`

If you execute EXPLAIN on this query, you might notice, that it uses indexes more efficient then queries with GROUP BY


text:
Q: Do i need to register post type before inserting value under specific post type in wordpress? I want to record email address of user who are submitting their email address  from userend.
<?php
$my_post = array(
          'post_title'    => 'Subscribed Email',
          'post_content'  => 'niroj@gmail.com',
          'post_status'   => 'publish',
          'post_author'   => 1,
          'post_type'     => 'subscription',
        );
$insertPost=wp_insert_post( $my_post );
?>

Here do i need to register subscription as a post type at first? Or it does not matter if i directly insert it with out registering post type?I do not need to show it on admin panel.

A: Your code will insert custom post type entry into the database even if you do not register custom post type before, but without registering custom post type you will not have permalink structure associated with CPT and will not be able to access it via url and you will not have an admin interface.

A: When you create a custom post type then you can add a custom meta box for email address as well and while inserting post data you can insert email to that meta box and that will make better sense in all cases, for creating custom post type visit this official WordPress page https://codex.wordpress.org/Post_Types