Thursday, 3 October 2013

How do I bind following object with following model?

How do I bind following object with following model?

This is my object
$scope.status = [{ "code": "CNA", "name": "Consignee Not Available" }, {
"code": "TBD", "name": "To Be Delivered" }, { "code": "CRA", "name":
"Consignee Refused To Accept" }, { "code": "D", "name": "Delivered" } ]
my HTML is as follows
<select ng-options="status.name for status in status"
ng-model="awb.delivery_fail_reason"> <option value="">Please Select
Status</option> </select>
so what I want is
when user selects the status To be Delivered my model variable
awb.delivery_fail_reason should be set to TBD
when model awb.delivery_fail_reason is TBD it should automatically set
select to To Be Delivered Is this possible ?

Wednesday, 2 October 2013

How to click a button programmatically in Windows Phone

How to click a button programmatically in Windows Phone

I have a Button on my app screen and I want to test its functionality in
various test cases by programmatically invoking the click event. For
Windows Phone SDK there is no button1.PerformClick() that I can call. I am
getting the button by traversing the Visual Tree; so, I have no access to
the event handler subscribed to the Click event of that button. I need to
somehow get the event handler delegate, subscribed to the event and then
invoke that event handler like this eventHandler.Invoke(button,
EventArgs.Empty).
Does anyone know how I can get the event handler delegate?

Site wide https with Laravel 4

Site wide https with Laravel 4

I am curious to find out how people are doing site wide https with links
and forms. I am familiar with URL::secure for generating a form link. It
looks like you can pass https to a route to force https. Does this mean I
have to set https on every route definition?

iBooks author : Widget Javascript/Ajax and PHP

iBooks author : Widget Javascript/Ajax and PHP

Using the software iBooks Author (produced by Apple), I am trying to
create a form with javascript, to send data with JQuery, Ajax and so the
POST method.
I wanted to know if it was possible to use the POST method to a php script
on a server (then store with MySQL), and if so, how you would do.
Thanks you in advance.

Order a select by Name and id (ELEVATEDB)

Order a select by Name and id (ELEVATEDB)

I Have a table named families, where i have nested families of products.
All the entries of the table that have a length lower than 5, are parent
families, and the families with a length of 5, are families with
associated products. For example: ID Name
001 food
00101 cookies
002 Cars
00201 ferrari
003 bike
00301 yamaha
Thats an example of my Db. I want to represent it on mvc c# list. But the
problem is, that I need to group it by Id, and order it by name too. For
example, I would like to have:
003 bike
00301 yamaha
002 Cars
00201 ferrari
001 food
00101 cookies
What I want to order alphabetically is the name of parent Families
(Bike,Cars,Food).
I'm using ElevateDb and MVC 4 c# in the other side, maybe, there is a way
to do it in the c# list too.

Tuesday, 1 October 2013

Including Media in Visual Basic Windows Forms

Including Media in Visual Basic Windows Forms

So I want to include a .WAV file in my windows form.
I can get it to load and play, but when I open the application on another
computer, there's an error.
I have been linking the .WAV file to a local folder (C:\Windows\Users and
so on and so forth until I reach the file)
What changes need to be made so I can put the .WAV file in another place,
and can you give some details on how to do so?
Thanks!
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
My.Computer.Audio.Play("C:\Users\RFair_000\Documents\Dropbox\School\Programs\Top
Gun\Top Gun\Top Gun.wav")
End Sub

Will be there value of a,b,c such that a+b=c and true for 1/a + 1/b = 1/c?

Will be there value of a,b,c such that a+b=c and true for 1/a + 1/b = 1/c?

I have a question in my homework, but i am stuck. I am waiting for your
help guys!
Question:
"Suppose we have three real numbers a, b, and c which satisfy the equation
a + b = c; Is it then also true that 1/a + 1/b = 1/c or not?
Or is it only true for some particular choice of a, b, and c, and which
would that be?"

Removing old Exchange server

Removing old Exchange server

We migrated an Exchange 2003 to exchange 2010 running on a new Windows
Server 2008 R2. The old Windows Server 2003 with Exchange 2003 is not
anymore (physically :-)) exist.
On my Exchange Server I saw event id 5006 MSEchangeTransport. When running
the Get-ExchangeServer cmdlet I still saw the old exchange server which
doesn't exist anymore.
I've followed these steps (http://support.microsoft.com/kb/833396) to go
to CN=Configuration, DC=Domain_Name,DC=com, CN=Services .... CN=Servers
Now I see on the CN=First Administrative Group > CN=Servers the old server
as only server listed and on the CN=Exchange Administrative Group >
CN=Servers I see the existing server as the only server listed.
Can I just remove that old server from the CN=Frist Administrative Group >
CN=Servers or should the new server also exist in the First Administrative
Group instead of only in the Exchange Administrative Group?
I'm using ADSI Edit on the Domain Controller, I suppose that there is no
difference on using it here or on the Exchange Server itself?

