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,291,461
6,291,593
Make <h1> vertically center with CSS?
Some text here I use h1{display: inline;} to make them in the same line, but the text is lower than the image, the images is 48x48px and the text size is 23px, I'd like to make the text vetically center to the image, how could I do that with CSS? Just need to support Chrome. Thanks for your answers, finally got it work...
Like this? http://jsfiddle.net/xs4x6/ Some text here header img { vertical-align: top } h1 { display: inline; font-size: 23px; line-height: 48px }
Make <h1> vertically center with CSS? Some text here I use h1{display: inline;} to make them in the same line, but the text is lower than the image, the images is 48x48px and the text size is 23px, I'd like to make the text vetically center to the image, how could I do that with CSS? Just need to support Chrome. Thanks...
TITLE: Make <h1> vertically center with CSS? QUESTION: Some text here I use h1{display: inline;} to make them in the same line, but the text is lower than the image, the images is 48x48px and the text size is 23px, I'd like to make the text vetically center to the image, how could I do that with CSS? Just need to supp...
[ "css", "html" ]
7
16
19,851
6
0
2011-06-09T10:35:15.160000
2011-06-09T10:46:39.533000
6,291,506
6,291,539
Check if event has any listeners?
Is it possible to detect if event has any listeners? (I need to dispose my event provider object, if nobody needs it)
Assume the class is in a 3rd party library and it can't be modified: public class Data { public event EventHandler OnSave; //other members } In your program: Data d = new Data(); d.OnSave += delegate { Console.WriteLine("event"); }; var handler = typeof(Data).GetField("OnSave", BindingFlags.NonPublic | BindingFlags.Ins...
Check if event has any listeners? Is it possible to detect if event has any listeners? (I need to dispose my event provider object, if nobody needs it)
TITLE: Check if event has any listeners? QUESTION: Is it possible to detect if event has any listeners? (I need to dispose my event provider object, if nobody needs it) ANSWER: Assume the class is in a 3rd party library and it can't be modified: public class Data { public event EventHandler OnSave; //other members } ...
[ "c#", ".net", "clr" ]
21
28
29,906
3
0
2011-06-09T10:39:19.557000
2011-06-09T10:42:24.020000
6,291,511
6,291,815
How to avoid a query string parameter being remembered?
I'm developing a messaging system on a website. When user sends a message, she is redirected to inbox?status=sent which displays a neat status Message sent. However, if she then goes on to see any of the inbox messages and clicks Back, she is brought to this statusful page again, whereas I don't want to display it anym...
You could try using TempData [HttpPost] public ActionResult SendMessage() { // TODO: send the message TempData["status"] = "sent"; return RedirectToAction("Result"); } and in the Result view you could show the message by fetching it from TempData: @TempData["status"]
How to avoid a query string parameter being remembered? I'm developing a messaging system on a website. When user sends a message, she is redirected to inbox?status=sent which displays a neat status Message sent. However, if she then goes on to see any of the inbox messages and clicks Back, she is brought to this statu...
TITLE: How to avoid a query string parameter being remembered? QUESTION: I'm developing a messaging system on a website. When user sends a message, she is redirected to inbox?status=sent which displays a neat status Message sent. However, if she then goes on to see any of the inbox messages and clicks Back, she is bro...
[ "html", "asp.net-mvc", "asp.net-mvc-3", "query-string", "tempdata" ]
1
2
218
1
0
2011-06-09T10:39:45.723000
2011-06-09T11:07:42.300000
6,291,522
6,291,752
FormatException: Input string was not in the correct format
I have Views field from one of my tables in the database. At first i allowed it to take nulls, and now it disallowed it to take null. The problem is that that exception is being thrown when i convert the SqlReader instance to an int..here is the code: try { conn.Open(); SqlDataReader dr = cmd.ExecuteReader(CommandBehav...
To avoid exception while convertion, use Int32.TryParse always.
FormatException: Input string was not in the correct format I have Views field from one of my tables in the database. At first i allowed it to take nulls, and now it disallowed it to take null. The problem is that that exception is being thrown when i convert the SqlReader instance to an int..here is the code: try { co...
TITLE: FormatException: Input string was not in the correct format QUESTION: I have Views field from one of my tables in the database. At first i allowed it to take nulls, and now it disallowed it to take null. The problem is that that exception is being thrown when i convert the SqlReader instance to an int..here is ...
[ "c#", "asp.net", "sql" ]
0
0
2,726
4
0
2011-06-09T10:40:35.730000
2011-06-09T11:02:58.403000
6,291,532
6,291,837
Does TLS have to encrypt the whole file before sending it down?
I've experienced a CPU usage surge coming from a WCF service that sends large files to requesting clients over HTTPS. Does TLS need to encrypt the whole file before sending it down or does it just encrypt the packets? I'm trying to find out what in the service is causing the surge as the WCF method responsible just ser...
SSL and TLS act at the transport layer, so anything sent over that session should be encrypted at the time of sending, and immediately decrypted upon receiving it. That means they can still be used to effectively secure streams or other open-ended communications. Because the encryption will only happen as fast as the c...
Does TLS have to encrypt the whole file before sending it down? I've experienced a CPU usage surge coming from a WCF service that sends large files to requesting clients over HTTPS. Does TLS need to encrypt the whole file before sending it down or does it just encrypt the packets? I'm trying to find out what in the ser...
TITLE: Does TLS have to encrypt the whole file before sending it down? QUESTION: I've experienced a CPU usage surge coming from a WCF service that sends large files to requesting clients over HTTPS. Does TLS need to encrypt the whole file before sending it down or does it just encrypt the packets? I'm trying to find o...
[ "wcf", "ssl" ]
1
1
264
2
0
2011-06-09T10:41:39.130000
2011-06-09T11:10:00.780000
6,291,544
6,291,808
Is there a safe way of detecting File access permissions
Below is the part code I currently use to write to a file, Try Using sWriter As New IO.StreamWriter("C:\Tmp.txt", False) sWriter.Write(m_Buffer.ToString): sWriter.Flush() End Using Return True Catch ex As IOException End Try but some time this results in error Access to the path 'C:\Tmp.txt' is denied My question is, ...
There have been other similar questions asked in StackoverFlow. check this before you ask! How do you check for permissions to write to a directory or file? how can you easily check if access is denied for a file in.NET? The first link can help you directly.
Is there a safe way of detecting File access permissions Below is the part code I currently use to write to a file, Try Using sWriter As New IO.StreamWriter("C:\Tmp.txt", False) sWriter.Write(m_Buffer.ToString): sWriter.Flush() End Using Return True Catch ex As IOException End Try but some time this results in error A...
TITLE: Is there a safe way of detecting File access permissions QUESTION: Below is the part code I currently use to write to a file, Try Using sWriter As New IO.StreamWriter("C:\Tmp.txt", False) sWriter.Write(m_Buffer.ToString): sWriter.Flush() End Using Return True Catch ex As IOException End Try but some time this ...
[ "c#", "vb.net", "file-io" ]
1
0
121
2
0
2011-06-09T10:42:37.177000
2011-06-09T11:07:21.713000
6,291,545
6,291,608
How do I find out why importing failed with PyImportModule?
I have this code in a C application that's embedding Python (2.7.1): { PyObject *user_dict; PyObject *user_func; PyObject *result; PyObject *header_tuple; PyObject *original_recipients; PyObject *working_recipients; if (!Py_IsInitialized()) { Py_Initialize(); } if (!expy_exim_dict) { PyObject *module = Py_InitModule(...
You do this by looking at the exception that was raised. Currently you wipe the exception (that's what PyErr_Clear() does.) Don't do that, and instead print the traceback or inspect the exception object. See http://docs.python.org/c-api/exceptions.html for information on how to do that from C code, but usually the best...
How do I find out why importing failed with PyImportModule? I have this code in a C application that's embedding Python (2.7.1): { PyObject *user_dict; PyObject *user_func; PyObject *result; PyObject *header_tuple; PyObject *original_recipients; PyObject *working_recipients; if (!Py_IsInitialized()) { Py_Initialize();...
TITLE: How do I find out why importing failed with PyImportModule? QUESTION: I have this code in a C application that's embedding Python (2.7.1): { PyObject *user_dict; PyObject *user_func; PyObject *result; PyObject *header_tuple; PyObject *original_recipients; PyObject *working_recipients; if (!Py_IsInitialized()) ...
[ "python", "python-c-api", "python-embedding" ]
5
6
3,644
1
0
2011-06-09T10:42:45.463000
2011-06-09T10:47:51.990000
6,291,547
6,291,677
How to improve this code in intelligente way in Jquery to change the background code of DIV
I've 6 div's when the user clicks on the DIV it displays the contect of the divs. (I'm using ASPX - Ajaxtabpanel). Below I figured out the div names and what I do below is, when the click on a DIV, change the Background color. So Active div get another color. Below I've JQuery code it works but I'm sure it can be done ...
If those are the only divs that use class ajax__tab_outer, you could do something like this:
How to improve this code in intelligente way in Jquery to change the background code of DIV I've 6 div's when the user clicks on the DIV it displays the contect of the divs. (I'm using ASPX - Ajaxtabpanel). Below I figured out the div names and what I do below is, when the click on a DIV, change the Background color. S...
TITLE: How to improve this code in intelligente way in Jquery to change the background code of DIV QUESTION: I've 6 div's when the user clicks on the DIV it displays the contect of the divs. (I'm using ASPX - Ajaxtabpanel). Below I figured out the div names and what I do below is, when the click on a DIV, change the B...
[ "javascript", "jquery-ui", "jquery", "jquery-selectors" ]
0
0
128
4
0
2011-06-09T10:42:59.053000
2011-06-09T10:56:22.253000
6,291,549
6,291,575
Select rows within a date range in T-SQL
I have a set of rows, each with a date value, and I need to select rows that fall within a specific date range. How can I do this? select * from table where convert(int,date_created) between //what should go here? I want to select between '20-10-2010' and '22-10-2010'. It keeps complaining about string to date conversi...
You need to use yyyymmdd which is the safest format for SQL Server select * from table where date_created BETWEEN '20101020' and '20101022' Not sure why you had CONVERT to int there... Note: if date_created has a time component that this fails because it assume midnight. Edit: To filter for the day 20 Oct 2010 to 22 Oc...
Select rows within a date range in T-SQL I have a set of rows, each with a date value, and I need to select rows that fall within a specific date range. How can I do this? select * from table where convert(int,date_created) between //what should go here? I want to select between '20-10-2010' and '22-10-2010'. It keeps ...
TITLE: Select rows within a date range in T-SQL QUESTION: I have a set of rows, each with a date value, and I need to select rows that fall within a specific date range. How can I do this? select * from table where convert(int,date_created) between //what should go here? I want to select between '20-10-2010' and '22-1...
[ "t-sql", "date" ]
11
26
35,880
2
0
2011-06-09T10:43:12.340000
2011-06-09T10:45:04.050000
6,291,554
6,291,714
Does a .net 2.0 web service always use Soap over http?
Im doing research and I downloaded a test app that calls a standard.asmx service. The service is being called using a standard POST request. Im slightly confused because I thought.asmx services always used SOAP? Or is the ability to communicate with HTTP (POST) something that was introduced recently?
.NET Web-Services uses the one protocol you choose. By deafult it is the SOAP, and POST requests are allowed. Standart help page automatically created by.NET: POST /demo/MSDN/PerfCounter.asmx HTTP/1.1 Connection: Keep-Alive Content-Length: 150 Content-Type: text/xml Host: localhost User-Agent: MS Web Services Client Pr...
Does a .net 2.0 web service always use Soap over http? Im doing research and I downloaded a test app that calls a standard.asmx service. The service is being called using a standard POST request. Im slightly confused because I thought.asmx services always used SOAP? Or is the ability to communicate with HTTP (POST) som...
TITLE: Does a .net 2.0 web service always use Soap over http? QUESTION: Im doing research and I downloaded a test app that calls a standard.asmx service. The service is being called using a standard POST request. Im slightly confused because I thought.asmx services always used SOAP? Or is the ability to communicate wi...
[ "c#", "asp.net", "web-services", "asmx" ]
3
1
830
3
0
2011-06-09T10:43:51.700000
2011-06-09T10:58:58.360000
6,291,555
6,291,685
How should I install JDateChooser?
I've discover this JDateChooser from searching how to use Item Combobox at Java Swing. Do you know how to install this? Here is the link JDateChooser I can't find any instructions on how to install it.. Can you share some instructions on how to install it... thanks in advance v(^_^)v
It's very simple. Download the Toedter jcalendar-1.4.jar (also maven repository will locate it) If you are using Netbeans you can create an new bean and add the Toedter beans to your Palette Manager: This gives you the capability to drag and drop these anywhere you like: If you drag and drop the bean somewhere, the cod...
How should I install JDateChooser? I've discover this JDateChooser from searching how to use Item Combobox at Java Swing. Do you know how to install this? Here is the link JDateChooser I can't find any instructions on how to install it.. Can you share some instructions on how to install it... thanks in advance v(^_^)v
TITLE: How should I install JDateChooser? QUESTION: I've discover this JDateChooser from searching how to use Item Combobox at Java Swing. Do you know how to install this? Here is the link JDateChooser I can't find any instructions on how to install it.. Can you share some instructions on how to install it... thanks i...
[ "java", "swing", "jdatechooser" ]
5
13
47,974
2
0
2011-06-09T10:43:53.180000
2011-06-09T10:56:45.927000
6,291,565
6,291,852
HTML select dropdown going off screen
Considering the following code: asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 When opening the right selectbox, the contents of the dropdown go off the screen. Also when the list would be longer, you would not be able to scroll thro...
I think you mean the right side of the select box is not visible so the user cannot use the scroll-bar. You have 2 potential options that I can see outside of changing to a JavaScript solution, the first is to repostition the elements to allow for longer content. The second is to specify the width of the element to a p...
HTML select dropdown going off screen Considering the following code: asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 When opening the right selectbox, the contents of the dropdown go off the screen. Also when the list would be longer...
TITLE: HTML select dropdown going off screen QUESTION: Considering the following code: asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 asd flkjh asdfkljha sdlkfjhasldjkfh aslkjdfh asjdhf alksjdhl k 1 2 When opening the right selectbox, the contents of the dropdown go off the screen. Also when the li...
[ "html", "css", "cross-browser" ]
9
5
25,750
3
0
2011-06-09T10:44:29.800000
2011-06-09T11:11:08.457000
6,291,566
6,291,619
As a skilled c# programmer what traps are waiting for me in the Java type arguments inference rules?
Or in other words What are the main difference in type arguments inference for generic types between C# and Java? I am looking for an answer that can be read and understood in a few minutes by a skilled C# developer.
The main difference between Java & C# generics is that Java generics are enforced by the compiler, with the required cast being inserted as appropriate. The bytecode does not make reference to the generic type, this is termed ' type erasure '. Within C# generics is present in the intermediate language, hence there is n...
As a skilled c# programmer what traps are waiting for me in the Java type arguments inference rules? Or in other words What are the main difference in type arguments inference for generic types between C# and Java? I am looking for an answer that can be read and understood in a few minutes by a skilled C# developer.
TITLE: As a skilled c# programmer what traps are waiting for me in the Java type arguments inference rules? QUESTION: Or in other words What are the main difference in type arguments inference for generic types between C# and Java? I am looking for an answer that can be read and understood in a few minutes by a skille...
[ "c#", "java", "generics", "type-inference" ]
1
3
163
2
0
2011-06-09T10:44:30.447000
2011-06-09T10:49:15.143000
6,291,570
6,291,712
How can I write to a remote file?
I need to be able to write to a remote text file located on my vps. I know how to read the file using WebRequest, WebResponse. It's probably something really simple.
How to: Upload Files with FTP: using System; using System.IO; using System.Net; using System.Text; namespace Examples.System.Net { public class WebRequestGetExample { public static void Main () { // Get the object used to communicate with the server. FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www....
How can I write to a remote file? I need to be able to write to a remote text file located on my vps. I know how to read the file using WebRequest, WebResponse. It's probably something really simple.
TITLE: How can I write to a remote file? QUESTION: I need to be able to write to a remote text file located on my vps. I know how to read the file using WebRequest, WebResponse. It's probably something really simple. ANSWER: How to: Upload Files with FTP: using System; using System.IO; using System.Net; using System....
[ "c#", "file-io", "remote-access" ]
0
3
3,242
3
0
2011-06-09T10:44:41.670000
2011-06-09T10:58:45.203000
6,291,577
6,291,662
Premature end of file Error
I am using XSL to configure my XML file into a smaller XML. My code fragments are so: public class MessageTransformer { public static void main(String[] args) { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer (new StreamSource...
You are streaming from and to the same file. Try changing it to something like this: transformer.transform(new StreamSource ("sample.xml"), new StreamResult( new FileOutputStream("sample_result.xml")) );
Premature end of file Error I am using XSL to configure my XML file into a smaller XML. My code fragments are so: public class MessageTransformer { public static void main(String[] args) { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newT...
TITLE: Premature end of file Error QUESTION: I am using XSL to configure my XML file into a smaller XML. My code fragments are so: public class MessageTransformer { public static void main(String[] args) { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = trans...
[ "java", "xslt", "transformer-model" ]
5
7
19,095
2
0
2011-06-09T10:45:19.730000
2011-06-09T10:54:09.540000
6,291,578
6,291,805
Delphi - Deleting runtime generated buttons from TPanel
I have several TPanels that are populated with buttons at runtime. However the code below that i use to free my buttons from their parent panels sometimes generates access violation errors. procedure TfrmTakeOrder.FreeItemButtons(buttons: array of TButton); var cnt,i: integer; begin for i:= 0 to gridLayoutItems.Contro...
It looks to me like you are trying to remove all buttons from a TPanel and that panel only contains buttons. Try this: while gridLayoutItems.ControlCount > 0 do gridLayoutItems.Controls[0].Free;
Delphi - Deleting runtime generated buttons from TPanel I have several TPanels that are populated with buttons at runtime. However the code below that i use to free my buttons from their parent panels sometimes generates access violation errors. procedure TfrmTakeOrder.FreeItemButtons(buttons: array of TButton); var cn...
TITLE: Delphi - Deleting runtime generated buttons from TPanel QUESTION: I have several TPanels that are populated with buttons at runtime. However the code below that i use to free my buttons from their parent panels sometimes generates access violation errors. procedure TfrmTakeOrder.FreeItemButtons(buttons: array o...
[ "delphi" ]
4
7
7,841
8
0
2011-06-09T10:45:20.013000
2011-06-09T11:07:12.300000
6,291,588
6,292,013
execute sql statement in asp.net mvc3 (C#)
How to execute sql statement in asp.net mvc3 (C#)? I am using Entity Data Model for my asp.net mvc application I need to execute a sql query (" select * from users where EmailAddress like '%@gmail.com' ").
Is your User entity mapped? In such case yo can use var users = from u in context.Users where u.EmailAddress.EndsWith("@gmail.com") select u; If you don't have User table mapped but you have User class with parameterless constructor and public settable properties with same names as columns in result set you can use: va...
execute sql statement in asp.net mvc3 (C#) How to execute sql statement in asp.net mvc3 (C#)? I am using Entity Data Model for my asp.net mvc application I need to execute a sql query (" select * from users where EmailAddress like '%@gmail.com' ").
TITLE: execute sql statement in asp.net mvc3 (C#) QUESTION: How to execute sql statement in asp.net mvc3 (C#)? I am using Entity Data Model for my asp.net mvc application I need to execute a sql query (" select * from users where EmailAddress like '%@gmail.com' "). ANSWER: Is your User entity mapped? In such case yo ...
[ "c#", "sql", "entity-framework" ]
3
5
11,863
1
0
2011-06-09T10:46:14.383000
2011-06-09T11:24:08.030000
6,291,605
6,291,804
servlet code structure / pattern ideas ? writing response
I have a simple servlet at the moment. I need it to call a static jar method and return its response. 1) Can someone recommend a suitable structure ie do I need to create factories and handler classes etc... 2) How should I encode the hash in the response... Is the simply writing to output stream ok do something else? ...
First and foremost, your hashcode is not thread-safe. After looking to your provided snippet. I don't think so. It is fairly simple thing. You are getting accountName as parameter, and then writing the same back. Is that you want? Or you mean respond the hashed version. You might like to validate accountName parameter,...
servlet code structure / pattern ideas ? writing response I have a simple servlet at the moment. I need it to call a static jar method and return its response. 1) Can someone recommend a suitable structure ie do I need to create factories and handler classes etc... 2) How should I encode the hash in the response... Is ...
TITLE: servlet code structure / pattern ideas ? writing response QUESTION: I have a simple servlet at the moment. I need it to call a static jar method and return its response. 1) Can someone recommend a suitable structure ie do I need to create factories and handler classes etc... 2) How should I encode the hash in t...
[ "java", "design-patterns", "servlets" ]
1
1
321
2
0
2011-06-09T10:47:45.673000
2011-06-09T11:07:02.437000
6,291,636
6,291,722
mysql saving and selecting many options
I’m developing an auctioning website. Each auction has a lot of options, that i want to be able to filter on the front-end. I was wondering what is best practice in handling/storing these options (mostly booleans/checkboxes). Is it best practice to store them all in the same row? Or would it be better to store them all...
You can use an options table that is connected M-N to the auctions table. Between these two tables you should build another table to connect them. Auctions | Auctions_options | Options So a query would be like this SELECT * FROM Auctions as A INNER JOIN Auctions_Options as B ON A.id_auction = B.id_auction INNER JOIN Op...
mysql saving and selecting many options I’m developing an auctioning website. Each auction has a lot of options, that i want to be able to filter on the front-end. I was wondering what is best practice in handling/storing these options (mostly booleans/checkboxes). Is it best practice to store them all in the same row?...
TITLE: mysql saving and selecting many options QUESTION: I’m developing an auctioning website. Each auction has a lot of options, that i want to be able to filter on the front-end. I was wondering what is best practice in handling/storing these options (mostly booleans/checkboxes). Is it best practice to store them al...
[ "mysql" ]
0
0
67
3
0
2011-06-09T10:51:08.277000
2011-06-09T10:59:44.277000
6,291,678
6,291,788
Convert input string to a clean, readable and browser acceptable route data
Scenario: There is a title called "AJAX, JSON & HTML5! The future of web?" Would like to convert this into this "ajax-json-html5-the-future-of-web" Basically what I need is a function that strips out all the non alphabets and then replace them with a single hyphen and lowercase that. Problem: With some effort I could d...
An example using Regex - this should get you in the right direction (Edit - added clearing off the trailing dash so it looks nicer) var input = "This is some amazing Rexex Stuff!"; input = Regex.Replace(input, @"[\W]+", "-").ToLower(); input = Regex.Replace(input, @"[-]+$", ""); Console.Write(input); Console.Read();
Convert input string to a clean, readable and browser acceptable route data Scenario: There is a title called "AJAX, JSON & HTML5! The future of web?" Would like to convert this into this "ajax-json-html5-the-future-of-web" Basically what I need is a function that strips out all the non alphabets and then replace them ...
TITLE: Convert input string to a clean, readable and browser acceptable route data QUESTION: Scenario: There is a title called "AJAX, JSON & HTML5! The future of web?" Would like to convert this into this "ajax-json-html5-the-future-of-web" Basically what I need is a function that strips out all the non alphabets and ...
[ "c#", "asp.net" ]
5
7
474
2
0
2011-06-09T10:56:23.263000
2011-06-09T11:05:59.510000
6,291,693
6,291,724
Git: How to add files and subfolders in a gitignore'd folder
Suppose I have a folder application/uploads EDIT application/uploads/{a}/{b}/{c}/{d}/{e}/{f}/{g}/abcdefghijklmnopqrstuvwxyz {a},{b},{c},{d},{e},{f},{g} - are hash keys, any alpha-numeric characters are possible abcdefghijklmnopqrstuvwxyz - is a hashed filename I don't want git to track it neither on development machine...
From the git-add manpage: -f, --force Allow adding otherwise ignored files.
Git: How to add files and subfolders in a gitignore'd folder Suppose I have a folder application/uploads EDIT application/uploads/{a}/{b}/{c}/{d}/{e}/{f}/{g}/abcdefghijklmnopqrstuvwxyz {a},{b},{c},{d},{e},{f},{g} - are hash keys, any alpha-numeric characters are possible abcdefghijklmnopqrstuvwxyz - is a hashed filenam...
TITLE: Git: How to add files and subfolders in a gitignore'd folder QUESTION: Suppose I have a folder application/uploads EDIT application/uploads/{a}/{b}/{c}/{d}/{e}/{f}/{g}/abcdefghijklmnopqrstuvwxyz {a},{b},{c},{d},{e},{f},{g} - are hash keys, any alpha-numeric characters are possible abcdefghijklmnopqrstuvwxyz - i...
[ "git" ]
2
7
1,792
2
0
2011-06-09T10:57:20.243000
2011-06-09T11:00:13.080000
6,291,704
6,291,766
.net DynamicObject implementation that returns null for missing properties rather than a RunTimeBinderException
I'd like to be able to do something like the following: dynamic a = new ExpandoObject(); Console.WriteLine(a.SomeProperty?? "No such member"); but that throws RunTimeBinderException: 'System.Dynamic.ExpandoObject' does not contain a definition for 'Throw' Do you know of an implementation of DynamicObject that would ret...
Something like this? using System; using System.Collections.Generic; using System.Dynamic; public class NullingExpandoObject: DynamicObject { private readonly Dictionary values = new Dictionary (); public override bool TryGetMember(GetMemberBinder binder, out object result) { // We don't care about the return value.....
.net DynamicObject implementation that returns null for missing properties rather than a RunTimeBinderException I'd like to be able to do something like the following: dynamic a = new ExpandoObject(); Console.WriteLine(a.SomeProperty?? "No such member"); but that throws RunTimeBinderException: 'System.Dynamic.ExpandoOb...
TITLE: .net DynamicObject implementation that returns null for missing properties rather than a RunTimeBinderException QUESTION: I'd like to be able to do something like the following: dynamic a = new ExpandoObject(); Console.WriteLine(a.SomeProperty?? "No such member"); but that throws RunTimeBinderException: 'System...
[ "c#", "dynamic" ]
22
35
5,290
1
0
2011-06-09T10:58:09.197000
2011-06-09T11:04:37.477000
6,291,707
6,291,776
Trying to load dll into Application domain
I am trying to do the following: if(domain!= null) { AppDomain.Unload(domain); } domain = AppDomain.CreateDomain(appDomainName); Assembly assembly = domain.Load(location); and the code throws FileLoadException but when i do the following there is no exception: Assembly assembly = Assembly.LoadFrom(location); Could yo...
From Suzanne Cook's.NET CLR Notes: AppDomain.Load() is only meant to be called on AppDomain.CurrentDomain. (It's meant for interop callers only. They need a non-static method, and Assembly.Load() is static.) If you call it on a different AppDomain, if the assembly successfully loads in the target appdomain, remoting wi...
Trying to load dll into Application domain I am trying to do the following: if(domain!= null) { AppDomain.Unload(domain); } domain = AppDomain.CreateDomain(appDomainName); Assembly assembly = domain.Load(location); and the code throws FileLoadException but when i do the following there is no exception: Assembly assem...
TITLE: Trying to load dll into Application domain QUESTION: I am trying to do the following: if(domain!= null) { AppDomain.Unload(domain); } domain = AppDomain.CreateDomain(appDomainName); Assembly assembly = domain.Load(location); and the code throws FileLoadException but when i do the following there is no excepti...
[ "c#", "applicationdomain" ]
0
4
983
2
0
2011-06-09T10:58:15.640000
2011-06-09T11:05:08.350000
6,291,710
6,291,739
Why do javascript tags use "text"?
Whenever we write a javascript,this is how we declare- But i don't understand why it is declared as a text.
Because it is. Javascript source is text. This predicate will determine how the data is transported. Then, the type of text (Javascript source) determines how it is used.
Why do javascript tags use "text"? Whenever we write a javascript,this is how we declare- But i don't understand why it is declared as a text.
TITLE: Why do javascript tags use "text"? QUESTION: Whenever we write a javascript,this is how we declare- But i don't understand why it is declared as a text. ANSWER: Because it is. Javascript source is text. This predicate will determine how the data is transported. Then, the type of text (Javascript source) determ...
[ "javascript", "mime-types" ]
1
3
204
6
0
2011-06-09T10:58:40.867000
2011-06-09T11:01:26.090000
6,291,715
6,291,839
sql date comparison
I was given a query similar to this select * from stuff where stuff.id = 1 and start_Dt < = todays_date and End_Dt > = todays_date I asked the person who gave it to me why the date comparison, the answer was "The start and end dates are necessary to ensure a unique record match" I'm confused, wouldn't that comparison e...
The reason is, that the IDs in your table are not unique, i.e. you can have more than one row with stuff.id = 1. But only one at any given time is active. This is checked with the date comparison: It returns the row with stuff.id = 1 that is currently valid. This is the row where the start date is in the past ( start_D...
sql date comparison I was given a query similar to this select * from stuff where stuff.id = 1 and start_Dt < = todays_date and End_Dt > = todays_date I asked the person who gave it to me why the date comparison, the answer was "The start and end dates are necessary to ensure a unique record match" I'm confused, wouldn...
TITLE: sql date comparison QUESTION: I was given a query similar to this select * from stuff where stuff.id = 1 and start_Dt < = todays_date and End_Dt > = todays_date I asked the person who gave it to me why the date comparison, the answer was "The start and end dates are necessary to ensure a unique record match" I'...
[ "sql", "sql-server", "t-sql", "datetime", "date-comparison" ]
0
3
452
2
0
2011-06-09T10:59:05.373000
2011-06-09T11:10:10.903000
6,291,716
6,291,759
How to retrieve more than one column using ExecuteScalar?
I am getting one column using ExecuteScalar: cmd.commandtext = "select rodeuser from customer_db_map"; string rodecustomer = cmd.executescalar; But I need to get more than one column, e.g.: cmd.commandtext = "select rodeuser,username,password from customer_db_map"; I need each column in a string: string rodecustomer = ...
ExecuteScalar executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored. To achieve this you need to use SqlCommand.ExecuteReader Method
How to retrieve more than one column using ExecuteScalar? I am getting one column using ExecuteScalar: cmd.commandtext = "select rodeuser from customer_db_map"; string rodecustomer = cmd.executescalar; But I need to get more than one column, e.g.: cmd.commandtext = "select rodeuser,username,password from customer_db_ma...
TITLE: How to retrieve more than one column using ExecuteScalar? QUESTION: I am getting one column using ExecuteScalar: cmd.commandtext = "select rodeuser from customer_db_map"; string rodecustomer = cmd.executescalar; But I need to get more than one column, e.g.: cmd.commandtext = "select rodeuser,username,password f...
[ "c#" ]
8
14
18,598
3
0
2011-06-09T10:59:09.240000
2011-06-09T11:03:36.930000
6,291,721
6,291,888
Totalling scores and adding to a graded result
I have a ratings form that allows individuals to be scored and then placed into a graded group but I'm having difficulty working out how this can be done with jQuery or JavaScript. For example, the first part of my form has this structure where the totals from each group should be written to the CombinedScore field. Th...
Using classes for different groups of items would make selectors more concise, but even with this markup you can do it like this $(function() { // Part 1 var sum = parseInt($('input[name="Food"]:checked').attr('value')); sum += parseInt($('input[name="Drink"]:checked').attr('value')); $('input[name="CombinedScore"]').v...
Totalling scores and adding to a graded result I have a ratings form that allows individuals to be scored and then placed into a graded group but I'm having difficulty working out how this can be done with jQuery or JavaScript. For example, the first part of my form has this structure where the totals from each group s...
TITLE: Totalling scores and adding to a graded result QUESTION: I have a ratings form that allows individuals to be scored and then placed into a graded group but I'm having difficulty working out how this can be done with jQuery or JavaScript. For example, the first part of my form has this structure where the totals...
[ "javascript", "jquery" ]
3
1
125
3
0
2011-06-09T10:59:41.147000
2011-06-09T11:13:35.910000
6,291,727
6,291,866
Using mvc-mini-profiler
I'm trying to use the mvc-mini-profiler with EFCodeFirst I'm creating a DbProfiledConnection and passing it to the DbContext on construction as below. The application continues to work as expected by the sql is not exposed to the Profiler. public class WebContext: DbContext { static DbConnection _connection = new SqlCo...
I suspect this relates to the static field initializer. Connections on web apps should never be static anyway (but request-specific at most). The key is: what does ProfiledDbConnection actually come out as? The Get method returns a ProfiledDbConnection only if you are currently profiling (on the current request), and t...
Using mvc-mini-profiler I'm trying to use the mvc-mini-profiler with EFCodeFirst I'm creating a DbProfiledConnection and passing it to the DbContext on construction as below. The application continues to work as expected by the sql is not exposed to the Profiler. public class WebContext: DbContext { static DbConnection...
TITLE: Using mvc-mini-profiler QUESTION: I'm trying to use the mvc-mini-profiler with EFCodeFirst I'm creating a DbProfiledConnection and passing it to the DbContext on construction as below. The application continues to work as expected by the sql is not exposed to the Profiler. public class WebContext: DbContext { s...
[ "asp.net-mvc", "entity-framework", "entity-framework-4.1", "mvc-mini-profiler" ]
13
7
2,543
1
0
2011-06-09T11:00:20.817000
2011-06-09T11:12:09.813000
6,291,729
6,292,006
how to keep application running in background? keep collecting data?
UPDATED AT BOTTOM I have written an application that logs the users position, current speed, average speed and top speed. I would like to know how to make the application do the following things: prevent the screen from turning off while it is open on the screen if the user opens another app or returns to the home scre...
Question 1: You must acquire a WakeLock. There are multiple types of wakelock, depending if you want only the cpu on or also the screen. Question 2: You should do your collecting data stuff inside a Service and separate the graphical interface from the collecting data. The Service will continue to collect the data unti...
how to keep application running in background? keep collecting data? UPDATED AT BOTTOM I have written an application that logs the users position, current speed, average speed and top speed. I would like to know how to make the application do the following things: prevent the screen from turning off while it is open on...
TITLE: how to keep application running in background? keep collecting data? QUESTION: UPDATED AT BOTTOM I have written an application that logs the users position, current speed, average speed and top speed. I would like to know how to make the application do the following things: prevent the screen from turning off w...
[ "android", "database", "gps" ]
7
7
15,636
1
0
2011-06-09T11:00:27.777000
2011-06-09T11:23:34.130000
6,291,749
6,291,773
Reference functions in C++
I have a function that gives me the error "cannot convert from 'int' to 'int &'" when I try to compile it. int& preinc(int& x) { return x++; } If I replace x++ with x, it will compile, but I'm not sure how that makes it any different. I thought that x++ returns x before it increments x, so shouldn't "return x++" be the...
x++ creates a temporary copy of the original, increments the original, and then returns the temporary. Because your function returns a reference, you are trying to return a reference to the temporary copy, which is local to the function and therefore not valid.
Reference functions in C++ I have a function that gives me the error "cannot convert from 'int' to 'int &'" when I try to compile it. int& preinc(int& x) { return x++; } If I replace x++ with x, it will compile, but I'm not sure how that makes it any different. I thought that x++ returns x before it increments x, so sh...
TITLE: Reference functions in C++ QUESTION: I have a function that gives me the error "cannot convert from 'int' to 'int &'" when I try to compile it. int& preinc(int& x) { return x++; } If I replace x++ with x, it will compile, but I'm not sure how that makes it any different. I thought that x++ returns x before it i...
[ "c++", "function", "reference" ]
5
11
210
3
0
2011-06-09T11:02:40.570000
2011-06-09T11:05:02.373000
6,291,765
6,291,843
When should a Service be stopped
My android application starts a service in the onCreate() callback of a class that extends Application. The service performs some background tasks that are relevant to the user only while the application is running. For that reason I would like to close the service when the application's last activity is closed. I've t...
An Android service, once started, will continue running until the Context.stopService() or stopSelf() is called. There are various hooks you can use to stop the service using Context.stopService (the service itself, or an onDestroy()/onPause callback in one of the activities, or a button click). It's true that Android ...
When should a Service be stopped My android application starts a service in the onCreate() callback of a class that extends Application. The service performs some background tasks that are relevant to the user only while the application is running. For that reason I would like to close the service when the application'...
TITLE: When should a Service be stopped QUESTION: My android application starts a service in the onCreate() callback of a class that extends Application. The service performs some background tasks that are relevant to the user only while the application is running. For that reason I would like to close the service whe...
[ "android" ]
1
2
995
2
0
2011-06-09T11:04:33.733000
2011-06-09T11:10:37.603000
6,291,768
6,291,806
Opening all links with class popup in a new window
I have lots of links on my page with class="popup". I want all of these to open in a new window. Any nice way to define this with JavaScript?
I am using.live() to support links that might be added later to the DOM. If you are not adding links from event handlers, Ajax callbacks, etc., you can simply use.click(). $('a.popup').live('click', function (e) { window.open(this.href); e.preventDefault(); }); Please note, that according to the current HTML5 spec, you...
Opening all links with class popup in a new window I have lots of links on my page with class="popup". I want all of these to open in a new window. Any nice way to define this with JavaScript?
TITLE: Opening all links with class popup in a new window QUESTION: I have lots of links on my page with class="popup". I want all of these to open in a new window. Any nice way to define this with JavaScript? ANSWER: I am using.live() to support links that might be added later to the DOM. If you are not adding links...
[ "javascript", "html", "jquery", "jquery-events" ]
2
4
3,540
2
0
2011-06-09T11:04:48.223000
2011-06-09T11:07:13.027000
6,291,783
6,291,873
Using field values from joined query as columns
I have two MySQL tables describing data that can be extended into subclasses, one that describes the parent class data and another one describing metadata fields as one-to-many relationships. Example rows from table page: id | name -----+----------------------- 123 | Example page 999 | Another page Example rows from ta...
SELECT pm.page_id as id, p.name, max(IF(pm.key = 'picture', pm.value, null)) as picture, max(IF(pm.key = 'video', pm.value, null)) as video, max(IF(pm.key = 'sound', pm.value, null)) as sound FROM page p INNER JOIN page_metadata pm ON (p.id = pm.page_id) GROUP BY p.id
Using field values from joined query as columns I have two MySQL tables describing data that can be extended into subclasses, one that describes the parent class data and another one describing metadata fields as one-to-many relationships. Example rows from table page: id | name -----+----------------------- 123 | Exam...
TITLE: Using field values from joined query as columns QUESTION: I have two MySQL tables describing data that can be extended into subclasses, one that describes the parent class data and another one describing metadata fields as one-to-many relationships. Example rows from table page: id | name -----+----------------...
[ "mysql", "one-to-many" ]
1
1
40
2
0
2011-06-09T11:05:32.280000
2011-06-09T11:12:32.370000
6,291,794
6,291,923
detect ADB from mobile Android
Can we detect from phone that phone is connected to charger or Android Debug Bridge (ADB)? and can we shutdown adb server using adb kill-server command?
You can detect that phone is connected to charger by receiving broadcast intent ACTION_POWER_CONNECTED. AFAIK you can't stop ADB server
detect ADB from mobile Android Can we detect from phone that phone is connected to charger or Android Debug Bridge (ADB)? and can we shutdown adb server using adb kill-server command?
TITLE: detect ADB from mobile Android QUESTION: Can we detect from phone that phone is connected to charger or Android Debug Bridge (ADB)? and can we shutdown adb server using adb kill-server command? ANSWER: You can detect that phone is connected to charger by receiving broadcast intent ACTION_POWER_CONNECTED. AFAIK...
[ "android", "detection", "adb" ]
1
2
571
1
0
2011-06-09T11:06:15.603000
2011-06-09T11:17:03.067000
6,291,797
6,291,860
arithmetic overflow error for data type tinyint,value = 256
byte number = 1; add(number); // form.cs public static int Add( byte? order) { arParams[0] = new SqlParameter("@number", (number.HasValue)? ((object)number): DBNull.Value); // stored procedure call is made which takes paramaters, } Stored procedure looks like this @number tinyint AS BEGIN IF @number IS NOT NULL BEGIN U...
It is because you cannot set the Tinyint value beyond 255 and below 0. So you should apply validation before sending it to database.
arithmetic overflow error for data type tinyint,value = 256 byte number = 1; add(number); // form.cs public static int Add( byte? order) { arParams[0] = new SqlParameter("@number", (number.HasValue)? ((object)number): DBNull.Value); // stored procedure call is made which takes paramaters, } Stored procedure looks like ...
TITLE: arithmetic overflow error for data type tinyint,value = 256 QUESTION: byte number = 1; add(number); // form.cs public static int Add( byte? order) { arParams[0] = new SqlParameter("@number", (number.HasValue)? ((object)number): DBNull.Value); // stored procedure call is made which takes paramaters, } Stored pro...
[ "sql-server" ]
3
3
32,049
2
0
2011-06-09T11:06:22.623000
2011-06-09T11:11:27.673000
6,291,810
6,291,856
Implementation patterns to avoid infinite loops with events
A naive implementation of MVC leeds to infinite loops. Example: Model is a Workbook with Worksheets, View is a Tabbar with Tabs User interakts with Tabbar to create new Tab Tabbar sends event onTabAdded to Controler Controler calls Workbook.addWorksheet() Workbook sends event onWorksheetAdded to Tabbar Tabbar adds Tab ...
You would typically code something like this (pseudo code): boolean inEventProcessing = false; processEvent(event){ if inEventProcessing return inEventProcessing = true doProcessEvent(event) inEventProcessing = false } The alternative is to make sure that by construction no loops happen. This is the conceptual cleaner...
Implementation patterns to avoid infinite loops with events A naive implementation of MVC leeds to infinite loops. Example: Model is a Workbook with Worksheets, View is a Tabbar with Tabs User interakts with Tabbar to create new Tab Tabbar sends event onTabAdded to Controler Controler calls Workbook.addWorksheet() Work...
TITLE: Implementation patterns to avoid infinite loops with events QUESTION: A naive implementation of MVC leeds to infinite loops. Example: Model is a Workbook with Worksheets, View is a Tabbar with Tabs User interakts with Tabbar to create new Tab Tabbar sends event onTabAdded to Controler Controler calls Workbook.a...
[ "javascript", "design-patterns", "architecture" ]
4
3
2,169
1
0
2011-06-09T11:07:23.463000
2011-06-09T11:11:20.873000
6,291,816
6,291,859
String was not recognized as a valid DateTime
I am converting the uk date format string to US format to save this into database but it throw me error "String was not recognized as a valid DateTime." string dateString = "13/06/2011"; DateTime dt = DateTime.Parse(dateString); I have also tried this but same exception. DateTime aa = DateTime.ParseExact(dateString, "M...
You have specified the wrong format. It should be dd/MM/yyyy: var dateString = "13/06/2011"; var aa = DateTime.ParseExact(dateString, "dd/MM/yyyy", CultureInfo.CurrentCulture);
String was not recognized as a valid DateTime I am converting the uk date format string to US format to save this into database but it throw me error "String was not recognized as a valid DateTime." string dateString = "13/06/2011"; DateTime dt = DateTime.Parse(dateString); I have also tried this but same exception. Da...
TITLE: String was not recognized as a valid DateTime QUESTION: I am converting the uk date format string to US format to save this into database but it throw me error "String was not recognized as a valid DateTime." string dateString = "13/06/2011"; DateTime dt = DateTime.Parse(dateString); I have also tried this but ...
[ "c#" ]
2
7
4,354
3
0
2011-06-09T11:07:58.157000
2011-06-09T11:11:25.780000
6,291,824
6,291,855
Check Windows Installer Version
I have checked my Add/Remove program panel and Components panel as well but could not find the version of Windows Installer on my machine. Can anybody please guide me in finding out the version of Windows Installer installed on any machine
Go into cmd(command prompt) or the run dialog ( Windows + R ) and execute msiexec -?. It will open a window containing your version at the top.
Check Windows Installer Version I have checked my Add/Remove program panel and Components panel as well but could not find the version of Windows Installer on my machine. Can anybody please guide me in finding out the version of Windows Installer installed on any machine
TITLE: Check Windows Installer Version QUESTION: I have checked my Add/Remove program panel and Components panel as well but could not find the version of Windows Installer on my machine. Can anybody please guide me in finding out the version of Windows Installer installed on any machine ANSWER: Go into cmd(command p...
[ "windows-installer" ]
34
66
93,222
1
0
2011-06-09T11:08:58.503000
2011-06-09T11:11:20.517000
6,291,827
6,291,882
Get the directory a bash script file is in
How can I get the directory a bash script file is in, when that script file is included from another (which makes it different from this question )? /script1.sh. /dir2/script2.sh /dir2/script2.sh # echoes "/dir2" echo whatevergetsthatdir This is the script I'm trying to "fix" /etc/init.d/silvercar-gameserver (unique fo...
In order to source the file, the parent script obviously knows the path where the child script is. Set it as a variable, then in the child script check for that variable. If it is available you know it's been sourced and you can use that path, otherwise use the normal trick in the question you linked. # script1.sh RESO...
Get the directory a bash script file is in How can I get the directory a bash script file is in, when that script file is included from another (which makes it different from this question )? /script1.sh. /dir2/script2.sh /dir2/script2.sh # echoes "/dir2" echo whatevergetsthatdir This is the script I'm trying to "fix" ...
TITLE: Get the directory a bash script file is in QUESTION: How can I get the directory a bash script file is in, when that script file is included from another (which makes it different from this question )? /script1.sh. /dir2/script2.sh /dir2/script2.sh # echoes "/dir2" echo whatevergetsthatdir This is the script I'...
[ "bash", "shell" ]
8
5
2,100
2
0
2011-06-09T11:09:05.123000
2011-06-09T11:12:59.383000
6,291,828
6,291,942
Referencing schema names for tables in the Entity Framework
How do you explicitally tell EF that a table lies in a specific schema? For example, the AdventureWorks database defines the Production.Product table. When using the OnModelCreating method, I use the following code: protected override void OnModelCreating(DbModelBuilder modelBuilder) { EntityTypeConfiguration config = ...
ToTable has overloaded version which accepts two parameters: table name and schema name so correct version is: config.ToTable("Product", "Production");
Referencing schema names for tables in the Entity Framework How do you explicitally tell EF that a table lies in a specific schema? For example, the AdventureWorks database defines the Production.Product table. When using the OnModelCreating method, I use the following code: protected override void OnModelCreating(DbMo...
TITLE: Referencing schema names for tables in the Entity Framework QUESTION: How do you explicitally tell EF that a table lies in a specific schema? For example, the AdventureWorks database defines the Production.Product table. When using the OnModelCreating method, I use the following code: protected override void On...
[ "c#", "entity-framework-4.1", "data-access" ]
6
14
2,071
2
0
2011-06-09T11:09:07.487000
2011-06-09T11:18:06.127000
6,291,832
6,292,060
Is it possible to have two pixastic-effected images on a single page?
Simple, but specfic question. I have a site which is using Pixastic to blur images. There are two images on a page which need to be blurred. This seems to work fine in IE (which I believe is using filters on the images) but doesn't work on other browsers (Firefox/Chrome). In those browsers it just effects the second im...
As far as I can tell, what you have that should work. Option 2. Try specifying a CSS class explicitly instead? e.g. roughly something like:
Is it possible to have two pixastic-effected images on a single page? Simple, but specfic question. I have a site which is using Pixastic to blur images. There are two images on a page which need to be blurred. This seems to work fine in IE (which I believe is using filters on the images) but doesn't work on other brow...
TITLE: Is it possible to have two pixastic-effected images on a single page? QUESTION: Simple, but specfic question. I have a site which is using Pixastic to blur images. There are two images on a page which need to be blurred. This seems to work fine in IE (which I believe is using filters on the images) but doesn't ...
[ "blur", "pixastic" ]
0
1
775
1
0
2011-06-09T11:09:28.417000
2011-06-09T11:27:50.577000
6,291,838
6,291,872
How to check this Json response whether its null or not
{"PatientPastMedicalHistoryGetResult":{"PastMedicalHistory":[]}} The PastMedicalHistory array is NUll without values. How can i check it.
if (response.PatientPastMedicalHistoryGetResult.PastMedicalHistory.length == 0) { } And this isn't null. This is an empty array.
How to check this Json response whether its null or not {"PatientPastMedicalHistoryGetResult":{"PastMedicalHistory":[]}} The PastMedicalHistory array is NUll without values. How can i check it.
TITLE: How to check this Json response whether its null or not QUESTION: {"PatientPastMedicalHistoryGetResult":{"PastMedicalHistory":[]}} The PastMedicalHistory array is NUll without values. How can i check it. ANSWER: if (response.PatientPastMedicalHistoryGetResult.PastMedicalHistory.length == 0) { } And this isn't...
[ "javascript", "json" ]
1
1
1,045
2
0
2011-06-09T11:10:06.183000
2011-06-09T11:12:28.323000
6,291,841
6,291,953
Jquery - get list position
i have the following code Club Eat Drink I want to use jquery to get the position of the first visible list item (i.e. where style is not display: none) Can this be done with jquery? Thanks in advance
Using the code you provided, you can get the index of the first visible list item (relative to the ul element, using the following jQuery: $(".tabClass:visible").index() See this fiddle for an example using your code (it should alert "1", as the first visible list item is in position 1 (the indexing starts at 0).
Jquery - get list position i have the following code Club Eat Drink I want to use jquery to get the position of the first visible list item (i.e. where style is not display: none) Can this be done with jquery? Thanks in advance
TITLE: Jquery - get list position QUESTION: i have the following code Club Eat Drink I want to use jquery to get the position of the first visible list item (i.e. where style is not display: none) Can this be done with jquery? Thanks in advance ANSWER: Using the code you provided, you can get the index of the first v...
[ "jquery", "list" ]
2
1
3,581
5
0
2011-06-09T11:10:32.713000
2011-06-09T11:18:38.080000
6,291,842
6,293,899
Updating text of a button in a datagridview
I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last column. On click event of this button, I am using a BackgroundWorker t...
You can set the Value of the cell in question and this will update the text. For this to work you must have also set the UseColumnTextForButtonValue property of the column to false; dataGridView[0,0].Value = "Processed"; With that code you just need to change the column and row indexes to match your cell, or access the...
Updating text of a button in a datagridview I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last column. On click event of ...
TITLE: Updating text of a button in a datagridview QUESTION: I have a DataGridView on a winform. I am dynamically adding DatagridViewButtonColumn in the load method of form with button name as btnAction and text displayed on it as "Process". So, every row in the grid would have this Process button in the last column. ...
[ "winforms", "datagridview", "backgroundworker" ]
3
5
4,538
1
0
2011-06-09T11:10:36.413000
2011-06-09T13:55:07.410000
6,291,875
6,292,073
Why does my python egg not work? - No distributions at all found for
I have made a distribution of my python package with the following setup.py #!/usr/bin/env python from setuptools import setup setup(name='mypackagename', version='0.1', description='Tool....', author='Peter Smit', author_email='lala@lala.com', packages=['mypackagename'], package_dir={'': 'src'}, install_requires=['b...
why not using setuptools easy_install? easy_install mypackagename-0.1-py2.6.egg If you want to work with eggs that's the way.
Why does my python egg not work? - No distributions at all found for I have made a distribution of my python package with the following setup.py #!/usr/bin/env python from setuptools import setup setup(name='mypackagename', version='0.1', description='Tool....', author='Peter Smit', author_email='lala@lala.com', pack...
TITLE: Why does my python egg not work? - No distributions at all found for QUESTION: I have made a distribution of my python package with the following setup.py #!/usr/bin/env python from setuptools import setup setup(name='mypackagename', version='0.1', description='Tool....', author='Peter Smit', author_email='la...
[ "python", "distribution", "pip", "egg" ]
5
2
8,517
3
0
2011-06-09T11:12:41.123000
2011-06-09T11:29:05.350000
6,291,880
6,291,960
jquery modal window and opening a pdf file in new window
I need to show listing of names of PDF files which are to be printed. I need to show this list in a JQuery Modal window. If anybody can please suggest as to how to redirect the view to a jquery modal window? I plan to use JQuery UI for the purpose. My other requirement is to display the select PDF file in a new window.
You could have a controller action that will return a partial view containing the list of PDF files. Then configure jQuery Dialog to use AJAX in order to fetch this list from the server and show it in a div. Finally inside this list you could add target="_blank" to anchor elements pointing to the actual PDF file so tha...
jquery modal window and opening a pdf file in new window I need to show listing of names of PDF files which are to be printed. I need to show this list in a JQuery Modal window. If anybody can please suggest as to how to redirect the view to a jquery modal window? I plan to use JQuery UI for the purpose. My other requi...
TITLE: jquery modal window and opening a pdf file in new window QUESTION: I need to show listing of names of PDF files which are to be printed. I need to show this list in a JQuery Modal window. If anybody can please suggest as to how to redirect the view to a jquery modal window? I plan to use JQuery UI for the purpo...
[ "asp.net-mvc-2", "jquery-ui", "modal-dialog" ]
1
1
1,835
2
0
2011-06-09T11:12:54.330000
2011-06-09T11:19:18.667000
6,291,906
6,292,075
Display HTML UL in a vertical direction
Normally i use ul to have list of product like this, just add "float: left" to the li and you are almost running: p1 p2 p3 p4 p5 p6 p7 p8 Now i'm in the situation where i want it apposite like this: p1 p4 p2 p6 p3 p7 p4 p8 Is this possible? EDIT: The content in the p1 is dynamic and can be different in size(height). So...
You could use the CSS3 multi-column module but it doesn't have widespread support yet (i.e. won't work in IE).
Display HTML UL in a vertical direction Normally i use ul to have list of product like this, just add "float: left" to the li and you are almost running: p1 p2 p3 p4 p5 p6 p7 p8 Now i'm in the situation where i want it apposite like this: p1 p4 p2 p6 p3 p7 p4 p8 Is this possible? EDIT: The content in the p1 is dynamic ...
TITLE: Display HTML UL in a vertical direction QUESTION: Normally i use ul to have list of product like this, just add "float: left" to the li and you are almost running: p1 p2 p3 p4 p5 p6 p7 p8 Now i'm in the situation where i want it apposite like this: p1 p4 p2 p6 p3 p7 p4 p8 Is this possible? EDIT: The content in ...
[ "html", "css" ]
3
3
13,209
3
0
2011-06-09T11:15:38.737000
2011-06-09T11:29:19.883000
6,291,911
6,291,993
Java Interface to enforce definition of enum type
I need to define an Interface that redefines something like a hashset. So I have methods to of the type get(byte key). As I can not use descriptive keys like String I am looking for a generic way to define the keys available within some implementation of the interface. I think of using an enum for that. But is it possi...
You can't enforce the creation of such enums, but you can force a type argument to be an enum: public interface Frobnicator > { void frobnicate(E value); } enum Bar { X, Y; } class BarFrobnicator implements Frobnicator { @Override public void frobnicate(Bar value) { // do stuff } } In this case a Frobnicator could si...
Java Interface to enforce definition of enum type I need to define an Interface that redefines something like a hashset. So I have methods to of the type get(byte key). As I can not use descriptive keys like String I am looking for a generic way to define the keys available within some implementation of the interface. ...
TITLE: Java Interface to enforce definition of enum type QUESTION: I need to define an Interface that redefines something like a hashset. So I have methods to of the type get(byte key). As I can not use descriptive keys like String I am looking for a generic way to define the keys available within some implementation ...
[ "java", "interface", "enums" ]
2
5
6,376
2
0
2011-06-09T11:16:10.133000
2011-06-09T11:22:29.860000
6,291,932
6,292,000
View engine does not render the view when I pass a model from the controller
I am developing an MVC3 application using C# and Razor. I have a problem when I need to display one the Play View. The Play action method is used to retrieve a path of a FLV (Flash) file to be then passed to the Play View to reproduce the file. When I use return View("Play") the application renders the View correctly. ...
You are invoking a wrong overload. Here's the correct overload: return View("Play", (object)path); or you could also declare the path variable as object: object path = Server.MapPath("~/App_Data/WebinarRecordings/" + ltopicDownloadLink); and then return View("Play", path); will also work:
View engine does not render the view when I pass a model from the controller I am developing an MVC3 application using C# and Razor. I have a problem when I need to display one the Play View. The Play action method is used to retrieve a path of a FLV (Flash) file to be then passed to the Play View to reproduce the file...
TITLE: View engine does not render the view when I pass a model from the controller QUESTION: I am developing an MVC3 application using C# and Razor. I have a problem when I need to display one the Play View. The Play action method is used to retrieve a path of a FLV (Flash) file to be then passed to the Play View to ...
[ "c#", "asp.net-mvc-3", "rendering", "viewengine" ]
0
2
456
4
0
2011-06-09T11:17:24.710000
2011-06-09T11:23:07.323000
6,291,933
6,291,982
Catch Application Exceptions in a Windows Forms Application
Is there anyway to catch expections that is thrown by anywhere in the code? I would like to catch exceptions and handle them in a similar manner rather than writing try catch blocks for each functionality.
In Windows Forms applications, when an exception is thrown anywhere in the application (on the main thread or during asynchronous calls), you can catch it by registering for the ThreadException event on the Application. In this way you can treat all the exceptions in the same way. Application.ThreadException += new Thr...
Catch Application Exceptions in a Windows Forms Application Is there anyway to catch expections that is thrown by anywhere in the code? I would like to catch exceptions and handle them in a similar manner rather than writing try catch blocks for each functionality.
TITLE: Catch Application Exceptions in a Windows Forms Application QUESTION: Is there anyway to catch expections that is thrown by anywhere in the code? I would like to catch exceptions and handle them in a similar manner rather than writing try catch blocks for each functionality. ANSWER: In Windows Forms applicatio...
[ "c#", ".net", "winforms", "exception" ]
27
39
30,109
4
0
2011-06-09T11:17:28.890000
2011-06-09T11:21:24.800000
6,291,956
6,292,037
jQuery html Attributes issue
I use the jQuery html Attributes to wrap some words in a large piece of text, this works fine but if the text has some html tags in it, it will remove all tags. Is there a way to prevent this with the html Attributes, preventing that i strips the other tags? piece of the code var pattern = new RegExp('('+$.unique(text....
That should work if you replace.text() with.html(), like this: jQuery('p').each(function(i){ // replaced.text() with.html() var orgText = jQuery(this).html(); orgText = orgText.replace(pattern, function($1){ return ' ' + $1 + ' '; }); jQuery(this).html(orgText); }); See test case on jsFiddle
jQuery html Attributes issue I use the jQuery html Attributes to wrap some words in a large piece of text, this works fine but if the text has some html tags in it, it will remove all tags. Is there a way to prevent this with the html Attributes, preventing that i strips the other tags? piece of the code var pattern = ...
TITLE: jQuery html Attributes issue QUESTION: I use the jQuery html Attributes to wrap some words in a large piece of text, this works fine but if the text has some html tags in it, it will remove all tags. Is there a way to prevent this with the html Attributes, preventing that i strips the other tags? piece of the c...
[ "javascript", "jquery", "html" ]
0
1
149
2
0
2011-06-09T11:18:58.403000
2011-06-09T11:25:52.750000
6,291,959
6,292,023
MySQL sort after argument in IN()
I have string containing a lot of IDs corresponding to my database. Like: 1,2,3,4,5 I then do a mySQL query to select all those rows: SELECT * FROM `table` WHERE `id` IN (".$myIDs.") I want mySQL to return the rows in the order they are in my IN() select. So if I instead had 2,1,3,4,5 I would have #2 as first row, when...
You should be able to do this via the FIELD() function like so: SELECT * FROM `table` WHERE `id` IN (2,1,3,4,5) ORDER BY FIELD(`id`, 2,1,3,4,5) DESC That is: SELECT * FROM `table` WHERE `id` IN (".$myIDs.") ORDER BY FIELD(`id`, ".$myIDs.") DESC More in this blog post: Sorting MySQL rows using column values.
MySQL sort after argument in IN() I have string containing a lot of IDs corresponding to my database. Like: 1,2,3,4,5 I then do a mySQL query to select all those rows: SELECT * FROM `table` WHERE `id` IN (".$myIDs.") I want mySQL to return the rows in the order they are in my IN() select. So if I instead had 2,1,3,4,5 ...
TITLE: MySQL sort after argument in IN() QUESTION: I have string containing a lot of IDs corresponding to my database. Like: 1,2,3,4,5 I then do a mySQL query to select all those rows: SELECT * FROM `table` WHERE `id` IN (".$myIDs.") I want mySQL to return the rows in the order they are in my IN() select. So if I inst...
[ "php", "mysql" ]
4
6
661
4
0
2011-06-09T11:19:17.670000
2011-06-09T11:24:59.053000
6,291,979
6,292,055
Is it possible to view exact google map in Android app?
I have created a mapview application and it shows map without any problem. But when I compare this map with the "Maps" application in the Android phone, there is some mismatch in the places. Some places are not shown in my application. I think the "Maps" application shows exactly the same as Google map. How to load the...
The official Google Maps application uses a different tiles provider than the MapView in the Android SDK. You'll notice that the tiles (squares on the map) are of much higher quality in the Google Maps application. Third party developers cannot use embed these high quality tiles in their applications. You'll notice oth...
Is it possible to view exact google map in Android app? I have created a mapview application and it shows map without any problem. But when I compare this map with the "Maps" application in the Android phone, there is some mismatch in the places. Some places are not shown in my application. I think the "Maps" applicati...
TITLE: Is it possible to view exact google map in Android app? QUESTION: I have created a mapview application and it shows map without any problem. But when I compare this map with the "Maps" application in the Android phone, there is some mismatch in the places. Some places are not shown in my application. I think th...
[ "android", "google-maps", "android-mapview" ]
0
2
126
1
0
2011-06-09T11:21:02.610000
2011-06-09T11:27:23.953000
6,291,988
6,292,039
LEFT JOIN not showing all rows for table on the left
Consider this query: SELECT s.*, COUNT( ssh_logs.id ) AS ssh_count FROM servers s LEFT JOIN logs ssh_logs ON s.ip_address = ssh_logs.server_ip I am under the impression the LEFT JOIN shows all rows on the left table, regardless of whether there's a match for the ON condition. SELECT s.* FROM servers s Returns 12 entrie...
The aggregate function count() collapses all rows into one. Do a group by to see the count per ip-address. SELECT s.*, COUNT(ssh_logs.id) AS ssh_count FROM servers s LEFT JOIN logs ssh_logs ON s.ip_address = ssh_logs.server_ip GROUP BY s.ip_address This will work best if servers.ip_address is an unique field for server...
LEFT JOIN not showing all rows for table on the left Consider this query: SELECT s.*, COUNT( ssh_logs.id ) AS ssh_count FROM servers s LEFT JOIN logs ssh_logs ON s.ip_address = ssh_logs.server_ip I am under the impression the LEFT JOIN shows all rows on the left table, regardless of whether there's a match for the ON c...
TITLE: LEFT JOIN not showing all rows for table on the left QUESTION: Consider this query: SELECT s.*, COUNT( ssh_logs.id ) AS ssh_count FROM servers s LEFT JOIN logs ssh_logs ON s.ip_address = ssh_logs.server_ip I am under the impression the LEFT JOIN shows all rows on the left table, regardless of whether there's a ...
[ "mysql", "join" ]
3
7
566
1
0
2011-06-09T11:22:03.797000
2011-06-09T11:26:02.490000
6,291,995
6,292,051
What's happening with my process?
The following process is still alive, but the actual code has finished. How do I go about making sure the process gets ended? USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 8100 90.4 3.4 13364 8956? Rl Jun07 2335:22 ruby haccts.rb I found out what R and l stand for: R Running or runnable (on run queue) l M...
Not sure about Ruby, but in most programming languages, you add return 0; at the end of the program. I think it was something like Process.Exit() in Ruby however.
What's happening with my process? The following process is still alive, but the actual code has finished. How do I go about making sure the process gets ended? USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 8100 90.4 3.4 13364 8956? Rl Jun07 2335:22 ruby haccts.rb I found out what R and l stand for: R Runn...
TITLE: What's happening with my process? QUESTION: The following process is still alive, but the actual code has finished. How do I go about making sure the process gets ended? USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 8100 90.4 3.4 13364 8956? Rl Jun07 2335:22 ruby haccts.rb I found out what R and l...
[ "ruby", "linux", "kernel" ]
0
0
64
1
0
2011-06-09T11:22:46.330000
2011-06-09T11:26:44.400000
6,292,018
6,292,078
Using EOF Function as a Condition
I am trying to import data from a file in my project but I am having trouble finding EOF. Firstly, I used the EOF function as a condition but I after reading this, I tried changed the code but still it is giving same error. Please help me out. Thanks #include #include #include using namespace std; class Rooms; class Gu...
It seems you have one or two syntax problems: you've got code outside of a function or main (the while and infile commands) they need to be put into main or a function. your second while needs a do ( do{....}while(1), also it runs forever All your variables are defined outside of main. This makes them global variables,...
Using EOF Function as a Condition I am trying to import data from a file in my project but I am having trouble finding EOF. Firstly, I used the EOF function as a condition but I after reading this, I tried changed the code but still it is giving same error. Please help me out. Thanks #include #include #include using na...
TITLE: Using EOF Function as a Condition QUESTION: I am trying to import data from a file in my project but I am having trouble finding EOF. Firstly, I used the EOF function as a condition but I after reading this, I tried changed the code but still it is giving same error. Please help me out. Thanks #include #include...
[ "c++", "file", "eof" ]
2
3
410
2
0
2011-06-09T11:24:33.023000
2011-06-09T11:29:30.677000
6,292,045
6,296,530
Scroll frameset/frame on iPad Safari
I have a with 3 frames. Now the height of the midddle is dynamic i.e. depends on the content.. I have an issue with this on the iPad. i.e. if the height for this middle increases, the footer frame appears partially or in some cases completely hidden..Also I cannot scroll through the same. Indirectly speaking, the visib...
You can use two fingers to scroll a frame or iframe in iOS Safari, but it's a nasty, hard to discover user interface. Frames are going to be effectively unusable for users in iOS.
Scroll frameset/frame on iPad Safari I have a with 3 frames. Now the height of the midddle is dynamic i.e. depends on the content.. I have an issue with this on the iPad. i.e. if the height for this middle increases, the footer frame appears partially or in some cases completely hidden..Also I cannot scroll through the...
TITLE: Scroll frameset/frame on iPad Safari QUESTION: I have a with 3 frames. Now the height of the midddle is dynamic i.e. depends on the content.. I have an issue with this on the iPad. i.e. if the height for this middle increases, the footer frame appears partially or in some cases completely hidden..Also I cannot ...
[ "html", "ios", "ipad", "safari", "frame" ]
0
0
1,730
1
0
2011-06-09T11:26:32.830000
2011-06-09T16:59:06.960000
6,293,766
6,293,778
List filtering with LINQ
So I came across this method in code: private void FilterBasedUponPermission(List list) { list.RemoveAll(item => (item.Permission == Controllers.Indications.ICConstants.TradeType_LLH &&!isLLH) || (item.Permission == Controllers.Indications.ICConstants.TradeType_ALM &&!isALM) || (item.Permission == Controllers.Indicatio...
Just add a item.Permission == null list.RemoveAll(item => item.Permission == null || (item.Permission == Controllers.Indications.ICConstants.TradeType_LLH &&!isLLH) || (item.Permission == Controllers.Indications.ICConstants.TradeType_ALM &&!isALM) || (item.Permission == Controllers.Indications.ICConstants.TradeType_Rea...
List filtering with LINQ So I came across this method in code: private void FilterBasedUponPermission(List list) { list.RemoveAll(item => (item.Permission == Controllers.Indications.ICConstants.TradeType_LLH &&!isLLH) || (item.Permission == Controllers.Indications.ICConstants.TradeType_ALM &&!isALM) || (item.Permission...
TITLE: List filtering with LINQ QUESTION: So I came across this method in code: private void FilterBasedUponPermission(List list) { list.RemoveAll(item => (item.Permission == Controllers.Indications.ICConstants.TradeType_LLH &&!isLLH) || (item.Permission == Controllers.Indications.ICConstants.TradeType_ALM &&!isALM) |...
[ "c#", ".net", "linq" ]
2
7
259
3
0
2011-06-09T13:44:56.417000
2011-06-09T13:46:06.483000
6,293,771
6,293,896
Print xhtml from command line?
I'm working with a client who has a print process that essentially prints hundreds of html pages nightly. The tool they use now is from bersoft called HTMLPrint. Recently, the vendor of the HTML documents upgraded everything to XHTML and uses Anchor tags (basically merging 10 files into 1). I've been tasked with the jo...
Without going too far (and noting that HTMLPrint's version history ends at Jan 2010), I found another article mentioning alternatives for printing html: Print Wide HTML 1.0.0 PDFArea HTML to PDF Converter 2.0 ASP Printer COM 2.1 ASPcodePrint 1.5.15 Batch Printing 1.0 LIKSE32 3.30 Smart Print Control 4.1 ONEView 1 Print...
Print xhtml from command line? I'm working with a client who has a print process that essentially prints hundreds of html pages nightly. The tool they use now is from bersoft called HTMLPrint. Recently, the vendor of the HTML documents upgraded everything to XHTML and uses Anchor tags (basically merging 10 files into 1...
TITLE: Print xhtml from command line? QUESTION: I'm working with a client who has a print process that essentially prints hundreds of html pages nightly. The tool they use now is from bersoft called HTMLPrint. Recently, the vendor of the HTML documents upgraded everything to XHTML and uses Anchor tags (basically mergi...
[ "c#", ".net" ]
4
1
393
2
0
2011-06-09T13:45:35.060000
2011-06-09T13:54:54.673000
6,293,793
6,293,867
Desktop IDE-Style Layouts on the Web
I am making a single-page, full-screen web application which will have a similar interface to an IDE (with menus at the top, output pane on the bottom, and input panes tiled horizontally across the middle). I am targeting only modern browsers, so a solution that uses HTML5 would be fine. Is there a good JavaScript fram...
You can try http://dhtmlx.com/ For a living exemple of what you want to do, try this apps: http://c9.io/ It uses ACE: http://ace.ajax.org/
Desktop IDE-Style Layouts on the Web I am making a single-page, full-screen web application which will have a similar interface to an IDE (with menus at the top, output pane on the bottom, and input panes tiled horizontally across the middle). I am targeting only modern browsers, so a solution that uses HTML5 would be ...
TITLE: Desktop IDE-Style Layouts on the Web QUESTION: I am making a single-page, full-screen web application which will have a similar interface to an IDE (with menus at the top, output pane on the bottom, and input panes tiled horizontally across the middle). I am targeting only modern browsers, so a solution that us...
[ "javascript", "css", "html" ]
1
1
1,470
2
0
2011-06-09T13:47:15.927000
2011-06-09T13:53:07.507000
6,293,820
6,293,849
Why is the last number wrong?
Why is only the last number wrong in the output this code: public class Test { public static void main(String[] args) { System.out.println("Hello world"); System.out.println("I wounder is the sqaure root of (2*3) the same as the sqaure root of 2 and 3 multiplied."); double squareroot0 = Math.pow(3*2, 0.5); double squar...
You can't represent numbers with infinite precision in a finite computer, so you need to round. What you see is the effect of rounding. This is inherent to all uses of floating point numbers. Mandatory link: What Every Computer Scientist Should Know About Floating-Point Arithmetic
Why is the last number wrong? Why is only the last number wrong in the output this code: public class Test { public static void main(String[] args) { System.out.println("Hello world"); System.out.println("I wounder is the sqaure root of (2*3) the same as the sqaure root of 2 and 3 multiplied."); double squareroot0 = Ma...
TITLE: Why is the last number wrong? QUESTION: Why is only the last number wrong in the output this code: public class Test { public static void main(String[] args) { System.out.println("Hello world"); System.out.println("I wounder is the sqaure root of (2*3) the same as the sqaure root of 2 and 3 multiplied."); doubl...
[ "java", "math", "double" ]
9
16
568
4
0
2011-06-09T13:48:51.380000
2011-06-09T13:51:19.830000
6,293,843
6,293,889
Store inline HTML within variable in PHP
I was wondering, mostly because I think I've seen it before somewhere, if it is possible to store HTML within a variable, something like the following (I know this makes no sense, it's just to clarify my question): text goes here And then $var would equal text goes here
You could do that using output buffering. Have a look at the examples at ob_get_contents() and ob_start(). All kinds of stuff, maybe some etc.
Store inline HTML within variable in PHP I was wondering, mostly because I think I've seen it before somewhere, if it is possible to store HTML within a variable, something like the following (I know this makes no sense, it's just to clarify my question): text goes here And then $var would equal text goes here
TITLE: Store inline HTML within variable in PHP QUESTION: I was wondering, mostly because I think I've seen it before somewhere, if it is possible to store HTML within a variable, something like the following (I know this makes no sense, it's just to clarify my question): text goes here And then $var would equal text ...
[ "php", "html", "variables" ]
8
16
10,643
3
0
2011-06-09T13:51:10.907000
2011-06-09T13:54:31.280000
6,293,844
6,293,887
Javascript - I.E., Chrome, Firefox - How inclusion of external .js files works?
Let's say I have 3 files. index.html (HTML + javascript) somescript1.js (Javascript File) somescript2.js (Javascript file) Is it appropriate to view the javascript involved in all three of the files as being "concatenated" together such that they are one long script with variables and functions accessible between all t...
Is it appropriate to view the javascript involved in all three of the files as being "concatenated" together such that they are one long script with variables and functions accessible between all three? Not entirely. Code in the first script that is executed immediately won't have access to anything that would be hoist...
Javascript - I.E., Chrome, Firefox - How inclusion of external .js files works? Let's say I have 3 files. index.html (HTML + javascript) somescript1.js (Javascript File) somescript2.js (Javascript file) Is it appropriate to view the javascript involved in all three of the files as being "concatenated" together such tha...
TITLE: Javascript - I.E., Chrome, Firefox - How inclusion of external .js files works? QUESTION: Let's say I have 3 files. index.html (HTML + javascript) somescript1.js (Javascript File) somescript2.js (Javascript file) Is it appropriate to view the javascript involved in all three of the files as being "concatenated"...
[ "javascript", "internet-explorer", "firefox", "google-chrome" ]
3
4
313
1
0
2011-06-09T13:51:11.593000
2011-06-09T13:54:23.243000
6,293,859
6,297,078
Is kohana 3.1 i18n system efficient for long messages?
Should I use __() function for email messages, notifications etc? Aren't 1024 characters long texts just too long for php's array hash keys? If they are, is there a better way to handle long messages translations, ensuring Validation class will work with it also? Using label instead of a message would also be a choice ...
Use special View templates for a big messages. For example, views/i18n/fr/confirmation.php, views/i18n/default/confirmation.php etc.
Is kohana 3.1 i18n system efficient for long messages? Should I use __() function for email messages, notifications etc? Aren't 1024 characters long texts just too long for php's array hash keys? If they are, is there a better way to handle long messages translations, ensuring Validation class will work with it also? U...
TITLE: Is kohana 3.1 i18n system efficient for long messages? QUESTION: Should I use __() function for email messages, notifications etc? Aren't 1024 characters long texts just too long for php's array hash keys? If they are, is there a better way to handle long messages translations, ensuring Validation class will wo...
[ "internationalization", "kohana", "message" ]
3
1
371
1
0
2011-06-09T13:52:34.580000
2011-06-09T17:48:27.203000
6,296,116
6,296,214
Add data to a separate app?
I want to make it easy for people to keep their info when upgrading my app to the pro version. How can i send data from the free app to the pro app once they have it on their iPhone? I'm sure i've seen this done before.
You can register a custom URL scheme and send the data via such an handler. Have a look at http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
Add data to a separate app? I want to make it easy for people to keep their info when upgrading my app to the pro version. How can i send data from the free app to the pro app once they have it on their iPhone? I'm sure i've seen this done before.
TITLE: Add data to a separate app? QUESTION: I want to make it easy for people to keep their info when upgrading my app to the pro version. How can i send data from the free app to the pro app once they have it on their iPhone? I'm sure i've seen this done before. ANSWER: You can register a custom URL scheme and send...
[ "iphone", "objective-c" ]
0
1
54
1
0
2011-06-09T16:25:21.823000
2011-06-09T16:34:30.680000
6,296,137
6,296,164
Website database access from android application
I am doing a freelance android project which requires telephone no. operator name from a website. My application will send the telephone no to the website. This is fine, I can do it by requesting a customized URL from the app. But in return how I can get the operator name in my application? When I enter phone no. in th...
You need to extract it from the input stream returned by URL.getContent(); For a single information like this regexp pattern matching is best, otherwise you should use a library that handles html parsing such as tagsoup (part of android distro) or my favorite: apache jericho. (Although it can be tough to compile it for...
Website database access from android application I am doing a freelance android project which requires telephone no. operator name from a website. My application will send the telephone no to the website. This is fine, I can do it by requesting a customized URL from the app. But in return how I can get the operator nam...
TITLE: Website database access from android application QUESTION: I am doing a freelance android project which requires telephone no. operator name from a website. My application will send the telephone no to the website. This is fine, I can do it by requesting a customized URL from the app. But in return how I can ge...
[ "android", "webforms", "return-value" ]
0
1
393
2
0
2011-06-09T16:27:00.707000
2011-06-09T16:30:15.797000
6,296,145
6,296,233
Equivelant of MySQL Limit in Oracle.Query includes several tables?
I have the following query in MySQL and want to convert it to Oracle. I tried row_number() function and subqueries in Oracle but could not make it run properly. The query is kinda weird and covers multiple tables. Original MySQL Query: select DISTINCT uc.virtual_clip_id, uc.clip_id, uc.duration, uc.title, uc.thumbnail,...
select * from ( select DISTINCT uc.virtual_clip_id, uc.clip_id, uc.duration, uc.title, uc.thumbnail,uc.filename, uc.description, uc.block_id_start, uc.block_id_end, u.uname,uc.cdate, uc.ctime, uc.privacy_level, uc.user_id, row_number() over(order by uc.virtual_clip_id desc) rn FROM user_clips uc, users u, user_like ul ...
Equivelant of MySQL Limit in Oracle.Query includes several tables? I have the following query in MySQL and want to convert it to Oracle. I tried row_number() function and subqueries in Oracle but could not make it run properly. The query is kinda weird and covers multiple tables. Original MySQL Query: select DISTINCT u...
TITLE: Equivelant of MySQL Limit in Oracle.Query includes several tables? QUESTION: I have the following query in MySQL and want to convert it to Oracle. I tried row_number() function and subqueries in Oracle but could not make it run properly. The query is kinda weird and covers multiple tables. Original MySQL Query:...
[ "mysql", "oracle", "limit" ]
1
0
466
3
0
2011-06-09T16:27:52.343000
2011-06-09T16:36:17.020000
6,296,154
6,296,251
Is it better to send XMLHttpRequests to different scripts or one master script that delegates tasks?
I am building a rather larger web application with javascript and PHP. The app has several different types of XMLHttpRequests, and my question is about best practice: is it better to send each of those requests to a different PHP script or to one master script which then goes through and delegates tasks? Currently I ha...
The single point of entry to your application should be some kind of router, which directs requests to the correct controller (script in your case). It sounds like you're reinventing the wheel, and poorly. Your router should not be a big series of if/else statements; you should store a mapping of URI patterns to contro...
Is it better to send XMLHttpRequests to different scripts or one master script that delegates tasks? I am building a rather larger web application with javascript and PHP. The app has several different types of XMLHttpRequests, and my question is about best practice: is it better to send each of those requests to a dif...
TITLE: Is it better to send XMLHttpRequests to different scripts or one master script that delegates tasks? QUESTION: I am building a rather larger web application with javascript and PHP. The app has several different types of XMLHttpRequests, and my question is about best practice: is it better to send each of those...
[ "php", "javascript" ]
1
2
49
1
0
2011-06-09T16:28:51.987000
2011-06-09T16:38:15.573000
6,296,160
6,299,051
good/flexible software for visualizing a dynamic network simulation
I would like to make a simulation of a constrained system indexed by time. This involves a network of agents/nodes that interact based on some logic/relationships. I would like to place the nodes on a grid 2D or 3D does not matter. I would like to have edges drawn between them, and text beside them. I would like to giv...
hmm. Not sure if I'm on the right track or not, but have you looked at graphviz? It'll render graphs (including auto-layout with various different algorithms). There are bindings from various languages, e.g. pydot for python. If you need graph analysis algorithms (e.g. shortest path) there's also pygraphlib. There are ...
good/flexible software for visualizing a dynamic network simulation I would like to make a simulation of a constrained system indexed by time. This involves a network of agents/nodes that interact based on some logic/relationships. I would like to place the nodes on a grid 2D or 3D does not matter. I would like to have...
TITLE: good/flexible software for visualizing a dynamic network simulation QUESTION: I would like to make a simulation of a constrained system indexed by time. This involves a network of agents/nodes that interact based on some logic/relationships. I would like to place the nodes on a grid 2D or 3D does not matter. I ...
[ "network-programming", "visualization", "simulation", "plot", "simulink" ]
1
1
429
3
0
2011-06-09T16:29:40.637000
2011-06-09T20:47:40.663000
6,296,170
6,296,217
MVC3 language route/constant overrides?
Given the following two routes defined: routes.MapRoute(name: "StateResultsCategory", url: "{state}/{category}/{searchTerm}", defaults: new { controller = "Results", action = "SearchStateCategory" }); routes.MapRoute(name: "FRStateResults", url: "fr/{state}/{searchTerm}", defaults: new { controller = "Results", action...
The order in which you place your routes makes a difference. Placing your more specific routes above the more generic routes ensures they won't get caught up in the more generic version.
MVC3 language route/constant overrides? Given the following two routes defined: routes.MapRoute(name: "StateResultsCategory", url: "{state}/{category}/{searchTerm}", defaults: new { controller = "Results", action = "SearchStateCategory" }); routes.MapRoute(name: "FRStateResults", url: "fr/{state}/{searchTerm}", defaul...
TITLE: MVC3 language route/constant overrides? QUESTION: Given the following two routes defined: routes.MapRoute(name: "StateResultsCategory", url: "{state}/{category}/{searchTerm}", defaults: new { controller = "Results", action = "SearchStateCategory" }); routes.MapRoute(name: "FRStateResults", url: "fr/{state}/{se...
[ "asp.net-mvc-3", "routes", "custom-routes" ]
0
0
321
1
0
2011-06-09T16:30:42.923000
2011-06-09T16:34:52.997000
6,296,176
6,296,261
Packaged Obfuscated javascript Android app doesn't work when distributed and installed
I created a working debug version of an Android app, installed it on my phone and works perfectly. I should also mention the javascript aspect of my app has been Obfuscated. I use Titanium developer to create my application. Now the time came to sign, zipline, package and distribute my Android app. I then installed my ...
If javascript calls your app methods, they shall not be obfuscated, keep them in proguard.cfg. Stéphane
Packaged Obfuscated javascript Android app doesn't work when distributed and installed I created a working debug version of an Android app, installed it on my phone and works perfectly. I should also mention the javascript aspect of my app has been Obfuscated. I use Titanium developer to create my application. Now the ...
TITLE: Packaged Obfuscated javascript Android app doesn't work when distributed and installed QUESTION: I created a working debug version of an Android app, installed it on my phone and works perfectly. I should also mention the javascript aspect of my app has been Obfuscated. I use Titanium developer to create my app...
[ "javascript", "android", "package", "obfuscation", "titanium" ]
0
0
366
1
0
2011-06-09T16:31:01.807000
2011-06-09T16:39:04.693000
6,296,178
6,296,247
Finding contiguous blocks in a 2D array
Say you had an array in the form: [ [2, 2, 3, 4], [2, 3, 5, 5], [2, 2, 2, 5], [3, 2, 2, 4], ] and wanted to find coordinates of numerically contiguous blocks, in this case: [ # the 2s: [(0,0), (0,1), (1,0), (2,0), (2,1), (2,2), (3,1), (3,2)], # and the 5s: [(1,2), (1,3), (2,3)] ] how would you do it?
You can try a flood fill algorithm on each cell. (Note: flag already processed cells also during fills to not take them into account multiple times)
Finding contiguous blocks in a 2D array Say you had an array in the form: [ [2, 2, 3, 4], [2, 3, 5, 5], [2, 2, 2, 5], [3, 2, 2, 4], ] and wanted to find coordinates of numerically contiguous blocks, in this case: [ # the 2s: [(0,0), (0,1), (1,0), (2,0), (2,1), (2,2), (3,1), (3,2)], # and the 5s: [(1,2), (1,3), (2,3)] ]...
TITLE: Finding contiguous blocks in a 2D array QUESTION: Say you had an array in the form: [ [2, 2, 3, 4], [2, 3, 5, 5], [2, 2, 2, 5], [3, 2, 2, 4], ] and wanted to find coordinates of numerically contiguous blocks, in this case: [ # the 2s: [(0,0), (0,1), (1,0), (2,0), (2,1), (2,2), (3,1), (3,2)], # and the 5s: [(1,2...
[ "arrays", "search", "2d" ]
2
4
1,277
1
0
2011-06-09T16:31:09.800000
2011-06-09T16:37:54.783000
6,296,194
6,296,535
Qt Creator Project deletes Makefile in between builds
I somehow seem to have jacked up a setting in my QtCreator project. I have a modified makefile in my projects build folder, and I am using that makefile to link in some external libraries, and point to other include files, etc. It seems like in between builds, or during cleans, or something, Qt Is deleting that file, a...
Qt mostly works with project files (*.pro) which it uses to generate Makefiles or Visual-Studio project files. Look for a file with the extension.pro in your project folder. You either have to lean how to handle project files or find ways to enter this information in QtCreator via the project tab.
Qt Creator Project deletes Makefile in between builds I somehow seem to have jacked up a setting in my QtCreator project. I have a modified makefile in my projects build folder, and I am using that makefile to link in some external libraries, and point to other include files, etc. It seems like in between builds, or du...
TITLE: Qt Creator Project deletes Makefile in between builds QUESTION: I somehow seem to have jacked up a setting in my QtCreator project. I have a modified makefile in my projects build folder, and I am using that makefile to link in some external libraries, and point to other include files, etc. It seems like in bet...
[ "c++", "qt", "qt4" ]
0
4
171
1
0
2011-06-09T16:32:54.547000
2011-06-09T16:59:58.007000
6,296,200
6,298,620
Bitwise signed division algorithm in C
Well, to be honest this is actually my homework where I have to implement an algorithm which has to be able to divide two values without taking the absolute values of them to do the division. It also has to find out the remainder. The dividend is the one with bigger absolute value and the divider has smaller absolute v...
Looks like the restriction of not allowing you to take the absolute values is a big one. It is possible to modify the code you have slightly to handle the case there Rg1>0 and Rg2<0. Instead of taking the absolute value of the negative number, you just change signs in places where Rg2 is used - and also change signs on...
Bitwise signed division algorithm in C Well, to be honest this is actually my homework where I have to implement an algorithm which has to be able to divide two values without taking the absolute values of them to do the division. It also has to find out the remainder. The dividend is the one with bigger absolute value...
TITLE: Bitwise signed division algorithm in C QUESTION: Well, to be honest this is actually my homework where I have to implement an algorithm which has to be able to divide two values without taking the absolute values of them to do the division. It also has to find out the remainder. The dividend is the one with big...
[ "c", "binary", "bit-manipulation", "division" ]
8
2
3,293
1
0
2011-06-09T16:33:09.790000
2011-06-09T20:08:08.827000
6,296,206
6,296,388
Getting std::map allocator to work
I've got an extremely basic allocator: template struct Allocator: public std::allocator { inline typename std::allocator::pointer allocate(typename std::allocator::size_type n, typename std::allocator::const_pointer = 0) { std::cout << "Allocating: " << n << " itens." << std::endl; return reinterpret_cast::pointer>(::o...
Because allocator is 4th template parameter, whereas 3rd parameter is comparator like std::less? so std::map, Allocator< std::pair > > should work. Also I think you should add default ctor and copy ctor: Allocator() {} template Allocator( const Allocator & _Right ) {}
Getting std::map allocator to work I've got an extremely basic allocator: template struct Allocator: public std::allocator { inline typename std::allocator::pointer allocate(typename std::allocator::size_type n, typename std::allocator::const_pointer = 0) { std::cout << "Allocating: " << n << " itens." << std::endl; re...
TITLE: Getting std::map allocator to work QUESTION: I've got an extremely basic allocator: template struct Allocator: public std::allocator { inline typename std::allocator::pointer allocate(typename std::allocator::size_type n, typename std::allocator::const_pointer = 0) { std::cout << "Allocating: " << n << " itens....
[ "c++", "stl", "allocator" ]
7
16
7,587
2
0
2011-06-09T16:33:38.667000
2011-06-09T16:48:10.297000
6,296,223
6,296,373
Why are my Entity Framework POCOs not loading the related entities correctly?
I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key] public int IssueId { get; set; } public int Number { get; set; } public string Title { get; set; } public DateTime Date { get; set; } public virtual ICollection Creators { get; set; } } public class Creator { [Key] public ...
Your query is wrong. You want: var issue = db.Issues.Where(x => x.IssueId == 8).Single(); You are expecting a single issue, not a list of one issue.
Why are my Entity Framework POCOs not loading the related entities correctly? I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key] public int IssueId { get; set; } public int Number { get; set; } public string Title { get; set; } public DateTime Date { get; set; } public virt...
TITLE: Why are my Entity Framework POCOs not loading the related entities correctly? QUESTION: I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key] public int IssueId { get; set; } public int Number { get; set; } public string Title { get; set; } public DateTime Date { get; s...
[ "entity-framework", "lazy-loading", "entity-framework-4.1", "entity-relationship" ]
1
1
179
2
0
2011-06-09T16:35:25.320000
2011-06-09T16:47:12.850000
6,296,238
6,296,307
StructureMap - NullReferenceException
I'm new to IoC and I'm trying to get started using StructureMap, but it is throwing a NullReferenceException when I try to get an object instance. Here's my init code: ObjectFactory.Initialize(x => { x.ForRequestedType >().TheDefaultIsConcreteType >(); x.ForRequestedType ().TheDefaultIsConcreteType (); }); The ICustome...
You most likely are getting an exception that StructureMap can't build an object, which causes a cascading exception of a null reference that has eaten the real exception. The best solution for debugging these scenarios is turning on catch all exceptions, Ctrl+Alt+E and mark to catch all thrown exceptions. The next too...
StructureMap - NullReferenceException I'm new to IoC and I'm trying to get started using StructureMap, but it is throwing a NullReferenceException when I try to get an object instance. Here's my init code: ObjectFactory.Initialize(x => { x.ForRequestedType >().TheDefaultIsConcreteType >(); x.ForRequestedType ().TheDefa...
TITLE: StructureMap - NullReferenceException QUESTION: I'm new to IoC and I'm trying to get started using StructureMap, but it is throwing a NullReferenceException when I try to get an object instance. Here's my init code: ObjectFactory.Initialize(x => { x.ForRequestedType >().TheDefaultIsConcreteType >(); x.ForReques...
[ "c#", "dependency-injection", "structuremap" ]
1
4
1,322
1
0
2011-06-09T16:36:56.750000
2011-06-09T16:42:56.070000
6,296,239
6,296,304
cursor: pointer doesn't work on :after element?
I'm viewing the below example in Chrome and can't seem to get cursor: pointer to work on the:after element of li. Is there a way to get around this? http://jsfiddle.net/qKMPQ/2/
Instead of setting the cursor: pointer on the:after element, set it on the entire li and it will show up on both. Edit: For those of you trying to have different cursors on the li and its:after pseudo-element, you simply need to explicitly define the cursor property of the content inside the li. See this updated fiddle...
cursor: pointer doesn't work on :after element? I'm viewing the below example in Chrome and can't seem to get cursor: pointer to work on the:after element of li. Is there a way to get around this? http://jsfiddle.net/qKMPQ/2/
TITLE: cursor: pointer doesn't work on :after element? QUESTION: I'm viewing the below example in Chrome and can't seem to get cursor: pointer to work on the:after element of li. Is there a way to get around this? http://jsfiddle.net/qKMPQ/2/ ANSWER: Instead of setting the cursor: pointer on the:after element, set it...
[ "html", "css" ]
45
34
16,325
1
0
2011-06-09T16:37:01.603000
2011-06-09T16:42:43.483000
6,296,241
6,296,271
Date format with Java
Possible Duplicate: format date from 14 aug to YYYYMMDD Hi I need to get a date in a YYYYMMDD format. I Don't know the right method for that... I set the date with this lines of code... Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.D...
You would use SimpleDateFormat: SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); format.setCalendar(cal); String text = format.format(cal.getTime()); Personally I would strongly recommend that you look at using Joda Time instead though - it's a much nicer API than the built-in Date / Calendar class.
Date format with Java Possible Duplicate: format date from 14 aug to YYYYMMDD Hi I need to get a date in a YYYYMMDD format. I Don't know the right method for that... I set the date with this lines of code... Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, mont...
TITLE: Date format with Java QUESTION: Possible Duplicate: format date from 14 aug to YYYYMMDD Hi I need to get a date in a YYYYMMDD format. I Don't know the right method for that... I set the date with this lines of code... Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.YEAR, year); cal.set(Ca...
[ "java", "date" ]
1
7
280
5
0
2011-06-09T16:37:03.210000
2011-06-09T16:40:07.853000
6,296,260
6,296,297
Why does this work? Object references in Javascript
I've finally been curious enough to find out why javascript does its voodoo magic to learn why not all object references are created equal. Given the example: var a, b, c, d; a = 100; b = a; c = {}; d = c; b = 10; d.e = 'f'; console.log(a, b); // outputs 100, 10 console.log(c, d); // outputs object => e = 'f', objec...
All variables in JavaScript are not objects. There are native types as well. c and d are not linked to one another. They are pointing to the same object reference. If you were to reassign d to something else, it will not affect c. var c = {}; var d = c; d = { foo: "bar" }; c === d // false However, if you were to modi...
Why does this work? Object references in Javascript I've finally been curious enough to find out why javascript does its voodoo magic to learn why not all object references are created equal. Given the example: var a, b, c, d; a = 100; b = a; c = {}; d = c; b = 10; d.e = 'f'; console.log(a, b); // outputs 100, 10 co...
TITLE: Why does this work? Object references in Javascript QUESTION: I've finally been curious enough to find out why javascript does its voodoo magic to learn why not all object references are created equal. Given the example: var a, b, c, d; a = 100; b = a; c = {}; d = c; b = 10; d.e = 'f'; console.log(a, b); // ...
[ "javascript" ]
6
8
1,885
3
0
2011-06-09T16:38:56.323000
2011-06-09T16:42:05.650000
6,296,277
6,296,317
C# clone EventHandler
I have a class with multiple EventHandlers (among other things): public GameObject { public event EventHandler Initialize; public event EventHandler BeginStep;.... } I want to be able to add a Clone() function to GameObject, which returns an exact duplicate of the object it was called on. I tried doing it like this: pu...
You don't need to worry about that. The EventHandler object is immutable so any change in the list of listeners in either object will cause that object to get a new EventHandler instance containing the updated invocation list. This change will not be present in the other GameObject.
C# clone EventHandler I have a class with multiple EventHandlers (among other things): public GameObject { public event EventHandler Initialize; public event EventHandler BeginStep;.... } I want to be able to add a Clone() function to GameObject, which returns an exact duplicate of the object it was called on. I tried ...
TITLE: C# clone EventHandler QUESTION: I have a class with multiple EventHandlers (among other things): public GameObject { public event EventHandler Initialize; public event EventHandler BeginStep;.... } I want to be able to add a Clone() function to GameObject, which returns an exact duplicate of the object it was c...
[ "c#", "event-handling" ]
7
10
9,830
5
0
2011-06-09T16:40:27.463000
2011-06-09T16:43:49.817000
6,296,285
6,296,479
Adding business information to an overlay in a MapView
On the Google maps web interface if you zoom in enough you can see businesses that are clickable. When you click the business you get the a speach bubble with a brief description of the business. Even on the native android Google map you can tap businesses and get a link to the business information. My question is that...
In the past I have used this. https://github.com/jgilfelt/android-mapviewballoons Not sure how to pull info though.
Adding business information to an overlay in a MapView On the Google maps web interface if you zoom in enough you can see businesses that are clickable. When you click the business you get the a speach bubble with a brief description of the business. Even on the native android Google map you can tap businesses and get ...
TITLE: Adding business information to an overlay in a MapView QUESTION: On the Google maps web interface if you zoom in enough you can see businesses that are clickable. When you click the business you get the a speach bubble with a brief description of the business. Even on the native android Google map you can tap b...
[ "android", "dictionary", "overlay" ]
0
2
338
2
0
2011-06-09T16:41:19.480000
2011-06-09T16:55:32.247000
6,296,290
6,296,343
Passing information from javascript to C# using events
I have this ASP.net component: and I'd like to send some additional information to this SubmitData method, implemented in C#. For example, I want to send an int set in the javascript. I've read that the way to do this is extending the EventArgs class. However, I don't really understand. Sure I can implement a class tha...
Simply assign it to a hidden field in javascript and read it using Request.Form["FieldName"]
Passing information from javascript to C# using events I have this ASP.net component: and I'd like to send some additional information to this SubmitData method, implemented in C#. For example, I want to send an int set in the javascript. I've read that the way to do this is extending the EventArgs class. However, I do...
TITLE: Passing information from javascript to C# using events QUESTION: I have this ASP.net component: and I'd like to send some additional information to this SubmitData method, implemented in C#. For example, I want to send an int set in the javascript. I've read that the way to do this is extending the EventArgs cl...
[ "javascript", "asp.net", "html", "eventargs" ]
0
1
1,689
2
0
2011-06-09T16:41:47.750000
2011-06-09T16:45:27.357000
6,296,295
6,296,919
How do I tell devise authentication to ignore IP address changes?
I'm using Devise with Rails3 for authentication, however due to the nature of the app the IP of the client changes. How do I stop Devise requiring the users session to be on a single IP. Obviously the cookie is persisting when the IP changes. Thanks a lot
I assume that you have:rememberable in your devise options some thing like: class User < ActiveRecord::Base devise:database_authenticatable,:confirmable,:recoverable,:rememberable,:trackable,:validatable end And in your migration you have something like this: create_table:users do |t| t.database_authenticatable t.confi...
How do I tell devise authentication to ignore IP address changes? I'm using Devise with Rails3 for authentication, however due to the nature of the app the IP of the client changes. How do I stop Devise requiring the users session to be on a single IP. Obviously the cookie is persisting when the IP changes. Thanks a lo...
TITLE: How do I tell devise authentication to ignore IP address changes? QUESTION: I'm using Devise with Rails3 for authentication, however due to the nature of the app the IP of the client changes. How do I stop Devise requiring the users session to be on a single IP. Obviously the cookie is persisting when the IP ch...
[ "ruby-on-rails", "ruby-on-rails-3", "devise" ]
1
0
276
1
0
2011-06-09T16:42:00.660000
2011-06-09T17:32:58.713000
6,296,302
6,297,203
How to incorporate AQGridView into ones project?
The documentation states that "This project compiles to a static library which you can include, or you can just reference the source files directly." Here's what I've done. I've downloaded it from GitHub and unzipped it. Here are the classes I can see. Now which file among these is the 'static library' that I should im...
All you need to do is add the class files to your project. Use the AQGridView.xcodeproj just as a reference to see how it uses the classes. It is actually a very friendly to use library of classes. Once you added the class files to your project, when you create a new viewController, just follow the setup. Make sure you...
How to incorporate AQGridView into ones project? The documentation states that "This project compiles to a static library which you can include, or you can just reference the source files directly." Here's what I've done. I've downloaded it from GitHub and unzipped it. Here are the classes I can see. Now which file amo...
TITLE: How to incorporate AQGridView into ones project? QUESTION: The documentation states that "This project compiles to a static library which you can include, or you can just reference the source files directly." Here's what I've done. I've downloaded it from GitHub and unzipped it. Here are the classes I can see. ...
[ "iphone", "objective-c", "xcode", "ios", "aqgridview" ]
4
9
4,316
4
0
2011-06-09T16:42:27.420000
2011-06-09T18:02:04.113000
6,296,312
6,296,382
Pointer trouble
I am having trouble getting my pointers to work correctly. In my main file I declare Analysis2 analysis = Analysis2(); MaxResults maxresults = MaxResults( analysis); Now in my MaxResults class, I want to point to analysis so that if any of its variables change I still get the right value. Right now I declare the constr...
If you want MaxResults to keep a pointer to an Analysis2 object, you should do it like this: class MaxResults { public: MaxResults(Analysis* an): analysis(an) {} private: Analysis* analysis; }; and construct it like this: Analysis2 analysis = Analysis2(); MaxResults maxresults = MaxResults( &analysis); Note the use o...
Pointer trouble I am having trouble getting my pointers to work correctly. In my main file I declare Analysis2 analysis = Analysis2(); MaxResults maxresults = MaxResults( analysis); Now in my MaxResults class, I want to point to analysis so that if any of its variables change I still get the right value. Right now I de...
TITLE: Pointer trouble QUESTION: I am having trouble getting my pointers to work correctly. In my main file I declare Analysis2 analysis = Analysis2(); MaxResults maxresults = MaxResults( analysis); Now in my MaxResults class, I want to point to analysis so that if any of its variables change I still get the right val...
[ "c++", "pointers", "pass-by-reference", "pass-by-value" ]
3
3
103
3
0
2011-06-09T16:43:13.433000
2011-06-09T16:47:45.550000
6,296,313
6,298,881
MySQL Trigger after update only if row has changed
Is there any possibility to use an "after update" trigger only in the case the data has been REALLY changed. I know of "NEW and OLD". But when using them I'm only able to compare columns. For example "NEW.count <> OLD.count". But I want something like: run trigger if "NEW <> OLD" An Example: create table foo (a INT, b ...
As a workaround, you could use the timestamp (old and new) for checking though, that one is not updated when there are no changes to the row. (Possibly that is the source for confusion? Because that one is also called 'on update' but is not executed when no change occurs) Changes within one second will then not execute...
MySQL Trigger after update only if row has changed Is there any possibility to use an "after update" trigger only in the case the data has been REALLY changed. I know of "NEW and OLD". But when using them I'm only able to compare columns. For example "NEW.count <> OLD.count". But I want something like: run trigger if "...
TITLE: MySQL Trigger after update only if row has changed QUESTION: Is there any possibility to use an "after update" trigger only in the case the data has been REALLY changed. I know of "NEW and OLD". But when using them I'm only able to compare columns. For example "NEW.count <> OLD.count". But I want something like...
[ "mysql", "sql", "database", "triggers" ]
76
80
201,048
8
0
2011-06-09T16:43:23.530000
2011-06-09T20:32:31.743000
6,296,321
6,296,595
Best Practices for displaying large lists
Are there any best practices for returning large lists of orders to users? Let me try to outline the problem we are trying to solve. We have a list of customers that have 1-5,000+ orders associated to each. We pull these orders directly from the database and present them to the user is a paginated grid. The view we hav...
My experience. Always set default values in the UI for the user that are reasonable. You don't want them clicking "Retrieve" and getting everything. Set a limit to the number of records that can be returned. Only return from the database the records you are going to display. If forward/backward consistencency is import...
Best Practices for displaying large lists Are there any best practices for returning large lists of orders to users? Let me try to outline the problem we are trying to solve. We have a list of customers that have 1-5,000+ orders associated to each. We pull these orders directly from the database and present them to the...
TITLE: Best Practices for displaying large lists QUESTION: Are there any best practices for returning large lists of orders to users? Let me try to outline the problem we are trying to solve. We have a list of customers that have 1-5,000+ orders associated to each. We pull these orders directly from the database and p...
[ "javascript", "sql", "xslt" ]
3
4
1,120
4
0
2011-06-09T16:43:58.870000
2011-06-09T17:05:00.950000
6,296,324
6,296,610
Insertion Of dynamic dropdownlist values(of each row) from a gridview to tables
//code in aspx.::: Q:I have to insert the selected dropdownlist items to a table all at a once i.e when i click a submit button(which i have not shown here) then all the selected values should go at a time to a table.
My assumption is you are using Gridview. So this will work. protected void btnSubmit_Click(object sender, EventArgs e) { List lst = new List (); foreach(GridViewRow gvr in GridView1.Rows) { if (gvr.RowType == DataControlRowType.DataRow) { lst.Add(((DropDownList)gvr.FindControl("didDdl")).SelectedValue); } } } Improvis...
Insertion Of dynamic dropdownlist values(of each row) from a gridview to tables //code in aspx.::: Q:I have to insert the selected dropdownlist items to a table all at a once i.e when i click a submit button(which i have not shown here) then all the selected values should go at a time to a table.
TITLE: Insertion Of dynamic dropdownlist values(of each row) from a gridview to tables QUESTION: //code in aspx.::: Q:I have to insert the selected dropdownlist items to a table all at a once i.e when i click a submit button(which i have not shown here) then all the selected values should go at a time to a table. ANS...
[ "c#", "asp.net", "gridview", "drop-down-menu" ]
0
1
2,402
3
0
2011-06-09T16:44:16.450000
2011-06-09T17:06:20.297000
6,296,328
6,296,390
while (_index != string::npos) doesn't seem to be stopping the loop
My code counts spaces in string temp, which works fine. Later in the code I have a similar loop that does not end as expected. Based on my debugging and some research, I’ve determined that the while loop isn’t stopping when it is supposed to the second time around, so an exception is thrown ( std::out_of_range )… Why? ...
Within the second loop you reference a variable input instead of temp. _index = input.find( " ", _index + 1 );` Therefore the loop does never terminate. This you don't do within the first while-loop.
while (_index != string::npos) doesn't seem to be stopping the loop My code counts spaces in string temp, which works fine. Later in the code I have a similar loop that does not end as expected. Based on my debugging and some research, I’ve determined that the while loop isn’t stopping when it is supposed to the second...
TITLE: while (_index != string::npos) doesn't seem to be stopping the loop QUESTION: My code counts spaces in string temp, which works fine. Later in the code I have a similar loop that does not end as expected. Based on my debugging and some research, I’ve determined that the while loop isn’t stopping when it is supp...
[ "c++" ]
0
1
1,389
1
0
2011-06-09T16:44:37.210000
2011-06-09T16:48:23.490000
6,296,330
6,296,725
Multiple Values from ListBox
I am using asp.net with vb.net. I have created 2 listboxes; lstselect and lstroles. List boxes lstselect contains all of the available roles that can be added into lstroles. How do I take the roles that have been added into lstroles and make them into a parameter to pulled into my database when the stored procedure run...
There are two ways to do it: 1) Create a Comma Separated Values from Your List Box Selected Items. But this is not a recommended Approach, as you need to parse it in your Stored Procedure. string commaSeparatedParams = string.Join(",", myArray); 2) Create an XML, each Role would be a Node. And Pass XML as your Stored P...
Multiple Values from ListBox I am using asp.net with vb.net. I have created 2 listboxes; lstselect and lstroles. List boxes lstselect contains all of the available roles that can be added into lstroles. How do I take the roles that have been added into lstroles and make them into a parameter to pulled into my database ...
TITLE: Multiple Values from ListBox QUESTION: I am using asp.net with vb.net. I have created 2 listboxes; lstselect and lstroles. List boxes lstselect contains all of the available roles that can be added into lstroles. How do I take the roles that have been added into lstroles and make them into a parameter to pulled...
[ "asp.net", "vb.net", "parameters", "listbox" ]
0
0
884
2
0
2011-06-09T16:44:40.790000
2011-06-09T17:16:18.527000
6,296,334
6,296,981
Synchronizing Events
I noticed that sometimes my code becomes out of sync if an event fires too quickly. I was wondering if there was a better approach. Under a normal scenario the DeviceOpenedEvent fires after I tell the thread to WaitOne in the TestDevice method, but I have seen in some cases where the event gets fired before the thread ...
Since OpenDevice is asynchronous (as you mentioned in a comment), it runs in a different thread than its caller. Sometimes it will finish before the next line in source executes: OpenDevice(); // Async: may finish before the next line executes! WaitForEvent = EventEnum.DeviceOpened; When that happens DeviceOpenedEvent ...
Synchronizing Events I noticed that sometimes my code becomes out of sync if an event fires too quickly. I was wondering if there was a better approach. Under a normal scenario the DeviceOpenedEvent fires after I tell the thread to WaitOne in the TestDevice method, but I have seen in some cases where the event gets fir...
TITLE: Synchronizing Events QUESTION: I noticed that sometimes my code becomes out of sync if an event fires too quickly. I was wondering if there was a better approach. Under a normal scenario the DeviceOpenedEvent fires after I tell the thread to WaitOne in the TestDevice method, but I have seen in some cases where ...
[ "c#", ".net", "multithreading", "concurrency" ]
3
2
1,414
2
0
2011-06-09T16:44:52.117000
2011-06-09T17:39:00.503000
6,296,339
6,299,135
Cuda 2d or 3d arrays
I am dealing with a set of (largish 2k x 2k) images I need to do per-pixel operations down a stack of a few sequential images. Are there any opinions on using a single 2D large texture + calculating offsets vs using 3D arrays? It seems that 3D arrays are a bit 'out of the mainstream' in the CUDA api, the allocation tra...
I would recommend you to read the book "Cuda by Example". It goes through all these things that aren't documented as well and it'll explain the "how and why". I think what you should use if you're rendering the result of the CUDA kernel is to use OpenGL interop. This way, your code processes the image on the GPU and le...
Cuda 2d or 3d arrays I am dealing with a set of (largish 2k x 2k) images I need to do per-pixel operations down a stack of a few sequential images. Are there any opinions on using a single 2D large texture + calculating offsets vs using 3D arrays? It seems that 3D arrays are a bit 'out of the mainstream' in the CUDA ap...
TITLE: Cuda 2d or 3d arrays QUESTION: I am dealing with a set of (largish 2k x 2k) images I need to do per-pixel operations down a stack of a few sequential images. Are there any opinions on using a single 2D large texture + calculating offsets vs using 3D arrays? It seems that 3D arrays are a bit 'out of the mainstre...
[ "cuda" ]
2
6
1,128
2
0
2011-06-09T16:45:07.810000
2011-06-09T20:53:48.247000
6,296,363
6,296,556
Objective-C initializers and overriding self
I have a question about writing your own init methods in objective-c. I've read a few different books and have seen a couple of ways to do it but the consensus is the right way to do it is like this: - (id)init { self = [super init]; if(self!=nil) { } return self; } I'm a little confused about the line "self = [super ...
To summarize, why set self to be the superclass vs the actual class I'm in? This is the Apple suggested way to do things, specifically due to the case of class clusters, as you say. In general, you should not worry about the fact that self might be of a different class in the "normal" case. self simply identifies the o...
Objective-C initializers and overriding self I have a question about writing your own init methods in objective-c. I've read a few different books and have seen a couple of ways to do it but the consensus is the right way to do it is like this: - (id)init { self = [super init]; if(self!=nil) { } return self; } I'm a l...
TITLE: Objective-C initializers and overriding self QUESTION: I have a question about writing your own init methods in objective-c. I've read a few different books and have seen a couple of ways to do it but the consensus is the right way to do it is like this: - (id)init { self = [super init]; if(self!=nil) { } retu...
[ "objective-c" ]
2
2
681
2
0
2011-06-09T16:46:45.760000
2011-06-09T17:02:10.080000
6,296,369
6,296,413
Comparing Bitfields of Different Sizes
What happens if you use a bitwise operator ( &, |, etc.) to compare two bitfields of different sizes? For example, comparing 0 1 1 0 with 0 0 1 0 0 0 0 1: 0 1 1 0 0 0 0 0 The smaller one is extended with zeros and pushed to the 0 0 1 0 0 0 0 1 most-significant side. Or... 0 0 0 0 0 1 1 0 The smaller one is extended wit...
The bitwise operators always work on promoted operands. So exactly what might happen can depend on whether one (or both) bitfields are signed (as that may result in sign extension). So, for your example values, the bit-field with the binary value 0 1 1 0 will be promoted to the int 6, and the bit-field with the binary ...
Comparing Bitfields of Different Sizes What happens if you use a bitwise operator ( &, |, etc.) to compare two bitfields of different sizes? For example, comparing 0 1 1 0 with 0 0 1 0 0 0 0 1: 0 1 1 0 0 0 0 0 The smaller one is extended with zeros and pushed to the 0 0 1 0 0 0 0 1 most-significant side. Or... 0 0 0 0 ...
TITLE: Comparing Bitfields of Different Sizes QUESTION: What happens if you use a bitwise operator ( &, |, etc.) to compare two bitfields of different sizes? For example, comparing 0 1 1 0 with 0 0 1 0 0 0 0 1: 0 1 1 0 0 0 0 0 The smaller one is extended with zeros and pushed to the 0 0 1 0 0 0 0 1 most-significant si...
[ "c++", "bit-manipulation", "low-level", "bit-fields" ]
10
8
10,748
3
0
2011-06-09T16:46:57.233000
2011-06-09T16:49:49.220000
6,296,370
6,296,497
Understanding properties by writing own setter method
So I'm having trouble with OOAD, properties, the self keyword, etc. I wanted to just create a simple test project that has a UITableView. I have an ivar of NSArray *tableData; how would I write a setter and getter method for this? I thought my setter would look like: - (void)setTableData:(NSArray *)array { [tableData a...
I'm sure you already know that using @synthesize will create setter/getter methods for you, but it's good to know what's going on "under the hood" to understand the concepts. As far as a setter method goes, you're probably better off with something like this: - (void)setTableData:(NSArray *)array { if (tableData!= arra...
Understanding properties by writing own setter method So I'm having trouble with OOAD, properties, the self keyword, etc. I wanted to just create a simple test project that has a UITableView. I have an ivar of NSArray *tableData; how would I write a setter and getter method for this? I thought my setter would look like...
TITLE: Understanding properties by writing own setter method QUESTION: So I'm having trouble with OOAD, properties, the self keyword, etc. I wanted to just create a simple test project that has a UITableView. I have an ivar of NSArray *tableData; how would I write a setter and getter method for this? I thought my sett...
[ "iphone", "objective-c", "properties" ]
0
1
1,870
1
0
2011-06-09T16:47:04.277000
2011-06-09T16:56:46.890000
6,296,379
6,296,503
C# Reading Excel Data From Cells in VS2010
I am writing a C# Console Application and I am correctly opening an Excel file. I just can't figure out how to read data from cells and copy it into an array. Most of the code I have found list examples that won't work with VS 2010. It appears they have changed how to read cell data in every version. I am wanting to re...
You can use this method workSheet.get_Range("A1", "A1").EntireRow.EntireColumn use bellow code this is 2d array. Iterate in this Object[,] obj = (object[,])sheet.get_Range("A1", "B4").Value2;
C# Reading Excel Data From Cells in VS2010 I am writing a C# Console Application and I am correctly opening an Excel file. I just can't figure out how to read data from cells and copy it into an array. Most of the code I have found list examples that won't work with VS 2010. It appears they have changed how to read cel...
TITLE: C# Reading Excel Data From Cells in VS2010 QUESTION: I am writing a C# Console Application and I am correctly opening an Excel file. I just can't figure out how to read data from cells and copy it into an array. Most of the code I have found list examples that won't work with VS 2010. It appears they have chang...
[ "c#", "visual-studio-2010", "excel" ]
0
1
2,137
1
0
2011-06-09T16:47:39.127000
2011-06-09T16:57:28.800000
6,296,387
6,296,759
Adding hash URL and page title after 3 seconds with jQuery
I have a Google Instant style search script written in jQuery. When a user searches, a URL is created which is something like #search/ QUERY /1/ and their query is put in the title of the page. This currently happens as they type however I want it to do this only after they have stayed on the result page for 3 seconds....
You want to the change the title of the page once the user has been on the results page for 3 seconds. That means once the ajax success function has finished and the results have been rendered, 3 seconds from then, you want to change the title. $(document).ready(function(){ $("#search").keyup(function(){ var search=$(t...
Adding hash URL and page title after 3 seconds with jQuery I have a Google Instant style search script written in jQuery. When a user searches, a URL is created which is something like #search/ QUERY /1/ and their query is put in the title of the page. This currently happens as they type however I want it to do this on...
TITLE: Adding hash URL and page title after 3 seconds with jQuery QUESTION: I have a Google Instant style search script written in jQuery. When a user searches, a URL is created which is something like #search/ QUERY /1/ and their query is put in the title of the page. This currently happens as they type however I wan...
[ "javascript", "jquery", "html" ]
0
0
655
2
0
2011-06-09T16:48:05.417000
2011-06-09T17:19:49.030000
6,296,392
6,296,429
Date field converted to string - Does not allow Order By
I am using SQL 2008. (in asp actually). SELECT orderId, CONVERT(varchar, orderDate, 101) AS Date_Ordered, CONVERT(varchar, sentDate, 101) AS Date_Shipped, FROM orders GROUP BY orderId, CONVERT(varchar, o.orderDate, 101), CONVERT(varchar, o.sentDate, 101) ORDER BY Date_Shipped OK, The reason I am using the Convert in th...
You have SQL Server 2008 so you can use the date type SELECT orderId, CONVERT(varchar, orderDate, 101) AS Date_Ordered, CONVERT(varchar, CAST(sentDate as date), 101) AS Date_Shipped FROM orders GROUP BY orderId, CONVERT(varchar, o.orderDate, 101), CAST(sentDate as date) ORDER BY CAST(sentDate as date) I can't recall ex...
Date field converted to string - Does not allow Order By I am using SQL 2008. (in asp actually). SELECT orderId, CONVERT(varchar, orderDate, 101) AS Date_Ordered, CONVERT(varchar, sentDate, 101) AS Date_Shipped, FROM orders GROUP BY orderId, CONVERT(varchar, o.orderDate, 101), CONVERT(varchar, o.sentDate, 101) ORDER BY...
TITLE: Date field converted to string - Does not allow Order By QUESTION: I am using SQL 2008. (in asp actually). SELECT orderId, CONVERT(varchar, orderDate, 101) AS Date_Ordered, CONVERT(varchar, sentDate, 101) AS Date_Shipped, FROM orders GROUP BY orderId, CONVERT(varchar, o.orderDate, 101), CONVERT(varchar, o.sentD...
[ "sql", "datetime" ]
1
1
1,673
2
0
2011-06-09T16:48:25.150000
2011-06-09T16:51:28.577000
6,296,398
6,296,426
iOS: replace an object inside an array of array
My code is: [[arrayOne objectAtIndex:indexSelected] replaceObjectAtIndex:1 withObject:new]; NSLog(@"indexSelected:%d", indexSelected); // = 0 NSLog(@"new:%@", new); // = 26 indexSelected is an int and new is a string When I try to do this I have an exception that says: Terminating app due to uncaught exception 'NSInva...
This is because NSArray is immutable. Use an NSMutableArray.
iOS: replace an object inside an array of array My code is: [[arrayOne objectAtIndex:indexSelected] replaceObjectAtIndex:1 withObject:new]; NSLog(@"indexSelected:%d", indexSelected); // = 0 NSLog(@"new:%@", new); // = 26 indexSelected is an int and new is a string When I try to do this I have an exception that says: T...
TITLE: iOS: replace an object inside an array of array QUESTION: My code is: [[arrayOne objectAtIndex:indexSelected] replaceObjectAtIndex:1 withObject:new]; NSLog(@"indexSelected:%d", indexSelected); // = 0 NSLog(@"new:%@", new); // = 26 indexSelected is an int and new is a string When I try to do this I have an exce...
[ "objective-c", "xcode", "ios", "nsarray" ]
3
6
5,559
1
0
2011-06-09T16:48:49.090000
2011-06-09T16:51:00.370000