I have designed a custom style in blend and want to use it in my code in c# . How to achieve it? |
As far as i know it should work.
Ok, how about changing the whole method?
How about developing Custom User Control, just copy-paste your XAML, name
it MyButton, and use as a ordinary button:
MyButton a = new MyButton();
|
how to achieve master detail table data insertion in MVC 4 code first approch |
Your design should look like following if we consider one to many
relationship in EF
customer table(Assume that it Customer class)
public int CustomerID { get; set; }
public string Name{ get; set; }
public string Address { get; set; }
public List<CustomerDetail> CustomerDetails{get; set; }
customer_contact table(Assume that it CustomerDetail class)
public int CustomerDetailId{ get; set; }
public string ContactName { get; set; }
public string PhoneNo { get; set; }
public string Email { get; set; }
public int CustomerID { get; set; }
public Customer Customer {get; set; }
|
How to achieve the target in linux c as the java code do when I send a http post request to a server? |
Contrary to Java C doesn't come with a standard http client in its library
(but then, you're using Commons HTTPClient in your Java example, also a
third party library), so you have to select a third party library that
implements this functionality. There are dozens to choose from, from quick
and dirty to the multiprotocol all singing and dancing libcURL. On the
libcURL site you'll even find a list of their competitors aka alternatives.
Which one is "best"? That depends largely on what you find important, but
libcURL is well documented, and comes with a load of examples - this one
especially as it's very close to what you want. Due to its popularity it
will also eb a lot easier to find help in case of trouble. It even has its
own tag here
|
Can IIS or asp.net/mvc somehow achieve this? |
URL Rewrite IIS Extension won't be helpful as it's based on URL pattern. It
doesn't care about whether the site is up or down.
You should consider setting up a load balancer instead. It's its job to
decide which server to hit depending on server current load or if it's
available or not.
|
how can I achieve this with css? |
Here's a basic example.
CSS:
.menu { width: 300px; border-bottom:1px solid #ddd; margin:0; padding:0 }
.menu-item { border-left:5px solid #fff; border-top: 1px solid #ddd;
color:#666; list-style:none; padding:5px; }
.menu-item:hover { border-left:5px solid #ddd; background: #eee; }
HTML:
<ul class="menu">
<li class="menu-item">Item 1</li>
<li class="menu-item">Item 2</li>
</ul>
http://jsfiddle.net/G2fcY/
TL;DR: Use borders to get the 'blue tab' thing you're talking about.
|
How to achieve this url routing? |
All you need to do is modify the signatures of your Controller methods,
like so:
In your UserController:
public ViewResult Show(string id)
In your ProductController:
public ViewResult Show(string category)
and in your CommentController:
public ViewResult Show(int id)
and it will work (of course you need to change the implementation too...
this is assuming, for instance, that the string "hamid-reza" is an ID of
some kind).
|
How to achieve Cin<< with spaces in c++ |
Something like this will allow exactly three strings to be written on a
line:
std::string line;
std::getline(std::cin, line);
std::istringstream iss(line);
std::string command, param1, param2;
if (!(iss >> command >> param1 >> param2)) {
std::cout << "Missing some input.
";
} else if (std::cin >> std::ws && std::cin.peek() != EOF) }
std::cout << "Too many parameters.
";
} else {
std::cout << "Ok.
";
}
|
How to achieve p2p on android |
If the only issue with XMPP is that your users don't use Google Talk you
should set up a server and rely on in-band registration.
Look at these Q&A to learn what it is and how you can get it in android
|
How to achieve this in Emacs? |
There is MiniMap package. From EmacsWiki:
Put minimap.el in your load path.
(require 'minimap)
Use M-x minimap-create in a buffer you’re currently editing.
Use M-x minimap-kill to kill the minimap.
Use M-x customize-groupRETminimap RET to adapt minimap to your needs.
|
How does one achieve const_auto, since C++11 lacks it? |
C++11 does allow you to write
const auto p = a.begin();
However, this doesn't do what you want. This makes a regular iterator to
non-constant data whose value cannot be changed.
The type of the right-hand side a.begin()is determined by the type of a,
and not by anything on the left-hand side. If a is non-const, then the
non-const version of a.begin() will be called. So, you could cast a to a
const& and then use it, or you could make a constant reference to a and
use that:
const auto& b = a;
auto p = b.begin();
However, a simpler approach would be to use the newly introduced .cbegin()
and .cend():
auto p = a.cbegin();
|
How to achieve .svn folder only in root? |
Former versions of svn were creating .svn in each folder. Since version 1.7
.svn folder is created once per working copy.
So if you want to have a single .svn directory, you must use client version
1.7 or better.
|
How to achieve submenu effect? |
Check this Demo : http://jsfiddle.net/kP4jt/
HTML Code
<ul>
<li><a href='#'>One</a></li>
<li><a href='#'>Two</a></li>
<li><a href='#'>Three</a></li>
<li><a href='#'>Four</a></li>
<li><a href='#'>Five</a>
<ul>
<li><a href='#'>Sub Menu 1</a></li>
<li><a href='#'>Sub Menu 2</a></li>
<li><a href='#'>Sub Menu 3</a></li>
</ul>
</li>
</ul>
CSS Code
* { padding: 0; margin : 0; }
ul li {
float : left;
list-style-type : none;
position : relative;
}
ul li a {
display : block;
padding :
|
Update from EntityListener - or is there a better way to achieve this? |
I normally use @PrePersist and @PreUpdate for stuff like this. It looks
like Rule has a direct reference to Strategy so you can put the @PreUpdate
method there:
@Table(name = "rule")
@EntityListeners({RuleListener.class})
public class Rule {
// ...
@PreUpdate
public void preUpdate() {
strategy.setModifiedDate(new Date());
}
}
Alternatively, you can tell your relationship to cascade updates to
Strategy and put the @PreUpdate in Strategy instead (this way you can still
change modifiedDate if Strategy is updated independently):
@Entity
@Table(name = "strategy")
public class Strategy {
// ...
@PreUpdate
public void preUpdate() {
modifiedDate = new Date();
}
}
@Table(name = "rule")
@EntityListeners({RuleListener.class})
public class Rule {
// ...
@ManyToOne(f
|
How to achieve the following in Cypher query? |
I think you can use the ALL predicate to ensures that for each node n in
the path p there doesn't exist a node in pt that has the same id as the
node n,
START s=node(1), t=node(4)
MATCH p=s-[*]-pt--t
WHERE SINGLE (n1 IN nodes(p)
WHERE id(n1)=id(t))
WITH DISTINCT collect(id(pt)) AS pts, t
MATCH p=t-[*]-pfn
WHERE ALL (n IN nodes(p)
WHERE NONE (pt IN pts
WHERE id(n)= pt))
RETURN DISTINCT pfn AS pf
|
How to achieve jpeg lossless? |
Standard java does not have a compression type for JPEG-LS.
You can to download and use the JAI (Java Advanced Imaging) API though
which I beleive includes such a compression type.
Can be downloaded from here
|
achieve this tabbed effect in css |
Ok here's my very crude attempt at this using pure CSS..
Here's the fiddle: http://jsfiddle.net/PJbhQ/4/
Here's the CSS:
.nav-tabs > li > a{
box-shadow: -2px -1px 3px -1px #aeaeae, 2px -1px 3px -1px #aeaeae;
background-image:linear-gradient(to bottom, #fefefe, #dddedd);
//border-bottom-color: transparent;
border-radius: 8px 20px 0 0;
border-bottom: none;
}
.nav-tabs > li > a:after{
background-attachment: scroll;
background-clip: border-box;
background-color: transparent;
background-image: radial-gradient(circle at 100% 0 , rgba(255, 255,
255, 0) 14px, #999 17px, #dddedd 18px);
background-origin: padding-box;
background-position: left bottom, right bottom, right top, left top;
background-repeat: no-repeat;
background-size:
|
How to achieve MCDC for the following requirement ? |
Treat x==10 as A, y==false as B, y==true as C
Write separate MCDC table for two conditions as
A AND B TT TF FX
A AND C TT TF FX
|
How to achieve dynamism with Joomla? |
You can not build complex custom forms with Joomla out-of-the-box.
The best solution depends on your needs - especially your further
processing of the order.
If you just want to send it by mail to someone or to have it saved in the
database, then it would be a enough to use a form extension for joomla. You
will find many form extension on JED - they vary a lot in features,
usability,flexibility and price. I often use breezingforms because it is
very flexible and you can extend it with your own code (mostly).
If you want a full "shop" then you should have a look at the virtueMart
extension for joomla. Or even at a shop system instead of joomla.
If you want full control you can write your own HTML and PHP Code and
inject it into Joomla by a module such as Sourcerer from nonumber.nl. Or
|
How to achieve floating div on scrolldown |
You can do something like this on that line:
$(".articlebutton").css("top", $(window).scrollTop());
Or event better, use a position: fixed; top: 0;
|
How to achieve the following flow in android app? |
Override the back button to do your desired function:
@Override
public void onBackPressed() {
Your function here.
super.onBackPressed();
}
And also you can add flags to your intent while calling respective
activiies:
1.FLAG_ACTIVITY_NO_HISTORY
|
How to achieve URL rewrite in mvc3? |
It sounds like you just want WebForm1.aspx to take you over to
MyDirectory/MyPage. I would suggest redirecting the user to your new page:
<system.webServer>
<rewrite>
<rules>
<rule name="WebFormToMyPage" stopProcessing="true">
<match url="^webform1.aspx" />
<action type="Redirect" url="MyDirectory/MyPage"
appendQueryString="false" />
</rule>
</rules>
</rewrite>
|
Trying to achieve this styling for messages |
HTML:
<div class="row">
<div class="span12">
<div id="message-container">
<div class="message">
<img src="images/message_avatar.jpg" alt="Profile Avatar" />
<div class="entry-content">
<h2>Charles Geschke</h2>
<h3 class="time">10:00 A.M</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nunc condimentum a nunc sit amet bibendum. Vivamus vel eros at turpis
volutpat euismod quis eget dui. Nunc a ultrices lacus, eget porta ipsum.
Phasellus vel ornare urna. Cras accumsan ipsum a dui vestibulum mattis.
Aenean a arcu porttitor quam molestie auctor.</p>
</div>
</div>
</div>
</div>
</div>
CSS:
.message img,
.
|
how to achieve conditional app_offline.htm in asp .net IIS 7 |
Sadly I dont think that is possible. App_offline.htm is a one-trick-pony
and just takes the app offline.
You mention being able to amend IIS settings. Are you able to set up a
second site within IIS and restrict access by IP address, therefore still
having your existing site online.
|
How to achieve Multiple inheritance in C#? |
C# does not support multiple inheritance. However you can achieve this via
multiple interfaces.
public interface ISecureInfo
{
}
public interface IGeneralInfo
{
}
public class UserClass : ISecureInfo, IGeneralInfo {
}
|
How to achieve single sign on? |
Assuming you have a common database for all this, you can achieve this by
writing few API's.
And use a kind of tokenization approach. That means when a user enters
valid credentials, you create a token and store it in db for that user and
return the same token as a response.
Use the same token to set it as browser session or cookie, and now across
different application i.e 1.Openerp 2.Magneto 3.Php web site read the above
cookie/session, if it is set, log them in.
|
Is there a way to achieve JIT performance without JIT overhead? |
I have just found my answer here:
Why is Java faster when using a JIT vs. compiling to machine code?
Quote from top answer:
This means that you cannot write a AOT compiler which covers ALL Java
programs as there is information available only at runtime about the
characteristics of the program.
|
How to achieve following result in Javascript? |
var exist_file = document.getElementById('exist_file').value,
msg = "The file" + exist_file.toString() + "has been already
transferred? Do you want to overwrite?";
document.getElementById('dialog-confirm-upload').innerHTML= msg;
This snippet works for both cases where exist_file is an array or a string.
|
how to achieve this in java ? requirement given below |
An array of ArrayLists
List<Integer>[] nodes = new ArrayList[count];
An ArrayList of ArrayLists
List<List<Integer>> nodes = new
ArrayList<List<Integer>>(count);
|
How to achieve smooth transition between webpages? |
First of all, you definitely should use jQuery, since it makes the
animation creation much easier. Here's how you should go about it:
Put the entire page contents( all of them, as you stated all the pages are
just one page ) in a wrapper div.
This wrapper div should have max width of 100% and overflow: hidden
Create a second wrapper div inside the main wrapper, but this one's width
is equal to the gross widths of all pages(or better say pseudo-page or
something)
Now each page is a div inside the second wrapper and there positions must
be absolute( then you should set the appropriate left and top positions for
them).
the second wrapper's position must be absolute too
and the first wrapper's position must be relative, or none of the absolute
positions would work the way you wanted it to.
|
How to achieve such Pivot Table in mysql? |
SELECT regd, Name_of_Student, Class, Section, Rollno,
MAX(If(Month = 'January', Status, 0)) AS Jan,
MAX(If(Month = 'September', Status, 0)) AS Sept
FROM fee
where Class='XI(Art)' and Rollno='2'
GROUP BY regd, Name_of_Student, Class, Section, Rollno;
|
how to achieve this effect on iphone,just like the ios 5.0 music app? |
It's a UIMenuController. Check the documentation.
|
How to achieve iOS 7 Tab bar icon design for iOS5/6 |
You can using the appereance protocol, in iOS7 is mostly made using new
features, but from iOS5 appereance method make you able to do that. you
just need to change the background (-setBackgroundImage:) image of the
tabbar and each UItabbarItem for viewcontrollers from selected to
unselected state( -setFinishedSelectedImage:withFinishedUnselectedImage: ).
There is also a tint property if you do not need to apply different image
for each VC.
Check the doc here
Check also this answer
|
How to achieve evenly spaced layout |
Put your ZEBRA and SPEAKER buttons in vertical LinearLayout. Set buttons'
height to match_parent and layout_weight to 1 and you should have what you
want
and if you want to distribute width among your buttons' container and
ImageView, set them width to match_parent and play with layout_weight
there.
|
What is simpler way to achieve an if then else if else stack in javascript |
you can use a var to store your choice and return it at the end
mode = (function(mode, current, proposed, origins, destinations) {
var varName='move';
if (mode === 'none') {
varName='project';
} else if (proposed.count === 0) {
varName='unseated';
} else if (current.count > proposed.count &&
proposed.count > 0) {
varName= 'reducing';
} else if (proposed.count === destinations.count &&
destinations.count > 1 && current.count === 0) {
varName= 'newplus';
} else if (proposed.count === destinations.count &&
current.count === 0) {
varName='new';
|
Cannot achieve HTTP caching in android |
You can't really cache POST responses. Use the GET method instead. Here's a
working example of a Retrofit and OkHttp with caching:
https://gist.github.com/swankjesse/5889518
|
How can I achieve this Database relationship in rails |
I think this should work
class User
has_many :parents, through: 'students_parents'
has_many :students, through: 'students_parents'
class StudentParent
belongs_to :student, class_name: 'User'
belongs_to :parent, class_name: 'User'
|
How to achieve "compile-time includes" in PHP? |
This is wrong assumption of yours.
Neither 200 nor 404 have to be sent in case of error but 503.
It is said that modern PHP versions have to take care of it, but I have
some reports that it doesn't.
The only guaranteed way known to me is to use php-fpm, as sending 503 in
case of error is one its core features.
Anyway, at least try to set display_errors = off in PHP settings (ini or
perdir) and see. there should be no error message (as it ought to be on a
live server) but 5xx status which will tell a client that page exists but
experience temporary problems.
|
How to achieve depth value invariance between two passes? |
Have you tried glDepthFunc(GL_EQUAL) instead of your
in-shader-comparison-approach?
Are you reading and writing to the same depth-texture in the same pass?
Im not sure if gl_FragCoord's format and precision is correlated with the
one of the depth-buffer. Also it might be a driver glitch, but
glDepthFunc(GL_EQUAL) should work as expected.
|
How do I achieve through Jboss Resteasy interceptors? |
Why not forget setting the enterpriseId value when the method is called and
instead just inject the HttpServletRequest and use that to grab the session
and value?
@POST
@Produces("text/json")
@Path("/qciimplinv")
public String getInvSummary(String circuitType, @Context HttpServletRequest
servletRequest) {
HttpSession session = servletRequest.getSession();
String enterpriseId = session.getAttribute("EnterpriseId").toString();
....
businessMethod(enterpriseId,circuitType);
....
}
|
RSpec - If I avoid using let, let and before, how to achieve same functionality? |
Whoever wrote those best practices actually wants to just say "don't use
RSpec". It's insane to avoid using core features and still think you can
get things done well. Can you link to these best practices? I'd love to
read them and see if they're justified or just some j-random-guy's opinion.
Avoid before and let? What? Really?
Avoid specify, I guess, it's just older syntax for it.
Avoid a specific subject call? I guess, if your code lives in an
idealistic fantasy land. Strive to minimize it and use implicit subjects?
Sure.
Avoid its? It's awesome! Why avoid it? Self-documenting one-line specs?
How horrible.
|