Protect scanned signature in a PDF – tex.stackexchange.com

Protect scanned signature in a PDF – tex.stackexchange.com

I would like to include a scanned signature in my PDF and send it via
email. Call me a tin-foil hat but I know how easy it is to open a PDF
using, say, inkscape and extract the signature graphics from …

Monday, 30 September 2013

Translation of sentence into logical proposition

Translation of sentence into logical proposition

Given the sentence: "You can access the internet only if you are a
computer science major or you are not a freshman" and functions:
a = you can access the internet
b = you are a computer science major
c = you are a freshman
we need to translate into a logical proposition.
My intuitive approach is to say (b v ~c) -> a.
However, the solution suggested is a -> (b v ~c).
Are these two equivalent in the sense that the proposition was really an
iff statement? If this is the case, why wasn't it translated to [a -> (b v
~c)] ^ [(b v ~c) -> a]?

CSS3 image animation inside a div element stretches

CSS3 image animation inside a div element stretches

I want to place a large image that would be "scrolling" up & down inside a
<div> element. The problem is that the images' size is stretched to the
size of the #animation-win div element. The images' height is greater than
300px, so that is the reason why I want to scroll it up&down so it can
appear in its original size within the 300px div element. Can it be done?
Thank you very much.
This is the html:
<div id="animation-win">
<div class="anim">
</div>
</div>
This is my CSS:
#animation-win {
background:#000;
position: relative;
width:900px;
height:300px;
}
.anim
{
background-image:url('../images/picture1.jpg');
background-size: 100% 100%;
position:absolute;
animation:cssanim 5s infinite;
animation-direction:alternate;
/* Safari and Chrome */
-webkit-animation:cssanim 5s infinite;
-webkit-animation-direction:alternate;
}
@keyframes cssanim
{
0% {background:red; left:0px; top:0px;}
100% {background:red; left:0px; top:0px;}
}
@-webkit-keyframes cssanim /* Safari and Chrome */
{
0%{
background-image:url('../images/picture1.jpg');
width:100%;
height:100%;
left:0px;
top:0px;
background-size: 100% 100%;
}
100% {
background-image:url('../images/picture1.jpg');
width:100%;
height:100%;
left:0px;
bottom:549px;
background-size: 100% 100%;
}
}

How to add class to this form_tag in Rails

How to add class to this form_tag in Rails

pI have this form_tag and I need to add a class to it. Not sure how to do
it without breaking it:/p precodelt;%= form_tag sessions_path do %gt;
/code/pre

Apple Mach-o linker error after editing older project

Apple Mach-o linker error after editing older project

I've been asked to make changes to a project that was developed on an
older version of XCode. I'm using version 4.6.3 and when I compile the
project I get the Apple Mach-o linker error which appears to relate to all
of the Frameworks included in the project.
Ld
/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Products/Debug-iphonesimulator/Holiday\
Cash.app/Holiday\ Cash normal i386
cd "/Users/stevecallahan/Documents/Development/Backups/Holiday Cash"
setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
setenv PATH
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch i386 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk
-L/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Products/Debug-iphonesimulator
-F/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Products/Debug-iphonesimulator
-filelist
/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Intermediates/Holiday\
Cash.build/Debug-iphonesimulator/Holiday\
Cash.build/Objects-normal/i386/Holiday\ Cash.LinkFileList -Xlinker
-objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime
-mios-simulator-version-min=4.3 -framework CoreGraphics -framework UIKit
-framework Foundation -framework QuartzCore -framework CFNetwork
-framework CoreLocation -framework CoreTelephony -framework
SystemConfiguration -lxml2 -lxml2.2 -Xlinker -dependency_info -Xlinker
/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Intermediates/Holiday\
Cash.build/Debug-iphonesimulator/Holiday\
Cash.build/Objects-normal/i386/Holiday\ Cash_dependency_info.dat -o
/Users/stevecallahan/Library/Developer/Xcode/DerivedData/Holiday_Cash-esepntvcbxyfowcnsvozpxnthhel/Build/Products/Debug-iphonesimulator/Holiday\
Cash.app/Holiday\ Cash
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CoreLocationController", referenced from:
objc-class-ref in PlacesTableViewController.o
"_OBJC_CLASS_$_GDataXMLDocument", referenced from:
objc-class-ref in PlacesTableViewController.o
objc-class-ref in CurrancyViewController.o
"_OBJC_CLASS_$_KLCalendarView", referenced from:
objc-class-ref in CalendarTestViewController.o
"_OBJC_CLASS_$_KLTile", referenced from:
_OBJC_CLASS_$_CheckmarkTile in CheckmarkTile.o
"_OBJC_CLASS_$_MKMapView", referenced from:
objc-class-ref in actaulMap.o
"_OBJC_CLASS_$_MapView", referenced from:
objc-class-ref in PlacesTableViewController.o
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in FirstLevelViewController.o
"_OBJC_CLASS_$_THCalendarInfo", referenced from:
objc-class-ref in KLCalendarModel.o
"_OBJC_METACLASS_$_KLTile", referenced from:
_OBJC_METACLASS_$_CheckmarkTile in CheckmarkTile.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've tried a number of solutions including making sure all of the .m files
were added to Compile Sources of Build Phases Tab under the Project
Settings. I also ensured the Architectures were all the same but I still
get the error and I'm not sure what to try next.

