Everyone has been telling me to learn C++. Without bashing languages right and left, can someone please state some relevant reasons as to why I should learn C++ today?
Note that in no way am I saying anything harsh about C++. I just want to know why I should master it as a programmer instead of the other powerful languages out there.
I have a jquery accordion which I want to add rows to. I can accomplish this by calling .accordion("destroy"), adding the needed ... bit and then calling .accordion() again, but this destroys the state and closes any dividers which are open.
Is it possible to add rows to the accordion without destroy and recreating it?
I'm implementing equals() - hashcode() - toString() of my Entities using all the available fields in the bean. I'm getting some Lazy init Exception on the frontend when I try to compare the equality or when I print the obj state. That's because some list in the entity can be lazy initialized.
I'm wondering what's the correct way to for implementing equals() and toString() on an Entity Obj
Hello there,
I am from a networking background and completely new to algorithm and flow charts, so could you please assist me with the following?
Draw flow charts for the following algorithmss:
State whether a number entered at the keyboard is even or odd.
Calculate the mean of a five numbers entered by the user from the keyboard
Count the number of characters and the number of words that are in a text file
Many thanks in advance!
I have an activity that shows up when the phone screen goes to sleep/turns off ie turns black.
For some reason, the phone turns on when the volume buttons or the camera buttons are pressed. By turns on, I mean the screen wakes up or comes back from the black screen state.
I've tried using dispatchKeyEvent(KeyEvent event) and the buttons are disabled on the activity, but they still wake up the phone.
Would one expect a backup of a SQL Server Compact database file created with Volume Shadow Copy Service expected to be consistent? I know the big SQL Server has a VSS writer to ensure consistency. If a connection is writing out to a SQL Server Compact database could the file be backed up in a inconsistent state?
Hello,
Do you know some good Open Source project written in PHP that is a finest example of MVC and is just the best example to learn how to write a state of art project?
kind regards,
CREATE TABLE SupplierQuote
(
supplierQuoteID int identity (3504,2) CONSTRAINT supquoteid_pk PRIMARY KEY,
PONumber int identity (9553,20) NOT NULL
.
.
.
CONSTRAINT ponumber_uq UNIQUE(PONumber)
);
The above ddl produces an error:
Msg 2744, Level 16, State 2, Line 1
Multiple identity columns specified
for table 'SupplierQuote'. Only one
identity column per table is allowed.
How can i solve it? I want PONumber to be auto-incremented.
I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below:
http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx
However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskbar. This only gets reset by clicking on the application in the taskbar, minimizing it, then re-maximizing it. Is there a way to clear this from being highlighted without any user interaction?
update p
set
p.storePrice =
CASE
WHEN
p.costPrice BETWEEN 0.00 AND 1.00
THEN p.costPrice * 1.0
CASE
WHEN
p.costPrice BETWEEN 0.00 AND 1.00
THEN p.costPrice * 1.0
ELSE
p.msrpPrice
END
FROM product p
WHERE p.type = 1
The error says:
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'CASE'.
I can't seem to see any issue with the sql?
I'm trying to drop a constraint on a db table, something like:
ALTER TABLE MyTable drop CONSTRAINT FK_MyTable_AnotherTable
But the execution just runs and runs. If I stop it I see:
Msg 3727, Level 16, State 0, Line 2
Could not drop constraint. See previous errors.
Web search throws up various pages but note that the constraint is properly named and I am trying to remove it using the correct name
My code:
MEMORY_BASIC_INFORMATION meminf;
::VirtualQuery(box.pBits, &meminf, sizeof(meminf));
The results:
meminf:
BaseAddress 0x40001000 void *
AllocationBase 0x00000000 void *
AllocationProtect 0x00000000 unsigned long
RegionSize 0x0de0f000 unsigned long
State 0x00010000 unsigned long
Protect 0x00000001 unsigned long
Type 0x00000000 unsigned long
Notes:
(1) AllocationBase is NULL while BaseAddress is not NULL
(2) AllocationProtect is 0 (not a protection value)
Is it a bug of VirtualQuery?
I refered this link.I am using the uri for streetview:
Uri.parse("google.streetview:cbll=" + sv_lat_val + ","+ sv_long_val + "&cbp=1,45,,45,0.0&mz=0.0")
But the zoom level always in Zoomed state. 1.0 is the normal zoom. so i set it for 0.0 . still its not zoomed out. why? But it working in default Google maps App? Any idea?
I have a page that performs an Ajax request that replaces a div every second.
This div also has hyperlinks in it.
If the user tries to click one of the hyperlinks, it will work, but if they move the cursor over the link, wait for a second without moving the cursor, the hyperlink no longer has the "hover" pseudostyle and if they click at the wrong time, the link doesn't work.
Is there a way to update the div without causing this, or to restore the "mouse over" state of the link?
If I define the up and over states of a button like this:
.button {color:red;}
.button:hover {color:blue;}
How can I get all the hover state styles for an element using JQuery?
Something like $(".button:hover").styles...
I am using the following to mute/unmute the master audio on my computer. Now, I am looking for a way to determine the mute state. Is there a just as easy way to do this in C#?
private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
private const int WM_APPCOMMAND = 0x319;
[DllImport("user32.dll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
I need to preserve the current GlBlendFunc so can restore it after I do some work. It seems that this is not one of the attributes that can be saved with GLPushAttrib, is there some other similar method I can use to preserve the state?
And how do I convert it to a datetime.datetime instance in python?
It's the output from the New York State Senate's API: http://open.nysenate.gov/legislation/.
I am working on a custom Camera activity for my application.
I was following the instruction from the Android Developers site here:
http://developer.android.com/guide/topics/media/camera.html
Everything seems to works fine, except the Callback function is not called and the picture is not saved. Here is my code:
public class CameraActivity extends Activity {
private Camera mCamera;
private CameraPreview mPreview;
private static final String TAG = "CameraActivity";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.camera);
// Create an instance of Camera
mCamera = getCameraInstance();
// Create our Preview view and set it as the content of our activity.
mPreview = new CameraPreview(this, mCamera);
FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
preview.addView(mPreview);
Button captureButton = (Button) findViewById(R.id.button_capture);
captureButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.v(TAG, "will now take picture");
mCamera.takePicture(null, null, mPicture);
Log.v(TAG, "will now release camera");
mCamera.release();
Log.v(TAG, "will now call finish()");
finish();
}
});
}
private PictureCallback mPicture = new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
Log.v(TAG, "Getting output media file");
File pictureFile = getOutputMediaFile();
if (pictureFile == null) {
Log.v(TAG, "Error creating output file");
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.v(TAG, e.getMessage());
} catch (IOException e) {
Log.v(TAG, e.getMessage());
}
}
};
private static File getOutputMediaFile() {
String state = Environment.getExternalStorageState();
if (!state.equals(Environment.MEDIA_MOUNTED)) {
return null;
}
else {
File folder_gui = new File(Environment.getExternalStorageDirectory() + File.separator + "GUI");
if (!folder_gui.exists()) {
Log.v(TAG, "Creating folder: " + folder_gui.getAbsolutePath());
folder_gui.mkdirs();
}
File outFile = new File(folder_gui, "temp.jpg");
Log.v(TAG, "Returnng file: " + outFile.getAbsolutePath());
return outFile;
}
}
After clicking the Button, I get logs: "will now take picture", "will now release camera" and "will now call finish". The activity finishes succesfully, but the Callback function was not called during the
mCamera.takePicture(null, null, mPicture);
function (There were no logs from the mPicture callback or getMediaOutputFile functions) and there is no file in the location that was specified.
Any ideas? :)
Much thanks!
select @[email protected]('*')
for xml raw,type
Above statement will generate following alert:
Msg 6819, Level 16, State 3, Line 2
The FOR XML clause is not allowed in a ASSIGNMENT statement.
SELECT
*
FROM
company c
INNER JOIN
city ci ON ci.city_id = c.city_id
INNER JOIN
state s ON s.state_id = c.state_id
WHERE
MATCH (
c.name, ci.name, c.zipcode, s.name
)
AGAINST (
'los angeles'
)
Given that state information is implicit in the zip code aren't storing both of them some violaiton of third normal form? Can or should you simply combine them into one field?
Hey, I have a table like this
Name State Amount
------------------------------
Pump 1 Present 339
Pump 1 Optimized 88
Which I want to transpose something like this
Pump 1 Present 339 Optimized 88
How can I do this with MS SQL 2000? I tried to search for a solution, but couldn't find the most fitting solution :(