PostId
int64
13
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
3
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-33
210k
OwnerUndeletedAnswerCountAtPostTime
int64
0
5.77k
Title
stringlengths
10
250
BodyMarkdown
stringlengths
12
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
47
30.1k
OpenStatus_id
int64
0
4
9,388,279
02/22/2012 02:22:57
817,527
06/27/2011 14:05:26
309
3
Can a script that was run by system command, access SESSION data of the running script?
When scriptA.php is run by some logged in user, an in turn will call another scriptB.php using a system() or exec(). Is it possible for scriptB.php to get parameters of the SESSION data of the user that run scriptA.php in the first place ? Thanks!
php
apache
null
null
null
null
open
Can a script that was run by system command, access SESSION data of the running script? === When scriptA.php is run by some logged in user, an in turn will call another scriptB.php using a system() or exec(). Is it possible for scriptB.php to get parameters of the SESSION data of the user that run scriptA.php in the first place ? Thanks!
0
7,794,505
10/17/2011 13:31:13
962,715
09/24/2011 14:50:35
10
0
what code of librery i shoud use in dotnetdf librery to make a method to understand one graph is a tree?
i want to insert some code to dotnetrdf librery to understand that a graph is a tree? where i shoud insert the code to achive better API?
.net
n3
dotnetrdf
null
null
11/12/2011 14:43:18
not a real question
what code of librery i shoud use in dotnetdf librery to make a method to understand one graph is a tree? === i want to insert some code to dotnetrdf librery to understand that a graph is a tree? where i shoud insert the code to achive better API?
1
4,593,493
01/04/2011 12:21:28
562,495
01/04/2011 11:49:54
1
0
Windows API's which will show the running processes
I want to create a tool like mini task manager. I want to show all the running processes, cpu and memory usage. Can anybody tell me related api's which I can use for this. Any link to related web page will be appreciated. (I want dump of all the statistics of running processes, cpu and memory.) Thanks in advance.
c
windows
winapi
visual-c++
process
null
open
Windows API's which will show the running processes === I want to create a tool like mini task manager. I want to show all the running processes, cpu and memory usage. Can anybody tell me related api's which I can use for this. Any link to related web page will be appreciated. (I want dump of all the statistics of running processes, cpu and memory.) Thanks in advance.
0
11,561,848
07/19/2012 13:24:18
903,052
08/19/2011 19:57:50
1
4
Can I make a user like us on facebook before downloading a freemium app
On a website, is it possible to have a users signup for a freemium app but once they signup up, hit a step that says "Like us on Facebook to get xyz app" - basically a free app that cost nothing except for a like on facebook. I know I can put a like us step with the like button but that is only optional. I want it to be mandatory to like before moving on to getting the free app. Is this possible?
facebook
like
null
null
null
07/20/2012 13:32:37
not a real question
Can I make a user like us on facebook before downloading a freemium app === On a website, is it possible to have a users signup for a freemium app but once they signup up, hit a step that says "Like us on Facebook to get xyz app" - basically a free app that cost nothing except for a like on facebook. I know I can put a like us step with the like button but that is only optional. I want it to be mandatory to like before moving on to getting the free app. Is this possible?
1
7,236,643
08/29/2011 22:16:12
201,231
11/02/2009 21:28:43
501
4
Am I getting <div> happy?
I am working on a new layout, and am having a bit of an issue with the 3 column portion on my test page... I am hoping I am not getting `<div>` happy, but am unable to find another way to lay out 3 columns and have them centered... I am hoping I can just post the link to my site and see if anyone has insight into the CSS structure.. thank you [http://jiujitsuboise.com/2012-Redesign/][1] [1]: http://jiujitsuboise.com/2012-Redesign/
css
null
null
null
null
08/30/2011 00:05:35
not a real question
Am I getting <div> happy? === I am working on a new layout, and am having a bit of an issue with the 3 column portion on my test page... I am hoping I am not getting `<div>` happy, but am unable to find another way to lay out 3 columns and have them centered... I am hoping I can just post the link to my site and see if anyone has insight into the CSS structure.. thank you [http://jiujitsuboise.com/2012-Redesign/][1] [1]: http://jiujitsuboise.com/2012-Redesign/
1
105,389
09/19/2008 20:36:28
19,281
09/19/2008 20:36:28
1
0
How do you store/share online your personal documents ?
For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files ? If there is a user management it would be also great (for example you decide that some persons, or everyone, can see some of your documents...).
user
personal
storing
documents
sharing
04/29/2011 21:39:59
off topic
How do you store/share online your personal documents ? === For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files ? If there is a user management it would be also great (for example you decide that some persons, or everyone, can see some of your documents...).
2
11,334,350
07/04/2012 19:11:06
1,381,170
05/08/2012 04:32:31
1
0
how do I create blog like functionality using php jquery js and ajax?
I have a personal website that I am developing and I want to add my own blog. I've been playing around with the js library jQuery and I've also heard about JSON but I've never had the chance to use it (would json be appropriate for my task?). I also want to have a username and password to log into a secure area of my website so I can update the blog page (this would be the next step after getting blog-like functionality).<br> For the blog specifically, I want to have a large text box and a button underneath the text box that submits the blog-post to my database that logs the time the blog was posted and the blog message itself. This should be done asynchronously so that the blog-posts appear as the submit button is pressed, somewhat like twitter or facebook updates.<br> I've got some knowledge of html, js, php and mysql however whenever I try doing any webdev involving ajax calls things begin to get jumbled. Can anyone help me get started down the right path?
php
jquery
html
ajax
json
07/04/2012 19:19:58
not a real question
how do I create blog like functionality using php jquery js and ajax? === I have a personal website that I am developing and I want to add my own blog. I've been playing around with the js library jQuery and I've also heard about JSON but I've never had the chance to use it (would json be appropriate for my task?). I also want to have a username and password to log into a secure area of my website so I can update the blog page (this would be the next step after getting blog-like functionality).<br> For the blog specifically, I want to have a large text box and a button underneath the text box that submits the blog-post to my database that logs the time the blog was posted and the blog message itself. This should be done asynchronously so that the blog-posts appear as the submit button is pressed, somewhat like twitter or facebook updates.<br> I've got some knowledge of html, js, php and mysql however whenever I try doing any webdev involving ajax calls things begin to get jumbled. Can anyone help me get started down the right path?
1
1,759,208
11/18/2009 21:29:01
213,060
11/17/2009 16:52:48
51
0
Write a data string to a numpy character array?
I want to write a data string to a numpy array. Pseudo Code: d=numpy.zeros(10,dtype=numpy.character) d[1:]='hello' Example result: d= array(['', 'h', 'e', 'l', 'l', 'o', '', '', '', ''], dtype='|S1') How can this be done with numpy most naturally and efficiently? I don't want for loops, generators, or anything iterative, can it be done with one command as with the pseudo code?
python
numpy
null
null
null
null
open
Write a data string to a numpy character array? === I want to write a data string to a numpy array. Pseudo Code: d=numpy.zeros(10,dtype=numpy.character) d[1:]='hello' Example result: d= array(['', 'h', 'e', 'l', 'l', 'o', '', '', '', ''], dtype='|S1') How can this be done with numpy most naturally and efficiently? I don't want for loops, generators, or anything iterative, can it be done with one command as with the pseudo code?
0
8,329,080
11/30/2011 16:10:03
475,850
10/14/2010 13:59:00
1,458
9
"chown mysql:mysql /data/tmp" command
I am on a Linux **ubuntu** machine with **MySQL** installed. If there is a **MySQL** installation on a **Ubuntu** machine, I saw some people doing the following thing: sudo chown mysql:mysql /data/tmp I get confused, I know the meaning of the above command, which is to change the owner of `/data/tmp` to user '`mysql`' and change the group of it to '`mysql`' group. **But (my questions):** **1.** Why would one run the above command? If I create a table in `my_db` database, by default, there will be `.frm`, `.MYD`, and `.MYI` files (data files) be created **automatically** by **MySQL** under `/var/lib/mysql/my_db/` . So, does the above command changes the default MySQL data directory to `/data/tmp/` instead of `/var/lib/mysql/my_db/`? **Basically, I would like to know the purpose and effect of the above command.** (better with examples) **2.** Where does the 'mysql' owner and group come from? Does the installation of MySQL on a Linux machine automatically create the 'mysql' user and group? or People need to manually create a `mysql` account for the linux machine?
mysql
database
linux
ubuntu
command-line
11/30/2011 16:58:09
off topic
"chown mysql:mysql /data/tmp" command === I am on a Linux **ubuntu** machine with **MySQL** installed. If there is a **MySQL** installation on a **Ubuntu** machine, I saw some people doing the following thing: sudo chown mysql:mysql /data/tmp I get confused, I know the meaning of the above command, which is to change the owner of `/data/tmp` to user '`mysql`' and change the group of it to '`mysql`' group. **But (my questions):** **1.** Why would one run the above command? If I create a table in `my_db` database, by default, there will be `.frm`, `.MYD`, and `.MYI` files (data files) be created **automatically** by **MySQL** under `/var/lib/mysql/my_db/` . So, does the above command changes the default MySQL data directory to `/data/tmp/` instead of `/var/lib/mysql/my_db/`? **Basically, I would like to know the purpose and effect of the above command.** (better with examples) **2.** Where does the 'mysql' owner and group come from? Does the installation of MySQL on a Linux machine automatically create the 'mysql' user and group? or People need to manually create a `mysql` account for the linux machine?
2
8,897,938
01/17/2012 16:13:11
1,154,353
01/17/2012 16:10:46
1
0
I am designing a Java Robot?
I am using a robot programmed with Java with a distance and touch sensor (but no gps or compass) to navigate a 1.0 by 2.5 metre obstacle course. The robot only knows its position by dead reckoning (like the number if turns of its wheels). When it turns it can measure the number of degrees from its last path travelled. After it finds the obstacles it needs to produce a map of where they are most likely to be. I want to extend a JPanel Class and override its paintComponent() method and then use the methods of the Graphics class to draw on the JPanel. I know that there are many drawxxxx methods for drawing. But I was wondering how I could actually achieve this, like the actual code that is necessary to produce this?!
java
robotics
null
null
null
01/17/2012 16:15:21
not a real question
I am designing a Java Robot? === I am using a robot programmed with Java with a distance and touch sensor (but no gps or compass) to navigate a 1.0 by 2.5 metre obstacle course. The robot only knows its position by dead reckoning (like the number if turns of its wheels). When it turns it can measure the number of degrees from its last path travelled. After it finds the obstacles it needs to produce a map of where they are most likely to be. I want to extend a JPanel Class and override its paintComponent() method and then use the methods of the Graphics class to draw on the JPanel. I know that there are many drawxxxx methods for drawing. But I was wondering how I could actually achieve this, like the actual code that is necessary to produce this?!
1
6,486,384
06/26/2011 20:03:17
179,736
09/27/2009 11:27:55
6,119
54
How do I make a div that can scroll left/right?
But when the user scrolls up and down using the mouse wheel, it scrolls the div left and right.
html
css
null
null
null
06/28/2011 20:04:35
not a real question
How do I make a div that can scroll left/right? === But when the user scrolls up and down using the mouse wheel, it scrolls the div left and right.
1
5,771,407
04/24/2011 15:27:18
376,947
06/26/2010 12:43:39
425
5
what does this PHP regex pattern mean?
Can anybody explain what does each character mean in this regex: ...preg_match('/\{loop(?: name){0,1}=\${0,1}(.*?)\}/', $html, $code)... ?
php
regex
string
null
null
04/25/2011 21:52:44
too localized
what does this PHP regex pattern mean? === Can anybody explain what does each character mean in this regex: ...preg_match('/\{loop(?: name){0,1}=\${0,1}(.*?)\}/', $html, $code)... ?
3
10,380,840
04/30/2012 08:50:00
574,419
01/13/2011 15:05:34
899
29
Disable page transition on data-role="header" at jQuery Mobile
Is it possible to disable page transition on data-role="header"? The goal would be to use page transition only at data-role="content".
javascript
jquery
mobile
jquery-mobile
null
04/30/2012 15:24:50
not a real question
Disable page transition on data-role="header" at jQuery Mobile === Is it possible to disable page transition on data-role="header"? The goal would be to use page transition only at data-role="content".
1
10,210,241
04/18/2012 13:19:14
1,218,198
02/18/2012 15:08:41
115
3
php script to edit html pages?
I was asked to create an editor for the admin side of the website to let him be able to edit static HTML pages and to be able to view the page through this editor something like the editor in the cpanel is that possible? and if it is i need the script to do that
php
html
null
null
null
04/19/2012 02:34:25
not a real question
php script to edit html pages? === I was asked to create an editor for the admin side of the website to let him be able to edit static HTML pages and to be able to view the page through this editor something like the editor in the cpanel is that possible? and if it is i need the script to do that
1
3,261,536
07/16/2010 02:33:35
287,279
03/05/2010 16:20:38
53
3
Best PHP Webserver for Development
I'm starting to work with PHP more these days and I've been wondering what the best PHP webserver might be for a dev environment. Ideally, it would be easy to build, live only in the project deps directory and be easy to configure. Also, decent performance would be a plus. In python land, [werkzeug][1] would be an equivalent of the type of server I'm thinking of. [1]: http://werkzeug.pocoo.org/
php
webserver
null
null
null
09/13/2011 12:39:19
not constructive
Best PHP Webserver for Development === I'm starting to work with PHP more these days and I've been wondering what the best PHP webserver might be for a dev environment. Ideally, it would be easy to build, live only in the project deps directory and be easy to configure. Also, decent performance would be a plus. In python land, [werkzeug][1] would be an equivalent of the type of server I'm thinking of. [1]: http://werkzeug.pocoo.org/
4
6,759,153
07/20/2011 08:39:28
59,666
01/28/2009 08:23:11
1,537
26
Headless webkit for .NET
Do any of you know of a headless webkit wrapper for .NET? I've looked at [WebKitDotNet][1] but it does not seem to work in headless mode. [1]: http://webkitdotnet.sourceforge.net/
c#
.net
webkit
headless
headless-browser
null
open
Headless webkit for .NET === Do any of you know of a headless webkit wrapper for .NET? I've looked at [WebKitDotNet][1] but it does not seem to work in headless mode. [1]: http://webkitdotnet.sourceforge.net/
0
9,480,933
02/28/2012 11:18:42
1,237,727
02/28/2012 11:13:26
1
0
Youtube API: allow users comment on youtube videos from my wordpress website
is there any one who can help me implement a script or a wordpress plug-in that allows users registered in youtube to comment on the videos posted in my wordpress website and that comment goes directly to youtube. I tried several times to make that using the php api but i am not professional with php. Thanks
api
youtube
null
null
null
null
open
Youtube API: allow users comment on youtube videos from my wordpress website === is there any one who can help me implement a script or a wordpress plug-in that allows users registered in youtube to comment on the videos posted in my wordpress website and that comment goes directly to youtube. I tried several times to make that using the php api but i am not professional with php. Thanks
0
3,669,628
09/08/2010 15:58:59
407,511
07/31/2010 15:25:44
75
10
How would you recommend doing stress testing to an azure cloud service?
How would you recommend doing stress testing to an azure cloud service?
c#
azure
stress-testing
null
null
06/13/2012 13:31:35
not constructive
How would you recommend doing stress testing to an azure cloud service? === How would you recommend doing stress testing to an azure cloud service?
4
5,687,102
04/16/2011 14:20:51
574,647
01/13/2011 17:40:48
13
0
Count with Bresenham's line algorithm in real-mode,assembly
I'd like to draw lines in assembly. I wrote the algorithm in C, now I need to put it into assembly.<br> I'm in 16bits real-mode; graphics-mode: 12h (640*480 16colors)<br> The C source: //x1/y1/x2/y2 = start x, start y, end x, end y void draw_line(int x1, int y1, int x2, int y2) { double delta_l = (x2-x1)/(y2-y1); //delta_l = like graph slope; maybe it's negative and/or not integer // it can be also type 'float' double y; for(int x = x1; x <= x2; x++) { y = y1 + ( x * delta_l ); Round_To_Integer(y); Put_Pixel(x, y, color); } } My problem is that I can't count with floating-point numbers (or double) in assembly.<br> Please help me to "translate" this C code into ASM.<br> Thank you.
c
assembly
types
count
floating-point
null
open
Count with Bresenham's line algorithm in real-mode,assembly === I'd like to draw lines in assembly. I wrote the algorithm in C, now I need to put it into assembly.<br> I'm in 16bits real-mode; graphics-mode: 12h (640*480 16colors)<br> The C source: //x1/y1/x2/y2 = start x, start y, end x, end y void draw_line(int x1, int y1, int x2, int y2) { double delta_l = (x2-x1)/(y2-y1); //delta_l = like graph slope; maybe it's negative and/or not integer // it can be also type 'float' double y; for(int x = x1; x <= x2; x++) { y = y1 + ( x * delta_l ); Round_To_Integer(y); Put_Pixel(x, y, color); } } My problem is that I can't count with floating-point numbers (or double) in assembly.<br> Please help me to "translate" this C code into ASM.<br> Thank you.
0
2,662,450
04/18/2010 13:57:32
319,694
04/18/2010 13:52:59
1
0
Who creates beans in a spring web appplication?
I know that in a standalone application I create one of the application context instances which in turn creates the beans from conf files. But I can not see any such code in dispatched servlet. How then are the beans created in a web application?
spring-mvc
java
spring
webapplication
bean
null
open
Who creates beans in a spring web appplication? === I know that in a standalone application I create one of the application context instances which in turn creates the beans from conf files. But I can not see any such code in dispatched servlet. How then are the beans created in a web application?
0
4,504,868
12/21/2010 23:16:45
50,079
12/30/2008 05:05:52
3,784
165
Implementing a robust async stream reader
I recently provided an answer to this question: http://stackoverflow.com/q/4501511/50079. As often happens, explaining stuff (here "stuff" was how I tackled a similar problem) leads you to greater understanding and/or, as is the case here, "oops" moments. I realized that my solution, as implemented, has a bug. The bug has little practical importance, but it has an extremely large importance to me as a developer: I can't rest easy knowing that my code has the potential to blow up. Squashing the bug is the purpose of this question. I apologize for the long intro, so let's get dirty. I wanted to build a class that allows me to receive input from a `Stream` in an event-based manner. The stream, in my scenario, is guaranteed to be a `FileStream` and there is also an associated `StreamReader` already present to leverage. The public interface of the class is this: public class MyStreamManager { public event EventHandler<ConsoleOutputReadEventArgs> StandardOutputRead; public void StartSendingEvents(); public void StopSendingEvents(); } Obviously this specific scenario has to do with a console's standard output, but that is a detail and does not play an important role. `StartSendingEvents` and `StopSendingEvents` do what they advertise; for the purposes of this discussion, we can assume that events are always being sent without loss of generality. The class uses these two fields internally: protected readonly StringBuilder inputAccumulator = new StringBuilder(); protected readonly byte[] buffer = new byte[256]; The functionality of the class is implemented in the methods below. To get the ball rolling: public void StartSendingEvents(); { this.stopAutomation = false; this.BeginReadAsync(); } To read data out of the `Stream` without blocking, and also without requiring a carriage return char, `BeginRead` is called: protected void BeginReadAsync() { if (!this.stopAutomation) { this.StandardOutput.BaseStream.BeginRead( this.buffer, 0, this.buffer.Length, this.ReadHappened, null); } } **The challenging part:** `BeginRead` requires using a buffer. This means that when reading from the stream, it is possible that the bytes available to read ("incoming chunk") are larger than the buffer. Since we are only handing off data from the stream to a consumer, and that consumer may well have inside knowledge about the size and/or format of these chunks, I want to only call event subscribers *exactly once for each chunk*. Otherwise the abstraction breaks down and the subscribers have to buffer the incoming data and reconstruct the chunks themselves using said their inside knowledge. This is *much* less convenient to the calling code, and detracts from the usefulness of my class. To this end, if the buffer is full after `EndRead`, we don't send its contents to subscribers immediately but instead append them to a `StringBuilder`. The contents of the `StringBuilder` are only sent back whenever there is no more to read from the stream (thus preserving the chunks). private void ReadHappened(IAsyncResult asyncResult) { var bytesRead = this.StandardOutput.BaseStream.EndRead(asyncResult); if (bytesRead == 0) { this.OnAutomationStopped(); return; } var input = this.StandardOutput.CurrentEncoding.GetString( this.buffer, 0, bytesRead); this.inputAccumulator.Append(input); if (bytesRead < this.buffer.Length) { this.OnInputRead(); // only send back if we 're sure we got it all } this.BeginReadAsync(); // continue "looping" with BeginRead } After any read which is not enough to fill the buffer, all accumulated data is sent to the subscribers: private void OnInputRead() { var handler = this.StandardOutputRead; if (handler == null) { return; } handler(this, new ConsoleOutputReadEventArgs(this.inputAccumulator.ToString())); this.inputAccumulator.Clear(); } (I know that as long as there are no subscribers the data gets accumulated forever. This is a deliberate decision). **The good** This scheme works *almost* perfectly: - Async functionality without spawning any threads - Very convenient to the calling code (just subscribe to an event) - Maintains the "chunkiness" of the data; this allows the calling code to use inside knowledge of the data without doing any extra work - Is almost agnostic to the buffer size (it will work correctly with any size buffer irrespective of the data being read) **The bad** That last *almost* is a very big one. Consider what happens when there is an incoming chunk with length exactly equal to the size of the buffer. The chunk will be read and buffered, but the event will not be triggered. This will be followed up by a `BeginRead` that expects to find more data belonging to the current chunk in order to send it back all in one piece, but... there will be no more data in the stream. *In fact, as long as data is put into the stream in chunks with length exactly equal to the buffer size, the data will be buffered and the event will never be triggered.* This scenario may be highly unlikely to occur in practice, especially since we can pick any number for the buffer size, but the problem is there. **Solution?** Unfortunately, after checking the available methods on `FileStream` and `StreamReader`, I can't find anything which lets me peek into the stream while also allowing async methods to be used on it. One "solution" would be to have a thread wait on a `ManualResetEvent` after the "buffer filled" condition is detected. If the event is not signaled (by the async callback) in a small amount of time, then more data from the stream will not be forthcoming and the data accumulated so far should be sent to subscribers. However, this introduces the need for another thread, requires thread synchronization, and is plain inelegant. Specifying a timeout for `BeginRead` would also suffice (call back into my code every now and then so I can check if there's data to be sent back; most of the time there will not be anything to do, so I expect the performance hit to be negligible). But it looks like timeouts are not supported in `FileStream`. Since I imagine that async calls with timeouts *are* an option in bare Win32, another approach might be to PInvoke the hell out of the problem. But this is also undesirable as it will introduce complexity and simply be a pain to code. Is there an elegant way to get around the problem? Thanks for being patient enough to read all of this.
c#
asynchronous
stream
filestream
null
null
open
Implementing a robust async stream reader === I recently provided an answer to this question: http://stackoverflow.com/q/4501511/50079. As often happens, explaining stuff (here "stuff" was how I tackled a similar problem) leads you to greater understanding and/or, as is the case here, "oops" moments. I realized that my solution, as implemented, has a bug. The bug has little practical importance, but it has an extremely large importance to me as a developer: I can't rest easy knowing that my code has the potential to blow up. Squashing the bug is the purpose of this question. I apologize for the long intro, so let's get dirty. I wanted to build a class that allows me to receive input from a `Stream` in an event-based manner. The stream, in my scenario, is guaranteed to be a `FileStream` and there is also an associated `StreamReader` already present to leverage. The public interface of the class is this: public class MyStreamManager { public event EventHandler<ConsoleOutputReadEventArgs> StandardOutputRead; public void StartSendingEvents(); public void StopSendingEvents(); } Obviously this specific scenario has to do with a console's standard output, but that is a detail and does not play an important role. `StartSendingEvents` and `StopSendingEvents` do what they advertise; for the purposes of this discussion, we can assume that events are always being sent without loss of generality. The class uses these two fields internally: protected readonly StringBuilder inputAccumulator = new StringBuilder(); protected readonly byte[] buffer = new byte[256]; The functionality of the class is implemented in the methods below. To get the ball rolling: public void StartSendingEvents(); { this.stopAutomation = false; this.BeginReadAsync(); } To read data out of the `Stream` without blocking, and also without requiring a carriage return char, `BeginRead` is called: protected void BeginReadAsync() { if (!this.stopAutomation) { this.StandardOutput.BaseStream.BeginRead( this.buffer, 0, this.buffer.Length, this.ReadHappened, null); } } **The challenging part:** `BeginRead` requires using a buffer. This means that when reading from the stream, it is possible that the bytes available to read ("incoming chunk") are larger than the buffer. Since we are only handing off data from the stream to a consumer, and that consumer may well have inside knowledge about the size and/or format of these chunks, I want to only call event subscribers *exactly once for each chunk*. Otherwise the abstraction breaks down and the subscribers have to buffer the incoming data and reconstruct the chunks themselves using said their inside knowledge. This is *much* less convenient to the calling code, and detracts from the usefulness of my class. To this end, if the buffer is full after `EndRead`, we don't send its contents to subscribers immediately but instead append them to a `StringBuilder`. The contents of the `StringBuilder` are only sent back whenever there is no more to read from the stream (thus preserving the chunks). private void ReadHappened(IAsyncResult asyncResult) { var bytesRead = this.StandardOutput.BaseStream.EndRead(asyncResult); if (bytesRead == 0) { this.OnAutomationStopped(); return; } var input = this.StandardOutput.CurrentEncoding.GetString( this.buffer, 0, bytesRead); this.inputAccumulator.Append(input); if (bytesRead < this.buffer.Length) { this.OnInputRead(); // only send back if we 're sure we got it all } this.BeginReadAsync(); // continue "looping" with BeginRead } After any read which is not enough to fill the buffer, all accumulated data is sent to the subscribers: private void OnInputRead() { var handler = this.StandardOutputRead; if (handler == null) { return; } handler(this, new ConsoleOutputReadEventArgs(this.inputAccumulator.ToString())); this.inputAccumulator.Clear(); } (I know that as long as there are no subscribers the data gets accumulated forever. This is a deliberate decision). **The good** This scheme works *almost* perfectly: - Async functionality without spawning any threads - Very convenient to the calling code (just subscribe to an event) - Maintains the "chunkiness" of the data; this allows the calling code to use inside knowledge of the data without doing any extra work - Is almost agnostic to the buffer size (it will work correctly with any size buffer irrespective of the data being read) **The bad** That last *almost* is a very big one. Consider what happens when there is an incoming chunk with length exactly equal to the size of the buffer. The chunk will be read and buffered, but the event will not be triggered. This will be followed up by a `BeginRead` that expects to find more data belonging to the current chunk in order to send it back all in one piece, but... there will be no more data in the stream. *In fact, as long as data is put into the stream in chunks with length exactly equal to the buffer size, the data will be buffered and the event will never be triggered.* This scenario may be highly unlikely to occur in practice, especially since we can pick any number for the buffer size, but the problem is there. **Solution?** Unfortunately, after checking the available methods on `FileStream` and `StreamReader`, I can't find anything which lets me peek into the stream while also allowing async methods to be used on it. One "solution" would be to have a thread wait on a `ManualResetEvent` after the "buffer filled" condition is detected. If the event is not signaled (by the async callback) in a small amount of time, then more data from the stream will not be forthcoming and the data accumulated so far should be sent to subscribers. However, this introduces the need for another thread, requires thread synchronization, and is plain inelegant. Specifying a timeout for `BeginRead` would also suffice (call back into my code every now and then so I can check if there's data to be sent back; most of the time there will not be anything to do, so I expect the performance hit to be negligible). But it looks like timeouts are not supported in `FileStream`. Since I imagine that async calls with timeouts *are* an option in bare Win32, another approach might be to PInvoke the hell out of the problem. But this is also undesirable as it will introduce complexity and simply be a pain to code. Is there an elegant way to get around the problem? Thanks for being patient enough to read all of this.
0
7,660,321
10/05/2011 11:05:39
969,733
09/28/2011 18:29:07
8
0
Creating a static table header
I know there are lots of plugins there to display a table with static headers. My issue is that i have a for loop which returns the values under this table: foreach($ftsProducts as $x) { $content .= "<tr class='highlight'> <td class='reportCell' title='" . $x['BaseCode'] . "'>" . $x['Description'] . "</td> <td class='reportCell'>" . $x['Fit'] . "</td>"; foreach($sizes as $y) { $content .= "<td class='reportCell'>" . $x[$y] . "</td>"; } $content .= "<td style='font-weight: bold; text-align: center;'>" . $x['Total'] . "</td> </tr>"; } $content .= "</table>"; Anyone got any suggestions or advice. Many thanks
php
null
null
null
null
null
open
Creating a static table header === I know there are lots of plugins there to display a table with static headers. My issue is that i have a for loop which returns the values under this table: foreach($ftsProducts as $x) { $content .= "<tr class='highlight'> <td class='reportCell' title='" . $x['BaseCode'] . "'>" . $x['Description'] . "</td> <td class='reportCell'>" . $x['Fit'] . "</td>"; foreach($sizes as $y) { $content .= "<td class='reportCell'>" . $x[$y] . "</td>"; } $content .= "<td style='font-weight: bold; text-align: center;'>" . $x['Total'] . "</td> </tr>"; } $content .= "</table>"; Anyone got any suggestions or advice. Many thanks
0
4,529,585
12/25/2010 07:12:34
553,722
12/25/2010 07:12:34
1
0
What is the best book for learning object oriented javascript?
I'm a pro when it comes to HTML/CSS, and can use jQuery pretty well to move things around on my sites, but I need a good book for a NON PROGRAMMING person to learn OO JS. I just can't grasp it. I need a good book for learning! Thanks :)
javascript
null
null
null
null
07/13/2012 14:46:01
not constructive
What is the best book for learning object oriented javascript? === I'm a pro when it comes to HTML/CSS, and can use jQuery pretty well to move things around on my sites, but I need a good book for a NON PROGRAMMING person to learn OO JS. I just can't grasp it. I need a good book for learning! Thanks :)
4
1,907,954
12/15/2009 14:49:50
135,605
07/09/2009 12:03:27
100
3
Rails ActiveRecord relationships - has many and belongs to associations
I've created 3 models: - Article: contains an article - Tag: contains tags - ArticleTag: meant for associating a many-to-one tags to article relationship. It contains a tag_id and an article_id. The problem I'm having is I'm fairly new to the active record technology and I don't understand the proper way to define everything. Currently, which I think is wrong, is I have a ArticleTag belongs_to :article belongs_to :tag Now, from here my thought was to then add Article :has_many :tag I'm not sure if im approaching this correctly at all. Thanks for the help!
ruby-on-rails
many-to-one
models
table-relationships
null
null
open
Rails ActiveRecord relationships - has many and belongs to associations === I've created 3 models: - Article: contains an article - Tag: contains tags - ArticleTag: meant for associating a many-to-one tags to article relationship. It contains a tag_id and an article_id. The problem I'm having is I'm fairly new to the active record technology and I don't understand the proper way to define everything. Currently, which I think is wrong, is I have a ArticleTag belongs_to :article belongs_to :tag Now, from here my thought was to then add Article :has_many :tag I'm not sure if im approaching this correctly at all. Thanks for the help!
0
5,786,480
04/26/2011 05:51:16
723,273
04/25/2011 05:29:35
1
0
repeated usage of functions in stores procedures
What is the problem if i call a function repeatedly inside stored procedures in sql
sql-server-2005
null
null
null
null
04/28/2011 04:56:41
not a real question
repeated usage of functions in stores procedures === What is the problem if i call a function repeatedly inside stored procedures in sql
1
4,840,941
01/30/2011 03:18:36
594,791
01/29/2011 07:45:42
3
0
Zend_Db without Zend Framework
I want using Zend_Db without Zend_Framework. I want incorporate Zend_Db for my existing website that was not made using Zend Framework. Is it possible to use Zend_Db like this? Can you recommend good tutorial or example how to do it good?
php
zend-framework
zend-db
null
null
null
open
Zend_Db without Zend Framework === I want using Zend_Db without Zend_Framework. I want incorporate Zend_Db for my existing website that was not made using Zend Framework. Is it possible to use Zend_Db like this? Can you recommend good tutorial or example how to do it good?
0
8,687,596
12/31/2011 10:29:42
1,124,214
12/31/2011 10:23:48
1
0
Set value to hidden column by jquery
Have one question here. I am trying to set value to a hidden column previously i have achieved by doing var bc = $("select[title='Broadcast Channel']").val(); $("select[title='Execution Channel']").val(bc); this work fine as I am able to get the column which exist in html source. Now i am trying to set value to a hidden column which i have hide in sharepoint 2010 list setting. and i not able to find it under html source (eg. <input type=hidden....>) so how can i set value to this hidden column? any help is much appreciate. Thanks!
javascript
jquery
sharepoint
null
null
null
open
Set value to hidden column by jquery === Have one question here. I am trying to set value to a hidden column previously i have achieved by doing var bc = $("select[title='Broadcast Channel']").val(); $("select[title='Execution Channel']").val(bc); this work fine as I am able to get the column which exist in html source. Now i am trying to set value to a hidden column which i have hide in sharepoint 2010 list setting. and i not able to find it under html source (eg. <input type=hidden....>) so how can i set value to this hidden column? any help is much appreciate. Thanks!
0
4,213,845
11/18/2010 10:35:37
511,974
11/18/2010 10:35:37
1
0
Error:uncaught exception, not enoughh argument.va
i have this code,how can i solve this error. Ext.lib.Ajax = function() { var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'], CONTENTTYPE = 'Content-Type'; // private function setHeader(o) { var conn = o.conn, prop; function setTheHeaders(conn, headers){ for (prop in headers) { if (headers.hasOwnProperty(prop)) { conn.setRequestHeader(prop, headers[prop]); } } } if (pub.defaultHeaders) { setTheHeaders(conn, pub.defaultHeaders); } if (pub.headers) { setTheHeaders(conn, pub.headers); pub.headers = null; } } // private function createExceptionObject(tId, callbackArg, isAbort, isTimeout) { return { tId : tId, status : isAbort ? -1 : 0, statusText : isAbort ? 'transaction aborted' : 'communication failure', isAbort: true, isTimeout: true, argument : callbackArg }; } // private function initHeader(label, value) { (pub.headers = pub.headers || {})[label] = value; } // private function createResponseObject(o, callbackArg) { var headerObj = {}, headerStr, conn = o.conn, t, s; try { headerStr = o.conn.getAllResponseHeaders(); Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){ t = v.indexOf(':'); if(t >= 0){ s = v.substr(0, t).toLowerCase(); if(v.charAt(t + 1) == ' '){ ++t; } headerObj[s] = v.substr(t + 1); } }); } catch(e) {} return { tId : o.tId, status : conn.status, statusText : conn.statusText, getResponseHeader : function(header){return headerObj[header.toLowerCase()];}, getAllResponseHeaders : function(){return headerStr}, responseText : conn.responseText, responseXML : conn.responseXML, argument : callbackArg }; } // private function releaseObject(o) { o.conn = null; o = null; } // private function handleTransactionResponse(o, callback, isAbort, isTimeout) { if (!callback) { releaseObject(o); return; } var httpStatus, responseObject; try { if (o.conn.status !== undefined && o.conn.status != 0) { httpStatus = o.conn.status; } else { httpStatus = 13030; } } catch(e) { httpStatus = 13030; } if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) { responseObject = createResponseObject(o, callback.argument); if (callback.success) { if (!callback.scope) { callback.success(responseObject); } else { callback.success.apply(callback.scope, [responseObject]); } } } else { switch (httpStatus) { case 12002: case 12029: case 12030: case 12031: case 12152: case 13030: responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout); if (callback.failure) { if (!callback.scope) { callback.failure(responseObject); } else { callback.failure.apply(callback.scope, [responseObject]); } } break; default: responseObject = createResponseObject(o, callback.argument); if (callback.failure) { if (!callback.scope) { callback.failure(responseObject); } else { callback.failure.apply(callback.scope, [responseObject]); } } } } releaseObject(o); responseObject = null; } // private function handleReadyState(o, callback){ callback = callback || {}; var conn = o.conn, tId = o.tId, poll = pub.poll, cbTimeout = callback.timeout || null; if (cbTimeout) { pub.timeout[tId] = setTimeout(function() { pub.abort(o, callback, true); }, cbTimeout); } poll[tId] = setInterval( function() { if (conn && conn.readyState == 4) { clearInterval(poll[tId]); poll[tId] = null; if (cbTimeout) { clearTimeout(pub.timeout[tId]); pub.timeout[tId] = null; } handleTransactionResponse(o, callback); } }, pub.pollInterval); } // private function asyncRequest(method, uri, callback, postData) { var o = getConnectionObject() || null; if (o) { o.conn.open(method, uri, true); if (pub.useDefaultXhrHeader) { initHeader('X-Requested-With', pub.defaultXhrHeader); } if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){ initHeader(CONTENTTYPE, pub.defaultPostHeader); } if (pub.defaultHeaders || pub.headers) { setHeader(o); } handleReadyState(o, callback); o.conn.send(postData || null); } return o; } // private function getConnectionObject() { var o; try { if (o = createXhrObject(pub.transactionId)) { pub.transactionId++; } } catch(e) { } finally { return o; } }
javascript
null
null
null
null
11/18/2010 15:24:06
not a real question
Error:uncaught exception, not enoughh argument.va === i have this code,how can i solve this error. Ext.lib.Ajax = function() { var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'], CONTENTTYPE = 'Content-Type'; // private function setHeader(o) { var conn = o.conn, prop; function setTheHeaders(conn, headers){ for (prop in headers) { if (headers.hasOwnProperty(prop)) { conn.setRequestHeader(prop, headers[prop]); } } } if (pub.defaultHeaders) { setTheHeaders(conn, pub.defaultHeaders); } if (pub.headers) { setTheHeaders(conn, pub.headers); pub.headers = null; } } // private function createExceptionObject(tId, callbackArg, isAbort, isTimeout) { return { tId : tId, status : isAbort ? -1 : 0, statusText : isAbort ? 'transaction aborted' : 'communication failure', isAbort: true, isTimeout: true, argument : callbackArg }; } // private function initHeader(label, value) { (pub.headers = pub.headers || {})[label] = value; } // private function createResponseObject(o, callbackArg) { var headerObj = {}, headerStr, conn = o.conn, t, s; try { headerStr = o.conn.getAllResponseHeaders(); Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){ t = v.indexOf(':'); if(t >= 0){ s = v.substr(0, t).toLowerCase(); if(v.charAt(t + 1) == ' '){ ++t; } headerObj[s] = v.substr(t + 1); } }); } catch(e) {} return { tId : o.tId, status : conn.status, statusText : conn.statusText, getResponseHeader : function(header){return headerObj[header.toLowerCase()];}, getAllResponseHeaders : function(){return headerStr}, responseText : conn.responseText, responseXML : conn.responseXML, argument : callbackArg }; } // private function releaseObject(o) { o.conn = null; o = null; } // private function handleTransactionResponse(o, callback, isAbort, isTimeout) { if (!callback) { releaseObject(o); return; } var httpStatus, responseObject; try { if (o.conn.status !== undefined && o.conn.status != 0) { httpStatus = o.conn.status; } else { httpStatus = 13030; } } catch(e) { httpStatus = 13030; } if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) { responseObject = createResponseObject(o, callback.argument); if (callback.success) { if (!callback.scope) { callback.success(responseObject); } else { callback.success.apply(callback.scope, [responseObject]); } } } else { switch (httpStatus) { case 12002: case 12029: case 12030: case 12031: case 12152: case 13030: responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout); if (callback.failure) { if (!callback.scope) { callback.failure(responseObject); } else { callback.failure.apply(callback.scope, [responseObject]); } } break; default: responseObject = createResponseObject(o, callback.argument); if (callback.failure) { if (!callback.scope) { callback.failure(responseObject); } else { callback.failure.apply(callback.scope, [responseObject]); } } } } releaseObject(o); responseObject = null; } // private function handleReadyState(o, callback){ callback = callback || {}; var conn = o.conn, tId = o.tId, poll = pub.poll, cbTimeout = callback.timeout || null; if (cbTimeout) { pub.timeout[tId] = setTimeout(function() { pub.abort(o, callback, true); }, cbTimeout); } poll[tId] = setInterval( function() { if (conn && conn.readyState == 4) { clearInterval(poll[tId]); poll[tId] = null; if (cbTimeout) { clearTimeout(pub.timeout[tId]); pub.timeout[tId] = null; } handleTransactionResponse(o, callback); } }, pub.pollInterval); } // private function asyncRequest(method, uri, callback, postData) { var o = getConnectionObject() || null; if (o) { o.conn.open(method, uri, true); if (pub.useDefaultXhrHeader) { initHeader('X-Requested-With', pub.defaultXhrHeader); } if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){ initHeader(CONTENTTYPE, pub.defaultPostHeader); } if (pub.defaultHeaders || pub.headers) { setHeader(o); } handleReadyState(o, callback); o.conn.send(postData || null); } return o; } // private function getConnectionObject() { var o; try { if (o = createXhrObject(pub.transactionId)) { pub.transactionId++; } } catch(e) { } finally { return o; } }
1
9,738,961
03/16/2012 14:19:17
846,627
07/15/2011 14:25:28
1
0
slowing down a user's ability to button mash in Android
I have an activity that runs some ASCII control over a network port to a remote device. Every single button push on the interface will trigger an AsyncTask to handle the communication, and (finally) works great. However, if a user starts button mashing like a chimp on crack, the system will crash with way too many calls on the same socket, so I've come up with a little timer function to slow down the reaction to their excitement. I'm wondering if somebody has come up with a better way to do this? First off, inside the onCreate: btn_pwrtoggle = (Button)findViewById(R.id.pwr_btn); btn_pwrtoggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!buttonMasher){ if(powerstat.equals("OFF")){ String[] commandToSend = {"POWER","ON"} }else{ String[] commandToSend = {"POWER","OFF"}; } deviceControl(commandToSend); } startButtonMashTimer(); }else{ Log.w("button masher","slow down there, monkey."); } } }); Then, in the actual Activity: Timer buttonTimer; TimerTask buttonMonitorThread; int chimpCrackCounter; protected void startButtonMashTimer() { chimpCrackCounter = 0; buttonTimer = new Timer(); buttonMonitorThread = new TimerTask(){ @Override public void run(){ buttonMasher = true; if(chimpCrackCounter == 1){ buttonMasher = false; buttonTimer.cancel(); } chimpCrackCounter++; } }; buttonTimer.schedule(buttonMonitorThread, 0, 500); } It seems to be working just fine, (and may help somebody having the same difficulty) but I'm open to suggestions.
android
performance
onclicklistener
null
null
null
open
slowing down a user's ability to button mash in Android === I have an activity that runs some ASCII control over a network port to a remote device. Every single button push on the interface will trigger an AsyncTask to handle the communication, and (finally) works great. However, if a user starts button mashing like a chimp on crack, the system will crash with way too many calls on the same socket, so I've come up with a little timer function to slow down the reaction to their excitement. I'm wondering if somebody has come up with a better way to do this? First off, inside the onCreate: btn_pwrtoggle = (Button)findViewById(R.id.pwr_btn); btn_pwrtoggle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!buttonMasher){ if(powerstat.equals("OFF")){ String[] commandToSend = {"POWER","ON"} }else{ String[] commandToSend = {"POWER","OFF"}; } deviceControl(commandToSend); } startButtonMashTimer(); }else{ Log.w("button masher","slow down there, monkey."); } } }); Then, in the actual Activity: Timer buttonTimer; TimerTask buttonMonitorThread; int chimpCrackCounter; protected void startButtonMashTimer() { chimpCrackCounter = 0; buttonTimer = new Timer(); buttonMonitorThread = new TimerTask(){ @Override public void run(){ buttonMasher = true; if(chimpCrackCounter == 1){ buttonMasher = false; buttonTimer.cancel(); } chimpCrackCounter++; } }; buttonTimer.schedule(buttonMonitorThread, 0, 500); } It seems to be working just fine, (and may help somebody having the same difficulty) but I'm open to suggestions.
0
7,527,910
09/23/2011 10:56:14
960,846
03/25/2011 05:09:42
1
0
Validation for you tube embed video
How to validate youtube embed video ?need regular expression in .net
javascript
asp.net
regex
null
null
09/23/2011 11:09:41
not a real question
Validation for you tube embed video === How to validate youtube embed video ?need regular expression in .net
1
8,041,179
11/07/2011 18:58:00
1,486,553
11/07/2011 17:43:36
1
0
how to use WP e-Commerce Canada Post shipping module under wordpress?
I have found the http://blog.yannbouschet.com/wp-content/uploads/2010/11/canadapost_wp_ecommerce.zip module. i uploaded it and also activated, however there are no place to find the setting for this plugin, anyone know how to use it?
php
wordpress
wordpress-plugin
null
null
12/06/2011 04:21:55
off topic
how to use WP e-Commerce Canada Post shipping module under wordpress? === I have found the http://blog.yannbouschet.com/wp-content/uploads/2010/11/canadapost_wp_ecommerce.zip module. i uploaded it and also activated, however there are no place to find the setting for this plugin, anyone know how to use it?
2
5,218,958
03/07/2011 11:12:31
647,947
03/07/2011 10:13:33
1
0
How do I use python progarm to build chrome extension??
I need to build a chrome extension where I can run the python program. Is that p
google-chrome
google-chrome-extension
null
null
null
03/08/2011 07:41:03
not a real question
How do I use python progarm to build chrome extension?? === I need to build a chrome extension where I can run the python program. Is that p
1
2,103,904
01/20/2010 18:30:09
20,526
09/22/2008 15:32:14
149
18
ASP.Net Cannot tab through all radio buttons when selected
I'm trying to implement accessibility (keyboard only) ability on my site, but I'm having problems with Radio Button lists. When using radiobuttonlists, when initially, none of the radio buttons is selected, I am able to tab through every single value and select one upon hitting "enter". However, after a value is selected, I can only tab to the selected values, which presents a problem if I want to change the selected value. From what I understand, radio buttons are grouped at the container controller level, thus when it is considered a group, only one can be selected at a time. Any ideas on how to fix this issue?
asp.net
radiobuttonlist
null
null
null
null
open
ASP.Net Cannot tab through all radio buttons when selected === I'm trying to implement accessibility (keyboard only) ability on my site, but I'm having problems with Radio Button lists. When using radiobuttonlists, when initially, none of the radio buttons is selected, I am able to tab through every single value and select one upon hitting "enter". However, after a value is selected, I can only tab to the selected values, which presents a problem if I want to change the selected value. From what I understand, radio buttons are grouped at the container controller level, thus when it is considered a group, only one can be selected at a time. Any ideas on how to fix this issue?
0
2,088,558
01/18/2010 19:11:42
229,976
12/11/2009 21:17:38
198
27
Updating HTML via JSON/AJAX
I've been using JSON to handle AJAX functionality in my rails applications ever since I heard about it, because using RJS/rendering HTML "felt" wrong because it violated MVC. The first AJAX-heavy project I worked on ended up with 20-30 controller actions tied directly to specific UI-behaviors and my view code spread over controller actions, partials and rjs files . The one headache I've found from using pure JSON is that you have to 'render' HTML via JS, which in the case of AJAX that has to update DOM-heavy elements, can be a real pain. I end up with long string building code like // ...ajax success: function(records){ $(records).each(function(record){ var html = ('<div id="blah">' + record.attr + etc + ') }) } where etc is 10-15 lines of dynamically constructing HTML based on record data. Is there a better practice for this approach? (My motivation for finally reaching out is I am now tasked with updating HTML so complex it required two nested loops of Ruby code to render in the first place. Duplicating that in Javascript seems insane.)
ajax
json
ruby-on-rails
javascript
jquery
null
open
Updating HTML via JSON/AJAX === I've been using JSON to handle AJAX functionality in my rails applications ever since I heard about it, because using RJS/rendering HTML "felt" wrong because it violated MVC. The first AJAX-heavy project I worked on ended up with 20-30 controller actions tied directly to specific UI-behaviors and my view code spread over controller actions, partials and rjs files . The one headache I've found from using pure JSON is that you have to 'render' HTML via JS, which in the case of AJAX that has to update DOM-heavy elements, can be a real pain. I end up with long string building code like // ...ajax success: function(records){ $(records).each(function(record){ var html = ('<div id="blah">' + record.attr + etc + ') }) } where etc is 10-15 lines of dynamically constructing HTML based on record data. Is there a better practice for this approach? (My motivation for finally reaching out is I am now tasked with updating HTML so complex it required two nested loops of Ruby code to render in the first place. Duplicating that in Javascript seems insane.)
0
6,936,840
08/04/2011 06:02:43
567,967
01/08/2011 11:23:50
59
0
In django, how to delete all related objects when deleting a certain type of instances?
I first tried to override the delete() method but that doesn't work for QuerySet's bulk delete method. It should be related to pre_delete signal but I can't figure it out. Can someone please help me?
python
django
null
null
null
null
open
In django, how to delete all related objects when deleting a certain type of instances? === I first tried to override the delete() method but that doesn't work for QuerySet's bulk delete method. It should be related to pre_delete signal but I can't figure it out. Can someone please help me?
0
10,396,812
05/01/2012 11:03:58
870,691
07/30/2011 13:29:18
17
0
Use of undefined constant in php class
don't know better title for this, but here's my code. I have class user that checks form data when it's instanciated but I get following errors/notices: Notice: Use of undefined constant username - assumed 'username' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 Notice: Use of undefined constant password - assumed 'password' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 Notice: Use of undefined constant passwordc - assumed 'passwordc' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 ... and so on for every defined variable in user class. Here's the user class: class User { function __construct(){ $test = 'blah'; $username; $password; $passwordc; $name; $surname; $address; $this->checkInput(array(username=>20, password=>20, passwordc=>20, name=>20, surname=>40, address=>40)); } //array(formName=>CharacterLimit) private function checkInput($fields){ foreach($fields as $field=>$limit){ if($_POST[$field]=='' || strlen($_POST[$field])>$limit) $this->error[] = "$field must be filled in, and it must be less than or $limit characters long."; else $this->{$field} = $_POST[$field]; } } } I don't quite understand what's the problem, I've tried first just creating variables and than from the main program calling checkInput method, but I get same error.
php
constants
undefined
name
null
05/01/2012 11:34:00
not a real question
Use of undefined constant in php class === don't know better title for this, but here's my code. I have class user that checks form data when it's instanciated but I get following errors/notices: Notice: Use of undefined constant username - assumed 'username' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 Notice: Use of undefined constant password - assumed 'password' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 Notice: Use of undefined constant passwordc - assumed 'passwordc' in C:\Users\Jinxed\Desktop\WebTrgovina\app\m\Register\User.m.php on line 7 ... and so on for every defined variable in user class. Here's the user class: class User { function __construct(){ $test = 'blah'; $username; $password; $passwordc; $name; $surname; $address; $this->checkInput(array(username=>20, password=>20, passwordc=>20, name=>20, surname=>40, address=>40)); } //array(formName=>CharacterLimit) private function checkInput($fields){ foreach($fields as $field=>$limit){ if($_POST[$field]=='' || strlen($_POST[$field])>$limit) $this->error[] = "$field must be filled in, and it must be less than or $limit characters long."; else $this->{$field} = $_POST[$field]; } } } I don't quite understand what's the problem, I've tried first just creating variables and than from the main program calling checkInput method, but I get same error.
1
8,599,085
12/22/2011 03:17:39
1,026,305
11/02/2011 18:53:39
4
0
Using Java how can I return a true/false value depending if a value is held in a mysql table or not?
Using Java how can I return a true/false value depending if a value is held in a mysql table or not? The table has a list of usernames and a bit value of 1 or 0 I want to check if the bit value is a 1 or 0 Thanks any help is a appreciated
java
mysql
null
null
null
12/22/2011 08:23:34
not a real question
Using Java how can I return a true/false value depending if a value is held in a mysql table or not? === Using Java how can I return a true/false value depending if a value is held in a mysql table or not? The table has a list of usernames and a bit value of 1 or 0 I want to check if the bit value is a 1 or 0 Thanks any help is a appreciated
1
4,281,445
11/25/2010 23:11:41
207,123
11/09/2009 17:16:56
8
0
Regular Expression C#
I need use c# RegEx to process a string. The idea is delete initials characteres, like a substring. Example string := "04|aH 800 A574a C.R."; The result should be "H 800 A574a C.R.". But the patron is variable, because the string can be "4|aProtestas populares" and the result should be "Protestas populares" Summarizing, I need the substring after a "|x" ignoring what is before this expression. Thanks... PD: Sorry by my english :S
c#
regex
null
null
null
null
open
Regular Expression C# === I need use c# RegEx to process a string. The idea is delete initials characteres, like a substring. Example string := "04|aH 800 A574a C.R."; The result should be "H 800 A574a C.R.". But the patron is variable, because the string can be "4|aProtestas populares" and the result should be "Protestas populares" Summarizing, I need the substring after a "|x" ignoring what is before this expression. Thanks... PD: Sorry by my english :S
0
5,972,784
05/12/2011 02:43:58
749,795
05/12/2011 02:41:06
1
0
How to install USB Device Driver for LG Thrive Android Device?
I have just purchased LG Thrive handset for android apps development purpose. I tried installing "LGMS690" and "LG _USB _Drivers_All_4.9.7" usb device drivers on my windows 7 PC, but my device is not getting detected in eclipse android plugin. I am unable to run/debug my applications on this device. Please help me with what steps should I follow to get my device ready for running/debugging apps..
usb
driver
device
android-2.2
lg
06/06/2012 11:03:01
off topic
How to install USB Device Driver for LG Thrive Android Device? === I have just purchased LG Thrive handset for android apps development purpose. I tried installing "LGMS690" and "LG _USB _Drivers_All_4.9.7" usb device drivers on my windows 7 PC, but my device is not getting detected in eclipse android plugin. I am unable to run/debug my applications on this device. Please help me with what steps should I follow to get my device ready for running/debugging apps..
2
3,328,062
07/25/2010 04:51:14
65,313
02/11/2009 21:54:03
1,127
64
Any good EAI (Enterprise Application Integration) books?
One of the jobs I'm looking at requires good experience with EAI. Was wondering if anyone can recommend good EAI books / resources?
eai
null
null
null
null
09/28/2011 11:30:09
not constructive
Any good EAI (Enterprise Application Integration) books? === One of the jobs I'm looking at requires good experience with EAI. Was wondering if anyone can recommend good EAI books / resources?
4
9,429,699
02/24/2012 11:08:06
1,197,089
02/08/2012 11:48:36
6
0
IllegalArgumentException JSON
I am trying to put String[] in jsonObject and getting following error > java.lang.IllegalArgumentException: Invalid type of value. Type: > [[Ljava.lang.String;] with value: [[Ljava.lang.String;@189db56] at > com.ibm.json.java.JSONObject.put(JSONObject.java:241) Please help me to resolve this. Thanks
java
json
illegalargumentexception
null
null
null
open
IllegalArgumentException JSON === I am trying to put String[] in jsonObject and getting following error > java.lang.IllegalArgumentException: Invalid type of value. Type: > [[Ljava.lang.String;] with value: [[Ljava.lang.String;@189db56] at > com.ibm.json.java.JSONObject.put(JSONObject.java:241) Please help me to resolve this. Thanks
0
10,893,683
06/05/2012 08:04:33
788,841
06/08/2011 08:45:56
160
0
Reading CSV files from Java
I have a csv file, with multiple rows and columns. Let say Dates Data1 data2 19/07/1999 2 5 18/06/1991 3 9 Given a column header name(say data2), I want to extract the column corresponding to it. How to do it? Also, given a particular date(say 18/06/1991), and a column header name, how to get corresponding field ?
java
file-io
csv
null
null
06/05/2012 09:34:13
not a real question
Reading CSV files from Java === I have a csv file, with multiple rows and columns. Let say Dates Data1 data2 19/07/1999 2 5 18/06/1991 3 9 Given a column header name(say data2), I want to extract the column corresponding to it. How to do it? Also, given a particular date(say 18/06/1991), and a column header name, how to get corresponding field ?
1
6,681,390
07/13/2011 15:27:19
805,245
06/19/2011 10:45:06
13
0
U3 - Usb flash drive
I want set that the U3 is the only way to access the DOK and there will be no shortcut in "My Computer". And this change will be kept to differnt computers?Is it possible?
usb
null
null
null
null
07/15/2011 11:28:13
off topic
U3 - Usb flash drive === I want set that the U3 is the only way to access the DOK and there will be no shortcut in "My Computer". And this change will be kept to differnt computers?Is it possible?
2
3,794,669
09/25/2010 17:05:40
158,285
08/18/2009 08:53:29
774
41
Confirmation email from devise on rails3 using gmail not arriving.
I've set the following up. ---------------------- config/environments/development.rb ---------------------- 29 ActionMailer::Base.delivery_method = :smtp 30 ActionMailer::Base.perform_deliveries = true 31 ActionMailer::Base.raise_delivery_errors = true 32 33 ActionMailer::Base.smtp_settings = { 34 :enable_starttls_auto => true, #this is the important shit! 35 :address => 'smtp.gmail.com', 36 :port => 587, 37 :domain => 'foo.com', 38 :authentication => :plain, 39 :user_name => '---@---.---', 40 :password => '---' 41 } However when devise sends the confirmation email webbrick prints out the email in the log with no error but the email does not end up in my inbox or spam inbox. Any ideas?
ruby-on-rails-3
gmail
devise
null
null
null
open
Confirmation email from devise on rails3 using gmail not arriving. === I've set the following up. ---------------------- config/environments/development.rb ---------------------- 29 ActionMailer::Base.delivery_method = :smtp 30 ActionMailer::Base.perform_deliveries = true 31 ActionMailer::Base.raise_delivery_errors = true 32 33 ActionMailer::Base.smtp_settings = { 34 :enable_starttls_auto => true, #this is the important shit! 35 :address => 'smtp.gmail.com', 36 :port => 587, 37 :domain => 'foo.com', 38 :authentication => :plain, 39 :user_name => '---@---.---', 40 :password => '---' 41 } However when devise sends the confirmation email webbrick prints out the email in the log with no error but the email does not end up in my inbox or spam inbox. Any ideas?
0
9,789,317
03/20/2012 15:03:16
1,281,186
03/20/2012 14:42:38
1
0
Novice programmer - will I need to bring in an outside programmer for this project (Javascript)
I am familiar with HMLT and javascript and will begin building a (wordpress) website promoting a CPA exam (I'm an MS accounting student) review that I think will be unlike any out there and sell very well (4 exams and each review around $39). I'm only giving this background to show my intent is authentic and not the typical "start a website make $$" type thing. **My question is about the depth that the website will have and whether it would be better to bring in a freelance coder or learn to develop the more complicated aspects myself.** The website will have an interface where paid users will login and go through a series of quizzes in the form of checkbox, drop down menus, and others. Each page/quiz area could have 20-100 total checkboxes in a series of 3-5 rows because of the comprehensive nature of CPA exam. This I can do - I know how to code the quiz and return a correct or incorrect answer based on each individual checkbox and present a cumulative score (ie: you got 57% correct). The issue lies in the fact that I would like to save the users results and keep them informed of their progress. When they complete all of the quizzes, I would like to have a visual output of their performance in each area. **Storing the output from their results offline is where I think I may run into a problem with my lack of coding experience.** I would also like to have a sidebar with their progress of each section (10-15) with a green percentage completion bar or a % correct which would draw from this. I have never had to code something that stores information like this offline - so back to my question - would it be better to learn the language needed or bring in a coder/developer for the back end stuff. Thanks - heard great things about this forum.
javascript
null
null
null
null
03/20/2012 15:07:06
off topic
Novice programmer - will I need to bring in an outside programmer for this project (Javascript) === I am familiar with HMLT and javascript and will begin building a (wordpress) website promoting a CPA exam (I'm an MS accounting student) review that I think will be unlike any out there and sell very well (4 exams and each review around $39). I'm only giving this background to show my intent is authentic and not the typical "start a website make $$" type thing. **My question is about the depth that the website will have and whether it would be better to bring in a freelance coder or learn to develop the more complicated aspects myself.** The website will have an interface where paid users will login and go through a series of quizzes in the form of checkbox, drop down menus, and others. Each page/quiz area could have 20-100 total checkboxes in a series of 3-5 rows because of the comprehensive nature of CPA exam. This I can do - I know how to code the quiz and return a correct or incorrect answer based on each individual checkbox and present a cumulative score (ie: you got 57% correct). The issue lies in the fact that I would like to save the users results and keep them informed of their progress. When they complete all of the quizzes, I would like to have a visual output of their performance in each area. **Storing the output from their results offline is where I think I may run into a problem with my lack of coding experience.** I would also like to have a sidebar with their progress of each section (10-15) with a green percentage completion bar or a % correct which would draw from this. I have never had to code something that stores information like this offline - so back to my question - would it be better to learn the language needed or bring in a coder/developer for the back end stuff. Thanks - heard great things about this forum.
2
6,472,630
06/24/2011 19:10:37
781,573
06/02/2011 17:28:39
808
83
How can I improve my jQuery React plugin?
I've been working on a jQuery plugin and I would like to get suggestions on how to improve both the code and its usefulness. Here's the demo page: http://natedavisolds.com/workshop/react.html Would this be useful to you? What other functionality should I include? Any refactoring or structure changes that I should make? ## The Goal The plugin helps in situations where an element should hide or show based on values in other elements. In particular, it excels when there are multiple conditions that need to be satisfied in order to hide or show. ### Additional concepts to keep in mind - use as jQuery pluin - easy to chain rules together - understandable by reading a line of code - can build/add custom conditions ### Example of business rules to solve Let's say we have the following rules for elements: - Display a set of checkboxes if 1. Zip is between 19000 and 20000 2. Income is lower than 15000 - Display another set of checkboxes if 1. City is 'Philadelphia' 2. Income is lower than 40000 - Display city select box if 1. Zip is between 19100 and 19400 ### Ideal look $('.elements_to_display') .reactIf( '#some_form_element', SatisfiesFirstCondition) .reactIf( '#some_other_form_element', SatisfiesAnotherCondition) .reactIf( '#some_other_form_element', SatisfiesAnotherCondition); # The Code ### Page JS var IS = $.extend({}, $.fn.reactor.helpers); $('.cities') .reactIf('#zip', IS.Between(19100, 19400)) .reactIf('#zip', IS.NotBlank); $('.philly_middle_to_low_income') .reactIf('#income_2011', IS.LessThan(40000)) .reactIf('#cities_select', IS.EqualTo('philadelphia')); $('.low_income_select_zips') .reactIf('#income_2011', IS.LessThan(15000)) .reactIf('#zip', IS.BetweenSameLength(19000, 20000)) .reactIf('#zip', IS.NotBlank); $('.reactor').trigger('change.reactor'); ### Plugin react.js (function($){ $.fn.reactTo = function(selector) { var $elements = $(selector), $reactor_element = $(this), _proxy_event = function() { $reactor_element.trigger('change.reactor'); }; $elements.filter('select').bind('change.reactor', _proxy_event); $elements.filter('input').bind('keyup.reactor', _proxy_event); return this; }; $.fn.reactIf = function(sel, exp_func) { var $sel = $(sel); var _func = function() { return exp_func.apply($sel); }; this.each(function() { if (!$(this).hasClass('reactor')) { $(this).reactor(); } var conditions_arry = $(this).data('conditions.reactor'); if (!$.isArray(conditions_arry)) { conditions_arry = []}; conditions_arry.push(_func); $(this).data('conditions.reactor', conditions_arry); }); $(this).reactTo(sel); return this; }; $.fn.react = function() { this.each(function() { $(this).trigger('change.reactor') }); return this; }; $.fn.reactor = function(options) { var settings = $.extend({}, $.fn.reactor.defaults, options); this.each(function() { // var opts = $.meta ? $.extend({}, settings, $this.data()) : settings; var $element = $(this); if (!$element.hasClass('reactor')) { $element.data('conditions.reactor', []).addClass('reactor'); } var is_reactionary = function() { var conditionalArray = $(this).data('conditions.reactor'); var r = true; $.each(conditionalArray, function() { r = (r && this.call()); }); return r; } var reaction = function(evt) { evt.stopPropagation(); if (is_reactionary.apply(this)) { settings.compliant.apply($element); } else { settings.uncompliant.apply($element); } } $element.bind('change.reactor', reaction); }); return this; }; $.fn.reactor.defaults = { compliant: function() { $(this).show(); }, uncompliant: function() { $(this).hide(); } }; $.fn.reactor.helpers = { NotBlank: function() { return( $(this).val().toString() != "" ) }, Blank: function() { return( $(this).val().toString() == "" ) }, EqualTo: function(matchStr) { var _func = function() { var v = $(this).val(); if (v) { return( v.toString() == matchStr ); } else { return false; } } return _func; }, LessThan: function(number) { var _func = function() { var v = $(this).val(); return(!(v && parseInt(v) > number)); } return _func; }, MoreThan: function(number) { var _func = function() { var v = $(this).val(); return(!(v && parseInt(v) < number)); } return _func; }, Between: function(min, max) { var _func = function() { var v = $(this).val(); return(!(v && (parseInt(v) > max || parseInt(v) < min))); } return _func; }, BetweenSameLength: function(min, max) { var len = min.toString().length; var _func = function() { var v = $(this).val(); return(!(v && v.length == len && (parseInt(v) > max || parseInt(v) < min))); } return _func; } }; })(jQuery); ### HTML react.html <form id="portfolio_form"> <fieldset> <label>Zip</label> <input id="zip" type="text" value="" /><br /> <label>2011 Income</label> <input id="income_2011" name="income[2011]" /> </fieldset> <p>Display cities only when zip is between 19100 and 19400</p> <fieldset class="cities"> <label>Cities</label> <select id="cities_select"> <option value=""></option> <option value="philadelphia">Philadelphia</option> <option value="media">Media</option> <option value="doylestown">Doylestown</option> </select> </fieldset> <p>Display checkboxes only for Philadelphia and income less than 40000</p> <fieldset class="philly_middle_to_low_income"> <input type="checkbox" /> Check One<br /> <input type="checkbox" /> Check Two<br /> <input type="checkbox" /> Check Three<br /> <input type="checkbox" /> Check Four<br /> </fieldset> <p>Display checkboxes when zip is between 19000 and 20000 and income is lower than 25000</p> <fieldset class="low_income_select_zips"> <input type="checkbox" /> Check One<br /> <input type="checkbox" /> Check Two<br /> <input type="checkbox" /> Check Three<br /> <input type="checkbox" /> Check Four<br /> </fieldset> </form>
jquery
jquery-plugins
null
null
null
06/25/2011 10:09:31
not a real question
How can I improve my jQuery React plugin? === I've been working on a jQuery plugin and I would like to get suggestions on how to improve both the code and its usefulness. Here's the demo page: http://natedavisolds.com/workshop/react.html Would this be useful to you? What other functionality should I include? Any refactoring or structure changes that I should make? ## The Goal The plugin helps in situations where an element should hide or show based on values in other elements. In particular, it excels when there are multiple conditions that need to be satisfied in order to hide or show. ### Additional concepts to keep in mind - use as jQuery pluin - easy to chain rules together - understandable by reading a line of code - can build/add custom conditions ### Example of business rules to solve Let's say we have the following rules for elements: - Display a set of checkboxes if 1. Zip is between 19000 and 20000 2. Income is lower than 15000 - Display another set of checkboxes if 1. City is 'Philadelphia' 2. Income is lower than 40000 - Display city select box if 1. Zip is between 19100 and 19400 ### Ideal look $('.elements_to_display') .reactIf( '#some_form_element', SatisfiesFirstCondition) .reactIf( '#some_other_form_element', SatisfiesAnotherCondition) .reactIf( '#some_other_form_element', SatisfiesAnotherCondition); # The Code ### Page JS var IS = $.extend({}, $.fn.reactor.helpers); $('.cities') .reactIf('#zip', IS.Between(19100, 19400)) .reactIf('#zip', IS.NotBlank); $('.philly_middle_to_low_income') .reactIf('#income_2011', IS.LessThan(40000)) .reactIf('#cities_select', IS.EqualTo('philadelphia')); $('.low_income_select_zips') .reactIf('#income_2011', IS.LessThan(15000)) .reactIf('#zip', IS.BetweenSameLength(19000, 20000)) .reactIf('#zip', IS.NotBlank); $('.reactor').trigger('change.reactor'); ### Plugin react.js (function($){ $.fn.reactTo = function(selector) { var $elements = $(selector), $reactor_element = $(this), _proxy_event = function() { $reactor_element.trigger('change.reactor'); }; $elements.filter('select').bind('change.reactor', _proxy_event); $elements.filter('input').bind('keyup.reactor', _proxy_event); return this; }; $.fn.reactIf = function(sel, exp_func) { var $sel = $(sel); var _func = function() { return exp_func.apply($sel); }; this.each(function() { if (!$(this).hasClass('reactor')) { $(this).reactor(); } var conditions_arry = $(this).data('conditions.reactor'); if (!$.isArray(conditions_arry)) { conditions_arry = []}; conditions_arry.push(_func); $(this).data('conditions.reactor', conditions_arry); }); $(this).reactTo(sel); return this; }; $.fn.react = function() { this.each(function() { $(this).trigger('change.reactor') }); return this; }; $.fn.reactor = function(options) { var settings = $.extend({}, $.fn.reactor.defaults, options); this.each(function() { // var opts = $.meta ? $.extend({}, settings, $this.data()) : settings; var $element = $(this); if (!$element.hasClass('reactor')) { $element.data('conditions.reactor', []).addClass('reactor'); } var is_reactionary = function() { var conditionalArray = $(this).data('conditions.reactor'); var r = true; $.each(conditionalArray, function() { r = (r && this.call()); }); return r; } var reaction = function(evt) { evt.stopPropagation(); if (is_reactionary.apply(this)) { settings.compliant.apply($element); } else { settings.uncompliant.apply($element); } } $element.bind('change.reactor', reaction); }); return this; }; $.fn.reactor.defaults = { compliant: function() { $(this).show(); }, uncompliant: function() { $(this).hide(); } }; $.fn.reactor.helpers = { NotBlank: function() { return( $(this).val().toString() != "" ) }, Blank: function() { return( $(this).val().toString() == "" ) }, EqualTo: function(matchStr) { var _func = function() { var v = $(this).val(); if (v) { return( v.toString() == matchStr ); } else { return false; } } return _func; }, LessThan: function(number) { var _func = function() { var v = $(this).val(); return(!(v && parseInt(v) > number)); } return _func; }, MoreThan: function(number) { var _func = function() { var v = $(this).val(); return(!(v && parseInt(v) < number)); } return _func; }, Between: function(min, max) { var _func = function() { var v = $(this).val(); return(!(v && (parseInt(v) > max || parseInt(v) < min))); } return _func; }, BetweenSameLength: function(min, max) { var len = min.toString().length; var _func = function() { var v = $(this).val(); return(!(v && v.length == len && (parseInt(v) > max || parseInt(v) < min))); } return _func; } }; })(jQuery); ### HTML react.html <form id="portfolio_form"> <fieldset> <label>Zip</label> <input id="zip" type="text" value="" /><br /> <label>2011 Income</label> <input id="income_2011" name="income[2011]" /> </fieldset> <p>Display cities only when zip is between 19100 and 19400</p> <fieldset class="cities"> <label>Cities</label> <select id="cities_select"> <option value=""></option> <option value="philadelphia">Philadelphia</option> <option value="media">Media</option> <option value="doylestown">Doylestown</option> </select> </fieldset> <p>Display checkboxes only for Philadelphia and income less than 40000</p> <fieldset class="philly_middle_to_low_income"> <input type="checkbox" /> Check One<br /> <input type="checkbox" /> Check Two<br /> <input type="checkbox" /> Check Three<br /> <input type="checkbox" /> Check Four<br /> </fieldset> <p>Display checkboxes when zip is between 19000 and 20000 and income is lower than 25000</p> <fieldset class="low_income_select_zips"> <input type="checkbox" /> Check One<br /> <input type="checkbox" /> Check Two<br /> <input type="checkbox" /> Check Three<br /> <input type="checkbox" /> Check Four<br /> </fieldset> </form>
1
1,803,610
11/26/2009 13:14:27
82,062
03/24/2009 15:01:30
3,475
245
IE7/IE8 and frozen animated gifs
I'm quite sure this is an old problem. This is how i render my animated gif: <img id='loading' alt='loading' style="display: none; position: relative; left:10px; top:2px;" src="<%= Url.Image("loading.gif") %>" /> This is how I'm desperately trying to show it at the moment: showLoading: function(gifId, butId) { var n = gifId != undefined ? gifId : 'loading'; var l = $('#' + n); //if browser is stupid if ('v' == '\v') { var s = l.attr('src'); var x = document.getElementById(n); x.style.visibility = "visible"; x.style.display = "inline"; setTimeout("document.getElementById('" + n + "').src = '"+s+"';", 100); } else { l.show(); } if (butId != undefined) $('#' + butId).css('cursor', 'default').attr("disabled", true); }, **Problem:** Animated gif appears frozen, there is no animation Strangest thing is that on other page everything works like a charm. P.s. it's painful not to rant about IE... argh...
internet-explorer
animated-gif
null
null
null
null
open
IE7/IE8 and frozen animated gifs === I'm quite sure this is an old problem. This is how i render my animated gif: <img id='loading' alt='loading' style="display: none; position: relative; left:10px; top:2px;" src="<%= Url.Image("loading.gif") %>" /> This is how I'm desperately trying to show it at the moment: showLoading: function(gifId, butId) { var n = gifId != undefined ? gifId : 'loading'; var l = $('#' + n); //if browser is stupid if ('v' == '\v') { var s = l.attr('src'); var x = document.getElementById(n); x.style.visibility = "visible"; x.style.display = "inline"; setTimeout("document.getElementById('" + n + "').src = '"+s+"';", 100); } else { l.show(); } if (butId != undefined) $('#' + butId).css('cursor', 'default').attr("disabled", true); }, **Problem:** Animated gif appears frozen, there is no animation Strangest thing is that on other page everything works like a charm. P.s. it's painful not to rant about IE... argh...
0
8,811,310
01/10/2012 22:15:16
467,927
10/06/2010 12:21:20
67
3
How to get CVS/* files without checking out the actual files?
My scripts depends on CVS/* files, but does not require actually having all the files. Would it be possible just to get CVS/* files without actually checking out all files from the repository? Checkout of all the files costs a lot of time.
cvs
null
null
null
null
null
open
How to get CVS/* files without checking out the actual files? === My scripts depends on CVS/* files, but does not require actually having all the files. Would it be possible just to get CVS/* files without actually checking out all files from the repository? Checkout of all the files costs a lot of time.
0
7,169,740
08/24/2011 02:15:30
446,929
09/14/2010 02:10:09
727
6
how to add margin for 960gs
default the 960gs only left 5px;each for margin,but i need 20px each side,how could i change this ? also is there some tools for help 960gs,such as ide =================================================================================== bellow words is unhelpful for this question duo to stackoverflow's quality standards, 960gs is real a good helper for back-end devloper do front-end css & layout job, i use rails3 is there some gem could helper for 960gs in ror
ruby-on-rails
compass-css
960.gs
grid-system
null
08/24/2011 11:23:57
not a real question
how to add margin for 960gs === default the 960gs only left 5px;each for margin,but i need 20px each side,how could i change this ? also is there some tools for help 960gs,such as ide =================================================================================== bellow words is unhelpful for this question duo to stackoverflow's quality standards, 960gs is real a good helper for back-end devloper do front-end css & layout job, i use rails3 is there some gem could helper for 960gs in ror
1
5,696,289
04/17/2011 20:40:26
712,498
04/17/2011 20:40:26
1
0
How to define /@-like operator
I would like to define a new operator of the form "x /==> y", where the operator "/==>" is treated as e.g. the "/@" operator of Map, and is translated to MyFunction[x, y]. There is one important aspect: I want the resulting operator to behave in the frontend like any two-bit operator does, that is, the two characters (a Divide and a DoubleLongRightArrow) should be connected together, no syntax coloration should appear, and they are to be selected together when clicked, so precedence must be set. Also, I'd rather avoid using the Notation package. As a result, I'd like to see somehting like this: In[11]:= FullForm[x/\[DoubleLongRightArrow]y] Out[11]//FullForm= MyFunction[x,y] Does anyone have an idea how to achieve this?
operators
mathematica
null
null
null
null
open
How to define /@-like operator === I would like to define a new operator of the form "x /==> y", where the operator "/==>" is treated as e.g. the "/@" operator of Map, and is translated to MyFunction[x, y]. There is one important aspect: I want the resulting operator to behave in the frontend like any two-bit operator does, that is, the two characters (a Divide and a DoubleLongRightArrow) should be connected together, no syntax coloration should appear, and they are to be selected together when clicked, so precedence must be set. Also, I'd rather avoid using the Notation package. As a result, I'd like to see somehting like this: In[11]:= FullForm[x/\[DoubleLongRightArrow]y] Out[11]//FullForm= MyFunction[x,y] Does anyone have an idea how to achieve this?
0
10,350,056
04/27/2012 11:45:47
482
08/06/2008 08:54:09
513
23
How to keep our readers safe and anonymous?
We run a politically sensitive website. Users can submit complaints anonymously. We have done things like - No logging of ip in our app - No access log on apache - No 3rd party javascript - No third party flash embeds I am still not very sure. What else can I do keep my users really safe and anonymous.
security
null
null
null
null
04/27/2012 13:05:29
off topic
How to keep our readers safe and anonymous? === We run a politically sensitive website. Users can submit complaints anonymously. We have done things like - No logging of ip in our app - No access log on apache - No 3rd party javascript - No third party flash embeds I am still not very sure. What else can I do keep my users really safe and anonymous.
2
9,911,719
03/28/2012 16:21:00
710,989
04/16/2011 08:50:08
51
3
comparing custom template tag within if tag
i have a custom template tag that takes some argument and calculates the result. I want to compare that value obtained from that custom tag with another variable. Custom template tag(having three arguments) {% price_for_pax service pax '' %} variable : {{service.price}} What i want is {% if service.price == price_for_pax service pax '' %} do something {% endif %} When i look for the result it does not show anything Can i compare like this ? If not what can be the solution ? Thanks in advance
django-templates
null
null
null
null
null
open
comparing custom template tag within if tag === i have a custom template tag that takes some argument and calculates the result. I want to compare that value obtained from that custom tag with another variable. Custom template tag(having three arguments) {% price_for_pax service pax '' %} variable : {{service.price}} What i want is {% if service.price == price_for_pax service pax '' %} do something {% endif %} When i look for the result it does not show anything Can i compare like this ? If not what can be the solution ? Thanks in advance
0
9,206,007
02/09/2012 05:49:10
1,198,895
02/09/2012 05:40:31
1
0
.net assembly language
how to change assembly language in C# application,there is problem when we are using [assembly:AssemblyCulture("en-US")] ther is error **Error emitting'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty'**
c#
.net
assembly
language
null
null
open
.net assembly language === how to change assembly language in C# application,there is problem when we are using [assembly:AssemblyCulture("en-US")] ther is error **Error emitting'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty'**
0
11,335,995
07/04/2012 22:26:10
1,496,011
07/02/2012 12:04:47
25
0
Which code is more effective? Why?
I'm doing some programming exercises at the end of chapter four in "Introduction to Java Programming: Comprehensive Version" by Y. Daniel Liang. On question 4.18 I came up with two different solutions. Which solution(PatternLoop1 or PatternLoop2) is more effective and why?<br> public class PatternLoop1 { public static void main(String[] args) { for (int counter = 0; counter < 6; ++counter) { for (int counter2 = 0; counter2 <= counter; ++counter2) { System.out.print(counter2 + 1); } System.out.println(); } } } <br> public class PatternLoop2 { public static void main(String[] args) { for (int counter = 1; counter < 7; counter++) { for (int counter2 = 1; counter2 < 7 && counter2 <= counter; counter2++) { System.out.print(counter2); } System.out.println(); } } }
java
code-efficiency
null
null
null
07/07/2012 11:03:59
not constructive
Which code is more effective? Why? === I'm doing some programming exercises at the end of chapter four in "Introduction to Java Programming: Comprehensive Version" by Y. Daniel Liang. On question 4.18 I came up with two different solutions. Which solution(PatternLoop1 or PatternLoop2) is more effective and why?<br> public class PatternLoop1 { public static void main(String[] args) { for (int counter = 0; counter < 6; ++counter) { for (int counter2 = 0; counter2 <= counter; ++counter2) { System.out.print(counter2 + 1); } System.out.println(); } } } <br> public class PatternLoop2 { public static void main(String[] args) { for (int counter = 1; counter < 7; counter++) { for (int counter2 = 1; counter2 < 7 && counter2 <= counter; counter2++) { System.out.print(counter2); } System.out.println(); } } }
4
10,425,521
05/03/2012 05:18:46
1,326,467
04/11/2012 11:47:40
21
0
do sth. before view is loaded in iOS. viewWillLoad?
I want to do sth. before view is loaded. However, according to the design of viewWillUnload and viewDidUnload, I can't find a method like viewWillLoad in UIViewController class. I traced the running, and it seems like the view is put into memory firstly and in no second. grateful if more running system is told. Lost...any suggestion?
iphone
ios
uiviewcontroller
viewdidload
null
05/03/2012 05:20:00
not a real question
do sth. before view is loaded in iOS. viewWillLoad? === I want to do sth. before view is loaded. However, according to the design of viewWillUnload and viewDidUnload, I can't find a method like viewWillLoad in UIViewController class. I traced the running, and it seems like the view is put into memory firstly and in no second. grateful if more running system is told. Lost...any suggestion?
1
8,286,261
11/27/2011 14:31:16
1,065,801
11/25/2011 14:35:10
1
0
Data for NSOutlineView Source List
i've got a Delegate class for a Source List. But i don't know what type the return variable of outlineView:objectValueForTableColumn:byItem: should be. At the Moment my code looks like this, all the structure things work but there is no text shown: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { return @"Some String"; }
objective-c
cocoa
nsoutlineview
null
null
null
open
Data for NSOutlineView Source List === i've got a Delegate class for a Source List. But i don't know what type the return variable of outlineView:objectValueForTableColumn:byItem: should be. At the Moment my code looks like this, all the structure things work but there is no text shown: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { return @"Some String"; }
0
96,051
09/18/2008 19:29:15
17,428
09/18/2008 08:50:27
1
4
Best file comparison tool
I've been using Subversion for a while now. I love it. And the feature I use the most is diff. But sometimes it is really frustrating when your comparison windows is filled with changes like: block inserted here, block deleted here. Just because you moved some methods around in your last refactoring session. All the tools I've see (TortoiseSVN-Compare, KDiff3, Eclipse-Compare, WinMerge) are nice but they aren't as good as I'd like them to be. What I'm missing the most is the ability to **detect block movement**. And it would be nice if the tool could **display multiple revisions** of a file **in a nice side by side view**. Which tool do you use?
file
sourcecode
comparison
null
null
09/11/2011 23:58:17
not constructive
Best file comparison tool === I've been using Subversion for a while now. I love it. And the feature I use the most is diff. But sometimes it is really frustrating when your comparison windows is filled with changes like: block inserted here, block deleted here. Just because you moved some methods around in your last refactoring session. All the tools I've see (TortoiseSVN-Compare, KDiff3, Eclipse-Compare, WinMerge) are nice but they aren't as good as I'd like them to be. What I'm missing the most is the ability to **detect block movement**. And it would be nice if the tool could **display multiple revisions** of a file **in a nice side by side view**. Which tool do you use?
4
6,267,890
06/07/2011 15:44:46
787,797
06/07/2011 15:44:46
1
0
Recursively list files and directories in an FTP Server using Java.
I'm currently using a Java FTP library (ftp4j) to access an FTP server. I want to do a file count and directory count for the server, but this means i would need to list files within directories within directories within directories, etc. How is this achievable? Any hints would be greatly appreciated. Extract from the code; client = new FTPClient(); try { client.connect(""); client.login("", ""); client.changeDirectory("/"); FTPFile[] list = client.list(); int totalDIRS = 0; int totalFILES = 0; for (FTPFile ftpFile : list) { if (ftpFile.getType() == FTPFile.TYPE_DIRECTORY) { totalDIRS++; } } message = "There are currently " + totalDIRS + " directories within the ROOT directory"; client.disconnect(true); } catch (Exception e) { System.out.println(e.toString()); } Thanks, John
java
list
ftp
ftp4j
null
null
open
Recursively list files and directories in an FTP Server using Java. === I'm currently using a Java FTP library (ftp4j) to access an FTP server. I want to do a file count and directory count for the server, but this means i would need to list files within directories within directories within directories, etc. How is this achievable? Any hints would be greatly appreciated. Extract from the code; client = new FTPClient(); try { client.connect(""); client.login("", ""); client.changeDirectory("/"); FTPFile[] list = client.list(); int totalDIRS = 0; int totalFILES = 0; for (FTPFile ftpFile : list) { if (ftpFile.getType() == FTPFile.TYPE_DIRECTORY) { totalDIRS++; } } message = "There are currently " + totalDIRS + " directories within the ROOT directory"; client.disconnect(true); } catch (Exception e) { System.out.println(e.toString()); } Thanks, John
0
11,064,716
06/16/2012 15:22:56
1,442,519
06/07/2012 14:49:57
1
0
Transaction in database
there is 2transaction(t1,t2), the following states, what happend and what should be done? (ِDiagnosis dirty read and ...) R=Read / W=Write / BOT= begin of transaction / C= Commite BOT(t1),R1(x),BOT(T2),R2(x),W1(x),C1,w2(x),C2,R2(x),W2(y) thanks
database
null
null
null
null
06/18/2012 03:56:03
not a real question
Transaction in database === there is 2transaction(t1,t2), the following states, what happend and what should be done? (ِDiagnosis dirty read and ...) R=Read / W=Write / BOT= begin of transaction / C= Commite BOT(t1),R1(x),BOT(T2),R2(x),W1(x),C1,w2(x),C2,R2(x),W2(y) thanks
1
6,787,017
07/22/2011 07:39:44
833,503
07/07/2011 12:29:09
1
0
Optimal solution for WCF
I have to fire service method multiple times. What would be the optimal solution? foreach(var _param in _paramList) { ServiceReference1.ServiceClient _sc = new ServiceReference1.ServiceClient(); _sc.Method(_param); } or ServiceReference1.ServiceClient _sc = new ServiceReference1.ServiceClient(); foreach(var _param in _paramList) { _sc.Method(_param); } maybe something else?
c#
wcf
optimization
null
null
07/23/2011 01:24:57
not a real question
Optimal solution for WCF === I have to fire service method multiple times. What would be the optimal solution? foreach(var _param in _paramList) { ServiceReference1.ServiceClient _sc = new ServiceReference1.ServiceClient(); _sc.Method(_param); } or ServiceReference1.ServiceClient _sc = new ServiceReference1.ServiceClient(); foreach(var _param in _paramList) { _sc.Method(_param); } maybe something else?
1
8,674,283
12/29/2011 22:34:42
126,353
06/21/2009 00:34:56
5,128
134
Suggestions For a Javascript Developer That Is Moving To C#
I've been using Javascript to build mobile applications during the last year and now that I got a HTC HD7S I'm moving to C# and then I want some suggestions to make the move. *PS: I've already used C# 2 years ago to build some simple Windows Mobile apps so I know a bit of the basics and syntax*
c#
javascript
windows-phone-7
mobile
null
12/29/2011 22:40:37
not a real question
Suggestions For a Javascript Developer That Is Moving To C# === I've been using Javascript to build mobile applications during the last year and now that I got a HTC HD7S I'm moving to C# and then I want some suggestions to make the move. *PS: I've already used C# 2 years ago to build some simple Windows Mobile apps so I know a bit of the basics and syntax*
1
2,124,400
01/23/2010 19:27:54
250,371
01/14/2010 01:26:25
43
5
How to create index for dynamic search strings
I have a little DB, for academic purpose only, and I have object tables at most. I've created a entity-relationship model (ERM) in Power Designer and the program, by default, creates index for the serial id's for each table. 1-I want to know how do I use a index like that on a query.Say I would want to find a product by it's id, but using it's index. 2- Is it possible to do `select value(s) from supplierf where s.name LIKE '%search%' order by s.name` using a index to do a search like that? I know it's possible to create index for the name, but for a search like that I don't know how things work. Let me say, that I do know that Oracle decides when oe if it's worth using index in a query, but I may have to give, at least, a try on using indexs in my BD project
plsql
pl
oracle
index
indexing
null
open
How to create index for dynamic search strings === I have a little DB, for academic purpose only, and I have object tables at most. I've created a entity-relationship model (ERM) in Power Designer and the program, by default, creates index for the serial id's for each table. 1-I want to know how do I use a index like that on a query.Say I would want to find a product by it's id, but using it's index. 2- Is it possible to do `select value(s) from supplierf where s.name LIKE '%search%' order by s.name` using a index to do a search like that? I know it's possible to create index for the name, but for a search like that I don't know how things work. Let me say, that I do know that Oracle decides when oe if it's worth using index in a query, but I may have to give, at least, a try on using indexs in my BD project
0
8,318,081
11/29/2011 21:37:22
355,039
06/01/2010 03:38:36
992
58
Animation in framgent won't restart after rotation
I have an animation which starts correctly the first time the fragment is displayed. However after an orientation change, it won't restart. The animation is an animation-list resource set as the background of an ImageView. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View root = inflater.inflate(R.layout.fragment_lead_manual, container, false); final ImageView badgeEntryView = (ImageView) root .findViewById(R.id.manual_image); mAnimation = (AnimationDrawable) badgeEntryView.getBackground(); return root; } @Override public void onResume() { super.onResume(); mAnimation.start(); } @Override public void onPause() { super.onPause(); mAnimation.stop(); }
android
animation
rotation
android-animation
null
null
open
Animation in framgent won't restart after rotation === I have an animation which starts correctly the first time the fragment is displayed. However after an orientation change, it won't restart. The animation is an animation-list resource set as the background of an ImageView. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View root = inflater.inflate(R.layout.fragment_lead_manual, container, false); final ImageView badgeEntryView = (ImageView) root .findViewById(R.id.manual_image); mAnimation = (AnimationDrawable) badgeEntryView.getBackground(); return root; } @Override public void onResume() { super.onResume(); mAnimation.start(); } @Override public void onPause() { super.onPause(); mAnimation.stop(); }
0
6,166,384
05/29/2011 07:07:41
181,509
09/30/2009 00:37:48
148
3
Clutter Toolkit Dependencies - Ubuntu 11.04
Is there an obvious way to get Clutter Toolkit up and running in Ubuntu. It seems like there is a huge list of dependencies as I try compiling it. I think the ubuntu package has a very old version (something like 0.25?) while the current version is 1.6.14. The current dependency which I am unable to resolve is "cogl-pango-1.0". Any suggestions on getting up a running with Clutter, for development?
c
opengl
ubuntu
pango
clutter
null
open
Clutter Toolkit Dependencies - Ubuntu 11.04 === Is there an obvious way to get Clutter Toolkit up and running in Ubuntu. It seems like there is a huge list of dependencies as I try compiling it. I think the ubuntu package has a very old version (something like 0.25?) while the current version is 1.6.14. The current dependency which I am unable to resolve is "cogl-pango-1.0". Any suggestions on getting up a running with Clutter, for development?
0
8,955,202
01/21/2012 17:52:05
804,365
06/18/2011 08:44:17
19
0
DataViewGrid - selected rows (unbound)
I can get the collection of selected rows but I cannot find a way to determine which is the first selected row. E.g. the table has 20 rows, the user selects rows 3,4,5,6 using the mouse on the rowheaders. How can I determine that the selection starts at row 3?
vb.net
null
null
null
null
null
open
DataViewGrid - selected rows (unbound) === I can get the collection of selected rows but I cannot find a way to determine which is the first selected row. E.g. the table has 20 rows, the user selects rows 3,4,5,6 using the mouse on the rowheaders. How can I determine that the selection starts at row 3?
0
7,385,914
09/12/2011 09:42:10
386,991
12/13/2009 14:10:54
11
2
Java - Read XML and leave all entities alone
I want to read XHTML files using SAX or StAX, whatever works best. But I don't want entities to be resolved, replaced or anything like that. Ideally they should just remain as they are. I don't want to use DTDs. Here's an (executable, using Scala 2.8.x) example: import javax.xml.stream._ import javax.xml.stream.events._ import java.io._ println("StAX Test - "+args(0)+"\n") val factory = XMLInputFactory.newInstance factory.setProperty(XMLInputFactory.SUPPORT_DTD, false) factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false) println("------") val xer = factory.createXMLEventReader(new FileReader(args(0))) val entities = new collection.mutable.ArrayBuffer[String] while (xer.hasNext) { val event = xer.nextEvent if (event.isCharacters) { print(event.asCharacters.getData) } else if (event.getEventType == XMLStreamConstants.ENTITY_REFERENCE) { entities += event.asInstanceOf[EntityReference].getName } } println("------") println("Entities: " + entities.mkString(", ")) Given the following xhtml file ... <html> <head> <title>StAX Test</title> </head> <body> <h1>Hallo StAX</h1> <p id="html"> &lt;div class=&quot;header&quot;&gt; </p> <p id="stuff"> &Uuml;berdies sollte das hier auch als Copyright sichtbar sein: &#169; </p> Das war's! </body> </html> ... running `scala stax-test.scala stax-test.xhtml` will result in: StAX Test - stax-test.xhtml ------ StAX Test Hallo StAX <div class="header"> berdies sollte das hier auch als Copyright sichtbar sein: ? Das war's! ------ Entities: Uuml So all entities have been replaced more or less sucessfully. What I would have expected and what I want is this, though: StAX Test - stax-test.xhtml ------ StAX Test Hallo StAX &lt;div class=&quot;header&quot;&gt; &Uuml;berdies sollte das hier auch als Copyright sichtbar sein: &#169; Das war's! ------ Entities: // well, or no entities above and instead: // Entities: lt, quot, quot, gt, Uuml, #169 Is this even possible? I want to parse XHTML, do some modifications and then output it like that as XHTML again. So I really want the entities to remain in the result. Also I don't get why Uuml is reported as an EntityReference event while the rest aren't.
java
xml
sax
entities
stax
null
open
Java - Read XML and leave all entities alone === I want to read XHTML files using SAX or StAX, whatever works best. But I don't want entities to be resolved, replaced or anything like that. Ideally they should just remain as they are. I don't want to use DTDs. Here's an (executable, using Scala 2.8.x) example: import javax.xml.stream._ import javax.xml.stream.events._ import java.io._ println("StAX Test - "+args(0)+"\n") val factory = XMLInputFactory.newInstance factory.setProperty(XMLInputFactory.SUPPORT_DTD, false) factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false) println("------") val xer = factory.createXMLEventReader(new FileReader(args(0))) val entities = new collection.mutable.ArrayBuffer[String] while (xer.hasNext) { val event = xer.nextEvent if (event.isCharacters) { print(event.asCharacters.getData) } else if (event.getEventType == XMLStreamConstants.ENTITY_REFERENCE) { entities += event.asInstanceOf[EntityReference].getName } } println("------") println("Entities: " + entities.mkString(", ")) Given the following xhtml file ... <html> <head> <title>StAX Test</title> </head> <body> <h1>Hallo StAX</h1> <p id="html"> &lt;div class=&quot;header&quot;&gt; </p> <p id="stuff"> &Uuml;berdies sollte das hier auch als Copyright sichtbar sein: &#169; </p> Das war's! </body> </html> ... running `scala stax-test.scala stax-test.xhtml` will result in: StAX Test - stax-test.xhtml ------ StAX Test Hallo StAX <div class="header"> berdies sollte das hier auch als Copyright sichtbar sein: ? Das war's! ------ Entities: Uuml So all entities have been replaced more or less sucessfully. What I would have expected and what I want is this, though: StAX Test - stax-test.xhtml ------ StAX Test Hallo StAX &lt;div class=&quot;header&quot;&gt; &Uuml;berdies sollte das hier auch als Copyright sichtbar sein: &#169; Das war's! ------ Entities: // well, or no entities above and instead: // Entities: lt, quot, quot, gt, Uuml, #169 Is this even possible? I want to parse XHTML, do some modifications and then output it like that as XHTML again. So I really want the entities to remain in the result. Also I don't get why Uuml is reported as an EntityReference event while the rest aren't.
0
6,600,666
07/06/2011 17:40:14
449,310
09/16/2010 09:30:37
200
23
Flash Video player subtitles
Hello I want to insert subtitles in youtube flash movies. As I can see, there is a site that can do this. http://www.overstream.net/ is the site and I am wondering how I can do this? If I make a flash player ang give it the url of a youtube video, it can play it? How can I do this? Thank you!
flash
flash-player
subtitle
null
null
07/07/2011 14:33:03
not constructive
Flash Video player subtitles === Hello I want to insert subtitles in youtube flash movies. As I can see, there is a site that can do this. http://www.overstream.net/ is the site and I am wondering how I can do this? If I make a flash player ang give it the url of a youtube video, it can play it? How can I do this? Thank you!
4
5,918,053
05/06/2011 23:32:50
712,213
04/17/2011 14:46:11
1
0
How do I make a Android Service where I can pass information to it when it starts?
I wanna start an android service but I need to pass some info to it before it starts how can I do this?
android
null
null
null
null
null
open
How do I make a Android Service where I can pass information to it when it starts? === I wanna start an android service but I need to pass some info to it before it starts how can I do this?
0
11,574,505
07/20/2012 07:08:02
492,372
10/30/2010 20:02:03
544
6
Telecom churn dataset
I am looking for a free/paid data set for predicting telecom churn. Is there a training and test data set that is available somewhere?
algorithm
dataset
machine-learning
churn
null
07/20/2012 14:58:06
off topic
Telecom churn dataset === I am looking for a free/paid data set for predicting telecom churn. Is there a training and test data set that is available somewhere?
2
9,832,918
03/23/2012 01:16:35
1,276,061
03/17/2012 17:53:43
1
0
how to get background color of button on android?
I want to get color of button.. I couldnt get color from getbackground function which returns drawable. I used getsolidcolor which returns integer value but its being 0 (zero) all time.. I dont understand where is problem. maybe its not true function.. here is my android code int renk = btn1.getSolidColor(); if(renk== Color.GREEN) Toast.makeText(getApplicationContext(), "green" , 1000).show(); else if(renk== Color.RED) Toast.makeText(getApplicationContext(), "red" , 1000).show(); else if(renk== Color.YELLOW) Toast.makeText(getApplicationContext(), "yellow" , 1000).show(); else Toast.makeText(getApplicationContext(), "unknown", 1000).show(); btn1.setBackgroundColor(Color.YELLOW); renk = btn1.getSolidColor(); if(renk== Color.GREEN) Toast.makeText(getApplicationContext(), "green" , 1000).show(); else if(renk== Color.RED) Toast.makeText(getApplicationContext(), "red" , 1000).show(); else if(renk== Color.YELLOW) Toast.makeText(getApplicationContext(), "yellow" , 1000).show(); else Toast.makeText(getApplicationContext(), "unknown", 1000).show(); I just get unknown toast message even I set background as yellow..
android
background-color
null
null
null
null
open
how to get background color of button on android? === I want to get color of button.. I couldnt get color from getbackground function which returns drawable. I used getsolidcolor which returns integer value but its being 0 (zero) all time.. I dont understand where is problem. maybe its not true function.. here is my android code int renk = btn1.getSolidColor(); if(renk== Color.GREEN) Toast.makeText(getApplicationContext(), "green" , 1000).show(); else if(renk== Color.RED) Toast.makeText(getApplicationContext(), "red" , 1000).show(); else if(renk== Color.YELLOW) Toast.makeText(getApplicationContext(), "yellow" , 1000).show(); else Toast.makeText(getApplicationContext(), "unknown", 1000).show(); btn1.setBackgroundColor(Color.YELLOW); renk = btn1.getSolidColor(); if(renk== Color.GREEN) Toast.makeText(getApplicationContext(), "green" , 1000).show(); else if(renk== Color.RED) Toast.makeText(getApplicationContext(), "red" , 1000).show(); else if(renk== Color.YELLOW) Toast.makeText(getApplicationContext(), "yellow" , 1000).show(); else Toast.makeText(getApplicationContext(), "unknown", 1000).show(); I just get unknown toast message even I set background as yellow..
0
5,666,805
04/14/2011 16:59:14
708,385
04/14/2011 16:53:03
1
0
is ZEND FRAMEWORK a good ideia do create an Social Networking website?
I'm asking because some people say that Zend Framework is not very effective when it comes to speed. Today I know the following frameworks: SpaghettiFramework, CodeIgniter, CakePHP and Zend, What is the best choice for creating a social network? Thanks.
php
zend-framework
cakephp
codeigniter
social-networking
04/14/2011 17:08:38
not constructive
is ZEND FRAMEWORK a good ideia do create an Social Networking website? === I'm asking because some people say that Zend Framework is not very effective when it comes to speed. Today I know the following frameworks: SpaghettiFramework, CodeIgniter, CakePHP and Zend, What is the best choice for creating a social network? Thanks.
4
2,236,772
02/10/2010 12:38:49
131,809
07/01/2009 16:03:48
455
19
Quartz.net and Common.Logging - Using Log4Net
I'm using Quartz.net within a windows service. Currently, the trigger is not firing - I'd like to use the logging to find out why. I have edited my config file for thie windows service: <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /> </sectionGroup> </configSections> <appSettings> <!--specific win service settings here--> </appSettings> <common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"> <arg key="configType" value="INLINE"/> <arg key="configFile" value="c:\sched.log"/> <arg key="level" value="INFO" /> </factoryAdapter> </logging> </common> <log4net> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <root> <level value="INFO" /> <appender-ref ref="EventLogAppender" /> </root> </log4net> My file structure is as follows: **C:\CompanyName** - root dir for all projects **C:\CompanyName\build\bin** - Output directory for all projects / class libraries in my solution **C:\CompanyName\lib** - Where 3rd party binaries / dlls are put In my Windows Service project, I have a reference to Quartz (in the C:\CompanyName\lib folder) I have also added a reference to Common.Logging.Log4net.dll When i test my app, i get the following error: > Could not load file or assembly > 'Common.Logging, Version=2.0.0.0, > Culture=neutral, > PublicKeyToken=af08829b84f0328e' or > one of its dependencies. The located > assembly's manifest definition does > not match the assembly reference. > (Exception from HRESULT: > 0x80131040)":"Common.Logging, > Version=2.0.0.0, Culture=neutral, > PublicKeyToken=af08829b84f0328e
c#
quartz.net
quartz-scheduler
log4net
logging
null
open
Quartz.net and Common.Logging - Using Log4Net === I'm using Quartz.net within a windows service. Currently, the trigger is not firing - I'd like to use the logging to find out why. I have edited my config file for thie windows service: <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /> </sectionGroup> </configSections> <appSettings> <!--specific win service settings here--> </appSettings> <common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"> <arg key="configType" value="INLINE"/> <arg key="configFile" value="c:\sched.log"/> <arg key="level" value="INFO" /> </factoryAdapter> </logging> </common> <log4net> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %l - %m%n" /> </layout> </appender> <root> <level value="INFO" /> <appender-ref ref="EventLogAppender" /> </root> </log4net> My file structure is as follows: **C:\CompanyName** - root dir for all projects **C:\CompanyName\build\bin** - Output directory for all projects / class libraries in my solution **C:\CompanyName\lib** - Where 3rd party binaries / dlls are put In my Windows Service project, I have a reference to Quartz (in the C:\CompanyName\lib folder) I have also added a reference to Common.Logging.Log4net.dll When i test my app, i get the following error: > Could not load file or assembly > 'Common.Logging, Version=2.0.0.0, > Culture=neutral, > PublicKeyToken=af08829b84f0328e' or > one of its dependencies. The located > assembly's manifest definition does > not match the assembly reference. > (Exception from HRESULT: > 0x80131040)":"Common.Logging, > Version=2.0.0.0, Culture=neutral, > PublicKeyToken=af08829b84f0328e
0
8,905,933
01/18/2012 06:11:22
983,767
10/07/2011 10:03:20
14
2
XML to XML transformation
I have a requirement that I have one input XML and one XSD. I need to transform from input xml format to another xml format based on the XSD. Please help me how can I do this. I am new for xml transformations.
xml
xsd
null
null
null
01/21/2012 13:59:47
not a real question
XML to XML transformation === I have a requirement that I have one input XML and one XSD. I need to transform from input xml format to another xml format based on the XSD. Please help me how can I do this. I am new for xml transformations.
1
3,509,001
08/18/2010 04:37:59
423,587
08/18/2010 04:37:59
1
0
Good books for Support department management
We have a small support department that has recently started using MS Dynamics CRM. As a developer, I occasional check active cases to see what problems are occurring in our software so it may be addressed. However, I usually find the cases emails, notes, questions asked, resolutions etc are not to my satisfaction. Does anyone have any good book references I can pass to the support manager to help him improve the department, his skills in management and how to better utilise CRM? Cheers
management
dynamics-crm
null
null
null
09/30/2011 08:41:29
not constructive
Good books for Support department management === We have a small support department that has recently started using MS Dynamics CRM. As a developer, I occasional check active cases to see what problems are occurring in our software so it may be addressed. However, I usually find the cases emails, notes, questions asked, resolutions etc are not to my satisfaction. Does anyone have any good book references I can pass to the support manager to help him improve the department, his skills in management and how to better utilise CRM? Cheers
4
11,266,323
06/29/2012 17:29:04
979,419
10/04/2011 22:29:47
8
0
Assistance in Implementing a Voting System on an Obtvse-powered Website
my personal blog/website (ChandlerCollins.com) runs on the Obtvse platform. In case you don't know, Obtvse is the open source variant of Dustin Curtis' blogging platform <a href = "https://svbtle.com/">Svbtle</a>. Obtvse is a simple markdown-powered Ruby on Rails blog platform. The code for Obtvse is found <a href="https://github.com/NateW/obtvse/">here</a>. What I want to do is add a Reddit style upvote/downvote button implemented in Ruby to Obtvse in the same position as the Kudos button found on any website in the Svbtle platform. (Example of the Kudos button <a href="http://bearsfightingbears.com/">here</a>) And then I want to add a button that will show all of my posts in sorted order depending on how many up votes or down votes they have. If anyone can share the code or where I can find the code for implementing an upvote/downvote button or if anyone has had any experience in modifying the Obtvse code for their website, please let share how you accomplished that or share the URL in which I can find it. Thanks, Chandler C.
ruby-on-rails
open-source
github
reddit
vote-up-buttons
06/30/2012 23:35:47
not a real question
Assistance in Implementing a Voting System on an Obtvse-powered Website === my personal blog/website (ChandlerCollins.com) runs on the Obtvse platform. In case you don't know, Obtvse is the open source variant of Dustin Curtis' blogging platform <a href = "https://svbtle.com/">Svbtle</a>. Obtvse is a simple markdown-powered Ruby on Rails blog platform. The code for Obtvse is found <a href="https://github.com/NateW/obtvse/">here</a>. What I want to do is add a Reddit style upvote/downvote button implemented in Ruby to Obtvse in the same position as the Kudos button found on any website in the Svbtle platform. (Example of the Kudos button <a href="http://bearsfightingbears.com/">here</a>) And then I want to add a button that will show all of my posts in sorted order depending on how many up votes or down votes they have. If anyone can share the code or where I can find the code for implementing an upvote/downvote button or if anyone has had any experience in modifying the Obtvse code for their website, please let share how you accomplished that or share the URL in which I can find it. Thanks, Chandler C.
1
5,828,322
04/29/2011 05:41:30
730,513
04/29/2011 05:41:30
1
0
Global Variables used across files in PHP
HI all, I have come across a situation where i need to use a queue and that should be accessible in all the pages . I tried it using Global variables but couldn't meet the requirement.
php
null
null
null
null
04/30/2011 05:39:17
not a real question
Global Variables used across files in PHP === HI all, I have come across a situation where i need to use a queue and that should be accessible in all the pages . I tried it using Global variables but couldn't meet the requirement.
1
10,964,254
06/09/2012 20:12:02
997,705
10/16/2011 10:15:57
29
0
Android Google Maps directions and road path inside app
I'm searching for a few hours right now, and i can't seem to reach any solution. I am developing an app that displays some reference points in a map. I want to draw the road path between these points, and show the respective directions inside my app. I don't want to launch google maps app to show those informations there. Is this possible? If yes, can you point some tutorials? Thks in advance.
android
google-maps
null
null
null
null
open
Android Google Maps directions and road path inside app === I'm searching for a few hours right now, and i can't seem to reach any solution. I am developing an app that displays some reference points in a map. I want to draw the road path between these points, and show the respective directions inside my app. I don't want to launch google maps app to show those informations there. Is this possible? If yes, can you point some tutorials? Thks in advance.
0
7,734,758
10/12/2011 02:56:36
990,640
10/12/2011 02:45:19
1
0
Paypal Payflow error code 12 even thought the CC is valid
Hello Stackoverflowers, I am having a problem with a persistent error being returned while processing payments through my Virtuemart store, which is utilising Paypal Payflow Pro as the payment processor. Although it was working up until recently, it now appears that payments from any credit card (bar 1, I'll get to that later) are declined with the reason that the CC details are incorrect. This is not true, I have used the cards I attempted to process the transactions with multiple times online with no issues, and since this issue only started recently I'm sure that the error is being returned for another reason. The entities being used for this transaction are: Joomla 1.5.15, Virtuemart 1.1.4, Paypal Payflow Pro, Wells Fargo Bank (as the payment partner) Transactions submitted in test mode using Paypal's testing CC numbers are processing fine, with all transaction records being shown up and no errors returning FYI, which is why I'm assuming that Wells Fargo's payment processing may be where the buck stops, however, I'm not sure, so any insight onto this problem would be much appreciated. Summary: Why is error 12 (invalid card details) returning when the card details are correct? Who is to blame for this error showing up? What needs to be done to rectify the situation? Thank you for reading this massive block of text, I really do appreciate it. Many thanks, Das
error-message
paypal
credit-card
payflowpro
null
10/15/2011 05:00:16
off topic
Paypal Payflow error code 12 even thought the CC is valid === Hello Stackoverflowers, I am having a problem with a persistent error being returned while processing payments through my Virtuemart store, which is utilising Paypal Payflow Pro as the payment processor. Although it was working up until recently, it now appears that payments from any credit card (bar 1, I'll get to that later) are declined with the reason that the CC details are incorrect. This is not true, I have used the cards I attempted to process the transactions with multiple times online with no issues, and since this issue only started recently I'm sure that the error is being returned for another reason. The entities being used for this transaction are: Joomla 1.5.15, Virtuemart 1.1.4, Paypal Payflow Pro, Wells Fargo Bank (as the payment partner) Transactions submitted in test mode using Paypal's testing CC numbers are processing fine, with all transaction records being shown up and no errors returning FYI, which is why I'm assuming that Wells Fargo's payment processing may be where the buck stops, however, I'm not sure, so any insight onto this problem would be much appreciated. Summary: Why is error 12 (invalid card details) returning when the card details are correct? Who is to blame for this error showing up? What needs to be done to rectify the situation? Thank you for reading this massive block of text, I really do appreciate it. Many thanks, Das
2
8,156,830
11/16/2011 18:36:07
1,034,022
11/07/2011 15:36:25
10
0
Get timezone by state/province and country?
Does anyone know how to get the timezone based on a users state/province and country selection?
c#
timezone
region
null
null
11/16/2011 18:50:42
not a real question
Get timezone by state/province and country? === Does anyone know how to get the timezone based on a users state/province and country selection?
1
10,733,036
05/24/2012 07:29:59
566,360
01/07/2011 03:12:01
438
13
Run mypdf lib on ios
I'm looking for a lib for pdf parsing written in c. My app is cross-platform. I found mupdf: > http://code.google.com/p/mupdf/downloads/list In the package mupdf-1.0-source.tar.gz, there's a iOS app. But I tried to run with no luck. How can I run it? Thank you
ios
c
pdf
native
pdf-parsing
06/08/2012 17:48:23
not a real question
Run mypdf lib on ios === I'm looking for a lib for pdf parsing written in c. My app is cross-platform. I found mupdf: > http://code.google.com/p/mupdf/downloads/list In the package mupdf-1.0-source.tar.gz, there's a iOS app. But I tried to run with no luck. How can I run it? Thank you
1
7,102,891
08/18/2011 05:40:27
898,245
08/17/2011 08:37:10
6
0
How to find the base and amino acdis of DNA the list position of DNA sequence
I have the sequence DNA and I want to find nucleotide and amino acids of the sequence at list position . Below is the example: open the sequence DNA: ACTAAAAATACAAAAATTAGCCAGGCGTGGTGGCAC (the length of sequence is 33) Open the list position: (1,3,5,7,9,12) I hope the result will print with file.txt and the result. list , nucleotide, amino acied 1 ACT T 2 AAA K I have no problem finding the amino acid of the position. But I don't know how to print in the same file and it is very long. Below is the current code I have. #! /bin/perl print "ENTER THE FILENAME OF THE DNA SEQUENCE:= "; $DNAfilename = <STDIN>; chomp $DNAfilename; unless ( open(DNAFILE, $DNAfilename) ) { print "Cannot open file \"$DNAfilename\"\n\n"; } @DNA = <DNAFILE>; close DNAFILE; $DNA = join( '', @DNA); $DNA =~ s/\s//g; print "ENTER THE LIST POSITION OF DNA SEQUENCE:= "; $po=<STDIN>; chomp $po; unless ( open(positionFILE, $po) ) { print "Cannot open file \"$po\"\n\n"; } @po = <positionFILE>; close positionFILE; $po = join( '', @po); $po =~ s/\s//g; $num=@po; open(BASE,">baselist.txt"); for ($i = 0; $i < $num; $i++){ $base=substr($DNA, $po[$i]-1, 3); print $base; print BASE $base."\n\n"; } close(BASE); print "ENTER THE BASE UNDER LIST POSITION OF THE DNA SEQUENCE:= "; $ba=<STDIN>; chomp $ba; unless ( open(baseFILE, $ba) ) { print "Cannot open file \"$ba\"\n\n"; } @ba = <baseFILE>; close baseFILE; $ba = join( '', @ba); $ba =~ s/\s//g; $protein=''; $codon; open(protein,">proteinlist.txt"); for(my $i=0;$i<(length($ba));$i+=3) { $codon=substr($ba,$i,3); $protein.=&codon2aa($codon); } print $protein; print BASE $protein."\n"; close(protein); sub codon2aa{ my($codon)=@_; $codon=uc $codon; my(%g)= ('TCA'=>'S','TCC'=>'S','TCG'=>'S','TCT'=>'S','TTC'=>'F','TTT'=>'F','TTA'=>'L','TTG'=>'L','TAC'=>'Y','TAT'=>'Y','TAA'=>'_','TAG'=>'_','TGC'=>'C','TGT'=>'C','TGA'=>'_','TGG'=>'W','CTA'=>'L','CTC'=>'L','CTG'=>'L','CTT'=>'L','CCA'=>'P','CCC'=>'P','CCG'=>'P','CCT'=>'P','CAC'=>'H','CAT'=>'H','CAA'=>'Q','CAG'=>'Q','CGA'=>'R','CGC'=>'R','CGG'=>'R','CGT'=>'R','ATA'=>'I','ATC'=>'I','ATT'=>'I','ATG'=>'M','ACA'=>'T','ACC'=>'T','ACG'=>'T','ACT'=>'T','AAC'=>'N','AAT'=>'N','AAA'=>'K','AAG'=>'K','AGC'=>'S','AGT'=>'S','AGA'=>'R','AGG'=>'R','GTA'=>'V','GTC'=>'V','GTG'=>'V','GTT'=>'V','GCA'=>'A','GCC'=>'A','GCG'=>'A','GCT'=>'A','GAC'=>'D','GAT'=>'D','GAA'=>'E','GAG'=>'E','GGA'=>'G','GGC'=>'G','GGG'=>'G','GGT'=>'G'); if(exists $g{$codon}) { return $g{$codon}; } else { print STDERR "Bad codon \"$codon\"!!\n"; exit; } } Please advice how can I make the result on the same file.
perl
perl-module
bioinformatics
null
null
08/24/2011 06:53:12
not constructive
How to find the base and amino acdis of DNA the list position of DNA sequence === I have the sequence DNA and I want to find nucleotide and amino acids of the sequence at list position . Below is the example: open the sequence DNA: ACTAAAAATACAAAAATTAGCCAGGCGTGGTGGCAC (the length of sequence is 33) Open the list position: (1,3,5,7,9,12) I hope the result will print with file.txt and the result. list , nucleotide, amino acied 1 ACT T 2 AAA K I have no problem finding the amino acid of the position. But I don't know how to print in the same file and it is very long. Below is the current code I have. #! /bin/perl print "ENTER THE FILENAME OF THE DNA SEQUENCE:= "; $DNAfilename = <STDIN>; chomp $DNAfilename; unless ( open(DNAFILE, $DNAfilename) ) { print "Cannot open file \"$DNAfilename\"\n\n"; } @DNA = <DNAFILE>; close DNAFILE; $DNA = join( '', @DNA); $DNA =~ s/\s//g; print "ENTER THE LIST POSITION OF DNA SEQUENCE:= "; $po=<STDIN>; chomp $po; unless ( open(positionFILE, $po) ) { print "Cannot open file \"$po\"\n\n"; } @po = <positionFILE>; close positionFILE; $po = join( '', @po); $po =~ s/\s//g; $num=@po; open(BASE,">baselist.txt"); for ($i = 0; $i < $num; $i++){ $base=substr($DNA, $po[$i]-1, 3); print $base; print BASE $base."\n\n"; } close(BASE); print "ENTER THE BASE UNDER LIST POSITION OF THE DNA SEQUENCE:= "; $ba=<STDIN>; chomp $ba; unless ( open(baseFILE, $ba) ) { print "Cannot open file \"$ba\"\n\n"; } @ba = <baseFILE>; close baseFILE; $ba = join( '', @ba); $ba =~ s/\s//g; $protein=''; $codon; open(protein,">proteinlist.txt"); for(my $i=0;$i<(length($ba));$i+=3) { $codon=substr($ba,$i,3); $protein.=&codon2aa($codon); } print $protein; print BASE $protein."\n"; close(protein); sub codon2aa{ my($codon)=@_; $codon=uc $codon; my(%g)= ('TCA'=>'S','TCC'=>'S','TCG'=>'S','TCT'=>'S','TTC'=>'F','TTT'=>'F','TTA'=>'L','TTG'=>'L','TAC'=>'Y','TAT'=>'Y','TAA'=>'_','TAG'=>'_','TGC'=>'C','TGT'=>'C','TGA'=>'_','TGG'=>'W','CTA'=>'L','CTC'=>'L','CTG'=>'L','CTT'=>'L','CCA'=>'P','CCC'=>'P','CCG'=>'P','CCT'=>'P','CAC'=>'H','CAT'=>'H','CAA'=>'Q','CAG'=>'Q','CGA'=>'R','CGC'=>'R','CGG'=>'R','CGT'=>'R','ATA'=>'I','ATC'=>'I','ATT'=>'I','ATG'=>'M','ACA'=>'T','ACC'=>'T','ACG'=>'T','ACT'=>'T','AAC'=>'N','AAT'=>'N','AAA'=>'K','AAG'=>'K','AGC'=>'S','AGT'=>'S','AGA'=>'R','AGG'=>'R','GTA'=>'V','GTC'=>'V','GTG'=>'V','GTT'=>'V','GCA'=>'A','GCC'=>'A','GCG'=>'A','GCT'=>'A','GAC'=>'D','GAT'=>'D','GAA'=>'E','GAG'=>'E','GGA'=>'G','GGC'=>'G','GGG'=>'G','GGT'=>'G'); if(exists $g{$codon}) { return $g{$codon}; } else { print STDERR "Bad codon \"$codon\"!!\n"; exit; } } Please advice how can I make the result on the same file.
4
6,202,549
06/01/2011 14:09:45
779,420
06/01/2011 12:58:07
1
0
Spliting strings by capltal letters regex python
Im trying to split strings into lists of "tags" in python, and im trying to get it to handle things like "HappyBirthday". and i want it to remove most punctuation but ignore hyphens, and apostrophis, so i have this tags = re.findall("([A-Z]{2,}(?=[A-Z]|$)|[A-Z][a-z]*)|\w+-\w+|[\w']+" and i would want to turn this: Jeff's dog is un-American SomeTimes! BUT NOTAlways into this ['Jeff's', 'dog', 'is', 'un-American', 'Some', 'Times', 'BUT', 'NOT', 'Always'] P.S. i'm sorry my word description isn't very good, i'm not sure how to explain it, and have been mostly unsuccessful with goggle, i hope the example illustrates it properly.
python
regex
string
tags
null
null
open
Spliting strings by capltal letters regex python === Im trying to split strings into lists of "tags" in python, and im trying to get it to handle things like "HappyBirthday". and i want it to remove most punctuation but ignore hyphens, and apostrophis, so i have this tags = re.findall("([A-Z]{2,}(?=[A-Z]|$)|[A-Z][a-z]*)|\w+-\w+|[\w']+" and i would want to turn this: Jeff's dog is un-American SomeTimes! BUT NOTAlways into this ['Jeff's', 'dog', 'is', 'un-American', 'Some', 'Times', 'BUT', 'NOT', 'Always'] P.S. i'm sorry my word description isn't very good, i'm not sure how to explain it, and have been mostly unsuccessful with goggle, i hope the example illustrates it properly.
0
7,104,820
08/18/2011 08:58:47
146,603
07/28/2009 18:33:58
1,552
45
Tutorial teaching Ruby syntax/knowledge required to easily learn rails
I am trying to learn ROR these days and have basic knowledge of ruby, but often working with rails, I get to the point where it seems as if I don't know a bit about ruby. Just to explain the point, in rails we use `has_many` keyword. I did not learn any such thing when I was going through ruby tutorials but just came to know that it has something to do with meta-programming in ruby (I have no idea what is meta programming). So I would like to know if there is any book/tutorial which explain all the points/syntax/concepts of ruby, which a newbie would see while programming in rails. Thanks.
ruby-on-rails
ruby
syntax
concepts
null
null
open
Tutorial teaching Ruby syntax/knowledge required to easily learn rails === I am trying to learn ROR these days and have basic knowledge of ruby, but often working with rails, I get to the point where it seems as if I don't know a bit about ruby. Just to explain the point, in rails we use `has_many` keyword. I did not learn any such thing when I was going through ruby tutorials but just came to know that it has something to do with meta-programming in ruby (I have no idea what is meta programming). So I would like to know if there is any book/tutorial which explain all the points/syntax/concepts of ruby, which a newbie would see while programming in rails. Thanks.
0
6,567,923
07/04/2011 06:15:18
827,597
07/04/2011 06:15:18
1
0
Timesone conversion
I need to convert from one timezone to another timezone in my project. I am able to convert from my current timezone to another but not from one timezone to another. For example I am in India I am able to convert from India to US using Data d=new Date() and assigning it to a calendar object and setting the time zone. but not from differnt timezone to another timezone. Like being in India converting from US to UK. Can anyone please help me with some code ?
java
null
null
null
null
null
open
Timesone conversion === I need to convert from one timezone to another timezone in my project. I am able to convert from my current timezone to another but not from one timezone to another. For example I am in India I am able to convert from India to US using Data d=new Date() and assigning it to a calendar object and setting the time zone. but not from differnt timezone to another timezone. Like being in India converting from US to UK. Can anyone please help me with some code ?
0
5,862,233
05/02/2011 20:41:04
623,658
02/18/2011 18:56:38
71
0
How do I commit only changes in one directory?
I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing git add my-dir but doing git commit -a Brings up a list of all changes in my repo, and I only want to commit and push changes from my-dir. Thanks for your help, - Dave
git
null
null
null
null
null
open
How do I commit only changes in one directory? === I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing git add my-dir but doing git commit -a Brings up a list of all changes in my repo, and I only want to commit and push changes from my-dir. Thanks for your help, - Dave
0
4,861,554
02/01/2011 10:43:09
254,232
01/19/2010 17:37:43
175
8
PGTO formula in c#
i need to use this formula in c#, and i dont know how is the original formula. can anyone help me?
c#
excel
null
null
null
null
open
PGTO formula in c# === i need to use this formula in c#, and i dont know how is the original formula. can anyone help me?
0
1,608,269
10/22/2009 16:04:09
179,364
09/26/2009 02:25:54
134
1
What kinf of css hack for IE do you know?
I know these so far: *width:to hack all IE _width:to hack IE6 only Can you guys continue?
css
ie-hack
null
null
null
10/22/2009 16:18:40
not a real question
What kinf of css hack for IE do you know? === I know these so far: *width:to hack all IE _width:to hack IE6 only Can you guys continue?
1
3,244,050
07/14/2010 07:12:39
384,193
07/06/2010 05:33:08
3
0
what does this snippet refer?
<pre> public void run(){ try{ while(true){ repaint(); synchronized(this){ wait(100L); } } }catch(Exception e){ e.printStackTrace(); } } </pre>
java-me
null
null
null
null
null
open
what does this snippet refer? === <pre> public void run(){ try{ while(true){ repaint(); synchronized(this){ wait(100L); } } }catch(Exception e){ e.printStackTrace(); } } </pre>
0
8,264,814
11/25/2011 04:29:48
1,019,414
10/29/2011 04:47:03
30
0
How the software knows that how many times it is installed?
How the software knows that how many times it has been installed? For example we are installing an ativirus (6 installations allowed for 6 systems),on the seventh installation it will not allow to install. How the software knows that it has been installed 6 times before. Please explain its working.. Regards, David
windows-xp
installation
software-tools
null
null
11/25/2011 07:48:39
off topic
How the software knows that how many times it is installed? === How the software knows that how many times it has been installed? For example we are installing an ativirus (6 installations allowed for 6 systems),on the seventh installation it will not allow to install. How the software knows that it has been installed 6 times before. Please explain its working.. Regards, David
2
4,508,797
12/22/2010 11:41:14
9,951
09/15/2008 20:34:12
20,488
341
Can a user / a game developper get their credit back in dollars? If yes, at what price?
You can find every information about [how to give money to faceboo][1]k, but when it comes to take it back... If I give credits to a user, can he get it back in dollars? If a user gives me credits, can I turn it into dollars? If yes, how much does it cost? [1]: http://www.facebook.com/credits/
facebook
facebook-credits
null
null
null
12/22/2010 15:59:14
off topic
Can a user / a game developper get their credit back in dollars? If yes, at what price? === You can find every information about [how to give money to faceboo][1]k, but when it comes to take it back... If I give credits to a user, can he get it back in dollars? If a user gives me credits, can I turn it into dollars? If yes, how much does it cost? [1]: http://www.facebook.com/credits/
2
8,651,949
12/28/2011 04:44:01
189,554
10/14/2009 03:05:31
21
1
Determining interop function caller
I'm exposing a C# class to COM using these attributes: [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDual)] [GuidAttribute("2325EBEB-DB5F-4D29-B220-64845379D9C5")] [ComSourceInterfaces(typeof(WrapperEvents))] in this class I have a function: public void shutdownService() This function is meant to be called just once from a VB6 client via COM Interop. Everything works fine. But somehow, it's being called more than once. My C# codes doesn't call this function directly. So I'm guessing the problem is in VB6 code. Unfortunately, that's not what the VB6 team thinks. Is there a way to determine the caller of this function, ie. from my C#code or the VB6 code? Right now I'm using a simple function to get the stacktrace: public void LogStack() { var trace = new System.Diagnostics.StackTrace(); foreach (var frame in trace.GetFrames()) { var method = frame.GetMethod(); if (method.Name.Equals("LogStack")) continue; logger.Debug(string.Format("LogStack: {0}::{1}", method.ReflectedType != null ? method.ReflectedType.Name : string.Empty, method.Name)); } } Obviously, I got somthing like this on the log: 2011-12-23 08:28:40,067 1 DEBUG (null) LogStack: Service::shutdownService Since the only line of LogStack is the COM exposed function, I assume it's being called from vb6. But that's not enough proof for the VB6 team. Any idea how to really prove where function ?
c#
vb6
interop
null
null
null
open
Determining interop function caller === I'm exposing a C# class to COM using these attributes: [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDual)] [GuidAttribute("2325EBEB-DB5F-4D29-B220-64845379D9C5")] [ComSourceInterfaces(typeof(WrapperEvents))] in this class I have a function: public void shutdownService() This function is meant to be called just once from a VB6 client via COM Interop. Everything works fine. But somehow, it's being called more than once. My C# codes doesn't call this function directly. So I'm guessing the problem is in VB6 code. Unfortunately, that's not what the VB6 team thinks. Is there a way to determine the caller of this function, ie. from my C#code or the VB6 code? Right now I'm using a simple function to get the stacktrace: public void LogStack() { var trace = new System.Diagnostics.StackTrace(); foreach (var frame in trace.GetFrames()) { var method = frame.GetMethod(); if (method.Name.Equals("LogStack")) continue; logger.Debug(string.Format("LogStack: {0}::{1}", method.ReflectedType != null ? method.ReflectedType.Name : string.Empty, method.Name)); } } Obviously, I got somthing like this on the log: 2011-12-23 08:28:40,067 1 DEBUG (null) LogStack: Service::shutdownService Since the only line of LogStack is the COM exposed function, I assume it's being called from vb6. But that's not enough proof for the VB6 team. Any idea how to really prove where function ?
0
6,728,248
07/18/2011 02:48:54
849,278
07/18/2011 02:37:59
1
0
Encryption of data between Mac application and PHP application
I am new to the whole encryption world, and I wish to build a Mac application which interacts with a PHP application in order to access and manipulate data remotely. My problem is that I can't just transfer plain data over the internet, as most of the data being transfered can be very private, as well as username and password are passed for authentication of the user. I would like to know what kind of encryption/decryption methods I need to use in order the data will be transfered safely over the internet. Shillo.
php
security
osx
encryption
application
null
open
Encryption of data between Mac application and PHP application === I am new to the whole encryption world, and I wish to build a Mac application which interacts with a PHP application in order to access and manipulate data remotely. My problem is that I can't just transfer plain data over the internet, as most of the data being transfered can be very private, as well as username and password are passed for authentication of the user. I would like to know what kind of encryption/decryption methods I need to use in order the data will be transfered safely over the internet. Shillo.
0
3,899,605
10/10/2010 08:37:08
331,024
05/02/2010 22:54:39
62
3
Does GCC create typedefs for arrays passed to functions?
While debugging some C code with gdb I came across something I've not seen nor heard of before! The compiler (gcc -O0) seems to have created a new type for passing an array of vectors to a function... I think! Have a look at the code and gdb information below: /* The Vector type - nothing unusual */ typedef struct { float x,y,z; } Vector; /* The function I was debugging. * The second parameter is what seems to have changed */ extern void gui_shader_draw( guiShader *shader, Vector quad[ 4 ], // << This is the one! Vector origin, Vector rotation, Vector scale, bool focus, int mode ); I set a breakpoint inside the gui_shader_draw function and this is what I see: break shader.c:248 Breakpoint 1 at 0x80013ac0: file src/gui/shader.c, line 248. (gdb) continue Continuing. // I have split the next line Breakpoint 1, gfx_shader_draw ( shader=0x80588ea8, quad_t=0x80585fe8, // << What the? origin=..., rotation=..., scale=..., focus=false, mode=3) at src/gui/shader.c:249 // The values quad_t points to are all good (gdb) print quad_t[0] $10 = {x = -320, y = -240, z = 0} (gdb) print quad_t[1] $11 = {x = 320, y = -240, z = 0} (gdb) print quad_t[2] $12 = {x = 320, y = 240, z = 0} (gdb) print quad_t[3] $13 = {x = -320, y = 240, z = 0} Where did quad_t come from? It's certainly not a typedef in any of my code. The system header sys/types.h has a quad_t alias (long int) but that doesn't seem at all related! What's going on? Have I missed something obvious?
c
gcc
function
compiler
parameter-passing
null
open
Does GCC create typedefs for arrays passed to functions? === While debugging some C code with gdb I came across something I've not seen nor heard of before! The compiler (gcc -O0) seems to have created a new type for passing an array of vectors to a function... I think! Have a look at the code and gdb information below: /* The Vector type - nothing unusual */ typedef struct { float x,y,z; } Vector; /* The function I was debugging. * The second parameter is what seems to have changed */ extern void gui_shader_draw( guiShader *shader, Vector quad[ 4 ], // << This is the one! Vector origin, Vector rotation, Vector scale, bool focus, int mode ); I set a breakpoint inside the gui_shader_draw function and this is what I see: break shader.c:248 Breakpoint 1 at 0x80013ac0: file src/gui/shader.c, line 248. (gdb) continue Continuing. // I have split the next line Breakpoint 1, gfx_shader_draw ( shader=0x80588ea8, quad_t=0x80585fe8, // << What the? origin=..., rotation=..., scale=..., focus=false, mode=3) at src/gui/shader.c:249 // The values quad_t points to are all good (gdb) print quad_t[0] $10 = {x = -320, y = -240, z = 0} (gdb) print quad_t[1] $11 = {x = 320, y = -240, z = 0} (gdb) print quad_t[2] $12 = {x = 320, y = 240, z = 0} (gdb) print quad_t[3] $13 = {x = -320, y = 240, z = 0} Where did quad_t come from? It's certainly not a typedef in any of my code. The system header sys/types.h has a quad_t alias (long int) but that doesn't seem at all related! What's going on? Have I missed something obvious?
0
10,619,277
05/16/2012 13:10:14
1,381,225
05/08/2012 05:17:00
19
0
How to search through sub views of navigation bar
I have a small question...How to search through the sub views of navigation bar.My thought is to change the font size if navigation title....
iphone
ios
iphone-sdk-4.0
ios4
cocos2d-iphone
05/17/2012 02:24:29
not a real question
How to search through sub views of navigation bar === I have a small question...How to search through the sub views of navigation bar.My thought is to change the font size if navigation title....
1
7,283,566
09/02/2011 12:43:32
458,955
09/26/2010 21:33:23
505
12
Proper use of malloc
A chapter out of the book I have been reading has focused on memory management allocating space using malloc linux functions. Before I read this I would make relatively small programs without allocating space. Is it acceptable to not do anything in the way of memory allocation for applications that run under 50 mB? What are the repercussions of not doing so?
c++
c
linux
malloc
null
09/03/2011 02:00:06
not a real question
Proper use of malloc === A chapter out of the book I have been reading has focused on memory management allocating space using malloc linux functions. Before I read this I would make relatively small programs without allocating space. Is it acceptable to not do anything in the way of memory allocation for applications that run under 50 mB? What are the repercussions of not doing so?
1
11,649,266
07/25/2012 12:04:08
1,528,328
07/16/2012 08:49:10
55
1
How to following code gives output as 14? Can anyone explain?
Read this question somewhere. Couldn't find the exact execution process. Can anyone explain the process. class Test { public static void main(String [] args) { int x = 11 & 9; int y = x ^ 3; System.out.println( y | 12 ); } }
java
null
null
null
null
07/28/2012 03:48:53
not a real question
How to following code gives output as 14? Can anyone explain? === Read this question somewhere. Couldn't find the exact execution process. Can anyone explain the process. class Test { public static void main(String [] args) { int x = 11 & 9; int y = x ^ 3; System.out.println( y | 12 ); } }
1
5,553,327
04/05/2011 14:16:20
693,083
04/05/2011 14:16:20
1
0
Jquery accordian problems with ie?
I have a simple jquery accordion that animates just fine, but in ie auto height isnt adjusting and have the menu is displaying underneath another dive, I know is a css issue. Any tips? I don't know much about min-height and what not. #accordion{ width:200px; height:auto; background:#fff; -moz-box-shadow: 3px 3px 10px #999; -webkit-box-shadow: 3px 3px 10px #999; box-shadow: 3px 3px 10px #999; border-radius: 15px; -moz-border-radius :15px; -webkit-border-radius: 15px; float:left; }
jquery
css
internet-explorer
jquery-accordian
null
06/05/2012 18:22:19
not a real question
Jquery accordian problems with ie? === I have a simple jquery accordion that animates just fine, but in ie auto height isnt adjusting and have the menu is displaying underneath another dive, I know is a css issue. Any tips? I don't know much about min-height and what not. #accordion{ width:200px; height:auto; background:#fff; -moz-box-shadow: 3px 3px 10px #999; -webkit-box-shadow: 3px 3px 10px #999; box-shadow: 3px 3px 10px #999; border-radius: 15px; -moz-border-radius :15px; -webkit-border-radius: 15px; float:left; }
1
8,565,396
12/19/2011 17:58:40
1,008,531
10/22/2011 12:23:33
11
0
doubly linked list shuffle c++
i need to shuffle a deck of cards that are in a doubly linked list. I have read some solution on internet, but there not very clear. Also because because my english is not to good. I was thinking about a for loop that's loops through my 52 cards, takes randomly a number between 2 and 52. Then I make a nested loop in that loop I loop from 2 up to the random number. So I have arrived at the card that I will pick and reposition in front of the deck. The place where I picked the card, will be reconnected and the first card becomes the second card and my random card becomes the head card. I might explaine it well, but the execution of typing it in c++ is a bit difficult.
c++
list
linked
shuffle
cards
12/20/2011 01:27:43
not constructive
doubly linked list shuffle c++ === i need to shuffle a deck of cards that are in a doubly linked list. I have read some solution on internet, but there not very clear. Also because because my english is not to good. I was thinking about a for loop that's loops through my 52 cards, takes randomly a number between 2 and 52. Then I make a nested loop in that loop I loop from 2 up to the random number. So I have arrived at the card that I will pick and reposition in front of the deck. The place where I picked the card, will be reconnected and the first card becomes the second card and my random card becomes the head card. I might explaine it well, but the execution of typing it in c++ is a bit difficult.
4
4,672,774
01/12/2011 18:53:51
412,932
08/06/2010 10:55:07
1
0
Android Play .asx file with MediaPlayer?
I want to make an app with which you can play radio audio streams. So far i have this: @Override public void onClick(View v) { player = new MediaPlayer(); try { player.setDataSource("http://livestreams.omroep.nl/npo/3fm-bb"); player.prepare(); player.start(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } But this aint seem to be working, is it even possible to play an .asx file? or like this? (click on the link and see what i mean)
android
mediaplayer
asx
null
null
null
open
Android Play .asx file with MediaPlayer? === I want to make an app with which you can play radio audio streams. So far i have this: @Override public void onClick(View v) { player = new MediaPlayer(); try { player.setDataSource("http://livestreams.omroep.nl/npo/3fm-bb"); player.prepare(); player.start(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } But this aint seem to be working, is it even possible to play an .asx file? or like this? (click on the link and see what i mean)
0
6,549,932
07/01/2011 15:22:20
771,541
05/26/2011 14:59:47
48
6
Image from URL then crop
So I've been trying to grab an image from an external URL, crop it and then save it. I could copy and save it okay but it's the crop part that is troubling me. I can't figure out how to get an image resource from the CURL stuff (I'm no good with curl this is someone else's curl stuff). I though it was this: $img = imagecreatefromstring($image); $crop = imagecreatetruecolor(8,8); imagecopy ( $crop, $img, 0, 0, 8, 8, 8, 8); But no luck there, saves a corrupt PNG. Here is the full code: $link = "urlhere"; $path = './mcimages/faces/'; $curl_handle=curl_init(urldecode($link)); curl_setopt($curl_handle, CURLOPT_NOBODY, true); $result = curl_exec($curl_handle); $retcode = false; if($result !== false) { $status = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); if($status == 200) $retcode = true; } curl_close($curl_handle); if($retcode) { $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,urldecode($link)); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $image = curl_exec($curl_handle); curl_close($curl_handle); if($image !== false) { $img = imagecreatefromstring($image); $crop = imagecreatetruecolor(8,8); imagecopy ( $crop, $img, 0, 0, 8, 8, 8, 8 ); if(strpos($link,"/") !== false) { $name = explode("/",$link); $total = count($name); $handle = fopen($path.$name[$total-1],"w") or die("Could not create : ".$path.rand()."_".$name[$total-1]); if($handle !== false) { fwrite($handle,$crop); fclose($handle); echo 'The file has been successfully saved !'; } } } } else { echo 'File not found !'; }
php
image
curl
png
crop
null
open
Image from URL then crop === So I've been trying to grab an image from an external URL, crop it and then save it. I could copy and save it okay but it's the crop part that is troubling me. I can't figure out how to get an image resource from the CURL stuff (I'm no good with curl this is someone else's curl stuff). I though it was this: $img = imagecreatefromstring($image); $crop = imagecreatetruecolor(8,8); imagecopy ( $crop, $img, 0, 0, 8, 8, 8, 8); But no luck there, saves a corrupt PNG. Here is the full code: $link = "urlhere"; $path = './mcimages/faces/'; $curl_handle=curl_init(urldecode($link)); curl_setopt($curl_handle, CURLOPT_NOBODY, true); $result = curl_exec($curl_handle); $retcode = false; if($result !== false) { $status = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE); if($status == 200) $retcode = true; } curl_close($curl_handle); if($retcode) { $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,urldecode($link)); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $image = curl_exec($curl_handle); curl_close($curl_handle); if($image !== false) { $img = imagecreatefromstring($image); $crop = imagecreatetruecolor(8,8); imagecopy ( $crop, $img, 0, 0, 8, 8, 8, 8 ); if(strpos($link,"/") !== false) { $name = explode("/",$link); $total = count($name); $handle = fopen($path.$name[$total-1],"w") or die("Could not create : ".$path.rand()."_".$name[$total-1]); if($handle !== false) { fwrite($handle,$crop); fclose($handle); echo 'The file has been successfully saved !'; } } } } else { echo 'File not found !'; }
0