w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
My Form is not registering Enter key presses
The AcceptButton property should be set = to the button you want "clicked" when enter is pressed, not a boolean value. Me.AcceptButton = buttonSubmit Did you add a handler for the form's Keydown event to go along with setting the KeyPreview property? Private Sub form1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles form1.KeyDown If e.KeyCode = System.Windows.Forms.Keys.Enter Then CheckQ() e.Handled = true End If End Sub Your code as you have it written for the textbox keydown event should work as well. I tried it in a test app and didn't have any issues. Do you hit a breakpoint if you place it on the CheckQ() method call? Any one of these methods should accomplish what you are trying to do.

Categories : Vb.Net

What is sent to the program when the user presses enter in the console?
What is sent to the terminal is 10 characters: [J][o][h][n][ ][S][m][i][t][h][ ] How the program handles it, depends on the function being used to read the input. The final character there (' ') is the indication that we hit "enter". A null terminated string is a concept internal to the program (ie string functions required it to work properly), you won't see a NULL terminator coming from stdin in your example. This is why you need to understand how the functions work that accept data from the user, if it takes the newline character, you may need to strip it. If it doesn't automatically append a null terminator, you should probably add one, etc.

Categories : C

How can I stop classic-asp page from submitting form when the user presses enter in IE8?
Don't use a <input type="submit">, use: <input type="button" onclick="document.forms[0].submit()"> ...assuming there is only one form on your page.

Categories : Javascript

Jquery Mobile Listview Autocomplete: how to trigger function when user presses enter?
Hey I used a local autocomplete jQM widget but this will work the same for ya - HTML - <div data-role="page" id="carPage"> <div data-role="content"> <ul id="autocomplete" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Find a car..." data-filter-theme="d"> <li><a href="acura.html">Acura</a></li> <li><a href="audi.html">Audi</a></li> <li><a href="bmw.html">BMW</a></li> <li><a href="bmw.html">Cadillac</a></li> <li><a href="bmw.html">Ferrari</a></li> <li><a href="bmw.html">Honda</a></li> </ul> &l

Categories : Javascript

Multiple Key Presses in XNA
This sounds like key blocking. This is not due to the software but due to the keyboard. Many keyboards will fail to recognize various three-key combinations. For example, my laptop and work keyboards don't recognize several combinations that I have tried to use in my applications. But my gaming keyboard does.

Categories : C#

How to subscribe for "user enter command to prompt" event in powershell?
I'm not sure if I understand what you are asking completely, but does this help? http://jaworskiblog.com/2011/08/05/logging-all-powershell-commands-and-output/ Basically, you add a "Start-Transcript" to your powershell profile. That will log everything you do even across multiple powershell instances, I think...

Categories : Powershell

Add Powershell Snapin for Powershell Module and Import Multiple Times
You might want to try to specify this module required by your own module through a module manifest (.psd1). See RequiredModules here.

Categories : Powershell

