Going off of my other question and it's pair.
I'm looking to grab the Hostname:Port value as found in the phpinfo() function. I can't seem to find it anywhere and it's not in $_SERVER.
Looking for some best practices on handling a major dependency upgrades within a project, assuming the use of a dependency management tool(e.g., Maven 2).
Specifically, I'm interested in:
How get an inherited application up-to-date(e.g., Spring 1.2.x to 2.5.x)
What practices can be put into place to after such an overhaul to keep applications somewhat up-to-date
Your own experiences or any articles/papers you've come across/found to be useful are welcome.
I am beginner in PHP. I am trying to parse this xml file.
<relationship>
<target>
<following type="boolean">true</following>
<followed_by type="boolean">true</followed_by>
<screen_name>xxxx</screen_name>
<id type="integer">xxxx</id>
</target>
<source>
<notifications_enabled nil="true"/>
<following type="boolean">true</following>
<blocking nil="true"/>
<followed_by type="boolean">true</followed_by>
<screen_name>xxxx</screen_name>
<id type="integer">xxxxx</id>
</source>
</relationship>
I need to get the value of the field 'following type="boolean" ' for the target and here's my code -
$xml = simplexml_load_string($response);
foreach($xml->children() as $child)
{
if ($child->getName() == 'target')
{
foreach($child->children() as $child_1)
if ( $child_1->getName() == 'following')
{
$is_my_friend = (bool)$child_1;
break;
}
break;
}
}
but I am not getting the correct output. I think the ' type="boolean" ' part of the field is creating problems. Please help.
I have a number between 0.0 and 1.0, I would like to convert it to a grayscale color.
White = 0
Black = 1
You can show me how in any understandable language (I prefer actionscript 3)
Please, don't just give a name of a function that a language have to do this, I want to know how it does.
In Firefox 'A' shows in the middle, on Chrome/IE it doesn't:
<button type="button" style="width:24px; text-align:center; vertical-align:middle">A</button>
Note the following has the same results:
<button type="button" style="width:24px;">A</button>
Hi,
Currently on my application I have a form where I ask the user to upload an image file to be used as a logo. I want to allow the user to reset that to nothing by supplying no file (by just pressing the upload button from the browser).
In this scenario the only thing left is to suspend file validation when no file is included.
Currently I get the *self::NO_FILE* error from the *Zend_Validate_File_Upload* class.
Is there any way to suspend the validation so that nothing will be checked if no file has been provided?
I'm trying to profile my code to check how long it takes to execute some parts of my code.
I've wrapped my most time-consuming part of the code in something like that:
DateTime start = DateTime.Now;
...
... // Here comes the time-consuming part
...
Console.WriteLine((DateTime.Now - start).Miliseconds);
The program is executing this part of code for couple of seconds (about 20 s) but in console I get the result of something about 800 miliseconds. Why is that so? What am I doing wrong?
We use ComponentOne controls in our Winforms application for .NET 2.0 and we have a problem when we attempt to use it on FIPS validated platforms - the licx file seems to fail and the control creation fails and even the ComponentOne activation seems to fail. Is there a workaround for this ?
Hello, I have some Regex, it looks like this:
string regexForDrop = @"^((%27)|'|(\-\-))\s*(d|%64|%44)(r|%72|%52)(o|%6F|%4F)(p|%70|%50)$";
It works fine, when i write to the input "--drop", but it does not works, when i write "drop table users" or something like that. I need that it would be working, no matter what comes after "--drop". How i can implement that?
Thanks
I have an ASP.NET MVC3 site that I want to be able to use different types of email service, depending on how busy the site is.
Consider the following:
public interface IEmailService
{
void SendEmail(MailMessage mailMessage);
}
public class LocalEmailService : IEmailService
{
public LocalEmailService()
{
// no setup required
}
public void SendEmail(MailMessage mailMessage)
{
// send email via local smtp server, write it to a text file, whatever
}
}
public class BetterEmailService : IEmailService
{
public BetterEmailService (string smtpServer, string portNumber, string username, string password)
{
// initialize the object with the parameters
}
public void SendEmail(MailMessage mailMessage)
{
//actually send the email
}
}
Whilst the site is in development, all of my controllers will send emails via the LocalEmailService; when the site is in production, they will use the BetterEmailService.
My question is twofold:
1) How exactly do I pass the BetterEmailService constructor parameters? Is it something like this (from ~/Bootstrapper.cs):
private static IUnityContainer BuildUnityContainer()
{
var container = new UnityContainer();
container.RegisterType<IEmailService, BetterEmailService>("server name", "port", "username", "password");
return container;
}
2) Is there a better way of doing that - i.e. putting those keys in the web.config or another configuration file so that the site would not need to be recompiled to switch which email service it was using?
Many thanks!
I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc.
It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc.
Parameter passing to template rendering engine is also important if I could pass all of them in a hash map instead of calling some function for each of parameters.
Do you have any recommendations?
I can see also the possibility of embedding languages like Lua, however I haven't found a templatizing library for that either.
Thanks!
Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains()? If not, what would what be "The Prototype Way" to selector/filter-down a list of elements that contains a particular string.
For example, using the following
$$('#some_div dd a')
I may get back an array of 50 or so links. I only want the links that contain the work 'home'. In jQuery I'd do this
jQuery('#some_div dd a:contains('home')');
Is it possible to do something similar using Prototype? If not, is there an elegant way to filter out the array of 50 elements that gets returned.
I've created a few sounds for use in my game. I can play them at certain events without issue:
// create sounds
CFBundleRef mainBundle;
mainBundle = CFBundleGetMainBundle();
_soundFileShake = CFBundleCopyResourceURL(mainBundle, CFSTR("shake"), CFSTR("wav"), NULL);
AudioServicesCreateSystemSoundID(_soundFileShake, &_soundIdShake);
// later...
AudioServicesPlaySystemSound(_soundIdShake);
The game has a mechanism which allows you to shake the device to activate some functionality. I've got the shaking code done so I get get a "shaking started" and "shaking ended" message to my game. What I need to have happen is start playing "shave.wav" when shaking starts and loop it until it stops. Is there a way to do this with AudioToolbox/AudioServices? How could I do this if not?
need some help with building a powershell script to help with some basic string manipulation. I know just enough powershell to get in trouble, but can't figure out the syntax or coding to make this work.
I have a text file that looks like this -
Here is your list of servers:
server1
server2.domain.local
server3
Total number of servers: 3
I need to take that text file and drop the first and last lines (Always first and last.) Then I need to take every other line and basically turn it into a CSV file.
The final output should be a text file that looks like this -
server1,server2.domain.local,server3
Any suggestions on where to start? Thanks!
Does anyone have any recommendations for either of these validation ASP.Net MVC Validation frameworks?
xVal: http://xval.codeplex.com/
FluentValidation: http://fluentvalidation.codeplex.com/documentation
NHibernate.Validator
DataAnnotations
by the way: my project use sharp-architecture
Hi Everyone
Can anybody please tell me how to implement an audio player appilcation in iphone. I am pretty new to iphone development and i am just starting to learn the tricks of the trade.
Thanks
I am confused about why this code does not display any image:
In the app delegate:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSRect rect = window.frame;
rect.origin.x = 0;
rect.origin.y = 0;
BlueImageView *blueImageView = [[BlueImageView alloc]initWithFrame:rect];
window.contentView = blueImageView; // also tried [window.contentView addSubview: blueImageView];
}
BlueImageView.h:
@interface BlueImageView : NSImageView {
}
@end
BlueImageView.m:
@implementation BlueImageView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setImage: [NSImage imageNamed:@"imagefile.png"]];
NSAssert(self.image, @"");
NSLog (@"Initialized");
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect {
}
@end
The file imagefile.png exists. The NSAssert is not causing an exception. The NSLog is firing. But no image shows up in the window.
I have a page with a link. On clicking the link a page opens up in a separate window. This new page has a form. On submitting this form, some operation takes place at the server. The result of which needs to be redirected to the same page. However after the operation on using the following:
return new ModelAndView("newUser");
//This view "newUser" actually maps to the popped up window.
A similar new window again pops up and the message gets displayed on this new page.
Any ideas as to why this behavior or how to go about this?
I have created a repository AAA and another BBB.
In AAA I have created a file A with the values a1, a2, a3 and commit
In BBB I have created a file B with the values b1, b2, b3, commit and export a bundle.
I add the bundle in AAA and merge.
I make a change in B, and write b33 in AAA and another change in B and write b23 in BBB. and commit both. I create bundle of BBB and add the bundle in AAA. I do a merge.
Now I decide to revert to the revert to step 2. I no more want to have the merge of 4. changes done in B as they were bad merges.
Now I want to add the bundle of 3 but I can see that it can`t see any changes anymore. Why? How can I do the merge once more?
I have lists of data such as
a = [1,2,3,4]
b = ["a","b","c","d","e"]
c = ["001","002","003"]
And I want to create new another list that was mixed from all possible case of a,b,c like this
d = ["1a001","1a002","1a003",...,"4e003"]
Is there any module or method to generate d without write many for loop?
I am developing a VS 2008 web application in C#. I am trying to include a namespace that is stored in one of my folders. So instead of:
using ADONET_namespace
it is stored in "Admins" folder. How do I modify this aspx.cs file to include Admins/ADONET_namespace?
Currently I get following error from aspx.cs file:
The type or namespace name 'ADONET_namespace' could not be found (are you missing a using directive or an assembly reference?)
If I have a Matcher[A] how do create a Matcher[Iterable[A]] that is satisfied only if each element of the Iterable satisfies the original Matcher.
class ExampleSpec extends Specification {
def allSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = error("TODO")
def notAllSatisfy[A](m: => Matcher[A]): Matcher[Iterable[A]] = allSatisfy(m).not
"allSatisfy" should {
"Pass if all elements satisfy the expectation" in {
List(1, 2, 3, 4) must allSatisfy(beLessThan(5))
}
"Fail if any elements do not satisfy the expectation" in {
List(1, 2, 3, 5) must notAllSatisfy(beLessThan(5))
}
}
}
For every Card, I would like to attach a special number to them that increments by one.
I assume I can do this all in the controller.
def create
@card = Card.new(params[:card])
@card.SpecNum = @card.SpecNum ++
...
end
Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020.
Any ideas?