w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Powershell "select-string" Read Info
Your Select-String instruction is repeatedly reading $TargetFile. This will adversely affect performance. Try something like this instead: $array = @(...) $found = @{} Get-Content "C:PowershellScriptsEngCon.pbo" | % { $line = $_ foreach ($item in $array) { if ($line -match $item) { $found[$item] = $true } } } $found.Keys | Out-File "C: esults.txt"

Categories : Arrays

Get operating system info with PHP
When you go to a website, your browser sends a request to the web server including a lot of information. This information might look something like this: GET /questions/18070154/get-operating-system-info-with-php HTTP/1.1 Host: stackoverflow.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate,sdch Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: <cookie data removed> Pragma: no-cache Cache-Control: no-cache These information are all used by the web server to determine how to handle the requ

Categories : PHP

HTML5 File System Info Bar Not Responding In Kiosk Mode
What version of Chromium Portable are you using? I had a similar issue awhile back, but I don't have the same problem in the newer versions. I am using the latest version as of now which is Chromium Portable 30.0.1599.10 (released on 2013-08-21).

Categories : Javascript

System.Management resources monitor for statistics info such as I/O, CPU, Memory usage... etc'
public class MyPerfoamnceCounter { public string pc() { Dictionary<string, List<PerformanceCounter>> counters = new Dictionary<string, List<PerformanceCounter>>(); List<PerformanceCounter> cpuList = new List<PerformanceCounter>(); List<PerformanceCounter> procList = new List<PerformanceCounter>(); List<PerformanceCounter> memList = new List<PerformanceCounter>(); PerformanceCounterCategory perfCat = new PerformanceCounterCategory(); foreach (Process process in Process.GetProcesses()) { PerformanceCounter procProcesTimeCounter = new PerformanceCounter( "Process", "% Processor Time", process.ProcessName); var proc = procProc

Categories : C#

Splice system call, what is passed to the pipe? Data or whereabouts info?
refer here A splice() is a system call mechanism to do i/o from one file to another file in kernel space without doing copying from/to user space.It is a way of improving I/O performance. The splice system call avoids all data copy from user space to kernel space & vice versa. It reads from the specified offset from the input file & writes to a pipe in the kernel space. There is no copying of data to user space.Then it can be called to write the data from the pipe to the output file at the specified/current offset. splice() works by using the pipe buffer mechanism to open a file descriptor for a data source and another for a data sink then by using splice() it can join the two together. In other words, splice() work on a kernel buffer that the user ha

Categories : Linux

Powershell Help system usage
For #1, you need to understand how positional parameters are used in PowerShell. You can refer to the following scripting guys article on that. http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/22/the-problem-with-powershell-positional-parameters.aspx For #2, in PowerShell v3, there is update-able help. By default, on PowerShell 3.0 systems, there is no help installed. Everything is online. You can download the help content using Update-Help and Save-Help cmdlets. Also, Get-Help <cmdletname> -Online shows the online (most up-to-date) content for any cmdlet. You can use the about topics in PowerShell to learn the concepts. These about topics can be accessed using help about*. You will see a huge list of topics which can be accessed using help or Get-Help. For example, he

Categories : Powershell

How to run the powershell code for all system drives?
You pretty much have it, all you really needed was to get a listing of all the physical drives on the computer and then loop through it. A couple other notes: I removed $results |ft -auto. You probably had it in there as debug output. You do this twice: $results | sort-object -property size -Descending | select-object -first 30. I did it once, storing the output back into $results. Multiple trips of the same data through the same pipeline steps is inefficient. I made $a a here-string. Easier to read & work with than concatenating strings. I reformatted the date string in your output files so that you can sort filenames by date. Don't put files in c:. It's just sloppy. Find a more appropriate location. This will capture all folders (you aren't filtering them out). Is that desired?

Categories : Powershell

in Powershell how to use two system variables to name a file?
The problem is caused by erroneus Get-Content- It would read contents from a file and is not used to read an environment variable. What you are looking for is more like "c:"+$env:computername+$(get-date -f dd-MM-yyyy-HH-mm)+".csv" # Output: c:MyComputer03-07-2013-12-29.csv

Categories : File

File System Monitor for multiple files at once in PowerShell
A simple option for doing something like this would be setting up a scheduled task that runs a PowerShell script every 3-5mins. The script you could call would be something simple like this: $folder = "d:Logs emp" $destination = "d:LogsXML" $filter = "*.xml" Move-Item ($folder+""+$filter) $destination -force This will move only file that match the $filter out of the start $folder and put them all in the $desination folder. http://windows.microsoft.com/en-GB/windows7/schedule-a-task

Categories : Powershell

How can I import PowerShell module at the time of system stratup?
Perhaps because you don't fill the good profile file. Have look at : $profile.AllUsersAllHosts C:WindowsSystem32WindowsPowerShellv1.0profile.ps1 in spite of : $profile.AllUsersCurrentHost C:WindowsSystem32WindowsPowerShellv1.0Microsoft.PowerShell_profile.ps1 $profile.CurrentUserAllHosts C:UsersJPBDocumentsWindowsPowerShellprofile.ps1 $profile.CurrentUserCurrentHost C:UsersJPBDocumentsWindowsPowerShellMicrosoft.PowerShell_profile.ps1

Categories : Powershell

how to catch a System.Diagnostics.Eventing.Reader error in powershell
It's probably happening when PowerShell is trying to convert $commandString into an XmlDocument (the type of the -FilterXml parameter). I don't think you'll be able to capture the error in your error variable since it is happening before the call into Get-WinEvent. Your best bet is to validate $commandString before trying to pass it to Get-WinEvent. try { $xmlDoc = New-Object 'Xml.XmlDocument' $xmlDoc.LoadXml( $commandString ) } catch { # Or do some other kind of error handling. You're the driver! Write-Error ('Oh no! Bad XML! What are you thinking?!') } $lbx_workstationg.SelectedItems | ForEach-Object { Get-WinEvent -ComputerName $_ -FilterXml $commandString -ErrorAction SilentlyContinue -ErrorAction eventerr } | Select-Object MachineName, TimeCreated, Level

Categories : Powershell

Alternatives to fix powershell error "execution of scripts is disabled on this system"
If you did what the instuctions told you to do you would have gotten a help page that would have told you exactly what you need to do. get-help about_signing In summary, the computer has no way to tell that whoever wrote the script was a trustworthy person, so by default it does not run any untrustworthy scripts. The two ways to fix this is either allow scripts from unknown sources (the solution you found out about by using Set-ExecutionPolicy Unrestricted) or by "signing" the script proving it came from a trustworthy source and has not been tampered with seance you got it from that source. To sign your own code you will need a code signing certificate, read that about_signing help and there is a section called CREATE A SELF-SIGNED CERTIFICATE that tells you how to do it. After you ha

Categories : Powershell

powershell 'system.windows.media.mediaplayer' Register-ObjectEvent
Add-Type -AssemblyName PresentationCore $_MediaPlayer = New-Object System.Windows.Media.MediaPlayer $_MusicFolder = 'C:UsersMaking JESUS ProudMusic' $_MusicFiles = Get-ChildItem -path $_MusicFolder -include *.mp3 -recurse $duration = $null foreach($_file in $_MusicFiles){ "Playing $($_file.BaseName)" [uri]$_song = $_file.FullName do { $_MediaPlayer.Open($_song) $_songDuration = $_MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds } until ($_songDuration) $_MediaPlayer.Volume = 1 $_MediaPlayer.Play() Start-Sleep -Milliseconds $_songDuration $_MediaPlayer.Stop() $_MediaPlayer.Close() }

Categories : Powershell

System Error on running a powershell command from a python script
Can you try : Watchdog_config = '"C:\Program Files (x86)\Common Files\ibm\icc\cimom\data\wmia.properties"' I'am not confortable with python, I just want to enclose path into double quotes "".

Categories : Python

Gather [System.Windows.Forms.Screen]::AllScreens via Powershell remotely
No, this is not possible. Screen.AllScreens does not have a remote version so you need to use PowerShell remoting to call that method on a remote machine. If you use PowerShell remoting you end up in a PowerShell Windows Service which has a default desktop. This desktop is not visible, belongs to the system account and has no real screens. Therefore it will simply not give you the result you want. Also see here.

Categories : Powershell

checking health on every second
If I understood you correctly, the health will have a certain value and you want to decrease it by 1 every second. If that value reaches below 20, then you want to call lowFood() right? Here's something you can try (I've tested this on a real device and updated the answer ): Handler handler = new Handler(); handler.post(new Runnable() { boolean run = true; int health = 200; @Override public void run() { while(run) { health = health - 1; if(health < 1) { lowFood(); run = false; } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } });

Categories : Android

Samsung S4 Health App API's
You can signup to become a partner on Samsung at http://developer.samsung.com/account. Once approved you will be sent a app id, app secret and a SDK. Using the SDK you can download Walks, Exercise, Fitness, Food and other body vitals like BP, Glucose etc.

Categories : Android

Tag mismatch player health
This is a common problem in SA:MP (which I presume is what you're developing for). GetPlayerHealth gives the player's health as a float, but you're saving it as an untagged variable. To fix this, simply change new health; to new Float:health;

Categories : Misc

IIS Server Farm Health API?
There are plenty of performance counters at your disposal for monitoring IIS and related services remotely: Web Service Counters for the WWW Service Internet Information Services Global Counters Performance Counters for ASP.NET You can check out these counter values through windows's Performance Monitor, which provides a fair user interface, or use the following C# code to develop your own monitoring tool: var category = "Web Service"; var counter = "Current Connections"; var instance = "_Total"; var server = "192.168.0.1"; var perf = new PerformanceCounter(category , counter , instance , server); int connections = (int)perf.NextValue();

Categories : C#

BatteryManager Health values
Take a look at the documentation on Battery Manager. You'll be able to see what these constant values mean. For example, the value 2 that you get corresponds to BATTERY_HEALTH_GOOD. You can check that here: Link. In your activity, you can check your integer variable health against these values like: if (health == BatteryManager.BATTERY_HEALTH_GOOD) { // do something, update a textview, show a Toast } else if (health == BatteryManager.BATTERY_HEALTH_OVERHEAT) { // do something else, show a warning } else if. . . . // check for however many values or check for all This way, you won't need to consider the actual value(numerical value) that health variable holds.

Categories : Java

How to monitor queue health in celery
@goro,if you are making requests to foreign services, you should try gevent or eventlet pool implementation instead of spawning 100500 workers. I also had problem, when celery workers stops consuming tasks, it was caused by a bug with celery+gevent+sentry(raven) combination. One thing I figure out about Celery, is that it could work fine without any monitoring if all done right(currently I'm doing >50M tasks per day), but if it's not, monitoring will not help you very much. "Disaster recovery" in Celery is a bit tricky, not all things will work as you expect :( You should break you solution on smaller peaces, may be separate some tasks between different queues. At some point, you'll find code snippet which cause problems.

Categories : Python

Health Device Profile (HDP) support in iOS
iOS does not support HDP for Bluetooth 2.1. It can connect to anything using Bluetooth 4.0 LE (CoreBluetooth), but you're essentially implementing the profile yourself by looking up services and characteristics.

Categories : IOS

Need help implementing Health in basic C++ attack game
I think that the best use of polymorphism is the one that matches what we think in real life. So, I would suggest you have the Character class which has all the common features of a hero and an enemy. Then you have two separate classes (the Hero class and the Enemy class) both inherit from Character. However, each implements its own specific methods unique to Heros and Enemies. Example of things in Character class: attack power and health (like you have in your code) Example of things in Hero and Enemy class: image of the enemy or hero (or special unique weapon for the hero), etc. Hence, the code you provided with the Ninja and Dragon makes a lot of sense to me.

Categories : C++

Trying to write a loop that goes through my array and increments health of each player by 100
public void BumpHealth() { for (Player player : playerObjectArray) { player.health += 100; } } Assuming, of course, that the player object's health variable is called 'health'.

Categories : Java

Performing health check of BizTalk without impacting the services
There are some unclear statements and unproven assumptions in the question. Thus an answer in a general way: Load balancing in BizTalk has two aspects: network and hosts. Load balancing method depends on the host type: in-process vs. isolated. BizTalk Server Monitoring Management Pack has capabilities to monitor health of the BizTalk artifacts. Generally, network load balancer should not pose a problem for the performance as it only polls once per server (not each BizTalk host).

Categories : C#

Route 53 Amazon Aws - Check service (Solr) health in my ec2 instance
Yes, this is possible. The port and path of Route 53 health checks is fully configurable, so you can create one pointing to eg. your-ec2-instance:8983/admin/ping There are a few things you'd have to setup: your ec2 instance needs to be reachable from the IP addresses used by Route 53 healthcheckers apache solr needs a URL that can be used to determine if it's healthy. A good way of doing this is with solr's ping request handler Full disclosure - I work for Route 53

Categories : Solr

old info in db not displaying when new info is added via CSV - phpMyAdmin
Try with sql load data infile http://dev.mysql.com/doc/refman/5.1/en/load-data.html. Example: LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;

Categories : PHP

info = info.replace("CN", "CN", "CN, "CO""); not functioning as expected
Try this code-> String str = "USI;1;3056090866;06/16/58/06/24/13;CN25.48,WN86.957;CN34.931,WN16.656"; StringBuilder b = new StringBuilder(str); b.replace(str.lastIndexOf("CN") - 1, str.lastIndexOf("CN") + 2, "CO" ); b.replace(str.lastIndexOf("WN") - 1, str.lastIndexOf("WN") + 2, "WO" ); str = b.toString(); It will work..

Categories : Java

System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)
That method not exists in .net 4.5 - before then, Delegate.CreateDelegate should be used instead. It sounds to me like maybe NInject is incorrectly using that method in a 4.0 nuget package, in which case you should report that as a bug in NInject. The first thing to do is to check you are using the correct version of the dll, i.e. specifically a 4.0 build. After that, one of: roll back to an earlier NInject version upgrade your .net framework version download the code, fix it, and submit a patch

Categories : C#

using xslt to remove info path declarations form info path XML ?
The type of node is called processing-instruction so use <xsl:template match="processing-instruction()[starts-with(name(), 'mso-')]"/> together with the identity transformation template <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> That way the processing instructions where the name starts with mso- will not be copied. I will show a complete stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="text() | comment()"> <xsl:copy/> </xsl:template> <xsl:template match="processing-instruction()[starts-with(name(), 'mso-')]"/> <xsl:template match="*"> <xsl:elem

Categories : Xml

Where are info document files in Mac or in Linux, and how can I install some missing info files?
I find this somewhere that I do not know where it was. strings `which info` | grep /info This would print out some default info directories that had been compiled with the info command. One can also export a shell variable called INFOPATH with info directories you want.

Categories : Misc

Why would installing Azure SDK 2.1 or powershell 3 on the build server break some of our tests which run in powershell?
Have you tried passing a fully qualified path to startInfo.FileName instead of just Powershell.exe incase there's a problem with %PATH% since the update Complete total guess, but any chance your running into FileSystemRedirector 32 vs. 64 issues as seen in this answer - Process.Start(): The system cannot find the file specified, but my file path seems to be legit

Categories : Powershell

PowerShell Community Extensions not Recognized by TeamCity PowerShell Runner
Do you import the PSCX module in your script? PowerShell v3 will cache the module info after you have done this once so you don't need to import it again. However if TeamCity is running the 64-bit console and you normally run the 32-bit console, then the 64-bit console wouldn't have PSCX commands in the command cache. Anyway, it is a good practice to have your scripts explicitly require the modules it depends upon e.g. #requires -Modules Pscx

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

Executing Powershell script as different User in Exchange 2007 Powershell
I just found out that executing Remote Powershell Commands/Skripts is not supported with Exchange 2007 (http://howexchangeworks.com/2009/11/exchange-2007-sp2-supports-powershell.html). So I need to wait until the upgrade to 2013. Some workarounds: http://social.technet.microsoft.com/Forums/en-US/exchangesvrgeneral/thread/4596035a-cede-4541-8b8e-e2e9bf1b40dc Or: http://peerfect.blogspot.co.at/2012/10/re-blog-of-my-exchange-remote.html

Categories : Powershell

How do I return value or object from C# powershell command to Powershell
You have to use the CmdLet.WriteObject method. Here a good explanation from @RomanKuzmin.

Categories : Powershell

How to use powershell variable in PowerShell.AddParameter method in C#?
The variable won't be available until you invoke the first script. Try this: ps.AddScript("$backupFile = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(),'{0}.bak')".FormatInvariant(databaseName)); ps.Invoke(); ps.Commands.Clear(); var backupFile = ps.Runspace.SessionStateProxy.PSVariable.Get("backupFile"); ps.AddCommand("New-Item") .AddParameter("Force") .AddParameter("ItemType", "File") .AddParameter("Path", backupFile )); ps.Invoke(); If you go this route though, I don't think you can use the RunspacePool because you're likely to get different runspaces between each Invoke(). In that case, the variable won't be available to the other runspace. Do you really need to use the RunspacePool in this scenario? If you do then why not just do the first bit in C#: var backup

Categories : C#

Powershell Script that will login into powershell for office 365
For the exchange powershell use: $SecPass1 = convertto-securestring -asplaintext -string "PasSword" -force $MSOLM = new-object System.Management.Automation.PSCredential -argumentlist "GlobalAdmin@some.com",$SecPass1 $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $MSOLM -Authentication Basic -AllowRedirection Import-Module MSOnline Import-PSSession $Session –AllowClobber

Categories : Actionscript

asp.net json web service sending array error Cannot convert object of type 'System.String' to type 'System.Collections.Generic.List`1[System.String]'
You need to make your data parameter of the $.ajax call like this: JSON.stringify({'a': variables}) The JSON variable is not available in < IE8 so you'll want to include a JSON implementation like the one mentioned in the answer here Also, you had an extra } in the success function. So, in the future, if you want to add extra parameters to your data object passed to the web service, you'd construct it like so: var someArr = ['el1', 'el2']; JSON.stringify({ 'param1': 1, 'param2': 'two' 'param3': someArr // etc }); JavaScript: var variables = Array(); var i = 0; $('#Div_AdSubmition').find('.selectBox').each(function () { variables[i] = $(this).find('.selected').find(".text").html(); i++; }); $.ajax({ type: 'post', data: JSON.stringify({'a': variables}),

Categories : C#

Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib]]
For above I could simply write int? nVal = val Actually, you can't do that either. There is no implicitly conversation from object to Nullable<int>. But there is an implicit conversation int to Nullable<int> so you can write this; int? unVal = (int)val; You can use Nullable.GetUnderlyingType method. Returns the underlying type argument of the specified nullable type. A generic type definition is a type declaration, such as Nullable, that contains a type parameter list, and the type parameter list declares one or more type parameters. A closed generic type is a type declaration where a particular type is specified for a type parameter. Type t = typeof(int?); //will get this dynamically Type u = Nullable.GetUnderlyingType(t); object val = 5; //will get th

Categories : C#



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