Why are there two ways to "declare" constants in CPP?
Which is better, or should I write, which of them should I use when?
#define MYCON 100
const int MYCON=100
Does anyone know of a way to use the mxmlc task of the Flex Ant tasks with a user-definable list of source path or library paths? The idea is that the user can define an arbitrary list of source paths and/or library (swc) paths into an Ant properties file and the build file takes these values and evaluates them for use in the mxmlc task. Just wondering if there are any tricks (maybe utilizing filtering/string replacing) to get this working?
I have (for example) an object of type A that I want to be able to cast to type B (similar to how you can cast an int to a float)
Data types A and B are my own.
Is it possible to define the rules by which this casting occurs?
Example
int a = 1;
float b = (float)a;
int c = (int)b;
Hi, I use one library which is very important and untouchable.
The problem is that library declare min, max function,
so when I include STL header in project, they conflict.
I want to disable min, max function in STL (like #define NOMNMAX) if I could.
If I can't, what would be solution?
Thanks, in advance.
Filename:backup_ver1
import os
import time
1 Using list to specify the files and directory to be backed up
source = r'C:\Documents and Settings\rgolwalkar\Desktop\Desktop\Dr Py\Final_Py'
2 define backup directory
destination = r'C:\Documents and Settings\rgolwalkar\Desktop\Desktop\PyDevResourse'
3 Setting the backup name
targetBackup = destination + time.strftime('%Y%m%d%H%M%S') + '.rar'
rar_command = "rar.exe a -ag '%s' %s" % (targetBackup, ''.join(source))
i am sure i am doing something wrong here - rar command please let me know
if os.system(rar_command) == 0:
print 'Successful backup to', targetBackup
else:
print 'Backup FAILED'
O/P:- Backup FAILED
winrar is added to Path and CLASSPATH under Environment variables as well - anyone else with a suggestion for backing up the directory is most welcome
I got a directory I want to copy to a number of locations.
Say I have
home.aspx
I want to copy it to
abc/home.aspx
def/home.aspx
ghi/home.aspx
so two questions for me:
How do I define the list abc, def, ghi?
How do I execute my Copy task with each element of this list?
In .htaccess, how do I specify a file type to be cached via browser and proxy? Cache-control for needs to be "private" for browser, "public" for proxy. However, I can't define Cache-Control to be private AND public for same file type. It seems like I have to choose between browser or proxy caching. Suggestions?
I currently define the background for a user control like this:
<UserControl.Background>
<ImageBrush ImageSource="{DynamicResource LeftMenuBackgroundImage}" />
</UserControl.Background>
How can I move this to code-behind, e.g.:
PSEUDO-CODE:
StackPanel sp = new StackPanel();
sp.Background = new ImageBrush(DynamicResource.GetResourceName("LeftMenuBackgroundImage"));
Ive defined a a class that inherits from django.contrib.syndication.feeds.Feed
class Rss(Feed):
...
def item_title(self, item):
return "Hello"
def item_description(self, item):
return "Test"
The issue those strings are never used, even when not using a template whats used is the templates you define.
Am I missing something?
Hello I want to get user from an email address,
eg: [email protected] then output must be sajid
for this is use below mentioned code but an warning occur
$user = strstr($email, '@', true);
Warning: Wrong parameter count for strstr() in /var/www/DataTable/dialog.php on line 3
& in php manul it is clearly define that the 3rd argument true is only valid for PHP 5.3.0
So is there any string function which could solve my problem?
If I'm not wrong, because of its nature in factory method there is cyclic dependency:
Base class needs to know subclasses because it creates them, and subclasses need to know base class. Having cyclic dependency is bad programming practice, is not it?
Practically I implemented a factory, I have problem above, even I added
#ifndef MYCLASS_H
#define MYCLASS_H
#endif
I'm still getting
Compiler Error C2504 'class' : base class undefined
And this error disappers when I remove subclass include from base class header.
Why is there a need to define a new method in RESTful controller, follow it up with a create method?
Google search didn't provide me the answer I was looking for. I understand the different, but need to know why they are used the way they are.
As it is not possible to override a static class in c#, if i want to override a method I generally define a delegate matching the signature of the static method, then modify the method along the lines of:
public static void foo(int bar)
{
if (delegatename!=null)
{
delegatename.Invoke(bar);
}
else
{
//execute previous code as normal
}
}
I feel a twinge of guilt, knowing this is a bit messy.
Can anyone suggest a neater solution to this problem (other than rewriting the original structure)
hi friends, I am having two package in my application
1.com.fsp.deals and 2.com.facebook.android..
i declared my package as package =com.fsp.deals in Manifest file..
if i want to use the activity in com.facebook.android how i should call activity in manifest file it showing error as i define as
</activity>
<activity android:name="com.facebook.android.Example"
android:screenOrientation="portrait" android:label="@string/app_name"
android:windowSoftInputMode="stateUnspecified|adjustPan">
</activity>
Hello,
I am using a Xib (tab bar controller with navigation bar).
when i use navigation bar in app delegate then Xib slides little bit bellow.Actually i want a navigation bar on enter page so it is compulsory to define navigation bar in app delegate.
Please help me how i solve this problem.
Given
class ValidationRule:
def __init__(self, **kwargs):
# code here
Is there a way that I can define __init__ such that if I were to initialize the class with something like ValidationRule(other='email') then self.other would be "added" to class without having to explicitly name every possible kwarg?
hi, my code wont work and idk why. the point of my code is to find the top window and save a text file with the name the same as the text on the top menu bar (task bar i think?). then save some data to that text file. but everytime i try to use it the write fails if i set the name of the text file before hand so it wont change it will write the data to the file. but if i don't set it before hand it will make the text doc but not write anything to it. or sometimes it will just write numbers for the name (i think it's the handle number) then it will write the data. :\ it's odd can anyone help?
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
#include <sstream>
#include <time.h>
using namespace std;
string header_str = ("NULL");
#define DTTMFMT "%Y-%m-%d %H:%M:%S "
#define DTTMSZ 21
char buff[DTTMSZ];
fstream filestr;
string ff = ("C:\\System logs\\txst.txt");
TCHAR buf[255];
int main()
{
GetWindowText(GetForegroundWindow(), buf, 255);
stringstream header(stringstream::in | stringstream::out);
header.flush();
header << ("C:\\System logs\\");
header << buf;
header << (".txt");
header_str = header.str();
ff = header_str;
cout << header_str << "\n";
filestr.open (ff.c_str(), fstream::in | fstream::out | fstream::app | ios_base::binary | ios_base::out);
filestr << "dfg";
filestr.close();
Sleep(10000);
return 0;
}
I need some classes to befriend other classes in my system. Lack of this feature made me publicize some methods which shouldn't be public. The consequences of that are that members of my team implement code in a bad and ugly way which causes a mess.
Is there a way to define a friendship in php 5.3?
(I am aware of http://bugs.php.net/bug.php?id=34044 You might want to vote there if there is no simple solution).
I was just reading a little bit on them from http://www.cplusplus.com/doc/tutorial/namespaces/
and it seems like a struct is capable of the same things? Or even a class for that matter. Maybe someone here can better define what a namespace is, and how it differs from a struct/class?
Hi, I was wondering if this rope bridge problem could be solved with a graphing algorithm search:
My gut feeling says DFS but how should I define the states? (That is if DFS is even the way to go.)
Rope Bridge
I'm trying to have show a large image that the user can pan around (so scroll vertically & horizontally). But I can't get the image to scroll. This is what I have:
Ext.define('myapp.view.image.Floorplan', {
extend: 'Ext.Container',
requires: 'Ext.Img',
xtype: 'floorplan',
config: {
title: 'Floorplan',
iconCls: 'locate',
items: [
{
xtype: 'image',
scrollable: true,
src: './resources/images/floorplan.png',
height: 1570,
width: 1047
}
]
}
});
How can I make the image scrollable?
Thanks
Matt
It would be much more less work to define which methods are NOT overideable instead of which are overideable because (at least for me), when you're designing a class, you don't care if its heirs will override your methods or not...
So, why methods in C# are not automatically virtual? What is the common sense in this?
I'm storing OLAC metadata which describes linguistic resources. Many of the elements of the metadata are repeatable -- for example, a resource can have two languages, three authors and four dates associated with it.
Is there any way of storing this in one model? It seems like overkill to define a model for each repeatable metadata element -- especially since the models will only have one field: it's value.