PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
11,297,912
07/02/2012 16:50:49
1,120,354
12/29/2011 02:53:42
463
0
In a MySQL db, how to add a new column and make it a primary key?
In a MySQL db, how to add a new column and make it a primary key? The db already has four columns, one of which is a primary key.
mysql
sql
primary-key
null
null
null
open
In a MySQL db, how to add a new column and make it a primary key? === In a MySQL db, how to add a new column and make it a primary key? The db already has four columns, one of which is a primary key.
0
11,297,916
07/02/2012 16:51:16
1,331,966
04/13/2012 15:32:46
10
1
Checkbox is selected and not assigning a new value
No matter what is selected it is still assigning a value of 1 to all the checkboxes and not changing the selected checkbox to a value of 0. Here is the code that is correct from a syntax standpoint but defaults to 1 no matter what I do not see why its not changing the selected box value to '0' //Correct answer variables $chkBox1 = '1'; $chkBox2 = '1'; $chkBox3 = '1'; $chkBox4 = '1'; $chkBox5 = '1'; if (isset($_POST['chkBox1'])) { if ($chkBox1 == 'chkBox1Selected') { $chkBox1 = '0'; } }//End of chkBox1Selected logic if (isset($_POST['chkBox2'])) { if ($chkBox2 == 'chkBox2Selected') { $chkBox2 = '0'; } }//End of chkBox2Selected logic if (isset($_POST['chkBox3'])) { if ($chkBox3 == 'chkBox3Selected') { $chkBox3 = '0'; } }//End of chkBox3Selected logic
php
null
null
null
null
null
open
Checkbox is selected and not assigning a new value === No matter what is selected it is still assigning a value of 1 to all the checkboxes and not changing the selected checkbox to a value of 0. Here is the code that is correct from a syntax standpoint but defaults to 1 no matter what I do not see why its not changing the selected box value to '0' //Correct answer variables $chkBox1 = '1'; $chkBox2 = '1'; $chkBox3 = '1'; $chkBox4 = '1'; $chkBox5 = '1'; if (isset($_POST['chkBox1'])) { if ($chkBox1 == 'chkBox1Selected') { $chkBox1 = '0'; } }//End of chkBox1Selected logic if (isset($_POST['chkBox2'])) { if ($chkBox2 == 'chkBox2Selected') { $chkBox2 = '0'; } }//End of chkBox2Selected logic if (isset($_POST['chkBox3'])) { if ($chkBox3 == 'chkBox3Selected') { $chkBox3 = '0'; } }//End of chkBox3Selected logic
0
11,297,917
07/02/2012 16:51:23
606,571
02/07/2011 14:30:42
70
4
GIT - merge two repositories (original project and changed project WITHOUT HISTORY)
I have two repositories: - Gephi (big open source project) hosted on github - Project of my company based on gephi 7 months ago, when our project started, somebody took a snapshot of gephi project on github and save it to corporate svn => change history loss now i decided to move our project to git repository and merge changes with original project i have now git repository migrated from svn with git-svn my files does not have change history beyond the time when our project started Can i map initial state of our repository to state of original repository? In other words i would like to start aplying our changes to original repository from specific revision.
git
version-control
merge
git-svn
null
null
open
GIT - merge two repositories (original project and changed project WITHOUT HISTORY) === I have two repositories: - Gephi (big open source project) hosted on github - Project of my company based on gephi 7 months ago, when our project started, somebody took a snapshot of gephi project on github and save it to corporate svn => change history loss now i decided to move our project to git repository and merge changes with original project i have now git repository migrated from svn with git-svn my files does not have change history beyond the time when our project started Can i map initial state of our repository to state of original repository? In other words i would like to start aplying our changes to original repository from specific revision.
0
11,349,274
07/05/2012 17:15:53
781,270
06/02/2011 14:13:49
71
0
CSS negative margins on my footer lead to a huge footer?
So I have a page where (for design reasons) I have pulled the main content up into/over the header area with position:relative. This left a gap between the main content and the footer. I fixed that by pulling the footer up with a negative top margin, but now it seems like I need to set a height on the footer so that it reaches all the way to the bottom of the page. And now its too big, since I wasnt planning on filling it with much. Any way to fix this? Here are some screenshots that should clarify everything. Here is the top of the page.. https://skitch.com/divinetiger/efyf8/brewers-berlin-walking-tours And here is the bottom of the page.. https://skitch.com/divinetiger/efygg/brewers-berlin-walking-tours Any ideas how to fix? Or is my problem just something you have to live with when pulling main content up like I did?
html
css
null
null
null
null
open
CSS negative margins on my footer lead to a huge footer? === So I have a page where (for design reasons) I have pulled the main content up into/over the header area with position:relative. This left a gap between the main content and the footer. I fixed that by pulling the footer up with a negative top margin, but now it seems like I need to set a height on the footer so that it reaches all the way to the bottom of the page. And now its too big, since I wasnt planning on filling it with much. Any way to fix this? Here are some screenshots that should clarify everything. Here is the top of the page.. https://skitch.com/divinetiger/efyf8/brewers-berlin-walking-tours And here is the bottom of the page.. https://skitch.com/divinetiger/efygg/brewers-berlin-walking-tours Any ideas how to fix? Or is my problem just something you have to live with when pulling main content up like I did?
0
11,349,276
07/05/2012 17:15:57
506,565
11/13/2010 07:40:50
616
7
Consistent text size for one line
I have an element with 1 line of text and I don't want it to overlap the border or start a new line. So I was considering using a limit on the length of text allowed, do all characters use an equal amount of space across browsers?
html
css
cross-browser
null
null
null
open
Consistent text size for one line === I have an element with 1 line of text and I don't want it to overlap the border or start a new line. So I was considering using a limit on the length of text allowed, do all characters use an equal amount of space across browsers?
0
11,349,277
07/05/2012 17:15:57
1,027,161
11/03/2011 07:44:09
18
1
Trouble Translating Magento
I'm developing a shopping site using Magento, but I'm since the site needs to be for spanish-speaking people, I need to translate the site into spanish. I downloaded some .csv files to make the translation but they're not working. I've even tried to make changes on the english .csv files, changing the statements to spanish but it's still not working. Any ideas of how to make this issue work? Thanks in advance!
magento
null
null
null
null
null
open
Trouble Translating Magento === I'm developing a shopping site using Magento, but I'm since the site needs to be for spanish-speaking people, I need to translate the site into spanish. I downloaded some .csv files to make the translation but they're not working. I've even tried to make changes on the english .csv files, changing the statements to spanish but it's still not working. Any ideas of how to make this issue work? Thanks in advance!
0
11,349,280
07/05/2012 17:16:16
1,094,784
12/13/2011 00:14:01
74
3
equivalent of jquery's event.type for node.js EventEmitter?
Does node.js have an equivalent of jquery's event.type method, i.e. something that gives the name of the event in the form of a string? I've tried event.type but it hasn't worked for me so far...
jquery
node.js
null
null
null
null
open
equivalent of jquery's event.type for node.js EventEmitter? === Does node.js have an equivalent of jquery's event.type method, i.e. something that gives the name of the event in the form of a string? I've tried event.type but it hasn't worked for me so far...
0
11,349,282
07/05/2012 17:16:28
786,489
06/06/2011 20:25:39
1,099
56
Entity Framework Navigation Property One-to-Many becomes One-to-One
In my database I have a One-to-Many relationship (Band has many Albums). However this relationship becomes One-to-One when a foreign key in Album is restricted. public class Band { [Key] public int BandID { get; set; } //Other fun attributes public virtual ICollection<Album> Albums { get; set; } } public class Album { [Key] public int AlbumID { get; set; } public int BandID { get; set; } //Other fun attributes //Some other foreign key public int SomeOtherKey { get; set; } } SQL that should be generated SELECT * FROM Band LEFT JOIN Album ON Band.BandID = Album.AlbumID WHERE Album.SomeOtherKey = 12 My question is should I have another navigational property `public virtual Album Album` in Band, or since this is not always true that would be a bad idea? Should I use LINQ? What is the simplest way to accomplish this using the Entity Framework and models?
c#
.net
sql-server
linq
entity-framework
null
open
Entity Framework Navigation Property One-to-Many becomes One-to-One === In my database I have a One-to-Many relationship (Band has many Albums). However this relationship becomes One-to-One when a foreign key in Album is restricted. public class Band { [Key] public int BandID { get; set; } //Other fun attributes public virtual ICollection<Album> Albums { get; set; } } public class Album { [Key] public int AlbumID { get; set; } public int BandID { get; set; } //Other fun attributes //Some other foreign key public int SomeOtherKey { get; set; } } SQL that should be generated SELECT * FROM Band LEFT JOIN Album ON Band.BandID = Album.AlbumID WHERE Album.SomeOtherKey = 12 My question is should I have another navigational property `public virtual Album Album` in Band, or since this is not always true that would be a bad idea? Should I use LINQ? What is the simplest way to accomplish this using the Entity Framework and models?
0
11,348,725
07/05/2012 16:34:40
1,370,900
05/02/2012 19:27:10
17
0
Is it better to create satellite dll's before or after programming a MFC application
I am halfway through the development of a MFC `Form` application and I know I will have to publish it in multiple languages. I plan on using satellite DLL's in order to achieve this goal. I am using Visual Studio 2012 by the way. I have done some reading but I'm still quite a neophyte on the subject. In order to create a satellite DLL containing a `Form` in an other language, I have to copy the `Form` in the resource file of a new DLL project, give a specific name to the DLL, add the `/NOENTRY` option to the linker and then translate the `Form`. The thing is, the `Form` may be subject to change in a near future (move/delete/add controls). If I create the satellite DLL right now, I fear I will have to do the same modifications in every single DLL if I need to alter the structure of a `Form`. My question is: Should I wait until I have completed my application and then create the satellite DLL's or is there a mechanism in VS or else where that will allow me to make the modifications of my DLL in a single place?
c++
mfc
resource-dll
null
null
null
open
Is it better to create satellite dll's before or after programming a MFC application === I am halfway through the development of a MFC `Form` application and I know I will have to publish it in multiple languages. I plan on using satellite DLL's in order to achieve this goal. I am using Visual Studio 2012 by the way. I have done some reading but I'm still quite a neophyte on the subject. In order to create a satellite DLL containing a `Form` in an other language, I have to copy the `Form` in the resource file of a new DLL project, give a specific name to the DLL, add the `/NOENTRY` option to the linker and then translate the `Form`. The thing is, the `Form` may be subject to change in a near future (move/delete/add controls). If I create the satellite DLL right now, I fear I will have to do the same modifications in every single DLL if I need to alter the structure of a `Form`. My question is: Should I wait until I have completed my application and then create the satellite DLL's or is there a mechanism in VS or else where that will allow me to make the modifications of my DLL in a single place?
0
11,349,284
07/05/2012 17:16:38
1,504,711
07/05/2012 17:01:29
1
0
google guage animation
I am trying to make google gauge pointer move, but it is not moving, I have set animation configuration as it suppose to be set in var options , such as duration : 1000 and easing: 'inAndOut' , I am n00b in javascript so for give my ignorance attempt. can anyone help me. here is the code. <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {packages:['gauge']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['Match',80], ]); var options = { width: 440, height: 140, greenFrom: 70, greenTo: 100, yellowFrom:50, yellowTo: 70, redFrom:0, redTo: 50, minorTicks: 5, animation:{ duration: 1000, easing: 'inAndOut', }, majorTicks : ['0','10','20','30','40','50','60','70','80','90','100'] }; var chart = new google.visualization.Gauge(document.getElementById('chart_div<%=id%>')); chart.draw(data, options); clearChart(); } </script>
javascript
google
gauge
null
null
null
open
google guage animation === I am trying to make google gauge pointer move, but it is not moving, I have set animation configuration as it suppose to be set in var options , such as duration : 1000 and easing: 'inAndOut' , I am n00b in javascript so for give my ignorance attempt. can anyone help me. here is the code. <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {packages:['gauge']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['Match',80], ]); var options = { width: 440, height: 140, greenFrom: 70, greenTo: 100, yellowFrom:50, yellowTo: 70, redFrom:0, redTo: 50, minorTicks: 5, animation:{ duration: 1000, easing: 'inAndOut', }, majorTicks : ['0','10','20','30','40','50','60','70','80','90','100'] }; var chart = new google.visualization.Gauge(document.getElementById('chart_div<%=id%>')); chart.draw(data, options); clearChart(); } </script>
0
11,349,295
07/05/2012 17:17:18
1,245,302
03/02/2012 14:43:54
33
5
Rails 3: How to skip duplicate rows on joins with ORDER by multiple columns in Postgres
I have a simple HABTM relationship Books <-> Authors and I'd like to get books by its title and name of the authors: Book.joins(:authors).where("books.title ILIKE 'roman%' OR authors.name ILIKE 'pushkin%'").order("books.id DESC").limit(20).group("books.id") That works perfect. BUT if i want to sort additionally by Author name i got duplicate row for books that have many authors: Book.joins(:authors).where("books.title ILIKE 'roman%' OR authors.name ILIKE 'pushkin%'").order("books.id DESC, authors.id DESC").limit(20).group("books.id, authors.id") I got something like: id | title | ... 123 | Roman1 | // this book has only 1 author 55 | roman2 | 55 | roman2 | // this one hase 2 authors 177 | Roman5 | ... etc. How can I merge those rows by `id` in sql query (btw, Postgres 9.1)?
ruby-on-rails
postgresql
activerecord
null
null
null
open
Rails 3: How to skip duplicate rows on joins with ORDER by multiple columns in Postgres === I have a simple HABTM relationship Books <-> Authors and I'd like to get books by its title and name of the authors: Book.joins(:authors).where("books.title ILIKE 'roman%' OR authors.name ILIKE 'pushkin%'").order("books.id DESC").limit(20).group("books.id") That works perfect. BUT if i want to sort additionally by Author name i got duplicate row for books that have many authors: Book.joins(:authors).where("books.title ILIKE 'roman%' OR authors.name ILIKE 'pushkin%'").order("books.id DESC, authors.id DESC").limit(20).group("books.id, authors.id") I got something like: id | title | ... 123 | Roman1 | // this book has only 1 author 55 | roman2 | 55 | roman2 | // this one hase 2 authors 177 | Roman5 | ... etc. How can I merge those rows by `id` in sql query (btw, Postgres 9.1)?
0
11,349,299
07/05/2012 17:17:42
1,258,140
03/08/2012 22:40:54
13
0
Dynamic Form Validation Admin Conflict
I am building a database-backed web application with an administrator module and a user module. The administrator module allows an admin to modify properties of entities stored in the database. The user module serves dynamically generated forms based on the state of the database. Consider the following use case: 1. A user requests a web page containing a form where the form options presented represent DB entities that meet a certain criteria 2. The requested page containing the dynamically generated form loads. 3. The admin makes changes in the DB to some entities loaded in the form such that they no longer meet the criteria to be displayed in the form (ie inactivated, deassociated) 4. The user submits the form with at least one entity selected that no longer meets the criteria to be displayed in the form. Should the server-side validation of the submitted form pass or fail in this scenario? The user was served a valid form but the posted form content is no longer valid with respect to the current state of the DB due to admin changes while the user was on the page... If it should pass, should I be validating the data against the state of the database when the page loaded (leveraging the database history or using the session) or is that overkill and instead I could just validate that the posted entity is valid but does not necessarily meet the current form criteria?
forms
validation
dynamic
null
null
null
open
Dynamic Form Validation Admin Conflict === I am building a database-backed web application with an administrator module and a user module. The administrator module allows an admin to modify properties of entities stored in the database. The user module serves dynamically generated forms based on the state of the database. Consider the following use case: 1. A user requests a web page containing a form where the form options presented represent DB entities that meet a certain criteria 2. The requested page containing the dynamically generated form loads. 3. The admin makes changes in the DB to some entities loaded in the form such that they no longer meet the criteria to be displayed in the form (ie inactivated, deassociated) 4. The user submits the form with at least one entity selected that no longer meets the criteria to be displayed in the form. Should the server-side validation of the submitted form pass or fail in this scenario? The user was served a valid form but the posted form content is no longer valid with respect to the current state of the DB due to admin changes while the user was on the page... If it should pass, should I be validating the data against the state of the database when the page loaded (leveraging the database history or using the session) or is that overkill and instead I could just validate that the posted entity is valid but does not necessarily meet the current form criteria?
0
11,372,682
07/07/2012 05:56:01
1,187,098
02/03/2012 08:54:37
73
1
jquery or javascript to sort attributes of a html object before regex
as a follow on from a previous question [http://stackoverflow.com/questions/11363585/using-jquery-to-find-each-on-attr-with-regex/11363790#comment14984726_11363790][1], [1]: http://stackoverflow.com/questions/11363585/using-jquery-to-find-each-on-attr-with-regex/11363790#comment14984726_11363790 I would like to sort the attributes alphabetically before running them through .each(). The final output is to add child divs in order of the attributes. <div id="myElement" extra1="a" stuff="z" extra9="c" more="y" extra5="b" /div> when I parse it through the code below, it outputs values `b,c,a`, what i need is to sort the elements first into order `extra1, extra5, extra9, more, stuff` then run it through the .each()+regex so the values come out as `a,b,c` var el = $('#myElement'); var attributes = el[0].attributes; $.each(attributes,function(i,attr){ var name = attr.nodeName; var val = attr.nodeValue; var regex = /^extra\d$/; if(name.match(regex)) { $(parentDiv).append("<div id="+val+" /div>"); } });​ thx in advance Art
jquery
html
regex
sorting
element
null
open
jquery or javascript to sort attributes of a html object before regex === as a follow on from a previous question [http://stackoverflow.com/questions/11363585/using-jquery-to-find-each-on-attr-with-regex/11363790#comment14984726_11363790][1], [1]: http://stackoverflow.com/questions/11363585/using-jquery-to-find-each-on-attr-with-regex/11363790#comment14984726_11363790 I would like to sort the attributes alphabetically before running them through .each(). The final output is to add child divs in order of the attributes. <div id="myElement" extra1="a" stuff="z" extra9="c" more="y" extra5="b" /div> when I parse it through the code below, it outputs values `b,c,a`, what i need is to sort the elements first into order `extra1, extra5, extra9, more, stuff` then run it through the .each()+regex so the values come out as `a,b,c` var el = $('#myElement'); var attributes = el[0].attributes; $.each(attributes,function(i,attr){ var name = attr.nodeName; var val = attr.nodeValue; var regex = /^extra\d$/; if(name.match(regex)) { $(parentDiv).append("<div id="+val+" /div>"); } });​ thx in advance Art
0
11,372,696
07/07/2012 05:59:47
652,497
04/27/2010 02:33:48
1,487
80
Twitter bootstrap: get rid of 1200px large display how?
If you look at: http://twitter.github.com/bootstrap/scaffolding.html#responsive they have categories for nearly every device. I'd like to eliminate the last support device entry: Large display 1200px and up 70px 30px I'm a backend programmer, not a designer, so my css knowledge is limited. Can someone point me to the files I would need to modify in order to get rid of support for large display? Thanks! (PS if anyone is wondering why I would do this, it's corporate standard blah blah blah 1024px blah blah.)
html
css
twitter-bootstrap
less
null
null
open
Twitter bootstrap: get rid of 1200px large display how? === If you look at: http://twitter.github.com/bootstrap/scaffolding.html#responsive they have categories for nearly every device. I'd like to eliminate the last support device entry: Large display 1200px and up 70px 30px I'm a backend programmer, not a designer, so my css knowledge is limited. Can someone point me to the files I would need to modify in order to get rid of support for large display? Thanks! (PS if anyone is wondering why I would do this, it's corporate standard blah blah blah 1024px blah blah.)
0
11,372,698
07/07/2012 06:00:03
1,481,978
06/26/2012 07:32:13
8
0
Visibility not changing on hover
I'm working on a simple nav bar with a drop-down menu on hover using the visibility property. But when I hover, the condition does not take effect. What is the logic behind this? http://jsfiddle.net/MAvQp/
css
hover
null
null
null
null
open
Visibility not changing on hover === I'm working on a simple nav bar with a drop-down menu on hover using the visibility property. But when I hover, the condition does not take effect. What is the logic behind this? http://jsfiddle.net/MAvQp/
0
11,372,700
07/07/2012 06:00:12
914,308
08/26/2011 14:38:22
1,515
26
Autocorrect Spell Checker
I have a TSV (tab-separated value) file that I need to spell-check for misspellings and combined words (ie 'I love you' vs 'Iloveyou'). I've installed Aspell on my machine and can run it through R using the aspell() function. files <- "train2.tsv" res <- aspell(files) str(res) summary(res) However, the output from running it in R is just a list of misspelled words and possible suggestions. > summary(res) Possibly mis-spelled words: [1] "amant" "contaneir" "creat" "ddition" "EssaySet" "EssayText" "experiament" "expireiment" "expirement" [10] "Fipst" "infomation" "Inorder" "measureing" "mintued" "neccisary" "officialy" "renuminering" "rinsen" [19] "sticlenx" "sucessfully" "tipe" "vineager" "vinigar" "yar" > str(res) Classes ‘aspell’ and 'data.frame': 27 obs. of 5 variables: $ Original : chr "EssaySet" "EssayText" "expirement" "expireiment" ... $ File : chr "train2.tsv" "train2.tsv" "train2.tsv" "train2.tsv" ... $ Line : int 1 1 3 3 3 3 3 3 6 6 ... $ Column : int 4 27 27 108 132 222 226 280 120 156 ... $ Suggestions:List of 27 ..$ : chr "Essay Set" "Essay-Set" "Essayist" "Essays" ... ..$ : chr "Essay Text" "Essay-Text" "Essayist" "Sedatest" ... ..$ : chr "experiment" "excrement" "excitement" "experiments" ... ..$ : chr "experiment" "experiments" "experimenter" "excrement" ... ..$ : chr "Amandy" "am ant" "am-ant" "Amanda" ... ..$ : chr "year" "ya" "Yard" "yard" ... Is there are way to have aspell (or any other spellchecker) automatically correct misspelled words?
python
r
spellchecking
nltk
aspell
null
open
Autocorrect Spell Checker === I have a TSV (tab-separated value) file that I need to spell-check for misspellings and combined words (ie 'I love you' vs 'Iloveyou'). I've installed Aspell on my machine and can run it through R using the aspell() function. files <- "train2.tsv" res <- aspell(files) str(res) summary(res) However, the output from running it in R is just a list of misspelled words and possible suggestions. > summary(res) Possibly mis-spelled words: [1] "amant" "contaneir" "creat" "ddition" "EssaySet" "EssayText" "experiament" "expireiment" "expirement" [10] "Fipst" "infomation" "Inorder" "measureing" "mintued" "neccisary" "officialy" "renuminering" "rinsen" [19] "sticlenx" "sucessfully" "tipe" "vineager" "vinigar" "yar" > str(res) Classes ‘aspell’ and 'data.frame': 27 obs. of 5 variables: $ Original : chr "EssaySet" "EssayText" "expirement" "expireiment" ... $ File : chr "train2.tsv" "train2.tsv" "train2.tsv" "train2.tsv" ... $ Line : int 1 1 3 3 3 3 3 3 6 6 ... $ Column : int 4 27 27 108 132 222 226 280 120 156 ... $ Suggestions:List of 27 ..$ : chr "Essay Set" "Essay-Set" "Essayist" "Essays" ... ..$ : chr "Essay Text" "Essay-Text" "Essayist" "Sedatest" ... ..$ : chr "experiment" "excrement" "excitement" "experiments" ... ..$ : chr "experiment" "experiments" "experimenter" "excrement" ... ..$ : chr "Amandy" "am ant" "am-ant" "Amanda" ... ..$ : chr "year" "ya" "Yard" "yard" ... Is there are way to have aspell (or any other spellchecker) automatically correct misspelled words?
0
11,372,701
07/07/2012 06:00:27
1,508,275
07/07/2012 05:01:44
1
0
GWT Fetch data and Insert data Problems
I am a new user in GWT framework. I try to use GWT RPC function to fetch and insert data from mysql database. I describe what I have done first: 1. I have a home page which can link to other two pages when I click the hyperlink on the home page. One (named insert page) is to insert new data into database. Another (named fetch page) is to fetch data from database and display in a flextable. 2. When I get into both pages, the device and tester can be fetched automatically one by one. 3. In the insert page, LotID can be keyed in manually. After selecting needed waferid and clicking Start button, it is supposed to have a new record in the database and jump into fetch page automatically. 4. In the fetch page, LotID is fetched from database automatically. When all three parameters have been selected by people, then flexbox will display the fetched data. Now, there are three problems I met: 1. When inserting new data into database on the insert page, it jumps into the fetch page correctly but there is no new record can be updated into database. This would be appeared only at first inserting time. The subsequent inserting can work. 2. The subsequent inserting can work but they insert the same data repeatly. For examply, I select device and tester and key in a lotname and select two waferids. The first time (accounted from insert function can work) there are 2 more repeated records(means add 10 records but the true is only two records are supposed to add in). The second time (same device and tester, lotname and two waferids are different), there are 10 more repeated records. The third time, there are 18 more repeated records. The forth time there are 30 more repeated records. 3. On the fetch page, if I display two records in the flextable at first time, after that, I display one record in the flextable. Always it shows a error like this: One or more exceptions caught, see full set in UmbrellaException#getCauses (..some related files..) Caused by: java.lang.IndexOutOfBoundsException: Row index: 2, Row size: 2; But I try to print out the row size when I remove the previous displayed content and show the news every time. The row size always be "1". Plus, when I fetch data on the fetch page on the first time, and go back to home page then I fetch data on the fetch page again the row size will print out two times. I doubt my way of removing flextable content is not appropriate and problems 2 and 3 is related. So I paste part codes here, hope you guys give me some help. Thanks you in advance. MY ENTERPOINT CODE: public void onModuleLoad() { String moduleRlativeURL = GWT.getModuleBaseURL() + "BMAPInterface"; endpoint.setServiceEntryPoint(moduleRlativeURL);*/ // If the application starts with no history token, redirect to a new 'home' state. String initToken = History.getToken(); if (initToken.length() == 0) { History.newItem("home"); } History.addValueChangeHandler(this); //paste on the main panel mainPanel.add(link1); mainPanel.add(link2); RootPanel.get("header").add(header); RootPanel.get("content").add(mainPanel); } MY PAGE CHANGE CODE: public void onValueChange(ValueChangeEvent event) { //Response to hyperlink change onHistoryChanged(History.getToken()); } public void onHistoryChanged(String historyToken) { //Clear Page RootPanel.get("header").clear(); RootPanel.get("content").clear(); header.addStyleName("header"); if (History.getToken().equals("triggerPolling")){ .... } // insert page else if (History.getToken().equals("checkStatus")){ ... } // fetch page else (...) //home page MY INSERT PAGE CODE: header.setText("Trigger Auto Polling System"); deviceList.clear(); testerList.clear(); lotIDList.setValue(null); RootPanel.get("header").clear(); RootPanel.get("content").clear(); getdevice.getDevices(new AsyncCallback<PeaceResultSet> (){ public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result){ deviceList.clear(); deviceList.addItem(""); testerList.clear(); testerList.setEnabled(false); lotIDList.setEnabled(false); startBtn02.setEnabled(false); if(result != null && result.getRows()!=null && result.getRows().size()>0){ String[] cols = result.getCols(); List<?> rows = result.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceList.addItem(cols[j]); } } rows.clear(); } } }); deviceList.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList.getSelectedIndex(); String devicename = deviceList.getItemText(x); Window.alert("You selected: " + devicename); getdevice.getTesters(devicename, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ testerList.clear(); testerList.setEnabled(true); testerList.addItem(""); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows01 = result01.getRows(); for(int i=0; i<rows01.size(); i++){ cols01 = (String[])rows01.get(i); for(int j=cols01.length-1; j>=0; j--){ testerList.addItem(cols01[j]); } } rows01.clear(); } } }); } }); testerList.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ lotIDList.setEnabled(true); startBtn02.setEnabled(true); /* for(int i=0; i<5; i++){ for(int j=0; j<5; j++){ CheckBox checkbox = new CheckBox("Wafer"+(i*5+j+1)); checkbox.setName("Wafer"+(i*5+j+1)); //checkbox = new CheckBox("Wafer"+(i*5+j+1)); checkbox.setEnabled(true); waferGrid.setWidget(i,j,checkbox); } }*/ } }); VerticalPanel Panel03 = new VerticalPanel(); HorizontalPanel Panel04 = new HorizontalPanel(); Label Label01= new Label(); FlexTable itemTable = new FlexTable(); //Add the selection grid deviceList.setVisibleItemCount(1); testerList.setVisibleItemCount(1); //lotIDList.setVisibleItemCount(1); itemTable.setText(0,0, "Select Device: "); itemTable.setWidget(0, 1, deviceList); itemTable.setText(1, 0, "Select Tester: "); itemTable.setWidget(1, 1, testerList); itemTable.setText(2,0, "Select LotID: "); itemTable.setWidget(2,1, lotIDList); //Add the text before select wafer Label01.setText("Tick the Wafer IDs:"); //Add the wafer grid waferGrid.setWidget(0, 0, check01); waferGrid.setWidget(0, 1, check02); waferGrid.setWidget(0, 2, check03); waferGrid.setWidget(0, 3, check04); waferGrid.setWidget(0, 4, check05); waferGrid.setWidget(1, 0, check06); waferGrid.setWidget(1, 1, check07); waferGrid.setWidget(1, 2, check08); waferGrid.setWidget(1, 3, check09); waferGrid.setWidget(1, 4, check10); waferGrid.setWidget(2, 0, check11); waferGrid.setWidget(2, 1, check12); waferGrid.setWidget(2, 2, check13); waferGrid.setWidget(2, 3, check14); waferGrid.setWidget(2, 4, check15); waferGrid.setWidget(3, 0, check16); waferGrid.setWidget(3, 1, check17); waferGrid.setWidget(3, 2, check18); waferGrid.setWidget(3, 3, check19); waferGrid.setWidget(3, 4, check20); waferGrid.setWidget(4, 0, check21); waferGrid.setWidget(4, 1, check22); waferGrid.setWidget(4, 2, check23); waferGrid.setWidget(4, 3, check24); waferGrid.setWidget(4, 4, check25); //Listen checkboxes //SELECT LOT ID RESPONSE //Add the start button startBtn02.setText("START"); startBtn02.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ int x = deviceList.getSelectedIndex(); String devicename = deviceList.getItemText(x); int y = testerList.getSelectedIndex(); String testername = testerList.getItemText(y); String lotname = lotIDList.getText(); //listen checkbox if(check01.getValue()){ checkstring.add("1"); } if(check02.getValue()){ checkstring.add("2"); } if(check03.getValue()){ checkstring.add("3"); } if(check04.getValue()){ checkstring.add("4"); } if(check05.getValue()){ checkstring.add("5"); } if(check06.getValue()){ checkstring.add("6"); } if(check07.getValue()){ checkstring.add("7"); } if(check08.getValue()){ checkstring.add("8"); } if(check09.getValue()){ checkstring.add("9"); } if(check10.getValue()){ checkstring.add("10"); } if(check11.getValue()){ checkstring.add("11"); } if(check12.getValue()){ checkstring.add("12"); } if(check13.getValue()){ checkstring.add("13"); } if(check14.getValue()){ checkstring.add("14"); } if(check15.getValue()){ checkstring.add("15"); } if(check16.getValue()){ checkstring.add("16"); } if(check17.getValue()){ checkstring.add("17"); } if(check18.getValue()){ checkstring.add("18"); } if(check19.getValue()){ checkstring.add("19"); } if(check20.getValue()){ checkstring.add("20"); } if(check21.getValue()){ checkstring.add("21"); } if(check22.getValue()){ checkstring.add("22"); } if(check23.getValue()){ checkstring.add("23"); } if(check24.getValue()){ checkstring.add("24"); } if(check25.getValue()){ checkstring.add("25"); } getdevice.getdeviceid(devicename, new AsyncCallback<PeaceResultSet>(){ public void onFailure(Throwable caught){ /*try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); }*/ } public void onSuccess(PeaceResultSet result04){ if(result04 != null && result04.getRows()!=null && result04.getRows().size()>0){ String[] cols = result04.getCols(); List<?> rows = result04.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceid=cols[j]; } } rows.clear(); } } }); getdevice.gettesterid(testername, new AsyncCallback<PeaceResultSet>(){ public void onFailure(Throwable caught){ /*try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); }*/ } public void onSuccess(PeaceResultSet result04){ if(result04 != null && result04.getRows()!=null && result04.getRows().size()>0){ String[] cols = result04.getCols(); List<?> rows = result04.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ testerid=cols[j]; } } rows.clear(); } } }); for(int i=0; i<checkstring.size();i++){ waferid = checkstring.get(i); //Window.alert("You choice is: " +devicename+ " AND " +testername+ " AND " +lotname+ " AND " +deviceid+ " AND " +testerid + " AND " +waferid); getdevice.insert(deviceid, testerid, lotname, waferid, new AsyncCallback<String> (){ public void onFailure(Throwable caught){ try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); } } public void onSuccess(String result05){ waferid = null; checkstring.clear(); } }); } History.newItem("checkStatus"); MY FETCH PAGE CODE: int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} RootPanel.get("header").clear(); RootPanel.get("content").clear(); header.setText("Check Status System"); VerticalPanel Panel01 = new VerticalPanel(); final Label labeltext = new Label(); deviceList01.setVisibleItemCount(1); testerList01.setVisibleItemCount(1); //USE getDevice getdevice.getDevices(new AsyncCallback<PeaceResultSet> (){ public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result){ deviceList01.addItem(""); testerList01.clear(); testerList01.setEnabled(false); lotIDList01.clear(); lotIDList01.setEnabled(false); if(result != null && result.getRows()!=null && result.getRows().size()>0){ String[] cols = result.getCols(); List<?> rows = result.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceList01.addItem(cols[j]); } } rows.clear(); } } }); //SELECT TESTER RESPONSE deviceList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); //Window.alert("You selected: " + devicename); getdevice.getTesters(devicename, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ testerList01.clear(); testerList01.setEnabled(true); testerList01.addItem(""); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows01 = result01.getRows(); for(int i=0; i<rows01.size(); i++){ cols01 = (String[])rows01.get(i); for(int j=cols01.length-1; j>=0; j--){ testerList01.addItem(cols01[j]); } } rows01.clear(); } } }); } }); //SELECT LOT ID RESPONSE testerList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); int y = testerList01.getSelectedIndex(); String testername = testerList01.getItemText(y); getdevice.getlotID(devicename, testername, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ lotIDList01.clear(); lotIDList01.addItem(""); lotIDList01.setEnabled(true); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows02 = result01.getRows(); for(int i=0; i<rows02.size(); i++){ cols01 = (String[])rows02.get(i); for(int j=cols01.length-1; j>=0; j--){ lotIDList01.addItem(cols01[j]); } } rows02.clear(); } } }); } }); lotIDList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); int y = testerList01.getSelectedIndex(); String testername = testerList01.getItemText(y); int z = lotIDList01.getSelectedIndex(); String lotname = lotIDList01.getItemText(z); getdevice.getinformation(devicename, testername, lotname, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows03 = result01.getRows(); for(int i=0; i<rows03.size(); i++){ cols01 = (String[])rows03.get(i); for(int j=cols01.length-1; j>=0; j--){ table01.setText(i+1, j, cols01[j]); } } rows03.clear(); HIGHLIGHT MY CODE TO CLEAR THE CONTENT IN FLEXTABLE int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);}
sql
gwt
null
null
null
null
open
GWT Fetch data and Insert data Problems === I am a new user in GWT framework. I try to use GWT RPC function to fetch and insert data from mysql database. I describe what I have done first: 1. I have a home page which can link to other two pages when I click the hyperlink on the home page. One (named insert page) is to insert new data into database. Another (named fetch page) is to fetch data from database and display in a flextable. 2. When I get into both pages, the device and tester can be fetched automatically one by one. 3. In the insert page, LotID can be keyed in manually. After selecting needed waferid and clicking Start button, it is supposed to have a new record in the database and jump into fetch page automatically. 4. In the fetch page, LotID is fetched from database automatically. When all three parameters have been selected by people, then flexbox will display the fetched data. Now, there are three problems I met: 1. When inserting new data into database on the insert page, it jumps into the fetch page correctly but there is no new record can be updated into database. This would be appeared only at first inserting time. The subsequent inserting can work. 2. The subsequent inserting can work but they insert the same data repeatly. For examply, I select device and tester and key in a lotname and select two waferids. The first time (accounted from insert function can work) there are 2 more repeated records(means add 10 records but the true is only two records are supposed to add in). The second time (same device and tester, lotname and two waferids are different), there are 10 more repeated records. The third time, there are 18 more repeated records. The forth time there are 30 more repeated records. 3. On the fetch page, if I display two records in the flextable at first time, after that, I display one record in the flextable. Always it shows a error like this: One or more exceptions caught, see full set in UmbrellaException#getCauses (..some related files..) Caused by: java.lang.IndexOutOfBoundsException: Row index: 2, Row size: 2; But I try to print out the row size when I remove the previous displayed content and show the news every time. The row size always be "1". Plus, when I fetch data on the fetch page on the first time, and go back to home page then I fetch data on the fetch page again the row size will print out two times. I doubt my way of removing flextable content is not appropriate and problems 2 and 3 is related. So I paste part codes here, hope you guys give me some help. Thanks you in advance. MY ENTERPOINT CODE: public void onModuleLoad() { String moduleRlativeURL = GWT.getModuleBaseURL() + "BMAPInterface"; endpoint.setServiceEntryPoint(moduleRlativeURL);*/ // If the application starts with no history token, redirect to a new 'home' state. String initToken = History.getToken(); if (initToken.length() == 0) { History.newItem("home"); } History.addValueChangeHandler(this); //paste on the main panel mainPanel.add(link1); mainPanel.add(link2); RootPanel.get("header").add(header); RootPanel.get("content").add(mainPanel); } MY PAGE CHANGE CODE: public void onValueChange(ValueChangeEvent event) { //Response to hyperlink change onHistoryChanged(History.getToken()); } public void onHistoryChanged(String historyToken) { //Clear Page RootPanel.get("header").clear(); RootPanel.get("content").clear(); header.addStyleName("header"); if (History.getToken().equals("triggerPolling")){ .... } // insert page else if (History.getToken().equals("checkStatus")){ ... } // fetch page else (...) //home page MY INSERT PAGE CODE: header.setText("Trigger Auto Polling System"); deviceList.clear(); testerList.clear(); lotIDList.setValue(null); RootPanel.get("header").clear(); RootPanel.get("content").clear(); getdevice.getDevices(new AsyncCallback<PeaceResultSet> (){ public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result){ deviceList.clear(); deviceList.addItem(""); testerList.clear(); testerList.setEnabled(false); lotIDList.setEnabled(false); startBtn02.setEnabled(false); if(result != null && result.getRows()!=null && result.getRows().size()>0){ String[] cols = result.getCols(); List<?> rows = result.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceList.addItem(cols[j]); } } rows.clear(); } } }); deviceList.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList.getSelectedIndex(); String devicename = deviceList.getItemText(x); Window.alert("You selected: " + devicename); getdevice.getTesters(devicename, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ testerList.clear(); testerList.setEnabled(true); testerList.addItem(""); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows01 = result01.getRows(); for(int i=0; i<rows01.size(); i++){ cols01 = (String[])rows01.get(i); for(int j=cols01.length-1; j>=0; j--){ testerList.addItem(cols01[j]); } } rows01.clear(); } } }); } }); testerList.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ lotIDList.setEnabled(true); startBtn02.setEnabled(true); /* for(int i=0; i<5; i++){ for(int j=0; j<5; j++){ CheckBox checkbox = new CheckBox("Wafer"+(i*5+j+1)); checkbox.setName("Wafer"+(i*5+j+1)); //checkbox = new CheckBox("Wafer"+(i*5+j+1)); checkbox.setEnabled(true); waferGrid.setWidget(i,j,checkbox); } }*/ } }); VerticalPanel Panel03 = new VerticalPanel(); HorizontalPanel Panel04 = new HorizontalPanel(); Label Label01= new Label(); FlexTable itemTable = new FlexTable(); //Add the selection grid deviceList.setVisibleItemCount(1); testerList.setVisibleItemCount(1); //lotIDList.setVisibleItemCount(1); itemTable.setText(0,0, "Select Device: "); itemTable.setWidget(0, 1, deviceList); itemTable.setText(1, 0, "Select Tester: "); itemTable.setWidget(1, 1, testerList); itemTable.setText(2,0, "Select LotID: "); itemTable.setWidget(2,1, lotIDList); //Add the text before select wafer Label01.setText("Tick the Wafer IDs:"); //Add the wafer grid waferGrid.setWidget(0, 0, check01); waferGrid.setWidget(0, 1, check02); waferGrid.setWidget(0, 2, check03); waferGrid.setWidget(0, 3, check04); waferGrid.setWidget(0, 4, check05); waferGrid.setWidget(1, 0, check06); waferGrid.setWidget(1, 1, check07); waferGrid.setWidget(1, 2, check08); waferGrid.setWidget(1, 3, check09); waferGrid.setWidget(1, 4, check10); waferGrid.setWidget(2, 0, check11); waferGrid.setWidget(2, 1, check12); waferGrid.setWidget(2, 2, check13); waferGrid.setWidget(2, 3, check14); waferGrid.setWidget(2, 4, check15); waferGrid.setWidget(3, 0, check16); waferGrid.setWidget(3, 1, check17); waferGrid.setWidget(3, 2, check18); waferGrid.setWidget(3, 3, check19); waferGrid.setWidget(3, 4, check20); waferGrid.setWidget(4, 0, check21); waferGrid.setWidget(4, 1, check22); waferGrid.setWidget(4, 2, check23); waferGrid.setWidget(4, 3, check24); waferGrid.setWidget(4, 4, check25); //Listen checkboxes //SELECT LOT ID RESPONSE //Add the start button startBtn02.setText("START"); startBtn02.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ int x = deviceList.getSelectedIndex(); String devicename = deviceList.getItemText(x); int y = testerList.getSelectedIndex(); String testername = testerList.getItemText(y); String lotname = lotIDList.getText(); //listen checkbox if(check01.getValue()){ checkstring.add("1"); } if(check02.getValue()){ checkstring.add("2"); } if(check03.getValue()){ checkstring.add("3"); } if(check04.getValue()){ checkstring.add("4"); } if(check05.getValue()){ checkstring.add("5"); } if(check06.getValue()){ checkstring.add("6"); } if(check07.getValue()){ checkstring.add("7"); } if(check08.getValue()){ checkstring.add("8"); } if(check09.getValue()){ checkstring.add("9"); } if(check10.getValue()){ checkstring.add("10"); } if(check11.getValue()){ checkstring.add("11"); } if(check12.getValue()){ checkstring.add("12"); } if(check13.getValue()){ checkstring.add("13"); } if(check14.getValue()){ checkstring.add("14"); } if(check15.getValue()){ checkstring.add("15"); } if(check16.getValue()){ checkstring.add("16"); } if(check17.getValue()){ checkstring.add("17"); } if(check18.getValue()){ checkstring.add("18"); } if(check19.getValue()){ checkstring.add("19"); } if(check20.getValue()){ checkstring.add("20"); } if(check21.getValue()){ checkstring.add("21"); } if(check22.getValue()){ checkstring.add("22"); } if(check23.getValue()){ checkstring.add("23"); } if(check24.getValue()){ checkstring.add("24"); } if(check25.getValue()){ checkstring.add("25"); } getdevice.getdeviceid(devicename, new AsyncCallback<PeaceResultSet>(){ public void onFailure(Throwable caught){ /*try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); }*/ } public void onSuccess(PeaceResultSet result04){ if(result04 != null && result04.getRows()!=null && result04.getRows().size()>0){ String[] cols = result04.getCols(); List<?> rows = result04.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceid=cols[j]; } } rows.clear(); } } }); getdevice.gettesterid(testername, new AsyncCallback<PeaceResultSet>(){ public void onFailure(Throwable caught){ /*try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); }*/ } public void onSuccess(PeaceResultSet result04){ if(result04 != null && result04.getRows()!=null && result04.getRows().size()>0){ String[] cols = result04.getCols(); List<?> rows = result04.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ testerid=cols[j]; } } rows.clear(); } } }); for(int i=0; i<checkstring.size();i++){ waferid = checkstring.get(i); //Window.alert("You choice is: " +devicename+ " AND " +testername+ " AND " +lotname+ " AND " +deviceid+ " AND " +testerid + " AND " +waferid); getdevice.insert(deviceid, testerid, lotname, waferid, new AsyncCallback<String> (){ public void onFailure(Throwable caught){ try { throw caught; } catch (IncompatibleRemoteServiceException e) { // this client is not compatible with the server; cleanup and refresh the browser Window.alert("Incompatible browser: "+e); } catch (InvocationException e) { // the call didn't complete cleanly Window.alert("Incomplete call :"+e); } catch (Throwable e) { // last resort -- a very unexpected exception Window.alert("Throwable: "+e); } } public void onSuccess(String result05){ waferid = null; checkstring.clear(); } }); } History.newItem("checkStatus"); MY FETCH PAGE CODE: int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} RootPanel.get("header").clear(); RootPanel.get("content").clear(); header.setText("Check Status System"); VerticalPanel Panel01 = new VerticalPanel(); final Label labeltext = new Label(); deviceList01.setVisibleItemCount(1); testerList01.setVisibleItemCount(1); //USE getDevice getdevice.getDevices(new AsyncCallback<PeaceResultSet> (){ public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result){ deviceList01.addItem(""); testerList01.clear(); testerList01.setEnabled(false); lotIDList01.clear(); lotIDList01.setEnabled(false); if(result != null && result.getRows()!=null && result.getRows().size()>0){ String[] cols = result.getCols(); List<?> rows = result.getRows(); for(int i=0; i<rows.size(); i++){ cols = (String[])rows.get(i); for(int j=cols.length-1; j>=0; j--){ deviceList01.addItem(cols[j]); } } rows.clear(); } } }); //SELECT TESTER RESPONSE deviceList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); //Window.alert("You selected: " + devicename); getdevice.getTesters(devicename, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ testerList01.clear(); testerList01.setEnabled(true); testerList01.addItem(""); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows01 = result01.getRows(); for(int i=0; i<rows01.size(); i++){ cols01 = (String[])rows01.get(i); for(int j=cols01.length-1; j>=0; j--){ testerList01.addItem(cols01[j]); } } rows01.clear(); } } }); } }); //SELECT LOT ID RESPONSE testerList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); int y = testerList01.getSelectedIndex(); String testername = testerList01.getItemText(y); getdevice.getlotID(devicename, testername, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ lotIDList01.clear(); lotIDList01.addItem(""); lotIDList01.setEnabled(true); if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows02 = result01.getRows(); for(int i=0; i<rows02.size(); i++){ cols01 = (String[])rows02.get(i); for(int j=cols01.length-1; j>=0; j--){ lotIDList01.addItem(cols01[j]); } } rows02.clear(); } } }); } }); lotIDList01.addChangeHandler(new ChangeHandler(){ public void onChange(ChangeEvent event){ int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);} int x = deviceList01.getSelectedIndex(); String devicename = deviceList01.getItemText(x); int y = testerList01.getSelectedIndex(); String testername = testerList01.getItemText(y); int z = lotIDList01.getSelectedIndex(); String lotname = lotIDList01.getItemText(z); getdevice.getinformation(devicename, testername, lotname, new AsyncCallback<PeaceResultSet> () { public void onFailure(Throwable caught){ } public void onSuccess(PeaceResultSet result01){ if(result01 != null && result01.getRows()!=null && result01.getRows().size()>0){ String[] cols01 = result01.getCols(); List<?> rows03 = result01.getRows(); for(int i=0; i<rows03.size(); i++){ cols01 = (String[])rows03.get(i); for(int j=cols01.length-1; j>=0; j--){ table01.setText(i+1, j, cols01[j]); } } rows03.clear(); HIGHLIGHT MY CODE TO CLEAR THE CONTENT IN FLEXTABLE int zclear = table01.getRowCount(); for(int y=1; y<zclear; y++){ table01.removeRow(y);}
0
11,372,702
07/07/2012 06:00:34
855,065
07/21/2011 02:01:46
205
3
Creating a 2d array of custom objects
The goal of the following code is to create a 2d array such that - Clip is a custom object - a Bank is an array of (8) clips - Banks is an array of (8) banks - Each clip is accessible by banks[a][b], where a is an index in banks (a bank) and b is an index in clips (a clip) In its current state it returns undefined, alas I am at a loss to explain why. Any suggestions about what I'm doing wrong would be greatly appreciated var banks = [] function Clip(a,b) { this.track = a this.slot = b } function Bank(w) { for (var j, j = 0; j <= 7; j++) { var clips = [] var aClip = new Clip(w,j); //post(i) //post(aClip.length) clips[j] = aClip } //post(); return clips } function makeBanks() { for (var k, k = 0; k <= 7; k++) { var aBank = Bank(k); //post(i) //post (aClip.length) banks[k] = aBank } } makeBanks(); console.log(banks[0][0])​ Many thanks in advance
javascript
arrays
oop
null
null
null
open
Creating a 2d array of custom objects === The goal of the following code is to create a 2d array such that - Clip is a custom object - a Bank is an array of (8) clips - Banks is an array of (8) banks - Each clip is accessible by banks[a][b], where a is an index in banks (a bank) and b is an index in clips (a clip) In its current state it returns undefined, alas I am at a loss to explain why. Any suggestions about what I'm doing wrong would be greatly appreciated var banks = [] function Clip(a,b) { this.track = a this.slot = b } function Bank(w) { for (var j, j = 0; j <= 7; j++) { var clips = [] var aClip = new Clip(w,j); //post(i) //post(aClip.length) clips[j] = aClip } //post(); return clips } function makeBanks() { for (var k, k = 0; k <= 7; k++) { var aBank = Bank(k); //post(i) //post (aClip.length) banks[k] = aBank } } makeBanks(); console.log(banks[0][0])​ Many thanks in advance
0
11,372,704
07/07/2012 06:01:05
1,454,990
06/13/2012 23:24:42
74
8
PHP file will not update in browser
For some odd reason, every time I update a file, it is not updating inside a browser (localhost - wampserver). To be more specific. If I have a simple php script: echo "hello world"; It runs fine in the browser, and shows the text 'hello world'. However, if I update it to echo "goodbye world"; And refresh the browser, nothing happens. The text remains 'hello world'. This has not been a problem before and was refreshing perfectly. I tried clearing the browser cache, tested on multiple browsers, restarted my wamp server, and restarted the computer. Nothing seems to be working. The only way the code seems to be updated is if I run the script from my IDE. Then it shows up in the browser with the updated code. How can this problem be fixed? I want it to go back to the way it was and be able to refresh from within the browser. Using wampserver php - 5.3.13, apache 2.2.22
php
browser
null
null
null
null
open
PHP file will not update in browser === For some odd reason, every time I update a file, it is not updating inside a browser (localhost - wampserver). To be more specific. If I have a simple php script: echo "hello world"; It runs fine in the browser, and shows the text 'hello world'. However, if I update it to echo "goodbye world"; And refresh the browser, nothing happens. The text remains 'hello world'. This has not been a problem before and was refreshing perfectly. I tried clearing the browser cache, tested on multiple browsers, restarted my wamp server, and restarted the computer. Nothing seems to be working. The only way the code seems to be updated is if I run the script from my IDE. Then it shows up in the browser with the updated code. How can this problem be fixed? I want it to go back to the way it was and be able to refresh from within the browser. Using wampserver php - 5.3.13, apache 2.2.22
0
11,372,706
07/07/2012 06:01:07
870,463
07/30/2011 08:20:07
3
0
How to get Data from Mysql to be in Value of text in servlet
How to get Data from Mysql to be in Value of text in servlet I try this code but it is not working while(rs.next()){ out.println("<form action=\"userpage\" method=\"post\">" + " <input type=\"text\" name=\"ID_customer\" value=\"<%=rs.getString(1)%>\">" + "</form>"); }
jsp
servlets
null
null
null
null
open
How to get Data from Mysql to be in Value of text in servlet === How to get Data from Mysql to be in Value of text in servlet I try this code but it is not working while(rs.next()){ out.println("<form action=\"userpage\" method=\"post\">" + " <input type=\"text\" name=\"ID_customer\" value=\"<%=rs.getString(1)%>\">" + "</form>"); }
0
11,372,709
07/07/2012 06:01:43
1,309,847
04/03/2012 08:00:18
115
4
RequireJs define default deps
usually a requirejs module looks like: define('ModuleName', ['jquery', 'underscore', 'backbone'], function($, _, Backbone){ }); because every file in my setup requires underscore and backbone I would like to have them automaticly available in the module without having to define them as dependencies. So something like: define('ModuleName', ['jquery'], function($){ $("div.someClass").addClass('hide'); // works var Model = Backbone.Model.extend(); // works too }); Is this possible? If yes how or what is the keyword I have to look for?
requirejs
js-amd
null
null
null
null
open
RequireJs define default deps === usually a requirejs module looks like: define('ModuleName', ['jquery', 'underscore', 'backbone'], function($, _, Backbone){ }); because every file in my setup requires underscore and backbone I would like to have them automaticly available in the module without having to define them as dependencies. So something like: define('ModuleName', ['jquery'], function($){ $("div.someClass").addClass('hide'); // works var Model = Backbone.Model.extend(); // works too }); Is this possible? If yes how or what is the keyword I have to look for?
0
11,372,710
07/07/2012 06:01:52
1,508,315
07/07/2012 05:45:08
1
0
Playing sound with AudioClip in Java - JackRouter error?
I'm relatively new to Java, though now I'm delving a little bit further in here. I'm creating a program that displays a button of a chicken, and upon clicking this button, an audioclip of the chicken clucking is played. Simple, it seems, yet I really can't get audio to work at all. I'm using AudioClip to try to accomplish this. The book that I've been using to teach myself, [i]Introduction to Java Programming[/i] (eighth edition) by Y. Daniel Liang, tells me that I can use AudioClip despite in a non-Applet program despite its location. I'm having trouble getting this to work, though, so here's what I have so far. I'll give you my code and then give you the error I'm receiving. I'm temporarily on a Mac, by the way, and haven't had a chance to try it on Windows. Don't know why that would affect anything, but there you go. //this is the class that plays the sound. The main class follows. import javax.swing.JApplet; import java.applet.*; import java.net.URL; public class ChickenSound extends JApplet { private AudioClip chSound; //creates AudioClip public ChickenSound() { URL url = getClass().getResource("resources/chicken-sound.wav"); //creates a url that is the path of the soundfile chSound = this.newAudioClip(url); //sets AudioClip equal to the url chSound.play(); //plays AudioClip } } //main class // some of these imports are unnecessary but I will clean them up later import java.applet.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.*; import java.net.URL; import javax.swing.*; public class ChickenButton extends JFrame { private ImageIcon chBtnIcon = new ImageIcon("resources/chicken-side.png"); private JButton chBtn = new JButton(chBtnIcon); private JPanel panel = new JPanel(new GridBagLayout()); public ChickenButton() //main window { GridBagConstraints c = new GridBagConstraints(); chBtn.setBorder(BorderFactory.createEmptyBorder()); chBtn.setContentAreaFilled(false); Font bigFont = new Font("Times New Roman", Font.BOLD, 25); JLabel chLbl = new JLabel("Click the Chick'n"); chLbl.setFont(bigFont); c.gridheight = 1; c.gridx= 0; c.gridy = 0; c.weighty = 2; panel.add(chLbl,c); c.gridheight=2; c.gridx= 0; c.gridy = 1; c.weighty = 2; panel.add(chBtn, c); add(panel); chBtn.addActionListener(new ChLstnr()); //creates click listener for button } public static void main(String[] args) { ChickenButton window = new ChickenButton(); window.setLocationRelativeTo(null); window.setTitle("Chick'n Button"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(300, 400); window.setVisible(true); //creates window } class ChLstnr implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Cluck cluck cluck"); //for button functionality testing purposes (and it works) ChickenSound chSnd = new ChickenSound(); //this is supposed to play the sound. This doesn't work. } } } The errors I receive are... 2012-07-06 15:44:33.365 java[41264:ff03] Error loading /Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter: dlopen(/Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter, 262): no suitable image found. Did find:/Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter: no matching architecture in universal wrapper 2012-07-06 15:44:33.367 java[41264:ff03] Cannot find function pointer New_JackRouterPlugIn for factory 7CB18864-927D-48B5-904C-CCFBCFBC7ADD in CFBundle/CFPlugIn 0x102191490 </Library/Audio/Plug-Ins/HAL/JackRouter.plugin> (bundle, not loaded) I really have no idea what this means. Obviously it has something to do with an audio plug-in that can't be loaded, but I don't really know. From what it seems this may be more of an error with my computer than something I'm messing up with Java, but I've found no solution so far. I've tried this with two IDEs, Eclipse and Netbeans, and they both produce the same errors. Does anyone have an idea what's up with this? Any help is greatly appreciated. Thanks.
java
audio
plugins
applet
javasound
null
open
Playing sound with AudioClip in Java - JackRouter error? === I'm relatively new to Java, though now I'm delving a little bit further in here. I'm creating a program that displays a button of a chicken, and upon clicking this button, an audioclip of the chicken clucking is played. Simple, it seems, yet I really can't get audio to work at all. I'm using AudioClip to try to accomplish this. The book that I've been using to teach myself, [i]Introduction to Java Programming[/i] (eighth edition) by Y. Daniel Liang, tells me that I can use AudioClip despite in a non-Applet program despite its location. I'm having trouble getting this to work, though, so here's what I have so far. I'll give you my code and then give you the error I'm receiving. I'm temporarily on a Mac, by the way, and haven't had a chance to try it on Windows. Don't know why that would affect anything, but there you go. //this is the class that plays the sound. The main class follows. import javax.swing.JApplet; import java.applet.*; import java.net.URL; public class ChickenSound extends JApplet { private AudioClip chSound; //creates AudioClip public ChickenSound() { URL url = getClass().getResource("resources/chicken-sound.wav"); //creates a url that is the path of the soundfile chSound = this.newAudioClip(url); //sets AudioClip equal to the url chSound.play(); //plays AudioClip } } //main class // some of these imports are unnecessary but I will clean them up later import java.applet.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.*; import java.net.URL; import javax.swing.*; public class ChickenButton extends JFrame { private ImageIcon chBtnIcon = new ImageIcon("resources/chicken-side.png"); private JButton chBtn = new JButton(chBtnIcon); private JPanel panel = new JPanel(new GridBagLayout()); public ChickenButton() //main window { GridBagConstraints c = new GridBagConstraints(); chBtn.setBorder(BorderFactory.createEmptyBorder()); chBtn.setContentAreaFilled(false); Font bigFont = new Font("Times New Roman", Font.BOLD, 25); JLabel chLbl = new JLabel("Click the Chick'n"); chLbl.setFont(bigFont); c.gridheight = 1; c.gridx= 0; c.gridy = 0; c.weighty = 2; panel.add(chLbl,c); c.gridheight=2; c.gridx= 0; c.gridy = 1; c.weighty = 2; panel.add(chBtn, c); add(panel); chBtn.addActionListener(new ChLstnr()); //creates click listener for button } public static void main(String[] args) { ChickenButton window = new ChickenButton(); window.setLocationRelativeTo(null); window.setTitle("Chick'n Button"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(300, 400); window.setVisible(true); //creates window } class ChLstnr implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Cluck cluck cluck"); //for button functionality testing purposes (and it works) ChickenSound chSnd = new ChickenSound(); //this is supposed to play the sound. This doesn't work. } } } The errors I receive are... 2012-07-06 15:44:33.365 java[41264:ff03] Error loading /Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter: dlopen(/Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter, 262): no suitable image found. Did find:/Library/Audio/Plug-Ins/HAL/JackRouter.plugin/Contents/MacOS/JackRouter: no matching architecture in universal wrapper 2012-07-06 15:44:33.367 java[41264:ff03] Cannot find function pointer New_JackRouterPlugIn for factory 7CB18864-927D-48B5-904C-CCFBCFBC7ADD in CFBundle/CFPlugIn 0x102191490 </Library/Audio/Plug-Ins/HAL/JackRouter.plugin> (bundle, not loaded) I really have no idea what this means. Obviously it has something to do with an audio plug-in that can't be loaded, but I don't really know. From what it seems this may be more of an error with my computer than something I'm messing up with Java, but I've found no solution so far. I've tried this with two IDEs, Eclipse and Netbeans, and they both produce the same errors. Does anyone have an idea what's up with this? Any help is greatly appreciated. Thanks.
0
11,221,115
06/27/2012 07:12:03
1,484,780
06/27/2012 06:58:34
1
0
send sms through url using vb.net
i want to send message to many people . that people type and phone no in mysql table. using procedure am getting list of phone numbers people those who are in same type.the data are in data table. am having one url. using that i send message to people those who are in same type. people type is stored in drop down control. i select that item and store it in a variable s. code ---- Dim ta As New dataset1TableAdapters.pro_selectsmsTableAdapter Dim dt As dataset1.pro_selectsmsDataTable = ta.Get Data(s) how to use that url in looping statement.the variable dt has list of phone numbers people those who are in same type. please help me to solve this problem. am new to vb.net
vb.net
url
null
null
null
null
open
send sms through url using vb.net === i want to send message to many people . that people type and phone no in mysql table. using procedure am getting list of phone numbers people those who are in same type.the data are in data table. am having one url. using that i send message to people those who are in same type. people type is stored in drop down control. i select that item and store it in a variable s. code ---- Dim ta As New dataset1TableAdapters.pro_selectsmsTableAdapter Dim dt As dataset1.pro_selectsmsDataTable = ta.Get Data(s) how to use that url in looping statement.the variable dt has list of phone numbers people those who are in same type. please help me to solve this problem. am new to vb.net
0
11,226,292
06/27/2012 12:32:44
1,434,739
06/04/2012 08:52:11
15
1
Mouse Events Triggering Prematurely & Incorrectly: JQuery Plugin
I have been battling to find the error in my menu for over a month now and desperately need help is detecting where my mouse events are going wrong. The design and code are working almost perfectly, along with the QTIP2 Jquery plugin... all that is left are these 2 annoying problems detailed below. Both problems are detailed below with a Fiddle and relate to Mouse events. I really hope someone can help so that I can wrap up this project. 10000 Magical Points to the genius who can crack this, as I really am all out of ways to solve it, thus this post is my last resort! The 2 problems: http://jsfiddle.net/UGQ95/10/ The 'Tier 1' menu opens correctly and persists correctly whenever the user is not using the menu. This means that whenever the user has completed hovering any menu items, it returns to indicate the users current item. The behaviour of the menu is currently correct, holding open 'Tier 1' and 'Tier 2', whilst 'Tier 3' (if there is one) is highlighted on hover, but remains hidden until hovered. Problem 1. You will notice the top tier, 'Tier 1', tries to force itself to the 'alwaysactive' item immediately on mouseleave when moving between 'Tier 1' items. I believe this is caused by the mouseleave trigger on the #navigation triggering prematurely. This JS is found in the last 10 lines. Problem 2. In the fiddle provided, you will notice I have set 'Tier 1 - Maintenance', 'Tier 2 - Bus Stops', and 'Tier 3 - Create Bus Stop' to being the active page. When hovering the other 'Tier 2' items alongside 'Bus Stops', I cannot get the 'Tier 2' active item to lose its highlighting, until it needs to return to being shown as active. Thanks so much if any of you can help! I really hope I was able to illustrate my problems clearly. Cheers Devin
javascript
jquery
jquery-plugins
javascript-events
null
null
open
Mouse Events Triggering Prematurely & Incorrectly: JQuery Plugin === I have been battling to find the error in my menu for over a month now and desperately need help is detecting where my mouse events are going wrong. The design and code are working almost perfectly, along with the QTIP2 Jquery plugin... all that is left are these 2 annoying problems detailed below. Both problems are detailed below with a Fiddle and relate to Mouse events. I really hope someone can help so that I can wrap up this project. 10000 Magical Points to the genius who can crack this, as I really am all out of ways to solve it, thus this post is my last resort! The 2 problems: http://jsfiddle.net/UGQ95/10/ The 'Tier 1' menu opens correctly and persists correctly whenever the user is not using the menu. This means that whenever the user has completed hovering any menu items, it returns to indicate the users current item. The behaviour of the menu is currently correct, holding open 'Tier 1' and 'Tier 2', whilst 'Tier 3' (if there is one) is highlighted on hover, but remains hidden until hovered. Problem 1. You will notice the top tier, 'Tier 1', tries to force itself to the 'alwaysactive' item immediately on mouseleave when moving between 'Tier 1' items. I believe this is caused by the mouseleave trigger on the #navigation triggering prematurely. This JS is found in the last 10 lines. Problem 2. In the fiddle provided, you will notice I have set 'Tier 1 - Maintenance', 'Tier 2 - Bus Stops', and 'Tier 3 - Create Bus Stop' to being the active page. When hovering the other 'Tier 2' items alongside 'Bus Stops', I cannot get the 'Tier 2' active item to lose its highlighting, until it needs to return to being shown as active. Thanks so much if any of you can help! I really hope I was able to illustrate my problems clearly. Cheers Devin
0
11,223,682
06/27/2012 10:01:39
1,407,528
05/21/2012 09:32:28
81
2
pushViewController don´t work on iOS 5 to launch GTMOAuth2ViewControllerTouch
I am developing an iPad application using sdk 5 and storyboard. I´m following the [OAuth2] Tutorial and sample.[1] I have port the code to a Singleton. Create a new view everytime initSesion is called: viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope clientID:kMyClientID clientSecret:kMyClientSecret keychainItemName:kKeychainItemName delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)]; //viewController.keychainItemAccessibility = kSecAttrAccessibleAlways; NSDictionary *params = [NSDictionary dictionaryWithObject:@"en" forKey:@"hl"]; //viewController.signIn.additionalAuthorizationParameters = params; NSString *html = @"<html><body bgcolor=silver><div align=center>Loading sign-in page...</div></body></html>"; viewController.initialHTMLString = html; [[self navigationController] pushViewController:viewController animated:YES]; But, when another Viewcontroller call the simgleton, the view pushed is not display. Teorically, a navigator Controller use a stack to show differents view, so, if i´m in the correct way, that function must launch the GTMOAuth2ViewControllerTouch.view, to log in using OAuth2, thats occur in the sample. But nothing happen. What´s going on? Thanks in advance. [1]: https://developers.google.com/accounts/docs/OAuth2
ios5
oauth-2.0
single-sign-on
null
null
null
open
pushViewController don´t work on iOS 5 to launch GTMOAuth2ViewControllerTouch === I am developing an iPad application using sdk 5 and storyboard. I´m following the [OAuth2] Tutorial and sample.[1] I have port the code to a Singleton. Create a new view everytime initSesion is called: viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope clientID:kMyClientID clientSecret:kMyClientSecret keychainItemName:kKeychainItemName delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)]; //viewController.keychainItemAccessibility = kSecAttrAccessibleAlways; NSDictionary *params = [NSDictionary dictionaryWithObject:@"en" forKey:@"hl"]; //viewController.signIn.additionalAuthorizationParameters = params; NSString *html = @"<html><body bgcolor=silver><div align=center>Loading sign-in page...</div></body></html>"; viewController.initialHTMLString = html; [[self navigationController] pushViewController:viewController animated:YES]; But, when another Viewcontroller call the simgleton, the view pushed is not display. Teorically, a navigator Controller use a stack to show differents view, so, if i´m in the correct way, that function must launch the GTMOAuth2ViewControllerTouch.view, to log in using OAuth2, thats occur in the sample. But nothing happen. What´s going on? Thanks in advance. [1]: https://developers.google.com/accounts/docs/OAuth2
0
11,226,299
06/27/2012 12:33:05
1,259,798
03/09/2012 17:00:59
8
0
Filtering PDO SQL Queries
I'm using PDO method in my PHP page to implode two strings (in order to create a graph... long story!), but I don't know how to filter them. The table structure in MySQL is like this: Column Name: **item** (the name of the item being voted on); **nvote** (the number of votes this item has received); **date** (the dates of the votes) This is what I have so far: $stmt1 = $db->prepare("SELECT date FROM vote"); $stmt1->execute(); $stmt2 = $db->prepare("SELECT nvote FROM vote"); $stmt2->execute(); $line1 = implode( ',', $stmt1->fetchAll (PDO::FETCH_COLUMN) ); $line2 = implode( ',', $stmt2->fetchAll (PDO::FETCH_COLUMN) ); (Line1 creates the x-axis of my graph, line2 creates the y-axis) This works very well to generate the strings for my graph. How can I filter these so that name of the item being voted on (in the "**item**" column") is filtered by a var (in this case, `$nameofitem`)? I can't seem to get it to work.
php
mysql
select
filter
pdo
null
open
Filtering PDO SQL Queries === I'm using PDO method in my PHP page to implode two strings (in order to create a graph... long story!), but I don't know how to filter them. The table structure in MySQL is like this: Column Name: **item** (the name of the item being voted on); **nvote** (the number of votes this item has received); **date** (the dates of the votes) This is what I have so far: $stmt1 = $db->prepare("SELECT date FROM vote"); $stmt1->execute(); $stmt2 = $db->prepare("SELECT nvote FROM vote"); $stmt2->execute(); $line1 = implode( ',', $stmt1->fetchAll (PDO::FETCH_COLUMN) ); $line2 = implode( ',', $stmt2->fetchAll (PDO::FETCH_COLUMN) ); (Line1 creates the x-axis of my graph, line2 creates the y-axis) This works very well to generate the strings for my graph. How can I filter these so that name of the item being voted on (in the "**item**" column") is filtered by a var (in this case, `$nameofitem`)? I can't seem to get it to work.
0
11,226,301
06/27/2012 12:33:13
1,485,631
06/27/2012 12:28:39
1
0
Where do I find the name for my data context?
I have this following code: DefaultModel.RegisterContext(typeof(YourDataContextType), new ContextConfiguration() { ScaffoldAllTables = true }); I know what does into the "yourdatacontexttype" but I cannot seem to find where it is. Thank you. --jd
c#
context
null
null
null
null
open
Where do I find the name for my data context? === I have this following code: DefaultModel.RegisterContext(typeof(YourDataContextType), new ContextConfiguration() { ScaffoldAllTables = true }); I know what does into the "yourdatacontexttype" but I cannot seem to find where it is. Thank you. --jd
0
11,226,302
06/27/2012 12:33:13
1,485,515
06/27/2012 11:46:43
1
0
mod_rewrite With Unknown File Name and Unknown Query String Var Names and Amount
I am trying to create SEO friendly URLs for a site that has a varying number of files, each with a different number of potential query string variables. Every example I have come by either has a specific file or variables in the regular expression; no query string rewriting; or it just doesn't work. I am not the best with regular expressions, but I have been using: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php Which I did not write and is pretty old so could very well be outdated. This snippet doesn't acknowledge the file name and stays on the index: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /$1 [L] What I would like to achieve is to go from these: http://domain.com/file.php?var1=val1&var2=val2 http://domain.com/anotherfile.php?var1=val1 http://domain.com/yetanotherfile.php?var1=val1&var2=val2&var3=val3 To these: http://domain.com/file/val1/val2 http://domain.com/anotherfile/val1 http://domain.com/yetanotherfile/val1/val2/val3 (Optional trailing slashes would be wonderful as well.) I am okay with getting the variables via the explode function in the PHP files, but what would be the lines needed in the .htaccess file to achieve this?
.htaccess
mod-rewrite
null
null
null
null
open
mod_rewrite With Unknown File Name and Unknown Query String Var Names and Amount === I am trying to create SEO friendly URLs for a site that has a varying number of files, each with a different number of potential query string variables. Every example I have come by either has a specific file or variables in the regular expression; no query string rewriting; or it just doesn't work. I am not the best with regular expressions, but I have been using: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php Which I did not write and is pretty old so could very well be outdated. This snippet doesn't acknowledge the file name and stays on the index: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /$1 [L] What I would like to achieve is to go from these: http://domain.com/file.php?var1=val1&var2=val2 http://domain.com/anotherfile.php?var1=val1 http://domain.com/yetanotherfile.php?var1=val1&var2=val2&var3=val3 To these: http://domain.com/file/val1/val2 http://domain.com/anotherfile/val1 http://domain.com/yetanotherfile/val1/val2/val3 (Optional trailing slashes would be wonderful as well.) I am okay with getting the variables via the explode function in the PHP files, but what would be the lines needed in the .htaccess file to achieve this?
0
11,226,310
06/27/2012 12:33:35
383,228
07/04/2010 19:54:57
79
0
Styling/Theming Drupal 7 Content Type Record
I developed a Content type of "Car Sales" with following fields: 1. Manufacturer 2. Model 3. Make 4. Fuel Type 5. Transmission (Manual/Automatic) 6. Color 7. Registered? (Yes/No) 8. Mileage 9. Engine Power 10. Condition (New/Reconditioned/Used) 11. Price 12. Pictures (Multiple uploads) I have developed View of this Content Type to display list of cars. Now I want to develop a screen/view for individual Car Sale Record like this: ![enter image description here][1] [1]: http://i.stack.imgur.com/gLwqF.jpg Apart from arranging fields, please note that I want to embed a Picture Gallery in between. Can this be achieved through Drupal 7 Admin UI or do I need to create custom CSS and template files? If I need to edit certain template files/css, what are those? I'm using Zen Sub Theme.
drupal-7
drupal-views
drupal-theming
null
null
null
open
Styling/Theming Drupal 7 Content Type Record === I developed a Content type of "Car Sales" with following fields: 1. Manufacturer 2. Model 3. Make 4. Fuel Type 5. Transmission (Manual/Automatic) 6. Color 7. Registered? (Yes/No) 8. Mileage 9. Engine Power 10. Condition (New/Reconditioned/Used) 11. Price 12. Pictures (Multiple uploads) I have developed View of this Content Type to display list of cars. Now I want to develop a screen/view for individual Car Sale Record like this: ![enter image description here][1] [1]: http://i.stack.imgur.com/gLwqF.jpg Apart from arranging fields, please note that I want to embed a Picture Gallery in between. Can this be achieved through Drupal 7 Admin UI or do I need to create custom CSS and template files? If I need to edit certain template files/css, what are those? I'm using Zen Sub Theme.
0
11,225,970
06/27/2012 12:16:09
1,194,102
02/07/2012 07:44:12
1
0
Passing an Abstract Class as an argument in an Method
I have recently started learning c# and have come across an issue. I'm not very familiar with the abstract/interface classes yet do understand the basic principles and applications. I am Currently looking at OOP for c#, I already know the mechanics of OOP, having done it in Java, yet have never used abstract or interface classes there either. The aim of my code is to pass in an ArrayList of Objects (Both Children of a Common Parent Class) and Print out only those Objects that are of that particular Class. This works, but I was curious to see If I could get the same method to print out all the child Objects of the parent class, If the parent class is abstract. Parent Class abstract class Person { protected string Name { get; set; } protected int Age { get; set; } public override string ToString() { return "Person:" + Name + ", " + this.Age; } } Child Class class Student : Person { private int studID { get; set; } private string school { get; set; } public Student() { } public Student(string name, int age, int studID, string school) { this.Name = name; this.Age = age; this.studID = studID; this.school = school; } public override string ToString() { string s = "Student:" + Name + ", " + Age + ", " + studID + ", " + school; return s; } } Method Call private static void StudentDetails(object type) { ArrayList tmp = new ArrayList(); //display all //foreach (Person p in people) tmp.Add(p); foreach (Person p in people) { if (type.GetType() == p.GetType()) { tmp.Add(p); } } //etc...
c#
abstract
null
null
null
null
open
Passing an Abstract Class as an argument in an Method === I have recently started learning c# and have come across an issue. I'm not very familiar with the abstract/interface classes yet do understand the basic principles and applications. I am Currently looking at OOP for c#, I already know the mechanics of OOP, having done it in Java, yet have never used abstract or interface classes there either. The aim of my code is to pass in an ArrayList of Objects (Both Children of a Common Parent Class) and Print out only those Objects that are of that particular Class. This works, but I was curious to see If I could get the same method to print out all the child Objects of the parent class, If the parent class is abstract. Parent Class abstract class Person { protected string Name { get; set; } protected int Age { get; set; } public override string ToString() { return "Person:" + Name + ", " + this.Age; } } Child Class class Student : Person { private int studID { get; set; } private string school { get; set; } public Student() { } public Student(string name, int age, int studID, string school) { this.Name = name; this.Age = age; this.studID = studID; this.school = school; } public override string ToString() { string s = "Student:" + Name + ", " + Age + ", " + studID + ", " + school; return s; } } Method Call private static void StudentDetails(object type) { ArrayList tmp = new ArrayList(); //display all //foreach (Person p in people) tmp.Add(p); foreach (Person p in people) { if (type.GetType() == p.GetType()) { tmp.Add(p); } } //etc...
0
11,327,201
07/04/2012 10:24:12
1,211,465
02/15/2012 13:46:07
451
4
checking part of a file extension and adding a class using jquery
I am trying to check for the following from within the file name: `images/PRODUCT/icon/` From the page that contains: `div.lookup-image-wrapper` If i match them both then i want to add a class to the image that contained: `images/PRODUCT/icon/` **HTML:** <div class="lookup-image-wrapper" style="text-align: center"> <div id="divProductPicZ23280" style="display:none"></div> <div class="divProductPic" id="divProductPic23280"> <img alt="Camping" border="0" id="ProductPic23280" name="ProductPic23280" src="images/Product/medium/23280.jpg"> </div> <img alt="Show Picture 1" border="0" onclick="setcolorpicidx_23280(1);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 2" border="0" onclick="setcolorpicidx_23280(2);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 3" border="0" onclick="setcolorpicidx_23280(3);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 4" border="0" onclick="setcolorpicidx_23280(4);" src="skins/skin_1/images/nopictureicon.gif" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 5" border="0" onclick="setcolorpicidx_23280(5);" src="images/PRODUCT/icon/23280_5_.jpg" style="cursor:hand;cursor:pointer;"> </div> **jquery:** $("img[src='images/PRODUCT/icon/']").addClass("selected highlight"); http://jsfiddle.net/tVvKL/
javascript
jquery
null
null
null
null
open
checking part of a file extension and adding a class using jquery === I am trying to check for the following from within the file name: `images/PRODUCT/icon/` From the page that contains: `div.lookup-image-wrapper` If i match them both then i want to add a class to the image that contained: `images/PRODUCT/icon/` **HTML:** <div class="lookup-image-wrapper" style="text-align: center"> <div id="divProductPicZ23280" style="display:none"></div> <div class="divProductPic" id="divProductPic23280"> <img alt="Camping" border="0" id="ProductPic23280" name="ProductPic23280" src="images/Product/medium/23280.jpg"> </div> <img alt="Show Picture 1" border="0" onclick="setcolorpicidx_23280(1);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 2" border="0" onclick="setcolorpicidx_23280(2);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 3" border="0" onclick="setcolorpicidx_23280(3);" src="http://i47.tinypic.com/o7szev.jpg" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 4" border="0" onclick="setcolorpicidx_23280(4);" src="skins/skin_1/images/nopictureicon.gif" style="cursor:hand;cursor:pointer;"> <img alt="Show Picture 5" border="0" onclick="setcolorpicidx_23280(5);" src="images/PRODUCT/icon/23280_5_.jpg" style="cursor:hand;cursor:pointer;"> </div> **jquery:** $("img[src='images/PRODUCT/icon/']").addClass("selected highlight"); http://jsfiddle.net/tVvKL/
0
11,327,167
07/04/2012 10:22:18
74,833
03/06/2009 18:34:54
80
7
PHPunit and getopt
I'm trying to test a component that uses a third party library which makes use of getopt to retrieve command line arguments. Is there any way I can get this working within PHPunit? I've tried inserting this prior to the component call: $args = explode( ' ', 'scriptName -q staging_to_xxx -w 250 -c 500' ); $_SERVER['argv'] = $args; But that doesn't work.
phpunit
null
null
null
null
null
open
PHPunit and getopt === I'm trying to test a component that uses a third party library which makes use of getopt to retrieve command line arguments. Is there any way I can get this working within PHPunit? I've tried inserting this prior to the component call: $args = explode( ' ', 'scriptName -q staging_to_xxx -w 250 -c 500' ); $_SERVER['argv'] = $args; But that doesn't work.
0
11,327,214
07/04/2012 10:25:21
384,134
07/05/2010 06:18:11
462
4
How to measure the spacing between controls of a NSRunAlertPanel
How can I find out the number of pixel position between the controls of a NSRunAlertPanel. In Interface Builder we can use the Option+Mouse to find the pixel length.Please help.
objective-c
osx
cocoa
nsrunalertpanel
null
null
open
How to measure the spacing between controls of a NSRunAlertPanel === How can I find out the number of pixel position between the controls of a NSRunAlertPanel. In Interface Builder we can use the Option+Mouse to find the pixel length.Please help.
0
11,327,215
07/04/2012 10:25:23
1,389,070
05/11/2012 09:17:23
1
0
Trying to register a dll but getting error DllRegisterServer entry point was not found
I have a .net assembly dll which i am trying to register using regsvr32, but get the following error: "dll loaded but DllRegisterServer entry point was not found " getting this error while registering the other dlls also.
error-message
dllregistration
null
null
null
null
open
Trying to register a dll but getting error DllRegisterServer entry point was not found === I have a .net assembly dll which i am trying to register using regsvr32, but get the following error: "dll loaded but DllRegisterServer entry point was not found " getting this error while registering the other dlls also.
0
11,327,216
07/04/2012 10:25:25
1,501,238
07/04/2012 10:04:34
1
0
XSRF token should be stored in a cookie or in the session?
On a PHP project I'm working on, I'd like to implement an anti-XSRF mecanism. So I'm generating a random token and I store it in my session (S_SESSION['token']) When I submit a form, I include my session token in a hidden field and verify is the transitted token == stored token. My question is : What is the security impact if I store this token in a cookie ?? I think both solutions are exploitable in case of XSS for example, and I'm not able to see wich storage is the best for the token :-( Thanks for you help :)
session
cookies
token
csrf
null
null
open
XSRF token should be stored in a cookie or in the session? === On a PHP project I'm working on, I'd like to implement an anti-XSRF mecanism. So I'm generating a random token and I store it in my session (S_SESSION['token']) When I submit a form, I include my session token in a hidden field and verify is the transitted token == stored token. My question is : What is the security impact if I store this token in a cookie ?? I think both solutions are exploitable in case of XSS for example, and I'm not able to see wich storage is the best for the token :-( Thanks for you help :)
0
11,326,748
07/04/2012 09:59:25
1,493,850
07/01/2012 04:18:25
43
0
query related to urlpatterns in urls.py in django
This is my urls.py (stored in /home/pooja/Desktop/mysite/mysite/urls.py, here "mysite" is the name of my project): from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^search/$','search.views.front_page'), #url(r'^search/$','search.views.results'),#commented url(r'^admin/', include(admin.site.urls)), ) This is my views.py file(stored #!/usr/bin/python from django.template import Context, loader, RequestContext from django.http import HttpResponse from skey import find_root_tags, count, sorting_list from search.models import Keywords #from django.shortcuts import render_to_response as rr def front_page(request): if request.method == 'POST' : str1 = request.POST['word'] fo = open("xml.txt","r") for i in range(count.__len__()): file = fo.readline() file = file.rstrip('\n') find_root_tags(file,str1,i) list.append((file,count[i])) sorting_list(list) for name, count in list: s = Keywords(file_name=name,frequency_count=count) s.save() fo.close() return HttpResponseRedirect('/results/') else : str1 = '' list = [] template = loader.get_template('search/search.html') c = RequestContext(request) response = template.render(c) return HttpResponse(response) def results(request): list1 = Keywords.objects.all() t = loader.get_template('search/results.html') c = Context({'list1':list1, }) return HttpResponse(t.render(c)) this is my results.html(which is stored in /home/pooja/Desktop/my_templates/search/results.html, (here search is my app name) : <html> <body bgcolor = "#9ACD32"> <style type="text/css"> h1 { position: absolute; top: 200px; left: 480px; } form #Edit1 { position: relative; top: 245px; left: 480px; } form #Edit2 { position: relative; top: 220px; left: 680px; } </style> <font size="5" face="arial" color="#0000FF"> <h1>Search Page</h1> </font> <hr/> <br/> <br/> <Form Action ="/front_page/",Method ="POST"> <div id="Edit1"> <INPUT TYPE = 'text' name ='word' VALUE =""> </div> <div id="Edit2"> <INPUT TYPE = "Submit" VALUE = "Search"> </div> </FORM> </body> </html> this is my results.html(which is stored in /home/pooja/Desktop/my_templates/search/results.html, (here search is my app name) : { % if list1 %} <html> <body BGCOLOR = "#9ACD32"> <ul> { % for l in list1 %} <li> {{l.file_name}}, {{l.frquency_count}}</li> { % endfor %} </ul> </body> </html> {% endif %} I know I have given a long descriptions about every file, but I wanted to know if there is any error that I'm making in any of these , so please let me know. I know one of my errors in "urls.py" where I don't know how to mention about search.results because when I ran this app on server, the search.html page was coming and as I entered some word say 'book' it gave me this error: Using the URLconf defined in mysite.urls, Django tried these URL patterns,in this order: ^search/$ ^admin/ The current URL, front_page/, didn't match any of these. why has this happened ?One more thing I have my all the skey.py, xml documents and xml.txt stored in search app please help me at this, it's urgent.
python
django
linux
ubuntu
null
null
open
query related to urlpatterns in urls.py in django === This is my urls.py (stored in /home/pooja/Desktop/mysite/mysite/urls.py, here "mysite" is the name of my project): from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^search/$','search.views.front_page'), #url(r'^search/$','search.views.results'),#commented url(r'^admin/', include(admin.site.urls)), ) This is my views.py file(stored #!/usr/bin/python from django.template import Context, loader, RequestContext from django.http import HttpResponse from skey import find_root_tags, count, sorting_list from search.models import Keywords #from django.shortcuts import render_to_response as rr def front_page(request): if request.method == 'POST' : str1 = request.POST['word'] fo = open("xml.txt","r") for i in range(count.__len__()): file = fo.readline() file = file.rstrip('\n') find_root_tags(file,str1,i) list.append((file,count[i])) sorting_list(list) for name, count in list: s = Keywords(file_name=name,frequency_count=count) s.save() fo.close() return HttpResponseRedirect('/results/') else : str1 = '' list = [] template = loader.get_template('search/search.html') c = RequestContext(request) response = template.render(c) return HttpResponse(response) def results(request): list1 = Keywords.objects.all() t = loader.get_template('search/results.html') c = Context({'list1':list1, }) return HttpResponse(t.render(c)) this is my results.html(which is stored in /home/pooja/Desktop/my_templates/search/results.html, (here search is my app name) : <html> <body bgcolor = "#9ACD32"> <style type="text/css"> h1 { position: absolute; top: 200px; left: 480px; } form #Edit1 { position: relative; top: 245px; left: 480px; } form #Edit2 { position: relative; top: 220px; left: 680px; } </style> <font size="5" face="arial" color="#0000FF"> <h1>Search Page</h1> </font> <hr/> <br/> <br/> <Form Action ="/front_page/",Method ="POST"> <div id="Edit1"> <INPUT TYPE = 'text' name ='word' VALUE =""> </div> <div id="Edit2"> <INPUT TYPE = "Submit" VALUE = "Search"> </div> </FORM> </body> </html> this is my results.html(which is stored in /home/pooja/Desktop/my_templates/search/results.html, (here search is my app name) : { % if list1 %} <html> <body BGCOLOR = "#9ACD32"> <ul> { % for l in list1 %} <li> {{l.file_name}}, {{l.frquency_count}}</li> { % endfor %} </ul> </body> </html> {% endif %} I know I have given a long descriptions about every file, but I wanted to know if there is any error that I'm making in any of these , so please let me know. I know one of my errors in "urls.py" where I don't know how to mention about search.results because when I ran this app on server, the search.html page was coming and as I entered some word say 'book' it gave me this error: Using the URLconf defined in mysite.urls, Django tried these URL patterns,in this order: ^search/$ ^admin/ The current URL, front_page/, didn't match any of these. why has this happened ?One more thing I have my all the skey.py, xml documents and xml.txt stored in search app please help me at this, it's urgent.
0
11,327,217
07/04/2012 10:25:25
880,276
08/05/2011 09:29:05
121
5
copy existing iamge and rename with php
I have a little blackout with the simplest of the simplest. I have a folder called "userpics" and in that folder there are 100x100 profile images named e.g. user-25.jpg. In that folder there also is a picture called user-none.jpg with a silhouette, used as a picture on a comments function when non-registered users posts a comment. What I want to do is when i user is registered the user-none.jpg (with the silhouette) is copied and name e.g. user-26.jpg. The user can then later upload a new profileimage from his account. I just can't figure out how to copy the image. I tried this: function CreateDummyProfileImage($user_id) { $new_dummy = "images/userpics/user-".$user_id.".jpg"; $dummy = "images/userpics/user-none.jpg"; list($current_width, $current_height) = getimagesize($dummy); $this->imageSizeH = 100; $this->imageSizeW = 100; $canvas = imagecreatetruecolor($this->imageSizeW, $this->imageSizeH); $current_image = imagecreatefromjpeg($dummy); imagecopy($canvas, $current_image, 0, 0, 0, 0, $current_width, $current_height); imagejpeg($canvas, $new_dummy, 100); } But that doesn't seem to work.
php
image
file
user-profile
null
null
open
copy existing iamge and rename with php === I have a little blackout with the simplest of the simplest. I have a folder called "userpics" and in that folder there are 100x100 profile images named e.g. user-25.jpg. In that folder there also is a picture called user-none.jpg with a silhouette, used as a picture on a comments function when non-registered users posts a comment. What I want to do is when i user is registered the user-none.jpg (with the silhouette) is copied and name e.g. user-26.jpg. The user can then later upload a new profileimage from his account. I just can't figure out how to copy the image. I tried this: function CreateDummyProfileImage($user_id) { $new_dummy = "images/userpics/user-".$user_id.".jpg"; $dummy = "images/userpics/user-none.jpg"; list($current_width, $current_height) = getimagesize($dummy); $this->imageSizeH = 100; $this->imageSizeW = 100; $canvas = imagecreatetruecolor($this->imageSizeW, $this->imageSizeH); $current_image = imagecreatefromjpeg($dummy); imagecopy($canvas, $current_image, 0, 0, 0, 0, $current_width, $current_height); imagejpeg($canvas, $new_dummy, 100); } But that doesn't seem to work.
0
11,327,220
07/04/2012 10:25:32
842,543
07/13/2011 11:03:11
1,134
84
COM based .net plugin framework
I have an ASP.NET MVC3 website which has to work with COM plugins. In order to do that I need to define an interface somehow. As far as I understand(I'm not a COM expert) this can be done either in .NET and export it with tlbexp.exe or idl->midl->tlbimp. I have gone the first way(with tlbexp). I tried IDL too but to no avail(for some reason could cast the implementing COM object back to the tlbimp'ed interface in .NET). This scenario would be simple if my interface didn't have an event on it: public delegate void ItemStatusChanged(string itemGuid, string itemStatus); [ComVisible(true)] [Guid("35202AE5-392D-4015-993D-29966DA5DE31")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface ICOMOutputPlugin { void Method1(string arg); void Method2(string arg); event ItemStatusChanged ItemStatusChanged; } [ComVisible(true)] [Guid("93862C43-503C-4C96-9BAE-944F1087AB77")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface ICOMOutputPluginEvents { void ItemStatusChanged(string itemGuid, string itemStatus); } I have tried to attribute the delegate with `ComVisible(true)` attribute but that would generate a hidden interface _`ItemStatusChanged` in the typelib which will prevent me from implementing the `ICOMOutputPlugin` interface. I export this to tlb with tlbexp.exe and register the .tlb with regtlibv12. Only this type library will be used by the plugin developers to import the interfaces. Now I have a C++ project which will be a plugin, I add in VS2010 new simple ATL object and change the IDL to: importlib("stdole2.tlb"); importlib("MyExp.tlb"); [ uuid(E09BC67A-4192-4CA3-8FD0-5CBFC69B43AC) ] coclass DumpToFileOutputPlugin { [default] interface ICOMOutputPlugin; [default, source] dispinterface ICOMOutputPluginEvents; }; My first problem here was that for some reason I couldn't add the connection point the 'normal way' via class wizard. It simply doesn't show any source interfaces when I direct it to my MyExp.tlb. So I did that manually(used another .tlb and renamed everything). So now I have the COM object with these 2 methods: STDMETHOD(add_ItemStatusChanged)(LPUNKNOWN value); STDMETHOD(remove_ItemStatusChanged)(LPUNKNOWN value); On the .NET side the plugin manager instantiates the plugins like this: Type type = Type.GetTypeFromProgID(progID); comObject = Activator.CreateInstance(type) as ICOMOutputPlugin; comObject.ItemStatusChanged += (guid, status) => ItemStatusChanged(guid, status); the last line miraculously calls the `add_ItemStatusChanged` method on my COM object. Here I'm stuck, what should I don in this method? my current implementation is: HRESULT CDumpToFileOutputPlugin::add_ItemStatusChanged(LPUNKNOWN value) { DWORD cookie; HRESULT ret = Advise(value, &cookie); _com_error err(ret); LPCTSTR errMsg = err.ErrorMessage(); return ret; } ret = 0x80040202 and errMsg says "IDispatch error #2". Any help how to solve this would be appreciated.
c#
.net
com
com-interop
null
null
open
COM based .net plugin framework === I have an ASP.NET MVC3 website which has to work with COM plugins. In order to do that I need to define an interface somehow. As far as I understand(I'm not a COM expert) this can be done either in .NET and export it with tlbexp.exe or idl->midl->tlbimp. I have gone the first way(with tlbexp). I tried IDL too but to no avail(for some reason could cast the implementing COM object back to the tlbimp'ed interface in .NET). This scenario would be simple if my interface didn't have an event on it: public delegate void ItemStatusChanged(string itemGuid, string itemStatus); [ComVisible(true)] [Guid("35202AE5-392D-4015-993D-29966DA5DE31")] [InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface ICOMOutputPlugin { void Method1(string arg); void Method2(string arg); event ItemStatusChanged ItemStatusChanged; } [ComVisible(true)] [Guid("93862C43-503C-4C96-9BAE-944F1087AB77")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface ICOMOutputPluginEvents { void ItemStatusChanged(string itemGuid, string itemStatus); } I have tried to attribute the delegate with `ComVisible(true)` attribute but that would generate a hidden interface _`ItemStatusChanged` in the typelib which will prevent me from implementing the `ICOMOutputPlugin` interface. I export this to tlb with tlbexp.exe and register the .tlb with regtlibv12. Only this type library will be used by the plugin developers to import the interfaces. Now I have a C++ project which will be a plugin, I add in VS2010 new simple ATL object and change the IDL to: importlib("stdole2.tlb"); importlib("MyExp.tlb"); [ uuid(E09BC67A-4192-4CA3-8FD0-5CBFC69B43AC) ] coclass DumpToFileOutputPlugin { [default] interface ICOMOutputPlugin; [default, source] dispinterface ICOMOutputPluginEvents; }; My first problem here was that for some reason I couldn't add the connection point the 'normal way' via class wizard. It simply doesn't show any source interfaces when I direct it to my MyExp.tlb. So I did that manually(used another .tlb and renamed everything). So now I have the COM object with these 2 methods: STDMETHOD(add_ItemStatusChanged)(LPUNKNOWN value); STDMETHOD(remove_ItemStatusChanged)(LPUNKNOWN value); On the .NET side the plugin manager instantiates the plugins like this: Type type = Type.GetTypeFromProgID(progID); comObject = Activator.CreateInstance(type) as ICOMOutputPlugin; comObject.ItemStatusChanged += (guid, status) => ItemStatusChanged(guid, status); the last line miraculously calls the `add_ItemStatusChanged` method on my COM object. Here I'm stuck, what should I don in this method? my current implementation is: HRESULT CDumpToFileOutputPlugin::add_ItemStatusChanged(LPUNKNOWN value) { DWORD cookie; HRESULT ret = Advise(value, &cookie); _com_error err(ret); LPCTSTR errMsg = err.ErrorMessage(); return ret; } ret = 0x80040202 and errMsg says "IDispatch error #2". Any help how to solve this would be appreciated.
0
11,327,221
07/04/2012 10:25:35
1,377,826
05/06/2012 08:45:24
82
1
Button click navigate to another view
I have a button and when ever the user clicks it, i need to show a different view/page (navigate to a different view). For example, Screen A, has a button, and when i click on that button, i need to navigate to Screen B. my code is as follows; onLoginSuccess : function(){ Ext.create('Ext.container.Viewport', { items: [ { xtype: 'screenb' } ] }); } but, what hapence is that, When i click on the Button in Screen A, i navigate to Screen B and also Screen A appears on Screen B. I need to get rid of Screen A (after the user clicks the button and show only screen B)
extjs
extjs4
extjs3
extjs-mvc
extjs4.1
null
open
Button click navigate to another view === I have a button and when ever the user clicks it, i need to show a different view/page (navigate to a different view). For example, Screen A, has a button, and when i click on that button, i need to navigate to Screen B. my code is as follows; onLoginSuccess : function(){ Ext.create('Ext.container.Viewport', { items: [ { xtype: 'screenb' } ] }); } but, what hapence is that, When i click on the Button in Screen A, i navigate to Screen B and also Screen A appears on Screen B. I need to get rid of Screen A (after the user clicks the button and show only screen B)
0
11,261,919
06/29/2012 12:37:37
1,491,153
06/29/2012 12:28:05
1
0
All Pairs Shortest Paths Udaya Kumar Redd Algorithm
Using the algorithm on Page 4 of the following paper, I am attempting to compute an all pairs shortest paths matrix. http://www.waset.org/journals/ijcms/v3/v3-5-43.pdf I am confused by lines 7 and 8 (subsequently, 11 and 12), because assigning s1 the value of j and using both these it the comparison on line 8 seems ambiguous to me. I am wondering if perhaps I am reading the indentation wrong. I am new to algorithms so please be patient with me. while(flag != false){ for(int i=0; i<n;i++){ aMin = Integer.MAX_VALUE; bMin = Integer.MAX_VALUE; for(int j=0; j<n;j++){ if((distanceMatrix[i][j] < aMin) && (j != i) && (BR[i][j] == false)){ aMin = distanceMatrix[i][j]; BR[i][j] = true; a[i] = j; int s1 = j; if(distanceMatrix[i][j] < distanceMatrix[i][s1]) BR[i][s1] = false; } } for(int j=0; j<n; j++){ if((distanceMatrix[i][j] < bMin) && (j != i) && (j != a[i]) && (BR[i][j] == false)){ bMin = distanceMatrix[i][j]; BR[i][j] = true; b[i] = j; int s2 = j; if(distanceMatrix[i][j] < distanceMatrix[i][s2]) BR[i][s2] = false; } } } for(int i=0; i <n; i++){ for(int j=0; j<n; j++){ int t1 = distanceMatrix[i][a[i]] + distanceMatrix[a[i]][j]; int t2 = distanceMatrix[i][b[i]] + distanceMatrix[b[i]][j]; distanceMatrix[i][j] = Math.min(distanceMatrix[i][j], Math.min(t1,t2)); distanceMatrix[j][i] = distanceMatrix[i][j]; } } flag = true; for(int i=0; i<n;i++){ for(int j=0; j<n; j++){ temp[i][j] = distanceMatrix[i][j]; if (distanceMatrix[i][j] == temp[i][j]) flag = false; } } } Additionally, I understand by looking at line 19 and 20 in the algorithm, it will get stuck in a loop because flag will always be true.
java
algorithm
graph
shortest-path
null
null
open
All Pairs Shortest Paths Udaya Kumar Redd Algorithm === Using the algorithm on Page 4 of the following paper, I am attempting to compute an all pairs shortest paths matrix. http://www.waset.org/journals/ijcms/v3/v3-5-43.pdf I am confused by lines 7 and 8 (subsequently, 11 and 12), because assigning s1 the value of j and using both these it the comparison on line 8 seems ambiguous to me. I am wondering if perhaps I am reading the indentation wrong. I am new to algorithms so please be patient with me. while(flag != false){ for(int i=0; i<n;i++){ aMin = Integer.MAX_VALUE; bMin = Integer.MAX_VALUE; for(int j=0; j<n;j++){ if((distanceMatrix[i][j] < aMin) && (j != i) && (BR[i][j] == false)){ aMin = distanceMatrix[i][j]; BR[i][j] = true; a[i] = j; int s1 = j; if(distanceMatrix[i][j] < distanceMatrix[i][s1]) BR[i][s1] = false; } } for(int j=0; j<n; j++){ if((distanceMatrix[i][j] < bMin) && (j != i) && (j != a[i]) && (BR[i][j] == false)){ bMin = distanceMatrix[i][j]; BR[i][j] = true; b[i] = j; int s2 = j; if(distanceMatrix[i][j] < distanceMatrix[i][s2]) BR[i][s2] = false; } } } for(int i=0; i <n; i++){ for(int j=0; j<n; j++){ int t1 = distanceMatrix[i][a[i]] + distanceMatrix[a[i]][j]; int t2 = distanceMatrix[i][b[i]] + distanceMatrix[b[i]][j]; distanceMatrix[i][j] = Math.min(distanceMatrix[i][j], Math.min(t1,t2)); distanceMatrix[j][i] = distanceMatrix[i][j]; } } flag = true; for(int i=0; i<n;i++){ for(int j=0; j<n; j++){ temp[i][j] = distanceMatrix[i][j]; if (distanceMatrix[i][j] == temp[i][j]) flag = false; } } } Additionally, I understand by looking at line 19 and 20 in the algorithm, it will get stuck in a loop because flag will always be true.
0
11,261,926
06/29/2012 12:38:10
1,291,986
03/26/2012 01:03:10
344
3
How similar are Relational Database Languages and Logic Programming?
What are the similarities and differences in terms of the fundamental concepts and implementation between a relational database language `sql` and a logic programming language such as `prolog` and clojure's `core.logic`? Are the two interchangeable?
prolog
relational-database
clojure-core.logic
null
null
null
open
How similar are Relational Database Languages and Logic Programming? === What are the similarities and differences in terms of the fundamental concepts and implementation between a relational database language `sql` and a logic programming language such as `prolog` and clojure's `core.logic`? Are the two interchangeable?
0
11,257,215
06/29/2012 06:43:30
553,486
12/24/2010 18:04:00
141
6
How do you create an Hotspots on an ImageView
I want to create clickable/hotspots on an imageview that when clicked trigger an animation. I have read on several post's that creating "hotspots" on an ImageView is the way to accomplish this but I have not found any working examples that show how it is done. Can someone please provide a small example of how to create a hotspot on an Imageview? Not sure if this has an impact on the design but the images are going to be in an PagerAdapter so the image names will change when the user swipes into the next page.
android
android-ui
null
null
null
null
open
How do you create an Hotspots on an ImageView === I want to create clickable/hotspots on an imageview that when clicked trigger an animation. I have read on several post's that creating "hotspots" on an ImageView is the way to accomplish this but I have not found any working examples that show how it is done. Can someone please provide a small example of how to create a hotspot on an Imageview? Not sure if this has an impact on the design but the images are going to be in an PagerAdapter so the image names will change when the user swipes into the next page.
0
6,617,823
07/07/2011 22:20:58
772,067
05/26/2011 21:14:42
11
0
AJAX SEO (re: faceted search w/ URL hashed state )
I'm reusing an AJAX faceted search framework I wrote for a previous website, which is all AJAX and stores the page state (for browser back button support) in the URL's hash. You can see it in action here w/ something like this: [http://www.carnegiefabrics.com/productsearch.aspx#v={-f-.{-Usage-.[653]_-Color-.[902]}_-p-.1_-s-.--}][1] [1]: http://www.carnegiefabrics.com/productsearch.aspx#v=%7B-f-.%7B-Usage-.%5B653%5D_-Color-.%5B902%5D%7D_-p-.1_-s-.--%7D In this new project I want the contents to be able to be crawled by search engines, so I need the results to render w/o JavaScript -- that is, by the server. NOTE: I don't want to use Google's hash solution (using the '!') because it's too magical and it's Google-only. I'm thinking of having the initial page load (which will have all facets set to "all") render ALL of the results directly from the server. SE will then be able to crawl them. Then, I'll strip the extra results (anything above what should be on page 1) via JavaScript. This will correct the UI for the user, and everything will be AJAX from here. It's a little awkward, but it's the best solution I have currently. What are people's thoughts/suggestions on this approach?
javascript
ajax
url
hash
seo
null
open
AJAX SEO (re: faceted search w/ URL hashed state ) === I'm reusing an AJAX faceted search framework I wrote for a previous website, which is all AJAX and stores the page state (for browser back button support) in the URL's hash. You can see it in action here w/ something like this: [http://www.carnegiefabrics.com/productsearch.aspx#v={-f-.{-Usage-.[653]_-Color-.[902]}_-p-.1_-s-.--}][1] [1]: http://www.carnegiefabrics.com/productsearch.aspx#v=%7B-f-.%7B-Usage-.%5B653%5D_-Color-.%5B902%5D%7D_-p-.1_-s-.--%7D In this new project I want the contents to be able to be crawled by search engines, so I need the results to render w/o JavaScript -- that is, by the server. NOTE: I don't want to use Google's hash solution (using the '!') because it's too magical and it's Google-only. I'm thinking of having the initial page load (which will have all facets set to "all") render ALL of the results directly from the server. SE will then be able to crawl them. Then, I'll strip the extra results (anything above what should be on page 1) via JavaScript. This will correct the UI for the user, and everything will be AJAX from here. It's a little awkward, but it's the best solution I have currently. What are people's thoughts/suggestions on this approach?
0
11,261,927
06/29/2012 12:38:10
1,491,146
06/29/2012 12:25:29
1
0
Write a console program that repeatedly prompts the user to enter data until they type done
Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type and the second dimension contains the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it is acceptable to skip that line. When they type done, do these steps: - display: As Entered - for each entry in the array, display the index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon). - display: Bubble Sorted - using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the second dimension. - display: Selection Sorted - using a selection sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the first dimension.
console
null
null
null
null
06/29/2012 17:19:41
not a real question
Write a console program that repeatedly prompts the user to enter data until they type done === Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type and the second dimension contains the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it is acceptable to skip that line. When they type done, do these steps: - display: As Entered - for each entry in the array, display the index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon). - display: Bubble Sorted - using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the second dimension. - display: Selection Sorted - using a selection sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the first dimension.
1
11,261,928
06/29/2012 12:38:12
1,438,904
03/19/2011 22:28:50
11
1
How to send post data and image file to server Xcode
How can I upload some text info (a text string) and an image file over the same http post request to server. I got images upload by itself, but can't get text to work with it. Thanks!
iphone
objective-c
xcode
null
null
null
open
How to send post data and image file to server Xcode === How can I upload some text info (a text string) and an image file over the same http post request to server. I got images upload by itself, but can't get text to work with it. Thanks!
0
11,261,929
06/29/2012 12:38:16
1,138,658
01/09/2012 12:31:14
851
36
auditing 50 columns using oracle trigger
I need to create a `trigger` in `oracle 11g` for auditing a table . I have a table with `50 columns` that need to be `audited`. - For `every new insert` into a table ,i need to put an entry in `audit table (1 row)`. - For `every update` ,suppose i update `1st 2nd column` ,then it will create two record in audit with its `old value and new value` . *structure of audit table will be* id NOT NULL attribute NOT NULL OLD VALUE NOT NULL NEW VALUE NOT NULL cre_date NOT NULL upd_date NULL cre_time NOT NULL upd_time NULL In case of `insert` ,only the primary key (main table)i.e the `id` and `cre_date and cre_time` need to be populated and `attribute` equal to `*` ,in case of update ,suppose colA and colB is updating then all need to be populated.In this case two records will be created with attribute of first record `colA` and corresponding `old and new` value , and same for the `colB` Now my solution to audit is `not very optimized` , i have created a `row level trigger` ,which will check for each and every 50 columns for that table whether it is been `changed` or not based on its `new and old value` , and it will populate the audit table . I am not satisfied with my soltuion thats why i am posting here. Another solution which i have seen in the link below : `http://stackoverflow.com/questions/1421645/oracle-excluding-updates-of-one-column-for-firing-a-trigger` This is not working in my case , I have done a POC for that as shown below: create table temp12(id number); create or replace trigger my_trigger after update or insert on temp12 for each row declare TYPE tab_col_nt IS table of varchar2(30); v_tab_col_nt tab_col_nt; begin v_tab_col_nt := tab_col_nt('id','name'); for r in v_tab_col_nt.first..v_tab_col_nt.last loop if updating(r) then insert into data_table values(1,'i am updating'||r); else insert into data_table values(2,'i am inserting'||r); end if; end loop; end; In case of updating it is calling the else part i don't know why . Can this be possible through `compound trigger`
oracle
triggers
oracle11g
null
null
null
open
auditing 50 columns using oracle trigger === I need to create a `trigger` in `oracle 11g` for auditing a table . I have a table with `50 columns` that need to be `audited`. - For `every new insert` into a table ,i need to put an entry in `audit table (1 row)`. - For `every update` ,suppose i update `1st 2nd column` ,then it will create two record in audit with its `old value and new value` . *structure of audit table will be* id NOT NULL attribute NOT NULL OLD VALUE NOT NULL NEW VALUE NOT NULL cre_date NOT NULL upd_date NULL cre_time NOT NULL upd_time NULL In case of `insert` ,only the primary key (main table)i.e the `id` and `cre_date and cre_time` need to be populated and `attribute` equal to `*` ,in case of update ,suppose colA and colB is updating then all need to be populated.In this case two records will be created with attribute of first record `colA` and corresponding `old and new` value , and same for the `colB` Now my solution to audit is `not very optimized` , i have created a `row level trigger` ,which will check for each and every 50 columns for that table whether it is been `changed` or not based on its `new and old value` , and it will populate the audit table . I am not satisfied with my soltuion thats why i am posting here. Another solution which i have seen in the link below : `http://stackoverflow.com/questions/1421645/oracle-excluding-updates-of-one-column-for-firing-a-trigger` This is not working in my case , I have done a POC for that as shown below: create table temp12(id number); create or replace trigger my_trigger after update or insert on temp12 for each row declare TYPE tab_col_nt IS table of varchar2(30); v_tab_col_nt tab_col_nt; begin v_tab_col_nt := tab_col_nt('id','name'); for r in v_tab_col_nt.first..v_tab_col_nt.last loop if updating(r) then insert into data_table values(1,'i am updating'||r); else insert into data_table values(2,'i am inserting'||r); end if; end loop; end; In case of updating it is calling the else part i don't know why . Can this be possible through `compound trigger`
0
11,261,936
06/29/2012 12:38:41
268,588
02/08/2010 11:11:02
1,074
19
How Retrieve SelectedID of Telerik RadGrid On Client-Side
How Can I Retrieve SelectedID of Telerik RadGrid On Client-Side Without Using OnRowSelected event? so lets to see my scenarion: my grid properties are like this : <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" DataSourceID="SqlDataSource1" AllowPaging="True" AutoGenerateColumns="False" CellSpacing="0" Width="660px" onitemdatabound="RadGrid1_ItemDataBound"> <ClientSettings Selecting-AllowRowSelect="true"> <Selecting AllowRowSelect="True"></Selecting> <ClientEvents OnRowSelected="OnRowSelected" /> </ClientSettings> ... and goal Column : <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Q column" HeaderText="Q" UniqueName="TemplateColumn_Q"> <ItemTemplate> <asp:Label ID="lblQInsideGrd" runat="server" Font-Size="11px" Text='<%# GetQ(Eval("Q")) %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> i fill this column in code behind like this : protected string GetQ(object Q) { if (Q.ToString().Length < 10) { return Q.ToString(); } else { string Q_str = Q.ToString(); Q_str = Q_str.Substring(0, 10) + "<span style='font-size:9px;color:red;'><a href='#' class='QClick'> (Full View...)</a></span>"; return Q_str; } as you see there is an anchor in every column that i want to retrieve related **ID** filed of that anchor in client side and show that id in an alarm. for server-side we can use CommandName property for that anchor, also when we click on every row we can use OnRowSelected (client side) event to retrieve that id. but in my situation clicking on those anchors will not couse to select the entire row for firing OnRowSelected. so what can i do about that? thanks in advance
c#
asp.net
telerik
client-side
radgrid
null
open
How Retrieve SelectedID of Telerik RadGrid On Client-Side === How Can I Retrieve SelectedID of Telerik RadGrid On Client-Side Without Using OnRowSelected event? so lets to see my scenarion: my grid properties are like this : <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" DataSourceID="SqlDataSource1" AllowPaging="True" AutoGenerateColumns="False" CellSpacing="0" Width="660px" onitemdatabound="RadGrid1_ItemDataBound"> <ClientSettings Selecting-AllowRowSelect="true"> <Selecting AllowRowSelect="True"></Selecting> <ClientEvents OnRowSelected="OnRowSelected" /> </ClientSettings> ... and goal Column : <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Q column" HeaderText="Q" UniqueName="TemplateColumn_Q"> <ItemTemplate> <asp:Label ID="lblQInsideGrd" runat="server" Font-Size="11px" Text='<%# GetQ(Eval("Q")) %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> i fill this column in code behind like this : protected string GetQ(object Q) { if (Q.ToString().Length < 10) { return Q.ToString(); } else { string Q_str = Q.ToString(); Q_str = Q_str.Substring(0, 10) + "<span style='font-size:9px;color:red;'><a href='#' class='QClick'> (Full View...)</a></span>"; return Q_str; } as you see there is an anchor in every column that i want to retrieve related **ID** filed of that anchor in client side and show that id in an alarm. for server-side we can use CommandName property for that anchor, also when we click on every row we can use OnRowSelected (client side) event to retrieve that id. but in my situation clicking on those anchors will not couse to select the entire row for firing OnRowSelected. so what can i do about that? thanks in advance
0
11,261,938
06/29/2012 12:38:52
1,325,893
04/11/2012 07:07:15
1
0
Notification sending in app
I have a web service link which are following: http://01s.in/webservices/gdns/getData.php?db_table=message From this link i want that message tag message are sent to app via a notification when user on notification button from iphone.and also the wifi or net connection is on.If the wifi or net connection is not on then notification would not be generated.I'm search so much for the coding but could not succeeded. Please.thanks in advance.
iphone
ios
null
null
null
07/20/2012 01:53:35
not a real question
Notification sending in app === I have a web service link which are following: http://01s.in/webservices/gdns/getData.php?db_table=message From this link i want that message tag message are sent to app via a notification when user on notification button from iphone.and also the wifi or net connection is on.If the wifi or net connection is not on then notification would not be generated.I'm search so much for the coding but could not succeeded. Please.thanks in advance.
1
11,261,939
06/29/2012 12:39:06
1,268,846
03/14/2012 11:29:28
15
0
directory_iterator file_iter to rename files in a folder
I wanted to rename the files in a directory.There are 52 folders in the directory. Each folder has a different name and has around 40 files in each of them.I wanted to extract the name of a particular folder and attach that name to the name of the files in that particular folder. It worked fine, when there was only 31 or less files in each folder. But whenever the number of files in a particular folder was above 31 the rename algorithm i wrote failed. I am not able to figure out why it crashes when there are more files. Do enlighten me if u understand why...! I'm attaching the code: int main( int argc, char** argv ){ directory_iterator end_iter; directory_iterator file_itr; string inputName; string checkName; inputName.assign(argv[1]); if (is_directory(inputName)) { for (directory_iterator dir_itr(inputName); dir_itr != end_iter; ++dir_itr) { if (is_directory(*dir_itr)) { for (directory_iterator file_itr(*dir_itr); file_itr != end_iter; ++file_itr) { string folderName(dir_itr->path().filename().string()); if (is_regular_file(*file_itr)) { std::string fileType = file_itr->path().extension().string(); std::transform(fileType.begin(), fileType.end(), fileType.begin(), (int(*)(int))std::toupper); if (fileType == ".JPG" || fileType == ".JPEG" || fileType == ".JPG" || fileType == ".PGM") { string filename(file_itr->path().string()); string pathName(file_itr->path().parent_path().string()); string oldName(file_itr->path().filename().string()); cout << folderName << endl; folderName += "_"; folderName += oldName; string newPathName = pathName + "\\" + folderName; cout << pathName <<"\\"<< folderName << endl; //RENAMING function rename(file_itr->path(), path(newPathName.c_str())); } } } } } } }
c++
file-rename
boost-filesystem
null
null
null
open
directory_iterator file_iter to rename files in a folder === I wanted to rename the files in a directory.There are 52 folders in the directory. Each folder has a different name and has around 40 files in each of them.I wanted to extract the name of a particular folder and attach that name to the name of the files in that particular folder. It worked fine, when there was only 31 or less files in each folder. But whenever the number of files in a particular folder was above 31 the rename algorithm i wrote failed. I am not able to figure out why it crashes when there are more files. Do enlighten me if u understand why...! I'm attaching the code: int main( int argc, char** argv ){ directory_iterator end_iter; directory_iterator file_itr; string inputName; string checkName; inputName.assign(argv[1]); if (is_directory(inputName)) { for (directory_iterator dir_itr(inputName); dir_itr != end_iter; ++dir_itr) { if (is_directory(*dir_itr)) { for (directory_iterator file_itr(*dir_itr); file_itr != end_iter; ++file_itr) { string folderName(dir_itr->path().filename().string()); if (is_regular_file(*file_itr)) { std::string fileType = file_itr->path().extension().string(); std::transform(fileType.begin(), fileType.end(), fileType.begin(), (int(*)(int))std::toupper); if (fileType == ".JPG" || fileType == ".JPEG" || fileType == ".JPG" || fileType == ".PGM") { string filename(file_itr->path().string()); string pathName(file_itr->path().parent_path().string()); string oldName(file_itr->path().filename().string()); cout << folderName << endl; folderName += "_"; folderName += oldName; string newPathName = pathName + "\\" + folderName; cout << pathName <<"\\"<< folderName << endl; //RENAMING function rename(file_itr->path(), path(newPathName.c_str())); } } } } } } }
0
11,280,174
07/01/2012 07:00:18
911,164
08/25/2011 04:31:59
107
2
Node.js - When to do HTML escape to JSON data, server or client side?
I'm using Node.js and Underscore.js. I can't determine whether to escape JSON data on server side or client side. For underscore doesn't auto escape interpolated values with syntax `<%= someValue %>` but with `<%- someValue %>`, which is in the contrast to EJS and may causes confusion. There was a [issue][1] on GitHub and also a [commit][2] of auto-escape version. But a comment beneath the issue said: > I'm of the general philosophy that escaping should be done closer to > your data than in the templating language So, any suggestion that when to do HTML escape to AJAX data is better? Here's the server side helper function I have been using: var htmlEscape = function(html){ return String(html) .replace(/&(?!\w+;)/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;'); }; var xss = function(obj) { if (obj instanceof Array) { for (var i = 0; i < obj.length; i++) { obj[i] = xss(obj[i]); } } else { for(var key in obj) { // key != '_id' for mongoose doc if(obj[key] instanceof Object && !(obj[key] instanceof String) && !(obj[key] instanceof Function) && key != '_id') { obj[key] = xss(obj[key]); } else if (obj[key] instanceof String || typeof(obj[key]) == "string") { obj[key] = htmlEscape(obj[key]); } else { obj[key] = obj[key]; } } } return obj; }; Then call it whenever return a JSON: res.json(xss(someData)); [1]: https://github.com/documentcloud/underscore/issues/129 [2]: https://github.com/dvv/underscore/commit/a4f4d30440f52c7cef26e8574e8eae384a66db9f
json
client-side
server-side
underscore.js
html-escape
null
open
Node.js - When to do HTML escape to JSON data, server or client side? === I'm using Node.js and Underscore.js. I can't determine whether to escape JSON data on server side or client side. For underscore doesn't auto escape interpolated values with syntax `<%= someValue %>` but with `<%- someValue %>`, which is in the contrast to EJS and may causes confusion. There was a [issue][1] on GitHub and also a [commit][2] of auto-escape version. But a comment beneath the issue said: > I'm of the general philosophy that escaping should be done closer to > your data than in the templating language So, any suggestion that when to do HTML escape to AJAX data is better? Here's the server side helper function I have been using: var htmlEscape = function(html){ return String(html) .replace(/&(?!\w+;)/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;'); }; var xss = function(obj) { if (obj instanceof Array) { for (var i = 0; i < obj.length; i++) { obj[i] = xss(obj[i]); } } else { for(var key in obj) { // key != '_id' for mongoose doc if(obj[key] instanceof Object && !(obj[key] instanceof String) && !(obj[key] instanceof Function) && key != '_id') { obj[key] = xss(obj[key]); } else if (obj[key] instanceof String || typeof(obj[key]) == "string") { obj[key] = htmlEscape(obj[key]); } else { obj[key] = obj[key]; } } } return obj; }; Then call it whenever return a JSON: res.json(xss(someData)); [1]: https://github.com/documentcloud/underscore/issues/129 [2]: https://github.com/dvv/underscore/commit/a4f4d30440f52c7cef26e8574e8eae384a66db9f
0
11,280,175
07/01/2012 07:00:29
1,493,941
07/01/2012 06:36:34
1
0
Find function argument spec for introspected methods
I'm developing an app using PyGI - Python 2.7 and GTK+ 3 through GObject introspection. How do I find a function's arguments and argument types of functions that are invoked using introspection? Specifically, `Gio.File.replace_contents_async()`. I found that the C definition does not match the one in PyGI ([gio C docs][1]). I've tried using the interactive shell and using help(Gio.File.replace_conents_async) and inspect.getargspec(...), but they just state that it takes vargs. Right now, I keep putting dummy arguments to see what warning or exceptions are printed to see what arguments it needs. Gtk documentation isn't complete, but I've found enough to solve some problems related to it. I started this app using Ubuntu's 'quickly' tool and didn't expect development to be so difficult with PyGI... lack of documentation, no source to look at... [1]: http://developer.gnome.org/gio/stable/GFile.html#g-file-replace-contents-async
python
introspection
pygobject
null
null
null
open
Find function argument spec for introspected methods === I'm developing an app using PyGI - Python 2.7 and GTK+ 3 through GObject introspection. How do I find a function's arguments and argument types of functions that are invoked using introspection? Specifically, `Gio.File.replace_contents_async()`. I found that the C definition does not match the one in PyGI ([gio C docs][1]). I've tried using the interactive shell and using help(Gio.File.replace_conents_async) and inspect.getargspec(...), but they just state that it takes vargs. Right now, I keep putting dummy arguments to see what warning or exceptions are printed to see what arguments it needs. Gtk documentation isn't complete, but I've found enough to solve some problems related to it. I started this app using Ubuntu's 'quickly' tool and didn't expect development to be so difficult with PyGI... lack of documentation, no source to look at... [1]: http://developer.gnome.org/gio/stable/GFile.html#g-file-replace-contents-async
0
11,280,191
07/01/2012 07:05:36
735,469
05/03/2011 04:42:58
1
1
Creating a object from java reflection without knowing the constructor parameters
I am trying to create a collecion of objects using reflection. I have the class name. But at compile time have no idea about the constructor. I used this tutorial. import java.lang.reflect.*; public class constructor2 { public constructor2() { } public constructor2(int a, int b) { System.out.println( "a = " + a + " b = " + b); } public static void main(String args[]) { try { Class cls = Class.forName("constructor2"); Class partypes[] = new Class[2]; partypes[0] = Integer.TYPE; partypes[1] = Integer.TYPE; Constructor ct = cls.getConstructor(partypes); Object arglist[] = new Object[2]; arglist[0] = new Integer(37); arglist[1] = new Integer(47); Object retobj = ct.newInstance(arglist); } catch (Throwable e) { System.err.println(e); } } } Now let's say I don't know abut the parameters of the constructors. (Whether it's a default constructor or two integers). The costructor parameters can change from class to class. I have no idea about the Constructor2 class. But I have the className. So I cant create the "argList" as above. Any idea how I can create a object from constructors then. I did as follows Constructor[] brickConstructorsArray = brickClass.getConstructors(); for (Constructor constructor : brickConstructorsArray) { Class[] constructorParams = constructor.getParameterTypes(); Object argList[] = new Object[constructorParams.length]; int index = 0; for (Class cls : constructorParams) { if (cls.equals(Sprite.class)) { Object spriteOb = foundSprite; argList[index] = spriteOb; } else if (cls.equals(double.class)) { Object dblObj = new Double(0.0); argList[index] = dblObj; } index++; } brickObject = (Brick) constructor.newInstance(argList); } This would work for costrcutors which will have Sprite or double parameters. To include other possibilities I'd have to create a loooong if else chain. Need help.
java
reflection
null
null
null
null
open
Creating a object from java reflection without knowing the constructor parameters === I am trying to create a collecion of objects using reflection. I have the class name. But at compile time have no idea about the constructor. I used this tutorial. import java.lang.reflect.*; public class constructor2 { public constructor2() { } public constructor2(int a, int b) { System.out.println( "a = " + a + " b = " + b); } public static void main(String args[]) { try { Class cls = Class.forName("constructor2"); Class partypes[] = new Class[2]; partypes[0] = Integer.TYPE; partypes[1] = Integer.TYPE; Constructor ct = cls.getConstructor(partypes); Object arglist[] = new Object[2]; arglist[0] = new Integer(37); arglist[1] = new Integer(47); Object retobj = ct.newInstance(arglist); } catch (Throwable e) { System.err.println(e); } } } Now let's say I don't know abut the parameters of the constructors. (Whether it's a default constructor or two integers). The costructor parameters can change from class to class. I have no idea about the Constructor2 class. But I have the className. So I cant create the "argList" as above. Any idea how I can create a object from constructors then. I did as follows Constructor[] brickConstructorsArray = brickClass.getConstructors(); for (Constructor constructor : brickConstructorsArray) { Class[] constructorParams = constructor.getParameterTypes(); Object argList[] = new Object[constructorParams.length]; int index = 0; for (Class cls : constructorParams) { if (cls.equals(Sprite.class)) { Object spriteOb = foundSprite; argList[index] = spriteOb; } else if (cls.equals(double.class)) { Object dblObj = new Double(0.0); argList[index] = dblObj; } index++; } brickObject = (Brick) constructor.newInstance(argList); } This would work for costrcutors which will have Sprite or double parameters. To include other possibilities I'd have to create a loooong if else chain. Need help.
0
11,280,139
07/01/2012 06:54:10
1,444,475
12/28/2009 22:18:52
2,280
3
Floating floats inside float?
I know the title of the question sounds absolutely weird but I had no idea what else to call it. First off I have a grid layout where I want my `.search-wrapper` to be 50% wide and floated right. In my demo on [jsfiddle][1] the entire `.search-wrapper` has a green background color. It's important that this element stays the way it is because it should fit into my grid. Inside this `.search-wrapper` I have a searchbox and a button both floated side by side. This is just how I want it to be. So the `#search-button` should be floated left and the `input` should be aligned right to it. However the thing I can't achieve is how to float both - the `#search-button` and the ´input` to the right inside the outer container `.search-wrapper`. The current status … ![enter image description here][2] The way I'd like it to be …  ![enter image description here][3] Here is a demo of my problem: http://jsfiddle.net/mQSBR/2/ Any ideas on that? Your help is very much appreciated. Thank you! [1]: http://jsfiddle.net/mQSBR/2/ [2]: http://i.stack.imgur.com/EQ8r4.jpg [3]: http://i.stack.imgur.com/jhLHR.jpg
css
css3
css-float
null
null
null
open
Floating floats inside float? === I know the title of the question sounds absolutely weird but I had no idea what else to call it. First off I have a grid layout where I want my `.search-wrapper` to be 50% wide and floated right. In my demo on [jsfiddle][1] the entire `.search-wrapper` has a green background color. It's important that this element stays the way it is because it should fit into my grid. Inside this `.search-wrapper` I have a searchbox and a button both floated side by side. This is just how I want it to be. So the `#search-button` should be floated left and the `input` should be aligned right to it. However the thing I can't achieve is how to float both - the `#search-button` and the ´input` to the right inside the outer container `.search-wrapper`. The current status … ![enter image description here][2] The way I'd like it to be …  ![enter image description here][3] Here is a demo of my problem: http://jsfiddle.net/mQSBR/2/ Any ideas on that? Your help is very much appreciated. Thank you! [1]: http://jsfiddle.net/mQSBR/2/ [2]: http://i.stack.imgur.com/EQ8r4.jpg [3]: http://i.stack.imgur.com/jhLHR.jpg
0
11,386,762
07/08/2012 21:15:48
1,243,525
03/01/2012 19:19:00
1
0
How to make an autocomplete address search text box that retrieves the same result as Android Maps?
I've created an autocomplete address search text box. My problem is that I just can't make it work fine: 1. Addresses are out of the bounding box usually, whatever I do - [this didn't help][1]. 2. Finds addresses that doesn't contain the typed text. 3. Finds less addresses, than max but it doesn't contain the good result. 4. The result list is totally irrelevant sometimes. 5. I need to type almost the whole address to get the correct result. Source: Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List<Address> addresses = null; try { // Bounding box: Hungary addresses = geocoder.getFromLocationName(text, 5, 46.13, 21.96, 48.89, 16.69); } catch (IOException e) { Log.v(tag, "Geocoding error: " + e.getMessage()); e.printStackTrace(); } My aim is to make an address search text box which gets the same result as in Android Maps seach text box - except the previously typed/favourite addresses and etc., which is an other story. [1]: http://stackoverflow.com/questions/6488890/android-getfromlocationname-return-results-outside-the-bounding-box
android
map
autocomplete
textbox
null
null
open
How to make an autocomplete address search text box that retrieves the same result as Android Maps? === I've created an autocomplete address search text box. My problem is that I just can't make it work fine: 1. Addresses are out of the bounding box usually, whatever I do - [this didn't help][1]. 2. Finds addresses that doesn't contain the typed text. 3. Finds less addresses, than max but it doesn't contain the good result. 4. The result list is totally irrelevant sometimes. 5. I need to type almost the whole address to get the correct result. Source: Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List<Address> addresses = null; try { // Bounding box: Hungary addresses = geocoder.getFromLocationName(text, 5, 46.13, 21.96, 48.89, 16.69); } catch (IOException e) { Log.v(tag, "Geocoding error: " + e.getMessage()); e.printStackTrace(); } My aim is to make an address search text box which gets the same result as in Android Maps seach text box - except the previously typed/favourite addresses and etc., which is an other story. [1]: http://stackoverflow.com/questions/6488890/android-getfromlocationname-return-results-outside-the-bounding-box
0
11,386,768
07/08/2012 21:16:13
518,551
11/24/2010 09:36:23
1,448
39
XNA for Windows development
Last time I looked at XNA it was at version 4 and you could use it to develop C# games that ran on Windows, or Windows Phone, or Xbox 360. Just been poking around again and I can't get any sense out of what the current state of play is. The emphasis is very very much on Windows phone 7.5, then to a lesser extent 360, and for Windows you just get pointed at the DirectX SDK. Has it been re-envisioned again? At some point I remember the C# version disappeared and you only had the C++ version, I sort of lost interest then. Thanks
xna
null
null
null
null
null
open
XNA for Windows development === Last time I looked at XNA it was at version 4 and you could use it to develop C# games that ran on Windows, or Windows Phone, or Xbox 360. Just been poking around again and I can't get any sense out of what the current state of play is. The emphasis is very very much on Windows phone 7.5, then to a lesser extent 360, and for Windows you just get pointed at the DirectX SDK. Has it been re-envisioned again? At some point I remember the C# version disappeared and you only had the C++ version, I sort of lost interest then. Thanks
0
11,386,774
07/08/2012 21:16:44
1,446,477
06/09/2012 17:30:08
46
2
array of custom type arrays
I have defined a new class type called `Hotspot`. I need 2 dynamic array of Hotspot (I used List<T>) and a third one that allow me to "switch" between them. Here my code: List<Hotspot> items = new List<Hotspot>(); List<Hotspot> locations = new List<Hotspot>(); Hotspot[][] arrays = new Hotspot[][]{items, locations}; but `arrays` doesn't work. I just need it so I can easily access to `items/locations` array. In F# I did it in this way: let mutable items = new ResizeArray<Hotspot>() let mutable locations = new ResizeArray<Hotspot>() let arrays = [|items; locations|] but I can't do the same thing in C#. Some help?
c#
.net
arrays
null
null
null
open
array of custom type arrays === I have defined a new class type called `Hotspot`. I need 2 dynamic array of Hotspot (I used List<T>) and a third one that allow me to "switch" between them. Here my code: List<Hotspot> items = new List<Hotspot>(); List<Hotspot> locations = new List<Hotspot>(); Hotspot[][] arrays = new Hotspot[][]{items, locations}; but `arrays` doesn't work. I just need it so I can easily access to `items/locations` array. In F# I did it in this way: let mutable items = new ResizeArray<Hotspot>() let mutable locations = new ResizeArray<Hotspot>() let arrays = [|items; locations|] but I can't do the same thing in C#. Some help?
0
11,386,775
07/08/2012 21:16:47
937,440
09/09/2011 19:28:21
481
11
.NET Function scope shadowing
I have seen some code like this (not on consecutive lines, but in the same function scope): Dim con1 As SqlConnection con1 = New SqlConnection 'More code here con1 = New SqlConnection con1 = Nothing I believe this is just a bug, but I wanted to check that there is not a form of shadowing going on here that I am unaware of. What happens to the first con1 variable? I assume it is inaccessible as there is no reference to the object.
asp.net
.net
null
null
null
null
open
.NET Function scope shadowing === I have seen some code like this (not on consecutive lines, but in the same function scope): Dim con1 As SqlConnection con1 = New SqlConnection 'More code here con1 = New SqlConnection con1 = Nothing I believe this is just a bug, but I wanted to check that there is not a form of shadowing going on here that I am unaware of. What happens to the first con1 variable? I assume it is inaccessible as there is no reference to the object.
0
11,386,719
07/08/2012 21:08:57
915,824
08/27/2011 19:51:05
163
4
Display countdown timer with bar on screen
I want to want to create a countdown timer with a progress bar (a backwards progress bar). I want it to tell me when it reached the end of the time and I want to be able to stop and restart it whenever I want. Is there an easy way to do it?
objective-c
ios
xcode
null
null
null
open
Display countdown timer with bar on screen === I want to want to create a countdown timer with a progress bar (a backwards progress bar). I want it to tell me when it reached the end of the time and I want to be able to stop and restart it whenever I want. Is there an easy way to do it?
0
11,386,777
07/08/2012 21:17:10
1,166,285
01/24/2012 04:42:36
478
30
Is there any jquery to detect if the html tag was not closed? or page has not completely loaded?
I'm experiencing an issue (which I still need to fix) where my entire page does not load. It gets cut off in the middle of an element. Is there a way using jquery or javscript to do something like: if (some element has not loaded yet) {refresh the page} I was thinking of just putting `<div id="end_of_page"></div>` at the bottom of the page, and checking if that was rendered, if not, i'll know something went wrong and can reload to try again. thanks!!
javascript
jquery
load
onload
null
null
open
Is there any jquery to detect if the html tag was not closed? or page has not completely loaded? === I'm experiencing an issue (which I still need to fix) where my entire page does not load. It gets cut off in the middle of an element. Is there a way using jquery or javscript to do something like: if (some element has not loaded yet) {refresh the page} I was thinking of just putting `<div id="end_of_page"></div>` at the bottom of the page, and checking if that was rendered, if not, i'll know something went wrong and can reload to try again. thanks!!
0
11,386,778
07/08/2012 21:17:19
496,999
08/26/2010 16:15:41
61
2
Pull from gitolite in cron job
I want to setup a cron job that makes a production site pull from a gitolite repository. The following command works in a non-cron-context: # m h dom mon dow command * * * * * cd /home/www/test/autopulling-site/ && /usr/bin/git fetch && /usr/bin/git pull I am suspecting that the git operation doesn't work due to the SSH key not being sent correctly in a cron context. The logs show nothing. Any ideas?
git
ssh
cron
gitolite
null
null
open
Pull from gitolite in cron job === I want to setup a cron job that makes a production site pull from a gitolite repository. The following command works in a non-cron-context: # m h dom mon dow command * * * * * cd /home/www/test/autopulling-site/ && /usr/bin/git fetch && /usr/bin/git pull I am suspecting that the git operation doesn't work due to the SSH key not being sent correctly in a cron context. The logs show nothing. Any ideas?
0
11,386,793
07/08/2012 21:19:50
1,385,368
05/09/2012 18:27:24
32
0
Disabled DropDownList in Cascade MVC 3
I have two DropDownList in cascade DD2 dependent on DD1. how do I disable the DD2 if the D1 does not contain data for the selected item? $(function () { $('#DD1').change(function () { var selected1 = $(this).val(); $.getJSON('@Url.Action("GetCiudadList", "ConsultorioSuper", new { Area = "Superusuario", controller = "Consultorio" })', { IdDD: selected }, function (myData) { var Select2 = $('#DD2'); Select2.empty(); $.each(myData, function (index, itemData) { citiesSelect.append($('<option/>', { value: itemData.Value, text: itemData.Text })); }); }); }); }) @Html.DropDownListFor(x => x.SelectedId1, new SelectList(ViewBag.IdUniversidad, "Id1", "Name"), "-- Select --", new { id = "DD1" }) @Html.DropDownListFor(x => x.SelectedId2, new SelectList(Enumerable.Empty<SelectListItem>(), "Id2", "Name"), "-- Select --", new { id = "DD2" }) Blessings
javascript
asp.net-mvc-3
null
null
null
null
open
Disabled DropDownList in Cascade MVC 3 === I have two DropDownList in cascade DD2 dependent on DD1. how do I disable the DD2 if the D1 does not contain data for the selected item? $(function () { $('#DD1').change(function () { var selected1 = $(this).val(); $.getJSON('@Url.Action("GetCiudadList", "ConsultorioSuper", new { Area = "Superusuario", controller = "Consultorio" })', { IdDD: selected }, function (myData) { var Select2 = $('#DD2'); Select2.empty(); $.each(myData, function (index, itemData) { citiesSelect.append($('<option/>', { value: itemData.Value, text: itemData.Text })); }); }); }); }) @Html.DropDownListFor(x => x.SelectedId1, new SelectList(ViewBag.IdUniversidad, "Id1", "Name"), "-- Select --", new { id = "DD1" }) @Html.DropDownListFor(x => x.SelectedId2, new SelectList(Enumerable.Empty<SelectListItem>(), "Id2", "Name"), "-- Select --", new { id = "DD2" }) Blessings
0
11,386,795
07/08/2012 21:20:02
780,392
06/02/2011 01:30:30
36
0
Drag and drop crossfading using Javascript
I'm looking to drag and drop a png image over another png image in the fashion of a cross fade using Javascript. I researched a little and could only come across similar situations but the ones I found were mostly automatic (couldn't do manual drag and drop) and they were fading, not cross fading. I'm just wondering, does anyone have any ideas as to what is the best way to approach this situation and try to develop this feature? Thanks
javascript
drag
drop
fading
null
null
open
Drag and drop crossfading using Javascript === I'm looking to drag and drop a png image over another png image in the fashion of a cross fade using Javascript. I researched a little and could only come across similar situations but the ones I found were mostly automatic (couldn't do manual drag and drop) and they were fading, not cross fading. I'm just wondering, does anyone have any ideas as to what is the best way to approach this situation and try to develop this feature? Thanks
0
11,386,796
07/08/2012 21:20:18
1,510,583
07/08/2012 21:17:25
1
0
How far can we customize/tweak Yahoo Mail?
With the help of Yahoo Mail Application Platform, can we:<br> 1. tweak/customize the UI of Y! Mail (for instance, addition of one more send button which lets you send scheduled mails)<br> 2. add some more functionality to Y! Mail like automated follow-up mails, scheduled mails, read receipts, Rapportive like plugin in Yahoo Mail, etc.<br> Thanks
yahoo-mail
null
null
null
null
null
open
How far can we customize/tweak Yahoo Mail? === With the help of Yahoo Mail Application Platform, can we:<br> 1. tweak/customize the UI of Y! Mail (for instance, addition of one more send button which lets you send scheduled mails)<br> 2. add some more functionality to Y! Mail like automated follow-up mails, scheduled mails, read receipts, Rapportive like plugin in Yahoo Mail, etc.<br> Thanks
0
11,386,797
07/08/2012 21:20:34
1,448,859
06/11/2012 11:43:13
26
1
instant binding method
I have this simple app for rebar selection. I have used bindings to set the connections and also there are some data called at the start from array controller. I am running this method after button calculate is pressed which gets the values from NSForm cell and use it for further calculation: -(IBAction)calculate:(id)sender{ NSArray *editFields = [formular cells]; int vArea; vArea = [[editFields objectAtIndex:1] intValue]; NSMutableString *select = [NSMutableString stringWithFormat:@"You selected %d + 25 = %d",vArea,vArea+25]; [selected setStringValue:select]; } It is running ok however I would like to run this code instantly after row in table is selected so I do not need that button there but I do not know which method to use as I am still learning. ![scrennshot][1] [1]: http://i.stack.imgur.com/P4A7j.png
objective-c
cocoa
nstableview
cocoa-bindings
null
null
open
instant binding method === I have this simple app for rebar selection. I have used bindings to set the connections and also there are some data called at the start from array controller. I am running this method after button calculate is pressed which gets the values from NSForm cell and use it for further calculation: -(IBAction)calculate:(id)sender{ NSArray *editFields = [formular cells]; int vArea; vArea = [[editFields objectAtIndex:1] intValue]; NSMutableString *select = [NSMutableString stringWithFormat:@"You selected %d + 25 = %d",vArea,vArea+25]; [selected setStringValue:select]; } It is running ok however I would like to run this code instantly after row in table is selected so I do not need that button there but I do not know which method to use as I am still learning. ![scrennshot][1] [1]: http://i.stack.imgur.com/P4A7j.png
0
11,386,799
07/08/2012 21:21:06
951,517
09/18/2011 18:14:57
249
30
Is PHP allocating memory for each new class that extend the same parent?
I am wondering if PHP will re-use the Parent class. With the following code: // File parent.php class Parent { $public foo = ''; public function __construct($args) { // .. } // .. some functions } // File child1.php class Child1 extends Parent { public function __construct() { } // .. Some overridden function // .. some extra functions } // File child2.php class Child2 extends Parent { public function __construct() { } // .. some extra functions } Now to use either Child1 or Child2 you need to include the parent.php and childN.php. If I only use Child1 I can imagine they are somehow concatenated into a single being. However if I use Child2 on the same page.. would I get 2 'concatenated' beings, that gobble on memory or is PHP super smart and able to see this and only use/load/whatever the Parent only once. This example is pretty simplified, but the Parent is pretty big and there are plenty of children!
php
null
null
null
null
null
open
Is PHP allocating memory for each new class that extend the same parent? === I am wondering if PHP will re-use the Parent class. With the following code: // File parent.php class Parent { $public foo = ''; public function __construct($args) { // .. } // .. some functions } // File child1.php class Child1 extends Parent { public function __construct() { } // .. Some overridden function // .. some extra functions } // File child2.php class Child2 extends Parent { public function __construct() { } // .. some extra functions } Now to use either Child1 or Child2 you need to include the parent.php and childN.php. If I only use Child1 I can imagine they are somehow concatenated into a single being. However if I use Child2 on the same page.. would I get 2 'concatenated' beings, that gobble on memory or is PHP super smart and able to see this and only use/load/whatever the Parent only once. This example is pretty simplified, but the Parent is pretty big and there are plenty of children!
0
11,713,301
07/29/2012 21:55:27
1,560,813
07/29/2012 10:19:20
1
0
jquery slider priority, slider over menu
I have a wordpress site, and I added a query slider on it. Now the nav menu drop down menu has lower priority then the slider so the slider shows over the drop down menu. How do you change the priority? This is the jquery source of the slider http://pastebin.com/qgSkW2tD
php
javascript
jquery
html
css
null
open
jquery slider priority, slider over menu === I have a wordpress site, and I added a query slider on it. Now the nav menu drop down menu has lower priority then the slider so the slider shows over the drop down menu. How do you change the priority? This is the jquery source of the slider http://pastebin.com/qgSkW2tD
0
11,713,306
07/29/2012 21:56:29
1,011,816
10/24/2011 23:13:35
667
1
How can I remove children in jQuery?
In the following example http://jsfiddle.net/pDsGF/ I want to remove just class 'child' from class 'parent'. I have tried `.remove($('parent').children('child'))`​ But it doesn't work
jquery
null
null
null
null
null
open
How can I remove children in jQuery? === In the following example http://jsfiddle.net/pDsGF/ I want to remove just class 'child' from class 'parent'. I have tried `.remove($('parent').children('child'))`​ But it doesn't work
0
11,713,320
07/29/2012 21:58:20
164,770
08/28/2009 10:15:30
138
4
LSP: conditional creation of objects
I'd like to know if I follow the right path, because I feel that the following code is wrong. Sorry, I didn't know how to name properly this question. I have a certain ShapeEntity class that is used for loading data from DB. There is other concrete classes for Shape (I can have many of them in the future) so I want to employ LSP to draw these shapes, that's why I use IShape abstraction. I instantiate concrete shape objects by using DB info which is provided by ShapeEntity. So my concern lies inside Main() function where I create these Shapes just using simple if-else. Is this correct approach to create "unknown" objects using if-else block? Maybe I could carry out creation of Shape objects to some kind of ShapeService? How could it be solved the other way? public class ShapeEntity { int idShape { get; set; } } public interface IShape { void Draw(); } public class Square : IShape { public void Draw() { } } public class Rectangle : IShape { public void Draw() { } } public class Canvas() { public static void Main() { List<IShape> Shapes = new List<IShape>(); foreach(ShapeEntity ShapeItem in ShapeRepository.GetAll()) { if(ShapeItem.idShape == 1) { Shapes.Add(new Square()); } else if(ShapeItem.idShape == 2) { Shapes.Add(new Rectangle()); } } } public void DrawShapesOnCanvas(IList<IShape> Shapes) { foreach(IShape Shape in Shapes) { Shape.Draw(); } } }
c#
oop
null
null
null
null
open
LSP: conditional creation of objects === I'd like to know if I follow the right path, because I feel that the following code is wrong. Sorry, I didn't know how to name properly this question. I have a certain ShapeEntity class that is used for loading data from DB. There is other concrete classes for Shape (I can have many of them in the future) so I want to employ LSP to draw these shapes, that's why I use IShape abstraction. I instantiate concrete shape objects by using DB info which is provided by ShapeEntity. So my concern lies inside Main() function where I create these Shapes just using simple if-else. Is this correct approach to create "unknown" objects using if-else block? Maybe I could carry out creation of Shape objects to some kind of ShapeService? How could it be solved the other way? public class ShapeEntity { int idShape { get; set; } } public interface IShape { void Draw(); } public class Square : IShape { public void Draw() { } } public class Rectangle : IShape { public void Draw() { } } public class Canvas() { public static void Main() { List<IShape> Shapes = new List<IShape>(); foreach(ShapeEntity ShapeItem in ShapeRepository.GetAll()) { if(ShapeItem.idShape == 1) { Shapes.Add(new Square()); } else if(ShapeItem.idShape == 2) { Shapes.Add(new Rectangle()); } } } public void DrawShapesOnCanvas(IList<IShape> Shapes) { foreach(IShape Shape in Shapes) { Shape.Draw(); } } }
0
11,713,326
07/29/2012 21:59:10
1,514,165
07/10/2012 08:27:16
44
2
How to change label value by jquery
My ASP.NET page includes: < asp:Label ID="lblDoc" runat="server" Text="Label" Visible="true"></asp:Label> I want to change the value by using javascript / jquery. $("#<%=lblDoc.ClientID%>").val("Hello World"); but it doesn't work? Have you got any idea? Is it wrong?
javascript
jquery
asp.net
null
null
null
open
How to change label value by jquery === My ASP.NET page includes: < asp:Label ID="lblDoc" runat="server" Text="Label" Visible="true"></asp:Label> I want to change the value by using javascript / jquery. $("#<%=lblDoc.ClientID%>").val("Hello World"); but it doesn't work? Have you got any idea? Is it wrong?
0
11,713,332
07/29/2012 21:59:33
359,248
06/05/2010 14:57:24
121
3
How to look for required methods in a protocol?
This is what I do. While looking up an apple documentation of protocol in Chrome or Xcode, I Cmd-F searching for "required". If result is zero, I conclude that all methods in that protocol are optional. Am I doing it right? Or is there any "formal" way?
cocoa-touch
documentation
protocols
null
null
null
open
How to look for required methods in a protocol? === This is what I do. While looking up an apple documentation of protocol in Chrome or Xcode, I Cmd-F searching for "required". If result is zero, I conclude that all methods in that protocol are optional. Am I doing it right? Or is there any "formal" way?
0
11,409,550
07/10/2012 08:38:08
1,107,474
12/20/2011 09:18:33
800
0
Composition vs reducing coupling?
I am getting a little confused between using objects as attributes within other objects (and invoking methods on the attribute) using composition, versus having a good overall coupling. Is there a tradeoff here? Perhaps its easier giving examples of bad coupling to explain the difference (if there is a difference)?
java
oop
composition
null
null
null
open
Composition vs reducing coupling? === I am getting a little confused between using objects as attributes within other objects (and invoking methods on the attribute) using composition, versus having a good overall coupling. Is there a tradeoff here? Perhaps its easier giving examples of bad coupling to explain the difference (if there is a difference)?
0
11,410,155
07/10/2012 09:15:17
1,384,480
05/09/2012 11:45:12
11
1
Apache CXF client with Spring MVC - BindingInfo is not SOAPBindingInfo
I am working on a spring MVC project, from which I need to access a webservice(client mode) My web service client is a different maven project which is working fine from its JUnit test cases. When i add this as a dependency to my Spring MVC project and access the jar file, I am getting the following exception. Jul 10, 2012 2:40:09 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [rest] in context with path [/mdot] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo] with root cause java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo at org.apache.cxf.binding.soap.SoapBindingFactory.createBinding(SoapBindingFactory.java:385) at org.apache.cxf.endpoint.EndpointImpl.createBinding(EndpointImpl.java:135) at org.apache.cxf.endpoint.EndpointImpl.<init>(EndpointImpl.java:82) at org.apache.cxf.jaxws.support.JaxWsEndpointImpl.<init>(JaxWsEndpointImpl.java:125) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createEndpoint(JaxWsServiceFactoryBean.java:235) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createEndpoints(ReflectionServiceFactoryBean.java:328) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:260) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:153) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:151) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318) at javax.xml.ws.Service.getPort(Service.java:119) at com.test.wsdl.MyWebServiceSOAP_Service.getMyWebServiceSOAPPort(MyWebServiceSOAP_Service.java:63)
web-services
spring
spring-mvc
cxf
dispatcher
null
open
Apache CXF client with Spring MVC - BindingInfo is not SOAPBindingInfo === I am working on a spring MVC project, from which I need to access a webservice(client mode) My web service client is a different maven project which is working fine from its JUnit test cases. When i add this as a dependency to my Spring MVC project and access the jar file, I am getting the following exception. Jul 10, 2012 2:40:09 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [rest] in context with path [/mdot] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo] with root cause java.lang.RuntimeException: Can not initialize SoapBinding, BindingInfo is not SoapBindingInfo at org.apache.cxf.binding.soap.SoapBindingFactory.createBinding(SoapBindingFactory.java:385) at org.apache.cxf.endpoint.EndpointImpl.createBinding(EndpointImpl.java:135) at org.apache.cxf.endpoint.EndpointImpl.<init>(EndpointImpl.java:82) at org.apache.cxf.jaxws.support.JaxWsEndpointImpl.<init>(JaxWsEndpointImpl.java:125) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createEndpoint(JaxWsServiceFactoryBean.java:235) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createEndpoints(ReflectionServiceFactoryBean.java:328) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:260) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90) at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:153) at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:151) at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331) at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318) at javax.xml.ws.Service.getPort(Service.java:119) at com.test.wsdl.MyWebServiceSOAP_Service.getMyWebServiceSOAPPort(MyWebServiceSOAP_Service.java:63)
0
11,410,156
07/10/2012 09:15:21
1,514,081
07/10/2012 07:57:34
1
0
file_get_contents - Resize - and save it to folder
Please i do really need help. I want to retrieve image from a URL, resize it and save it to folder. I have this script to retrieve image from url : $url = 'http://www.example.com/image/test.jpg'; $img = 'images/newtest.jpg'; file_put_contents($img, file_get_contents($url)); The problem is that before i file_put_contents, i want to resize the image. How can I do it with php ? Please Help me, i search on the internet but ended up with unclear explanation. Btw I am newbie. Thanks all..
php
file-get-contents
null
null
null
null
open
file_get_contents - Resize - and save it to folder === Please i do really need help. I want to retrieve image from a URL, resize it and save it to folder. I have this script to retrieve image from url : $url = 'http://www.example.com/image/test.jpg'; $img = 'images/newtest.jpg'; file_put_contents($img, file_get_contents($url)); The problem is that before i file_put_contents, i want to resize the image. How can I do it with php ? Please Help me, i search on the internet but ended up with unclear explanation. Btw I am newbie. Thanks all..
0
11,393,536
07/09/2012 10:47:24
544,685
12/16/2010 11:33:43
116
3
Parsing request.request_parameters in Rails
I'm building a web service app and I'm trying to handle nicely a 422 page sending back to the user the JSON the POSTed to better debug the error. To do this, I use request.request_parameters which get me back the JSON I sent, but it happens to be organized (for me) in a wired way and I can't really get it back only with the original data What I send as JSON is this. { "name":"New set intensity", "properties": [ {"uri":null,"value":"on"}, {"uri":"https://type.lelylan.com/properties/intensity","value":"100.0"} ] } What I get from request.request_parameters is this. {"{\"name\":\"New set intensity\",\"properties\":"=>{"{\"uri\":null,\"value\":\"on\"}, {\"uri\":\"https://type.lelylan.com/properties/intensity\",\"value\":\"100.0\"}"=>{"}"=>nil}}} My main problem is that somehow the content becomes the key, and this recursively inside. Is there a way to get back the clean data? Thanks a lot.
ruby-on-rails-3
null
null
null
null
null
open
Parsing request.request_parameters in Rails === I'm building a web service app and I'm trying to handle nicely a 422 page sending back to the user the JSON the POSTed to better debug the error. To do this, I use request.request_parameters which get me back the JSON I sent, but it happens to be organized (for me) in a wired way and I can't really get it back only with the original data What I send as JSON is this. { "name":"New set intensity", "properties": [ {"uri":null,"value":"on"}, {"uri":"https://type.lelylan.com/properties/intensity","value":"100.0"} ] } What I get from request.request_parameters is this. {"{\"name\":\"New set intensity\",\"properties\":"=>{"{\"uri\":null,\"value\":\"on\"}, {\"uri\":\"https://type.lelylan.com/properties/intensity\",\"value\":\"100.0\"}"=>{"}"=>nil}}} My main problem is that somehow the content becomes the key, and this recursively inside. Is there a way to get back the clean data? Thanks a lot.
0
11,393,537
07/09/2012 10:47:25
1,511,719
07/09/2012 10:36:11
1
0
Using Visual Studio 2010 for Sharepoint 2010 development
I am a newbie to SharePoint 2010 development, even though am a .net developer for past 3 years. I have setup development env with windows 7(64-bit), sharepoint foundation 2010, visual studio 2010, and sql server 2001 R2 in a virtual machine. As a beginning, I created a new web application in SharePoint 2010 and also created new site collection. Then I created a custom list for student details. Now I need to create a simple student registration page which validate all the user entries for example email id, phone number etc using regular expression and few fields using required field validator. I need to how can I use Visual Studio 2010 for this purpose. Please consider this as an entry level question in SharePoint 2010 development. Hope this question fits right in this forum.
visual-studio-2010
sharepoint2010
null
null
null
null
open
Using Visual Studio 2010 for Sharepoint 2010 development === I am a newbie to SharePoint 2010 development, even though am a .net developer for past 3 years. I have setup development env with windows 7(64-bit), sharepoint foundation 2010, visual studio 2010, and sql server 2001 R2 in a virtual machine. As a beginning, I created a new web application in SharePoint 2010 and also created new site collection. Then I created a custom list for student details. Now I need to create a simple student registration page which validate all the user entries for example email id, phone number etc using regular expression and few fields using required field validator. I need to how can I use Visual Studio 2010 for this purpose. Please consider this as an entry level question in SharePoint 2010 development. Hope this question fits right in this forum.
0
11,410,158
07/10/2012 09:15:26
536,105
12/09/2010 08:11:29
71
1
Execute Ruby code in sublime text 2
How can I run a Ruby file with ST2 and see the ouput? I thought I should use the build command. But if I have this: def foobar "hello world" end puts foobar and then press cmd + shift + b. All I see is [Finished in 0.1s] In textmate I could use the cmd + r (run command) and see all the ouput from the ruby script. I'm I missing something?
ruby
sublimetext2
null
null
null
null
open
Execute Ruby code in sublime text 2 === How can I run a Ruby file with ST2 and see the ouput? I thought I should use the build command. But if I have this: def foobar "hello world" end puts foobar and then press cmd + shift + b. All I see is [Finished in 0.1s] In textmate I could use the cmd + r (run command) and see all the ouput from the ruby script. I'm I missing something?
0
11,650,139
07/25/2012 12:51:14
461,887
09/29/2010 15:06:38
459
13
CSS link attributes in classes .net
How can you specify link attributes inside a class in main.css. The standard link attribute is fine when put in a non defined area of the CSS file. a:link { color:white } However if I want to create a class so that I am only defining how the attributes apply to a menu it errors as a syntax error. For example. menuLinks { a:link { color:white } } Will show as an error, so how can I define link attributes within a class. I am using visual web developer 2010
asp.net
null
null
null
null
null
open
CSS link attributes in classes .net === How can you specify link attributes inside a class in main.css. The standard link attribute is fine when put in a non defined area of the CSS file. a:link { color:white } However if I want to create a class so that I am only defining how the attributes apply to a menu it errors as a syntax error. For example. menuLinks { a:link { color:white } } Will show as an error, so how can I define link attributes within a class. I am using visual web developer 2010
0
11,650,218
07/25/2012 12:56:22
1,534,682
07/18/2012 11:54:16
27
0
Android: LinkedIn OAuth Callback not Working
I'm using LinkedIn `OAuth` in my Android app. I've an LinkedIn application, consumer key and secret already, an as a result I can request succesfully. Everything is fine until callback. The web page not calling back, I mean `onNewIntent` or `onResume` methods not calling. Web page only shows callback url with parameters. I mean it looks like: callback_url://?oauth_token=324sdf&oath_verifier=as21dsf Here is my all code: try { consumer = new CommonsHttpOAuthConsumer("ConsumerKey", "ConsumerSecret"); provider = new CommonsHttpOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken", "https://api.linkedin.com/uas/oauth/accessToken", "https://api.linkedin.com/uas/oauth/authorize"); final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } Activity is already defined as `singleInstance` in `Manifest`. What's wrong or missing?
android
oauth
null
null
null
null
open
Android: LinkedIn OAuth Callback not Working === I'm using LinkedIn `OAuth` in my Android app. I've an LinkedIn application, consumer key and secret already, an as a result I can request succesfully. Everything is fine until callback. The web page not calling back, I mean `onNewIntent` or `onResume` methods not calling. Web page only shows callback url with parameters. I mean it looks like: callback_url://?oauth_token=324sdf&oath_verifier=as21dsf Here is my all code: try { consumer = new CommonsHttpOAuthConsumer("ConsumerKey", "ConsumerSecret"); provider = new CommonsHttpOAuthProvider("https://api.linkedin.com/uas/oauth/requestToken", "https://api.linkedin.com/uas/oauth/accessToken", "https://api.linkedin.com/uas/oauth/authorize"); final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } Activity is already defined as `singleInstance` in `Manifest`. What's wrong or missing?
0
11,650,219
07/25/2012 12:56:23
1,551,672
07/25/2012 12:54:56
1
0
What do you call the => symbol on arrays?
I can't seem to find the answer on google.
php
c++
arrays
null
null
null
open
What do you call the => symbol on arrays? === I can't seem to find the answer on google.
0
11,650,222
07/25/2012 12:56:29
146,622
07/28/2009 19:08:12
1,516
61
Minimum number of bytes that can contain an integer value
Given an integer value, I need some way to find out the minimum number of bytes needed to store the value. The value may be _signed or unsigned, up to 64-bit_. Also take the sign bit into account for signed integers. For example: 8 requires 1 byte at minimum unsigned 255 requires 1 byte at minimum signed 255 requires 2 bytes at minimum 4351 requires 2 bytes at minimum -4294967296 requires 5 bytes at minimum I can think of a quick-and-dirty way to solve this, using many if-statements, but there might be better (e.g. simpler, cleverer, faster) ways to do this.
c#
integer
bit-manipulation
bit-twiddling
null
null
open
Minimum number of bytes that can contain an integer value === Given an integer value, I need some way to find out the minimum number of bytes needed to store the value. The value may be _signed or unsigned, up to 64-bit_. Also take the sign bit into account for signed integers. For example: 8 requires 1 byte at minimum unsigned 255 requires 1 byte at minimum signed 255 requires 2 bytes at minimum 4351 requires 2 bytes at minimum -4294967296 requires 5 bytes at minimum I can think of a quick-and-dirty way to solve this, using many if-statements, but there might be better (e.g. simpler, cleverer, faster) ways to do this.
0
11,650,223
07/25/2012 12:56:30
483,199
10/21/2010 15:05:32
10
0
HtmlTextWriter creating table rows dynamically
I'm creating a umbraco website where the user can login. On this login page I want to show him/her the workshops the user signed up for. That is done through a user control. If the user has registered for any workshops, it should create table-rows matching with the number of workshops - if not, the usercontrol should display a simple message. I'm outputting the table-rows with htmlTextWriter, however it is not working. Currently my code is as follows: 'foreach loop writer.AddAttribute(HtmlTextWriterAttribute.Class, "standard-content"); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-name"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write(nodeName); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-date"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderBeginTag(HtmlTextWriterTag.Strong); writer.Write(umbraco.library.FormatDateTime(nodeStartDate.ToString(), "dd-MMM-yy")); writer.RenderEndTag(); writer.Write(" to "); writer.RenderBeginTag(HtmlTextWriterTag.Strong); writer.Write(umbraco.library.FormatDateTime(nodeEndDate.ToString(), "dd-MMM-yy")); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-more"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute(HtmlTextWriterAttribute.Src, nodeUrl); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write("Read more..."); writer.RenderEndTag(); writer.RenderEndTag(); 'foreach end And then I'm outputting it to a placeholder: RegisteredWorkshops.RenderControl(writer); But the placeholder is empty whenever I run the site. How can I get to display these dynamic rows within the a table on my page based upon the registration of workhops? Best regards, brinck10
c#
umbraco
table-row
htmltextwriter
null
null
open
HtmlTextWriter creating table rows dynamically === I'm creating a umbraco website where the user can login. On this login page I want to show him/her the workshops the user signed up for. That is done through a user control. If the user has registered for any workshops, it should create table-rows matching with the number of workshops - if not, the usercontrol should display a simple message. I'm outputting the table-rows with htmlTextWriter, however it is not working. Currently my code is as follows: 'foreach loop writer.AddAttribute(HtmlTextWriterAttribute.Class, "standard-content"); writer.RenderBeginTag(HtmlTextWriterTag.Tr); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-name"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write(nodeName); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-date"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderBeginTag(HtmlTextWriterTag.Strong); writer.Write(umbraco.library.FormatDateTime(nodeStartDate.ToString(), "dd-MMM-yy")); writer.RenderEndTag(); writer.Write(" to "); writer.RenderBeginTag(HtmlTextWriterTag.Strong); writer.Write(umbraco.library.FormatDateTime(nodeEndDate.ToString(), "dd-MMM-yy")); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute(HtmlTextWriterAttribute.Class, "workshop-availability-more"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute(HtmlTextWriterAttribute.Src, nodeUrl); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write("Read more..."); writer.RenderEndTag(); writer.RenderEndTag(); 'foreach end And then I'm outputting it to a placeholder: RegisteredWorkshops.RenderControl(writer); But the placeholder is empty whenever I run the site. How can I get to display these dynamic rows within the a table on my page based upon the registration of workhops? Best regards, brinck10
0
11,650,224
07/25/2012 12:56:35
1,551,624
07/25/2012 12:39:19
1
0
How to know which entity has been removed/added in an AssociationChange event handler
I currently use EntityFramework and I have two entities : DBGroups and DBUsers. DBUsers have a EntityCollection of DBGroup. In parallel, I have a business representation of these thow entities, and Users have a list of Group. My goal is to keep a singleton of business objects as a exact representation of the entities in the current context (one unic business object for each entity in the context). Each time the entities change, I want to change the related business object to reflet the new state. So I have use OnPropertyChange for property, but I have some problems with navigation properties, such as my list of groups in DBUser. I have added a CollectionChangeEventHandler which use arguments that provide me if there was a removing or a adding and the entire new collection, but I not able to know wich entity has been remove/add ? Is there any way to know that ? In fact, i want to update the list of group in the corresponding user business object without read all the element of the list to know wich one is different from the entitycollection.
c#
entity-framework-4
entitycollection
null
null
null
open
How to know which entity has been removed/added in an AssociationChange event handler === I currently use EntityFramework and I have two entities : DBGroups and DBUsers. DBUsers have a EntityCollection of DBGroup. In parallel, I have a business representation of these thow entities, and Users have a list of Group. My goal is to keep a singleton of business objects as a exact representation of the entities in the current context (one unic business object for each entity in the context). Each time the entities change, I want to change the related business object to reflet the new state. So I have use OnPropertyChange for property, but I have some problems with navigation properties, such as my list of groups in DBUser. I have added a CollectionChangeEventHandler which use arguments that provide me if there was a removing or a adding and the entire new collection, but I not able to know wich entity has been remove/add ? Is there any way to know that ? In fact, i want to update the list of group in the corresponding user business object without read all the element of the list to know wich one is different from the entitycollection.
0
5,529,740
04/03/2011 13:03:37
685,288
03/31/2011 07:47:55
8
0
get multiple categories from xml-data and use it in wp_insert_post post_category
I am using the following while loop inside an foreach-loop to get categories from an xml file: foreach($mm_rss_xml->channel->item as $mm_item) { $i = 0; while ($xml_getinfo_result->movies->movie->categories->category[$i]) { $tmdb_cats = $xml_getinfo_result->movies->movie->categories->category[$i]->attributes()->name; // TMDb Categories echo "<li>".tmdb_cats."</li>"; $i++; } gives me: - action - drama - thriller Now, how can I add these categories into wordpress categories? (they are already added in wordpress, so they don't need to be added anymore) I use the following for adding the post into WP: $my_post = array(); $my_post['post_title'] = $tmdb_moviename; $my_post['post_content'] = $mm_overview; $my_post['post_category'] = // I am stuck here... $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['tags_input'] = $tmdb_actors2; $my_post['filter'] = true; $posted_id = wp_insert_post($my_post); add_post_meta($posted_id, 'test', $average_rating); } // end foreach loop Thanks in advance for any answers :)
php
arrays
wordpress
null
null
null
open
get multiple categories from xml-data and use it in wp_insert_post post_category === I am using the following while loop inside an foreach-loop to get categories from an xml file: foreach($mm_rss_xml->channel->item as $mm_item) { $i = 0; while ($xml_getinfo_result->movies->movie->categories->category[$i]) { $tmdb_cats = $xml_getinfo_result->movies->movie->categories->category[$i]->attributes()->name; // TMDb Categories echo "<li>".tmdb_cats."</li>"; $i++; } gives me: - action - drama - thriller Now, how can I add these categories into wordpress categories? (they are already added in wordpress, so they don't need to be added anymore) I use the following for adding the post into WP: $my_post = array(); $my_post['post_title'] = $tmdb_moviename; $my_post['post_content'] = $mm_overview; $my_post['post_category'] = // I am stuck here... $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['tags_input'] = $tmdb_actors2; $my_post['filter'] = true; $posted_id = wp_insert_post($my_post); add_post_meta($posted_id, 'test', $average_rating); } // end foreach loop Thanks in advance for any answers :)
0
11,650,227
07/25/2012 12:56:46
494,477
11/02/2010 08:31:31
497
6
Failure to produce a lazy stream
I will put this question as short and to the point as possible. I expected this computation to complete after inputting three characters to the command line. However, it does not. I am curious as to why this is. return . take 3 =<< sequence (repeat getChar)
haskell
null
null
null
null
null
open
Failure to produce a lazy stream === I will put this question as short and to the point as possible. I expected this computation to complete after inputting three characters to the command line. However, it does not. I am curious as to why this is. return . take 3 =<< sequence (repeat getChar)
0
11,650,228
07/25/2012 12:56:45
545,920
12/17/2010 10:21:22
561
3
Microsoft unit testing. Is it possible to skip test from test method body?
So I have situation when I need skip current test from test method body. Simplest way is to write something like this in test method. if (something) return; But I have a lot complicated tests and I need a way to skip test from methods which I invoke in current test method body. Is it possible?
c#
unit-testing
null
null
null
null
open
Microsoft unit testing. Is it possible to skip test from test method body? === So I have situation when I need skip current test from test method body. Simplest way is to write something like this in test method. if (something) return; But I have a lot complicated tests and I need a way to skip test from methods which I invoke in current test method body. Is it possible?
0
11,650,235
07/25/2012 12:56:58
753,271
05/14/2011 03:33:42
17
3
Sideways corner markers (CSS)
I have an HTML page with many photos listed on it. I am looking for some help on how to do the CSS so that some photos have a top-corner "marker" like the red stripe here called "Featured" -- http://www.logospire.com/logos/3922 I could have googled for what this is, but I don't know the keywords. Would love any tips and pointers. Thanks so much!
css
null
null
null
null
null
open
Sideways corner markers (CSS) === I have an HTML page with many photos listed on it. I am looking for some help on how to do the CSS so that some photos have a top-corner "marker" like the red stripe here called "Featured" -- http://www.logospire.com/logos/3922 I could have googled for what this is, but I don't know the keywords. Would love any tips and pointers. Thanks so much!
0
11,226,312
06/27/2012 12:33:38
1,107,129
12/20/2011 04:29:19
157
6
org.apache.jasper.JasperException in jsp page
I want to display dropdown on the basis of if condition,My code snippet is as below <%if(userType.equalsIgnoreCase("O")) {String user=(String)session.getAttribute("executorname"); %> <html:select style="width:190;" value=<%=user%> property="jobOwner"> <html:option value=<%=user %>><%=user %></html:option> </html:select> <%} %> I get `org.apache.jasper.JasperException: /jsp/frmQueryExecutor.jsp(73,23) quote symbol expected` I want the value os session variable in dropdown.
jsp
java-ee
struts
null
null
null
open
org.apache.jasper.JasperException in jsp page === I want to display dropdown on the basis of if condition,My code snippet is as below <%if(userType.equalsIgnoreCase("O")) {String user=(String)session.getAttribute("executorname"); %> <html:select style="width:190;" value=<%=user%> property="jobOwner"> <html:option value=<%=user %>><%=user %></html:option> </html:select> <%} %> I get `org.apache.jasper.JasperException: /jsp/frmQueryExecutor.jsp(73,23) quote symbol expected` I want the value os session variable in dropdown.
0
11,226,315
06/27/2012 12:33:40
1,441,533
06/07/2012 07:14:29
1
0
In WCF REST service's WebInvoke post method return 400 error
when i used this URITemplate then i got value in _placeId variable and all working fine. WebInvoke(UriTemplate = "myPostMethod?placeId={_placeId}", BodyStyle = WebMessageBodyStyle.WrappedRequest, Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] List myPostMethod(string _placeId); But when i use this URITemplate and passing data in json format it gives 400 error in fiddler WebInvoke(UriTemplate = "myPostMethod", BodyStyle = WebMessageBodyStyle.WrappedRequest, Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] List myPostMethod(string _placeId); My Fiddler request is as follws: method is post Request Headers: User-Agent: Fiddler Host: localhost:3129 Content-Length: 19 ContentType: application/json;charset=utf-8 Request body: {"_placeId":"251"}
wcf-rest
webinvoke
null
null
null
null
open
In WCF REST service's WebInvoke post method return 400 error === when i used this URITemplate then i got value in _placeId variable and all working fine. WebInvoke(UriTemplate = "myPostMethod?placeId={_placeId}", BodyStyle = WebMessageBodyStyle.WrappedRequest, Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] List myPostMethod(string _placeId); But when i use this URITemplate and passing data in json format it gives 400 error in fiddler WebInvoke(UriTemplate = "myPostMethod", BodyStyle = WebMessageBodyStyle.WrappedRequest, Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] List myPostMethod(string _placeId); My Fiddler request is as follws: method is post Request Headers: User-Agent: Fiddler Host: localhost:3129 Content-Length: 19 ContentType: application/json;charset=utf-8 Request body: {"_placeId":"251"}
0
11,226,316
06/27/2012 12:33:53
186,274
05/17/2009 18:47:21
175
8
Stand-alone front-end modules in Django
I'm trying to create stand-alone front-end module (HTML, CSS & JS) to integrate into a Django app. The best example for what I mean is a "map" module, which I'd like to include in various, unrelated pages, possibly in different locations in each page. I have a template that provides the HTML code that I need for the map, and I'd like the CSS and JS code to also be included through this template, to ease handling of front end dependencies. Up until now, this can be achieved using the <code>{% include %}</code> tag. *But* including stylesheets and scripts in the middle of the HTML page is an extremely bad practice when it comes to front-end performance. (CSS should be included in the <code>&lt;head&gt;</code>, JS should be included at the end of <code>&lt;body&gt;</code>) My problem could have been solved if <code>{% include %}</code> tags would have been rendered as part of the template that included them and could have overridden <code>{% block %}</code> tags. That is not the case in Django. <code>{% include %}</code> tags are first rendered to HTML and only then included, so they cannot override <code>{% block %}</code> tags. Looking around past questions around this subject suggest that the common wisdom is to use template inheritance (i.e. <code>{% extends %}</code>) instead of <code>{% include %}</code>, but since I'd like my modules to be independent, I don't see how I can use inheritance in my case. What can I do to maintain my front-end dependencies inside the templates while maintaining front-end performance best practices? Thanks!
django
frontend
null
null
null
null
open
Stand-alone front-end modules in Django === I'm trying to create stand-alone front-end module (HTML, CSS & JS) to integrate into a Django app. The best example for what I mean is a "map" module, which I'd like to include in various, unrelated pages, possibly in different locations in each page. I have a template that provides the HTML code that I need for the map, and I'd like the CSS and JS code to also be included through this template, to ease handling of front end dependencies. Up until now, this can be achieved using the <code>{% include %}</code> tag. *But* including stylesheets and scripts in the middle of the HTML page is an extremely bad practice when it comes to front-end performance. (CSS should be included in the <code>&lt;head&gt;</code>, JS should be included at the end of <code>&lt;body&gt;</code>) My problem could have been solved if <code>{% include %}</code> tags would have been rendered as part of the template that included them and could have overridden <code>{% block %}</code> tags. That is not the case in Django. <code>{% include %}</code> tags are first rendered to HTML and only then included, so they cannot override <code>{% block %}</code> tags. Looking around past questions around this subject suggest that the common wisdom is to use template inheritance (i.e. <code>{% extends %}</code>) instead of <code>{% include %}</code>, but since I'd like my modules to be independent, I don't see how I can use inheritance in my case. What can I do to maintain my front-end dependencies inside the templates while maintaining front-end performance best practices? Thanks!
0
11,226,322
06/27/2012 12:34:16
1,265,960
03/13/2012 08:18:27
36
1
How to concatenate two strings to build a complete path
I am trying to write a bash script. In this script I want user to enter a path of a directory. Then I want to append some strings at the end of this string and build a path to some subdirectories. For example assume user enters an string like this: /home/user1/MyFolder Now I want to create 2 subdirectories in this directory and copy some files there. /home/user1/MyFolder/subFold1 /home/user1/MyFolder/subFold2 How can I do this?
linux
bash
null
null
null
null
open
How to concatenate two strings to build a complete path === I am trying to write a bash script. In this script I want user to enter a path of a directory. Then I want to append some strings at the end of this string and build a path to some subdirectories. For example assume user enters an string like this: /home/user1/MyFolder Now I want to create 2 subdirectories in this directory and copy some files there. /home/user1/MyFolder/subFold1 /home/user1/MyFolder/subFold2 How can I do this?
0
11,226,333
06/27/2012 12:34:31
500,105
11/07/2010 21:01:38
267
11
WCF Jquery Ajax cross domain policy - "Method Not Allowed"
I am trying to consume a WCF service, using Jquery from Localhost to a server, but keeps getting "405 Method Not Allowed". This is the configuration I'm using: <system.serviceModel> <bindings> <webHttpBinding> <binding name="jsonp" crossDomainScriptAccessEnabled="true" /> <binding name="jsonpSsl" crossDomainScriptAccessEnabled="true"> <security mode="Transport" /> </binding> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="MyBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="MyBehavior"> <webHttp /> </behavior> </endpointBehaviors> </behaviors> <services> <service behaviorConfiguration="MyBehavior" name="MyWs.Service1"> <endpoint address="" binding="webHttpBinding" bindingConfiguration="jsonp" contract="MyWs.IService1" behaviorConfiguration="MyBehavior"/> <endpoint address="" binding="webHttpBinding" bindingConfiguration="jsonpSsl" contract="MyWs.IService1" behaviorConfiguration="MyBehavior"/> </service> </services> </system.serviceModel> The JQuery function: $.ajax({ type: "POST", url: "http://XXX.XXX.XXX.XXX/wcf/Service1.svc/GetData", data: '{"value":"2340"}', contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccessCall, error: OnErrorCall }); function OnSuccessCall(response) { alert(response); } function OnErrorCall(response) { alert(response.status + " " + response.statusText); } The WCF Interface: [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] string GetData(int value); The Method implementation: public string GetData(int value) { WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*"); System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string json = oSerializer.Serialize(string.Format("You entered: {0}", value)); return json; } Any ideas how to solve it? Thank You!
jquery
wcf
cross-domain
null
null
null
open
WCF Jquery Ajax cross domain policy - "Method Not Allowed" === I am trying to consume a WCF service, using Jquery from Localhost to a server, but keeps getting "405 Method Not Allowed". This is the configuration I'm using: <system.serviceModel> <bindings> <webHttpBinding> <binding name="jsonp" crossDomainScriptAccessEnabled="true" /> <binding name="jsonpSsl" crossDomainScriptAccessEnabled="true"> <security mode="Transport" /> </binding> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="MyBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="MyBehavior"> <webHttp /> </behavior> </endpointBehaviors> </behaviors> <services> <service behaviorConfiguration="MyBehavior" name="MyWs.Service1"> <endpoint address="" binding="webHttpBinding" bindingConfiguration="jsonp" contract="MyWs.IService1" behaviorConfiguration="MyBehavior"/> <endpoint address="" binding="webHttpBinding" bindingConfiguration="jsonpSsl" contract="MyWs.IService1" behaviorConfiguration="MyBehavior"/> </service> </services> </system.serviceModel> The JQuery function: $.ajax({ type: "POST", url: "http://XXX.XXX.XXX.XXX/wcf/Service1.svc/GetData", data: '{"value":"2340"}', contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccessCall, error: OnErrorCall }); function OnSuccessCall(response) { alert(response); } function OnErrorCall(response) { alert(response.status + " " + response.statusText); } The WCF Interface: [OperationContract] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] string GetData(int value); The Method implementation: public string GetData(int value) { WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*"); System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string json = oSerializer.Serialize(string.Format("You entered: {0}", value)); return json; } Any ideas how to solve it? Thank You!
0
11,226,338
06/27/2012 12:34:39
1,029,453
11/04/2011 10:01:59
1,706
92
Missing something with Reader monad - passing the damn thing around everywhere
Learning Haskell, managing syntax, have a rough grasp of what monads etc are about but I'm clearly missing something. In `main` I can read my config file, and supply it as `runReader (somefunc) myEnv` just fine. But `somefunc` doesn't need access to the `myEnv` the reader supplies, nor do the next couple in the chain. The function that needs something from myEnv is a tiny leaf function. So - how do I get access to the environment in a function without tagging all the intervening functions as `(Reader Env)`? That can't be right because otherwise you'd just pass myEnv around in the first place. There are plenty of examples I can find on the net but they all seem to have only one level between runReader and accessing the environment.
haskell
reader
null
null
null
null
open
Missing something with Reader monad - passing the damn thing around everywhere === Learning Haskell, managing syntax, have a rough grasp of what monads etc are about but I'm clearly missing something. In `main` I can read my config file, and supply it as `runReader (somefunc) myEnv` just fine. But `somefunc` doesn't need access to the `myEnv` the reader supplies, nor do the next couple in the chain. The function that needs something from myEnv is a tiny leaf function. So - how do I get access to the environment in a function without tagging all the intervening functions as `(Reader Env)`? That can't be right because otherwise you'd just pass myEnv around in the first place. There are plenty of examples I can find on the net but they all seem to have only one level between runReader and accessing the environment.
0
11,226,343
06/27/2012 12:34:50
926,907
09/03/2011 18:43:35
1,508
111
Strange white border on WebView while testing on HTC Sensation XE
On HTC Sensation XE with Android 2.3.4 (and maybe on other HTC devices, unfortunately I can only on this one) there a strange white line on right border of the WebView (screenshot below). I've also tested my app on emulator with same params and on Asus TF101, **but everything was OK**. ![Here is the problem][1] This layout is pretty complex to post here, so I've tested it on this one (and there is same bug too): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" android:orientation="vertical" > <!-- This WebView created dynamically --> <WebView android:id="@+id/webView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> [And here is the page, that I'm testing on][2]. As you can see, there is no padding and no margin (`<body style="padding:0; margin:0;">`). Can anyone give me an advice where the problem can be? Thanks. [1]: http://i.stack.imgur.com/QcYHY.jpg [2]: http://kupitut.webtm.ru/index.php?longitude=10.0&lattitude=10.0&myLongitude=10.0&myLattitude=10.0
android
webview
null
null
null
null
open
Strange white border on WebView while testing on HTC Sensation XE === On HTC Sensation XE with Android 2.3.4 (and maybe on other HTC devices, unfortunately I can only on this one) there a strange white line on right border of the WebView (screenshot below). I've also tested my app on emulator with same params and on Asus TF101, **but everything was OK**. ![Here is the problem][1] This layout is pretty complex to post here, so I've tested it on this one (and there is same bug too): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" android:orientation="vertical" > <!-- This WebView created dynamically --> <WebView android:id="@+id/webView" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> [And here is the page, that I'm testing on][2]. As you can see, there is no padding and no margin (`<body style="padding:0; margin:0;">`). Can anyone give me an advice where the problem can be? Thanks. [1]: http://i.stack.imgur.com/QcYHY.jpg [2]: http://kupitut.webtm.ru/index.php?longitude=10.0&lattitude=10.0&myLongitude=10.0&myLattitude=10.0
0
11,226,346
06/27/2012 12:34:56
767,760
05/24/2011 12:54:08
319
2
Can't use jdbc inside clojure
I am trying to make connect clojure to mysql, but somehow fail. My project.clj is: (defproject my-project "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.3.0"] [org.clojure/java.jdbc "0.2.3"]] :jvm-opts ["-Djdbc.drivers=com.mysql.jdbc.Driver"]) My file is: (ns my-project (:require [clojure.java.jdbc :as sql])) (def db {:classname "com.mysql.jdbc.Driver" :subprotocol "mysql" :subname "//localhost:3306/db" :user "xxx" :password "xxx"}) And I am trying to run the following from the REPL: (sql/with-connection db (sql/with-query-results rows "show tables;")) The error I am getting is: No suitable driver found for jdbc:mysql://localhost:3306/db I have in sql a database called db and I ensured mysql.server is running on port 3306. I would be grateful if someone could give me a hint. Also my error message is not dependant from the username and password I provide, and nothing is shown on the log file from mysql. Thanks!
sql
clojure
null
null
null
null
open
Can't use jdbc inside clojure === I am trying to make connect clojure to mysql, but somehow fail. My project.clj is: (defproject my-project "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.3.0"] [org.clojure/java.jdbc "0.2.3"]] :jvm-opts ["-Djdbc.drivers=com.mysql.jdbc.Driver"]) My file is: (ns my-project (:require [clojure.java.jdbc :as sql])) (def db {:classname "com.mysql.jdbc.Driver" :subprotocol "mysql" :subname "//localhost:3306/db" :user "xxx" :password "xxx"}) And I am trying to run the following from the REPL: (sql/with-connection db (sql/with-query-results rows "show tables;")) The error I am getting is: No suitable driver found for jdbc:mysql://localhost:3306/db I have in sql a database called db and I ensured mysql.server is running on port 3306. I would be grateful if someone could give me a hint. Also my error message is not dependant from the username and password I provide, and nothing is shown on the log file from mysql. Thanks!
0
11,226,351
06/27/2012 12:35:06
1,447,350
06/10/2012 12:50:28
11
1
identify third party cookies
Given a cookie with the common attributes (name, id, etc), is there anyway we can identify if the cookie is a third-party cookie? By that we mean a cookie that has been placed by website B while visiting website A. At the moment, I can see no ways of achieving that but perhaps I've missed something. I'm working on a project related to user privacy online and would like to get a list of websites that left third-party cookies in user's browser. I use Mozilla Firefox Browser.
javascript
firefox
cookies
null
null
null
open
identify third party cookies === Given a cookie with the common attributes (name, id, etc), is there anyway we can identify if the cookie is a third-party cookie? By that we mean a cookie that has been placed by website B while visiting website A. At the moment, I can see no ways of achieving that but perhaps I've missed something. I'm working on a project related to user privacy online and would like to get a list of websites that left third-party cookies in user's browser. I use Mozilla Firefox Browser.
0
11,297,929
07/02/2012 16:52:27
1,192,403
02/06/2012 13:41:21
52
1
Watin, selecting html option list, generated by Javascript
I'm having trouble selecting a list that is mixed with javascript. The original code on the page is this: <select id="List_1" name="List_1"> <option value="">Select..</option> <option value="val_1" >Orange</option> <option value="val_2" >Apple</option> <option value="val_3" >Peach</option> </select> But when the JS file loads, it modifies the List and when I view Generated Source, I get this: <div tabindex="0" style="-moz-user-select: none;" role="listbox" title="Fruit" class="fruit-box k-select">Select..</div> And WatiN cannot find the listbox anymore.. I tried: browser.Element(Find.ById("Fruit")).Focus(); browser.Element(Find.ById("Fruit")).Click(); but that didn't trigger the dropdown list to go down. Then I tried to request the page with GoToNoWait(); and then use a loop to find the list, before JS is loaded, that modifies it: while (browser.SelectLists.Count <= 0) { Thread.Sleep(100); // wait until the first option list is loaded } foreach (WatiN.Core.SelectList a in brower.SelectLists) { if (a.IdOrName == "Fruit") { a.SelectByValue("val_1"); } } I can see the list showing up normal in browser (not JS) at first, but the loop hangs while the page is loading and JS gets loaded before foreach loop gets a chance to get executed.. My only solution is this: browser.Div(Find.ByTitle("Fruit")).Focus(); browser.Div(Find.ByTitle("Fruit")).Click(); browser.Div(Find.ByTitle("Fruit")).FireEvent("onClick"); SendKeys.SendWait("{DOWN}"); SendKeys.SendWait("{DOWN}"); SendKeys.SendWait("{ENTER}"); But when using SendKeys I need to have firefox window in focus, otherwise the keystrokes get sent to whatever application I have currently open which doesn't work for me. Is there a way to select the option list, before JS is added to it? OR is there a way to use SendKeys and point it to specific application instead of currently focused one? Thank you!
c#
list
watin
null
null
null
open
Watin, selecting html option list, generated by Javascript === I'm having trouble selecting a list that is mixed with javascript. The original code on the page is this: <select id="List_1" name="List_1"> <option value="">Select..</option> <option value="val_1" >Orange</option> <option value="val_2" >Apple</option> <option value="val_3" >Peach</option> </select> But when the JS file loads, it modifies the List and when I view Generated Source, I get this: <div tabindex="0" style="-moz-user-select: none;" role="listbox" title="Fruit" class="fruit-box k-select">Select..</div> And WatiN cannot find the listbox anymore.. I tried: browser.Element(Find.ById("Fruit")).Focus(); browser.Element(Find.ById("Fruit")).Click(); but that didn't trigger the dropdown list to go down. Then I tried to request the page with GoToNoWait(); and then use a loop to find the list, before JS is loaded, that modifies it: while (browser.SelectLists.Count <= 0) { Thread.Sleep(100); // wait until the first option list is loaded } foreach (WatiN.Core.SelectList a in brower.SelectLists) { if (a.IdOrName == "Fruit") { a.SelectByValue("val_1"); } } I can see the list showing up normal in browser (not JS) at first, but the loop hangs while the page is loading and JS gets loaded before foreach loop gets a chance to get executed.. My only solution is this: browser.Div(Find.ByTitle("Fruit")).Focus(); browser.Div(Find.ByTitle("Fruit")).Click(); browser.Div(Find.ByTitle("Fruit")).FireEvent("onClick"); SendKeys.SendWait("{DOWN}"); SendKeys.SendWait("{DOWN}"); SendKeys.SendWait("{ENTER}"); But when using SendKeys I need to have firefox window in focus, otherwise the keystrokes get sent to whatever application I have currently open which doesn't work for me. Is there a way to select the option list, before JS is added to it? OR is there a way to use SendKeys and point it to specific application instead of currently focused one? Thank you!
0
11,297,925
07/02/2012 16:52:08
383,341
07/05/2010 01:55:12
396
12
How to scroll to a given position in a document displayed in a JScrollPane
In an application with Java Swing components I have a `JTextPane` inside a non-editable `JScrollPane`, and some other fields where the user can enter some criteria. If the user clicks a certain button or menu item, there will be a search for a section of the document in the `JTextPane` that meets the given criteria, and if a match is found the section will be highlighted. That part is solved; I can find the relevant document segment, know where it starts and ends (in terms of integer offsets), and highlight it. But that highlighted segment might have scrolled off the screen and I need it to be scrolled to within the visible piece of the JScrollPane. I see there is a method `scrollRectToVisible(Rectangle)` on `JComponent` that seems like it might to do the job, but I don't see how to convert from the textual document position integer to a `Rectangle`. Note that it is a non-editable JTextPane and I don't want to move the cursor the highlighted segment (the user cannot see the cursor anyway), I only want to make the segment show within the visible area of the JScrollPane.
swing
jscrollpane
null
null
null
null
open
How to scroll to a given position in a document displayed in a JScrollPane === In an application with Java Swing components I have a `JTextPane` inside a non-editable `JScrollPane`, and some other fields where the user can enter some criteria. If the user clicks a certain button or menu item, there will be a search for a section of the document in the `JTextPane` that meets the given criteria, and if a match is found the section will be highlighted. That part is solved; I can find the relevant document segment, know where it starts and ends (in terms of integer offsets), and highlight it. But that highlighted segment might have scrolled off the screen and I need it to be scrolled to within the visible piece of the JScrollPane. I see there is a method `scrollRectToVisible(Rectangle)` on `JComponent` that seems like it might to do the job, but I don't see how to convert from the textual document position integer to a `Rectangle`. Note that it is a non-editable JTextPane and I don't want to move the cursor the highlighted segment (the user cannot see the cursor anyway), I only want to make the segment show within the visible area of the JScrollPane.
0
11,297,932
07/02/2012 16:52:36
1,292,230
03/26/2012 05:21:52
114
25
Check if UIImage is valid
I'm trying to check if an image is valid for transforming, but I can't seem to get any results. Just a lot of errors. I'm grabbing the context and performing various transforms on images and they work fine, so long as the image isn't a gif image, but there may be other exceptions. Is there any way to tell if an image is valid for context and transforms before trying to apply them? I've tried checking the CGImage and context references to see if they're NULL, but they all seem valid, so I don't know where I'm supposed to look.
ios
uiimage
transform
null
null
null
open
Check if UIImage is valid === I'm trying to check if an image is valid for transforming, but I can't seem to get any results. Just a lot of errors. I'm grabbing the context and performing various transforms on images and they work fine, so long as the image isn't a gif image, but there may be other exceptions. Is there any way to tell if an image is valid for context and transforms before trying to apply them? I've tried checking the CGImage and context references to see if they're NULL, but they all seem valid, so I don't know where I'm supposed to look.
0
11,297,547
07/02/2012 16:25:13
331,439
05/03/2010 13:16:11
2,425
23
Preventing values in html inputs with jQuery
How do I prevent the user from changing a string in an input box if the combined value of that input with their latest keypress does not pass a regular expression? I see all kinds of examples on how to use keypress for testing characters, but I need to match the whole value to a regular expression, not just the key the pressed. For example, The textbox needs to conform to the following regular expression: "^023-[0-9]{0,7}$" If I use keypress() event in jQuery, and get the value of the input element like this: $(this).val() Then I will only get the value before they pressed the key - not after. Thus, there is no way to test the input against my regular expression. I have looked into keydown/keyup events, and while keyup seems to give me the current value of the input after the user has pressed a key, I am finding it difficult to remove the effects of what they typed: var regex = new RegExp("^023-[0-9]{0,7}$"); $("#number").keyup(function(event) { var number = $(this).val(); if(!regex.test(number)) { event.preventDefault(); return false; } }); The above code just doesn't work. How can I make it work? Thanks
javascript
jquery
regex
validation
input
null
open
Preventing values in html inputs with jQuery === How do I prevent the user from changing a string in an input box if the combined value of that input with their latest keypress does not pass a regular expression? I see all kinds of examples on how to use keypress for testing characters, but I need to match the whole value to a regular expression, not just the key the pressed. For example, The textbox needs to conform to the following regular expression: "^023-[0-9]{0,7}$" If I use keypress() event in jQuery, and get the value of the input element like this: $(this).val() Then I will only get the value before they pressed the key - not after. Thus, there is no way to test the input against my regular expression. I have looked into keydown/keyup events, and while keyup seems to give me the current value of the input after the user has pressed a key, I am finding it difficult to remove the effects of what they typed: var regex = new RegExp("^023-[0-9]{0,7}$"); $("#number").keyup(function(event) { var number = $(this).val(); if(!regex.test(number)) { event.preventDefault(); return false; } }); The above code just doesn't work. How can I make it work? Thanks
0
11,297,875
07/02/2012 16:48:51
1,496,642
07/02/2012 16:38:09
1
0
I have a server application written in python that uses sockets. It works locally but on my public server it doesn't respond to connections
Lets say I put something like this: #! /usr/bin/python print 'Content-type: application' print '\n\n' import SocketServer import cgitb cgitb.enable() class MyTCPHandler(SocketServer.BaseRequestHandler): """ The RequestHandler class for our server. It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client. """ def handle(self): # self.request is the TCP socket connected to the client self.data = self.request.recv(1024).strip() print "{} wrote:".format(self.client_address[0]) print self.data # just send back the same data, but upper-cased self.request.sendall(self.data.upper()) self.request.sendall('Data Received') if __name__ == "__main__": HOST, PORT = "localhost", 9989 # Create the server, binding to localhost on port 9989 server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever() It works on my own computer, but if I run it on my public server it's just unresponsive. Also, if I run this twice, I get an error saying: > error: (98, 'Address already in use')
python
sockets
null
null
null
null
open
I have a server application written in python that uses sockets. It works locally but on my public server it doesn't respond to connections === Lets say I put something like this: #! /usr/bin/python print 'Content-type: application' print '\n\n' import SocketServer import cgitb cgitb.enable() class MyTCPHandler(SocketServer.BaseRequestHandler): """ The RequestHandler class for our server. It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client. """ def handle(self): # self.request is the TCP socket connected to the client self.data = self.request.recv(1024).strip() print "{} wrote:".format(self.client_address[0]) print self.data # just send back the same data, but upper-cased self.request.sendall(self.data.upper()) self.request.sendall('Data Received') if __name__ == "__main__": HOST, PORT = "localhost", 9989 # Create the server, binding to localhost on port 9989 server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever() It works on my own computer, but if I run it on my public server it's just unresponsive. Also, if I run this twice, I get an error saying: > error: (98, 'Address already in use')
0