I have one main.php file with a class definition. Other php files use this main.php file
//main.php
<?php
class A{
}
//I want to execute the following statements exactly once
$a = new A();
/*
Some code
*/
?>
I use main.php in other php files like
//php1.php
<?php
require_once("main.php");
$b = new A();
/*
Some code
*/
…
I'm trying to figure out how do download a particular tag of a git repository - it's one version behind the current version.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
But the version name is "Tagged release 1.1.5" according the site.
I tried a command like this (with names…
Hi, I always thought that functions like printf() are in the last step defined using inline assembly. That deep into stdio.h is burried some asm code that actually tells CPU what to do. Something like in dos, first mov bagining of the string to some memory location or register and than call some int. But since x64 version of Visual Studio doesent…
I have a Python function accepting several string arguments def foo(a, b, c): and concatenating them in a string.
I want to iterate over all function arguments to check they are not None. How it can be done?
Is there a quick way to convert None to ""?
Thanks.
Hi all,
ok what I want to do is to draw a quad in the scene that lays on a plane parallel to the view. So it should appear flat.
More in particular, I think I didn't get very well how the mechanism of gluLookAt works in comparison with the functions glTranslate and glRotate:
If I position the view "manually" using the functions glTranslate…
I have two entities. Groups. Pools. A Group can create many pools.
So I setup my Pool table to have a GroupID foreign key.
My code:
using (entity _db = new entity()) {
Pool p = new Pool();
p.Name = "test";
p.Group.ID = "5";
_db.AddToPool(p);
}
This doesn't work. I get a null reference exception on…
How would you store all 12 months and their correct amount of days in an array? Making a 12 by 31 array is two much for some of the months, like Feb has only 28 days. Suggestions?
Normally it would be in such a structure:
../application/modules/somemodule/views/scripts/index/index.phtml
How I move it to:
../application/templates/somemodule/template1/views/......
../application/templates/somemodule/templateTWOOMG/.......
??
I want to create a list containing the 3-D coords of a grid of regularly spaced points, each as a 3-element tuple. I'm looking for advice on the most efficient way to do this.
In C++ for instance, I simply loop over three nested loops, one for each coordinate. In Matlab, I would probably use the meshgrid function (which would…
I have a strange problem,
I am trying to order the output of a set of records by a field called displayOrder. Now even though record A has a displayOrder of 2 and record B has a displayOrder of 1000, record B still shows up before record A. Here's my select statement:
SELECT * FROM items ORDER BY displayOrder ASC
It works…
Hi,
I am creating a small rails app for personal use and would like to be able to upload excel files to later be validated and added to the database. I had this working previously with csv files, but this has since become impractical.
Does anyone know of a tutorial for using the roo or spreadsheet gem to upload the file,…
This is my function:
(defun MyFunction(input)
(let ((NEWNUM (find input num)))
(if (find input num) //if this
(setq num NEWNUM) (FUNCT2) //then execute both of these
(list 'not found)))) //else output this
So after the if statment I want to be able to execute (setq num…
Are there any tools available that allow you to 'look' at any given application and show you which WinForm controls are being used in that application? I happen to have an app which I like the GUI of, and I want to use a similar structure in my own app. Instead of developing these controls myself, it may be easier to…
Hi, I'm using JQuery to select some elements on a page and then move them around in the DOM. The problem I'm having is I need to select all the elements in the reverse order that JQuery naturally wants to select them. For example:
<ul>
<li>Item 1</li>
<li>Item 2</li>
…
I'm trying to make an application-level add-in for Excel and I would like to store certain information about the program's state. The information I want to store pertains to the state of each Excel file (rather than across all Excel files).
I am using PHP/Java bridge to run PHP scripts on the Tomcat server. Can someone point me to an example as to how to call my PHP scripts from a Java file.
<?php
class X{
//variables
//functions
}
?>
Now I want to call the member functions of class X using its object via a Java file. How…
I need to delay my program's execution for a specified number of milliseconds, but also want the user to be able to escape the wait when a key is pressed. If no key is pressed the program should wait for the specified number of milliseconds.
I have been using Thread.Sleep to halt the program (which in…
I want to have a function which searches for a key in a collection of maps and returns an iterator to the found key. But what should be returned in case the key cannot be found? I cannot return map::end since the collection of maps can be empty.
Thanks.
I've just begin work on a mobile version for one of my sites.
I've set up my sign up form for my users.
It worked fine and the CSS styled it correctly.
@using (Html.BeginForm("XXX", "Registration", FormMethod.Post, new { @class = "twitter-sign-in-container" }))
{
<input type="submit"…
Hi, when I first saw C#, I thought this must be some joke. I was starting with programming in C. But in C# you could just drag and drop objects, and just write event code to them. It was so simple.
Now, I still like C the most, becouse I am very attracted to the basic low level operations,…
Hi, I'm kind of new to this stuff. I was wondering how you can allow the user of your iPhone app to add new items to your tableview. If you're confused by what I mean, please look at the free app, ListGnome.