w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Scale background image of div to a fixed width; auto-scale height
Any reason you can't add <img src='base64'/> inside the div elements then in the css have div{background: 0px 0px} to hide the div background and have img{width:171px}? See the modified jsFiddle. That solves the problem, but not sure if you are able to add the img tag. Let me know and i'll see if another solution can be found.

Categories : Javascript

Auto Generate Machine Key VS. Custom Machine Key
If you have a WebFarm you have to use custom machine key, other way it won't work. The only secure problem is that there are people, who knows these machine key. If they "sell it" outside your company somebody can for example decrypt your cookies.

Categories : Asp Net

Does windows azure virtual machine logs out when disconnecting
No, your Virtual Machines don't shut down when you disconnect from rdp/ssh. However: There's always the possibility that your machine will restart, even if infrequently (e.g. failed hardware, Host OS maintenance, etc.). So... your essential programs should be set up to auto-start at boot time, without requiring you to rdp/ssh in to start them up again.

Categories : Windows

Java synchronization is doing auto notify on exit ? Is this expected?
You shouldn't use a Thread object as a locking object. See more explanations in question Does java notify waiting threads implicitly?. Advertisement: Jon Skeet speaks there :) (This is a direct link to the answer in the above linked question.) There is also another question linked from a comment, now I'll make it more achievable: who and when notify the thread.wait() when thread.join() is called?

Categories : Java

A way to scale resque workers in and out on dev machine?
Take a look at the following plugins: https://github.com/kmullin/resque-sliders - Gives you control via the web UI https://github.com/frausto/resque-director - Allows you to define "rules" for scaling up and down.

Categories : Ruby On Rails

what's the fast and new way(based on high performance) of reading event logs from remote machine using c#
I don't know if this is faster, but worth a shot My suggestion is to skip the eventlogreader class and go straight to WMI ( where you may be able to query just what you want. Also, you can get the remote machine to backup the event log then try copying the backup... see http://msdn.microsoft.com/en-us/library/windows/desktop/aa394593(v=vs.85).aspx you may want to look at How to construct WMI query on how to do WMI From C#

Categories : C#

How can I retrieve logs between two timeframes using regex?
Using bash, it is possible to generate a regex statement based only on two input timestamps, which you may pipe to a command (such as grep): #!/bin/bash #This is a bare-bone recursive script that accepts input of a start/end timeframe #in the 24-hour format, based on which a regex statement will be generated that will #select all values in between those two timeframes. Please note that this script #has undergone some optimization (I apologize for the reading difficulty, but it #did not occur to me until now that someone might have a use for such a script). #You are free to use, distribute, or modify this script to your heart's content. Any #constructive feedback is welcome. I did my best to eliminate all bugs, but should #you find any case where the generated regex is INCORRECT for som

Categories : Regex

Not able to retrieve call Logs specifically through blackberry 10
It turns out you can't do it in WebWorks, but you can add a native extension. I'm sorry that I can't provide you an example, but take a look at BlackBerry 10: Creating native extensions . From that page: Although a BlackBerry WebWorks application has a wide range of functionality, that functionality is limited to the resources that the application contains. By creating a custom extension, you can extend the functionality of your application to include the features and functions provided by core native APIs that are available to BlackBerry 10 OS applications. You create a custom extension in C/C++, which are the native languages for BlackBerry 10 OS, and then you wrap it in JavaScript. When you build and package your BlackBerry WebWorks application, you include the extension, so th

Categories : HTML

