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,263,039
6,263,863
(Caliburn Micro) Mapping a ActionMessage Methodname to a Child Object of the ViewModel
I would like to bind the methodname propererty of the caliburn.micro actionmessage to a method on a child object of the ViewModel. How I would imagine it should work: The problem here is that the methodname does not live directly on the viewmodel, but on a childobject of the viewmodel. So in this case I would like to b...
You can set the actual target of the action (MenuItemX) using cal:Action.TargetWithoutContext attached property: or the shorter syntax:
(Caliburn Micro) Mapping a ActionMessage Methodname to a Child Object of the ViewModel I would like to bind the methodname propererty of the caliburn.micro actionmessage to a method on a child object of the ViewModel. How I would imagine it should work: The problem here is that the methodname does not live directly on ...
TITLE: (Caliburn Micro) Mapping a ActionMessage Methodname to a Child Object of the ViewModel QUESTION: I would like to bind the methodname propererty of the caliburn.micro actionmessage to a method on a child object of the ViewModel. How I would imagine it should work: The problem here is that the methodname does not...
[ "silverlight", "caliburn.micro" ]
5
9
1,549
1
0
2011-06-07T09:12:23.923000
2011-06-07T10:24:32.217000
6,263,044
6,263,182
Idiomatic C++ for remove_if
I have this class class Point2D { public: bool isValid(); //... private: double x_, y_; }; I have a std::vector< Point2D > and I would like to remove the invalid points, now I do like this: bool invalid ( const Point2D& p ) { return!p.isValid(); } void f() { std::vector< Point2D > points; // fill points points.erase( ...
Try this: points.erase(std::remove_if(points.begin(), points.end(), std::not1(std::mem_fun_ref(&Point2D::isValid))), points.end());
Idiomatic C++ for remove_if I have this class class Point2D { public: bool isValid(); //... private: double x_, y_; }; I have a std::vector< Point2D > and I would like to remove the invalid points, now I do like this: bool invalid ( const Point2D& p ) { return!p.isValid(); } void f() { std::vector< Point2D > points; /...
TITLE: Idiomatic C++ for remove_if QUESTION: I have this class class Point2D { public: bool isValid(); //... private: double x_, y_; }; I have a std::vector< Point2D > and I would like to remove the invalid points, now I do like this: bool invalid ( const Point2D& p ) { return!p.isValid(); } void f() { std::vector< P...
[ "c++", "c++11" ]
10
16
4,811
6
0
2011-06-07T09:12:43.947000
2011-06-07T09:25:10.053000
6,263,047
6,264,385
Play! JPA - Get an enum value in a query
This is my enum: package enums; public enum SessionType { SESSION_NORMAL(12), SESSION_PERFECT(5), SESSION_SOLO(1); private int value; private SessionType(int value) { this.setValue(value); } public void setValue(int value) { this.value = value; } public int getValue() { return value; } public String toString(){ r...
You can't access the value inside the enum via a SQL query, but you could just use the Ordinal value of the enumeration to store this in the database with the annotation: @Enumerated(EnumType.ORDINAL) That would return 1, 2 or 3 right now, but you can either remap the values (so instead of 1,5,12 you use 1,2,3) or simp...
Play! JPA - Get an enum value in a query This is my enum: package enums; public enum SessionType { SESSION_NORMAL(12), SESSION_PERFECT(5), SESSION_SOLO(1); private int value; private SessionType(int value) { this.setValue(value); } public void setValue(int value) { this.value = value; } public int getValue() { ret...
TITLE: Play! JPA - Get an enum value in a query QUESTION: This is my enum: package enums; public enum SessionType { SESSION_NORMAL(12), SESSION_PERFECT(5), SESSION_SOLO(1); private int value; private SessionType(int value) { this.setValue(value); } public void setValue(int value) { this.value = value; } public in...
[ "java", "jpa", "enums", "playframework" ]
2
1
3,726
2
0
2011-06-07T09:13:05.463000
2011-06-07T11:16:29.157000
6,263,052
6,265,707
TableServiceContext and strongly typed table name
I have a DocumentDataServiceContext derived from TableServiceContext. Inside that class I have the following method: public DataServiceQuery Documents { get { return this.CreateQuery ("Documents"); } } Is there a way to get rid of the string constant passed to CreateQuery and instead obtain the table name used by Cloud...
No. At the end of the day, the CreateQuery() must have the table name to query against. You can of course use convention or reflection to derive what that table name will be in another method, but at some point a string must be passed to CreateQuery. public DataServiceQuery CreateQueryByConvention () { return this.Crea...
TableServiceContext and strongly typed table name I have a DocumentDataServiceContext derived from TableServiceContext. Inside that class I have the following method: public DataServiceQuery Documents { get { return this.CreateQuery ("Documents"); } } Is there a way to get rid of the string constant passed to CreateQue...
TITLE: TableServiceContext and strongly typed table name QUESTION: I have a DocumentDataServiceContext derived from TableServiceContext. Inside that class I have the following method: public DataServiceQuery Documents { get { return this.CreateQuery ("Documents"); } } Is there a way to get rid of the string constant p...
[ "azure", "azure-table-storage" ]
0
1
281
1
0
2011-06-07T09:13:38.803000
2011-06-07T13:12:16.763000
6,263,073
6,263,123
Is there any difference between window.location and window.location.href?
Possible Duplicate: Javascript: Setting window.location.href versus window.location When I tested these code in browser it seems like they are the same. Is there any difference? 1 window.location = "http://stackoverflow.com"; 2 window.location.href = "http://stackoverflow.com";
Yes, there is a difference. window.location is a Location object. window.location.href is a string representation of the location. The location object's toString() value is the same as the href property, so they are identical if used as strings. Setting window.location is the same as setting window.location.href. windo...
Is there any difference between window.location and window.location.href? Possible Duplicate: Javascript: Setting window.location.href versus window.location When I tested these code in browser it seems like they are the same. Is there any difference? 1 window.location = "http://stackoverflow.com"; 2 window.location.hr...
TITLE: Is there any difference between window.location and window.location.href? QUESTION: Possible Duplicate: Javascript: Setting window.location.href versus window.location When I tested these code in browser it seems like they are the same. Is there any difference? 1 window.location = "http://stackoverflow.com"; 2 ...
[ "javascript" ]
5
22
14,797
3
0
2011-06-07T09:15:08.727000
2011-06-07T09:19:39.203000
6,263,109
6,263,156
Add or get attachment file inside a PDF file
We have recently got a client that have the ability to send files (text files) inside a PDF file. Is there some kind of library that can get or add attachment files to PDF? I have searched the web and only found PDF File Attachments (an Adobe blog post).
iTextSharp is a free.NET port of the Java library iText that can let you do what you want. Documentation, however, is rather scarce on the ported library and you will often need to refer to Java documentation to get an idea of how to do things and/or google other peoples' attempts at doing what you need to do. The code...
Add or get attachment file inside a PDF file We have recently got a client that have the ability to send files (text files) inside a PDF file. Is there some kind of library that can get or add attachment files to PDF? I have searched the web and only found PDF File Attachments (an Adobe blog post).
TITLE: Add or get attachment file inside a PDF file QUESTION: We have recently got a client that have the ability to send files (text files) inside a PDF file. Is there some kind of library that can get or add attachment files to PDF? I have searched the web and only found PDF File Attachments (an Adobe blog post). A...
[ "c#", "pdf", "attachment" ]
1
6
2,874
1
0
2011-06-07T09:18:21.770000
2011-06-07T09:23:06.290000
6,263,111
6,263,140
Ubuntu and Red Hat? PHP files deployment
I have developed an application using PHP in Ubuntu XAMPP 1.7.4 environment. Now I'm going to deploy this in Redhat 5 OS. Is there any problem with file system? What are the rules I have to follow for Redhat5 OS
It will depend more on their particular Apache/php config. Anything to do with the OS not be noticeably different.
Ubuntu and Red Hat? PHP files deployment I have developed an application using PHP in Ubuntu XAMPP 1.7.4 environment. Now I'm going to deploy this in Redhat 5 OS. Is there any problem with file system? What are the rules I have to follow for Redhat5 OS
TITLE: Ubuntu and Red Hat? PHP files deployment QUESTION: I have developed an application using PHP in Ubuntu XAMPP 1.7.4 environment. Now I'm going to deploy this in Redhat 5 OS. Is there any problem with file system? What are the rules I have to follow for Redhat5 OS ANSWER: It will depend more on their particular ...
[ "php", "linux", "ubuntu", "redhat" ]
0
1
166
1
0
2011-06-07T09:18:28.763000
2011-06-07T09:21:40.740000
6,263,119
6,263,278
Ajaxify not working?
So I have the latest jQuery loaded. I've loaded Ajaxify. I gave the links the class of ajaxify and a target, but nothing happens?? I just don't know where to look anymore. Any suggestions? Here's the link with source. Is it maybe because of Wordpress?
The Ajaxify code seems bugged, the error given in my case is 'Error: Your jQuery version is old. Version 1.2.6 or newer is required.' because you have version 1.6.1 and the test of the version is if(ver[0] < 1 || ver[1] < 2 || ver[2] < 6){ //returns error } try to modify ajaxify.js in that line using something like thi...
Ajaxify not working? So I have the latest jQuery loaded. I've loaded Ajaxify. I gave the links the class of ajaxify and a target, but nothing happens?? I just don't know where to look anymore. Any suggestions? Here's the link with source. Is it maybe because of Wordpress?
TITLE: Ajaxify not working? QUESTION: So I have the latest jQuery loaded. I've loaded Ajaxify. I gave the links the class of ajaxify and a target, but nothing happens?? I just don't know where to look anymore. Any suggestions? Here's the link with source. Is it maybe because of Wordpress? ANSWER: The Ajaxify code see...
[ "jquery" ]
1
2
767
2
0
2011-06-07T09:19:26.257000
2011-06-07T09:33:04.853000
6,263,127
6,263,171
LINQ filtering and aggregation
I have a list of items that can be represented like this: ClientNo Name Date Time 0001 Mike 01/12/2000 6 0002 Dave 01/12/2000 12 0001 Mike 01/12/2000 10 0002 Dave 02/12/2000 6 Is it possible to group and aggregate this to look something like this using LINQ? ClientNo Name Date Time 0001 Mike 01/12/2000 16 0002 Dave 01/...
I think it should look like this: from p in ListofModel group p by new { p.ClientNo, p.Date, p.Name } into g orderby g.key.Date select new ModelClass { ClientNo = g.Key.ClientNo, Name = g.key.Name, Date = g.Key.Date, Time = g.Sum(x => x.Time) } You don't want to group by the time, so it should not be included in the gr...
LINQ filtering and aggregation I have a list of items that can be represented like this: ClientNo Name Date Time 0001 Mike 01/12/2000 6 0002 Dave 01/12/2000 12 0001 Mike 01/12/2000 10 0002 Dave 02/12/2000 6 Is it possible to group and aggregate this to look something like this using LINQ? ClientNo Name Date Time 0001 M...
TITLE: LINQ filtering and aggregation QUESTION: I have a list of items that can be represented like this: ClientNo Name Date Time 0001 Mike 01/12/2000 6 0002 Dave 01/12/2000 12 0001 Mike 01/12/2000 10 0002 Dave 02/12/2000 6 Is it possible to group and aggregate this to look something like this using LINQ? ClientNo Nam...
[ "c#", "linq", "grouping", "aggregation" ]
2
0
644
2
0
2011-06-07T09:19:58.940000
2011-06-07T09:24:09.883000
6,263,128
6,263,393
How to bind a dictionary object to a Windows Forms gridview
How can I bind a dictionary object to a datagridview in Windows Forms? Dictionary result = new Dictionary (); result.Add(arrFilename[i].fileName,"Found"); dataGridView1.DataSource = result; The dataview grid doesn't bind. What is the solution?
DataGridView.DataSource needs an object that implements IList, IListSource, IBindingList, or IBindingListView. Since none of Dictionary, Dictionary.ValueCollection or Dictionary.KeyCollection implements it, you can't bind directly to it. If you just want a readonly list of values you could add them to a List and bind t...
How to bind a dictionary object to a Windows Forms gridview How can I bind a dictionary object to a datagridview in Windows Forms? Dictionary result = new Dictionary (); result.Add(arrFilename[i].fileName,"Found"); dataGridView1.DataSource = result; The dataview grid doesn't bind. What is the solution?
TITLE: How to bind a dictionary object to a Windows Forms gridview QUESTION: How can I bind a dictionary object to a datagridview in Windows Forms? Dictionary result = new Dictionary (); result.Add(arrFilename[i].fileName,"Found"); dataGridView1.DataSource = result; The dataview grid doesn't bind. What is the solution...
[ "c#", "winforms", "visual-studio-2005" ]
1
3
7,723
3
0
2011-06-07T09:19:59.540000
2011-06-07T09:42:12.907000
6,263,129
6,263,158
How to save pictures in MySQL
I want to save pictures(mostly JPEG) to MySQL database. I saw most people say save pictures elsewhere and add link to table. It is the most efficient way. But i need to encrypt my pictures and want to set user privileges. So how can i do this. Please can anyone help me. I'm using a C client program to connect to the My...
Not a good idea, but if you really have to do it this way, use BLOBs (a data type). http://dev.mysql.com/doc/refman/5.0/en/blob.html
How to save pictures in MySQL I want to save pictures(mostly JPEG) to MySQL database. I saw most people say save pictures elsewhere and add link to table. It is the most efficient way. But i need to encrypt my pictures and want to set user privileges. So how can i do this. Please can anyone help me. I'm using a C clien...
TITLE: How to save pictures in MySQL QUESTION: I want to save pictures(mostly JPEG) to MySQL database. I saw most people say save pictures elsewhere and add link to table. It is the most efficient way. But i need to encrypt my pictures and want to set user privileges. So how can i do this. Please can anyone help me. I...
[ "mysql", "c" ]
2
1
3,507
3
0
2011-06-07T09:20:10.583000
2011-06-07T09:23:06.177000
6,263,134
6,263,183
Setting a value to a variable from another class
I'm having a Windows Forms application with a combobox. I added items to the combobox (for example, 1,2,3,4). If I select an item in the combobox SelectedIndex should be returned to the variable in another class. class Form1 { private void Combobox1_SelecetedIndexChanged(object sender,eventArgs e) { combobox1.selecetde...
Something along these lines: (pseudocode) class SomeClass { public int comboindex { get; set; } } SomeClass c = new SomeClass(); c.comboindex = mycombo.selectedindex;
Setting a value to a variable from another class I'm having a Windows Forms application with a combobox. I added items to the combobox (for example, 1,2,3,4). If I select an item in the combobox SelectedIndex should be returned to the variable in another class. class Form1 { private void Combobox1_SelecetedIndexChanged...
TITLE: Setting a value to a variable from another class QUESTION: I'm having a Windows Forms application with a combobox. I added items to the combobox (for example, 1,2,3,4). If I select an item in the combobox SelectedIndex should be returned to the variable in another class. class Form1 { private void Combobox1_Sel...
[ "c#", ".net", "winforms", "combobox" ]
0
0
4,646
3
0
2011-06-07T09:21:13.010000
2011-06-07T09:25:15.090000
6,263,138
6,263,195
Custom delete in ASP.NET Dynamic Data scaffolds
How could I implement a custom delete operation in a ASP.NET Dynamic Data Project? I found this post but nothing helped. Here's the block of code for the delete command: If I implemented the GridView1_RowCommand event I can catch it on the debugger, but where does the actual Delete command code stored, and if I changed...
You can use RowCommand event to gridview and write custom code for deletion protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "newDelete ") { e.CommandArgument // will Return current Row primary key value.............. //Write Delete custom code here............. } }
Custom delete in ASP.NET Dynamic Data scaffolds How could I implement a custom delete operation in a ASP.NET Dynamic Data Project? I found this post but nothing helped. Here's the block of code for the delete command: If I implemented the GridView1_RowCommand event I can catch it on the debugger, but where does the act...
TITLE: Custom delete in ASP.NET Dynamic Data scaffolds QUESTION: How could I implement a custom delete operation in a ASP.NET Dynamic Data Project? I found this post but nothing helped. Here's the block of code for the delete command: If I implemented the GridView1_RowCommand event I can catch it on the debugger, but ...
[ "c#", "asp.net", "linq", "gridview" ]
3
1
892
1
0
2011-06-07T09:21:36.693000
2011-06-07T09:26:10.163000
6,263,141
6,263,489
how to open java program generated zip file using UTF-8 encoding
Our product has an export function, which uses ZipOutputStream to zip a directory; however, when you try to zip a directory that contains file names with Chinese or Japanese character the export doesn't work properly. For some reason the new files in the zipped file are named differently. Here is an example of our zipp...
The top answer here may answer your question; unfortunately it seems to suggest that the Zip format doesn't really allow for creating a Zip file that will display filenames properly on any computer: https://superuser.com/questions/60379/linux-zip-tgz-filenames-encoding-problem I expect it works when you set encoding to...
how to open java program generated zip file using UTF-8 encoding Our product has an export function, which uses ZipOutputStream to zip a directory; however, when you try to zip a directory that contains file names with Chinese or Japanese character the export doesn't work properly. For some reason the new files in the ...
TITLE: how to open java program generated zip file using UTF-8 encoding QUESTION: Our product has an export function, which uses ZipOutputStream to zip a directory; however, when you try to zip a directory that contains file names with Chinese or Japanese character the export doesn't work properly. For some reason the...
[ "java", "encoding", "zip", "unzip", "7zip" ]
4
1
14,883
2
0
2011-06-07T09:21:42.533000
2011-06-07T09:50:40.983000
6,263,160
6,263,290
How can i show a particular column to list view in android
I want to show setName column as a list view how it is possible in android. I am share my code. private String lv_arr[]; String selectList = "select setName from Displaysettings"; DBConnect conn1 = new DBConnect(getApplicationContext(), "colorCode"); conn1.execNonQuery(selectList); lv1=(ListView)findViewById(R.id.ListV...
you can try something like this: String[] setNameValues = new String[] { "setName1", "setName2", "setName3" }; // Create a simple array adapter (of type string) //with the setName values returned by conn1.execNonquery ListAdapter adapter = new ArrayAdapter (this, android.R.layout.simple_list_item_1, setNameValues); So...
How can i show a particular column to list view in android I want to show setName column as a list view how it is possible in android. I am share my code. private String lv_arr[]; String selectList = "select setName from Displaysettings"; DBConnect conn1 = new DBConnect(getApplicationContext(), "colorCode"); conn1.exec...
TITLE: How can i show a particular column to list view in android QUESTION: I want to show setName column as a list view how it is possible in android. I am share my code. private String lv_arr[]; String selectList = "select setName from Displaysettings"; DBConnect conn1 = new DBConnect(getApplicationContext(), "color...
[ "android", "sqlite" ]
1
0
379
2
0
2011-06-07T09:23:17.117000
2011-06-07T09:33:58.333000
6,263,168
6,263,373
How to extract a column of a DataTable into a ConcurrentQueue(Of T)?
Suppose I have a small database represented in memory as a DataTable, what is the best way to extract a column from that DataTable and put it into a ConcurrentQueue(Of T)? Or, should I use a different representation than a DataTable? More details: The 'database' is an extract from a larger database, comprising just 3 c...
Instead of relying on DataTables why don't you create a class to hold the data you require and add the functionality to the class (or class List) which will make more semantic sense.
How to extract a column of a DataTable into a ConcurrentQueue(Of T)? Suppose I have a small database represented in memory as a DataTable, what is the best way to extract a column from that DataTable and put it into a ConcurrentQueue(Of T)? Or, should I use a different representation than a DataTable? More details: The...
TITLE: How to extract a column of a DataTable into a ConcurrentQueue(Of T)? QUESTION: Suppose I have a small database represented in memory as a DataTable, what is the best way to extract a column from that DataTable and put it into a ConcurrentQueue(Of T)? Or, should I use a different representation than a DataTable?...
[ ".net", "datatable" ]
1
1
326
1
0
2011-06-07T09:24:02.543000
2011-06-07T09:41:29.233000
6,263,173
6,263,229
Wordpress redirect htaccess
I have a problem with my htaccess file in wordpress. I want to redirect users who come to /wp-login.php?action=register to another registration form with role parameter. Like this /wp-login.php?action=register&role=patient. So i wanna hide first url from users. I wrote this line in my htaccess. RewriteRule ^wp-login.ph...
You have to match for the query string in a RewriteCond: RewriteCond %{QUERY_STRING} ^action=register$ RewriteRule ^wp-login[.]php$ /wp-login.php?action=register&role=patient [R,NC,L] Edit: corrected my answer
Wordpress redirect htaccess I have a problem with my htaccess file in wordpress. I want to redirect users who come to /wp-login.php?action=register to another registration form with role parameter. Like this /wp-login.php?action=register&role=patient. So i wanna hide first url from users. I wrote this line in my htacce...
TITLE: Wordpress redirect htaccess QUESTION: I have a problem with my htaccess file in wordpress. I want to redirect users who come to /wp-login.php?action=register to another registration form with role parameter. Like this /wp-login.php?action=register&role=patient. So i wanna hide first url from users. I wrote this...
[ "wordpress", ".htaccess" ]
1
1
1,476
3
0
2011-06-07T09:24:24.717000
2011-06-07T09:28:57.870000
6,263,205
6,263,820
Calling ajax from struts2 to populate a div
I have a drop down and have a JavaScript function tied to the onchange event of the drop down.I need to call a action class with the drop down selected value and fetch data from database.I need pointers to call the action class from JavaScript and also pass the selected value of drop down to fire a DB select query and ...
What exactly is it you need assistance with? From what I understand, you have it all figured out (minus the ajax call to the Struts action). All you need to make it work is: What URL you need to call the Struts action How to make the call to the Struts action How to change the contents of a div element using Javascript...
Calling ajax from struts2 to populate a div I have a drop down and have a JavaScript function tied to the onchange event of the drop down.I need to call a action class with the drop down selected value and fetch data from database.I need pointers to call the action class from JavaScript and also pass the selected value...
TITLE: Calling ajax from struts2 to populate a div QUESTION: I have a drop down and have a JavaScript function tied to the onchange event of the drop down.I need to call a action class with the drop down selected value and fetch data from database.I need pointers to call the action class from JavaScript and also pass ...
[ "java", "javascript", "ajax", "struts2" ]
0
0
2,223
1
0
2011-06-07T09:27:04.983000
2011-06-07T10:21:05.320000
6,263,218
6,271,261
MuleESB Reporting
Has anyone used any open source, or relatively low-cost, reporting that works with MuleESB. The Mule Management console looks really good, but the cost of it look prohibitively high for the personal project I want to use it for.
What do you mean by reporting? If you mean monitoring, then use the Mule JMX Agent: you'll get plenty of data points to get the pulse of your running instances.
MuleESB Reporting Has anyone used any open source, or relatively low-cost, reporting that works with MuleESB. The Mule Management console looks really good, but the cost of it look prohibitively high for the personal project I want to use it for.
TITLE: MuleESB Reporting QUESTION: Has anyone used any open source, or relatively low-cost, reporting that works with MuleESB. The Mule Management console looks really good, but the cost of it look prohibitively high for the personal project I want to use it for. ANSWER: What do you mean by reporting? If you mean mon...
[ "reporting", "mule" ]
0
1
83
1
0
2011-06-07T09:28:10.223000
2011-06-07T20:31:38.807000
6,263,223
6,263,403
resizing css sprite
I've an image of dimension some 500X400 px (background.png) and then an HTML div of width 150X100 px. I want to show the portion of the image background.png from top-left (x: 50, y: 50) to bottom-right (x1: 350, y1: 250) inside the div. The dimension of the portion of background.png I want to show is 300X200, which is ...
You can use background-position: -50px -50px and the CSS3 background-size: 50% to achieve this result. background-size isn't supported by old browsers, you can check support here.
resizing css sprite I've an image of dimension some 500X400 px (background.png) and then an HTML div of width 150X100 px. I want to show the portion of the image background.png from top-left (x: 50, y: 50) to bottom-right (x1: 350, y1: 250) inside the div. The dimension of the portion of background.png I want to show i...
TITLE: resizing css sprite QUESTION: I've an image of dimension some 500X400 px (background.png) and then an HTML div of width 150X100 px. I want to show the portion of the image background.png from top-left (x: 50, y: 50) to bottom-right (x1: 350, y1: 250) inside the div. The dimension of the portion of background.pn...
[ "jquery", "css" ]
0
1
2,650
1
0
2011-06-07T09:28:26.337000
2011-06-07T09:43:11.467000
6,263,224
6,264,050
How to add rule to JtextPane according to the text entered
I want to have a rule in JtextPane such as it bolds the words if it contains "-" (dash) as a character else it doesnt. Can i add some rule in documentFilter? Where can i add this rule
First of all use StyledEditorKit (or extension e.g. HTMLEditorKit). Add a DocumentListener. On each change you can check whether newly typed word contains '-' char. I would add the check on ' ' typed. Use Utilities class to get word start and word end. Create a SimpleAttributeSet and use StyleConstants.setBold() to set...
How to add rule to JtextPane according to the text entered I want to have a rule in JtextPane such as it bolds the words if it contains "-" (dash) as a character else it doesnt. Can i add some rule in documentFilter? Where can i add this rule
TITLE: How to add rule to JtextPane according to the text entered QUESTION: I want to have a rule in JtextPane such as it bolds the words if it contains "-" (dash) as a character else it doesnt. Can i add some rule in documentFilter? Where can i add this rule ANSWER: First of all use StyledEditorKit (or extension e.g...
[ "java", "swing", "document", "jtextpane" ]
1
3
995
2
0
2011-06-07T09:28:27.230000
2011-06-07T10:43:08.910000
6,263,226
6,264,235
Python tkinter Entry widget status switch via Radio buttons
a simple question (not so simple for a tkinter newby like me): I'm building a GUI and I want to have two radio buttons driving the status (enabled or disabled) of an Entry widget, into which the user will input data. When the first radio button is pressed, I want the Entry to be disabled; when the second radio button i...
You have a few things wrong with your program, but the general structure is OK. you aren't calling root.mainloop(). This is necessary for the event loop to service events such as button clicks, etc. you use ENABLED and DISABLED but don't define or import those anywhere. Personally I prefer to use the string values "nor...
Python tkinter Entry widget status switch via Radio buttons a simple question (not so simple for a tkinter newby like me): I'm building a GUI and I want to have two radio buttons driving the status (enabled or disabled) of an Entry widget, into which the user will input data. When the first radio button is pressed, I w...
TITLE: Python tkinter Entry widget status switch via Radio buttons QUESTION: a simple question (not so simple for a tkinter newby like me): I'm building a GUI and I want to have two radio buttons driving the status (enabled or disabled) of an Entry widget, into which the user will input data. When the first radio butt...
[ "python", "user-interface", "radio-button", "tkinter" ]
6
7
11,170
1
0
2011-06-07T09:28:41.013000
2011-06-07T11:03:58.830000
6,263,227
6,263,383
IRouteConstraint for enum
I want to create an IRouteConstraint that filters a value against possible values of an enum. I tried to google it for myself, but that didn't result in anything. Any ideas?
See this Essentially, you need private Type enumType; public EnumConstraint(Type enumType) { this.enumType = enumType; } public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { // You can also try Enum.IsDefined, but docs say noth...
IRouteConstraint for enum I want to create an IRouteConstraint that filters a value against possible values of an enum. I tried to google it for myself, but that didn't result in anything. Any ideas?
TITLE: IRouteConstraint for enum QUESTION: I want to create an IRouteConstraint that filters a value against possible values of an enum. I tried to google it for myself, but that didn't result in anything. Any ideas? ANSWER: See this Essentially, you need private Type enumType; public EnumConstraint(Type enumType) {...
[ "asp.net-mvc", "asp.net-mvc-2", "asp.net-mvc-routing", "url-routing" ]
5
5
1,777
3
0
2011-06-07T09:28:54.030000
2011-06-07T09:41:46.977000
6,263,237
6,263,381
jQuery if attribute contains a certain value
Having a total mind blank here. Hoping you can help. How would I alter this argument to be when the attribute 'href does not start with #overlay'... if(this.getTrigger().attr("href")){ // stuff in here } Thanks you wonderful people. Kevin
If you want to use jQuery selectors: if(this.getTrigger().is('a:not([href^="#overlay]")')) { // stuff in here } Edit: In your case where you already have only one item and want to check its href value, the selector solution performs worse than just comparing a slice of the attribute to '#overlay' as the other answers h...
jQuery if attribute contains a certain value Having a total mind blank here. Hoping you can help. How would I alter this argument to be when the attribute 'href does not start with #overlay'... if(this.getTrigger().attr("href")){ // stuff in here } Thanks you wonderful people. Kevin
TITLE: jQuery if attribute contains a certain value QUESTION: Having a total mind blank here. Hoping you can help. How would I alter this argument to be when the attribute 'href does not start with #overlay'... if(this.getTrigger().attr("href")){ // stuff in here } Thanks you wonderful people. Kevin ANSWER: If you wa...
[ "jquery" ]
2
2
7,948
6
0
2011-06-07T09:30:05.527000
2011-06-07T09:41:45.727000
6,263,242
6,263,285
What is happening in the following snippet?
I am not able to understand the following snipet. I mean what is happening exactly. Can any one explain me what is happening? This is the snippet: protected NodeService getUnprotectedNodeService() { if (this.unprotectedNodeService == null) { this.unprotectedNodeService = (NodeService) FacesHelper.getManagedBean(Faces...
it sets this.unprotectedNodeService if it not set yet(and also returns it..), and if it is already set, it just returns it. seems like a caching mechanism to prevent calling heavy methods more then once
What is happening in the following snippet? I am not able to understand the following snipet. I mean what is happening exactly. Can any one explain me what is happening? This is the snippet: protected NodeService getUnprotectedNodeService() { if (this.unprotectedNodeService == null) { this.unprotectedNodeService = (N...
TITLE: What is happening in the following snippet? QUESTION: I am not able to understand the following snipet. I mean what is happening exactly. Can any one explain me what is happening? This is the snippet: protected NodeService getUnprotectedNodeService() { if (this.unprotectedNodeService == null) { this.unprotect...
[ "java" ]
0
3
69
4
0
2011-06-07T09:30:30.490000
2011-06-07T09:33:25.837000
6,263,250
6,263,430
Convert pixels to sp
I need the current TextSize of the TextView in sp units. But getTextSize() returns the size in pixels. So is there a way to convert pixels to sp?
See the DisplayMetrics class, it has fields for densityDpi and scaledDensity. Example usage: float sp = px / getResources().getDisplayMetrics().scaledDensity;
Convert pixels to sp I need the current TextSize of the TextView in sp units. But getTextSize() returns the size in pixels. So is there a way to convert pixels to sp?
TITLE: Convert pixels to sp QUESTION: I need the current TextSize of the TextView in sp units. But getTextSize() returns the size in pixels. So is there a way to convert pixels to sp? ANSWER: See the DisplayMetrics class, it has fields for densityDpi and scaledDensity. Example usage: float sp = px / getResources().ge...
[ "android", "textview" ]
64
48
78,243
3
0
2011-06-07T09:30:51.983000
2011-06-07T09:45:09.967000
6,263,253
6,265,357
How to add developed Facebook application in a Company profile page?
i have two facebook accounts, one is for my personal, and other one is company profile. i just developed facebook application (using personal account), but how can i add it into company profile account, to be accessible using left menu on FB page? tnx in adv!
You have to go to the application profile page: http://www.facebook.com/apps/application.php?id=YOUR_APPLICATION_ID You can also get there by going to facebook.com/developers then click on your application the right, then on the next page click "application profile page". So when your on the "application profile page",...
How to add developed Facebook application in a Company profile page? i have two facebook accounts, one is for my personal, and other one is company profile. i just developed facebook application (using personal account), but how can i add it into company profile account, to be accessible using left menu on FB page? tnx...
TITLE: How to add developed Facebook application in a Company profile page? QUESTION: i have two facebook accounts, one is for my personal, and other one is company profile. i just developed facebook application (using personal account), but how can i add it into company profile account, to be accessible using left me...
[ "facebook" ]
4
4
2,125
2
0
2011-06-07T09:31:07.877000
2011-06-07T12:45:44.043000
6,263,262
6,263,320
How can I force MinGW to use tr1 namespace?
I'm using MinGW 4.5.2 and I'd like to use unordered_map from the tr1 namespace, not the one from std namespace that is enabled by passing -std=c++0x. I'm sure this can be done since there are two unordered_map files, and one is in the tr1 sub-directory. Clarification: I'm also compiling this code with msvc10 and it sup...
Include and use std::tr1::unordered_map<>. EDIT: I'm also compiling this code with msvc10 and it supports it in both namespaces but only in one location. So I'd like to make it compile with both compilers with changing as least as possible. To make it compile with both compilers you can use something like: #if defined(...
How can I force MinGW to use tr1 namespace? I'm using MinGW 4.5.2 and I'd like to use unordered_map from the tr1 namespace, not the one from std namespace that is enabled by passing -std=c++0x. I'm sure this can be done since there are two unordered_map files, and one is in the tr1 sub-directory. Clarification: I'm als...
TITLE: How can I force MinGW to use tr1 namespace? QUESTION: I'm using MinGW 4.5.2 and I'd like to use unordered_map from the tr1 namespace, not the one from std namespace that is enabled by passing -std=c++0x. I'm sure this can be done since there are two unordered_map files, and one is in the tr1 sub-directory. Clar...
[ "c++", "gcc", "c++11", "mingw", "tr1" ]
3
7
1,462
2
0
2011-06-07T09:32:03.337000
2011-06-07T09:36:56.600000
6,263,263
6,263,352
C# WPF - Adding child after exiting fullscreen is adding it on right of where it was
I'm just starting WPF so am just learning but I've ran into a problem when making a UIElement fullscreen. I have a horizontal StackPanel with 2 UIElements inside: 2 more StackPanel s, the one on the left contains a 3dViewport and another StackPanel of Button s and the one on the right contains a vertical stackpanel of ...
Okay just sorted it, sorry for posting the question but I'll answer it here for anyone else who might have the same problem. Instead of using: containerPanel.Children.Add(leftPanel); when coming out of fullscreen, I've used: containerPanel.Children.Insert(0, leftPanel); which inserts the leftPanel element as the first ...
C# WPF - Adding child after exiting fullscreen is adding it on right of where it was I'm just starting WPF so am just learning but I've ran into a problem when making a UIElement fullscreen. I have a horizontal StackPanel with 2 UIElements inside: 2 more StackPanel s, the one on the left contains a 3dViewport and anoth...
TITLE: C# WPF - Adding child after exiting fullscreen is adding it on right of where it was QUESTION: I'm just starting WPF so am just learning but I've ran into a problem when making a UIElement fullscreen. I have a horizontal StackPanel with 2 UIElements inside: 2 more StackPanel s, the one on the left contains a 3d...
[ "c#", "wpf", "styles", "fullscreen" ]
1
0
342
1
0
2011-06-07T09:32:03.373000
2011-06-07T09:39:39.207000
6,263,265
6,263,412
ListView With three fields
Iam Trying to make a financial application and i want to put a image, a text with the description, and the money in the account, in a listview line.. how can i do that?
You would use a CustomAdapter as a subclass of BaseAdapter or ArrayAdapter. Inflate your custom row.xml (Which will be your layout for a single row) and then set that adapter to the ListView. Here is a good tutorial
ListView With three fields Iam Trying to make a financial application and i want to put a image, a text with the description, and the money in the account, in a listview line.. how can i do that?
TITLE: ListView With three fields QUESTION: Iam Trying to make a financial application and i want to put a image, a text with the description, and the money in the account, in a listview line.. how can i do that? ANSWER: You would use a CustomAdapter as a subclass of BaseAdapter or ArrayAdapter. Inflate your custom r...
[ "android", "xml", "eclipse", "listview" ]
1
2
145
1
0
2011-06-07T09:32:06.927000
2011-06-07T09:43:54.310000
6,263,270
6,263,314
Accessing Linked list across modules in C#
I have previously worked with Linked list in C++ where refering link list in different modules using pointer to acxcess the address of it. What I use to do is after creating the linked list use to store the address of the Linked list in long format. In another module is same application after type casting the address I...
Can you not just hold a reference to your Linked List and use it again whenever you need it? LinkedList mylist = new LinkedList(); Now use mylist in whatever place you need it, by passing it around, preferrably.
Accessing Linked list across modules in C# I have previously worked with Linked list in C++ where refering link list in different modules using pointer to acxcess the address of it. What I use to do is after creating the linked list use to store the address of the Linked list in long format. In another module is same a...
TITLE: Accessing Linked list across modules in C# QUESTION: I have previously worked with Linked list in C++ where refering link list in different modules using pointer to acxcess the address of it. What I use to do is after creating the linked list use to store the address of the Linked list in long format. In anothe...
[ "c#", "pointers" ]
3
2
212
2
0
2011-06-07T09:32:16.680000
2011-06-07T09:35:57.020000
6,263,274
6,263,355
get option value from jquery to php and refresh page
I have a simple dropdown box and jquery to get value from what i selected. It works fine but i want the selected value to a php variable and after that i need automatically refresh page. My exact need is when i select a city the below image changes accordingly. for example if i selected Delhi i get the value to a php v...
To do this with AJAX, you will need a php file (ajax.php for example) to handle the sql request and return the image (server side): Also you need an ajax request in the page (client side): $("#single").change(function() { var city_val = $(this).val(); $.get("ajax.php?city="+city_val,function(img_src) { alert(img_src); ...
get option value from jquery to php and refresh page I have a simple dropdown box and jquery to get value from what i selected. It works fine but i want the selected value to a php variable and after that i need automatically refresh page. My exact need is when i select a city the below image changes accordingly. for e...
TITLE: get option value from jquery to php and refresh page QUESTION: I have a simple dropdown box and jquery to get value from what i selected. It works fine but i want the selected value to a php variable and after that i need automatically refresh page. My exact need is when i select a city the below image changes ...
[ "php", "jquery" ]
0
0
2,268
2
0
2011-06-07T09:32:34.210000
2011-06-07T09:39:45.230000
6,263,280
6,263,330
Event handling when onclick
I have an onclick handler for a button. When user clicks on it onBlur() is called on currently focused element rather on the button user just clicked. Now I am handling blur as well. While handling blur I realized I dont want to execute onclick handler at all. How can I do that? Let me know if information provided is i...
I would set a variable during the onblur function called blurring or something similar that is true at the beginning, then false after finishing onblur. In the onclick handler check if the blurring is true, if not then do stuff, otherwise do nothing.
Event handling when onclick I have an onclick handler for a button. When user clicks on it onBlur() is called on currently focused element rather on the button user just clicked. Now I am handling blur as well. While handling blur I realized I dont want to execute onclick handler at all. How can I do that? Let me know ...
TITLE: Event handling when onclick QUESTION: I have an onclick handler for a button. When user clicks on it onBlur() is called on currently focused element rather on the button user just clicked. Now I am handling blur as well. While handling blur I realized I dont want to execute onclick handler at all. How can I do ...
[ "javascript", "jquery", "event-handling" ]
0
0
55
1
0
2011-06-07T09:33:11.237000
2011-06-07T09:38:04.887000
6,263,294
6,263,399
C# JSON serialization based on class definition
I'm using Newtonsoft JSON.NET library, but run into following problem. Dynamic serialization iterates over all object properties and fields. But when using eg ORM where dynamic proxying comes in, I've got obviously error that proxy internal fields can't be serialized. Using attributes on serialized classes with OptIn a...
You could define your json-format in a seperate set of classes and convert the ORM-classes to these with eg. Automapper.
C# JSON serialization based on class definition I'm using Newtonsoft JSON.NET library, but run into following problem. Dynamic serialization iterates over all object properties and fields. But when using eg ORM where dynamic proxying comes in, I've got obviously error that proxy internal fields can't be serialized. Usi...
TITLE: C# JSON serialization based on class definition QUESTION: I'm using Newtonsoft JSON.NET library, but run into following problem. Dynamic serialization iterates over all object properties and fields. But when using eg ORM where dynamic proxying comes in, I've got obviously error that proxy internal fields can't ...
[ "c#", "json" ]
1
1
536
1
0
2011-06-07T09:34:09.490000
2011-06-07T09:42:49.473000
6,263,303
6,263,345
Show a div as a modal pop up
I have the following div: You must select a language. Ok Is this HTML page there are more divs and buttons. I want to show divAlert as a modal pop up. I know there is something in jQuery, I think, that I can use to show my div with a half transparent black background filling the entire page. But I can't remember its na...
you can use jquery dialog widget http://jqueryui.com/demos/dialog/
Show a div as a modal pop up I have the following div: You must select a language. Ok Is this HTML page there are more divs and buttons. I want to show divAlert as a modal pop up. I know there is something in jQuery, I think, that I can use to show my div with a half transparent black background filling the entire page...
TITLE: Show a div as a modal pop up QUESTION: I have the following div: You must select a language. Ok Is this HTML page there are more divs and buttons. I want to show divAlert as a modal pop up. I know there is something in jQuery, I think, that I can use to show my div with a half transparent black background filli...
[ "html", "modal-dialog" ]
16
13
131,080
2
0
2011-06-07T09:35:07.477000
2011-06-07T09:39:00.343000
6,263,304
6,263,364
how to read only images from a folder?
class PhotoController { def index = { def baseFolder = grailsAttributes.getApplicationContext().getResource("/").getFile().toString() def imagesFolder = baseFolder + '/images/sps' def imageList1 = new File(imagesFolder).list() [imageList:imageList1] } } The above is listing non-jpg files too. How can I avoid that?!
You can invoke the eachFileMatch method on the folder: def imageList1 = [] new File(imagesFolder).eachFileMatch(~/.*?\.jpg/) { imageList1 << it }
how to read only images from a folder? class PhotoController { def index = { def baseFolder = grailsAttributes.getApplicationContext().getResource("/").getFile().toString() def imagesFolder = baseFolder + '/images/sps' def imageList1 = new File(imagesFolder).list() [imageList:imageList1] } } The above is listing non-jp...
TITLE: how to read only images from a folder? QUESTION: class PhotoController { def index = { def baseFolder = grailsAttributes.getApplicationContext().getResource("/").getFile().toString() def imagesFolder = baseFolder + '/images/sps' def imageList1 = new File(imagesFolder).list() [imageList:imageList1] } } The above...
[ "grails", "groovy" ]
1
5
299
1
0
2011-06-07T09:35:13.840000
2011-06-07T09:40:42.610000
6,263,305
6,263,654
Constant in-place array of strings and records in Delphi
Is something like this possible with Delphi? (with dynamic arrays of strings and records) type TStringArray = array of String; TRecArray = array of TMyRecord; procedure DoSomethingWithStrings(Strings: TStringArray); procedure DoSomethingWithRecords(Records: TRecArray); function BuildRecord(const Value: String): TMyRec...
If you don't have to change the length of the arrays inside your DoSomethingWith* routines, I suggest using open arrays instead of dynamic ones, e.g. like this: procedure DoSomethingWithStrings(const Strings: array of string); var i: Integer; begin for i:= Low(Strings) to High(Strings) do Writeln(Strings[i]); end; pro...
Constant in-place array of strings and records in Delphi Is something like this possible with Delphi? (with dynamic arrays of strings and records) type TStringArray = array of String; TRecArray = array of TMyRecord; procedure DoSomethingWithStrings(Strings: TStringArray); procedure DoSomethingWithRecords(Records: TRec...
TITLE: Constant in-place array of strings and records in Delphi QUESTION: Is something like this possible with Delphi? (with dynamic arrays of strings and records) type TStringArray = array of String; TRecArray = array of TMyRecord; procedure DoSomethingWithStrings(Strings: TStringArray); procedure DoSomethingWithRec...
[ "arrays", "delphi", "delphi-xe" ]
4
6
2,851
1
0
2011-06-07T09:35:14.183000
2011-06-07T10:04:35.883000
6,263,319
6,263,852
the fastest way to pick the Nth element of a hash
I've got a big hashtable (array with string indexes) and looking for a function that quickly picks the first (ideally, also Nth) element from it. array_shift() and reset() are too slow for my needs. UPDATE: i'm also not looking for a reference-based solution, the function should accept expressions as in get_first(some_...
Use array_slice to get an array of just the n -th item and array_pop to finally get it: $nthItem = array_pop(array_slice($arr, $n, 1));
the fastest way to pick the Nth element of a hash I've got a big hashtable (array with string indexes) and looking for a function that quickly picks the first (ideally, also Nth) element from it. array_shift() and reset() are too slow for my needs. UPDATE: i'm also not looking for a reference-based solution, the functi...
TITLE: the fastest way to pick the Nth element of a hash QUESTION: I've got a big hashtable (array with string indexes) and looking for a function that quickly picks the first (ideally, also Nth) element from it. array_shift() and reset() are too slow for my needs. UPDATE: i'm also not looking for a reference-based so...
[ "php", "arrays" ]
6
7
1,686
5
0
2011-06-07T09:36:56.350000
2011-06-07T10:23:52.603000
6,263,323
6,270,848
Can't create a distribution provisioning profile in iOS Dev Center
My problem is, that i can't create a distribution provisioning profile in the iOS Dev Center. I created a new App in the iOS Dev Center I programmed the app I built the app with an existing distribution provisioning profile from an other app I created the App in the iTunes Connect Center and set it ready for upload Whe...
I am having the same trouble. I called Developer Support and they told me that the systems where being overwelhemed by the iOS5 downloads. So they had me email the Provisioning team. Still have not heard anything back from them. But it appears to be affecting just about everyone, if not everyone.
Can't create a distribution provisioning profile in iOS Dev Center My problem is, that i can't create a distribution provisioning profile in the iOS Dev Center. I created a new App in the iOS Dev Center I programmed the app I built the app with an existing distribution provisioning profile from an other app I created t...
TITLE: Can't create a distribution provisioning profile in iOS Dev Center QUESTION: My problem is, that i can't create a distribution provisioning profile in the iOS Dev Center. I created a new App in the iOS Dev Center I programmed the app I built the app with an existing distribution provisioning profile from an oth...
[ "ios", "distribution" ]
8
3
8,218
2
0
2011-06-07T09:37:19.097000
2011-06-07T19:53:20.970000
6,263,327
6,263,357
$_GET php security
Do coding this way pose any security risks? $test = $_GET['test']; if($test) { $sql = mysql_query("SELECT * FROM tbl WHERE col2 = 'ABC'"); $row... }
No, The code above does not have any security hole since you are not using the GET variable in any mysql query. Look here for other security concerns
$_GET php security Do coding this way pose any security risks? $test = $_GET['test']; if($test) { $sql = mysql_query("SELECT * FROM tbl WHERE col2 = 'ABC'"); $row... }
TITLE: $_GET php security QUESTION: Do coding this way pose any security risks? $test = $_GET['test']; if($test) { $sql = mysql_query("SELECT * FROM tbl WHERE col2 = 'ABC'"); $row... } ANSWER: No, The code above does not have any security hole since you are not using the GET variable in any mysql query. Look here for...
[ "php" ]
1
4
4,820
7
0
2011-06-07T09:37:46.633000
2011-06-07T09:39:55.680000
6,263,329
6,263,497
two tables considered as one
I have two tables like this: Table1(id, name) Table2(id_of_table_1, code) I don't need an entity for Table1 or Table2, but one entity for both together: class Merge{ public virtual long id{get;set;} public virtual string name{get;set;} public virtual string code{get;set;} } How can I load the tables to the edmx so that...
You are looking for advanced mapping called Entity splitting.
two tables considered as one I have two tables like this: Table1(id, name) Table2(id_of_table_1, code) I don't need an entity for Table1 or Table2, but one entity for both together: class Merge{ public virtual long id{get;set;} public virtual string name{get;set;} public virtual string code{get;set;} } How can I load t...
TITLE: two tables considered as one QUESTION: I have two tables like this: Table1(id, name) Table2(id_of_table_1, code) I don't need an entity for Table1 or Table2, but one entity for both together: class Merge{ public virtual long id{get;set;} public virtual string name{get;set;} public virtual string code{get;set;} ...
[ "c#", ".net", "entity-framework" ]
4
2
194
4
0
2011-06-07T09:37:54.233000
2011-06-07T09:51:13.210000
6,263,338
6,263,610
Items decorations in a TreeViewer
I have the following problem: I'm preparing an editor in Eclipse and one of the tab contains TreeViewer to show items in the tree. Each item has a name and a value, which is editable. The problem I need to indicate to user that value is incorrect (e.g. exceeds a given range). My idea is to decorate incorrect cells with...
There are two ways that this can be done. If your TreeViewer displays objects that are instances of EObject (generated by EMF. If your don't understand this part, skip to the next paragraph:)), you can change these EObject's "XyzItemProvider" so that their "getImage" method return a decorated image instead of the "plai...
Items decorations in a TreeViewer I have the following problem: I'm preparing an editor in Eclipse and one of the tab contains TreeViewer to show items in the tree. Each item has a name and a value, which is editable. The problem I need to indicate to user that value is incorrect (e.g. exceeds a given range). My idea i...
TITLE: Items decorations in a TreeViewer QUESTION: I have the following problem: I'm preparing an editor in Eclipse and one of the tab contains TreeViewer to show items in the tree. Each item has a name and a value, which is editable. The problem I need to indicate to user that value is incorrect (e.g. exceeds a given...
[ "java", "eclipse", "treeview", "swt", "jface" ]
4
8
3,592
1
0
2011-06-07T09:38:31.247000
2011-06-07T10:01:07.697000
6,263,341
6,263,531
Getting virtual path of an arbitrary page
Consider this scenario: You want to redirect (REDIRECT) a user to a certain handler (aspx or ashx) without hardcoded path. You have the name of the handler's class, you can even get it's type (ASP.whateverpageclass). Now, how do you get the virtual path?
If I understood correctly, you want a virtual path for a handler if you have the name/type of implementing class. AFAIK, this is not possible because there need not be one to one correlation between two - from ASP.NET run-time perspective, it has to map a virtual path to some handler class (and not a vice-verse). For e...
Getting virtual path of an arbitrary page Consider this scenario: You want to redirect (REDIRECT) a user to a certain handler (aspx or ashx) without hardcoded path. You have the name of the handler's class, you can even get it's type (ASP.whateverpageclass). Now, how do you get the virtual path?
TITLE: Getting virtual path of an arbitrary page QUESTION: Consider this scenario: You want to redirect (REDIRECT) a user to a certain handler (aspx or ashx) without hardcoded path. You have the name of the handler's class, you can even get it's type (ASP.whateverpageclass). Now, how do you get the virtual path? ANSW...
[ "asp.net" ]
1
1
362
1
0
2011-06-07T09:38:40.003000
2011-06-07T09:54:00.900000
6,263,344
6,263,753
How to write an if-statement within a if-statement
How can I write something like: if $1 = a then check second statement if $2 is b then echo a and b else $1 = 1 then check second statement if $2 = 2 then echo 1 and 2...where all of the variables are strings? This is what I have: fun() { if [ "$1" == "a" ]; # when $1 is a then then if [ "$2" == "" ]; # $1 is a and $2 i...
Using a nested case statement could help you: Nested case in bash script Your function would look like this: fun(){ case "$1" in "a") # $1 is 'a' case "$2" in "") echo "$1";; # only $1 present "b") echo "a and b";; # $1 is 'a' and $2 is 'b' esac;; "1") # $1 is '1' case "$2" in "") echo "$1";; # only $1 present "2") ech...
How to write an if-statement within a if-statement How can I write something like: if $1 = a then check second statement if $2 is b then echo a and b else $1 = 1 then check second statement if $2 = 2 then echo 1 and 2...where all of the variables are strings? This is what I have: fun() { if [ "$1" == "a" ]; # when $1 i...
TITLE: How to write an if-statement within a if-statement QUESTION: How can I write something like: if $1 = a then check second statement if $2 is b then echo a and b else $1 = 1 then check second statement if $2 = 2 then echo 1 and 2...where all of the variables are strings? This is what I have: fun() { if [ "$1" == ...
[ "bash" ]
1
3
1,396
3
0
2011-06-07T09:38:59.737000
2011-06-07T10:13:46.750000
6,263,348
6,263,420
Java: generics method and type identification
I'm not very used to generics, so I'm a little confused here about how I'm supposed to solve this problem. I've written a method that tries to call different methods at runtime. But I'm getting a ClassCastException although the code seems syntactically correct. I have the following classes (some getters and setters wer...
You need to pass the class to your method: public List intersectTransportes(Entidade entidade, List transportes, Class clazz) {... T typeOfTransporte = clazz.newInstance();
Java: generics method and type identification I'm not very used to generics, so I'm a little confused here about how I'm supposed to solve this problem. I've written a method that tries to call different methods at runtime. But I'm getting a ClassCastException although the code seems syntactically correct. I have the f...
TITLE: Java: generics method and type identification QUESTION: I'm not very used to generics, so I'm a little confused here about how I'm supposed to solve this problem. I've written a method that tries to call different methods at runtime. But I'm getting a ClassCastException although the code seems syntactically cor...
[ "java", "generics", "methods", "runtimeexception" ]
1
1
818
5
0
2011-06-07T09:39:13.370000
2011-06-07T09:44:16.197000
6,263,349
6,268,431
Programmatically convert autocad file to visio diagram
I am drying to convert autocad file (dwg or dxf format) to visio file. I can manually insert auto cad file in visio and then convert the cad drawing object to visio shapes. This works fine. I tried to do the same using visio interop assembly, but I cannot find any method to import the cad file. Is there any method usin...
You can use the "Convert AutoCAD Drawings" addon. See here: Viewing, Editing, and Saving AutoCAD Files in Microsoft Office Visio.
Programmatically convert autocad file to visio diagram I am drying to convert autocad file (dwg or dxf format) to visio file. I can manually insert auto cad file in visio and then convert the cad drawing object to visio shapes. This works fine. I tried to do the same using visio interop assembly, but I cannot find any ...
TITLE: Programmatically convert autocad file to visio diagram QUESTION: I am drying to convert autocad file (dwg or dxf format) to visio file. I can manually insert auto cad file in visio and then convert the cad drawing object to visio shapes. This works fine. I tried to do the same using visio interop assembly, but ...
[ "c#", "office-interop", "visio", "autocad", "dwg" ]
1
2
1,671
1
0
2011-06-07T09:39:29.520000
2011-06-07T16:22:10.833000
6,263,372
6,263,448
Problem with HTTP Connections
I've a big problem (sorry for my poor english). I attach directly my code: public bool isServerOnline() { Boolean ret = false; try { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(VPMacro.MacroUploader.SERVER_URL); req.Method = "HEAD"; req.KeepAlive = false; HttpWebResponse resp = (HttpWebResponse)req.GetR...
Tomcat Manager shows sessions, not active TCP connections. Each request might start a new session, but an active session does not necessarily indicate an active TCP connection.
Problem with HTTP Connections I've a big problem (sorry for my poor english). I attach directly my code: public bool isServerOnline() { Boolean ret = false; try { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(VPMacro.MacroUploader.SERVER_URL); req.Method = "HEAD"; req.KeepAlive = false; HttpWebResponse re...
TITLE: Problem with HTTP Connections QUESTION: I've a big problem (sorry for my poor english). I attach directly my code: public bool isServerOnline() { Boolean ret = false; try { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(VPMacro.MacroUploader.SERVER_URL); req.Method = "HEAD"; req.KeepAlive = false; ...
[ "c#", "http", "connection", "persistence" ]
2
0
150
2
0
2011-06-07T09:41:24.723000
2011-06-07T09:47:06.633000
6,263,378
6,264,192
Sterling database created from Windows Console app won't read inside WP7 app
I have created a Sterling database inside a standard Windows console app, then I have added that database file as a resource inside a WP7 app. I find that the database reading code causing an ArgumentNullException when accessing the LazyValue.Value member. Here's the database creation code, excluding the model 'Venue'....
Currently Sterling stores types using the fully qualified assembly type name. That means the referenced classes should be in the exact same project = preferably a shared Silverlight 3 DLL. If you are just linking the files and recompiling it won't work due to this. The goal is to change this in version 2.0 to improve t...
Sterling database created from Windows Console app won't read inside WP7 app I have created a Sterling database inside a standard Windows console app, then I have added that database file as a resource inside a WP7 app. I find that the database reading code causing an ArgumentNullException when accessing the LazyValue....
TITLE: Sterling database created from Windows Console app won't read inside WP7 app QUESTION: I have created a Sterling database inside a standard Windows console app, then I have added that database file as a resource inside a WP7 app. I find that the database reading code causing an ArgumentNullException when access...
[ "c#", "database", "windows-phone-7" ]
1
1
546
2
0
2011-06-07T09:41:40.683000
2011-06-07T10:58:14.030000
6,263,379
6,263,837
Can't create QwtPlot without getting 1073741515 at run time
I'm working on a project in Qt 4.7.4 using the msvc2008 compiler, and I'm trying to use Qwt to plot some graphs in my project. I tried to add a very simple graph, and when that didn't work, I stripped out all of the code until I got to the first error, which was the very first line: QwtPlot *leftGraph; leftGraph = new ...
Exit code -1073741515 is 0xC0000135 in hex, which basically means "some dll not found". If your run the app normally (ie not under the debugger), you should get a dialog box saying which dll was not found, I suggest you try that first. Anyway the typical cause in your case would be that the Qt dlls are not found when y...
Can't create QwtPlot without getting 1073741515 at run time I'm working on a project in Qt 4.7.4 using the msvc2008 compiler, and I'm trying to use Qwt to plot some graphs in my project. I tried to add a very simple graph, and when that didn't work, I stripped out all of the code until I got to the first error, which w...
TITLE: Can't create QwtPlot without getting 1073741515 at run time QUESTION: I'm working on a project in Qt 4.7.4 using the msvc2008 compiler, and I'm trying to use Qwt to plot some graphs in my project. I tried to add a very simple graph, and when that didn't work, I stripped out all of the code until I got to the fi...
[ "visual-studio-2008", "qt", "graph", "qwt" ]
0
1
772
1
0
2011-06-07T09:41:40.393000
2011-06-07T10:22:13.240000
6,263,384
6,263,472
Why does my view become white when i remove a subview?
in my view I have a scrollView as subview. The scrollView has another subview called thePDFView. It is for showing a PDF page. This view has 2 subviews. drawImage is an image loaded from disk above the whole PDF view. And paintView is the second subview where all the painting and markup is done. But I only want to add ...
[thePDFView removeFromSuperview]; removes the whole view which was inside the scroll view leaving you nothing but the scrollview which does not have any subviews now. Hence your view is white. I think you wanted to remove only paintView.view so it should be [paintView.view removeFromSuperview];
Why does my view become white when i remove a subview? in my view I have a scrollView as subview. The scrollView has another subview called thePDFView. It is for showing a PDF page. This view has 2 subviews. drawImage is an image loaded from disk above the whole PDF view. And paintView is the second subview where all t...
TITLE: Why does my view become white when i remove a subview? QUESTION: in my view I have a scrollView as subview. The scrollView has another subview called thePDFView. It is for showing a PDF page. This view has 2 subviews. drawImage is an image loaded from disk above the whole PDF view. And paintView is the second s...
[ "iphone", "xcode", "uiview", "uiviewcontroller", "subview" ]
0
2
197
1
0
2011-06-07T09:41:55.973000
2011-06-07T09:48:41.027000
6,263,389
6,265,493
Can I create an AIR app which will only run with the provided CD?
I'm looking to make an AIR application. However, unlike the normal distro, I want to sell these on a CD. I want the AIR app to only be able to be run when the CD is in the CD drive (I don't care that people can hack around this, its the default behavior I want) Does anyone know if this is possible?
You can get drive list with: var drives:Array = File.getRootDirectories(); Next, you want to check ones with spaceAvailable = 0 if they contain files like on your CD. If the disk isn't in the drive, drive will not be listed in array.
Can I create an AIR app which will only run with the provided CD? I'm looking to make an AIR application. However, unlike the normal distro, I want to sell these on a CD. I want the AIR app to only be able to be run when the CD is in the CD drive (I don't care that people can hack around this, its the default behavior ...
TITLE: Can I create an AIR app which will only run with the provided CD? QUESTION: I'm looking to make an AIR application. However, unlike the normal distro, I want to sell these on a CD. I want the AIR app to only be able to be run when the CD is in the CD drive (I don't care that people can hack around this, its the...
[ "air", "cd-rom" ]
1
1
197
1
0
2011-06-07T09:42:07.303000
2011-06-07T12:57:03.430000
6,263,394
6,264,784
R: Print two tables with xtable ()
I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b), but they should be either adjacent, or stacke...
I would recommend saving the results as two separate tables in different files (see the file= option to print.xtable() ), and then input them into your LaTeX document with any command you find appropriate for your layout ( tabular, subfloat, minipage, etc.). This is what I do in general, although I generally rely on La...
R: Print two tables with xtable () I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b), but they s...
TITLE: R: Print two tables with xtable () QUESTION: I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()? The two tables should be distinct, i.e. we could call them Table x(a) and Tabl...
[ "r", "sweave" ]
8
16
12,011
2
0
2011-06-07T09:42:31.200000
2011-06-07T11:53:56.660000
6,263,395
6,263,608
Visual Studio localhost prompting for login
I'm using Visual Studio 2005 for a project. When I try to run the project, the browser pops up the login prompt saying Authentication Required. If I hit Ok or Cancel, it goes to the error page saying HTTP Error 401 - Unauthorized. The weird thing is the same project was working fine till today! There have been no recen...
You might need admin rights to run in the debugger, depending on OS
Visual Studio localhost prompting for login I'm using Visual Studio 2005 for a project. When I try to run the project, the browser pops up the login prompt saying Authentication Required. If I hit Ok or Cancel, it goes to the error page saying HTTP Error 401 - Unauthorized. The weird thing is the same project was worki...
TITLE: Visual Studio localhost prompting for login QUESTION: I'm using Visual Studio 2005 for a project. When I try to run the project, the browser pops up the login prompt saying Authentication Required. If I hit Ok or Cancel, it goes to the error page saying HTTP Error 401 - Unauthorized. The weird thing is the same...
[ "c#", "asp.net", "visual-studio" ]
7
7
2,962
1
0
2011-06-07T09:42:36.823000
2011-06-07T10:01:04.357000
6,263,405
6,263,527
How to model an unknown amount of variables with C#
I don't know how to explain this properly, someone please edit my title and post as needed. I thought this could be solved with polymorphism, but I couldn't get it to work. What I would like to have is as following. I'm going to have different shapes and they all have different variables. For example, to describe a par...
The scheme you're thinking in is usually called a "variant". CVariable is not a good name for this, it's just to unspecific. But you're thinking in the right direction already. By deriving from a common base class you can pack the elements in a common container. The trick to access those derived types is using the runt...
How to model an unknown amount of variables with C# I don't know how to explain this properly, someone please edit my title and post as needed. I thought this could be solved with polymorphism, but I couldn't get it to work. What I would like to have is as following. I'm going to have different shapes and they all have...
TITLE: How to model an unknown amount of variables with C# QUESTION: I don't know how to explain this properly, someone please edit my title and post as needed. I thought this could be solved with polymorphism, but I couldn't get it to work. What I would like to have is as following. I'm going to have different shapes...
[ "c#", "polymorphism" ]
1
1
207
2
0
2011-06-07T09:43:18.177000
2011-06-07T09:53:49.970000
6,263,415
6,264,370
List comprehension vs high-order functions in F#
I come from SML background and feel quite comfortable with high-order functions. But I don't really get the idea of list comprehension. Is there any situation where list comprehension is more suitable than high-order functions on List and vice versa? I heard somewhere that list comprehension is slower than high-order f...
Choosing between comprehensions and higher-order functions is mostly a matter of style. I think that comprehensions are sometimes more readable, but that's just a personal preference. Note that the cartesian function could be written more elegantly like this: let rec cartesian = function | [] -> [[]] | L::Ls -> [ for C...
List comprehension vs high-order functions in F# I come from SML background and feel quite comfortable with high-order functions. But I don't really get the idea of list comprehension. Is there any situation where list comprehension is more suitable than high-order functions on List and vice versa? I heard somewhere th...
TITLE: List comprehension vs high-order functions in F# QUESTION: I come from SML background and feel quite comfortable with high-order functions. But I don't really get the idea of list comprehension. Is there any situation where list comprehension is more suitable than high-order functions on List and vice versa? I ...
[ "list", "f#", "list-comprehension" ]
8
11
1,386
3
0
2011-06-07T09:43:58.687000
2011-06-07T11:14:57.847000
6,263,424
6,263,477
jQuery: .select() and .focus() method difference
In jQuery, what is basic difference between.select() & focus() and what are their appropriate using places?
They have their differences:.select(): will fire when TEXT is selected. Limitted to and elements..focus(): will fire when an element receives focus i.e. an input box is clicked on, tabbed into, etc. Also limitted but to a wider range of elements, mostly form elements such as,,
jQuery: .select() and .focus() method difference In jQuery, what is basic difference between.select() & focus() and what are their appropriate using places?
TITLE: jQuery: .select() and .focus() method difference QUESTION: In jQuery, what is basic difference between.select() & focus() and what are their appropriate using places? ANSWER: They have their differences:.select(): will fire when TEXT is selected. Limitted to and elements..focus(): will fire when an element rec...
[ "jquery" ]
20
14
15,478
2
0
2011-06-07T09:44:36.160000
2011-06-07T09:49:11.867000
6,263,425
6,263,596
Why does the compiler version appear in my ELF executable?
I've recently compiled a simple hello world C program under Debian Linux using gcc: gcc -mtune=native -march=native -m32 -s -Wunused -O2 -o hello hello.c The file size was 2980 bytes. I opened it in a hex editor and i saw the following lines: GCC: (Debian 4.4.5-8) 4.4.5 GCC: (Debian 4.4.5-10) 4.4.5.shstrtab.interp.note...
That's in a comment section in the ELF binary. You can strip it out: $ gcc -m32 -O2 -s -o t t.c $ ls -l t -rwxr-xr-x 1 me users 5488 Jun 7 11:58 t $ readelf -p.comment t String dump of section '.comment': [ 0] GCC: (Gentoo 4.5.1-r1 p1.4, pie-0.4.5) 4.5.1 [ 2d] GCC: (Gentoo 4.5.2 p1.1, pie-0.4.5) 4.5.2 $ strip -R.comm...
Why does the compiler version appear in my ELF executable? I've recently compiled a simple hello world C program under Debian Linux using gcc: gcc -mtune=native -march=native -m32 -s -Wunused -O2 -o hello hello.c The file size was 2980 bytes. I opened it in a hex editor and i saw the following lines: GCC: (Debian 4.4.5...
TITLE: Why does the compiler version appear in my ELF executable? QUESTION: I've recently compiled a simple hello world C program under Debian Linux using gcc: gcc -mtune=native -march=native -m32 -s -Wunused -O2 -o hello hello.c The file size was 2980 bytes. I opened it in a hex editor and i saw the following lines: ...
[ "c", "linux", "gcc", "elf" ]
15
11
8,750
6
0
2011-06-07T09:44:36.257000
2011-06-07T10:00:06.193000
6,263,428
6,263,876
How to do a wiki / wordpress style compare / diff in PHP?
A bit like this from WordPress: Or this from MediaWiki: I have tried several diff engines in PHP, the most comprehensive seem to be ( http://www.raymondhill.net/finediff/viewdiff-ex.php ) and PEAR's Text_Diff, but I can't seem to find any option to have both versions stacked side by side like in the above images. I thi...
Have found a solution - by taking the WP_Text_Diff_Renderer_Table class from WordPress (wp-includes/wp-diff.php) which is used in conjuction with PEAR Text_Diff: $diff = new Text_Diff('auto', array($lines1, $lines2)); $render = new WP_Text_Diff_Renderer_Table; echo $render->render($diff); When wrapped in tags the above...
How to do a wiki / wordpress style compare / diff in PHP? A bit like this from WordPress: Or this from MediaWiki: I have tried several diff engines in PHP, the most comprehensive seem to be ( http://www.raymondhill.net/finediff/viewdiff-ex.php ) and PEAR's Text_Diff, but I can't seem to find any option to have both ver...
TITLE: How to do a wiki / wordpress style compare / diff in PHP? QUESTION: A bit like this from WordPress: Or this from MediaWiki: I have tried several diff engines in PHP, the most comprehensive seem to be ( http://www.raymondhill.net/finediff/viewdiff-ex.php ) and PEAR's Text_Diff, but I can't seem to find any optio...
[ "php", "diff" ]
3
5
1,265
2
0
2011-06-07T09:45:03.570000
2011-06-07T10:25:40.680000
6,263,443
6,263,868
PDO Connection Test
I am writing an installer for one of my apps and I would like to be able to test some default database settings. Is this possible using PDO to test valid and invalid database connections? I have the following code: try{ $dbh = new pdo('mysql:host=127.0.0.1:3308;dbname=axpdb','admin','1234'); die(json_encode(array('outc...
you need to set the error mode when connection to the database: try{ $dbh = new pdo( 'mysql:host=127.0.0.1:3308;dbname=axpdb', 'admin', '1234', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); die(json_encode(array('outcome' => true))); } catch(PDOException $ex){ die(json_encode(array('outcome' => false, 'message' ...
PDO Connection Test I am writing an installer for one of my apps and I would like to be able to test some default database settings. Is this possible using PDO to test valid and invalid database connections? I have the following code: try{ $dbh = new pdo('mysql:host=127.0.0.1:3308;dbname=axpdb','admin','1234'); die(jso...
TITLE: PDO Connection Test QUESTION: I am writing an installer for one of my apps and I would like to be able to test some default database settings. Is this possible using PDO to test valid and invalid database connections? I have the following code: try{ $dbh = new pdo('mysql:host=127.0.0.1:3308;dbname=axpdb','admin...
[ "php", "mysql", "pdo" ]
46
65
105,344
4
0
2011-06-07T09:46:43.773000
2011-06-07T10:25:17.590000
6,263,446
6,263,494
retainAll for many lists (Java)
I have a bunch of lists ( List ) and I want to get the intersection. SomeClass looks like this: public class SomeClass { private String a; private String b; // getters and setters } It should only become part of the intersection if the members a and b are equal. How can I do that? I could probably use Collection.retai...
Override the equals and hasCode methods accordingly for your class. See Implementing equals. These two methods implicitly reside in the Object instance, root of all classes, and they can be tuned/override to implement identification of instances following certain semantics, like in your case. This other SO question add...
retainAll for many lists (Java) I have a bunch of lists ( List ) and I want to get the intersection. SomeClass looks like this: public class SomeClass { private String a; private String b; // getters and setters } It should only become part of the intersection if the members a and b are equal. How can I do that? I cou...
TITLE: retainAll for many lists (Java) QUESTION: I have a bunch of lists ( List ) and I want to get the intersection. SomeClass looks like this: public class SomeClass { private String a; private String b; // getters and setters } It should only become part of the intersection if the members a and b are equal. How ca...
[ "java", "intersection" ]
2
2
999
1
0
2011-06-07T09:46:58.287000
2011-06-07T09:51:02.920000
6,263,450
6,264,774
PHP how to open page1, redirect to page2 and show page1 in a div dom?
I have many sub pages, there urls like www.domain.com/sub/page1.php www.domain.com/sub/page2.php... Now when I type there url in browser. they all redirect to www.domain.com/sub/index.php, and the current sub page will show in a div dom in the index.php. My knowledge is very limited. I only know jqeury.load and php hea...
In every PHP file (e.g page1.php ) use this code: Insert the content you want here... And in the index.php file:
PHP how to open page1, redirect to page2 and show page1 in a div dom? I have many sub pages, there urls like www.domain.com/sub/page1.php www.domain.com/sub/page2.php... Now when I type there url in browser. they all redirect to www.domain.com/sub/index.php, and the current sub page will show in a div dom in the index....
TITLE: PHP how to open page1, redirect to page2 and show page1 in a div dom? QUESTION: I have many sub pages, there urls like www.domain.com/sub/page1.php www.domain.com/sub/page2.php... Now when I type there url in browser. they all redirect to www.domain.com/sub/index.php, and the current sub page will show in a div...
[ "php", "javascript", "jquery", "redirect" ]
1
1
380
1
0
2011-06-07T09:47:08.857000
2011-06-07T11:52:58.103000
6,263,452
6,263,553
Implementing settings in my APP
I would like to implement settings/preferences in my application, which is written in PHP with Kohana and Zend Framework. Question: What is the best approach to implement settings/preferences? I don't want to put IF statemant every time something needs to be optionally run. Is there more objective kind of way? Where ca...
What is the best approach to implement settings/preferences? That's hard to answer that widely, there are approaches and each have their pros and cons. Normally in PHP the best approach is to implement settings within an array variable. Later on you can add complexity by adding the ArrayAccess interface to it, convert ...
Implementing settings in my APP I would like to implement settings/preferences in my application, which is written in PHP with Kohana and Zend Framework. Question: What is the best approach to implement settings/preferences? I don't want to put IF statemant every time something needs to be optionally run. Is there more...
TITLE: Implementing settings in my APP QUESTION: I would like to implement settings/preferences in my application, which is written in PHP with Kohana and Zend Framework. Question: What is the best approach to implement settings/preferences? I don't want to put IF statemant every time something needs to be optionally ...
[ "php", "zend-framework", "settings", "preferences" ]
1
1
113
1
0
2011-06-07T09:47:18.177000
2011-06-07T09:55:44.713000
6,263,453
6,263,482
Retrieve client ip address in mysql
I'm trying to get with a simple SQL statement the IP address of the client. I do not want to use PHP or other techniques. Only pure SQL. When I use SELECT USER(); I get dbouser@host.i.do.not.care.of When I use SELECT CURRENT_USER(); I get dbouser@% But how do I get the plain IP? Thanks a lot in advance.
You will only get the IP address of the client process communicating with MySQL. Assuming this is what you want: select host from information_schema.processlist WHERE ID=connection_id(); Will give you the host name (or IP address if name resolution is not enabled, which it is usually not) connecting to the mysql server...
Retrieve client ip address in mysql I'm trying to get with a simple SQL statement the IP address of the client. I do not want to use PHP or other techniques. Only pure SQL. When I use SELECT USER(); I get dbouser@host.i.do.not.care.of When I use SELECT CURRENT_USER(); I get dbouser@% But how do I get the plain IP? Than...
TITLE: Retrieve client ip address in mysql QUESTION: I'm trying to get with a simple SQL statement the IP address of the client. I do not want to use PHP or other techniques. Only pure SQL. When I use SELECT USER(); I get dbouser@host.i.do.not.care.of When I use SELECT CURRENT_USER(); I get dbouser@% But how do I get ...
[ "mysql", "sql" ]
30
56
55,190
5
0
2011-06-07T09:47:18.840000
2011-06-07T09:49:48.497000
6,263,454
6,263,526
Get relative URL from absolute URL
I want to get the relative URL from an absolute URL in JavaScript using regex and the replace method. I tried the following but it is not working: var str="http://localhost/mypage.jsp"; document.write(str.replace("^[\w]*\/\/[\w]*$",""));
If by "relative URL" you mean the part of the string after the first single /, then it's simple: document.write(str.replace(/^(?:\/\/|[^/]+)*\//, '')); This matches all the characters up to the first single / in the string and replaces them with the empty string. In: http://localhost/my/page.jsp --> Out: /my/page.jsp
Get relative URL from absolute URL I want to get the relative URL from an absolute URL in JavaScript using regex and the replace method. I tried the following but it is not working: var str="http://localhost/mypage.jsp"; document.write(str.replace("^[\w]*\/\/[\w]*$",""));
TITLE: Get relative URL from absolute URL QUESTION: I want to get the relative URL from an absolute URL in JavaScript using regex and the replace method. I tried the following but it is not working: var str="http://localhost/mypage.jsp"; document.write(str.replace("^[\w]*\/\/[\w]*$","")); ANSWER: If by "relative URL"...
[ "javascript", "regex", "url" ]
40
30
67,317
8
0
2011-06-07T09:47:19.720000
2011-06-07T09:53:47.957000
6,263,455
6,263,550
Javascript match with wildcard
Hi and thanks for looking. I need to get all form inputs from a form using javascript, the inputs are named like so:...... and I have the following to pick them up and adding the values togther, but it is not working, what am I doing wrong: function site_change() { var sites= document.getElementById('sitesinput').value...
Your regex is a little off (using [] blocks characters, but you actually want to find square brackets so they need to be escaped. And $ needs to be at the end). Try:.match(/^site\[\d+\]$/)
Javascript match with wildcard Hi and thanks for looking. I need to get all form inputs from a form using javascript, the inputs are named like so:...... and I have the following to pick them up and adding the values togther, but it is not working, what am I doing wrong: function site_change() { var sites= document.get...
TITLE: Javascript match with wildcard QUESTION: Hi and thanks for looking. I need to get all form inputs from a form using javascript, the inputs are named like so:...... and I have the following to pick them up and adding the values togther, but it is not working, what am I doing wrong: function site_change() { var s...
[ "javascript", "forms", "match", "textinput" ]
0
1
1,063
1
0
2011-06-07T09:47:27.163000
2011-06-07T09:55:18.577000
6,263,458
6,264,510
"Distribute weights evenly" in code
I have one little problem...Here is my code..Is there a way to "distribute weights evenly" for those buttons what I made.. I tried to button[i].setWidth().. but when I turn around my phone it looks ugly.. so Is there away to distribute buttons width auto? ViewGroup row1 = (ViewGroup)findViewById(R.id.TableRow02); ViewG...
Tactically, put the buttons in a LinearLayout and set android:layout_weight="1" for each of them. Strategically, design a decent UI, one that does not involve a row of 36 buttons.
"Distribute weights evenly" in code I have one little problem...Here is my code..Is there a way to "distribute weights evenly" for those buttons what I made.. I tried to button[i].setWidth().. but when I turn around my phone it looks ugly.. so Is there away to distribute buttons width auto? ViewGroup row1 = (ViewGroup)...
TITLE: "Distribute weights evenly" in code QUESTION: I have one little problem...Here is my code..Is there a way to "distribute weights evenly" for those buttons what I made.. I tried to button[i].setWidth().. but when I turn around my phone it looks ugly.. so Is there away to distribute buttons width auto? ViewGroup ...
[ "java", "android", "button" ]
0
4
816
2
0
2011-06-07T09:47:38.083000
2011-06-07T11:28:42.577000
6,263,485
6,263,998
save excel sheet to a particular folder that i have created in my local machine and make this excel sheet as read only
in my application im exporting gridview data to excel sheet now i want save this sheet to a folder that i have created in my machine how can i do that i have written code like this using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.W...
First of all use StreamWriter to write the stream FileStream fileStream = new FileStream(@"Location+Filename.xls", FileMode.Create); and further if you want to save it in My Documents Folder You have to use Environment.SpecialFolder.MyDocuments For more Info regarding this click Hope will help.....:-)
save excel sheet to a particular folder that i have created in my local machine and make this excel sheet as read only in my application im exporting gridview data to excel sheet now i want save this sheet to a folder that i have created in my machine how can i do that i have written code like this using System; using ...
TITLE: save excel sheet to a particular folder that i have created in my local machine and make this excel sheet as read only QUESTION: in my application im exporting gridview data to excel sheet now i want save this sheet to a folder that i have created in my machine how can i do that i have written code like this us...
[ "c#", "asp.net" ]
4
1
8,003
4
0
2011-06-07T09:50:01.213000
2011-06-07T10:36:09.990000
6,263,492
6,263,677
Will jQuery work on a CD distribuited "website"?
Sadly I have to make a website (so to speak website) that can be placed on a CD. My question is, can I use JavaScript and jQuery? Some of the people who get the CD might have IE6 on Win XP installed. Thank you.
You can put a website on to CD, and javascript/jquery should work fine. But beware that you'll only be able to have static resources: that is every request must be for a physical asset that exists on the CD. I.e you wont be able to have pages rendered dynamically in response to a request, and I'm pretty sure that you w...
Will jQuery work on a CD distribuited "website"? Sadly I have to make a website (so to speak website) that can be placed on a CD. My question is, can I use JavaScript and jQuery? Some of the people who get the CD might have IE6 on Win XP installed. Thank you.
TITLE: Will jQuery work on a CD distribuited "website"? QUESTION: Sadly I have to make a website (so to speak website) that can be placed on a CD. My question is, can I use JavaScript and jQuery? Some of the people who get the CD might have IE6 on Win XP installed. Thank you. ANSWER: You can put a website on to CD, a...
[ "javascript", "jquery", "cd" ]
5
2
388
3
0
2011-06-07T09:50:54.697000
2011-06-07T10:06:54.180000
6,263,500
6,265,232
How to decode nvarchar to text (SQL Server 2008 R2)?
I have a SQL Server 2008 R2 table with nvarchar(4000) field. Data that stores this table look like '696D616765206D61726B65643A5472' or '303131' ("011"). I see that each char is encoding to hex. How can I read those data from table? I don't want write decoding function, I mean that simpler way exists. P.S. Sorry for my ...
SQL Server 2008 actually has a built-in hex-encoding and decoding feature! Sample (note the third parameter with value "1" when converting your string to VarBinary): DECLARE @ProblemString VarChar(4000) = '54657374' SELECT Convert(VarChar, Convert(VarBinary, '0x' + @ProblemString, 1)) Ref: http://blogs.msdn.com/b/sqlti...
How to decode nvarchar to text (SQL Server 2008 R2)? I have a SQL Server 2008 R2 table with nvarchar(4000) field. Data that stores this table look like '696D616765206D61726B65643A5472' or '303131' ("011"). I see that each char is encoding to hex. How can I read those data from table? I don't want write decoding functio...
TITLE: How to decode nvarchar to text (SQL Server 2008 R2)? QUESTION: I have a SQL Server 2008 R2 table with nvarchar(4000) field. Data that stores this table look like '696D616765206D61726B65643A5472' or '303131' ("011"). I see that each char is encoding to hex. How can I read those data from table? I don't want writ...
[ "sql-server", "sql-server-2008", "encoding", "decoding", "nvarchar" ]
7
4
4,282
2
0
2011-06-07T09:51:25.540000
2011-06-07T12:36:56.153000
6,263,501
6,263,551
Ajax get Date in dd/mm/yyyy format
var d = new Date(); var today_date = d.getDate() + '/' + month_name[d.getMonth()] + '/' + d.getFullYear(); This is how I am getting a date. It works with a slight problem. For todays date 7th of June 2011 it returns 7/11/2011, what i want it to return is 07/11/2011? Anyone know how?
Like so: ("0"+1).slice(-2); // returns 01 ("0"+10).slice(-2); // returns 10 Complete example: var d = new Date(2011,1,1); // 1-Feb-2011 var today_date = ("0" + d.getDate()).slice(-2) + "/" + ("0" + (d.getMonth() + 1)).slice(-2) + "/" + d.getFullYear(); // 01/02/2011
Ajax get Date in dd/mm/yyyy format var d = new Date(); var today_date = d.getDate() + '/' + month_name[d.getMonth()] + '/' + d.getFullYear(); This is how I am getting a date. It works with a slight problem. For todays date 7th of June 2011 it returns 7/11/2011, what i want it to return is 07/11/2011? Anyone know how?
TITLE: Ajax get Date in dd/mm/yyyy format QUESTION: var d = new Date(); var today_date = d.getDate() + '/' + month_name[d.getMonth()] + '/' + d.getFullYear(); This is how I am getting a date. It works with a slight problem. For todays date 7th of June 2011 it returns 7/11/2011, what i want it to return is 07/11/2011? ...
[ "javascript", "jquery", "asp.net", "ajax", "date" ]
3
1
26,809
4
0
2011-06-07T09:51:26.127000
2011-06-07T09:55:27.697000
6,263,520
6,263,554
Operator associavity problem with pre and post increment :(
Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i, i = i++, etc…) #include< stdio.h > int main() { int i = 1; int x = ++i * ++i * ++i; printf("%d\n", x); printf("%d\n\n",i); return 0; } Im getting output of 1!! and 4 in gcc. I use ubuntu linux
The behaviour of your code is undefined since i is modified more than once between sequence points: int x = ++i * ++i * ++i; See the FAQ (I urge you to read the entire section 3 ).
Operator associavity problem with pre and post increment :( Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i, i = i++, etc…) #include< stdio.h > int main() { int i = 1; int x = ++i * ++i * ++i; printf("%d\n", x); printf("%d\n\n",i); return 0; } Im getting output of 1!! and 4 in gcc. I...
TITLE: Operator associavity problem with pre and post increment :( QUESTION: Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i, i = i++, etc…) #include< stdio.h > int main() { int i = 1; int x = ++i * ++i * ++i; printf("%d\n", x); printf("%d\n\n",i); return 0; } Im getting output of 1...
[ "c", "gcc", "operator-keyword", "associativity" ]
1
2
963
2
0
2011-06-07T09:53:25.383000
2011-06-07T09:55:52.967000
6,263,530
6,263,561
problem regarding maximum pool size in asp.net
I have been working on a small file manager module in a project where a list of folders are shown in a treeview. I have done the whole thing in javascript. Everytime I click a node, a list of data is fetched into a datareader and populated in the front end. But when I deploy the application in IIS, after about 18 subse...
I think what's happening is that you don't free up unused resources. More specifically, you absolutely must call Dispose() on all database-related objects, like SqlConnection, SqlDataReader, etc. Or, better yet, wrap them in using statements.
problem regarding maximum pool size in asp.net I have been working on a small file manager module in a project where a list of folders are shown in a treeview. I have done the whole thing in javascript. Everytime I click a node, a list of data is fetched into a datareader and populated in the front end. But when I depl...
TITLE: problem regarding maximum pool size in asp.net QUESTION: I have been working on a small file manager module in a project where a list of folders are shown in a treeview. I have done the whole thing in javascript. Everytime I click a node, a list of data is fetched into a datareader and populated in the front en...
[ "c#", "asp.net", "connection-pooling" ]
1
6
9,873
2
0
2011-06-07T09:53:52.677000
2011-06-07T09:56:36.617000
6,263,533
6,263,634
2 uitableview in the same uiview issue
I have 2 uitableview settings and searchResult as following IBOutlet UITableView* Settings; IBOutlet UITableView* SearchResult; @property ( nonatomic, retain ) IBOutlet UITableView* Settings; @property ( nonatomic, retain ) IBOutlet UITableView* SearchResult; to diffrentiate between them in the tableview delegate and ...
Shouldn't the number of sections in the second table be 1 instead of 0? The second table will not be visible if the number of sections is 0.. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if(tableView == Settings ) { return 2; } return 1; // Called for second table }
2 uitableview in the same uiview issue I have 2 uitableview settings and searchResult as following IBOutlet UITableView* Settings; IBOutlet UITableView* SearchResult; @property ( nonatomic, retain ) IBOutlet UITableView* Settings; @property ( nonatomic, retain ) IBOutlet UITableView* SearchResult; to diffrentiate betw...
TITLE: 2 uitableview in the same uiview issue QUESTION: I have 2 uitableview settings and searchResult as following IBOutlet UITableView* Settings; IBOutlet UITableView* SearchResult; @property ( nonatomic, retain ) IBOutlet UITableView* Settings; @property ( nonatomic, retain ) IBOutlet UITableView* SearchResult; to...
[ "iphone", "ipad" ]
0
1
376
3
0
2011-06-07T09:54:17.100000
2011-06-07T10:02:36.657000
6,263,535
6,264,123
Load iframe and target content
I have a script that write a iframe into the page. I want to target a link inside this iframe to have a function. The problem is: after the iframe has been written I use this code: $('#iframe_pin').load(function () { $(this).contents().find('a.close').click(function (event) { event.preventDefault(); $('.loaded').fadeOu...
from comments you have something like: so, all you need to do is: $("#iframe_pin").load(function() { // let's get the iframe source var iframe = $("#iframe_pin").contents(); iframe.find("a.close").bind("click", function() { $(".loaded").fadeOut('slow', function() { // now that the FadeOut is finished, let's remove $(...
Load iframe and target content I have a script that write a iframe into the page. I want to target a link inside this iframe to have a function. The problem is: after the iframe has been written I use this code: $('#iframe_pin').load(function () { $(this).contents().find('a.close').click(function (event) { event.preven...
TITLE: Load iframe and target content QUESTION: I have a script that write a iframe into the page. I want to target a link inside this iframe to have a function. The problem is: after the iframe has been written I use this code: $('#iframe_pin').load(function () { $(this).contents().find('a.close').click(function (eve...
[ "javascript", "jquery", "iframe", "jquery-events", "dom-manipulation" ]
2
2
2,986
1
0
2011-06-07T09:54:21.787000
2011-06-07T10:50:11.010000
6,263,539
6,265,558
How to set a Collection's url
let's say I have: var Book = Backbone.Model.extend(); var Collection = Backbone.Collection.extend({ model: Book, url: '/books', initialize: function(){ this.fetch(); }) }) How can I change the Collection 's url when instantiating a new collection? var AdventureBooks = new Books({ url: '/books/adventure' }) does not wo...
var Book = Backbone.Model.extend({ "url": function() { return '/books/' + this.get("category"); } });
How to set a Collection's url let's say I have: var Book = Backbone.Model.extend(); var Collection = Backbone.Collection.extend({ model: Book, url: '/books', initialize: function(){ this.fetch(); }) }) How can I change the Collection 's url when instantiating a new collection? var AdventureBooks = new Books({ url: '/b...
TITLE: How to set a Collection's url QUESTION: let's say I have: var Book = Backbone.Model.extend(); var Collection = Backbone.Collection.extend({ model: Book, url: '/books', initialize: function(){ this.fetch(); }) }) How can I change the Collection 's url when instantiating a new collection? var AdventureBooks = ne...
[ "backbone.js" ]
35
28
41,062
8
0
2011-06-07T09:54:33.540000
2011-06-07T13:02:26.430000
6,263,544
6,263,765
How can i add placeholder images to my embedded Vimeo and Youtube videos?
I have successfully implemented embedded vimeo videos into my app, however i would like to create placeholder images as an overlay on the videos whilst they are not playing. Does anyone have an idea of how to do this? #import "FifthDetailViewController.h" @interface FifthDetailViewController (Private) - (void)embedVi...
The approach we took with youtube videos is as follow (I guess you can do something similar with vimeo). What you need to do is set an imageview on top the webview, which should display the thumbnail img of your vimeo video (this is what I understand from your question). You can retrieve thumbnail images with Vimeo API...
How can i add placeholder images to my embedded Vimeo and Youtube videos? I have successfully implemented embedded vimeo videos into my app, however i would like to create placeholder images as an overlay on the videos whilst they are not playing. Does anyone have an idea of how to do this? #import "FifthDetailViewCont...
TITLE: How can i add placeholder images to my embedded Vimeo and Youtube videos? QUESTION: I have successfully implemented embedded vimeo videos into my app, however i would like to create placeholder images as an overlay on the videos whilst they are not playing. Does anyone have an idea of how to do this? #import "F...
[ "iphone", "ios", "ipad", "uiwebview" ]
0
0
2,292
1
0
2011-06-07T09:54:53.940000
2011-06-07T10:15:35.600000
6,263,549
6,264,048
Android Tabs - Navigation between tabs causing memory leak
I finished an application recently and began profiling it for CPU & Memory usage and came across a memory leak: In a simple 3 tab application where each tab has a distinct function, I have a button on Tab3 which sends the user back to Tab1 along with a messageId. The activity associated with Tab1 catches this extra and...
Use this public void onClick(View arg0) { Intent notificationIntent = new Intent(NotifyService.getInstance(), TabContainerActivity.class); notificationIntent.setAction("com.test.notify.MESSAGE"); notificationIntent.putExtra(MessageBean.MESSAGE_ID, messageId); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);...
Android Tabs - Navigation between tabs causing memory leak I finished an application recently and began profiling it for CPU & Memory usage and came across a memory leak: In a simple 3 tab application where each tab has a distinct function, I have a button on Tab3 which sends the user back to Tab1 along with a messageI...
TITLE: Android Tabs - Navigation between tabs causing memory leak QUESTION: I finished an application recently and began profiling it for CPU & Memory usage and came across a memory leak: In a simple 3 tab application where each tab has a distinct function, I have a button on Tab3 which sends the user back to Tab1 alo...
[ "android", "memory-leaks", "android-sdk-2.3" ]
2
1
1,042
1
0
2011-06-07T09:55:17.697000
2011-06-07T10:42:48.260000
6,263,562
6,264,467
How to get the Character by Point or by index from TRichedit
I have function that returns the index of a character GetCharFromPos(Pt: TPoint): Integer; now i wanted to get character of that position. like GetCharByIndex(Index: Integer): Char;
The efficient way to do this using pure VCL is to use SelStart, SelLength and SelText. function GetCharByIndex(Index: Integer): Char; begin RichEdit.SelStart:= Index; RichEdit.SelLength:= 1; Result:= RichEdit.SelText[1]; end; You'll likely want to save away the selection before modifying it, and then restore it once yo...
How to get the Character by Point or by index from TRichedit I have function that returns the index of a character GetCharFromPos(Pt: TPoint): Integer; now i wanted to get character of that position. like GetCharByIndex(Index: Integer): Char;
TITLE: How to get the Character by Point or by index from TRichedit QUESTION: I have function that returns the index of a character GetCharFromPos(Pt: TPoint): Integer; now i wanted to get character of that position. like GetCharByIndex(Index: Integer): Char; ANSWER: The efficient way to do this using pure VCL is to ...
[ "delphi", "char", "position", "message", "richedit" ]
1
6
1,649
2
0
2011-06-07T09:56:39.067000
2011-06-07T11:24:06.220000
6,263,563
6,264,275
Debugging .Net String value in windbg
I have a.Net application dump which captured an exception, I'm analysing using windbg and interested in the value of a String parameter on one of the methods. I've isolated the String object. My windbg working is: 0:000>.loadby sos mscorwks 0:000>!dso OS Thread Id: 0x16f0 (0) RSP/REG Object Name 00000000001fe908 000000...
Here's what System.IO.Path.CheckInvalidPathChars is doing (at least in.NET 2.0): for (int i = 0; i < path.Length; i++) { int num2 = path[i]; if (((num2 == 0x22) || (num2 == 60)) || (((num2 == 0x3e) || (num2 == 0x7c)) || (num2 < 0x20))) { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathCha...
Debugging .Net String value in windbg I have a.Net application dump which captured an exception, I'm analysing using windbg and interested in the value of a String parameter on one of the methods. I've isolated the String object. My windbg working is: 0:000>.loadby sos mscorwks 0:000>!dso OS Thread Id: 0x16f0 (0) RSP/R...
TITLE: Debugging .Net String value in windbg QUESTION: I have a.Net application dump which captured an exception, I'm analysing using windbg and interested in the value of a String parameter on one of the methods. I've isolated the String object. My windbg working is: 0:000>.loadby sos mscorwks 0:000>!dso OS Thread Id...
[ ".net", "debugging", "windbg", "postmortem-debugging" ]
8
1
4,059
2
0
2011-06-07T09:56:43.440000
2011-06-07T11:06:27.773000
6,263,567
6,264,715
filetype doesnt works in php
How to get file type in php? I had tried following codes $attachment_path = "/views/default/helpcentre/check_attachment/wildryan.jpg"; $file_type = filetype($attachment_path); $mime_type = mime_content_type($attachment_path); echo "Type of the file: ".$file_type; echo "Mime Type of the file: ".$mime_type; File type is ...
Alternative: Will return image/jpeg echo mimeType(basename("/views/default/helpcentre/check_attachment/wildryan.jpg")); /** * Mime Type * * @param string * @return string */ function mimeType($file) { $mimeTypes = array( "323" => "text/h323", "acx" => "application/internet-property-stream", "ai" => "application/postsc...
filetype doesnt works in php How to get file type in php? I had tried following codes $attachment_path = "/views/default/helpcentre/check_attachment/wildryan.jpg"; $file_type = filetype($attachment_path); $mime_type = mime_content_type($attachment_path); echo "Type of the file: ".$file_type; echo "Mime Type of the file...
TITLE: filetype doesnt works in php QUESTION: How to get file type in php? I had tried following codes $attachment_path = "/views/default/helpcentre/check_attachment/wildryan.jpg"; $file_type = filetype($attachment_path); $mime_type = mime_content_type($attachment_path); echo "Type of the file: ".$file_type; echo "Mim...
[ "php", "file-type" ]
3
1
381
4
0
2011-06-07T09:57:02.610000
2011-06-07T11:47:57.873000
6,263,590
6,263,609
Echoing <a> tag with PHP variables involved
I'm looking to echo an hyperlink in a PHP file. The target and text are variables. And no, I can't just make a html file and then echo out the variables. It has to be done with echoing out the statement. I'm having problems with the " " around the target. The first " is okay, but the second is causing problems. Here is...
The backslash needs to be shifted one position to the right. You can see where it goes wrong by the coloring. Change this line: echo " ".$row[adder]." "; To: echo " ".$row[adder]." ";
Echoing <a> tag with PHP variables involved I'm looking to echo an hyperlink in a PHP file. The target and text are variables. And no, I can't just make a html file and then echo out the variables. It has to be done with echoing out the statement. I'm having problems with the " " around the target. The first " is okay,...
TITLE: Echoing <a> tag with PHP variables involved QUESTION: I'm looking to echo an hyperlink in a PHP file. The target and text are variables. And no, I can't just make a html file and then echo out the variables. It has to be done with echoing out the statement. I'm having problems with the " " around the target. Th...
[ "php", "html", "hyperlink" ]
0
3
145
3
0
2011-06-07T09:59:42.657000
2011-06-07T10:01:04.833000
6,263,597
6,263,883
Can a long-running method and a "Working..." dialog be run together using the Task Parallel Library to allow long task to write to a BindingList?
I have a WPF (C# and.NET 4) application that has a long running task in it that blocked the UI giving the impression that it has hung. I decided to put this long-running task onto a separate thread by using a BackgroundWorker thread and showed a BusyIndicator in a separate popup window (named WorkingDialog below). This...
You need to use a dispatcher to add a new element to your logginglist. public void SomeLongRunningTask() { System.Threading.Thread.Sleep(5000); Application.Current.Dispatcher.BeginInvoke((Action)(() => LoggingList.Add(new CustomMessage("Completed long task!")))); } Edit: public class MyRandomBusinessClass { public Bin...
Can a long-running method and a "Working..." dialog be run together using the Task Parallel Library to allow long task to write to a BindingList? I have a WPF (C# and.NET 4) application that has a long running task in it that blocked the UI giving the impression that it has hung. I decided to put this long-running task...
TITLE: Can a long-running method and a "Working..." dialog be run together using the Task Parallel Library to allow long task to write to a BindingList? QUESTION: I have a WPF (C# and.NET 4) application that has a long running task in it that blocked the UI giving the impression that it has hung. I decided to put this...
[ "c#", "wpf", "multithreading", "c#-4.0", "task-parallel-library" ]
2
1
952
1
0
2011-06-07T10:00:11.260000
2011-06-07T10:26:03.707000
6,263,605
6,263,804
iphone: need to implement navigationController inside viewcontroller which appears after selecting a tab in tabbar
I am pretty new to UITabBarController. I was trying to provide a navigation system in a viewController corresponding to a tab in tabViewController created an instance of navigation controller in viewDidLOad [testLabel setText:@"Test"]; self.navigator=[[UINavigationController alloc] initWithRootViewController:self]; [su...
Just add this in AppDelegate.h UINavigationController *navigationController; Just add this in AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; se...
iphone: need to implement navigationController inside viewcontroller which appears after selecting a tab in tabbar I am pretty new to UITabBarController. I was trying to provide a navigation system in a viewController corresponding to a tab in tabViewController created an instance of navigation controller in viewDidLOa...
TITLE: iphone: need to implement navigationController inside viewcontroller which appears after selecting a tab in tabbar QUESTION: I am pretty new to UITabBarController. I was trying to provide a navigation system in a viewController corresponding to a tab in tabViewController created an instance of navigation contro...
[ "iphone", "uinavigationcontroller", "uitabbarcontroller" ]
0
1
190
1
0
2011-06-07T10:00:51.670000
2011-06-07T10:19:45.600000
6,263,615
6,263,637
date code in php displaying 01/01/1970
this portion of code is outputing 01/01/1970. is my code incorrect? i have only posted the relevant part because it is part of a json page. the table field is date format. thanks date('d/m/Y',$row['destroy_date'])
If $row['destroy_date'] is not a UNIX timestamp, parse it with strtotime first: date('d/m/Y', strtotime($row['destroy_date'])) Read in the manual for date and you'll see that the second argument cannot be a date in any format.
date code in php displaying 01/01/1970 this portion of code is outputing 01/01/1970. is my code incorrect? i have only posted the relevant part because it is part of a json page. the table field is date format. thanks date('d/m/Y',$row['destroy_date'])
TITLE: date code in php displaying 01/01/1970 QUESTION: this portion of code is outputing 01/01/1970. is my code incorrect? i have only posted the relevant part because it is part of a json page. the table field is date format. thanks date('d/m/Y',$row['destroy_date']) ANSWER: If $row['destroy_date'] is not a UNIX ti...
[ "php", "mysql", "date", "timestamp" ]
1
11
11,229
3
0
2011-06-07T10:01:21.517000
2011-06-07T10:02:55.727000
6,263,616
6,263,801
Counting minutes of calling in app (iOS)
I need some methods for counting banda usage, minutes of calling, number of sms sent, and more (for iOS). Is there a way to access any of this information? Thanks!
I dont think there is any possibility for you to do this. This amounts to spying on the user of your application on his privacy, which surely would be reject by Apple. And they have also not opened any APIs for this.
Counting minutes of calling in app (iOS) I need some methods for counting banda usage, minutes of calling, number of sms sent, and more (for iOS). Is there a way to access any of this information? Thanks!
TITLE: Counting minutes of calling in app (iOS) QUESTION: I need some methods for counting banda usage, minutes of calling, number of sms sent, and more (for iOS). Is there a way to access any of this information? Thanks! ANSWER: I dont think there is any possibility for you to do this. This amounts to spying on the ...
[ "iphone", "ios", "phone-call" ]
0
1
811
2
0
2011-06-07T10:01:21.573000
2011-06-07T10:18:54.847000
6,263,628
6,263,675
Why do I get a NullPointerException when I pass an url to the webview?
I get a NullPointerException when a url passed in webview in an activity (the url is passed from previous activity), but it shows NullPointerException when control goes on webview.loadurl(url). I checked that there is a value in a passed url but I still don't know why it gives an error? This is Error: 06-07 15:13:43.68...
ComponentInfo{com.shopzilla.android.common/com.shopzilla.android.product.ProductStoreActivity}:,tells that ProductStoreActivity is not detected, check in AndroidManifest file, whether you have specified the activity.
Why do I get a NullPointerException when I pass an url to the webview? I get a NullPointerException when a url passed in webview in an activity (the url is passed from previous activity), but it shows NullPointerException when control goes on webview.loadurl(url). I checked that there is a value in a passed url but I s...
TITLE: Why do I get a NullPointerException when I pass an url to the webview? QUESTION: I get a NullPointerException when a url passed in webview in an activity (the url is passed from previous activity), but it shows NullPointerException when control goes on webview.loadurl(url). I checked that there is a value in a ...
[ "android" ]
1
0
453
1
0
2011-06-07T10:02:04.473000
2011-06-07T10:06:46.293000
6,263,630
6,265,282
JSchException: Algorithm negotiation fail
I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: com.jcraft.jsch.JSchException: Algorithm negotiation fail at com.jcraft.jsch.Session.receive_kexinit(Session.java:529) at com.jcraft.jsch.Session.connect(Session.java:291) at com.jcraft....
There are a couple of places that SSH clients and servers try and agree on a common implementation. Two I know of are encryption and compression. The server and client produce a list of available options and then the best available option in both lists is chosen. If there is no acceptable option in the lists then it fa...
JSchException: Algorithm negotiation fail I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: com.jcraft.jsch.JSchException: Algorithm negotiation fail at com.jcraft.jsch.Session.receive_kexinit(Session.java:529) at com.jcraft.jsch.Sessio...
TITLE: JSchException: Algorithm negotiation fail QUESTION: I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: com.jcraft.jsch.JSchException: Algorithm negotiation fail at com.jcraft.jsch.Session.receive_kexinit(Session.java:529) at com....
[ "java", "encryption", "ssh", "sftp", "jsch" ]
49
33
189,605
13
0
2011-06-07T10:02:06.347000
2011-06-07T12:41:02.720000
6,263,632
6,263,665
jquery remove text partially
Can i use jQuery to remove part of a text within a div. Like so: Published May 18th 2011 - Approuved - Expire May 18 th 2012 Source: SuperSite I would like to remove Approuved - Expire May 18 th 2012 So the result would be: Published May 18th 2011 Source: SuperSite
You can use jquery to select your element/html, but javascript has a builtin function replace that will do what you need: $('div.entry').html($('div.entry').html().replace('Approuved - Expire May 18 th 2012', '')) Or using RegExp: If what you want to replace starts always with Approuved - Expire: $('div.entry').html($(...
jquery remove text partially Can i use jQuery to remove part of a text within a div. Like so: Published May 18th 2011 - Approuved - Expire May 18 th 2012 Source: SuperSite I would like to remove Approuved - Expire May 18 th 2012 So the result would be: Published May 18th 2011 Source: SuperSite
TITLE: jquery remove text partially QUESTION: Can i use jQuery to remove part of a text within a div. Like so: Published May 18th 2011 - Approuved - Expire May 18 th 2012 Source: SuperSite I would like to remove Approuved - Expire May 18 th 2012 So the result would be: Published May 18th 2011 Source: SuperSite ANSWER...
[ "jquery" ]
3
8
10,786
3
0
2011-06-07T10:02:12.467000
2011-06-07T10:05:31.133000
6,263,633
6,263,938
HTML5/Js client-side DB
We're starting development of a client application. No servers, just HTML5/JS. How to organize a local, non-relational, read-only, one-table DB? Message | Img | Code ---------------------------------- File not found | error.png | 15 Access denied | error.png | 42 We want to query row(s) by a field, say, 'Code = 15'. Al...
If you need cross browser support then I would recommend localStorage. There is a nice abstraction. store.js that allows you to store keyvalue pairs in the local storage. Alternatively if you want proper SQL you can use Web SQL but wikipedia claims it's only supported by Opera/Safari/Chrome. Example of store: var Row =...
HTML5/Js client-side DB We're starting development of a client application. No servers, just HTML5/JS. How to organize a local, non-relational, read-only, one-table DB? Message | Img | Code ---------------------------------- File not found | error.png | 15 Access denied | error.png | 42 We want to query row(s) by a fie...
TITLE: HTML5/Js client-side DB QUESTION: We're starting development of a client application. No servers, just HTML5/JS. How to organize a local, non-relational, read-only, one-table DB? Message | Img | Code ---------------------------------- File not found | error.png | 15 Access denied | error.png | 42 We want to que...
[ "javascript", "database", "html" ]
1
1
372
1
0
2011-06-07T10:02:21.263000
2011-06-07T10:31:21.343000
6,263,639
6,263,721
Android Dialog: Removing title bar
I have a weird behavior I can't pinpoint the source of. I have my app with the classic requestWindowFeature(Window.FEATURE_NO_TITLE); to remove the title/status bar. I then create a Dialog box to allow the user to enter information (name etc) With a physical keyboard, no problem but when I use the virtual keyboard I ha...
use, dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //before dialog.setContentView(R.layout.logindialog);
Android Dialog: Removing title bar I have a weird behavior I can't pinpoint the source of. I have my app with the classic requestWindowFeature(Window.FEATURE_NO_TITLE); to remove the title/status bar. I then create a Dialog box to allow the user to enter information (name etc) With a physical keyboard, no problem but w...
TITLE: Android Dialog: Removing title bar QUESTION: I have a weird behavior I can't pinpoint the source of. I have my app with the classic requestWindowFeature(Window.FEATURE_NO_TITLE); to remove the title/status bar. I then create a Dialog box to allow the user to enter information (name etc) With a physical keyboard...
[ "android", "layout", "dialog" ]
115
441
133,790
13
0
2011-06-07T10:03:05.147000
2011-06-07T10:11:04.397000
6,263,641
6,263,778
getExternalFilesDir alternative in android 2.1
I built an android app on android 2.2, for saving files into the SD card I use the following: context.getExternalFilesDir(null).getAbsolutePath(); returning a string like: /mnt/sdcard/Android/data/com.hello.example1/files Now I need to make my app compatible with android 2.1, what method do I need to use to get the ext...
You should compose the path yourself: String packageName = context.getPackageName(); File externalPath = Environment.getExternalStorageDirectory(); File appFiles = new File(externalPath.getAbsolutePath() + "/Android/data/" + packageName + "/files");
getExternalFilesDir alternative in android 2.1 I built an android app on android 2.2, for saving files into the SD card I use the following: context.getExternalFilesDir(null).getAbsolutePath(); returning a string like: /mnt/sdcard/Android/data/com.hello.example1/files Now I need to make my app compatible with android 2...
TITLE: getExternalFilesDir alternative in android 2.1 QUESTION: I built an android app on android 2.2, for saving files into the SD card I use the following: context.getExternalFilesDir(null).getAbsolutePath(); returning a string like: /mnt/sdcard/Android/data/com.hello.example1/files Now I need to make my app compati...
[ "java", "android", "android-2.1-eclair" ]
12
20
6,633
1
0
2011-06-07T10:03:12.860000
2011-06-07T10:16:34.770000
6,263,644
6,263,702
Android app crashes because of Shared preferrence
in the first activity of my app, at start i am checking whether the SharedPreferrence contains some value or not. If it is to be null, it open the first activity, if not i want to open the second activity of my app. Following is part of my code. SharedPreferences prefs = this.getSharedPreferences( "idValue", MODE_WORLD...
You are accessing the current instance this of your class before initiating,Thats why you are getting nullpointer exception. SharedPreferences prefs = null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); prefs = this.getSharedPreferences( "idValue",...
Android app crashes because of Shared preferrence in the first activity of my app, at start i am checking whether the SharedPreferrence contains some value or not. If it is to be null, it open the first activity, if not i want to open the second activity of my app. Following is part of my code. SharedPreferences prefs ...
TITLE: Android app crashes because of Shared preferrence QUESTION: in the first activity of my app, at start i am checking whether the SharedPreferrence contains some value or not. If it is to be null, it open the first activity, if not i want to open the second activity of my app. Following is part of my code. Shared...
[ "android", "android-activity", "sharedpreferences", "switching" ]
2
6
2,439
2
0
2011-06-07T10:03:20.510000
2011-06-07T10:09:31.773000
6,263,653
6,263,994
how to make spry accordion look like a tree
Here is my accordion how can i apply some stylesheet to this, so that looks like a tree. eg: + when accordion tab is closed and - when accordion is open System Patches Network User Environment Environment Variables {mainData::@product} ODBC Bitmode
If you look in the SpryAccordion.css stylesheet you will find.AccordionPanelTab {}.AccordionPanelOpen.AccordionPanelTab {} You can set whatever background image you like on those two to get the effect you are after.AccordionPanelTab will affect the normal state and.AccordionPanelOpen.AccordionPanelTab will affect the o...
how to make spry accordion look like a tree Here is my accordion how can i apply some stylesheet to this, so that looks like a tree. eg: + when accordion tab is closed and - when accordion is open System Patches Network User Environment Environment Variables {mainData::@product} ODBC Bitmode
TITLE: how to make spry accordion look like a tree QUESTION: Here is my accordion how can i apply some stylesheet to this, so that looks like a tree. eg: + when accordion tab is closed and - when accordion is open System Patches Network User Environment Environment Variables {mainData::@product} ODBC Bitmode ANSWER: ...
[ "javascript", "jquery", "css", "spry" ]
0
1
569
2
0
2011-06-07T10:04:18.483000
2011-06-07T10:35:43.670000
6,263,656
6,263,692
TableView scrolls to bottom and perform some action
In my application there is a table view.What I want to do is when I scrolls the table view and when it come to its end row I want to perform some action. Please tell me which approach should I use to do this. Thanks in advance!!
I think you should make a check in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) when it loads the last row then call that method. I think this will work. because table does not load all data at once but i loads data when user scroll
TableView scrolls to bottom and perform some action In my application there is a table view.What I want to do is when I scrolls the table view and when it come to its end row I want to perform some action. Please tell me which approach should I use to do this. Thanks in advance!!
TITLE: TableView scrolls to bottom and perform some action QUESTION: In my application there is a table view.What I want to do is when I scrolls the table view and when it come to its end row I want to perform some action. Please tell me which approach should I use to do this. Thanks in advance!! ANSWER: I think you ...
[ "iphone", "objective-c", "uitableview", "uiscrollview" ]
1
1
266
2
0
2011-06-07T10:04:42.157000
2011-06-07T10:08:30.410000
6,263,660
6,264,300
The object cannot be deleted because it was not found in the ObjectStateManager
I have something like this: public void Delete(T entity) { Context.DeleteObject(entity); Context.SaveChanges(); } I end up wit a exception: "The object cannot be deleted because it was not found in the ObjectStateManager." If I try to add the entity to objectContext with AttachTo() I get: "An object with the same key a...
You have to fetch the entity you wish to delete from your context first. Best to do this with a comparison of the primary key. It could look like this, but i do not know the object structure of TabMaster and TabMasterViewModel, so the properties may be wrong named. public void Delete(TabMasterViewModel entity) { TabMas...
The object cannot be deleted because it was not found in the ObjectStateManager I have something like this: public void Delete(T entity) { Context.DeleteObject(entity); Context.SaveChanges(); } I end up wit a exception: "The object cannot be deleted because it was not found in the ObjectStateManager." If I try to add t...
TITLE: The object cannot be deleted because it was not found in the ObjectStateManager QUESTION: I have something like this: public void Delete(T entity) { Context.DeleteObject(entity); Context.SaveChanges(); } I end up wit a exception: "The object cannot be deleted because it was not found in the ObjectStateManager."...
[ "asp.net-mvc", "entity-framework" ]
2
12
9,045
2
0
2011-06-07T10:05:11.693000
2011-06-07T11:08:27.603000
6,263,663
6,263,691
Investigate an unaligned userspace access with only the Program Counter and the executable
So I have this executable, compiled with the -g options, that triggers loads of unaligned userspace access warnings. Unaligned userspace access in "softtest" pid=1407 pc=0x0041515c ins=0x011e Unaligned userspace access in "softtest" pid=1406 pc=0x0041515c ins=0x011e Unaligned userspace access in "softtest" pid=1406 pc=...
Have a look at the addr2line utility DESCRIPTION addr2line translates addresses into file names and line numbers. Given an address in an executable or an offset in a section of a relocatable object, it uses the debugging information to figure out which file name and line number are associated with it. A Simple c-exampl...
Investigate an unaligned userspace access with only the Program Counter and the executable So I have this executable, compiled with the -g options, that triggers loads of unaligned userspace access warnings. Unaligned userspace access in "softtest" pid=1407 pc=0x0041515c ins=0x011e Unaligned userspace access in "softte...
TITLE: Investigate an unaligned userspace access with only the Program Counter and the executable QUESTION: So I have this executable, compiled with the -g options, that triggers loads of unaligned userspace access warnings. Unaligned userspace access in "softtest" pid=1407 pc=0x0041515c ins=0x011e Unaligned userspace...
[ "c", "linux", "memory", "gdb", "kernel" ]
1
2
1,902
1
0
2011-06-07T10:05:17.537000
2011-06-07T10:08:23.433000
6,263,669
6,263,734
How to order query results by search term first, and then alphabetically?
I'm using NHibernate to do a search on item name. I'm getting a paged list of items back from the database, and I'm ordering it by item name ascending. So, if I search for 'term', I get back a page of results that contains 'term' anywhere in the result, and the page is ordered alphabetically. For example, the results m...
If it's possible to write a function that returns an integer based on the relevancy, you could do SELECT MyField FROM MyTable WHERE MyField like '%term%' ORDER BY GetRelevance(MyField, SearchTerm) DESC Your function wouldn't have to be very complicated. It could just look to see if the Field Starts with the SearchTerm ...
How to order query results by search term first, and then alphabetically? I'm using NHibernate to do a search on item name. I'm getting a paged list of items back from the database, and I'm ordering it by item name ascending. So, if I search for 'term', I get back a page of results that contains 'term' anywhere in the ...
TITLE: How to order query results by search term first, and then alphabetically? QUESTION: I'm using NHibernate to do a search on item name. I'm getting a paged list of items back from the database, and I'm ordering it by item name ascending. So, if I search for 'term', I get back a page of results that contains 'term...
[ "c#", "nhibernate" ]
4
1
277
3
0
2011-06-07T10:05:53.600000
2011-06-07T10:12:01.840000
6,263,673
6,263,931
Add list elements in DOM to array in JS
I have a un-ordered list containing links with the same class and a unique ID, I need to add all those ID's to an array in javascript with. How could I do this?
an easier (more mootools-like) way to do what @Dimitar did: var ids = $$('.item').get('id'); Good Luck
Add list elements in DOM to array in JS I have a un-ordered list containing links with the same class and a unique ID, I need to add all those ID's to an array in javascript with. How could I do this?
TITLE: Add list elements in DOM to array in JS QUESTION: I have a un-ordered list containing links with the same class and a unique ID, I need to add all those ID's to an array in javascript with. How could I do this? ANSWER: an easier (more mootools-like) way to do what @Dimitar did: var ids = $$('.item').get('id');...
[ "javascript", "html", "mootools" ]
1
1
308
2
0
2011-06-07T10:06:03.100000
2011-06-07T10:30:45.517000
6,263,681
6,263,794
Set the XML file for Layout design according IPhone screen widgets
I want this type of layout how i can do this all the titles should be clickable please help me I used Button and TextView but it seems very dull
Inflate a LinearLayout with a TextView and an image (the right arrow). That LinearLayout must have clickable="true" and onClick="methodYouLike" To identify what is being clicked you can add a tag to each, with an id, like android:tag="1", android:tag="2"... On the Activity onClick receives a View, só you can get that v...
Set the XML file for Layout design according IPhone screen widgets I want this type of layout how i can do this all the titles should be clickable please help me I used Button and TextView but it seems very dull
TITLE: Set the XML file for Layout design according IPhone screen widgets QUESTION: I want this type of layout how i can do this all the titles should be clickable please help me I used Button and TextView but it seems very dull ANSWER: Inflate a LinearLayout with a TextView and an image (the right arrow). That Linea...
[ "android" ]
1
1
231
3
0
2011-06-07T10:07:10.857000
2011-06-07T10:18:12.107000
6,263,686
6,263,732
How to call class method from NSString in obj-c?
In obj-c, how can I call [myClass myString]; where myString = @"myMethod"; Which should be the equivalent of [myClass myMethod]; Not sure if this kind of meta language manipulation is possible.
[myClass class] returns the metaclass, class methods are called on the metaclass. E.g. [NSString someClassMethod]; NSString *instanceOfString = @"some string instance"; [[instanceOfString class] someClassMethod]; EDIT: I misread the question. Use NSSelectorFromString to get a SEL from an NSString. That's documented in...
How to call class method from NSString in obj-c? In obj-c, how can I call [myClass myString]; where myString = @"myMethod"; Which should be the equivalent of [myClass myMethod]; Not sure if this kind of meta language manipulation is possible.
TITLE: How to call class method from NSString in obj-c? QUESTION: In obj-c, how can I call [myClass myString]; where myString = @"myMethod"; Which should be the equivalent of [myClass myMethod]; Not sure if this kind of meta language manipulation is possible. ANSWER: [myClass class] returns the metaclass, class metho...
[ "iphone", "objective-c", "ios", "nsstring", "meta" ]
6
1
4,353
5
0
2011-06-07T10:07:44.660000
2011-06-07T10:11:31.870000