Sunday, 29 September 2013

AFNetworking success block ReusableCell

AFNetworking success block ReusableCell

I need to save downloaded Images to the device, so I'm using AFNetworking's
setImageWithURLRequest:placeholderImage:success:failure:
But this sets set's the image in the wrong cell's imageview when I scroll
the table.
What is the correct way to use this method for reusable tableview cells?
This is how I'm using it:
NSURL *nsurl = [NSURL URLWithString:[kBaseURL stringByAppendingString:
remoteImagePath]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:nsurl];
[request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
UIImageView *imgView = imageView;
[imageView setImageWithURLRequest: request
placeholderImage: placeholderImage
success: ^(NSURLRequest *request,
NSHTTPURLResponse *response, UIImage *image) {
imgView.image = image;
NSString *imageName = [[localImagePath
componentsSeparatedByString:@"/"]
lastObject];
[self saveInCacheDirImage:image
withName:imageName];
}
failure: nil
];

my application gets stuck with no reason after running for a while [on hold]

my application gets stuck with no reason after running for a while [on hold]

I have built an application, running on android 4.1.2. I'm using samsung
S2 for running it The application uses GPS location services, audio
recording to a file, and a serial terminal using the OTG USB connection.
Most of the code is executed on each time a location update is reported.
this happens in a period of ~1 second When I start the application,
everything looks ok and it runs for a while, but then the code freezes
suddenly and the application is stuck. it gets stuck after a random period
of time and for sure this time is not constant I don't know why, where and
when is it stuck and I don't know how to investigate it Is there a way to
see what happened somehow ? (I remind you that the application uses the
USB port as a serial terminal so it is not available)
Thanks in advance Tal

How do you get a div class inside a div class inside a div class?

How do you get a div class inside a div class inside a div class?

My problem is that I need to get a div class inside a div class inside a
div class and the are 4 instances of the classes with the same name but
different data... I can currently get the first div class inside the div
class but i need to be able to access other elements within it
aswell......for example:
docTide =
Jsoup.connect("http://www.mhpa.co.uk/search-tide-times/").timeout(600000).get();
Elements tideTableRows =
docTide.select("div.tide_row.odd");
Element firstDiv = tideTableRows.first();
Element secondDiv = tideTableRows.get(1);
System.out.println("This is the first div: " +
firstDiv.text());
System.out.println("This is the second div: "
+ secondDiv.text());
but this is the structure of the webpage where there are 2 repeats and I
need to access each of them e.g:
<div class="tide_row odd">
<div class="time">00:57</div>
<div class="height_m">4.9</div>
<div class="height_f">16,1</div>
<div class="range_m">1.9</div>
<div class="range_f">6,3</div>
</div>
<div class="tide_row even">
<div class="time">07:23</div>
<div class="height_m">2.9</div>
<div class="height_f">9,6</div>
<div class="range_m">2</div>
<div class="range_f">6,7</div>
</div>
<div class="tide_row odd">
<div class="time">13:46</div>
<div class="height_m">5.1</div>
<div class="height_f">16,9</div>
<div class="range_m">2.2</div>
<div class="range_f">7,3</div>
</div>
<div class="tide_row even">
<div class="time">20:23</div>
<div class="height_m">2.8</div>
<div class="height_f">9,2</div>
<div class="range_m">2.3</div>
<div class="range_f">7,7</div>
</div>
Thank you

Access Control Allow Origin on getjson jquery

Access Control Allow Origin on getjson jquery

I have been reading about this jsonp method and i just don't get it and i
dont know what to fix.
here's my code
$(document).ready(function() {
$.getJSON( 'http://nutri.de.imerchmedia.com/services/accounts',
function(data ) {
$('#select').append("<option value='0' name='idsel'>Select Outlet</option>");
console.log(data);
$.each(data, function (i, item) {
$('#select').append("<option value='" + item.outlet_group_id + "'>" +
item.outlet_group_name + " : " + item.outlet_group_code + "</option>");
});
});
});
I hope someone could help me, it's been 2days >.<
and if i use this
var url = "http://nutri.de.imerchmedia.com/services/accounts";
$.ajax({
url: url,
type: 'GET',
dataType: "jsonp",
success: function(data){
console.log(data);
}
});
i always get this Resource interpreted as Script but transferred with MIME
type text/html:
"http://nutri.de.imerchmedia.com/services/accounts?callback=jQuery1102006321510183624923_1380442924579&_=1380442924580".

Saturday, 28 September 2013

Django CSS working wierdly on Google Chrome

Django CSS working wierdly on Google Chrome

So, I have this Django project in which I wanted to display a navbar on
the side of a header image. As the image is big, though, I wanted to make
the navbar apear a little closer to the bottom of the image. I tried this:
#header img {
margin: 5% 0;
display: inline;
vertical-align: -27%;
}
#navbar {
margin: -3%;
padding: 2% 0;
display: inline;
background-color: rgba(100, 100, 100, 0.4);
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
And it worked just fine in Safari, but in Google Chrome the navbar keeps
apearing bellow the image, and the only way to make it appear in the right
place is to change the vertical-align to -300% or a number high as that,
which, then, causes the navbar to apear way over the image in Safari.
I searched this on google but I couldn't find anything. If it helps, I am
using Mac OS X.

