When I SSH into a linux box, I want to have the /etc/profile file save the results of the whoami command to a global environment variable. if I were to go root with the command sudo su -, I do not want that command to run again when gonig root, I want it to stick with the result of whoami as my regular username from before I went root, and I need to access that variable as the root user even though it will run the /etc/profile file again when I go root. What can I do to only run that command once in the /etc/profile command?
I try out CakePHP. I follow this Tutorial and can't find out why this code doesn't work. The code from the tutorial works fine.
echo $html -> link('Löschen', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Sind Sie sicher?' );
I know that C++ has the concept of objects but C doesn't. I also know that pretty much all there is to know about C fits into K & R but the C++ library is vastly more complex. There have got to be other big differences though.
What are the major differences between C and C++?
Select * from Example
where
1 = Case when :index = 0 then
Case when DateEx Between :pDat1 and :pDate2 then 1 end
else
Case When :index = 1 or :index = 2 then
Case When DateEx >= :pDat1 then 1 end
end
end
And
Select * from Example
where
1 = Case when :index = 0 then
Case when DateEx Between :pDat1 and :pDat2 then 1 end
else 1
end
and 1 = Case When :index = 1 or :index = 2 then
Case When DateEx >= :pDat1 then 1 end
end
I'm working on creating a date/time user control in WPF using C# 2008. My first user control. I'm also using Matthew MacDonald's book, "Pro WPF in C# 2008". In that book he strongly recommended creating a user control using the WPF Custom Control Library project template; so I followed his suggestion. I've finished writing the code which would go into what I think of as the code-behind file. Now I'm ready to write the XAML.
The only problem is, I just discovered there is no corresponding .xaml file? So, I don't get why using a WPF Custom Control Library project is better, or prefered, when writing a user control?
In my project I observed that in a FormClosed method (that handles FormClosed event)
is set MdiParent = Nothing (null).
This code makes (? no idea why) that OnLoad(method) on some child panels is raised.
Is there any sense to set MdiParent to null (Nothing) in FormClosed?
hi,
I'm using Swing GroupLayout and I'm confused about the values GroupLayout.DEFAULT_SIZE and GroupLayout.PREFERRED_SIZE. I never know when to use each one of them in methods like GroupLayout.addComponent(Component, int, int, int).
suppose I have this code:
GroupLayout l = ...;
l.setHorizontalGroup(l.createSequentialGroup()
.addComponent(tf1)
.addComponent(tf2));
l.setVerticalGroup(l.createParallelGroup()
.addComponent(tf1)
.addComponent(tf2));
there are two JTextFields on a single line laid out with GroupLayout (one sequential group horizontally and one parallel group vertically). if I resize the window now, both components get the available space (50% each). but I want only the first text field to grow/shrink horizontally and only the second text field to grow/shrink vertically. what values of min, pref and max should I use to accomplish that? I know I can just try it and see what combination works but I'd like to know the reasoning behind this problem.
Here is the mysterious:
I have a scope which looks like this (in Image.rb)
scope :moderate_all, delegates.where("moderation_flag = #{$moderation_flags[:not_moderated]}")
Note that delegates is another scope that I am defining before moderate_all
When I leave it like this, I can run my test that checks if an image has been "checked-out" it is not available anymore. I don't put the code of the test, because it does not matter actually.
With this code, when I run "rake test" it fails, but if I do "ruby test/unit/image_test.rb" it works! I was thinking I am starting to have a bad day. Then I tried
scope :moderate_all, lambda {
delegates.where("moderation_flag = #{$moderation_flags[:not_moderated]}")
}
And "rake test" passes!
So my problem is solved, but why?
I have this code that has one "outerDIV" that contains an "innerDIV". On chrome the "innerDIV" size is 491px, whereas on IE it is 425px (same as outerDIV). Hence, on Chrome I can see the first two children of "innerdiv": "My test string #1" and "test2". But for IE I can only see the first child.
I am not quite sure what the "right" behavior should be, as firefox does the same as IE. However I would like to have IE do the same as Chrome.
I have been experimenting with some css styles (mainly overflow and display), but still can't make it right: IE will expand its height instead of its width to make the elements fit.
Can you guys help me figure out a way to change the css so that IE will wraps the div elements inline? As a restriction though, I cannot change the width on the HTML. As a benefit, I am using a css that only loads for IE to patch these kind of IE inconsistencies. The same css will NOT load for chrome, so I don't need to worry about messing with chrome when changing the IE CSS. Thanks in advance!
<html>
<head>
<style type="text/css">
<!--
body {
font-family: helvetica;
}
.myContainer {
overflow: hidden;
border: 1px solid rgba(0, 0, 0, .5);
font-size: 14pt;
height: 49px;
line-height: 49px;
overflow: hidden;
display: block;
}
.myContainer > DIV {
float: left;
white-space: nowrap;
display: block;
}
.myContainer .item:first-child {
padding-left: 10px;
}
.myContainer .item {
float: left;
padding-right: 32px;
}
-->
</style>
</head>
<body>
<div id="outerDIV" class="myContainer" style="display: block; width: 425px;">
<div id="innerDIV">
<div class="item">
--------My test string #1--------
</div>
<div class="item">
------test2-------
</div>
<div class="item">
test
</div>
</div>
</div>
</body>
</html>
I have two applications, one of which is a store and is located under the virtual directory "store", while the main "application" is the parent website/application. However, when visiting the the top-level website address, I would like to start people in /store/default.aspx (technically "/store/home") but this is not allowed in the entry box in IIS.
Currently I am doing the redirect manually in code, but was wondering if there was a way to do this in IIS or something. Thanks for any help.
I was studying the legacy API's in the Java's Collection Framework and I learnt that classes such as Vector and HashTable have been superseded by ArrayList and HashMap.
However still they are NOT deprecated, and deemed as legacy when essentially, deprecation is applied to software features that are superseded and should be avoided, so, I am not sure when is a API deemed legacy and when it is deprecated.
I've installed English Windows 8 x64 on my notebook and selected Slovenian as locale during installation.
The problem I'm having now is that my tiles on start screen display in Slovenian even though my installation is English. I've also edited languages, adding English (British) on the list and putting it on top of Slovenian, but tiles still use Slovenian...
All previous Windows versions were able to have English UI with a particular locale for input, time, dates, currency etc.
How can I do the same in Windows 8?
I want to do following things:
If recipient address not exist in exchange ,redirect to [email protected]
If recipient address meet specific pattern , redirect to [email protected]
Thank in advance!
Hi
dispite some posts on this forum and others i cannot find something that tells me how to set the focus on a text box.
I have a userControl with many labels and textBoxes.When the form is loaded I want the a particular textBox to have the focus.
I have set the tabIndex but that didnt seem to work.
Any suggestions
Given the following inputs:
line1 = "Hey | Hello | Good | Morning"
line2 = "Hey , Hello , Good , Morning"
file1=length1=name1=title1=nil
Using ',' to split the string as follows:
file1, length1, name1, title1 = line2.split(/,\s*/)
I get the following output:
puts file1,length1,name1,title1
>Hey
>Hello
>Good
>Morning
However, using '|' to split the string I receive a different output:
file1, length1, name1, title1 = line2.split(/|\s*/)
puts file1,length1,name1,title1
>H
>e
>y
Both the strings are same except the separating symbol (a comma in first case and a pipe in second case). The format of the split function I am using is also the same except, of course, for the delimiting character. What causes this variation?
Configuration:
windows 8 (desktop)
firefox (latest version)
I've been trying to figure out how to enable the checkbox to "always open with ... application for file type", for quite a while without any luck.
Can anybody explain to me how I can enable the checkbox (see red rectangle). It's in Dutch, but I hope you recognize the dialog.
Tried so far:
- default programs (control panel)
- HKCU/Microsoft/.../FileExts: remove the UserChoice (but it was already removed, so no luck there either)
Thanks a lot in advance
I can imagine that the 'server' can be a machine/host but can be also a program like ftp server, smtp server, etc..
The 'service' on the other hand refers mainly to applications/programms..
Why can then for example the Sql Server cannot be called as Sql Service? It has the same semanthics. Or the other way round: MS Azure service: why it isn't called Azure Server? :)
In II7 you have the option the choose different application pool type. I have 4 types to choose from
Default Application pool
Classic .Net Application pool
ASP.NET v4.0
ASP.NET v4.0 Classic
What are the differences between these, and when to choose what?
Hi, I can't wrap my brain around this one so I hope someone can help. I have a song track that has the song length in milliseconds. I also have the date the song played in DATETIME format. What I am trying to do is find out how many milliseconds is left in the song play time.
Example
$tracktime = 219238;
$dateplayed = '2011-01-17 11:01:44';
$starttime = strtotime($dateplayed);
I am using the following to determine time left but it does not seem correct.
$curtime = time();
$timeleft = $starttime+round($tracktime/1000)-$curtime;
Any help would be greatly appreciated.
I've just answered problem with sockets in c# where in my example code I initializing my socket using ProtocolType.IP as this is what I've always used in my own code, and it has never caused me problems. But I see many examples specifying ProtocolType.Tcp.
I guess, what I'm asking is, by using ProtocolType.IP instead of ProtocolType.Tcp is anything being performed differently under the hood that I should be aware of?
Hello,
Im using opensource library called wxFreeChart to draw some XY charts. In example there is code which uses static array as a serie :
double data1[][2] = {
{ 10, 20, },
{ 13, 16, },
{ 7, 30, },
{ 15, 34, },
{ 25, 4, },
};
dataset-AddSerie((double *) data1, WXSIZEOF(dynamicArray));
WXSIZEOF ismacro defined like: sizeof(array)/sizeof(array[0])
In this case everything works great but in my program Im using dynamic arrays (according to users input).
I made a test and wrotecode like below:
double **dynamicArray = NULL;
dynamicArray = new double *[5] ;
for( int i = 0 ; i < 5 ; i++ )
dynamicArray[i] = new double[2];
dynamicArray [0][0] = 10;
dynamicArray [0][1] = 20;
dynamicArray [1][0] = 13;
dynamicArray [1][1] = 16;
dynamicArray [2][0] = 7;
dynamicArray [2][1] = 30;
dynamicArray [3][0] = 15;
dynamicArray [3][1] = 34;
dynamicArray [4][0] = 25;
dynamicArray [4][1] = 4;
dataset-AddSerie((double *) *dynamicArray, WXSIZEOF(dynamicArray));
But it doesnt work correctly. I mean point arent drawn. I wonder if there is any possibility that I can "cheat" that method and give it dynamic array in way it understands it and will read data from correct place
thanks for help