question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,216,554
6,218,130
cmake glob include while preserving directory structure
I'm new to cmake and I'm trying to install.hpp files while preserving directory structure. So far I have FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/detail/*.hpp" install (FILES ${files} DESTINATION include) Al...
You can use the DIRECTORY variant of the CMake install command. This command will preserve the structure of the copied directory: install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.hpp") If the directory to be copied contains subdirectories that should not be installed, you'll have to explicitly e...
cmake glob include while preserving directory structure I'm new to cmake and I'm trying to install.hpp files while preserving directory structure. So far I have FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/detail...
TITLE: cmake glob include while preserving directory structure QUESTION: I'm new to cmake and I'm trying to install.hpp files while preserving directory structure. So far I have FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MyLib/*.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/in...
[ "c++", "installation", "cmake", "directory-structure", "glob" ]
15
17
6,810
1
0
2011-06-02T15:19:01.177000
2011-06-02T17:41:02.877000
6,216,562
6,216,610
WinAPI mouse move notification for full desktop
In WinAPI is there a mouse move notification for the full desktop (full screen) and not for a window only? I would like to receive mouse screen coordinates in my main window procedure. Edit: What I try to do is getting the coordinates from the mouse when dragging from a button in my window to outside that window.
Not as such, no. If you wanted to do something anywhere on the desktop from within your program, e.g. point somewhere or draw something anywhere, you could capture the mouse and then follow the movement until the mouse button is released. See SetCapture for this. For an example, see this article on MSDN: Drawing Lines ...
WinAPI mouse move notification for full desktop In WinAPI is there a mouse move notification for the full desktop (full screen) and not for a window only? I would like to receive mouse screen coordinates in my main window procedure. Edit: What I try to do is getting the coordinates from the mouse when dragging from a b...
TITLE: WinAPI mouse move notification for full desktop QUESTION: In WinAPI is there a mouse move notification for the full desktop (full screen) and not for a window only? I would like to receive mouse screen coordinates in my main window procedure. Edit: What I try to do is getting the coordinates from the mouse when...
[ "c", "winapi" ]
2
5
1,842
3
0
2011-06-02T15:19:21.657000
2011-06-02T15:22:54.267000
6,216,564
6,216,622
How do I setup a PdfReader filepath?
This may seem like a trivial question, I would like to open an existing pdf template, edit and flatten the file, then send as an email attachment. But how do I setup PdfReader to read my file located in my Content folder (Content/Documents/PDFFile.pdf). This is what I have which gives the error "(whatever path I try).p...
Try using Server.MapPath("/Path/Here.pdf"); or Request.PhysicalApplicationPath("/Path/Here.pdf");
How do I setup a PdfReader filepath? This may seem like a trivial question, I would like to open an existing pdf template, edit and flatten the file, then send as an email attachment. But how do I setup PdfReader to read my file located in my Content folder (Content/Documents/PDFFile.pdf). This is what I have which giv...
TITLE: How do I setup a PdfReader filepath? QUESTION: This may seem like a trivial question, I would like to open an existing pdf template, edit and flatten the file, then send as an email attachment. But how do I setup PdfReader to read my file located in my Content folder (Content/Documents/PDFFile.pdf). This is wha...
[ "c#", "asp.net", "asp.net-mvc", "pdf", "itext" ]
0
5
4,446
1
0
2011-06-02T15:19:27.973000
2011-06-02T15:24:01.843000
6,216,568
6,216,937
Rich Text Editor That Can Strip Microsoft Word Formatting?
I'm building a (CakePHP) website with an admin section that allows rich text editing of some of the entered data. Currently I'm using TinyMCE but I'm not sure if there isn't a better tool for the job, given some of the requirements (or at least would-be-very-nice-to-haves) of the client. Ideally, if a user were to cut ...
We're using the "pastetext" and "pasteword" option in TinyMCE (to give the users the option to paste text-only or try to use all formatting) and it works pretty good. http://tinymce.moxiecode.com/wiki.php/Plugin:paste
Rich Text Editor That Can Strip Microsoft Word Formatting? I'm building a (CakePHP) website with an admin section that allows rich text editing of some of the entered data. Currently I'm using TinyMCE but I'm not sure if there isn't a better tool for the job, given some of the requirements (or at least would-be-very-ni...
TITLE: Rich Text Editor That Can Strip Microsoft Word Formatting? QUESTION: I'm building a (CakePHP) website with an admin section that allows rich text editing of some of the entered data. Currently I'm using TinyMCE but I'm not sure if there isn't a better tool for the job, given some of the requirements (or at leas...
[ "cakephp", "formatting", "ms-word", "tinymce", "rich-text-editor" ]
3
4
1,917
2
0
2011-06-02T15:19:49.503000
2011-06-02T15:52:38.973000
6,216,569
6,226,206
jQuery chained animation without plugin
Before with jQuery I could do a chained animation with a delay between like so: $("#element").delay(45).animate({ }, 45).delay(45).animate({ }, 45).delay(45).animate({ }, 45); Now since the update to v1.6.1 instead of doing what it did previously, it now skips to the last animation. Ignoring the previous statements. I ...
Here is the second way as requested. I post it in another answer, because it is more complex, and perhaps less beautiful. To play with it see: http://jsfiddle.net/LMptt/1/ Usage: use a string with + or - to indicate a relative timestamp. The order matters for relative timestamps (relative to the previous action that is...
jQuery chained animation without plugin Before with jQuery I could do a chained animation with a delay between like so: $("#element").delay(45).animate({ }, 45).delay(45).animate({ }, 45).delay(45).animate({ }, 45); Now since the update to v1.6.1 instead of doing what it did previously, it now skips to the last animati...
TITLE: jQuery chained animation without plugin QUESTION: Before with jQuery I could do a chained animation with a delay between like so: $("#element").delay(45).animate({ }, 45).delay(45).animate({ }, 45).delay(45).animate({ }, 45); Now since the update to v1.6.1 instead of doing what it did previously, it now skips t...
[ "jquery", "animation", "chaining" ]
6
4
306
2
0
2011-06-02T15:19:58.777000
2011-06-03T10:58:11.597000
6,216,577
6,216,668
strtod accepts "e" but also "d" -- why?
I find this strange. While it makes sense that strtod accepts 'e' as one of the characters (exactly one to be precise) in the input string I find that it also accepts 'd'. Can someone please explain? #include < stdio.h > #include < stdlib.h > int main () { char *s[] = {"1a1", "1e1", "1d1", "1f1"}; char * pEnd; double d...
What Compiler/Libraries are you using to compile this code? Assuming you're on Visual Studio, this behaviour is expected (quoting text from the MSDN): strtod expects nptr to point to a string of the following form: [whitespace] [sign] [digits] [.digits] [ {d | D | e | E}[sign]digits] You can find the full documentation...
strtod accepts "e" but also "d" -- why? I find this strange. While it makes sense that strtod accepts 'e' as one of the characters (exactly one to be precise) in the input string I find that it also accepts 'd'. Can someone please explain? #include < stdio.h > #include < stdlib.h > int main () { char *s[] = {"1a1", "1e...
TITLE: strtod accepts "e" but also "d" -- why? QUESTION: I find this strange. While it makes sense that strtod accepts 'e' as one of the characters (exactly one to be precise) in the input string I find that it also accepts 'd'. Can someone please explain? #include < stdio.h > #include < stdlib.h > int main () { char ...
[ "c", "strtod" ]
3
3
419
4
0
2011-06-02T15:20:43.597000
2011-06-02T15:27:23.937000
6,216,584
6,217,506
Using AJAX with an asp:Calendar
Total newb to.NET programming (and AJAX) but I've been working on this program a while. Many things I state in this question might not make sense, so please correct me where my understanding is off. Right now I've got an ASP:Calendar which has this property: OnSelectionChanged = "SelectionChanged". So the SelectionChan...
Well, you can use the standard.NET AJAX controls, they are pretty simple to implement.... Basically, you need to first include a script manager in your markup, nothing complicated about that. Just make sure it is in the tags. You want to wrap the part of your page you want to be accessible on the AJAX postback in an Up...
Using AJAX with an asp:Calendar Total newb to.NET programming (and AJAX) but I've been working on this program a while. Many things I state in this question might not make sense, so please correct me where my understanding is off. Right now I've got an ASP:Calendar which has this property: OnSelectionChanged = "Selecti...
TITLE: Using AJAX with an asp:Calendar QUESTION: Total newb to.NET programming (and AJAX) but I've been working on this program a while. Many things I state in this question might not make sense, so please correct me where my understanding is off. Right now I've got an ASP:Calendar which has this property: OnSelection...
[ "javascript", "asp.net", "ajax" ]
0
0
489
2
0
2011-06-02T15:20:59.007000
2011-06-02T16:44:18.177000
6,216,588
6,216,735
UDF calling external C++ code inside SQL Server
Suposse I have an UDF in SQL Server 2008: Create function dbo.ReadXml (@xmlMatrix xml) returns table as return ( select --SOME C++ CODE ) go Is it possible to add a c++ code or call a c++ function inside the UDF?
Onyl if this C++ function was compiled and installed as an extended stored procedure. But extended stored procedures are deprecated and will be removed soon. So your only reliable option is to write a CLR function. It can be a C# CLR function that calls an external C++ dll, or it might be a managed C++ CLR function tha...
UDF calling external C++ code inside SQL Server Suposse I have an UDF in SQL Server 2008: Create function dbo.ReadXml (@xmlMatrix xml) returns table as return ( select --SOME C++ CODE ) go Is it possible to add a c++ code or call a c++ function inside the UDF?
TITLE: UDF calling external C++ code inside SQL Server QUESTION: Suposse I have an UDF in SQL Server 2008: Create function dbo.ReadXml (@xmlMatrix xml) returns table as return ( select --SOME C++ CODE ) go Is it possible to add a c++ code or call a c++ function inside the UDF? ANSWER: Onyl if this C++ function was co...
[ "c++", "sql-server-2008", "user-defined-functions" ]
1
2
2,315
1
0
2011-06-02T15:21:23.240000
2011-06-02T15:33:20.957000
6,216,595
6,216,625
How can I strip tab characters from a string in Ruby?
I have a program that loads some tab-separated lines into a MySQL table. One of the values has tabs in it, which is causing some problems. The data is created column by column, so I need to find a way to strip the tab character out of an individual field with gsub. I do not, however, want to get rid of anything else, l...
It's really easy \t is the tab character. result = string.gsub /\t/, '' or, in-place string.gsub! /\t/, ''
How can I strip tab characters from a string in Ruby? I have a program that loads some tab-separated lines into a MySQL table. One of the values has tabs in it, which is causing some problems. The data is created column by column, so I need to find a way to strip the tab character out of an individual field with gsub. ...
TITLE: How can I strip tab characters from a string in Ruby? QUESTION: I have a program that loads some tab-separated lines into a MySQL table. One of the values has tabs in it, which is causing some problems. The data is created column by column, so I need to find a way to strip the tab character out of an individual...
[ "ruby" ]
5
20
15,122
2
0
2011-06-02T15:21:51.967000
2011-06-02T15:24:08.163000
6,216,599
6,216,650
Does using assembly compiled in older version of .NET framework affects whole performance?
Lets imagine that we have two assemblies: Foo.Logic (compiled on.NET 2.0 framework) Foo.Application (compiled on.NET 4.0 framework) that have reference and uses compiled Foo.Logic. Does it have impact on Foo.Application performance (or have any other drawbacks)?
In the situation you described in the question, everything will Just Work™ without any problems. A.NET 4.0 application will load a.NET 2.0 library directly into the.NET 4.0 runtime environment. It will not use side-by-side execution unless you explicitly ask it to. There's a lot of misinformation or unclear statements ...
Does using assembly compiled in older version of .NET framework affects whole performance? Lets imagine that we have two assemblies: Foo.Logic (compiled on.NET 2.0 framework) Foo.Application (compiled on.NET 4.0 framework) that have reference and uses compiled Foo.Logic. Does it have impact on Foo.Application performan...
TITLE: Does using assembly compiled in older version of .NET framework affects whole performance? QUESTION: Lets imagine that we have two assemblies: Foo.Logic (compiled on.NET 2.0 framework) Foo.Application (compiled on.NET 4.0 framework) that have reference and uses compiled Foo.Logic. Does it have impact on Foo.App...
[ ".net", "performance", ".net-4.0", ".net-2.0", "assemblies" ]
12
20
3,682
2
0
2011-06-02T15:22:21.970000
2011-06-02T15:26:04.603000
6,216,600
6,220,181
How do I access a ViewBag.Title after it has been set by the underlying View?
Here's the thing. I have a MVC Action, and on that action, I have applied a custom ActionFilterAttribute to get the deserialization working. Now, what I want to do, is set some header based on the ViewBag.Title that is set inside this view. I've tried wrapping the ViewResult in my own, and overriding the ExecuteResult ...
Try this - assign the output of the view result var output = View(msg); //do your other viewbag stuff here return output; Why all of this though - I didn't follow when you said "and I want to do be able to let the View think it's handling a normal web page." Edit: Why don't you then just set this via a helper method in...
How do I access a ViewBag.Title after it has been set by the underlying View? Here's the thing. I have a MVC Action, and on that action, I have applied a custom ActionFilterAttribute to get the deserialization working. Now, what I want to do, is set some header based on the ViewBag.Title that is set inside this view. I...
TITLE: How do I access a ViewBag.Title after it has been set by the underlying View? QUESTION: Here's the thing. I have a MVC Action, and on that action, I have applied a custom ActionFilterAttribute to get the deserialization working. Now, what I want to do, is set some header based on the ViewBag.Title that is set i...
[ "asp.net-mvc", "asp.net-mvc-3", "viewbag" ]
4
3
10,074
1
0
2011-06-02T15:22:31.397000
2011-06-02T20:45:11.370000
6,216,602
6,216,860
View schema of resultset in SQL Server Management Studio
Is there any way in Sql Server Management Studio (2008) whereby I can view the data types of each field in the result of a query? In this case, I am running a stored procedure which returns a result set, and I would like to know the lengths of the nvarchar columns and precision of decimals. In the past, I have created ...
Quick and dirty snippet, requires all the fields in the result set are named or aliased; select * into #T from openrowset('SQLNCLI', 'Server=.;Trusted_Connection=yes;', 'exec thedb.dbo.sp_whatever') exec('use tempdb exec sp_columns #T drop table #T')
View schema of resultset in SQL Server Management Studio Is there any way in Sql Server Management Studio (2008) whereby I can view the data types of each field in the result of a query? In this case, I am running a stored procedure which returns a result set, and I would like to know the lengths of the nvarchar column...
TITLE: View schema of resultset in SQL Server Management Studio QUESTION: Is there any way in Sql Server Management Studio (2008) whereby I can view the data types of each field in the result of a query? In this case, I am running a stored procedure which returns a result set, and I would like to know the lengths of t...
[ "sql-server-2008", "ssms" ]
10
7
2,537
2
0
2011-06-02T15:22:41.287000
2011-06-02T15:44:30.343000
6,216,611
6,216,749
Entering data twice
I made a php code for insert data on mysql. if(isset($_POST['submitted'])){ $img = NULL; if(isset($_FILES['upload'])){ include('classes/imagens.class.php'); $imagem = new imagem($_FILES['upload']['name'],$_FILES['upload']['tmp_name'],$_FILES['upload']['size'],$_FILES['upload']['error']); if($imagem->verifica_extensa...
Every time you call mysqli_query, a query is launched to the database. You are doing that twice: if (mysqli_query(...)) {.... $this->result = mysqli_query(...); } So that's why you end with duplicated data.
Entering data twice I made a php code for insert data on mysql. if(isset($_POST['submitted'])){ $img = NULL; if(isset($_FILES['upload'])){ include('classes/imagens.class.php'); $imagem = new imagem($_FILES['upload']['name'],$_FILES['upload']['tmp_name'],$_FILES['upload']['size'],$_FILES['upload']['error']); if($imag...
TITLE: Entering data twice QUESTION: I made a php code for insert data on mysql. if(isset($_POST['submitted'])){ $img = NULL; if(isset($_FILES['upload'])){ include('classes/imagens.class.php'); $imagem = new imagem($_FILES['upload']['name'],$_FILES['upload']['tmp_name'],$_FILES['upload']['size'],$_FILES['upload']['e...
[ "php", "mysql", "oop" ]
2
5
139
1
0
2011-06-02T15:23:15.917000
2011-06-02T15:34:45.810000
6,216,637
6,216,673
Convert String to HTML Ready text for MAILTO: URL
I am writing a large Java Application in which I would like to include a "Send Email" button. All it does is open a mailto url with the appropriate headers. The only difficulty I am having is parsing the input strings so that they are formatted appropriately, for example: mailto:someone@somewhere.net?subject=This is th...
You can try URLEncoder, specifically the encode method that can be found here.
Convert String to HTML Ready text for MAILTO: URL I am writing a large Java Application in which I would like to include a "Send Email" button. All it does is open a mailto url with the appropriate headers. The only difficulty I am having is parsing the input strings so that they are formatted appropriately, for exampl...
TITLE: Convert String to HTML Ready text for MAILTO: URL QUESTION: I am writing a large Java Application in which I would like to include a "Send Email" button. All it does is open a mailto url with the appropriate headers. The only difficulty I am having is parsing the input strings so that they are formatted appropr...
[ "java", "html", "string", "parsing" ]
0
2
1,506
2
0
2011-06-02T15:25:18.790000
2011-06-02T15:28:03.003000
6,216,643
6,216,763
Process same file in two threads using ifstream
I have an input file in my application that contains a vast amount of information. Reading over it sequentially, and at only a single file offset at a time is not sufficient for my application's usage. Ideally, I'd like to have two threads, that have separate and distinct ifstream s reading from two unique file offsets...
Two std::ifstream instances will probably be the best option here. Modern HDDs are optimized for a large queue of I/O requests, so reading from two std::ifstream instances concurrently should give quite nice performance. If you have a single std::ifstream you'll have to worry about synchronizing access to it, plus it m...
Process same file in two threads using ifstream I have an input file in my application that contains a vast amount of information. Reading over it sequentially, and at only a single file offset at a time is not sufficient for my application's usage. Ideally, I'd like to have two threads, that have separate and distinct...
TITLE: Process same file in two threads using ifstream QUESTION: I have an input file in my application that contains a vast amount of information. Reading over it sequentially, and at only a single file offset at a time is not sufficient for my application's usage. Ideally, I'd like to have two threads, that have sep...
[ "c++", "multithreading", "io", "fstream", "ifstream" ]
7
13
11,335
5
0
2011-06-02T15:25:45.227000
2011-06-02T15:36:15.477000
6,216,661
6,216,898
Jquery blackout + popup problem
Js Fiddle I'm struggling to understand what is wrong with this code. I am basically trying to make the page 'blackout' and then display the hidden div inside the new div I have create in the JS. The first line seems to work, creating a blackout div and fading it over the whole page. But the rest of the jquery just does...
You need to load jQuery 1.4 or higher, because.delay() is added in 1.4: http://api.jquery.com/delay/ Working example: http://jsfiddle.net/PjpWC/
Jquery blackout + popup problem Js Fiddle I'm struggling to understand what is wrong with this code. I am basically trying to make the page 'blackout' and then display the hidden div inside the new div I have create in the JS. The first line seems to work, creating a blackout div and fading it over the whole page. But ...
TITLE: Jquery blackout + popup problem QUESTION: Js Fiddle I'm struggling to understand what is wrong with this code. I am basically trying to make the page 'blackout' and then display the hidden div inside the new div I have create in the JS. The first line seems to work, creating a blackout div and fading it over th...
[ "jquery" ]
0
0
734
2
0
2011-06-02T15:26:54.823000
2011-06-02T15:48:28.987000
6,216,664
6,216,725
Is there any guide for iOS runloop mechanism?
I'm learning socket communication on iPhone, and its guide said something about CFRunloop (it is a guide for CFNetwork, can this be used on iOS?) Where can I learn about runloop on iOS?API reference is not enough.
Look at the "Run Loops" chapter of Apple's Threading Programming Guide. In brief: There is one run loop associated with each thread. The run loop has to be run to do anything. Apple's application main function takes care of this for you on the main thread. A run loop is run in a specific mode. The "common mode" is actu...
Is there any guide for iOS runloop mechanism? I'm learning socket communication on iPhone, and its guide said something about CFRunloop (it is a guide for CFNetwork, can this be used on iOS?) Where can I learn about runloop on iOS?API reference is not enough.
TITLE: Is there any guide for iOS runloop mechanism? QUESTION: I'm learning socket communication on iPhone, and its guide said something about CFRunloop (it is a guide for CFNetwork, can this be used on iOS?) Where can I learn about runloop on iOS?API reference is not enough. ANSWER: Look at the "Run Loops" chapter o...
[ "iphone", "ios", "sockets", "runloop" ]
17
43
16,765
3
0
2011-06-02T15:27:15.153000
2011-06-02T15:32:50.783000
6,216,676
6,217,367
ClickOnce Save Dialog for Setup.exe
I’ve created a winform application which is deployed/installed via « ClickOnce ». I’ve notice an odd behavior when I add a prerequisite… Initially, I have the following prerequisites: Windows Installer 3.1.Net Framework 3.5 SP 1 Once published, the users navigate to the publish.htm file and they see: Name: Version: Pub...
1.) The auto-generated publish.htm file does not include the installation of your prerequisites unless you choose to have them installed before your application. As soon as you specified a prerequisite from the Prerequisites screen on the Publish tab of your project, the publication process changes the look of the inst...
ClickOnce Save Dialog for Setup.exe I’ve created a winform application which is deployed/installed via « ClickOnce ». I’ve notice an odd behavior when I add a prerequisite… Initially, I have the following prerequisites: Windows Installer 3.1.Net Framework 3.5 SP 1 Once published, the users navigate to the publish.htm f...
TITLE: ClickOnce Save Dialog for Setup.exe QUESTION: I’ve created a winform application which is deployed/installed via « ClickOnce ». I’ve notice an odd behavior when I add a prerequisite… Initially, I have the following prerequisites: Windows Installer 3.1.Net Framework 3.5 SP 1 Once published, the users navigate to...
[ "clickonce" ]
3
1
2,169
2
0
2011-06-02T15:28:13.853000
2011-06-02T16:31:24.533000
6,216,690
6,216,907
Image Submit buttons in Codeigniter - what am i missing?
I've got the following Codeigniter code to display a form, with two image submit buttons. I need to know which button has been clicked by the user. Normally I just reference the name or value that is passed through, but nothing is passed from these buttons. All other fields/textboxes etc.. on the form pass through ok, ...
I had a similar issue (with Zend though)! The thing is, the browser does not pass the “value” when input type=image. to check wich button was clicked you could still reference the button by adding "_x" or "_y" to your button name (Ex 'Button2_x')and check the $_Post array against this. if(isset($_POST['button2_x'])) { ...
Image Submit buttons in Codeigniter - what am i missing? I've got the following Codeigniter code to display a form, with two image submit buttons. I need to know which button has been clicked by the user. Normally I just reference the name or value that is passed through, but nothing is passed from these buttons. All o...
TITLE: Image Submit buttons in Codeigniter - what am i missing? QUESTION: I've got the following Codeigniter code to display a form, with two image submit buttons. I need to know which button has been clicked by the user. Normally I just reference the name or value that is passed through, but nothing is passed from th...
[ "php", "codeigniter" ]
3
2
3,511
2
0
2011-06-02T15:29:43.890000
2011-06-02T15:49:20.853000
6,216,695
6,216,731
Perl : How to match a parenthesis inside a regexp?
I'm trying to extract some fields from a fixed format data, which looks like this: G1 = DFF(G2) Say $_ has the above line, and I want to get G1 and G2 after matching it with a suitable reg exp. I'm using this: if (/(w+)\s*=\s*DFF\((w+)\)/) { print "$1, $2"; } But this isn't printing what I want (prints nothing, which m...
if (/(\w+)\s*=\s*DFF\((\w+)\)/) It's not the parens that are incorrect, it's the word match \w that needs an escape.
Perl : How to match a parenthesis inside a regexp? I'm trying to extract some fields from a fixed format data, which looks like this: G1 = DFF(G2) Say $_ has the above line, and I want to get G1 and G2 after matching it with a suitable reg exp. I'm using this: if (/(w+)\s*=\s*DFF\((w+)\)/) { print "$1, $2"; } But this ...
TITLE: Perl : How to match a parenthesis inside a regexp? QUESTION: I'm trying to extract some fields from a fixed format data, which looks like this: G1 = DFF(G2) Say $_ has the above line, and I want to get G1 and G2 after matching it with a suitable reg exp. I'm using this: if (/(w+)\s*=\s*DFF\((w+)\)/) { print "$1...
[ "regex", "perl" ]
2
11
2,174
1
0
2011-06-02T15:29:54.713000
2011-06-02T15:33:10.190000
6,216,697
6,216,889
Problem sending POST variable with C# client
I in a C# client, I have the following code: Uri uri = new Uri(@"http://myserver/test.php"); HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest; request.Method = WebRequestMethods.Http.Post; //request.ContentType = "application/json"; string req = "er3=12"; Console.WriteLine("Req: " + req); System.Text...
You'll need to set the content type of your data so that PHP knows how to parse it. Like this: request.ContentType = "application/x-www-form-urlencoded"; application/x-www-form-urlencoded is the standard MIME type used by web browsers when posting form data.
Problem sending POST variable with C# client I in a C# client, I have the following code: Uri uri = new Uri(@"http://myserver/test.php"); HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest; request.Method = WebRequestMethods.Http.Post; //request.ContentType = "application/json"; string req = "er3=12"; C...
TITLE: Problem sending POST variable with C# client QUESTION: I in a C# client, I have the following code: Uri uri = new Uri(@"http://myserver/test.php"); HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest; request.Method = WebRequestMethods.Http.Post; //request.ContentType = "application/json"; string...
[ "c#", "web-services", "post", "client" ]
2
2
658
1
0
2011-06-02T15:30:07.633000
2011-06-02T15:47:36.613000
6,216,709
6,218,531
jqGrid 4 with jQuery 1.6.1
is there anyone who have experienced problems using the latests jQuery version with one of the last jqGrid releases? I am in process to upgrade jQuery to 1.6.1 and I was trying to find infos about jqGrid but it seems that they are not yet supporting it. UPDATE: I did some tests and it seems that there are problems: Thi...
Sorry, but I could not reproduce your problem. See the demo. I use HTTP "GET" instead of "POST" because I use no active server components. Could you verify the demo in your environments?
jqGrid 4 with jQuery 1.6.1 is there anyone who have experienced problems using the latests jQuery version with one of the last jqGrid releases? I am in process to upgrade jQuery to 1.6.1 and I was trying to find infos about jqGrid but it seems that they are not yet supporting it. UPDATE: I did some tests and it seems t...
TITLE: jqGrid 4 with jQuery 1.6.1 QUESTION: is there anyone who have experienced problems using the latests jQuery version with one of the last jqGrid releases? I am in process to upgrade jQuery to 1.6.1 and I was trying to find infos about jqGrid but it seems that they are not yet supporting it. UPDATE: I did some te...
[ "jquery", "jqgrid" ]
2
2
982
1
0
2011-06-02T15:30:53.793000
2011-06-02T18:14:25.263000
6,216,711
6,217,076
general programming logic
I have a general question - regarding testing of values, I have run into this issue multiple time and I end up with some unsightly long code to accomplish something that logically seems simple. the issue - I have one or multiple values I want to test against other values....SUCH THAT my code ends up looking like this (...
You have two questions here: 1) is there a cleaner way to write this code? and 2) is this computationally efficient? murgatroid99 and τεκ both have good answers to how to produce cleaner code. But both of these methods are actually (at least on the face of things, assuming the compiler doesn't optimize under the hood) ...
general programming logic I have a general question - regarding testing of values, I have run into this issue multiple time and I end up with some unsightly long code to accomplish something that logically seems simple. the issue - I have one or multiple values I want to test against other values....SUCH THAT my code e...
TITLE: general programming logic QUESTION: I have a general question - regarding testing of values, I have run into this issue multiple time and I end up with some unsightly long code to accomplish something that logically seems simple. the issue - I have one or multiple values I want to test against other values....S...
[ "logic", "mathematical-optimization" ]
2
4
180
4
0
2011-06-02T15:31:14.167000
2011-06-02T16:04:33.603000
6,216,712
6,272,977
Selenium, Java, waitForCondition
I want to check the following (on ie8): After clicking on a link, popup window is launched, then I want to check if flash content inside has loaded. For some reason waitForPopUp does not work, it just keeps waiting and times out but I've solved it this way: selenium.waitForCondition("selenium.getAllWindowTitles().lengt...
I gave this a little more thought. There is no way to test an object if it is truely loaded and the flash app is ready and initialized. The only true way of letting selenium know the flash object is loaded and ready is for flash to use the ExternalInterface method and call a JavaScript function that will assign a var a...
Selenium, Java, waitForCondition I want to check the following (on ie8): After clicking on a link, popup window is launched, then I want to check if flash content inside has loaded. For some reason waitForPopUp does not work, it just keeps waiting and times out but I've solved it this way: selenium.waitForCondition("se...
TITLE: Selenium, Java, waitForCondition QUESTION: I want to check the following (on ie8): After clicking on a link, popup window is launched, then I want to check if flash content inside has loaded. For some reason waitForPopUp does not work, it just keeps waiting and times out but I've solved it this way: selenium.wa...
[ "java", "flash", "selenium" ]
4
1
1,669
1
0
2011-06-02T15:31:17.083000
2011-06-08T00:13:55.563000
6,216,713
6,217,558
OpenGL ES 2.0 shader examples for image processing?
I am learning shader programming and looking for examples, specifically for image processing. I'd like to apply some Photoshop effect to my photos, e.g. Curves, Levels, Hue/Saturation adjustments, etc.
I'll assume you have a simple uncontroversial vertex shader, as it's not really relevant to the question, such as: void main() { gl_Position = modelviewProjectionMatrix * position; texCoordVarying = vec2(textureMatrix * vec4(texCoord0, 0.0, 1.0)); } So that does much the same as ES 1.x would if lighting was disabled, i...
OpenGL ES 2.0 shader examples for image processing? I am learning shader programming and looking for examples, specifically for image processing. I'd like to apply some Photoshop effect to my photos, e.g. Curves, Levels, Hue/Saturation adjustments, etc.
TITLE: OpenGL ES 2.0 shader examples for image processing? QUESTION: I am learning shader programming and looking for examples, specifically for image processing. I'd like to apply some Photoshop effect to my photos, e.g. Curves, Levels, Hue/Saturation adjustments, etc. ANSWER: I'll assume you have a simple uncontrov...
[ "iphone", "image-processing", "shader", "opengl-es-2.0" ]
9
10
6,045
2
0
2011-06-02T15:31:18.210000
2011-06-02T16:49:49.137000
6,216,716
6,250,400
Constructing an object graph from a flat DTO using visitor pattern
I've written myself a nice simple little domain model, with an object graph that looks like this: -- Customer -- Name: Name -- Account: CustomerAccount -- HomeAddress: PostalAddress -- InvoiceAddress: PostalAddress -- HomePhoneNumber: TelephoneNumber -- WorkPhoneNumber: TelephoneNumber -- MobilePhoneNumber: TelephoneNu...
I think you are really over-complicating things here. Just use a factory method and let your domain objects clearly state on which other domain objects they depend. class Customer { private readonly Name name; private readonly PostalAddress homeAddress; public Customer(Name name, PostalAddress homeAddress,...) { this....
Constructing an object graph from a flat DTO using visitor pattern I've written myself a nice simple little domain model, with an object graph that looks like this: -- Customer -- Name: Name -- Account: CustomerAccount -- HomeAddress: PostalAddress -- InvoiceAddress: PostalAddress -- HomePhoneNumber: TelephoneNumber --...
TITLE: Constructing an object graph from a flat DTO using visitor pattern QUESTION: I've written myself a nice simple little domain model, with an object graph that looks like this: -- Customer -- Name: Name -- Account: CustomerAccount -- HomeAddress: PostalAddress -- InvoiceAddress: PostalAddress -- HomePhoneNumber: ...
[ "c#", "factory-pattern", "dto", "visitor-pattern", "domain-model" ]
12
7
3,131
4
0
2011-06-02T15:31:46.927000
2011-06-06T10:01:08.563000
6,216,718
6,216,793
Jquery Each Problem
So the server is giving me a block of html within a hidden input. I need to take this block (which contains multiple divs) and move those divs, but with some logic. My approach is to take the value of the hidden input (html block) and append it into a newly created hidden div: var history = $("input[name=history]").val...
FWIW, your code works fine: http://jsfiddle.net/7XWuN/2/ I assume there is something else going on in the code you did not post. Without any more context, I would suggest something like this: $("#history_temp.off").each(function(){ var n = this.className.match(/\d+/)[0]; $(this).insertAfter('.on.' + n); }); DEMO This w...
Jquery Each Problem So the server is giving me a block of html within a hidden input. I need to take this block (which contains multiple divs) and move those divs, but with some logic. My approach is to take the value of the hidden input (html block) and append it into a newly created hidden div: var history = $("input...
TITLE: Jquery Each Problem QUESTION: So the server is giving me a block of html within a hidden input. I need to take this block (which contains multiple divs) and move those divs, but with some logic. My approach is to take the value of the hidden input (html block) and append it into a newly created hidden div: var ...
[ "jquery", "clone", "each", "insertafter" ]
2
3
1,027
2
0
2011-06-02T15:31:55.447000
2011-06-02T15:38:30.297000
6,216,720
6,216,755
UIPickerView realtime update on TextField
As soon as I scroll the PickerView (or) UIDatePicker, I need the value to get displayed on a TextField: While Scrolling. Even when the picker is moving the text field should update itself. Is it possible? On the event that the Picker stops moving and comes to rest. Is there an event for the PickerView to come to rest s...
(1) might not be possible. For (2), you can use the delegate method pickerView:didSelectRow:inComponent. Let me know if you need any help with this. For UIPickerView (1) Implement pickerView:titleForRow:forComponent, - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)...
UIPickerView realtime update on TextField As soon as I scroll the PickerView (or) UIDatePicker, I need the value to get displayed on a TextField: While Scrolling. Even when the picker is moving the text field should update itself. Is it possible? On the event that the Picker stops moving and comes to rest. Is there an ...
TITLE: UIPickerView realtime update on TextField QUESTION: As soon as I scroll the PickerView (or) UIDatePicker, I need the value to get displayed on a TextField: While Scrolling. Even when the picker is moving the text field should update itself. Is it possible? On the event that the Picker stops moving and comes to ...
[ "iphone", "objective-c", "xcode", "uipickerview", "textfield" ]
1
5
1,584
2
0
2011-06-02T15:32:20.687000
2011-06-02T15:35:35.053000
6,216,722
6,217,473
difference between resource and controller generators
when I do rails g model user name:string rails g controller users index create new destroy show and edit config/routes.rb to add: resource:users bundle exec rake routes gives: users POST /users(.:format) {:action=>"create",:controller=>"users"} new_users GET /users/new(.:format) {:action=>"new",:controller=>"users"} ed...
You should call rails g controller user index create new destroy show instead of rails g controller users index create new destroy show in order to get resources:users to give you the helpers you want. The latter causes Rails to assume that users is a singular object, and that resources:users should create what is call...
difference between resource and controller generators when I do rails g model user name:string rails g controller users index create new destroy show and edit config/routes.rb to add: resource:users bundle exec rake routes gives: users POST /users(.:format) {:action=>"create",:controller=>"users"} new_users GET /users/...
TITLE: difference between resource and controller generators QUESTION: when I do rails g model user name:string rails g controller users index create new destroy show and edit config/routes.rb to add: resource:users bundle exec rake routes gives: users POST /users(.:format) {:action=>"create",:controller=>"users"} new...
[ "ruby-on-rails", "ruby-on-rails-3" ]
12
13
18,956
4
0
2011-06-02T15:32:36.383000
2011-06-02T16:40:32.957000
6,216,726
6,217,102
text on canvas looks rubbish in IE...why?
i recently extended the lovely jquery "flot" charts plugin a bit...goal is to draw what would usually be in the legend directly on the chart. it looks only a bit rubbish as IE seems to render the font quite weakly. see here, left side is IE, right side is Firefox: issue http://i56.tinypic.com/34oq4ci.png btw...function...
The sad fact is that, as of now font discrepancies between all the browsers exist in Canvas. What looks one way in Firefox will look another way in IE. What looks one way in Chrome will look another way in Safari (even though they are both webkit based) Change the font to a "safer" one and see what happens. For instanc...
text on canvas looks rubbish in IE...why? i recently extended the lovely jquery "flot" charts plugin a bit...goal is to draw what would usually be in the legend directly on the chart. it looks only a bit rubbish as IE seems to render the font quite weakly. see here, left side is IE, right side is Firefox: issue http://...
TITLE: text on canvas looks rubbish in IE...why? QUESTION: i recently extended the lovely jquery "flot" charts plugin a bit...goal is to draw what would usually be in the legend directly on the chart. it looks only a bit rubbish as IE seems to render the font quite weakly. see here, left side is IE, right side is Fire...
[ "html", "canvas" ]
5
3
635
1
0
2011-06-02T15:32:51.873000
2011-06-02T16:07:04.590000
6,216,727
6,216,795
How do I grab an index from an array in a HashMap?
I've got a HashMap I just want to grab the 0 index position from the String[]. How do I do that? Can I just do this? mMap.get(position)[0]?
Yes, you can do what you've indicated, provided position is a key in the map.
How do I grab an index from an array in a HashMap? I've got a HashMap I just want to grab the 0 index position from the String[]. How do I do that? Can I just do this? mMap.get(position)[0]?
TITLE: How do I grab an index from an array in a HashMap? QUESTION: I've got a HashMap I just want to grab the 0 index position from the String[]. How do I do that? Can I just do this? mMap.get(position)[0]? ANSWER: Yes, you can do what you've indicated, provided position is a key in the map.
[ "java", "arrays", "collections" ]
2
6
195
4
0
2011-06-02T15:32:58.643000
2011-06-02T15:38:39.193000
6,216,740
6,216,772
Can I use ASP.NET MVC3 exclusively as a RESTful Web Service?
I'm building a READ ONLY sencha-touch app for our local church. We use Vimeo to host all of our videos, and I'd like to integrate our Vimeo vids as well as our RSS feed into our web app. The rest of the "content" in the app will be static "info" as well as a contact form. My question is, is it kosher to ONLY use ASP.NE...
Yes, this works great. Just return a JsonResult. Here is an example I am using in production: public partial class StudentController: BaseController { public StudentController(RESTContext portalContext): base(portalContext) { } [HttpGet, Url("organizations/{organizationId?}/students")] public virtual JsonResult List(G...
Can I use ASP.NET MVC3 exclusively as a RESTful Web Service? I'm building a READ ONLY sencha-touch app for our local church. We use Vimeo to host all of our videos, and I'd like to integrate our Vimeo vids as well as our RSS feed into our web app. The rest of the "content" in the app will be static "info" as well as a ...
TITLE: Can I use ASP.NET MVC3 exclusively as a RESTful Web Service? QUESTION: I'm building a READ ONLY sencha-touch app for our local church. We use Vimeo to host all of our videos, and I'd like to integrate our Vimeo vids as well as our RSS feed into our web app. The rest of the "content" in the app will be static "i...
[ "web-services", "asp.net-mvc-3", "sencha-touch" ]
5
10
2,567
1
0
2011-06-02T15:33:53.420000
2011-06-02T15:36:49.283000
6,216,743
6,216,946
On load, redirect page in new tab/window
I have access to a page template but no access to the header template (don't ask me how!), I need to create an instant page redirect on that template. It's needs to open in a new window. It doesn't really matter how it's done just that it opens in a new window and please bear in mind I don't have access to the header t...
I could be a bit off here (please correct me if i am) but, you just the page to open a new page then something like this See this for detailed usage of window.open. You can pass html into the function as well. Or if you were just wanting a redirect to an existing page then See this for detailed usage of window.location...
On load, redirect page in new tab/window I have access to a page template but no access to the header template (don't ask me how!), I need to create an instant page redirect on that template. It's needs to open in a new window. It doesn't really matter how it's done just that it opens in a new window and please bear in...
TITLE: On load, redirect page in new tab/window QUESTION: I have access to a page template but no access to the header template (don't ask me how!), I need to create an instant page redirect on that template. It's needs to open in a new window. It doesn't really matter how it's done just that it opens in a new window ...
[ "html", "redirect" ]
5
8
60,924
1
0
2011-06-02T15:34:08.973000
2011-06-02T15:53:40.330000
6,216,754
6,217,032
IE8/Compat View Bug - All images stack on each other at top of Div. Need Help
A very strange behavior is occuring on the website I'm working on in a animal display list. The animals are laid out in a grid format. When in IE8 and with compat mode turned on, the animals pictures all shoot to the top of the screen and stack under each other. This is completely perplexing to me. I need to call upon ...
Certianly you need to clean up your markup and not use a and structure with all the nested when a simple would do nicely. Also, you can get a little closer by changing div.center-photo-box-1 to have position:relative instead of static. that will get you closer...
IE8/Compat View Bug - All images stack on each other at top of Div. Need Help A very strange behavior is occuring on the website I'm working on in a animal display list. The animals are laid out in a grid format. When in IE8 and with compat mode turned on, the animals pictures all shoot to the top of the screen and sta...
TITLE: IE8/Compat View Bug - All images stack on each other at top of Div. Need Help QUESTION: A very strange behavior is occuring on the website I'm working on in a animal display list. The animals are laid out in a grid format. When in IE8 and with compat mode turned on, the animals pictures all shoot to the top of ...
[ "html", "css", "internet-explorer-8", "internet-explorer-7" ]
2
1
348
3
0
2011-06-02T15:35:31.593000
2011-06-02T16:00:48.577000
6,216,761
6,216,845
Ruby Undefined Local Variable
The following is code from an ERB tutorial. When I tried to execute the code, the compiler complained saying "(erb):16: undefined local variable or method `priority' for main:Object (NameError)". I cannot figure out the reason. Could someone please help me out? require "erb" # Create template. template = %q{ From: Jam...
That ERB template looks mangled, a problem caused by your indentation. You just need to fix the middle: <% priorities.each do |priority| %> * <%= priority %> <% end %> The alternate syntax is to have a % at the very beginning of the line. In your case you have inadvertently added some spaces which are rendering that pa...
Ruby Undefined Local Variable The following is code from an ERB tutorial. When I tried to execute the code, the compiler complained saying "(erb):16: undefined local variable or method `priority' for main:Object (NameError)". I cannot figure out the reason. Could someone please help me out? require "erb" # Create temp...
TITLE: Ruby Undefined Local Variable QUESTION: The following is code from an ERB tutorial. When I tried to execute the code, the compiler complained saying "(erb):16: undefined local variable or method `priority' for main:Object (NameError)". I cannot figure out the reason. Could someone please help me out? require "e...
[ "ruby", "undefined", "erb", "local-variables" ]
0
0
1,088
1
0
2011-06-02T15:36:12.543000
2011-06-02T15:42:42.497000
6,216,768
6,216,785
Are arrays being transformed when using an enhanced for loop?
Does Java 5 or higher apply some of form of "boxing" to arrays? This question came to mind as the following code goes through an array as if it's an Iterable. for( String: args ){ // Do stuff }
No, arrays are always reference types. There's no need for boxing or unboxing, unless it's on the access for each element. For example: int[] x = new int[10]; // The value of x is a reference int y = x[0]; // No boxing Integer z = x[1]; // Boxing conversion from x[1] (which is an int) to Integer Also note that althoug...
Are arrays being transformed when using an enhanced for loop? Does Java 5 or higher apply some of form of "boxing" to arrays? This question came to mind as the following code goes through an array as if it's an Iterable. for( String: args ){ // Do stuff }
TITLE: Are arrays being transformed when using an enhanced for loop? QUESTION: Does Java 5 or higher apply some of form of "boxing" to arrays? This question came to mind as the following code goes through an array as if it's an Iterable. for( String: args ){ // Do stuff } ANSWER: No, arrays are always reference types...
[ "java", "arrays", "unboxing" ]
1
2
268
4
0
2011-06-02T15:36:29.850000
2011-06-02T15:38:00.890000
6,216,771
6,216,792
What are these diagrams called? (answer : railroad diagrams)
I have seen a lot of these diagrams in some help files and src documentation What are they called? Are there any other (for same purpose) known diagrams? Img source: http://www.sqlite.org/images/syntax/insert-stmt.gif
They are called "railroad diagrams", because of their resemblance to a railroad track. They were often used to describe the grammar of older languages, before more formal grammars became routinely used. The problem with them is you can't easily feed them into tools like parser generators, or grammar checkers, so they a...
What are these diagrams called? (answer : railroad diagrams) I have seen a lot of these diagrams in some help files and src documentation What are they called? Are there any other (for same purpose) known diagrams? Img source: http://www.sqlite.org/images/syntax/insert-stmt.gif
TITLE: What are these diagrams called? (answer : railroad diagrams) QUESTION: I have seen a lot of these diagrams in some help files and src documentation What are they called? Are there any other (for same purpose) known diagrams? Img source: http://www.sqlite.org/images/syntax/insert-stmt.gif ANSWER: They are calle...
[ "diagram", "sequence-diagram", "diagramming" ]
4
9
953
2
0
2011-06-02T15:36:48.520000
2011-06-02T15:38:25.450000
6,216,787
6,216,874
simultaneous page load and ajax call
I have a web application with some pages take quite a long time to load because of what they have to do in code behind. I would like to show what is going on to the user by showing the different status of the process. I was thinking about calling recursively (by ajax) a page which ready a value in the session. This val...
The usual pattern here is to load an initial status page that triggers an AJAX call to retrieve the final version of the page, overwriting the original with the result of your AJAX call when it completes.
simultaneous page load and ajax call I have a web application with some pages take quite a long time to load because of what they have to do in code behind. I would like to show what is going on to the user by showing the different status of the process. I was thinking about calling recursively (by ajax) a page which r...
TITLE: simultaneous page load and ajax call QUESTION: I have a web application with some pages take quite a long time to load because of what they have to do in code behind. I would like to show what is going on to the user by showing the different status of the process. I was thinking about calling recursively (by aj...
[ "asp.net", "ajax", "load" ]
0
0
387
2
0
2011-06-02T15:38:06.177000
2011-06-02T15:46:17.660000
6,216,797
6,224,471
Flash Builder: "Access of undefined property Bindable"
I have inherited an Adobe AIR application, and am attempting to debug it through Flash Builder 4.5. Within Flash Builder, when I look at one of the MXML files, I see warnings for each use of the [Bindable] tag: [Bindable] internal var selectedPreviousID:String=null; [Bindable] internal var recent:mx.collections.ArrayC...
By removing elements from the code one by one, I discovered that the warnings somehow appear to have been caused by an element declaration earlier: Specifically, if I remove the inline 'operations' attribute - then the warnings against Bindable disappear. Must be triggering some issue with the parser. Further testing r...
Flash Builder: "Access of undefined property Bindable" I have inherited an Adobe AIR application, and am attempting to debug it through Flash Builder 4.5. Within Flash Builder, when I look at one of the MXML files, I see warnings for each use of the [Bindable] tag: [Bindable] internal var selectedPreviousID:String=null...
TITLE: Flash Builder: "Access of undefined property Bindable" QUESTION: I have inherited an Adobe AIR application, and am attempting to debug it through Flash Builder 4.5. Within Flash Builder, when I look at one of the MXML files, I see warnings for each use of the [Bindable] tag: [Bindable] internal var selectedPrev...
[ "apache-flex", "actionscript-3", "binding", "flash-builder" ]
3
3
1,671
1
0
2011-06-02T15:38:46.833000
2011-06-03T07:58:58.377000
6,216,801
6,217,136
PHP Structure - Interfaces and stdClass vars
I'm building a class to handle Paypal IPNs as part of a project, and since I already know i'm going to need to use it again in at least two more upcoming jobs - I want to make sure I structure it in a way that will allow me to re-use it without having to recode the class - I just want to have to handle changes in the b...
if you are using a class autoloader, which I highly recommend, you would not want to keep the interface and the class in the same file so that the interface can autoload without needing to first load this one class that implements it. For more info on autoloading: http://php.net/manual/en/language.oop5.autoload.php ano...
PHP Structure - Interfaces and stdClass vars I'm building a class to handle Paypal IPNs as part of a project, and since I already know i'm going to need to use it again in at least two more upcoming jobs - I want to make sure I structure it in a way that will allow me to re-use it without having to recode the class - I...
TITLE: PHP Structure - Interfaces and stdClass vars QUESTION: I'm building a class to handle Paypal IPNs as part of a project, and since I already know i'm going to need to use it again in at least two more upcoming jobs - I want to make sure I structure it in a way that will allow me to re-use it without having to re...
[ "php", "oop" ]
7
5
1,964
1
0
2011-06-02T15:39:04.243000
2011-06-02T16:09:53.717000
6,216,802
6,216,909
Implementing Real Time frequency spectrum for a beginner
I want to develop an application that would take audio(.wav) as input and display its real time simultaneous frequency spectrum. From what i have looked upon the subject, this requires fourier transform of the waves. Can someone suggest where i should start with? Possible references and books. I want to learn the detai...
There are already many libraries to do FFTs for you. No reason to reinvent the wheel. DirectX has an implementation but it might only be in the most recent version. Here's an open source C library for it. If you want to understand the math behind it, here's a simple explanation and here's a complicated explanation.
Implementing Real Time frequency spectrum for a beginner I want to develop an application that would take audio(.wav) as input and display its real time simultaneous frequency spectrum. From what i have looked upon the subject, this requires fourier transform of the waves. Can someone suggest where i should start with?...
TITLE: Implementing Real Time frequency spectrum for a beginner QUESTION: I want to develop an application that would take audio(.wav) as input and display its real time simultaneous frequency spectrum. From what i have looked upon the subject, this requires fourier transform of the waves. Can someone suggest where i ...
[ "c++", "signal-processing", "fft", "frequency-analysis" ]
4
5
5,597
4
0
2011-06-02T15:39:06.130000
2011-06-02T15:49:24.680000
6,216,803
6,216,956
Using CASE statements as a precursor for COUNT function in single (large) SQL query, syntax
I'm having trouble incorporating a bit of logic into a large SQL query. I'm using SQL Server Reporting Services 2005 with the Report Designer, and it only gives you one area to define a single SQL query to populate the report with. Hopefully someone can tell me what's wrong with my syntax so I can get it running. I nee...
I haven't tried to unravel your whole statement, but it sounds like you want to use your CASE statement like this: SUM(CASE WHEN BIAdmin.Item.ItemStatus = 'inactive' THEN 0 ELSE 1 END) As ActiveItemCount This statement would go in your select clause rather than in your where clause. Using "Like" the way you isn't going...
Using CASE statements as a precursor for COUNT function in single (large) SQL query, syntax I'm having trouble incorporating a bit of logic into a large SQL query. I'm using SQL Server Reporting Services 2005 with the Report Designer, and it only gives you one area to define a single SQL query to populate the report wi...
TITLE: Using CASE statements as a precursor for COUNT function in single (large) SQL query, syntax QUESTION: I'm having trouble incorporating a bit of logic into a large SQL query. I'm using SQL Server Reporting Services 2005 with the Report Designer, and it only gives you one area to define a single SQL query to popu...
[ "sql", "sql-server", "sql-server-2005", "reporting-services", "report-designer" ]
1
2
1,932
3
0
2011-06-02T15:39:08.097000
2011-06-02T15:54:46.280000
6,216,805
6,216,974
magento memory problem, cannot unset objects
i am writing a magento product exporter, that writes a couple of attributes into a csv file. one attribute is called the "category string" and its method looks like:... foreach($products as $_product) {... $productId = $_product->getSku(); $productCategory = getCategoryString($_product['category_ids']);... }... funct...
We had the same problem with a cron for Magento, I know that it isn't the best way to do it but we needed to do it quickly. Our solution was creating a new PHP file with the necessary code to do one single operation. From magento we get a product list and then call with exec() to this external PHP file product by produ...
magento memory problem, cannot unset objects i am writing a magento product exporter, that writes a couple of attributes into a csv file. one attribute is called the "category string" and its method looks like:... foreach($products as $_product) {... $productId = $_product->getSku(); $productCategory = getCategoryStri...
TITLE: magento memory problem, cannot unset objects QUESTION: i am writing a magento product exporter, that writes a couple of attributes into a csv file. one attribute is called the "category string" and its method looks like:... foreach($products as $_product) {... $productId = $_product->getSku(); $productCategory...
[ "php", "memory", "magento", "export", "unset" ]
1
1
2,194
2
0
2011-06-02T15:39:13.840000
2011-06-02T15:56:15.390000
6,216,809
6,232,508
Executing a fetch request on another thread
I want to make a CoreData fetch request on a background thread in order to give the user the option to cancel it. Below is my background thread code: - (void)searchDailyNotes { NSEntityDescription *entity = [NSEntityDescription entityForName:@"DailyNotes" inManagedObjectContext:self.managedObjectContext]; NSString *se...
Cocoa threading doesn't generally include the idea of forcing a thread to abort. You'll see a cancel method, but that's strictly advisory. The idea is that the code in the thread will check this state periodically and exit early if a cancel has been requested. You'll see this in NSThread and NSOperation, for example. I...
Executing a fetch request on another thread I want to make a CoreData fetch request on a background thread in order to give the user the option to cancel it. Below is my background thread code: - (void)searchDailyNotes { NSEntityDescription *entity = [NSEntityDescription entityForName:@"DailyNotes" inManagedObjectConte...
TITLE: Executing a fetch request on another thread QUESTION: I want to make a CoreData fetch request on a background thread in order to give the user the option to cancel it. Below is my background thread code: - (void)searchDailyNotes { NSEntityDescription *entity = [NSEntityDescription entityForName:@"DailyNotes" in...
[ "cocoa", "core-data" ]
1
1
556
1
0
2011-06-02T15:39:27.973000
2011-06-03T20:48:18.073000
6,216,810
6,217,059
How do I extend a model in Rails?
I need to extend a model in a Rails 2.3.11 app without touching the original source file. I need to add a:has_many association in it. I've tried the approach mentioned in Extend model in plugin with "has_many" using a module without success. The class I need to extend is called UbiquoUser. Here the code I have in lib/e...
The problem you have now is that you are extending your class, not including a module into it, so the Sicada::Extensions::UbiquoUser#included method never gets called. To fix this, change this line: UbiquoUser.send(:extend, Sindicada::Extensions::UbiquoUser) to UbiquoUser.send(:include, Sindicada::Extensions::UbiquoUse...
How do I extend a model in Rails? I need to extend a model in a Rails 2.3.11 app without touching the original source file. I need to add a:has_many association in it. I've tried the approach mentioned in Extend model in plugin with "has_many" using a module without success. The class I need to extend is called UbiquoU...
TITLE: How do I extend a model in Rails? QUESTION: I need to extend a model in a Rails 2.3.11 app without touching the original source file. I need to add a:has_many association in it. I've tried the approach mentioned in Extend model in plugin with "has_many" using a module without success. The class I need to extend...
[ "ruby-on-rails", "ruby" ]
0
1
838
1
0
2011-06-02T15:39:29.453000
2011-06-02T16:03:21.743000
6,216,812
6,219,394
Looking for guidance on WF4
We have a rather large document routing framework that's currently implemented in SharePoint (with a large set of cumbersome SP workflows), and it's running into the edge of what SP can do easily. It's slated for a rewrite into.NET I've spent the past week or so reading and watching WF4 discussions and demonstrations t...
To send messages to a specific workflow instance you need to set up message correlation between your different Receive activities. In order to do that you need some unique value as part of your message data. The Appfabric logging works well but if you want to create custom a custom logging solution you don't need to ad...
Looking for guidance on WF4 We have a rather large document routing framework that's currently implemented in SharePoint (with a large set of cumbersome SP workflows), and it's running into the edge of what SP can do easily. It's slated for a rewrite into.NET I've spent the past week or so reading and watching WF4 disc...
TITLE: Looking for guidance on WF4 QUESTION: We have a rather large document routing framework that's currently implemented in SharePoint (with a large set of cumbersome SP workflows), and it's running into the edge of what SP can do easily. It's slated for a rewrite into.NET I've spent the past week or so reading and...
[ "workflow-foundation-4", "workflowservice" ]
2
2
535
2
0
2011-06-02T15:39:36.757000
2011-06-02T19:29:38.923000
6,216,820
6,216,948
using jquery - 2 different links that open the same window but display the appropriate content?
I'm trying to work out how this can be achieved using jQuery, I have page 1 which has 2 links namely link 1 and link 2, what I want to achieve is when I click link 1 a new browser window is opened displaying the content for link 1 and when I click link 2 the same window is displayed but with the content for link 2. Is ...
Give this a shot... I'm using the rel attribute of the link to point to the content, and a class on these links, which allows the click handler to work for any number of links/windows. This displays for link1 This displays for link2 Link 1 Link 2
using jquery - 2 different links that open the same window but display the appropriate content? I'm trying to work out how this can be achieved using jQuery, I have page 1 which has 2 links namely link 1 and link 2, what I want to achieve is when I click link 1 a new browser window is opened displaying the content for ...
TITLE: using jquery - 2 different links that open the same window but display the appropriate content? QUESTION: I'm trying to work out how this can be achieved using jQuery, I have page 1 which has 2 links namely link 1 and link 2, what I want to achieve is when I click link 1 a new browser window is opened displayin...
[ "javascript", "jquery" ]
0
2
1,021
2
0
2011-06-02T15:40:23.340000
2011-06-02T15:53:50.227000
6,216,834
6,249,852
How can I have Packed decimal and normal text in a single file?
I need to generate a fixed width file with few of the columns in packed decimal format and few of the columns in normal number format. I was able to generate. I zipped the file and passed it on to the mainframe team. They imported it and unzipped the file and converted to EBCDIC. They were able to get the packed decima...
As you are coding in Java and you require a mix of EBCDIC and COMP-3 in your output you wiil need to do the unicode to EBCDIC conversion in your own program. You cannot leave this up to the file transfer utility as it will corrupt your COMP-3 fields. But luckily you are using Java so its easy using the getBytes method ...
How can I have Packed decimal and normal text in a single file? I need to generate a fixed width file with few of the columns in packed decimal format and few of the columns in normal number format. I was able to generate. I zipped the file and passed it on to the mainframe team. They imported it and unzipped the file ...
TITLE: How can I have Packed decimal and normal text in a single file? QUESTION: I need to generate a fixed width file with few of the columns in packed decimal format and few of the columns in normal number format. I was able to generate. I zipped the file and passed it on to the mainframe team. They imported it and ...
[ "decimal", "cobol", "ebcdic", "packed-decimal" ]
2
2
8,020
4
0
2011-06-02T15:41:53.293000
2011-06-06T09:14:25.383000
6,216,846
6,226,694
CSS3 transition problem on iOS devices
I'm trying out some webkit transitions on a site and have come across a problem on iOS devices. I have six images being given a random rotation every second. The transition works fine for five out of the six images but for some reason when using the iPad or the iPhone the sixth image disappears during the transition. Y...
Your z-index values are starting from -2. In my experience Webkit doesn't mind that you use negative values, but it seems Mobile Webkit does. If you put a border on.b1_needle you will notice it appears below.bigOne, despite having a z-index of 100. Start your z-indexes from 0 and then go up. Copy and paste this CSS to ...
CSS3 transition problem on iOS devices I'm trying out some webkit transitions on a site and have come across a problem on iOS devices. I have six images being given a random rotation every second. The transition works fine for five out of the six images but for some reason when using the iPad or the iPhone the sixth im...
TITLE: CSS3 transition problem on iOS devices QUESTION: I'm trying out some webkit transitions on a site and have come across a problem on iOS devices. I have six images being given a random rotation every second. The transition works fine for five out of the six images but for some reason when using the iPad or the i...
[ "ipad", "css", "webkit", "mobile-website", "css-transitions" ]
0
2
8,771
1
0
2011-06-02T15:42:42.763000
2011-06-03T11:45:59.043000
6,216,854
6,217,087
OpenGL on Android: Any conflicts when calling OpenGL functions in both Java and C++?
In my application, I'm using a 3rd party custom view that calls OpenGL functions in Java, and I'm also calling OpenGL functions in my native C++ code. Should this be a problem? Is there any risk that they could be called at the same time? What is the threading order of OpenGL calls across java/c++?
This should not be a problem, as long as you know what you're doing. The OpenGL Java bindings in Android basically just call the same c++ function. There's not more logic in those calls. So you can basically think of those calls in the same way as if they were direct c++ code. The problem that you are more likely to ru...
OpenGL on Android: Any conflicts when calling OpenGL functions in both Java and C++? In my application, I'm using a 3rd party custom view that calls OpenGL functions in Java, and I'm also calling OpenGL functions in my native C++ code. Should this be a problem? Is there any risk that they could be called at the same ti...
TITLE: OpenGL on Android: Any conflicts when calling OpenGL functions in both Java and C++? QUESTION: In my application, I'm using a 3rd party custom view that calls OpenGL functions in Java, and I'm also calling OpenGL functions in my native C++ code. Should this be a problem? Is there any risk that they could be cal...
[ "java", "c++", "android", "opengl-es", "native" ]
4
3
874
3
0
2011-06-02T15:43:50.050000
2011-06-02T16:05:50.160000
6,216,858
6,217,135
Generic Service Contract
I need to have a generic Service contract but if I do that I receive this error: [ServiceContract] public interface IService where T: MyClass { [OperationContract] void DoWork(); } The contract name 'x.y' could not be found in the list of contracts implemented by the service 'z.t'.
As long as you use a closed generic for your interface it does work - see below. What you cannot do is to have an open generic as the contract type. public class StackOverflow_6216858_751090 { public class MyClass { } [ServiceContract] public interface ITest where T: MyClass { [OperationContract] string Echo(string tex...
Generic Service Contract I need to have a generic Service contract but if I do that I receive this error: [ServiceContract] public interface IService where T: MyClass { [OperationContract] void DoWork(); } The contract name 'x.y' could not be found in the list of contracts implemented by the service 'z.t'.
TITLE: Generic Service Contract QUESTION: I need to have a generic Service contract but if I do that I receive this error: [ServiceContract] public interface IService where T: MyClass { [OperationContract] void DoWork(); } The contract name 'x.y' could not be found in the list of contracts implemented by the service '...
[ "wcf" ]
1
0
1,185
3
0
2011-06-02T15:44:22.013000
2011-06-02T16:09:46.237000
6,216,862
6,217,174
isapi rewrite rules remove blog from wordpress url
while i am new to rewrite I will try to outline this problem in english first than start a thread on how to fix this issue with all your help. I am trying to remove the folder /blog/ from the following url: http://blog.site.com/blog/2011/05/26/article-name-test/ with: http://blog.site.com/2011/05/26/article-name-test/
Put this code in your.htaccess file: Options +FollowSymlinks -MultiViews RewriteEngine on RewriteRule ^blog/?(.*)$ /$1 [R=301,L,NE,NC] Update: Based on your comments Here is your suggested.htaccess: RewriteCond %{HTTP_HOST} ^www\.site\.me$ [NC] RewriteRule ^ http://site.me%{REQUEST_URI} [R=301,L] RewriteCond %{HTTP_H...
isapi rewrite rules remove blog from wordpress url while i am new to rewrite I will try to outline this problem in english first than start a thread on how to fix this issue with all your help. I am trying to remove the folder /blog/ from the following url: http://blog.site.com/blog/2011/05/26/article-name-test/ with: ...
TITLE: isapi rewrite rules remove blog from wordpress url QUESTION: while i am new to rewrite I will try to outline this problem in english first than start a thread on how to fix this issue with all your help. I am trying to remove the folder /blog/ from the following url: http://blog.site.com/blog/2011/05/26/article...
[ "apache", "wordpress", "mod-rewrite", "url-rewriting", "isapi" ]
1
0
1,144
1
0
2011-06-02T15:44:33.587000
2011-06-02T16:12:31.527000
6,216,863
6,216,894
Create .wav file using C#
I have nessary chunk header bytes for a wave file stored in a text file. What I'd like to do is create a new.wav that will vary in data length and write into it 50ms/10kHz signals(which is stored in separate file). How can I accomplish with.NET/C#? -Mickey
Use the System.IO.BinaryReader and System.IO.BinaryWriter streams to read data from your signals files, write binary datatypes to a file, as per the wav file specification.
Create .wav file using C# I have nessary chunk header bytes for a wave file stored in a text file. What I'd like to do is create a new.wav that will vary in data length and write into it 50ms/10kHz signals(which is stored in separate file). How can I accomplish with.NET/C#? -Mickey
TITLE: Create .wav file using C# QUESTION: I have nessary chunk header bytes for a wave file stored in a text file. What I'd like to do is create a new.wav that will vary in data length and write into it 50ms/10kHz signals(which is stored in separate file). How can I accomplish with.NET/C#? -Mickey ANSWER: Use the Sy...
[ "c#" ]
0
4
1,347
1
0
2011-06-02T15:44:51.357000
2011-06-02T15:47:57.570000
6,216,882
6,217,494
NSUserDefaults standardUserDefaults not returning results
I created a settings.bundle and added a few items. Now I am trying to access their values from my application. I am using the standard Apple example: - (void)applicationDidFinishLaunching:(UIApplication *)application { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [self setShouldPlaySounds:[defaults...
Without any other code, I can only suggest that you are not setting SearchRadius and RecordReturnCount correctly. They would be along the lines of: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setFloat: searchRadius forKey: @"SearchRadius"]; [defaults setInteger: returnResults forKey: @"R...
NSUserDefaults standardUserDefaults not returning results I created a settings.bundle and added a few items. Now I am trying to access their values from my application. I am using the standard Apple example: - (void)applicationDidFinishLaunching:(UIApplication *)application { NSUserDefaults *defaults = [NSUserDefaults ...
TITLE: NSUserDefaults standardUserDefaults not returning results QUESTION: I created a settings.bundle and added a few items. Now I am trying to access their values from my application. I am using the standard Apple example: - (void)applicationDidFinishLaunching:(UIApplication *)application { NSUserDefaults *defaults ...
[ "objective-c", "nsuserdefaults" ]
0
0
2,787
1
0
2011-06-02T15:46:49.717000
2011-06-02T16:43:14.473000
6,216,884
6,216,928
How does this bouncing off object after collision detection code work?
Recently I was just reading the book XNA 4.0 Game Developmeny by Example. In one the of the chapters this code is written for bouncing (reflecting) the objects after collision detection: private void BounceAsteroids(Sprite asteroid1, Sprite asteroid2) { Vector2 cOfMass = (asteroid1.Velocity + asteroid2.Velocity) / 2; ...
this is trying to simulate a bounce. the Normalize and center calculations are making the blobs start the bounce when their edges touch, as opposed to when their centers might hit. then the velocity is changed according to some calculation involving masses of each asteroid. the Reflect function no doubt calculates some...
How does this bouncing off object after collision detection code work? Recently I was just reading the book XNA 4.0 Game Developmeny by Example. In one the of the chapters this code is written for bouncing (reflecting) the objects after collision detection: private void BounceAsteroids(Sprite asteroid1, Sprite asteroid...
TITLE: How does this bouncing off object after collision detection code work? QUESTION: Recently I was just reading the book XNA 4.0 Game Developmeny by Example. In one the of the chapters this code is written for bouncing (reflecting) the objects after collision detection: private void BounceAsteroids(Sprite asteroid...
[ "c#", "xna", "collision-detection", "game-physics" ]
2
2
1,500
1
0
2011-06-02T15:47:19.753000
2011-06-02T15:51:54.753000
6,216,888
6,217,178
Is NodeJs faster than Clojure?
I just started learning Clojure. One of the first things I noticed is that there are no loops. That's OK, I can recur. So let's look at this function (from Practical Clojure): (defn add-up "Adds up numbers from 1 to n" ([n] (add-up n 0 0)) ([n i sum] (if (< n i) sum (recur n (+ 1 i) (+ i sum))))) To achieve the same fu...
(set! *unchecked-math* true) (defn add-up ^long [^long n] (loop [n n i 0 sum 0] (if (< n i) sum (recur n (inc i) (+ i sum))))) (defn fib ^long [^long n] (if (<= n 1) 1 (+ (fib (dec n)) (fib (- n 2))))) (comment;; ~130ms (dotimes [_ 10] (time (add-up 1e8)));; ~1180ms (dotimes [_ 10] (time (fib 41))) ) All numbers fro...
Is NodeJs faster than Clojure? I just started learning Clojure. One of the first things I noticed is that there are no loops. That's OK, I can recur. So let's look at this function (from Practical Clojure): (defn add-up "Adds up numbers from 1 to n" ([n] (add-up n 0 0)) ([n i sum] (if (< n i) sum (recur n (+ 1 i) (+ i ...
TITLE: Is NodeJs faster than Clojure? QUESTION: I just started learning Clojure. One of the first things I noticed is that there are no loops. That's OK, I can recur. So let's look at this function (from Practical Clojure): (defn add-up "Adds up numbers from 1 to n" ([n] (add-up n 0 0)) ([n i sum] (if (< n i) sum (rec...
[ "javascript", "performance", "node.js", "clojure" ]
31
49
17,919
9
0
2011-06-02T15:47:36.177000
2011-06-02T16:13:03.787000
6,216,890
6,216,951
target both android and iphone with Python
I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I will run into?
You cannot use Python on either of Android or iPhone platforms. This is clearly outruled by Apple SDK license, while with Android there actually is an Android scripting environment, but you will quickly realize that is not meant for the final user. In any case, the fact that Python is not supported on iPhone rules this...
target both android and iphone with Python I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I will run into?
TITLE: target both android and iphone with Python QUESTION: I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I w...
[ "python", "android", "iphone", "beeware" ]
3
3
1,374
4
0
2011-06-02T15:47:42.040000
2011-06-02T15:54:06.077000
6,216,891
6,216,993
How to make an RPM package (without rpmbuild)
deb: fakeroot dpkb-build -b directory package.deb # Name, version, architecture, etc. are in directory/DEBIAN/control rpm: $SOME_COMMAND directory package.rpm # Name, version, architecture, etc. are in SOME_FILE What to use as SOME_COMMAND and SOME_FILE?
First it is not clear what kind of RPM package you intend to build. It is.src.rpm or a binary.rpm? RPM packages have a file format. This consists of a lead block, a number of header structures, a signature block, and an archive. It's like a ZIP file, but it contains extra information in binary at the beginning to ensur...
How to make an RPM package (without rpmbuild) deb: fakeroot dpkb-build -b directory package.deb # Name, version, architecture, etc. are in directory/DEBIAN/control rpm: $SOME_COMMAND directory package.rpm # Name, version, architecture, etc. are in SOME_FILE What to use as SOME_COMMAND and SOME_FILE?
TITLE: How to make an RPM package (without rpmbuild) QUESTION: deb: fakeroot dpkb-build -b directory package.deb # Name, version, architecture, etc. are in directory/DEBIAN/control rpm: $SOME_COMMAND directory package.rpm # Name, version, architecture, etc. are in SOME_FILE What to use as SOME_COMMAND and SOME_FILE? ...
[ "rpm", "rpmbuild" ]
3
2
2,653
1
0
2011-06-02T15:47:42.633000
2011-06-02T15:57:50.810000
6,216,893
6,217,078
Can I turn off the email address validation in System.Net.Mail?
I'm trying to talk to Fax server software using an email. The fax server will accept formatted SMTP mails and covert them to faxes and send them to the fax number defined in the to address. This has been manually tested by sending an email from Outlook via the same server. Here's my problem - System.Net.Mail is throwin...
No, you cannot turn that validation off. EDIT: After looking in to this a little bit it seems as if the following code snippet would be a feasible workaround: ConstructorInfo ctor = typeof(MailAddress).GetConstructor( BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(string), typeof(string), typ...
Can I turn off the email address validation in System.Net.Mail? I'm trying to talk to Fax server software using an email. The fax server will accept formatted SMTP mails and covert them to faxes and send them to the fax number defined in the to address. This has been manually tested by sending an email from Outlook via...
TITLE: Can I turn off the email address validation in System.Net.Mail? QUESTION: I'm trying to talk to Fax server software using an email. The fax server will accept formatted SMTP mails and covert them to faxes and send them to the fax number defined in the to address. This has been manually tested by sending an emai...
[ "c#", "email", "system.net.mail" ]
8
7
3,777
4
0
2011-06-02T15:47:45.910000
2011-06-02T16:04:41.993000
6,216,897
6,217,250
Rails creating bulk objects via a web service
I'm writing a rails web-hooks service consumer that receives bulk objects in nested XML and need to save certain fields in each node. When the XML data hits my create action in my HooksController, the XML is automatically converted into a hash that looks like this. Parameters: {"Events"=>{"RecordSet"=>{"Record"=>[{"SEN...
You'll need to write some manual code to do this. How about something like: params["Events"]["RecordSet"]["Record"].each do |h| ExternalEvent.create(h.merge({:MSISDN => h["SENDER_MSISDN"] })) end If you need to remove certain fields then you can use the delete_if method for Hash. For example: h.merge(..).delete_if {|ke...
Rails creating bulk objects via a web service I'm writing a rails web-hooks service consumer that receives bulk objects in nested XML and need to save certain fields in each node. When the XML data hits my create action in my HooksController, the XML is automatically converted into a hash that looks like this. Paramete...
TITLE: Rails creating bulk objects via a web service QUESTION: I'm writing a rails web-hooks service consumer that receives bulk objects in nested XML and need to save certain fields in each node. When the XML data hits my create action in my HooksController, the XML is automatically converted into a hash that looks l...
[ "ruby-on-rails", "nokogiri", "observer-pattern", "bulkinsert", "webhooks" ]
0
0
300
2
0
2011-06-02T15:48:26.237000
2011-06-02T16:19:15.147000
6,216,901
6,219,845
Why can't I use Telerik's RadPanelBar with a standard collection of objects?
I am trying to use Telerik's RadPanelBar to display a list of objects. I would like the name to display when it is collapsed, and the object to display when expanded. For some reason this doesn't seem to work. Am I using this control incorrectly?? The Control renders correctly, with the correct number of items, however...
For whatever reason, the RadPanelBar needs to be bound to a collection within a collection. It doesn't work with a single object. A workaround I use is this: In my ContactClass I added a collection just for this.... private ObservableCollection _forTelerik; public ObservableCollection ObnoxiousWorkaroundForTelerik { ge...
Why can't I use Telerik's RadPanelBar with a standard collection of objects? I am trying to use Telerik's RadPanelBar to display a list of objects. I would like the name to display when it is collapsed, and the object to display when expanded. For some reason this doesn't seem to work. Am I using this control incorrect...
TITLE: Why can't I use Telerik's RadPanelBar with a standard collection of objects? QUESTION: I am trying to use Telerik's RadPanelBar to display a list of objects. I would like the name to display when it is collapsed, and the object to display when expanded. For some reason this doesn't seem to work. Am I using this...
[ "wpf", "xaml", "telerik" ]
0
1
2,131
2
0
2011-06-02T15:48:30.373000
2011-06-02T20:15:14.860000
6,216,906
6,217,002
How do I store a SecureString in the registry?
I want to store a System.SecureString in the registry. Is that possible? And how would I go about doing it? Would my program be able to decrypt the string again when running the next time?
It's not possible to do in encrypted form without a helper layer. It' doesn't natively support any form of serialization and in fact cannot even be inspected in it's native form. To even get any information out of it you need to go through PInvoke or the SecureStringToBSTR API. Both of which will give you access to the...
How do I store a SecureString in the registry? I want to store a System.SecureString in the registry. Is that possible? And how would I go about doing it? Would my program be able to decrypt the string again when running the next time?
TITLE: How do I store a SecureString in the registry? QUESTION: I want to store a System.SecureString in the registry. Is that possible? And how would I go about doing it? Would my program be able to decrypt the string again when running the next time? ANSWER: It's not possible to do in encrypted form without a helpe...
[ ".net", "windows", "registry" ]
1
3
1,282
2
0
2011-06-02T15:49:18.570000
2011-06-02T15:58:13.300000
6,216,920
6,229,606
Best practice to support portrait and landscape views in a UINavigationController
I searched high and low and I'm not sure what I came out with is the best way of dealing with this (though it seems the only one). According to Want to use muliple nibs for different iphone interface orientations I implemented the relevant methods, and everything seems to work fine. Unfortunately I have to deal with a ...
I set up a sample project to demonstrate how I "solved" my problem. It's probably not the only way, nor the best way, but due to documentation, or lack thereof, this is the best I came up with. https://github.com/Morpheu5/Rotation
Best practice to support portrait and landscape views in a UINavigationController I searched high and low and I'm not sure what I came out with is the best way of dealing with this (though it seems the only one). According to Want to use muliple nibs for different iphone interface orientations I implemented the relevan...
TITLE: Best practice to support portrait and landscape views in a UINavigationController QUESTION: I searched high and low and I'm not sure what I came out with is the best way of dealing with this (though it seems the only one). According to Want to use muliple nibs for different iphone interface orientations I imple...
[ "ios", "uinavigationcontroller", "uitabbarcontroller", "landscape", "portrait" ]
5
2
3,511
1
0
2011-06-02T15:51:01.510000
2011-06-03T16:00:08.977000
6,216,921
6,216,985
jQuery validator - Decimal not validating correctly
Possible Duplicate: Jquery validation - allow number without the leading zero? I am using the jQuery validator script to validate a field to ensure their is a number entered. The number should allow for a decimal point. If I put a number before the decimal point, the validator passes (ex. 2.5). If I don't put a number ...
Try using * (0 or more) instead of + (1 or more): /^-?(?:\d*|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/
jQuery validator - Decimal not validating correctly Possible Duplicate: Jquery validation - allow number without the leading zero? I am using the jQuery validator script to validate a field to ensure their is a number entered. The number should allow for a decimal point. If I put a number before the decimal point, the ...
TITLE: jQuery validator - Decimal not validating correctly QUESTION: Possible Duplicate: Jquery validation - allow number without the leading zero? I am using the jQuery validator script to validate a field to ensure their is a number entered. The number should allow for a decimal point. If I put a number before the d...
[ "javascript", "jquery", "regex", "jquery-validate" ]
1
3
2,366
1
0
2011-06-02T15:51:23.700000
2011-06-02T15:57:06.007000
6,216,930
6,218,360
Drupal 7: How to load js and css files on different pages
What is the best way to load a js and css file on certain pages (not on every single page like happens when using the.info file)?
If the pages contain a form, you can use something similar to the following code: $form['#attached']['css'] = array( drupal_get_path('module', 'ajax_example'). '/ajax_example.css', ); $form['#attached']['js'] = array( drupal_get_path('module', 'ajax_example'). '/ajax_example.js', );
Drupal 7: How to load js and css files on different pages What is the best way to load a js and css file on certain pages (not on every single page like happens when using the.info file)?
TITLE: Drupal 7: How to load js and css files on different pages QUESTION: What is the best way to load a js and css file on certain pages (not on every single page like happens when using the.info file)? ANSWER: If the pages contain a form, you can use something similar to the following code: $form['#attached']['css...
[ "drupal", "drupal-7" ]
1
1
2,921
2
0
2011-06-02T15:51:58.470000
2011-06-02T18:01:07.937000
6,216,931
6,217,677
How to build an interop with a COM class (written in delphi)
We have a COM dll written in delphi in our bin folder that call 2 static dll in the system32 folder (also COM in delphi). My question is, how can we transform that dll in delphi into an interop dll? Or is there any better way to do this? Thanks!
.net consumes COM objects with ease. There's no need for interop, just import the type libraries and off you go! MSDN has a comprehensive tutorial.
How to build an interop with a COM class (written in delphi) We have a COM dll written in delphi in our bin folder that call 2 static dll in the system32 folder (also COM in delphi). My question is, how can we transform that dll in delphi into an interop dll? Or is there any better way to do this? Thanks!
TITLE: How to build an interop with a COM class (written in delphi) QUESTION: We have a COM dll written in delphi in our bin folder that call 2 static dll in the system32 folder (also COM in delphi). My question is, how can we transform that dll in delphi into an interop dll? Or is there any better way to do this? Tha...
[ ".net", "delphi", "dll", "com", "interop" ]
2
2
453
2
0
2011-06-02T15:52:11.357000
2011-06-02T17:01:38.853000
6,216,935
6,216,963
problem in setting parameters for NSMutableURLRequest ( POST request)
am setting the parameters(key-value pairs - user name, password, email id) for NSMutableURLRequest(POST) using the class method + (void)setProperty:(id)value forKey:(NSString *)key inRequest:(NSMutableURLRequest *)request and requesting the server using sendSynchronous. But at the server end, the parameters are null. p...
Use ASIFormDataRequest. Its -setPostValue:forKey: method makes POSTing data as application/x-www-urlformencoded or multipart/form-data dead simple. If you want to use NSURLRequest instead, check out the OAuthConsumer project for an example of using application/x-www-form-urlencoded. Start by reading -setParameters: in ...
problem in setting parameters for NSMutableURLRequest ( POST request) am setting the parameters(key-value pairs - user name, password, email id) for NSMutableURLRequest(POST) using the class method + (void)setProperty:(id)value forKey:(NSString *)key inRequest:(NSMutableURLRequest *)request and requesting the server us...
TITLE: problem in setting parameters for NSMutableURLRequest ( POST request) QUESTION: am setting the parameters(key-value pairs - user name, password, email id) for NSMutableURLRequest(POST) using the class method + (void)setProperty:(id)value forKey:(NSString *)key inRequest:(NSMutableURLRequest *)request and reques...
[ "iphone", "objective-c", "http", "post", "http-post" ]
0
2
2,660
1
0
2011-06-02T15:52:29.360000
2011-06-02T15:55:33.237000
6,216,944
6,217,262
Can jQuery-UI safely be used without the CSS assets?
Can jQuery-UI safely be used without including the CSS assets? Google hosts the JS file, but I don't see any references on that page to the jQuery-UI CSS resources. What problems or issues can I expect if I include only jquery-ui.js?
You'd go from something like this (with jQuery UI CSS): To something like this (no jQuery UI CSS): Use the link @Ates Goral posted in comments or Xavi - Links to jQuery UI CSS themes hosted on Google's CDN for a hosted stylesheet Update: For reference sake, the path for the Google CDN jQuery UI CSS is http:// ajax.goog...
Can jQuery-UI safely be used without the CSS assets? Can jQuery-UI safely be used without including the CSS assets? Google hosts the JS file, but I don't see any references on that page to the jQuery-UI CSS resources. What problems or issues can I expect if I include only jquery-ui.js?
TITLE: Can jQuery-UI safely be used without the CSS assets? QUESTION: Can jQuery-UI safely be used without including the CSS assets? Google hosts the JS file, but I don't see any references on that page to the jQuery-UI CSS resources. What problems or issues can I expect if I include only jquery-ui.js? ANSWER: You'd ...
[ "javascript", "jquery", "css", "jquery-ui", "google-cdn" ]
6
8
3,422
1
0
2011-06-02T15:53:30.903000
2011-06-02T16:20:58.060000
6,216,945
6,216,987
simplify/reduce code - if
$form = array(); $form = $_POST['data']; function livre($form) { if (empty($form["radios"]) || empty($form["age"]) || empty($form["gender"]) || empty($form["civil"]) || empty($form["formation_area"]) || empty($form["scholarithy"]) || empty($form["professional_activity"]) || empty($form["city_work"]) || empty($form["co...
You can store all the field names that have to be tested in an array: $fields = array('radios', 'age',...); and then loop over it: foreach($fields as $field) { if(empty($form[$field])) { echo 'empty'; break; } } Side note: You don't need $form = array();.
simplify/reduce code - if $form = array(); $form = $_POST['data']; function livre($form) { if (empty($form["radios"]) || empty($form["age"]) || empty($form["gender"]) || empty($form["civil"]) || empty($form["formation_area"]) || empty($form["scholarithy"]) || empty($form["professional_activity"]) || empty($form["city_...
TITLE: simplify/reduce code - if QUESTION: $form = array(); $form = $_POST['data']; function livre($form) { if (empty($form["radios"]) || empty($form["age"]) || empty($form["gender"]) || empty($form["civil"]) || empty($form["formation_area"]) || empty($form["scholarithy"]) || empty($form["professional_activity"]) || ...
[ "php", "arrays" ]
1
5
115
7
0
2011-06-02T15:53:31.963000
2011-06-02T15:57:17.533000
6,216,953
6,220,671
WCF authentication on IIS7 shared hosting
After several days of tests I find the only way I can create a WCF web service with authentication is to put a certificate in localmachine/trustedpeople cert store. The host will not do this for me. Do you know any way to enable WCF authentication without putting a cert in that store? Is there any other way to get WCF ...
I did some very simple test on my local IIS. I have very simple service with single method. To expose the service I use this configuration: The configuration defines: Two custom appSettings describing path to the certificate and password. Single service with configuration based activation - it will have default endpoin...
WCF authentication on IIS7 shared hosting After several days of tests I find the only way I can create a WCF web service with authentication is to put a certificate in localmachine/trustedpeople cert store. The host will not do this for me. Do you know any way to enable WCF authentication without putting a cert in that...
TITLE: WCF authentication on IIS7 shared hosting QUESTION: After several days of tests I find the only way I can create a WCF web service with authentication is to put a certificate in localmachine/trustedpeople cert store. The host will not do this for me. Do you know any way to enable WCF authentication without putt...
[ "wcf", "wcf-security", "shared-hosting" ]
2
3
580
1
0
2011-06-02T15:54:15.200000
2011-06-02T21:36:05.733000
6,216,959
6,217,052
Linux tool/editor that will nicely auto-format my code AFTER it's written
I'm looking for a tool or editor where I can paste in potentially messy code, be it HTML, Javascript, CSS, whatever, and properly take care of all indentation and spacing. I use Geany but I don't see an option for this, surprisingly. I don't know if it's possible in vim or emacs. Any help would be appreciated. Example ...
Both vim and emacs will let you do what you ask. I believe in vim you want to use 'gg=G', and emacs is C-x C-M-\ I hope this helps.
Linux tool/editor that will nicely auto-format my code AFTER it's written I'm looking for a tool or editor where I can paste in potentially messy code, be it HTML, Javascript, CSS, whatever, and properly take care of all indentation and spacing. I use Geany but I don't see an option for this, surprisingly. I don't know...
TITLE: Linux tool/editor that will nicely auto-format my code AFTER it's written QUESTION: I'm looking for a tool or editor where I can paste in potentially messy code, be it HTML, Javascript, CSS, whatever, and properly take care of all indentation and spacing. I use Geany but I don't see an option for this, surprisi...
[ "indentation", "auto-indent" ]
3
2
4,065
3
0
2011-06-02T15:55:09.077000
2011-06-02T16:02:30.660000
6,216,964
6,220,670
Why doesn't S.notice show up after redirect in lift mvc v2.3
when requesting: case "page":: AsInt(id):: Nil => { S.notice("Hello world!") S.redirectTo("/index") } redirects to: case "index":: Nil => { // replace the contents of the element with id "time" with the date "#time *" #> DependencyFactory.inject[Date].map(_.toString) } however "Hello world!" doesn't show up. It will sh...
I suppose that's because S.notice() places message in request scope and it's not available after redirect (new request is created). See following quotes from Exploring Lift book: The net.liftweb.http.S object represents the state of the current request. The messages that you send are held by a RequestVar in the S objec...
Why doesn't S.notice show up after redirect in lift mvc v2.3 when requesting: case "page":: AsInt(id):: Nil => { S.notice("Hello world!") S.redirectTo("/index") } redirects to: case "index":: Nil => { // replace the contents of the element with id "time" with the date "#time *" #> DependencyFactory.inject[Date].map(_.t...
TITLE: Why doesn't S.notice show up after redirect in lift mvc v2.3 QUESTION: when requesting: case "page":: AsInt(id):: Nil => { S.notice("Hello world!") S.redirectTo("/index") } redirects to: case "index":: Nil => { // replace the contents of the element with id "time" with the date "#time *" #> DependencyFactory.in...
[ "session", "redirect", "lift" ]
1
3
406
2
0
2011-06-02T15:55:38.050000
2011-06-02T21:35:51.437000
6,216,969
6,218,726
How to implement rufus-scheduler in Rails?
The schedule is running but errors "undefined method 'do_something'". What is not right? Using rails 3. In config/initializers/task_scheduler.rb: require 'rubygems' require 'rufus/scheduler' scheduler = Rufus::Scheduler.start_new scheduler.every("10s") do JobThing.do_something end models/job_thing.rb: class JobThing < ...
You're trying to call a class-level method from the task_scheduler when you've actually defined an instance method in your JobThing class. You can define a class method as below: class JobThing < ActiveRecord::Base def self.do_something puts "something" end end
How to implement rufus-scheduler in Rails? The schedule is running but errors "undefined method 'do_something'". What is not right? Using rails 3. In config/initializers/task_scheduler.rb: require 'rubygems' require 'rufus/scheduler' scheduler = Rufus::Scheduler.start_new scheduler.every("10s") do JobThing.do_something...
TITLE: How to implement rufus-scheduler in Rails? QUESTION: The schedule is running but errors "undefined method 'do_something'". What is not right? Using rails 3. In config/initializers/task_scheduler.rb: require 'rubygems' require 'rufus/scheduler' scheduler = Rufus::Scheduler.start_new scheduler.every("10s") do Job...
[ "ruby-on-rails", "ruby-on-rails-3", "rubygems", "rufus-scheduler" ]
4
12
4,389
1
0
2011-06-02T15:55:50.873000
2011-06-02T18:29:25.910000
6,216,970
6,217,001
How can I reload files in /lib on every request?
Rails loads controllers, helpers and models on each request. My controllers have a bunch of modules which include methods for shared actions Each time I change the modules, I have to restart Rails for the changes in the actions to take effect Any idea how I can tell rails to reload these modules too? Update: My directo...
You can add them to your autoload_paths in your application.rb file and they will be re-loaded automatically along with the models and controllers. config.autoload_paths << "#{config.root}/lib"
How can I reload files in /lib on every request? Rails loads controllers, helpers and models on each request. My controllers have a bunch of modules which include methods for shared actions Each time I change the modules, I have to restart Rails for the changes in the actions to take effect Any idea how I can tell rail...
TITLE: How can I reload files in /lib on every request? QUESTION: Rails loads controllers, helpers and models on each request. My controllers have a bunch of modules which include methods for shared actions Each time I change the modules, I have to restart Rails for the changes in the actions to take effect Any idea h...
[ "ruby", "ruby-on-rails-3", "module" ]
3
3
1,743
2
0
2011-06-02T15:55:54.477000
2011-06-02T15:58:10.950000
6,216,983
6,217,744
Why does Android use JUnit over TestNG even if Cedric Beust created TestNg and was part of Android team?
Just curious about it... Cedric Beust created TestNG and I understand from an interview I read was part of the Android team. Why did they chose to use JUnit as the testing infrastructure for Android Eclipse Tools? Isn't TestNG supposed to a better than JUnit?
I actually picked JUnit over TestNG for Android testing, I thought it was more lightweight than TestNG for on-device testing. That was in 2007, I'm not sure I would make that same choice today.
Why does Android use JUnit over TestNG even if Cedric Beust created TestNg and was part of Android team? Just curious about it... Cedric Beust created TestNG and I understand from an interview I read was part of the Android team. Why did they chose to use JUnit as the testing infrastructure for Android Eclipse Tools? I...
TITLE: Why does Android use JUnit over TestNG even if Cedric Beust created TestNg and was part of Android team? QUESTION: Just curious about it... Cedric Beust created TestNG and I understand from an interview I read was part of the Android team. Why did they chose to use JUnit as the testing infrastructure for Androi...
[ "android", "junit", "testng" ]
7
16
1,179
2
0
2011-06-02T15:56:54.320000
2011-06-02T17:07:50.607000
6,216,986
6,217,033
Html Formatting Grid View
I'm trying to format my grid view so it looks like the following: so instead of looking like a table it has 2 columns and 3 rows. Thanks in advance
Consider switching your server control to an. This gives you granular control over your markup, compared to a gridview. Here's a great ListView tutortial by the Gu.
Html Formatting Grid View I'm trying to format my grid view so it looks like the following: so instead of looking like a table it has 2 columns and 3 rows. Thanks in advance
TITLE: Html Formatting Grid View QUESTION: I'm trying to format my grid view so it looks like the following: so instead of looking like a table it has 2 columns and 3 rows. Thanks in advance ANSWER: Consider switching your server control to an. This gives you granular control over your markup, compared to a gridview....
[ "asp.net", "gridview" ]
1
3
1,877
4
0
2011-06-02T15:57:08.003000
2011-06-02T16:00:56.747000
6,216,989
6,217,039
How to align the text from webpage in android web view?
In my application i have one web view.I will loading a simple html page inside that it is working correctly.But the content of the web page is displaying without alignment I want to display the contents with justified alignment Please any one give me idea for how to do that? Thanks in advance
Did you try to use the align=justify HTML attribute (deprecated) or CSS text-align:justify in you web page?
How to align the text from webpage in android web view? In my application i have one web view.I will loading a simple html page inside that it is working correctly.But the content of the web page is displaying without alignment I want to display the contents with justified alignment Please any one give me idea for how ...
TITLE: How to align the text from webpage in android web view? QUESTION: In my application i have one web view.I will loading a simple html page inside that it is working correctly.But the content of the web page is displaying without alignment I want to display the contents with justified alignment Please any one giv...
[ "android", "webview" ]
0
0
1,245
1
0
2011-06-02T15:57:30.123000
2011-06-02T16:01:34.090000
6,216,997
6,224,788
Upgrading driver from XP to W7
I've got a driver for a custom PCI card, which builds and runs fine on XP. I'm trying to use this custom hardware on W7, and am trying to build and run my driver. I've got the latest DDK from Microsoft, and build my driver for XP using Windows XP "x86 Free Build Environment". Everything installs & works fine. (Build us...
AFAIK, the biggest changes have been made in video and network drivers. Other drivers retain backward compatibility and can be run on W7 even with no recompiling. Run your driver under driver verifier and turn on generating crash dumps with a keyboard (very helpful in case of system hangs, you can manually generate cra...
Upgrading driver from XP to W7 I've got a driver for a custom PCI card, which builds and runs fine on XP. I'm trying to use this custom hardware on W7, and am trying to build and run my driver. I've got the latest DDK from Microsoft, and build my driver for XP using Windows XP "x86 Free Build Environment". Everything i...
TITLE: Upgrading driver from XP to W7 QUESTION: I've got a driver for a custom PCI card, which builds and runs fine on XP. I'm trying to use this custom hardware on W7, and am trying to build and run my driver. I've got the latest DDK from Microsoft, and build my driver for XP using Windows XP "x86 Free Build Environm...
[ "windows", "driver", "upgrade" ]
0
0
210
1
0
2011-06-02T15:57:53.237000
2011-06-03T08:35:54.330000
6,216,998
6,219,863
svn: how to ignore deletion of files on update
Using svn, here is a little intro of my situation: My working copy is at revision XX. Someone added a directory and images at revision YY. On revision ZZ, I deleted those images (but not the directory) to add a property svn:ignore for all images. Is there a way to update a working copy from revision XX to revision ZZ w...
the easiest is to copy them outside the directory, do your update, then copy them back in as now-unversioned files. The simplest solution is often the best. Or you could just update and let the system delete them, then fetch them from where-ever the master versions of them are stored. Lastly, I think you can update the...
svn: how to ignore deletion of files on update Using svn, here is a little intro of my situation: My working copy is at revision XX. Someone added a directory and images at revision YY. On revision ZZ, I deleted those images (but not the directory) to add a property svn:ignore for all images. Is there a way to update a...
TITLE: svn: how to ignore deletion of files on update QUESTION: Using svn, here is a little intro of my situation: My working copy is at revision XX. Someone added a directory and images at revision YY. On revision ZZ, I deleted those images (but not the directory) to add a property svn:ignore for all images. Is there...
[ "svn" ]
0
1
140
1
0
2011-06-02T15:57:57.800000
2011-06-02T20:16:02.513000
6,217,008
6,231,791
Stream audio from SQLite db
I have an SQLite db, and it has audio files in it stored as blobs. Is it possible in android (or anywhere) to stream media from a db?
I would recommend not storing the audio data in the database. The memory issues mentioned earlier can lead to huge amounts of GC thrashing which can make the system non-responsive for seconds or more at time. The typical approach involves a handful of steps. Store the audio in a file somewhere in your application's dir...
Stream audio from SQLite db I have an SQLite db, and it has audio files in it stored as blobs. Is it possible in android (or anywhere) to stream media from a db?
TITLE: Stream audio from SQLite db QUESTION: I have an SQLite db, and it has audio files in it stored as blobs. Is it possible in android (or anywhere) to stream media from a db? ANSWER: I would recommend not storing the audio data in the database. The memory issues mentioned earlier can lead to huge amounts of GC th...
[ "android", "sqlite", "audio", "stream" ]
5
5
4,754
2
0
2011-06-02T15:58:34.010000
2011-06-03T19:33:09.007000
6,217,009
6,227,343
jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3
I am creating a day range validator using DataAnnotations, jQuery.validate and jquery.validate.unobtrusive. I've already read the following: http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html http://weblogs.asp.net/mikaelsoderstrom/archive/2010/10/06/unobtrusive-validation-in-asp-net-mvc-3.aspx...
Solved! I forgot/didn't understand that you have to pass jQuery itself into the function closure. Therefore the custom validator on the client side should look like this: $(function () { jQuery.validator.addMethod('dayRange', function (value, element, param) { if (!value) return false; var valueDateParts = value.split(...
jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3 I am creating a day range validator using DataAnnotations, jQuery.validate and jquery.validate.unobtrusive. I've already read the following: http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html http://weblogs.asp.ne...
TITLE: jQuery.validator.unobtrusive.adapters.addMinMax round trips, doesn't work in MVC3 QUESTION: I am creating a day range validator using DataAnnotations, jQuery.validate and jquery.validate.unobtrusive. I've already read the following: http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html htt...
[ "asp.net-mvc-3", "jquery-validate", "unobtrusive" ]
7
19
8,232
2
0
2011-06-02T15:58:36.160000
2011-06-03T12:53:51.363000
6,217,011
6,217,086
Apache HttpClient in Java, instream.toString = org.apache.http.conn.EofSensorInputStream
I am GETting a page with Apache HttpClient and I want to store the server reply's http body into a string so I can then manipulate this string and print it to the console. Unfortunately when running this method I get this message back: 17:52:01,862 INFO Driver:53 - fetchPage STARTING 17:52:07,580 INFO Driver:73 - fetch...
You are calling the toString on the InputStream after it has already read through. You need to create your string from the byte arrays. The simpler way to get the String version of the content is to use the EntityUtils.toString(HttpEntity) The exact implementation would look like: import org.apache.http.util.EntityUtil...
Apache HttpClient in Java, instream.toString = org.apache.http.conn.EofSensorInputStream I am GETting a page with Apache HttpClient and I want to store the server reply's http body into a string so I can then manipulate this string and print it to the console. Unfortunately when running this method I get this message b...
TITLE: Apache HttpClient in Java, instream.toString = org.apache.http.conn.EofSensorInputStream QUESTION: I am GETting a page with Apache HttpClient and I want to store the server reply's http body into a string so I can then manipulate this string and print it to the console. Unfortunately when running this method I ...
[ "java", "httpclient", "inputstream", "http-get" ]
7
12
20,941
1
0
2011-06-02T15:58:42.980000
2011-06-02T16:05:41.953000
6,217,013
6,219,160
Silverlight Slider CustomConstrol properties not available
I've create a custom control with Blend 4 to customize a Slide object. Here a snipet of code generated by Blend:
Ok so there's a major difference in UserControls and Custom Controls. Although you didn't post all of your code, which i would suggest, it looks like what you have here is a UserControl that contains a Slider that has a customized StyleTemplate. So basically, you're not creating a control that inheirits functionality f...
Silverlight Slider CustomConstrol properties not available I've create a custom control with Blend 4 to customize a Slide object. Here a snipet of code generated by Blend:
TITLE: Silverlight Slider CustomConstrol properties not available QUESTION: I've create a custom control with Blend 4 to customize a Slide object. Here a snipet of code generated by Blend: ANSWER: Ok so there's a major difference in UserControls and Custom Controls. Although you didn't post all of your code, which i ...
[ "silverlight", "silverlight-4.0", "custom-controls" ]
0
1
167
1
0
2011-06-02T15:58:57.987000
2011-06-02T19:07:42.647000
6,217,017
6,217,182
Preallocating arrays in Matlab?
I am using a simple for loop to crop a large amount of images and then storing them in a cell array. I keep getting the message: The variable croppedSag appears to change size on every loop iteration. Consider preallocating for speed. I have seen this several times before while coding in MATLAB. I have always ignored i...
Pre-allocating an array is always a good idea in Matlab. The alternative is to have an array which grows during each iteration through a loop. Each time an element is added to the end of the array, Matlab must produce a totally new array, copy the contents of the old array into the new one, and then, finally, add the n...
Preallocating arrays in Matlab? I am using a simple for loop to crop a large amount of images and then storing them in a cell array. I keep getting the message: The variable croppedSag appears to change size on every loop iteration. Consider preallocating for speed. I have seen this several times before while coding in...
TITLE: Preallocating arrays in Matlab? QUESTION: I am using a simple for loop to crop a large amount of images and then storing them in a cell array. I keep getting the message: The variable croppedSag appears to change size on every loop iteration. Consider preallocating for speed. I have seen this several times befo...
[ "arrays", "matlab", "memory-management", "pre-allocation" ]
7
12
10,183
1
0
2011-06-02T15:59:20.690000
2011-06-02T16:13:22.560000
6,217,021
6,217,631
Removing Virtual Inheritance
I am working on an embedded project I am trying to remove a virtual number class that has + / - * implemented. removing this class saves a lot of code space so I have replaced + with the following function, if (BASE(h)->type() == FLOAT && BASE(v)->type() == FLOAT) { res = FLOAT(h)->floatValue() + FLOAT(v)->floatValue()...
#define GETFLOAT(arg) (BASE(arg)->type() == INTEGER? INTEGER(arg)->floatValue(): FLOAT(arg)->floatValue()) switch(BASE(h)->type()) { case INTEGER: if (BASE(v)->type() == INTEGER) { res = INTEGER(h)->intValue() + INTEGER(v)->intValue(); break; } case FLOAT: res = GETFLOAT(h) + GETFLOAT(v); } This actually branches on t...
Removing Virtual Inheritance I am working on an embedded project I am trying to remove a virtual number class that has + / - * implemented. removing this class saves a lot of code space so I have replaced + with the following function, if (BASE(h)->type() == FLOAT && BASE(v)->type() == FLOAT) { res = FLOAT(h)->floatVal...
TITLE: Removing Virtual Inheritance QUESTION: I am working on an embedded project I am trying to remove a virtual number class that has + / - * implemented. removing this class saves a lot of code space so I have replaced + with the following function, if (BASE(h)->type() == FLOAT && BASE(v)->type() == FLOAT) { res = ...
[ "c++" ]
0
2
162
3
0
2011-06-02T15:59:41.213000
2011-06-02T16:57:10.150000
6,217,027
6,217,822
jQuery Droppables - Problems when hiding 'inactive' drop zones
I've got a fairly long list of divs which I'm trying to use as droppable's - but I want to hide all of the droppables that won't accept the current draggable element. I've put an example up at http://jsfiddle.net/N3uh3/ Basically if I drag the 'Drag A' element it will hide all 'Droppable B' elements and allow me to dro...
The problem is that hiding your inactive droppables changes the element flow and positions of the active ones. By the time your delayed event fires, absolute droppable positions are already cached by jQuery UI, and that is what's checked when you let the mouse button go. In your original example you can still drop B if...
jQuery Droppables - Problems when hiding 'inactive' drop zones I've got a fairly long list of divs which I'm trying to use as droppable's - but I want to hide all of the droppables that won't accept the current draggable element. I've put an example up at http://jsfiddle.net/N3uh3/ Basically if I drag the 'Drag A' elem...
TITLE: jQuery Droppables - Problems when hiding 'inactive' drop zones QUESTION: I've got a fairly long list of divs which I'm trying to use as droppable's - but I want to hide all of the droppables that won't accept the current draggable element. I've put an example up at http://jsfiddle.net/N3uh3/ Basically if I drag...
[ "jquery", "css", "jquery-ui", "html", "jquery-ui-droppable" ]
2
3
1,563
1
0
2011-06-02T16:00:25.497000
2011-06-02T17:16:24.470000
6,217,028
6,217,109
Share constants between C# and Javascript in MVC Razor
I'd like to use string constants on both sides, in C# on server and in Javascript on client. I encapsulate my constants in C# class namespace MyModel { public static class Constants { public const string T_URL = "url"; public const string T_TEXT = "text";... } } I found a way to use these constants in Javascript using ...
The way you are using it is dangerous. Imagine some of your constants contained a quote, or even worse some other dangerous characters => that would break your javascripts. I would recommend you writing a controller action which will serve all constants as javascript: public ActionResult Constants() { var constants = t...
Share constants between C# and Javascript in MVC Razor I'd like to use string constants on both sides, in C# on server and in Javascript on client. I encapsulate my constants in C# class namespace MyModel { public static class Constants { public const string T_URL = "url"; public const string T_TEXT = "text";... } } I ...
TITLE: Share constants between C# and Javascript in MVC Razor QUESTION: I'd like to use string constants on both sides, in C# on server and in Javascript on client. I encapsulate my constants in C# class namespace MyModel { public static class Constants { public const string T_URL = "url"; public const string T_TEXT =...
[ "javascript", "asp.net-mvc-3", "razor" ]
37
81
20,746
5
0
2011-06-02T16:00:30.163000
2011-06-02T16:07:29.093000
6,217,041
6,217,064
Where a redirect is coming from?
I am making a website, where a person could be redirected to a form page several different pages within the site and depending on where they were redirected from, the form would be filled out certain to make it quick for them. This is all on the mobile, so data has to be kept in mind.
That information is usually contained in the HTTP Referer header field.
Where a redirect is coming from? I am making a website, where a person could be redirected to a form page several different pages within the site and depending on where they were redirected from, the form would be filled out certain to make it quick for them. This is all on the mobile, so data has to be kept in mind.
TITLE: Where a redirect is coming from? QUESTION: I am making a website, where a person could be redirected to a form page several different pages within the site and depending on where they were redirected from, the form would be filled out certain to make it quick for them. This is all on the mobile, so data has to ...
[ "redirect", "mobile-website", "tracking" ]
0
0
56
2
0
2011-06-02T16:01:46.817000
2011-06-02T16:03:51.253000
6,217,050
6,219,016
Maven is not found as a Right-Click option in EClipse
I have installed and set the Maven plugin but when I right click on a project in project explorer I cannot find the Maven option so I cannot find Build dependencies either..any things that I should check maybe I have missed some settings? Windows, Eclipse 3.6 JavaEE edition
i had not installed th pluging correctly, removed and reinstalled it. working now.
Maven is not found as a Right-Click option in EClipse I have installed and set the Maven plugin but when I right click on a project in project explorer I cannot find the Maven option so I cannot find Build dependencies either..any things that I should check maybe I have missed some settings? Windows, Eclipse 3.6 JavaEE...
TITLE: Maven is not found as a Right-Click option in EClipse QUESTION: I have installed and set the Maven plugin but when I right click on a project in project explorer I cannot find the Maven option so I cannot find Build dependencies either..any things that I should check maybe I have missed some settings? Windows, ...
[ "maven-plugin" ]
0
0
1,545
1
0
2011-06-02T16:02:20.137000
2011-06-02T18:55:12.467000
6,217,055
6,231,754
How can I copy a file from a remote server to using Putty in Windows?
How do I copy a file from a remote server to my local Windows system using a Putty session?
It worked using PSCP. Instructions: Download PSCP.EXE from Putty download page Open command prompt and type set PATH= In command prompt point to the location of the pscp.exe using cd command Type pscp use the following command to copy file form remote server to the local system pscp [options] [user@]host:source target ...
How can I copy a file from a remote server to using Putty in Windows? How do I copy a file from a remote server to my local Windows system using a Putty session?
TITLE: How can I copy a file from a remote server to using Putty in Windows? QUESTION: How do I copy a file from a remote server to my local Windows system using a Putty session? ANSWER: It worked using PSCP. Instructions: Download PSCP.EXE from Putty download page Open command prompt and type set PATH= In command pr...
[ "windows", "putty", "pscp" ]
98
168
309,419
2
0
2011-06-02T16:02:53.997000
2011-06-03T19:29:55.643000
6,217,056
6,218,781
Twitter timezone & created_at (utc time) values to calculate what time zone the user is in
I'm trying to estimate a twitter user's location based on the time_zone or created_at value in a given tweet object. However it seems that all created_at values I've come across are just in a pointless localised time and the time zone they supply isn't in the most helpful format example tweet "created_at":"Thu Jun 02 1...
This answer details how to convert a Twitter date into something PHP can work with; synopsis below. strtotime("dateString"); gets it into the native PHP date format, then you can work with the date() function to get it printed out how you'd like it. As for the time zone, you can use the value of the utc_offset property...
Twitter timezone & created_at (utc time) values to calculate what time zone the user is in I'm trying to estimate a twitter user's location based on the time_zone or created_at value in a given tweet object. However it seems that all created_at values I've come across are just in a pointless localised time and the time...
TITLE: Twitter timezone & created_at (utc time) values to calculate what time zone the user is in QUESTION: I'm trying to estimate a twitter user's location based on the time_zone or created_at value in a given tweet object. However it seems that all created_at values I've come across are just in a pointless localised...
[ "php", "timezone", "twitter", "utc" ]
6
9
11,067
1
0
2011-06-02T16:03:04.227000
2011-06-02T18:34:26.557000
6,217,058
6,217,127
strip xml attribute id's using C# .NET 4
I'm passing some xml to a server and when doing a POST I need to strip the attribute id's, but I'm not sure how to do that using c# Thanks
var myDoc = XDocument.Load("C:\\mydoc.xml") myDoc.Descendants("myNode").Attributes("id").Remove();
strip xml attribute id's using C# .NET 4 I'm passing some xml to a server and when doing a POST I need to strip the attribute id's, but I'm not sure how to do that using c# Thanks
TITLE: strip xml attribute id's using C# .NET 4 QUESTION: I'm passing some xml to a server and when doing a POST I need to strip the attribute id's, but I'm not sure how to do that using c# Thanks ANSWER: var myDoc = XDocument.Load("C:\\mydoc.xml") myDoc.Descendants("myNode").Attributes("id").Remove();
[ "xml", "c#-4.0", "linq-to-xml" ]
0
0
152
2
0
2011-06-02T16:03:09.530000
2011-06-02T16:09:24.583000
6,217,063
6,217,308
How to composite two varbinaries
I have two varbinary masks: @mask1 = 0x0000000000000001 @mask65 = 0x7FFFFFFFFFFFFFFF0000000000000003 I have to 1) composite them to get something like this @mask_composite = @mask1 | @mask65 2) check @mask_composite & @mask2 > 0 How can I do that by using T-SQL?
Here some guy shares a solution. It's a function that splits varbinaries into ints, applies bitwise logic and merges it back.
How to composite two varbinaries I have two varbinary masks: @mask1 = 0x0000000000000001 @mask65 = 0x7FFFFFFFFFFFFFFF0000000000000003 I have to 1) composite them to get something like this @mask_composite = @mask1 | @mask65 2) check @mask_composite & @mask2 > 0 How can I do that by using T-SQL?
TITLE: How to composite two varbinaries QUESTION: I have two varbinary masks: @mask1 = 0x0000000000000001 @mask65 = 0x7FFFFFFFFFFFFFFF0000000000000003 I have to 1) composite them to get something like this @mask_composite = @mask1 | @mask65 2) check @mask_composite & @mask2 > 0 How can I do that by using T-SQL? ANSW...
[ "t-sql", "sql-server-2008", "varbinary" ]
2
2
317
1
0
2011-06-02T16:03:50.677000
2011-06-02T16:25:07.427000
6,217,080
6,217,589
android app load and resize images
I need load image from assets I can read text file but i can not read images and get to BitmapFactory my simple code BitmapFactory.decodeFile(resources.getAssets().open("Untitled-1.jpg"));
Images should be placed in the /res/drawable-XXX -folders ( see this table ). If you put them in the /res/drawable-XX -folder, you can load them (with Java) using something like this to show it in a ImageView: ImageView view = (ImageView) this.findViewById(R.id.drawme); view.setImageResource(R.drawable.android); If you...
android app load and resize images I need load image from assets I can read text file but i can not read images and get to BitmapFactory my simple code BitmapFactory.decodeFile(resources.getAssets().open("Untitled-1.jpg"));
TITLE: android app load and resize images QUESTION: I need load image from assets I can read text file but i can not read images and get to BitmapFactory my simple code BitmapFactory.decodeFile(resources.getAssets().open("Untitled-1.jpg")); ANSWER: Images should be placed in the /res/drawable-XXX -folders ( see this ...
[ "android", "android-webview" ]
0
0
540
1
0
2011-06-02T16:04:58.520000
2011-06-02T16:52:54.117000
6,217,085
6,217,303
Is it possible to create a System UDF in SQL Server 2005
I saw that it is possible in SQL Server 2000. I want to have a function(s) where I don't have to qualify it with an owner. for instance fn_trim() instead of dbo.fn_trim()
Following on from Joe's answer You can create a schema for your UDFs with CREATE SCHEMA (say "fn") so you could have fn.trim() rather than dbo.fn_trim().
Is it possible to create a System UDF in SQL Server 2005 I saw that it is possible in SQL Server 2000. I want to have a function(s) where I don't have to qualify it with an owner. for instance fn_trim() instead of dbo.fn_trim()
TITLE: Is it possible to create a System UDF in SQL Server 2005 QUESTION: I saw that it is possible in SQL Server 2000. I want to have a function(s) where I don't have to qualify it with an owner. for instance fn_trim() instead of dbo.fn_trim() ANSWER: Following on from Joe's answer You can create a schema for your U...
[ "sql-server-2005" ]
2
5
152
2
0
2011-06-02T16:05:26.363000
2011-06-02T16:24:39.033000
6,217,088
6,217,392
General sibling combinator (~), not updating on DOM changes, working as intended?
I had a go at at this question (this question isn't related at all to his question), and tried to solve it through applying CSS selectors depending on whether the checkboxes had been ticked. The idea I had, was that if there is an element which is:checked, the preceeding submit button should be visible. The resulting C...
Your CSS looks correct, but browser support, of course, varies, and where there is support, there will be bugs. Javascript would be much more reliable.
General sibling combinator (~), not updating on DOM changes, working as intended? I had a go at at this question (this question isn't related at all to his question), and tried to solve it through applying CSS selectors depending on whether the checkboxes had been ticked. The idea I had, was that if there is an element...
TITLE: General sibling combinator (~), not updating on DOM changes, working as intended? QUESTION: I had a go at at this question (this question isn't related at all to his question), and tried to solve it through applying CSS selectors depending on whether the checkboxes had been ticked. The idea I had, was that if t...
[ "html", "css", "google-chrome", "css-selectors" ]
1
1
258
2
0
2011-06-02T16:06:00.160000
2011-06-02T16:34:14.710000
6,217,091
6,219,042
default filter in interactive report
How can I make custom default filter in interactive report? That filter is loaded when reset button is pressed. Also how can I make this filter to be set with some values, e.g. filter is initialized with current date and rows that only relates to current date are shown.
How can I make custom default filter in interactive report? That filter is loaded when reset button is pressed. Once you are happy with your report, starting from the Interactive report actions menu --> select save report --> change the select list to "As Default Report Settings" Also how can I make this filter to be s...
default filter in interactive report How can I make custom default filter in interactive report? That filter is loaded when reset button is pressed. Also how can I make this filter to be set with some values, e.g. filter is initialized with current date and rows that only relates to current date are shown.
TITLE: default filter in interactive report QUESTION: How can I make custom default filter in interactive report? That filter is loaded when reset button is pressed. Also how can I make this filter to be set with some values, e.g. filter is initialized with current date and rows that only relates to current date are s...
[ "oracle", "oracle-apex" ]
1
3
5,280
1
0
2011-06-02T16:06:08.360000
2011-06-02T18:57:32.027000
6,217,093
6,217,482
How can the install path be set for a qt project
I'm looking for the equivalent to./configure --prefix= for qmake. Basically, I want to override the default install/deployment directory. How is this specified with command line qmake? I also use QtCreator to build a lot of my gui projects, and I'd like to know how to do the same thing while building inside of QtCreato...
I've found the solution to this, and it is just as easy as specifying the --prefix option to configure. For qmake on the command line, you simpy add a PREFIX= parameter: qmake PREFIX=/usr/local There are two ways to do this in QtCreator. First, you could change your.pro file to include an explicit PREFIX variable defin...
How can the install path be set for a qt project I'm looking for the equivalent to./configure --prefix= for qmake. Basically, I want to override the default install/deployment directory. How is this specified with command line qmake? I also use QtCreator to build a lot of my gui projects, and I'd like to know how to do...
TITLE: How can the install path be set for a qt project QUESTION: I'm looking for the equivalent to./configure --prefix= for qmake. Basically, I want to override the default install/deployment directory. How is this specified with command line qmake? I also use QtCreator to build a lot of my gui projects, and I'd like...
[ "qt", "qt-creator" ]
7
5
9,961
2
0
2011-06-02T16:06:21.047000
2011-06-02T16:41:56.630000
6,217,097
6,227,322
Why do I download an aspx page instead of just navigating to it in MVC 2
This is probably the dumbest question ever here on stack Overflow. But I am getting the weirdest results from some code that I am working with. I am trying to get jqGrid to work in my MVC 2 application. My home controller has an action method for Index and GridData... GridData takes 4 parameters, 2 of them cannot be nu...
Ok. I think I figured it out. I don't want to redirect to an action. The action returns a Json data type and that is just text so the browser is just going to attempt to download it. I want to redirect to a view... So what I did is make a helper function that returns a json data and I do redirect to the dataGrid contro...
Why do I download an aspx page instead of just navigating to it in MVC 2 This is probably the dumbest question ever here on stack Overflow. But I am getting the weirdest results from some code that I am working with. I am trying to get jqGrid to work in my MVC 2 application. My home controller has an action method for ...
TITLE: Why do I download an aspx page instead of just navigating to it in MVC 2 QUESTION: This is probably the dumbest question ever here on stack Overflow. But I am getting the weirdest results from some code that I am working with. I am trying to get jqGrid to work in my MVC 2 application. My home controller has an ...
[ "asp.net-mvc-2", "asp.net-mvc-routing" ]
0
0
142
2
0
2011-06-02T16:06:38.663000
2011-06-03T12:51:53.057000
6,217,098
6,217,196
How to include $wpdb in wordpress plugin?
I've been developing for some time on a plugin in wordpress, but one problem keeps bugging me. I want to export a database-table as an excel file and therefor i need access to the global $wpdb->variable from a file in my plugin directory. I found a blog entry that explains what classes i should include, but this doesn'...
If you're creating a WordPress plugin, you don't need to include those files manually. If you want to export your table, why don't you create a function/class for it and pass the $wpdb to it (if you need it). You can also use the normal MySQLi -class (from PHP) do access your MySQL Database. If you simply want to acces...
How to include $wpdb in wordpress plugin? I've been developing for some time on a plugin in wordpress, but one problem keeps bugging me. I want to export a database-table as an excel file and therefor i need access to the global $wpdb->variable from a file in my plugin directory. I found a blog entry that explains what...
TITLE: How to include $wpdb in wordpress plugin? QUESTION: I've been developing for some time on a plugin in wordpress, but one problem keeps bugging me. I want to export a database-table as an excel file and therefor i need access to the global $wpdb->variable from a file in my plugin directory. I found a blog entry ...
[ "php", "wordpress", "plugins" ]
7
12
32,908
2
0
2011-06-02T16:06:47.110000
2011-06-02T16:14:20.953000