I am new to Java. I have a string like the following:
str="4*5";
Now I have to get the result of 20 by using the string. I know in some other languages the eval function will do this. How do I do this in Java?
I need to use VBA to determine the number of arguments passed to an Excel formula. For instance, suppose a cell contains the formula =MyFunc($A$1, "xyz", SUM(1,2,COUNT(C1:C12)), IF(B12,1,0)). Then the counter function should return 4. Does VBA contain any built-in functions for this, or does someone have an example of a regular expression that could calculate this?
I am loading a website using a WebBrowser's Navigate function, and I want the browser to load the page with a cookie I've given it.
The following code doesn't work:
wb.Navigate(url, null, null, "Cookie: " + cookie + "\n");
What am I doing wrong? Will I have to use InternetSetCookie? This doesn't seem like the best solution.
Thanks!
Hello,
I am trying to do some wav processing using Lua, but have fallen a the first hurdle! I cannot find a function or library that will allow me to load a wav file and access the raw data. There is one library, but it onl allows playing of wavs, not access to the raw data.
Are there any out there?
Cheers,
Pete.
I'm using these function calls:
glEnable(GL_BLEND)
glEnable(GL_POLYGON_SMOOTH)
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE)
It doesn't work and wont render.
glEnable(GL_BLEND)
glEnable(GL_POLYGON_SMOOTH)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
It doesn't anti-alias.
Hello everyone,
I have used a JDialog to display a form ( I could have used JFrame, but I have my reasons). There is an event in my application that will cause a function to generate and display the said JDialog. Now, I want to know if the user has closed that JDialog. How do I find this out?
P.S. My defaultCloseOperation is JDialog.DISPOSE_ON_CLOSE.
I am trying to get logging via the application.ini file going and I am getting stuck with an error.
resources.log.db.writerName = "Db"
resources.log.db.writerParams.db.adapter = "PDO_SQLITE"
resources.log.db.writerParams.db.dbname = ROOT "/data/tmp.db3"
resources.log.db.writerParams.db.table = "logs"
resources.log.db.writerParams.db.columnMap.priority = "priority"
resources.log.db.writerParams.db.columnMap.message = "message"
Fatal error: Call to a member function insert() on a non-object in /var/www/libs/zend/library/Zend/Log/Writer/Db.php on line 137
Bubble sort is O(n) at best, O(n^2) at worst, and its memory usage is O(1) . Merge sort is always O(n log n), but its memory usage is O(n).
Which algorithm we would use to implement a function that takes an array of integers and returns the max integer in the collection, assuming that the length of the array is less than 1000. What if the array length is greater than 1000?
I have a dropdownlist in gridview and bind grid view from a function in code behind for the dropdownlist.
The problem is the dropdownlist is in edittemplate and the selected value is the id in the same celle when the is dropdownlist when the row is not editing.
How I can display in editing the null value????
One of the features of the Flash app I'm working on is to be able to stream a webcam to others. We're just using the built-in webcam support in Flash and sending it through FMS.
We've had some people ask for higher quality video, but we're already using the highest quality setting we can in Flash (setting quality to 100%).
My understanding is that in the newer flash players they added support for MPEG-4 encoding for the videos. I created a simple test Flex app to try and compare the video quality of the MP4 vs FLV encodings. However, I can't seem to get MP4 to work at all.
According to the Flex documentation the only thing I need to do to use MP4 instead of FLV is prepend "mp4:" to the name of the stream when calling publish:
Specify the stream name as a string
with the prefix mp4: with or without
the filename extension. The prefix
indicates to the server that the file
contains H.264-encoded video and
AAC-encoded audio within the MPEG-4
Part 14 container format.
When I try this nothing happens. I don't get any events raised on the client side, no exceptions thrown, and my logging on the server side doesn't show any streams starting.
Here's the relevant code:
// These are all defined and created within the class.
private var nc:NetConnection;
private var sharing:Boolean;
private var pubStream:NetStream;
private var format:String;
private var streamName:String;
private var camera:Camera;
// called when the user clicks the start button
private function startSharing():void {
if (!nc.connected) {
return;
}
if (sharing) { return; }
if(pubStream == null) {
pubStream = new NetStream(nc);
pubStream.attachCamera(camera);
}
startPublish();
sharing = true;
}
private function startPublish():void {
var name:String;
if (this.format == "mp4") {
name = "mp4:" + streamName;
} else {
name = streamName;
}
//pubStream.publish(name, "live");
pubStream.publish(name, "record");
}
Unfortunately form.reset() function doesn't reset hidden inputs of the form.
Checked in FF3 and Chromium.
Does any one have an idea how to do the reset for hidden fields as well?
I want to be able to change the appearance of the mouse cursor as it moves over various hot spots in my view's and it seems to me that I should be doing that in the kEventControlSetCursor handler (which I can get). The function "SetCursor" is deprecated, which leads to the question, what do I call to actually change the cursor?
And is there some standard list of cursors I can use? Things like horizontal and vertical arrows? I beam?
Can anyone explain what the jquery documentation is exactly referring to with this statement: "the argument to write failsafe jQuery code using the $ alias, without relying on the global alias" when referring to using the following:
jQuery(function($) {
});
I have been using jquery for a while now so understand what this code is doing to a certain extent but the phrase used in the documentation about writing failsafe jquery code puzzles me and i am unsure whether it is important or not.
I've got some tests that need to count the number of warnings raised by a function. In Python 2.6 this is simple, using
with warnings.catch_warnings(record=True) as warn:
...
self.assertEquals(len(warn), 2)
Unfortunately, with is not available in Python 2.4, so what else could I use? I can't simply check if there's been a single warning (using warning filter with action='error' and try/catch), because the number of warnings is significant.
Hi,
Does anybody know if there is a free python chess moves validation function available somewhere?
What I need. I have a diagram stored as a string, and move candidate. What I need is to see if move candidate is valid for the diagram.
Would be really interested to see examples, if possible.
I'm trying to create a universal iPhone app, but it uses a class defined only in a newer version of the SDK. The framework exists on older systems, but a class defined in the framework doesn't.
I know I want to use some kind of weak linking, but any documentation I can find talks about runtime checks for function existence - how do I check that a class exists?
I'm writing an ASP.NET MVC2 application that uses a jquery theme. I have a partial view that is updated with an Ajax call. When the partial view is re-rendered the buttons lose their jquery theme. I tried having the "onComplete" function restyle them, but no luck.
I enjoy using recursion whenever I can, it seems like a much more natural way to loop over something then actual loops. I was wondering if there is any limit to recursion in lisp? Like there is in python where it freaks out after like 1000 loops?
Could you use it for say, a game loop?
Testing it out now, simple counting recursive function. Now at 7000000!
Thanks alot
I wrote a quick and dirty function to compare file contents (BTW, I have already tested that they are of equal size):
let eqFiles f1 f2 =
let bytes1 = Seq.ofArray (File.ReadAllBytes f1)
let bytes2 = Seq.ofArray (File.ReadAllBytes f2)
let res = Seq.compareWith (fun x y -> (int x) - (int y)) bytes1 bytes2
res = 0
I'm not happy with reading the whole contents into an array. I'd rather have a lazy sequence of bytes, but I can't find the right API in F#.
I have project in MFC that works fine in x32.
I used the configuration manager to change the project to x64, then I tried to rebuild the project.
the result was "unresolved external symbol" for many MFC function.
I guess that I miss something here in the Tools/Option toolbar with x64 platform but I don't know what.
P.S.
win32 console application works fine when I change the platfrom to x64
Disassembling printf doesn't give much info:
(gdb) disas printf
Dump of assembler code for function printf:
0x00401b38 <printf+0>: jmp *0x405130
0x00401b3e <printf+6>: nop
0x00401b3f <printf+7>: nop
End of assembler dump.
How is it implemented under the hood?
I can't find any good documentation on this suprisingly so I'm posting it here.
What's the raw javascript equivilent to this:
$(elem).click(function(){
alert(this.text());
});
All I can find is this <elem onlick="func()" /> which is not what I want, I want to be able to do it just with javascript not within the context of an element.
I need to grab the value of the radiobutton option selected with jQuery. I am using the following code but "str" is undefined in Firebug:
//handling Feed vs. Ingredient RadioButton
$('[id$=rdoCheck]').change(function() {
str = $("input[name='rdoCheck']:checked").val();
//ingredients
if (str == "ing")
{ $('[id$="lblDescription"]').text("Ingredient") }
//finished feed
else if (str == "ffc")
{ $('[id$="lblDescription"]').text("Finished") }
});
I am currently learning the zsh and now I wanted to use strftime but i get:
zsh: command not found: strftime
I think I'm doin' something wrong, since I see people using that function all the time in their dotfiles.
friends,
i want to set MaxLenght of TextView Through programming i cannot see Set function related to MaxLenght can any one guide me how to achieve this?
i dont want hard code in layout.
any help would be appriciated.