How to generate a tags file for all C++ header files of the MSVC folder that couldn't be process by Ctags?

How to generate a tags file for all C++ header files of the MSVC folder
that couldn't be process by Ctags?

How can I generate a tags file for all C++ header files of Microsoft
Visual C++ if the Exuberant Ctags couldn't process in the containing
folder?
For example the containing folder's path of the header files of Microsoft
Visual C++ is: "C:\Program Files\Microsoft Visual Studio 11.0\VC\include"
How to generate a tags file for all C++ files in that containing folder?
And also how to generate for all C++ files in that containing folder and
on its subdirectories?
I already tried the command:
:!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q
--language-force=C++ -f C:\Users\USR\vimfiles\tags\msvc C:\Program\
Files\Microsoft\ Visual\ Studio\ 11.0\VC\include
And the command:
:!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q
--language-force=C++ -f C:\Users\USR\vimfiles\tags\msvc C:\Program
Files\Microsoft Visual Studio 11.0\VC\include
But these are just creating a tags file "msvc" without tagging any files
in the \include folder. In fact this is the full source of the created
tags files:
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to
lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
But I'm pretty sure that those 2 previous commands shall work if the
folder that's in process is on the $HOME of the Windows user such as
"C:\Users\USR".

Xcode IOS: a property of viewcontroller disappears after viewDidLoad has been called

Xcode IOS: a property of viewcontroller disappears after viewDidLoad has
been called

I am writing an app for iphone (iOS 7, Xcode5), and found some strange
behaviour from one of the viewController classes
(TrackDetailsViewController):
When this view is getting called i pass a Track item with some information
i deed through the prepareForSegue method. Now When i check for the Track
Item in the viewDidLoad method it exists and has all the data i expect it
to have. However, when I check it again in the viewDidAppear the Track
Item has become zero (see code below):
TrackDetailsViewController.h:
@interface TrackDetailsViewController : UIViewController
<UIScrollViewDelegate>
@property (weak, nonatomic) Track *track;
@end
TrackDetailsViewController.m:
- (void)viewDidLoad
{
[super viewDidLoad];
//check for track
if (_track !=nil) {
NSLog(@"track not nil");
}
else{
NSLog(@"no track");
}
// Do any additional setup after loading the view.
}
-(void) viewDidAppear: (BOOL) animated{
//check for track
if (track != nil) {
NSLog(@"track not nil");
}
else{
NSLog(@"no track");
}
}
Now the log after running this code (after showing the view in question)
looks like:
2013-09-28 16:25:31.877 I-Sail[1388:c07] track not nil
2013-09-28 16:25:32.235 I-Sail[1388:c07] no track
So, somewhere in-between viewDidLoad and viewDidAppear, the value of the
track property was changed to null.
After that the whole thing becomes even weirder to me, since the track
property keeps its value when i add a variable track2 to the .m file, and
assign the value of the track property to the track2 variable like shown
in the code below:
Track *track2;
- (void)viewDidLoad
{
[super viewDidLoad];
//check for track
if (_track !=nil) {
NSLog(@"track not nil");
}
else{
NSLog(@"no track");
}
//assign the value of _track to the track2 variable
track2 = _track;
}
-(void) viewDidAppear: (BOOL) animated{
//check for track
if (_track !=nil) {
NSLog(@"track not nil");
}
else{
NSLog(@"no track");
}
}
This time the output becomes:
2013-09-28 16:35:57.929 I-Sail[1452:c07] track not nil
2013-09-28 16:35:58.286 I-Sail[1452:c07] track not nil
So the property track keeps its value and i can use it in other methods of
the viewController class as well.
Has anybody experienced issues like this before, some explanation for this
behaviour? or found a more elegant workaround than creating a dummy
variable?
Cheers!