how to deactive enter event (only enter no shift+enter) in contenteditable
You can use the keydown event for this. Mdn has more information about this event. With the following example html: <div id="pinky" contenteditable="true">Pink unicorns are blue</div> You can attach an keydown event handler to this element. We can then use the event.shiftKey to detect if the shiftKey is pressed together with our enter key. Key 13 is either of the "enter" keys. $('#pinky').on('keydown', function(e) { if (e.which == 13 && e.shiftKey == false) { //Prevent insertion of a return //You could do other things here, for example //focus on the next field return false; } }); This snippets shows this in action: $('#pinky').on('keydown', function(e) { if (e.which == 13 && e.shiftKey == false) { //Prevent insertion of a r

Categories : Jquery

Move to the next control on enter/return press in Windows 8 Store application
You can handle the KeyDown/KeyUp events on your TextBoxes (depending on whether you want to go to the next one at the beginning or end of the key press). Example XAML: <TextBox KeyUp="TextBox_KeyUp" /> Code Behind: private void TextBox_KeyUp(object sender, KeyRoutedEventArgs e) { TextBox tbSender = (TextBox)sender; if (e.Key == Windows.System.VirtualKey.Enter) { // Get the next TextBox and focus it. DependencyObject nextSibling = GetNextSiblingInVisualTree(tbSender); if (nextSibling is Control) { // Transfer "keyboard" focus to the target element. ((Control)nextSibling).Focus(FocusState.Keyboard); } } } Full example code including code for t

Categories : C#

Store powershell output in a variable in CMD
The closing braces and percent need to be escaped/doubled. @echo off for /f "delims=" %%a in ('powershell get-date((get-date^).addDays(-1^)^) -uformat "%%Y%%m%%d"') do set d8=%%a echo %d8% pause

Categories : Powershell

Powershell - Store all Computers in AD into Array
In PowerShell V2.0 you can try : Import-module ActiveDirectory $computers = Get-ADComputer * In PowerShell V1.0 You can try : # dom.fr is the DNS root name of the domain $dn = New-Object System.DirectoryServices.DirectoryEntry ("LDAP://dom.fr:389/dc=dom,dc=fr","administrator@dom.fr","admin") # Look for computers $Rech = new-object System.DirectoryServices.DirectorySearcher($dn) $Rech.filter = "((objectClass=computer))" $Rech.SearchScope = "subtree" $Rech.PropertiesToLoad.Add("sAMAccountName"); $Rech.PropertiesToLoad.Add("lastLogon"); $Rech.PropertiesToLoad.Add("distinguishedname"); $computers = $Rech.findall()

Categories : Powershell

In Powershell, how to store an object in array, by "value" and not by "reference"?
When adding to the array, add a copy of the object: $arr += $obj.PSObject.Copy() http://msdn.microsoft.com/en-us/library/system.management.automation.psobject.copy(v=vs.85).aspx

Categories : Arrays

How to store data from foreach function in HTML file in powershell and get Physicall ram
You need to look at the ConvertTo-Html cmdlet. Get-WmiObject -Class Win32_BIOS -ComputerName localhost,$env:COMPUTERNAME | Select PSComputerName,Version,SerialNumber | ConvertTo-Html | Out-File c: est3.html Another method based on OPs update: $arrComputers = get-Content -Path "C:Computers.txt" $arrComputers | ForEach-Object { Get-WMIObject -Class Win32_BIOS -ComputerName $_ } | Select PSComputerName, Version, Manufacturer | ConvertTo-Html | Out-File C: est4.html

Categories : Powershell

Powershell: search for multiple string multiple xml and output results to csv
I'm not sure I'm getting your question right but: If you have an XML input such as: <persons> <person> <firstname>Mickey</firstname> <lastname>Mouse</lastname> </person> <person> <firstname>Donald</firstname> <lastname>Duck</lastname> </person> </persons> Save on d: empInput.xml Then the command $xml = [xml](get-Content d: empinput.xml) $csv = $xml.persons.person | Convertto-CSV -NoTypeInformation Should do the trick.

Categories : Xml

Asp.Net multiple submit buttons, enter submits only the first
You don't need forms, just wrap the related controls in their own panels and use the Panel.DefaultButton property. Use the DefaultButton property to indicate which button gets clicked when the Panel control has focus and the user presses the ENTER key. The DefaultButton can be set to the identifier for a Button control or any control that implements the IButtonControl interface except a LinkButton control.

Categories : Asp Net

NSTextField and Opt+Enter etc for forcing multiple lines - A bug or Feature?
This behavior is documented (or at least mentioned as a feature of NSTextField) here in the Mac developer library: https://developer.apple.com/library/mac/qa/qa1454/_index.html

Categories : Osx

Primefaces autocomplete multiple - select input value on enter
consider the following completeMethod for autocomplete public List<String> completeEmailIds(String keyword) { List<String> emailsIds = new ArrayList<String>(); List<String> availableEmailIds = aMethodThatReturnsAvailableEmailIdsBasedOnKeyword(String keyword); if(!(availableEmailIds.isEmpty())){ emailIds.addAll(availableEmailIds); }else{ emailIds.add(keyword); // if availableEmailIds returns empty, then new typed email will also be added. } return emailIds; } This way, the autocomplete items will be created and returned. You can use them in autocomplete component for multiple values. Hope this helps

Categories : Java

How with one function and one form to enter multiple rows in DB with same inputs - Laravel
You could make another table called ingrediens: ID | value | prod_id And there you could store all ingredients for each product. Then when inserting datas you could just use foreach and insert them in loop Hope it is useful

Categories : PHP

How to re-prompt a user for input if they enter a string with multiple whitespaces
For explanation how to replace multiple spaces with single space read how-to-replace-2-or-more-spaces-with-single-space-in-string.

Categories : Java

Fastest/Easiest way to store multiple arrays of data for multiple time steps
Why not index via the particle id?: particles = struct; particles(id).t % length(t)-by-1 particles(id).x % length(t)-by-1 particles(id).y % length(t)-by-1 particles(id).xdot % length(t)-by-1 particles(id).ydot % length(t)-by-1 Then particles(id).x is a vector where each element corresponds to an element in particles(id).t. particles(1).x(1) would be the first x value for id 1. However, the problem with breaking things up with an id is that you won't be able to search across particles. I'd really just use arrays (or a struct containing arrays for all particles): particles = struct; particles.ids % 1-by-length(ids) particles.t % length(t)-by-1 or length(t)-by-length(ids) particles.x % length(t)-by-length(ids) particles.y % length(t)-by-length(ids) particles.xdot % leng

Categories : Arrays

java code that allow to enter some words to it until I enter a space, then it output the same string with dash
The solution to your homework (don't tell the professor): import java.io.*; public class whatever { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer buffer = new StringBuffer(); String str; while((str = in.readLine()) != null && !str.equals(" ")) { buffer.append(str); } System.out.println(buffer.toString().replace(" ", "-"); } } You must put it in a file called whatever.java.

Categories : Java

Can I close a validation dialog box with enter key but not submit textbox value but use enter for valid value?
Without being able to see the rest of your code, you could have an event listener on submit, do e.preventDefault() and sub in whatever you want for the input values before manually submitting the form via JS.

Categories : Javascript

why ember.js use transitionToRoute enter controller's init() function afte this enter Route's setupController?
init is part of Ember's internal CoreObject and is fired when an instance of almost anything is created. Generallyit isn't part of the recommended workflow, but if you do use be careful. NOTE: If you do override init for a framework class like Ember.View or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember may not have an opportunity to do important setup work, and you'll see strange behavior in your application. setupController is called every time the context(underlying model) for a route changes.

Categories : Ember Js

JQuery Mobile - Disable "enter" / script to not allow using enter
you could try this : $("#comment").on("keypress", function (e) { if (e.which === 13) { e.preventDefault(); //alert("Keypress averted"); } }); Demo : http://jsfiddle.net/hungerpain/JTwXv/

Categories : Javascript

Clicking on TextBox inside Panel triggers Enter event multiple times
Try this ... Dim lFocused as Boolean Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus TextBox1.SelectAll() lFocused = True End Sub Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave lFocused = False End Sub Private Sub TextBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseUp lFocused = True TextBox1.SelectAll() End Sub Based idea

Categories : C#

Why doesn't Python enter the def of one class while it does enter the def of another?
Tests must begin with a name that starts with 'test'. So to run the tests in the first class, change correct_dictionary_v1 to test_correct_dictionary_v1, and correct_dictionary_v2 to test_correct_dictionary_v2. From the docs: TestLoader uses the 'test' method name prefix to identify test methods automatically.

Categories : Python

i need to post with enter key but have shift & enter key for new line
You need to consider the shiftKey value in both conditions. $("#post_text").keydown(function(e){ if (e.which === 13) { // Enter was pressed if (e.shiftKey) { // With shift } else { // Without shift } } }); Also note the use of which, not keyCode. jQuery standardizes the event object, making sure which is set on browsers that don't set it.

Categories : Javascript

PowerShell Multiple DynamicParam
I'm trying to replicate the "workaround" you're using, but I'm only seeing that I have access to the dynamic parameter Share (not Quota). In order to reproduce your setup, since I don't have access to personfileutility.exe I have commented out two lines and added a third where I hardcode $type to "faculty". For example, in two places I have updated the code to be: #$lookup = [xml](\servernamepersonalfilespersonfileutility.exe -a $Identity) #$type = $lookup.User.user_directory.type.type $type = "faculty" With these changes in place, I can access the Share parameter after I specify an Identity. However, I cannot access the Quota. Do you expect Quota to be available? If I'm understanding the problem you're asking about, you do not want Share to be accessible until Identity is accessible

Categories : Powershell

Assigning Multiple ips to a NIC using powershell
You want to call the EnableStatic method on the instance of the Win32_NetworkAdapterConfiguration WMI class for the network interface you want to configure. uint32 EnableStatic( [in] string IPAddress[], [in] string SubnetMask[] ); You can see above it takes two parameters. A string array of IP addresses and a string array of subnet masks. It will return an status code. 0 indicates success. Here is PowerShell example code: Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=true" | ForEach-Object { $result = $_.EnableStatic(("192.168.1.10","10.0.0.10"),("255.255.255.0","255.0.0.0")) if ($result -ne 0) { # handle non-successful response code here. } }

Categories : Powershell

How do I create multiple arrays with one csv in powershell?
If I understood your question correctly, something like this should do what you want: $parentID = @() $element = @() Import-Csv "C:path oyour.csv" | % { $parentID += $_."Parent ID" $element += $_.Element } Another (less performance-hungry) approach would be this: $data = Import-Csv "C:path oyour.csv" $parentID = $data | % { $_."ParentID" } $element = $data | % { $_.Element } The array $parentID will contain all values from the Parent ID column, the array $element all values from the Element column: PS C:> $parentID A B C D E E A PS C:> $element 1 2 3 4 5 6 7

Categories : Arrays

Multiple counts from Powershell Get-ChildItem?
Basically you need to enumerate all files and folders for a given path and maintain a count of each object type: $files=$folders=0 $path = "d: emp" dir $path -recurse | foreach { if($_.psiscontainer) {$folders+=1} else {$files+=1} } "'$path' contains $files files, $folders folders"

Categories : Powershell

How to run multiple Scripts one by one in a powershell script
./script1.bat ./script2.bat ./script3.bat ... You'll get the picture, I guess. This will run them in sequence. To determine whether they were sucessful or not that depends very much on how those batch files signal errors or sucessful completion. If you exit with exit /b 234 or something similar on an error then you can use $LastExitCode or also $? to determine that. You could also look whether the changes made by those batch files are actually done, of there is no other way of figuring out whether they were sucessful.

Categories : Powershell

Multiple parameters put into one variable in PowerShell
Arguments to PowerShell functions should not be put in parenthesis when called. It should be ValidatePath $filename $user. What you have written results in calling ValidatePath with just one parameter and $filename being an array of two values, namely the filename and the user. BTW: When calling .Net methods in PowerShell you do need the parenthesis. :)

Categories : Dotnet

How to format multiple entries in Powershell
I'm sure this isn't the cleanest solution: Get-ADUser $identity -Properties directReports | select-object -expandproperty directReports|foreach-object{$_.split(",")[0].replace("CN=","")}| export-csv "DirectReports-$identity.csv" You'll get each person's name (only) on its own line in the CSV file.

Categories : Powershell

Powershell Separate Script With Multiple Sessions
How about you run as command powershell invoke-command (http://technet.microsoft.com/en-us/library/hh849719.aspx) Check out the part about -AsJob which execute on background

Categories : Powershell

Write to a file with multiple jobs in PowerShell
You could synchronize file access using a Mutex e.g. $mutex = new-object System.Threading.Mutex $false,'SomeUniqueName' ... nr = $WorkflowData['_Number'] $mutex.WaitOne() > $null $nr >> C:Configuration rFile.txt $mutex.ReleaseMutex()

Categories : Windows

Powershell: Comparing multiple values in an array
You could group by Computername, then for each group, sort by LastDate and select the last item. You will have to adjust to meet your formatting needs, but it would look something like this. Import-Csv -Path .computers.csv| group -Property Computername| foreach { $_.group| sort { try { [datetime]$_.LastDate } catch {} }| select -last 1 }| Export-Csv -Path .computers_LastDate.csv -NoTypeInformation

Categories : Arrays

check multiple NAS directories for folder PowerShell
It looks like you're very close to your answer already, is this what you are looking for? $Folderquery = Read-Host 'Enter remote folder name' $i = 0 Foreach ($potentialpath in (Get-Content \NASlistofpaths.txt)) { If (Test-Path "$potentialpath$Folderquery") { $i++ } } If ($i -eq 0) { Write-Output "The Folder $Folderquery does not exist" | Out-File "C:logfile.log" -Encoding ASCII -Append }

Categories : Powershell

Powershell: how to remove multiple & directories with exceptions?
And almost as soon as I posted, the answer came to me -- I had to find only files, not directories. Since I'm on PowerShell 2.0, I couldn't use the -File attribute that's new in powershell 3. Instead, I have to check every object to see if it's a container. Solution: $exclude = @('license.txt', 'settings.txt') Get-ChildItem C:RootFolder -recurse -exclude $exclude | Where-Object {!($_.PSIsContainer)} | foreach ($_) {remove-item $_.fullname} This worked perfectly to achieve what I needed. Improving on the Solution Thanks to several comments / posts here, there are some more elegant ways that taught me a bit more about powershell: Remove-Item can take commands from a pipe-line. No foreach is necessary. Where-Object can just be shortened to "?" Get-ChildItem can be shortened to "gci"

Categories : Windows

Powershell + Regular Expressions - How to get multiple matches?
If I understand it correctly, you would like to match the text inside the tags. Then use something like this: $text_to_parse -replace '<div[^>]+>(.*?)</div>', '$1' it returns just the text. Some text here Besides that getting multiple matches reminds me this task: Given test "ab cd ef ax 0 a0" select all strings that begin with "a" Then $s = "ab cd ef ax 0 a0" $s -match 'aw' is useles, but you may go with this: $s | Select-String 'aw' -AllMatches | % { $_.Matches } | # select matches % { $_.Value } # selectt values from matches In V3 it is maybe more simple, this is for V2.

Categories : Regex



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.