w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
iDangero.us Swiper - dealing with large image sets
Give imagesLoaded a try (https://github.com/desandro/imagesloaded). Listen to the done/always event and then initialize your swiper. imagesLoaded(".swiper-wrapper").on("done", function() { // Initialize swiper });

Categories : Javascript

How to get the Intersection of Multiple sets but Ignore Sets that Don't Intersect
You'll want something like this: var results = from x in X from y in Y where x == y || X.All(item => !Y.Contain(item)) select x; The basic idea is: include the intersection if any intersection exists OR all items if no intersection exists.

Categories : SQL

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

Dealing with multiple possible indexOf()
using match and map may be an idea: "(hello) (world) (something) (number 4)" .match(/(.+?)/g) .map(function(a){return a.replace(/[()]/g,'');}) //=> ["hello", "world", "something", "number 4"] See MDN on the Array.prototype.map method, also offers a shim for older browsers

Categories : Javascript

Dealing with multiple IDs in jquery
Choose the one you like HTML <ul class="list_items"> assign ul with class list_items js $(document).ready(function(){ $('.list_items li a').hover( function(){ $(this).css('margin-left','10px'); $(this).css('color','white'); $(this).css('background-color','red'); },function(){ $(this).css('margin-left','0px'); $(this).css('color','black'); $(this).css('background-color','white'); } ); }); Updated DEMO Better approach with js $(document).ready(function () { $('.list_items li a').hover( function () { var x = $(this).parent('li'); x.css({ 'margin-left': '10px', 'color': 'white', 'background-color': 'red'

Categories : Javascript

C++ : Confused in dealing with multiple classes
Looks like you are missing return statements, this is an improvement node* Avlnode::Avlsearch(string x,Avlnode* t) { if (t==NULL) { cout<<"why you search whats not in string";//invalid search exit(0); } else { if(isLess(x,t->element)) //isLess compares strings and works good { //element refers to the string stored in Avlnode return Avlsearch(x,t->left); ^^^^^^ } else if (isLess(t->element,x)) { return Avlsearch(x,t->right); ^^^^^^ } else { cout<<"found"; cout<<t->index->empname; return t->index; //its fine till here } } }

Categories : C++

dealing with multiple $_POST coming from different objects
Your checkbox elements don't have names. If a checkbox is unchecked the name will not appear in $_POST, if it is checked it will appear with the specified value. <input type="checkbox" name="aaa" value="1"/> Should give you: $_POST["aaa"] === "1";

Categories : PHP

Spring JDBCDaoSupport - dealing with multiple selects
If you don't want to generate SQL yourself you have to use some existing framework. From what i know myBatis, is more lightweight than hibernate so it can suit you more, but there may be other more suitable.

Categories : SQL

How to dynamically build array key when dealing with a multiple
Arrays by definition start at zero. That's all there is to that. You could loop through and set each array index x number of indeces further back in the array but why you would want to do that is beyond me. A little more info on your end goal would help us give you a better solution. As far as setting your own keys, you're talking about an associative array, and that is possible: $newArr = array(); for($i = 0; i < count($_REQUEST['formMonths']); $i++){ $newIndex = //some code to generate whatever index you want as a string newArr[$newIndex] = $_REQUEST['formMonths'][$i]; } Which you now access each index by name: //Example using an index you know you set "october10": $somevar = newArr["october10"];

Categories : PHP

Does deploying a .net web app always have to be so painful when dealing with multiple references to the connection string?
How about Web.config transformations If you expand Web.config in Visual Studio you will see two more files: Web.Debug.config and Web.Release.config. You can add more configurations, for example Web.Staging.config.

Categories : C#

onuserpreferencechanged hang - dealing with multiple forms and mutlipe ui threads
I'm also confused about the terminology "UI thread". A UI thread is a thread that pumps a message loop. And operates in a mode that's compatible with user interface objects, it needs to be an STA, a Single Threaded Apartment. That's a COM implementation detail that matters a great deal to common UI operations that are not thread-safe and require an STA, like Drag+Drop, the Clipboard, shell dialogs like OpenFileDialog and ActiveX components. It is the CLR's job to call CoInitializeEx() and select the apartment type. It does so guided by the [STAThread] attribute on the Main() entrypoint in your program. Present in projects that create UI objects like a Winforms or WPF app. But not a console mode app or service. For a worker thread, in other words a thread that was created by you

Categories : C#

How do I minimize repeated xml attributes when dealing with multiple levels of inheritance?
Another approach would be to implement IXmlSerializable I think. I have done this in my own project to handle the serialization and deserialization of a complex inheritance. You can "control" the de/serialization with ReadXml/WriteXml methods that are overwritten by child classes. Implementing IXmlSerializable on your own is much more better if you have some "dynamic" mechanism in your framework, like extending the classes by types that are loaded during the runtime of the program or if you dont want to edit your attributes every time. If you go this way, you have to serialize the Type of the class. And at deserialization time you can create the object via "Activator" and the type you have serialized.

Categories : C#

Powershell script that depends on another parameter
You could try doing your parameters like this: param ( [Parameter(ParameterSetName="Add")][switch]$Add, [Parameter(ParameterSetName="Delete")][switch]$Delete, [Parameter(ParameterSetName="Add",Mandatory=$true)] [Parameter(ParameterSetName="Delete")] [string]$Subject ) When you have the switch "Add" then the Subject is mandatory, when you have the switch "Delete" then the Subject parameter is optional.

Categories : Powershell

Eloquent calls in Laravel 4: Dealing with single columns over multiple tables
$user_profiles = User_Profiles::where('city','=',Auth::user()->city)->get(); foreach($user_profiles as $user_profile){ $id = array('user_id'=>$user_profile->user_id); } So that code will get you the user_profiles by city and then loop through them and put their in an array , im not sure what do you mean by match answers to users table though..

Categories : PHP

powershell "Parameter set cannot be resolved using the specified named parameters"
Fairly new to using PowerShell, think I might be able to help. Could you try this? I believe you're not getting the correct parameters to your script block: param([string]$one, [string]$two) $res = Invoke-Command -Credential $migratorCreds -ScriptBlock {Get-LocalUsers -parentNodeXML $args[0] -migratorUser $args[1] } -ArgumentList $xmlPRE, $migratorCreds

Categories : Powershell

Powershell script parameter and dependant assembly
I'd say, no. One thing you can do is prevent the script from running if the the assembly is not present by using the The #Requires statement: #Requires -PSSnapin Microsoft.SharePoint.PowerShell If you don't have access to the script or cannot control it any way then i suggest to change the type of the parameter and add validations inside the function.

Categories : Powershell

Pass a function (with arguments) as a parameter in PowerShell
Don't you want to do something like this? function Add([int] $x, [int] $y) { return $x + $y } function Apply([scriptblock] $s) { Write-Host $s.Invoke($args) } Apply { Add 1 2}

Categories : Powershell

Powershell: Hiding second function parameter when first is already defined
Parameter sets are your friend. http://blogs.msdn.com/b/powershell/archive/2008/12/23/powershell-v2-parametersets.aspx

Categories : Powershell

Convert the value of a positional parameter into a variable (powershell)
Try this: @' <%%head.html%%> <body></body></html> '@ > testFile.html @' <!DOCTYPE html> <html><head><title></title></head> '@ > head.html $r = [regex]"<\%\%([w.-_]+)\%\%>" $fileContent = Get-Content testFile.html -Raw $matchEval = {param($matchInfo) $fileName = $matchInfo.Groups[1].Value Get-Content $fileName -Raw } $r.Replace($fileContent, $matchEval) The second parameter is a MatchEvaluator callback which expects one parameter which is of type MatchInfo. Also, if you're on v3 you don't need to pipe through Out-String, you can just use the -Raw parameter on Get-Content. BTW there is a way to do this if you have a function (not a scriptblock) called matchEval, that is: $r.Replace($fileContent,

Categories : Powershell

How to get rid of multiple sets of parentheses in an array
Try like.. Access the Objectforkey of Parameter Value and store into a dicitonary and then access the objectforkey of Smith and store the value into a string. NSError *e = nil; NSMutableArray *JSON = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e]; NSDictionary *value = [JSON objectforkey:@"parameter_value"]; You will get the expected values.

Categories : IOS

SQL: How to refer to multiple data sets with only one id?
The situation you describe is best solved with a foreign key between the Order and OrderItems table that uses the ORDER_ID column. There is no way to use the ORDER_ID as the primary key for each ORDER_ITEM since the key would not be unique. DDL create table `order`( order_id int NOT NULL, customer_name varchar(50), primary key(order_id) ); create table order_item( order_item_id int NOT NULL, order_id int, item_name varchar(50), primary key(order_item_id), foreign key(order_id) references `order`(order_id) ); Once you have this DDL setup you can easily reference an order using one key by joining the two tables. select * from `order` o join order_item oi on o.order_id = oi.order_id where o.order_id = 5;

Categories : Mysql

Get-Content with wait parameter doesn't update in Powershell
Not allowed to comment (don't have a 50 reputation), so have to give an Answer.... Less for Windows (http://gnuwin32.sourceforge.net/packages/less.htm) with the +F or Shift-F option (http://www.commandlinefu.com/commands/view/1024/make-less-behave-like-tail-f.) showed updated file content where PowerShell "get-content $path -wait" did not.

Categories : Powershell

Powershell read/update/write parameter file
Since you are storing the original entries in a hashtable, the original ordering is lost and based on the hashtable's internal hashing algorithm. I think the simplest solution is to cache the original order when parsing the file and then use that when outputting. So change your parsing function like this: function Parse-IniFile ($file) { $ini = @{} $fields = @() # to store the order switch -regex -file $file { "^s*([^#].+?)s*=s*(.*)" { $name,$value = $matches[1..2] $ini[$name] = $value.trim() $fields += $name } } $ini,$fields } Now when you call the function you will have to store each returned object in a separate variable like this: $aLines,$fields = Parse-IniFile .pfile.ora After you make your edit, you can output in the origi

Categories : Arrays

Passing bool parameter to powershell script shortcut
try with this: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command "& 'C:Program FilesMySoftwarediagnosticDiagnosticTool.ps1'" -copyAll:$true of with -file parameter to pass bool to a switch parameter of your script try: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -file "C:Program FilesMySoftwarediagnosticDiagnosticTool.ps1" {-All:$False} The last one is taked from TechNet but to be honest I'll never be able to work with it.

Categories : Powershell

Powershell Import-CSV with Custom Function Parameter Binding
If you decorate each parameter with the ValueFromPipelineByPropertyName attribute you'll be you'll be able to bind the values via the pipeline and call the function like so: Function HelloWorld() { [CmdletBinding()] Param( [Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)] [string]$Url, [Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$true)] [string]$Email ) Process { Write-Host $Url $Email } } Import-CSV C: empmyfile.csv | HelloWorld Notice that for this to work, parameter names must be named the same as the incoming object properties (otherwise you need to use an alias). Without the above you could call the function using the Foreach-Object cmdlet: Import-CSV C: em

Categories : Powershell

powershell executing external command not accepting parameter
I can never get Invoke-Expression (alias = &) to work right either, so I learned how to use a process object $7ZExe = (Get-Command -CommandType Application -Name 7z ) $7ZArgs = @( ('-o"{0}{1}"' -f $dir, $_.Name), ('"{0}{1}"' -f $dir, 'temp2') ) [Diagnostics.ProcessStartInfo]$7Zpsi = New-Object -TypeName:System.Diagnostics.ProcessStartInfo -Property:@{ CreateNoWindow = $false; UseShellExecute = $false; Filename = $7ZExe.Path; Arguments = $7ZArgs; WindowStyle = 'Hidden'; RedirectStandardOutput = $true RedirectStandardError = $true WorkingDirectory = $(Get-Location).Path } $proc = [System.Diagnostics.Process]::Start($7zpsi) $7ZOut = $proc.StandardOutput $7ZErr = $proc.Stand

Categories : Powershell

How can I use PowerShell's -filter parameter to exclude values/files?
-Filter is not the right way. Use the -exclude parameter instead: $srcfiles = Get-ChildItem $srcPath -exclude *.htm* -exclude accepts a string[] type as an input. In that way you can exclude more than one extension/file type as follows: $srcfiles = Get-ChildItem $srcPath -exclude *.htm*,*.css,*.doc*,*.xls* ..And so on.

Categories : Shell

SQLite selecting multiple sets of rows
Please learn Aggregate function for SQL Lite select max(RowID) as RowID,User,Event from Table1 group by User order by max(RowID) SQL FIDDLE

Categories : SQL

Multiple result sets excluding column
Need to clean up the query and your thought process If you want to debug dEndDate then include it in the output All values where dEndDate is null and dEndDate <= GETDATE() is always false. A value cannot be null and have a value. In the default configuration a comparison to null is always false. null <= 1/1/2000 is false null >= 1/1/2000 is false null = null is false If you want null OR dEndDate <= GETDATE() then: where dEndDate is null or dEndDate <= GETDATE() Why would you expect this not to return one row? dEndDate <= GETDATE()

Categories : Sql Server

nonlinear regression in R with multiple data sets
If you want identical parameters, you should just pool your data: df2 <- data.frame(Y=c(df$B,df$C), X=rep(df$A, 2)) p <- nls(Y ~ k1/X + k2, data = df2, start = list(k1=10, k2=10), lower = c(0, 0), algorithm = "port") summary(p) # Formula: Y ~ k1/X + k2 # # Parameters: # Estimate Std. Error t value Pr(>|t|) # k1 124.819 18.078 6.904 0.000124 *** # k2 1.199 9.781 0.123 0.905439 # --- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # # Residual standard error: 16.59 on 8 degrees of freedom # # Algorithm "port", convergence message: both X-convergence and relative convergence (5) Edit: If you want one parameter to be equal and one to vary, you could use a mix

Categories : R

Using multiple alternatives of hashCode() and equals() for sets
You can get that effect by using a TreeSet when providing a custom Comparator that only inspects the fields you're interested in. Note, however, that strictly speaking such a TreeSet no longer is a "correct" Set because it effectively ignores the equal() method of your objects: Note that the ordering maintained by a set (whether or not an explicit comparator is provided) must be consistent with equals if it is to correctly implement the Set interface. (See Comparable or Comparator for a precise definition of consistent with equals.) This is so because the Set interface is defined in terms of the equals operation, but a TreeSet instance performs all element comparisons using its compareTo (or compare) method, so two elements that are deemed equal by this method are, from the standpoint

Categories : Java

TAdoDataSet, TAdoStoredProc multiple result sets
It is an inherent limitation to server side cursors. As stated in following MSDN link: Server cursors cannot be used with statements that generate more than one recordset. This restriction applies to all statements described in Generating Multiple Recordsets. For more information, see Generating Multiple Recordsets. If a server cursor is used with any statement that generates multiple recordsets, an application can return one of the following errors: Cannot open a cursor on a stored procedure that has anything other than a single SELECT statement in it. sp_cursoropen. The statement parameter can only be a single SELECT statement or stored procedure.

Categories : Sql Server

How to search through multiple sets with one linq statement
You can use SelectMany to flatten list of list, add collectionA and collectionA to listOfLists first: listOfLists.AddRange(new[] {collectionA, collectionB}); if (listOfLists.SelectMany(x => x).Any(y => y == "Item5")) { } With you new edit which does not prefer to change the existing collections, nor create the new one, you can do: if (listOfLists.Any(x => x.Any(y => y == "Item5")) || collectionA.Any(x => x == "Item5") || collectionB.Any(x => x == "Item5")) { }

Categories : C#

Need a powershell script to use a parameter to manipulate/read in fields from another csv file
You can react to the server name like this: $csv = Import-Csv 'C:path oyour.csv' ... if ( $alert.PrincipalName -eq 'MYSTSERVER.CONTOSO.COM' ) { if ( $alert.MonitoringObjectDisplayName -match '.*[(.*?)]' ) { $targetserver = $matches[1] } } else { $targetserver = $alert.PrincipalName } $newdata = $csv | ? { $_.ServerName -eq $targetserver } ` | select ServiceOwner, 'Application Tier' ... $alert.CustomField2 = $newdata.ServiceOwner $alert.CustomField3 = $newdata.'Application Tier' ...

Categories : Powershell

I have Python code for detecting input parameter - How to do similar in Powershell
You use $args in Powershell, similar to sys.argv used in the Python example. Read more here - http://technet.microsoft.com/en-us/library/ff730958.aspx

Categories : Python

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

SQLite - multiple random result sets with unions
Actually I think I've solved this now. I don't actually know how this site works but I've done it by doing something like this: select * from ( select colA, colB, colC from tableA order by random() limit 10 ) union all select * from ( select colA, colB, colC from tableB order by random() limit 10 )

Categories : SQL

How do I replace a multiple sets of characters with a single character
you can try this. R+ will replace one or more R String str = "i want hello RRRRRRRRRRRR My name RRR is RRRRRRRR arvind RR"; System.out.println(str.replaceAll("R+","A"));

Categories : Java

What is the best way to show multiple sets information with the same layout in android
The way to display multiple product is to use list view. There are various forms of list view available, you can use expandable listview or can also use simple listview and follow master-detail format. Even play store also uses listview to display their apps(products). If you are trying to load large amount of data then you can use lazy loading technique along with caching.

Categories : Android

Validating Multiple sets of POST data in Cakephp
Figured out how to do it on my own... in /app/Model i created 'ShippingAddress.php' and 'BillingAddress.php', Both Extend "Address" //ShippingAddress.php <?php App::uses('Address', 'Model'); class ShippingAddress extends Address { } //BillingAddress.php <?php App::uses('Address', 'Model'); class BillingAddress extends Address { } To prevent the new models from using tables named after them, we edit the parent Address.php and set $useTable so that both extended models use Addresses Table //Address.php ... public $useTable = 'addresses'; ... then its just a matter of inserting the two instances of the input fields into the view... no renaming models, no modifying validationErrors, it just works :)

Categories : Cakephp



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