What I basically want is a Colorbox (which is a lightbox clone), to have an argument which chooses different stylesheets dependant on which variable I provide.
I have the following line of code that I use to update my personal date variable in my projects to todays current date. This line works in Ubuntu's terminal, but the Mac terminal seems to be far behind. Unfortunately, I copied this snippet from some site, so I'm not sure how it exactly works. Suggestions?
grep -ilr --exclude=revar.sh --exclude=README.md "[DATE]" * | grep -v .git | xargs -i@ sed -i "s/\[DATE\]/${today}/g" @
Is there a way to set up a git repository, so that git pull defaults to one remote and git push defaults to another? I know I can set both by changing the value of the remote variable in branch section of .git/config, but how to do it for each direction separately?
I'm working on implementing the equality operator = for a custom class of mine. The class has one property, Value, which is itself a List(Of OtherClass), where OtherClass is yet another custom class in my project.
I've already implemented the IComparer, IComparable, IEqualityComparer, and IEquatable interfaces, the operators =, <>, bool and not, and overriden Equals and GetHashCode for OtherClass. This should give me all the tools I need to compare these objects, and various tests comparing two singular instances of these objects so far checks out.
However, I'm not sure how to approach this when they are in a List. I don't care about the list order. Given:
Dim x As New List(Of OtherClass) From
{New OtherClass("foo"),
New OtherClass("bar"),
New OtherClass("baz")}
Dim y As New List(Of OtherClass) From
{New OtherClass("baz"),
New OtherClass("foo"),
New OtherClass("bar")}
Then (x = y).ToString should print out True.
I need to compare the same (not distinct) set of objects in this list. The list shouldn't support dupes of OtherClass, but I'll have to figure out how to add that in later as an exception. Not interested in using LINQ. It looks nice, but in the few examples I've played with, adds a performance overhead in that bugs me. Loops are ugly, but they are fast :)
A straight code answer is fine, but I'd like to understand the logic needed for such a comparison as well. I'm probably going to have to implement said logic more than a few times down the road.
Let's say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows:
const char* ansiString = env-GetStringUTFChars(myString, 0);
is there a way of getting
const wchar_t* unicodeString = ...
If I want to get a user that has the email address of '[email protected]', how do I pass that as a parameter in linq?
ie.:
var a = from u in Users
where u.Email = @email
Select u;
So this would be used in my method:
public static GetuserByEmail(string email)
Do I just pass in the variable or?
I guess, DAO is thread safe, does not use any class members.
So can it be used without any problem as a private field of a Servlet ? We need only one copy, and
multiple threads can access it simultaneously, so why bother creating a local variable, right?
I have written a text editor using JavaScript.
Here I am not storing the written text in any variable, Now I want to replace some text/string of some selected text with other text/string.
Can anyone suggest me, how to do it using JavaScript.
Thanks
I am having trouble believing the following code is the most efficient way to move a value from the stack to ST(0):
.data
var dd 4.2
tmp dd ?
.code
mov EAX, var
push EAX
; top of stack now contains a value
; move it to ST(0)
pop EAX
mov tmp, EAX
fld tmp
Is the temporary variable really necessary? Further, is there an easier way to get a value from the stack to ST(0)?
Dumb question, but whenever you call new, do you always have a pointer?
SomeClass *person = new SomeClass();
And is that because you need a pointer to point to that new space of memory that was allocated for the SomeClass variable person? Thanks!
I have the following TSQL Statement:
SELECT ProductId, OwnerId FROM Product
How I can store the ProductId and OwnerId in a TSQL variable and then return it to the calling application?
I'm writing a page that does very simple search queries, resulting in something like:
SELECT * FROM my_table WHERE A in (a1, a2, a3) AND B in (b1, b2) AND C in (c1, c2, c3, c4) AND
And so on for a variable number of columns, usually ~5. If I create a separate index for each column (one for A, one for B, one for C, not (A,B,C)), will all of them be used in the above query?
This should be really simple but I'm a javascript/jQuery rookie, so here we go:
With the following code I can select a certain element
var user = $(".ui-selected .user-name").html();
But if there are multiple elements with the above classes, only the first value gets selected. What I would like to accomplish is a variable with all the elements seperated by a , like: user1,user2,user3 ... etc.
Any help would be greatly appreciated, thanks in advance!
I'm writing a C++ app.
I have a class variable that more than one thread is writing to.
In C++, anything that can be modified without the compiler "realizing" that it's being changed needs to be marked volatile right? So if my code is multi threaded, and one thread may write to a var while another reads from it, do I need to mark the var volaltile?
[I don't have a race condition since I'm relying on writes to ints being atomic]
Thanks!
I want to generate a bat file for multiple tag processing and the command lines look like this:
"C:\Program Files (x86)\tools\tag.exe" -t Genre="%genre%" "%_folderpath%\%track%. %title%.%_extension%"
IF ERRORLEVEL==1 PAUSE
I can populate all variables automatically but can I replace the %title% variable with a wildcard?
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
system("pause");
return main();
}
The above works,but it hardcoded the main(),is there a magic variable to get the current running function?
Please help me with this problem. I'm new in extJs and i need a little help.
I have this code
Ext.onReady(function() {
var datesStore = new Ext.data.JsonStore({
start : 'StartTableDate',
end : 'FinishTableDate',
autoLoad : true,
proxy : new Ext.data.HttpProxy({
url : 'dates.json',
method:'GET'
}),
fields : [
// 2 mandatory fields
{name:'StartTableDate'},
{name:'FinishTableDate'}
]
});
// i want to pass to variable start si end the values from JSON
var start = 'StartTableDate';
var end = 'FinishTableDate';
My favorite candidate again. I am in the process of identifying memory leaks in my app (a puzzling challenge for a newbe like me).
I am using the xCode leak analyzer, but what puzzles me is how to trace back a memory leak to its variable or value. Is there a pointer to the instances that have reserved a memory address where a leak is identifyed?
How do I best go about it?
Hi:
Is there any alternative to non-ISO gcc specific extension __attribute__ on 64-bit kernels ?
Three types that i've noticed are: function attributes, type attributes and variable attributes.
eg.
i'd like to avoid using __attribute__((__packed__)) for structures passed over the network, even though some gcc based code do use it.
Any suggestions or pointers on how to entirely avoid __attribute__ usage in C systems/kernel code ?
thanks
Saifi.
I have a pagination script that displays a list of all pages like so:
prev [1][2][3][4][5][6][7][8][9][10][11][12][13][14] next
But I would like to only show ten of the numbers at a time:
prev [3][4][5][6][7][8][9][10][11][12] next
How can I accomplish this? Here is my code so far:
<?php
/* Set current, prev and next page */
$page = (!isset($_GET['page']))? 1 : $_GET['page'];
$prev = ($page - 1);
$next = ($page + 1);
/* Max results per page */
$max_results = 2;
/* Calculate the offset */
$from = (($page * $max_results) - $max_results);
/* Query the db for total results.
You need to edit the sql to fit your needs */
$result = mysql_query("select title from topics");
$total_results = mysql_num_rows($result);
$total_pages = ceil($total_results / $max_results);
$pagination = '';
/* Create a PREV link if there is one */
if($page > 1)
{
$pagination .= '< a hr_ef="?page='.$prev.'">Previous</a> ';
}
/* Loop through the total pages */
for($i = 1; $i <= $total_pages; $i++)
{
if(($page) == $i)
{
$pagination .= $i;
}
else
{
$pagination .= '< a hr_ef="index.php?page='.$i.'">'.$i.'</a>';
}
}
/* Print NEXT link if there is one */
if($page < $total_pages)
{
$pagination .= '< a hr_ef="?page='.$next.'"> Next</a>';
}
/* Now we have our pagination links in a variable($pagination) ready to
print to the page. I pu it in a variable because you may want to
show them at the top and bottom of the page */
/* Below is how you query the db for ONLY the results for the current page */
$result=mysql_query("select * from topics LIMIT $from, $max_results ");
while ($i = mysql_fetch_array($result))
{
echo $i['title'].'<br />';
}
echo $pagination;
?>
We can replace strings in a batch file using the following command
set str="jump over the chair"
set str=%str:chair=table%
These lines work fine and change the string "jump over the chair" to "jump over the table". Now I want to replace the word "chair" in the string with some variable and I don't know how to do it.
set word=table
set str="jump over the chair"
??
Any ideas?
I'm working on implementing different APIs in C and C++ and wondered what techniques are available for avoiding that clients get the encoding wrong when receiving strings from the framework or passing them back. For instance, imagine a simple plugin API in C++ which customers can implement to influence translations. It might feature a function like this:
const char *getTranslatedWord( const char *englishWord );
Now, let's say that I'd like to enforce that all strings are passed as UTF-8. Of course I'd document this requirement, but I'd like the compiler to enforce the right encoding, maybe by using dedicated types. For instance, something like this:
class Word {
public:
static Word fromUtf8( const char *data ) { return Word( data ); }
const char *toUtf8() { return m_data; }
private:
Word( const char *data ) : m_data( data ) { }
const char *m_data;
};
I could now use this specialized type in the API:
Word getTranslatedWord( const Word &englishWord );
Unfortunately, it's easy to make this very inefficient. The Word class lacks proper copy constructors, assignment operators etc.. and I'd like to avoid unnecessary copying of data as much as possible. Also, I see the danger that Word gets extended with more and more utility functions (like length or fromLatin1 or substr etc.) and I'd rather not write Yet Another String Class. I just want a little container which avoids accidental encoding mixups.
I wonder whether anybody else has some experience with this and can share some useful techniques.
EDIT: In my particular case, the API is used on Windows and Linux using MSVC 6 - MSVC 10 on Windows and gcc 3 & 4 on Linux.
how pass a parameter to onload function??
<body onLoad="myFunction(<%=myVar%>)">
It crashes.
The parameter is a vb variable defined with Dim
The function is a vbscript function
Urgent HELP