Auto-scrolling multiple chat logs using AngularJS
You could create a chatlog directive and add it to your markup like this: <div chatlog ng-repeat="msg in channel.msgLog"> Then in the linking function of your directive you can do something like: link: function(scope, element, attrs) { if (scope.$last) { // this will run each time the channel.msgLog array changes // more precisely, every time the last element is linked } }

Categories : Angularjs

How to auto scale an image for all resolutions?
Regardless of the resolution your app still sees logical pixels of 800x480 (or 853 for 16:9), so your image size will not change. That article only talks about providing higher resolution images so that the images, when viewed on a higher res screen (which is often larger in size) is of better quality. In terms of layout and size though they will remain the same regardless of screen resolution. To test this add an image to your app and run it across multiple emulators with different sizes and you'll see that it stays the same relative size regardless of screen resolution.

Categories : C#

Auto scale android resources
You could add the image you wish to use to the drawable-nodpi directory with an alternate name to it's drawable name. Then in drawable-ldpi create an alias to the drawable with the 'real' drawable name you wish to use using a drawable alias (http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources) Finally, in drawable-xhdpi create a scale drawable with the same 'real' name and a scale of 1, the source being the -nodpi counterpart (http://developer.android.com/guide/topics/resources/drawable-resource.html#Scale) This way, by preference, the scaling drawable should be used for ldpi-hdpi and xhdpi should prefer the fixed-scale drawable. Try it out

Categories : Android

Highcharts - toggle auto scale
Sure, you can extract the current chart settings by calling chart.highcharts(), it contains each axis which will have the effective min and max as well as the data's min/max set based on the series that are using it. yAxis[0] would work if you only have one, but setting an id on the Axis might be clearer: var chart = highcharts({... yAxis: { id: 'my_y', ... yAxis = chart.highcharts().get('my_y'); yAxis.getExtremes(); // {min:, max:, dataMin:, dataMax:} yAxis.setExtremes(newmin, newmax); fiddle

Categories : Javascript

Web Deploy Command Line Logs in Event Logs (Updated / Inserted / Deleted Files) in event logs
I don't believe you can log the activities to the event log, but what you can do is use the -xml parameter to output the changes in XML format. You could then use this to log to the event log via a Powershell script, for example.

Categories : Iis

Rotate and Scale with auto-layout in iOS6
The easiest way around this was to create the image programmatically using the following code to remove auto-layout. Since you cannot set image.translatesAutoresizingMaskIntoConstraints = YES if you add the image into the view using IB due to the apple "bug" with auto-layout. Because you will get an error saying, "Unable to simultaneously satisfy constraints" So you need to do this programmatically because IB adds constraints and you don't want any. UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, 100, 100)]; image.image = [UIImage imageNamed:@"gorilla_red.png"]; image.translatesAutoresizingMaskIntoConstraints = YES; [self.view addSubview:image];

Categories : IOS

Is my machine key auto-generated or isolated?
the default setting of IIS is autogenerate machine-key and isolate per application you can change this setting globaly in your machine.config or localy (per application) in your web.config for details please see http://technet.microsoft.com/en-us/library/cc772287(v=ws.10).aspx http://technet.microsoft.com/en-us/library/cc754909(v=ws.10).aspx You can see the current setting for machine-key in IIS manager. For details, see http://blogs.msdn.com/b/amb/archive/2012/07/31/easiest-way-to-generate-machinekey.aspx

Categories : Asp Net

How to properly auto-scale AWS EC2 Instances group in a relatively complex infrastructures?
Auto-scaling creates new nodes based on the launch configuration. So you would have two separate auto scaling groups and two separate launch configurations. ie "VarnishScalingGroup" : { "Type" : "AWS::AutoScaling::AutoScalingGroup", "Properties" : { "LaunchConfigurationName" : {"Ref" : "VarnishLaunchConfiguration" }, "LoadBalancerNames" : {"Ref" : "ELB"}, ... } }, "VarnishLaunchConfiguration" : { "Type" : "AWS::AutoScaling::LaunchConfiguration", "Properties" : { ... "UserData" : { .... }, "MetaData" : { ... } }, "ApacheScalingGroup" : { "Type" : "AWS::AutoScaling::AutoScalingGroup", "Properties" : { "LaunchConfigurationName" : {"Ref" : "ApacheLaunchConfiguration" }, "LoadBalancerNames" : {"Ref" : "InternalELB"}, ...

Categories : Amazon

How can I replace CGAffineTransform scale and alpha animations using CABasicAnimations and Auto Layout?
I don't know why you want to do it with CABasicAnimation for scale. You can do it like you mention at the top of your question. Set a new value for the view's width and height constraint constant values and then use [myView layoutIfNeeded] inside animateWithDuration. If the view doesn't have height and width constraints, but has constants to the top and bottom and/or left and right edges of the superview, change those values instead.

Categories : IOS

Why does Cookie Session keep dying
It sounds like the cookie you get back from the server is a session cookie which, keeping it simple, means that when you stop the application and run it again the cookie is discarded. I would suggest to set on the server side a Max-Age or an Expire for the cookie. This should solve the problem. Another way to debug this kind of issues is to print out the HTTP Headers you get back from the server. There could be in fact a bug which does not set correctly the cookie expiration or Max-Age. Another really important thing is to set the Secure attribute of the cookie if you are using it to authenticate the HTTP clients/requests otherwise your cookie will be sent every and each time you execute an HTTP request to the domain specified in the cookie, even though the request is about a download o

Categories : Android

git-svn clone dying with signal 6
Singal 6 is defined to be SIGABRT — this is a special signal which is sent to a process when it calls abort(3). In most cases the process does not handle this signal, and the standard disposition of this signal is to kill the process, which is what happens in your case. Supposedly the assertion checking code calls abort(3) in the end. As to the possible solutions, googling yields at least this as well as a number of other pointers — try to work through them.

Categories : GIT

Retrieve auto increment id of last inserted record in MVC 4
You can do the following: var account = new Account(); context.Accounts.Add(account); context.SaveChanges(); var Phone = new Phone(); // account.Id will be populated with the Id from the Database. // as long as it's the identity seed or set to NewID()(Sql Server) phone.AccountId = account.Id; ...

Categories : C#

How to retrieve previously auto-generated PK ID value using JDBC and HSQLDB
Not much action here, so I'll go ahead and answer to bring closure to this question. After playing around with the different options, and after see this question, I was able to get my option 3 to work. Like I mentioned in the edit to my question, I'm going to use option 3. Option 4 also worked fine, but since the accepted answer to the linked question is given by a reputable source, I am sticking with that. I wish I'd have seen that question/answer before starting this one, I'd have saved some time!

Categories : Java

How to conveniently store common logs and client specific logs
I would have an xml file that contain the appenders to specify what packages go into what log file. You can then load the xml file in your application entry point. Below is an example I have used in my current project <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <!-- appenders --> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param name="Target" value="System.out" /> <param name="threshold" value="error" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%t] %p %c - %m%n" /> </layout> </appender> <appender name="codebaseXAppender" class="org.apache.log4j.RollingFileAppender"> <

Categories : Java

Fibonacci Rabbits Dying After Arbitrary # of Months
This is copied from the answer in SpaceCadets question to help rbump it out of the "unanswered" list of questions. The two keys here were drawing out the tree to a large number, AND making sure to include a base case check for the first and second generations of deaths (It's -1 in both cases, and then it's something that depends on input). So 3 potential cases. The regular fib sequence when we don't need to account for deaths, the first and second generations of deaths to initialize our final sequence with the recurrence relation Fn-2 + Fn-1 - Fn-(monthsAlive+1) I'm certain there's a way to merge 1 or 2 of these checks and make the algorithm more efficient, but as of now it solved a large test case (90, 17) instantly and correctly. So I'm happy. Lesson learned: Use the entire white-b

Categories : Python

how to retrieve identity auto number of table of microsoft sql server
Microsoft SQL server records the last auto-generated identity value in the @@IDENTITY system variable. You can select that to get the value that you're interested in after the insert. -- Statement to Create Table CREATE TABLE Purchase( InvoiceNo INT IDENTITY(1,1) PRIMARY KEY , Product NVARCHAR(128)) -- Insert Statement INSERT INTO Purchase (Product) VALUES ('Test Product A') GO -- Get the auto-generate InvoiceNo for last inserted record SELECT @@IDENTITY as [InvoiceNo]

Categories : Database

zedgraph custom auto scale - but with minimum (of Min), and minimum of Max)
You can manually set 'Y' axis as follows, myPane.YAxis.Scale.Min = 0; myPane.YAxis.Scale.Max = 10; myPane.AxisChange(); zedGraphControl1.Invalidate(); and if you want to reverse the scale set the 'IsReverse' property to 'True' myPane.YAxis.Scale.IsReverse = true;

Categories : C#

How to set intellij to show logs in the logs tab and not the output tab
In the application server Run/Debug configuration open the Logs tab and specify the full log file path there. You can just search your disk for algo_js.log file and specify its location.

Categories : Spring

Cassandra Node dying, saw OpsCenter thrift operation queue full prior
"unable to create new native thread" is your smoking gun. Things that will help include: Increase your kernel thread limits Switch thrift to hsha instead of thread-per-conn Upgrade to the latest OpsCenter agent

Categories : Cassandra

Get iPhone Logs(not crash logs)
Got a breakthrough!!. We need to re-direct NSLog to a file like this and then access the file. - (void)redirectNSLogToDocumentFolder{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *fileName =[NSString stringWithFormat:@"%@.log",[NSDate date]]; NSString *logFilePath = [documentsDirectory stringByAppendingPathComponent:fileName]; freopen([logFilePath cStringUsingEncoding:NSASCIIStringEncoding],"a+",stderr); } http://objcolumnist.com/2009/12/19/redirecting-nslog-to-a-log-file/

Categories : IOS

A better way for a stacked area chart toggle between a percent scale and absolute scale?
So there are a lot of things you can do to avoid repeating yourself in the code. First of all a lot of the D3 functions you are using can be reused - they are general functions. This together with the concept of javascript closures means you only have to declare them once and initialize the parts that won't change. The stack layout does overwrite the y and y0 values, so to get the toggle to work I renamed your initial data to raw_x and raw_y and adjusted the accessors appropriately. Then the work of figuring out the yScale domain and actually updating the paths I wrapped into a function: function drawChart() { yScale.domain([0, d3.max(data, function (d) { return d3.max(d.values, function (d) { return d.y0 + d.y; }); })]); // new data items need t

Categories : Javascript

How to retrieve specific columns rather than auto generate all columns or attributes from Entity
You are telling JPA to fetch Project and its referenced Employees, so it needs to return complete entities otherwise it corrupts the context. I don't know how/if Hibernate supports lazy basic mappings, but that might be one option - mark the attributes in Employee that you don't always want as lazy. This will affect both requestedBy and empNumber relationships equally though. If you do not want complete Employee data, you might have the query return only the data you want. Leave the query to fetch the empNumber but make the requestedBy relationship lazy, and have the query return Project and the Project_.requestedBy data that you want. Linda has a great example of using multiselect to return data at https://blogs.oracle.com/ldemichiel/entry/the_typing_of_criteria_queries .

Categories : Hibernate

How to copy only file permissions and user:group from one machine and apply them on another machine in linux?
How about this? #!/bin/bash user="user" host="remote_host" while read file do permission=$(stat -c %a $file) # retrieve permission owner=$(stat -c %U $file) # retrieve owner group=$(stat -c %G $file) # retrieve group # just for debugging echo "$file@local: p = $permission, o = $owner, g = $group" # copy the permission ssh $user@$host "chmod $permission $file" < /dev/null # copy both owner and group ssh $user@$host "chown $owner:$group $file" < /dev/null done < list.txt I am assuming that the list of the files is saved in "list.txt". Moreover you should set the variables "user" and "host" accordingly to your setup. I would suggest to configure ssh to have "automatic login". Otherwise you should insert the password twice per loop. Here

Categories : Shell

ModelState.isValid = false on production machine, true on development machine
As I mentioned in the edit, I found the cause of and solution to my problem. It was caused by an error being thrown by the automatic binding of parameters, and the reason it was having issues with dates on my production machine was due to the locale settings (dd/mm/yy vs mm/dd/yy) on that machine. To fix, I set the computers region settings (in the control panel), and also added a line into my Web.config.

Categories : Jquery

Use NLP / Machine Learning to teach a machine how to detect if a string is mathematical?
Parsing is a better tool than machine learning for this problem. What you have described is a relatively simple grammar for arithmetic, with some aliases for numbers, and a touch of syntax for those aliases. A tokenizer and some basic syntactic analysis, which you could code directly, will produce better more reliable results with significantly less computational effort than machine learning and optimization will. One reason why parsing is sufficient is that you don't need to worry about misspellings as often as you do, say, with people's names. If you want to get fancy about that, then use your Jaro-Winkler-based things for lexical analysis and then use syntatic analysis on what you think are your tokens. That is still much cheaper and less complex than machine learning. I don't know mu

Categories : PHP

Is it possible to remotely debug a 64 bit machine from 32 bit Host Machine(which has visual studio)
According to MSDN, the answer in the other article is incorrect, and you can debug x64 from an x86 host: http://msdn.microsoft.com/en-us/library/vstudio/ms184681%28v=vs.100%29.aspx If you are debugging remotely, Visual Studio can run under WOW64 or on a 32-bit computer. You can debug both IA64 and x64 applications, in addition to 32-bit applications that are running under x64 WOW mode or on 32-bit operating systems.

Categories : Dotnet

PyDev: Running Code in local machine to remote machine
One solution would be: Install python on the remote machine Package your code into a python package using distutils (see http://wiki.python.org/moin/Distutils/Tutorial). Basically the process ends when you run the command python setup sdist in the root dir of your project, and get a tar.gz file in the dist/ subfolder. Copy your package to the remote server using scp, for example, if it is an amazon machine: scp -i myPemFile.pem local-python-package.tar.gz remote_user_name@remote_ip:remote_folder Run sudo pip install local-python-package.tar.gz on the remote server Now you can either SSH to the remote machine and run your code or use some remote enabler such as fabric to start commands on the remote server (works for any shell command, specifically python scripts) Alternatively, you c

Categories : Python

MySQL statement failing on local machine but not deployment machine?
The failure is referring to the d.id in the nested subquery: ON dol.id=( SELECT MIN(dol2.id) FROM DOLineEJB dol2 WHERE d.id=dol2.DeliveryOrderEJB_lines ) You can fix the query: SELECT d.id, ..., dol.weight, d.status FROM DeliveryOrderEJB d join InbondEJB_DeliveryOrderEJB_link lnk on d.id=lnk.DeliveryOrderEJB_id left join DOLineEJB dol ON dol.id=( SELECT MIN(dol2.id) FROM DOLineEJB dol2 WHERE d.id=dol2.DeliveryOrderEJB_lines ) WHERE lnk.InbondEJB_itNo='...' ORDER BY d.id I believe the problem is because you have different versions of MySQL on the machines. MySQL changed the semantics of the , around version 5.0.

Categories : Mysql

Powershell tasks from local machine to remote machine
Reading from docs on MSDN: To run a single command on a remote computer, use the ComputerName parameter. To run a series of related commands that share data, use the New-PSSession cmdlet to create a PSSession (a persistent connection) on the remote computer, and then use the Session parameter of Invoke-Command to run the command in the PSSession. To run a command in a disconnected session, use the InDisconnectedSession parameter. To run a command in a background job, use the AsJob parameter. So basically you should do something like: $session = New-PSSession Invoke-Command -Session $session -FilePath <PathToScript>

Categories : Powershell

Connecting Clients machine to MySQL Server machine
You can use other tool with good looking GUI. For example: HeidiSQL. Then, you need to enable remote access. If you use windows, there is nice wizard for you to enable remote access with a few clicks. The wizard is located it at MySQL Server 5.5inMySQLInstanceConfig.exe. Then Reconfigure Instance -> Next -> Standard Configuration -> Next -> Next. You will see this screen. Tick on "Enable root access from remote machines". Or you can manually configure it to allow remote access from my.ini file. See this link for how to do it. If having done above still does not allow you to connect to your MySQL. Please make sure that Firewall does not block MySQL port.

Categories : Mysql

Installation of MSI File on remote machine from local machine
You're running a remote MSI on the local host. To install the remote executable on a remote host, you could use WMI: host = "<IP ADDR>" setup = "msiexec /a ""C:MySetup<FILENAME>"" /quiet ..." Set wmi = GetObject("winmgmts://" & host & "/root/cimv2") rc = wmi.Get("Win32_Process").Create(setup, , , pid) If rc = 0 Then WScript.Echo "Setup started with PID " & pid & "." Else WScript.Echo "Starting setup failed. (" & rc & ")" End If The above will start the process asynchronously (i.e. Create returns immediately). If you need to wait for the remote process to complete, you'll have to monitor it like this: Do WScript.Sleep 100 Set p = wmi.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessID=" & pid) Loop Until p.Count = 0 There may be s

Categories : Vbscript

host webapp in my machine trough virtual machine
Yes to both questions, if your browser machine can hit the port the server machine is serving the app on. On WAN, you would need to make sure your router didn't block requests to the server's port, and the same for any modem/firewall that connects you to the internet at large. Also, if your public ip is not static, it may change.

Categories : Iis

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