An odd question:
Just wondering if it is possible by some loophole to define a method name that ends in a colon. The purpose being things like this:
mymethod: arg1,arg2,arg3
Within my Website project, I have some aspx pages, javascript files, and a custom C# class I called MyCustomReport. I placed a Image box with an ID of Image1 inside SelectionReport.aspx. I need to get access to that Image1 inside MyCustomReport.cs so I can turn it on and off based on conditions. What code do I need to do this? Thanks everyone
$(document).ready(function(){
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var month = new array("January","February","March","April","May","June","July","August","September","October","November","December");
var mon;
mon = month(m);
var today = m+"/"+d+"/"+y
$('#calendar').append('<div id="today">Today is'+' '+mon+'/'+d+'/'+y+'.');
});
The XFBML version of the Facebook Registration plugin only loads HTTPS. I need it to load HTTP so my form does not call a security error mismatch between domains.
I wrote this code to get the SRC and rewrite it with out HTTPS
It works fine on the first load, however on Chrome and Safari it only loads the first time and on HARD refreshes. It does not load on standard reloads or by pressing "enter" on the address bar. Here is the code
$(window).load(function () {
// Replace HTTPS with HTTP when frame has loaded
$(".subscribe iframe").each(function(){
var source = $(this).attr("src");
//alert(source);
var sourceNew = source.replace("https", "http"); // change https to http
alert(sourceNew);
$(this).attr("src", sourceNew);
});
});
I have .HTACCESS set to disable server cache
<Files *>
Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0"
Header set Expires: 0
Header set Pragma: no-cache
</Files>
What is causing this to not fire reliably? Thanks
Hi,
I have been working with C# so this is quite strange for me:
while($variable=mysql_fetch_assoc)
I have not been able to look up in PHP manual how it works. I guess that in each loop it advances to next element of assoc.array. But what is this generally called in PHP? I am just not used to see '=' in loop condition.
I have just seen this in code
var thisYear = (new Date()).getFullYear();
See it live on JSbin.
This is cool, as I've always done something like that in 2 lines, i.e. create the new object instance and assigned it to a variable, then called the method on it.
Is this new method fine to use everywhere? Any gotchas?
xpi_built := $(build_dir)/$(install_rdf) \
$(build_dir)/$(chrome_manifest) \
$(chrome_jar_file) \
$(default_prefs)
xpi_built_no_dir := $(subst $(build_dir)/,,$(xpi_built))
$(xpi_file): $(build_dir) $(xpi_built)
@echo "Creating XPI file."
cd $(build_dir); $(ZIP) ../$(xpi_file) $(xpi_built_no_dir)
@echo "Creating XPI file. Done!"
$(build_dir)/%: %
cp -f $< $@
$(build_dir):
@if [ ! -x $(build_dir) ]; \
then \
mkdir $(build_dir); \
fi
can anyone explain me this makefile part? particularly interested in
$(build_dir)/%: % as well as $< and $@ directives
two labels $(build_dir) exists, I guess both are executed, but in which order?
i have a script, to open a model window, but it wont work. google chrome give me "Uncaught SyntaxError: Unexpected token }", but on a line that doesnt even have a closing curly brace.
here is my script:
function showm(id1){
window.onscroll=function(){document.getElementById(id1).style.top=document.body.scrollTop;};
document.getElementById(id1).style.display="block";
document.getElementById(id1).style.top=document.body.scrollTop;
}
does anybody have any ideas on this? any help is appreciated.
I see code like this all over the web
var days= "Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" ");
Why do that instead of
var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
hi this plugin to highlight words but I'm trying to highlight diacritic arabic word like this example :
jsfiddle.net/z8PUG/84/
but its not working i tested for three arabic characters
'?': '[\u0645\u064b\20\u0645\u064c\20\u0645\u064d\20\u0645\u064e\20\u0645\u064f\20\u0645\u0650\20\u0645\u0651\20\u0645\u0652\20\u0645\u0653]',
'?': '[\u062d\u064b\20\u062d\u064c\20\u062d\u064d\20\u062d\u064e\20\u062d\u064f\20\u062d\u0650\20\u062d\u0651\20\u062d\u0652\20\u062d\u0653]',
'?': '[\u062f\u064b\20\u062f\u064c\20\u062f\u064d\20\u062f\u064e\20\u062f\u064f\20\u062f\u0650\20\u062f\u0651\20\u062f\u0652\20\u062f\u0653]',
I'm trying to set up a batch file to automatically deploy a php app to a web server. Basically, what I want is an entirely automated process: I would just give it a revision number from the repository and it would then export the files, upload via ftp and then update deployment info at the repo host (codebase).
However, I'm starting from scratch here. How would I set up a batch file to accept a variable when it was run?
For example, the command myfile.bat /revision 42 should deploy revision 42 to my server.
If anyone can point me in the right direction I'd appreciate it.
I'm trying to hide the "Server" header returned by Apache on every request, from Varnish.
Using in sub vcl_fetch:
unset obj.http.Server;
on Varnish start I get:
Expected action, 'if' or '}'
(/etc/varnish/default.vcl Line 43 Pos 9)
unset obj.http.Server;
--------#####-----------------
Any ideas?
First, a pseudo code example:
;(function(foo){
foo.init = function(baz) { ... }
foo.other = function() { ... }
return foo;
}(window.FOO = window.FOO || {}));
Called like so:
FOO.init();
My question:
What is the technical name/description of: window.FOO = window.FOO || {}?
I understand what the code does... See below for my reason(s) for asking.
Reason for asking:
I'm calling the passed in global like so:
;(function(foo){
... foo vs. FOO, anyone else potentially confused? ...
}(window.FOO = window.FOO || {}));
... but I just don't like calling that lowercase "foo", considering that the global is called capitalized FOO... It just seems confusing.
If I knew the technical name of this technique, I could say:
;(function(technicalname){
... do something with technicalname, not to be confused with FOO ...
}(window.FOO = window.FOO || {}));
I've seen a recent (awesome) example where they called it "exports":
;(function(exports){
...
}(window.Lib = window.Lib || {}));
I guess I'm just trying to standardize my coding conventions... I'd like to learn what the pros do and how they think (that's why I'm asking here)!
UPDATE files
SET filepath = REPLACE(filepath, `sites/somedomain.com/files/`, `sites/someotherdomain.com/files/`);
I have a table called files with a field called filepath. MySQL returns this error: Unknown column 'sites/somedomain.com/files/' in 'field list'
I have a string a and I would like to split it in half depending on its length, so I have
a-front = len(a) / 2 + len(a) % 2
this works fine in the interpreter but when i run the module from the command line python gives me a SyntaxError: can't assign to operator. What could be the issue here.
I see this in the Django source code:
description = _("Comma-separated integers")
description = _("Date (without time)")
What does it do? I try it in Python 3.1.3 and it fails:
>>> foo = _("bar")
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
foo = _("bar")
NameError: name '_' is not defined
No luck in 2.4.4 either:
>>> foo = _("bar")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
foo = _("bar")
NameError: name '_' is not defined
What's going on here?
I am new to c++, trying to debug the following line of code
class cGameError
{
string m_errorText;
public:
cGameError( char *errorText )
{
DP1("***\n*** [ERROR] cGameError thrown! text: [%s]\n***\n",
errorText );
m_errorText = string( errorText );
}
const char *GetText()
{
return m_errorText.c_str();
}
};
enum eResult
{
resAllGood = 0, // function passed with flying colors
resFalse = 1, // function worked and returns 'false'
resFailed = –1, // function failed miserably
resNotImpl = –2, // function has not been implemented
resForceDWord = 0x7FFFFFFF
};
This header file is included in the program as followed
#include "string.h"
#include "stdafx.h"
#include "Chapter 01 MyVersion.h"
#include "cGameError.h"
Hi,
I was trying to find meaning of this terms but especially due to language barrier I was not able to understand what they are used for.
I assume that "field" is variable (object too?) in the class while "property" is just an object that returns specific value and cannot contain methods etc. By "member" I understand any object that is declared on the class level. But these are just my assumptions based on commented code samples where some careful programmers used "property region" etc.
I would really appreciate if someone could explain it to me.
Is there any way to format this so it's a valid expression, without adding another step?
<<One:8,_:(One*8)>> = <<1,9>>.
* 1: illegal bit size
These work
<<One:8,_:(1*8)>> = <<1,9>>.
<<1,9>>
<<Eight:8,_:Eight>> = <<8,9>>.
<<8,9>>
I'm trying to parse a binary with nested data with list comprehensions instead of stacking accumulators.
Hi there,
Is it possible to create template to the initialization like:
template <typename C> typename C::value_type fooFunction(C& c) {...};
std::vector<string> vec_instance;
fooFunction(cont<0>(vec_instance));
fooFunction(cont<1>(vec_instance));
In general i'm interested is it possible to specify template using integer (ie. 0) instead of true type name.
And how to achieve above?
I have a piece of code:
links
|> Seq.map (fun x -> x.GetAttributeValue ("href", "no url"))
Which I wanted to rewrite to:
links
|> Seq.map (fun x -> (x.GetAttributeValue "href" "no url"))
But the F# compiler doesn't seem to like that. I was under the impression that these two function calls were interchangeable:
f (a, b)
(f a b)
The error that I get is:
The member or object constructor 'GetAttributeValue' taking 2 arguments are not accessible from this code location. All accessible versions of method 'GetAttributeValue' take 2 arguments.
Which seems amusing, as it seems to indicate that it needs what I'm giving it. What am I missing here?
The first one below works, but, just wanted to see if there's a better way...
If I'm trying to find all records that start with 'C' with either a flag of 2 or a status of 9, do I need to incorporate the 'C' criteria twice?
i.e.,
"SELECT * FROM mytable WHERE name like 'C%' AND flag = 2 OR name like 'C%' AND status = 9"
Or, is there a way quicker way to write it so that I only need to set 'C%' once?