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,319,273
07/03/2012 21:13:01
1,472,824
06/21/2012 17:09:49
29
0
Java program grading
I've been working on this program for hours and I can't figure out how to get the program to actually print the grades from the scores Text file public class Assign7{ private double finalScore; private double private_quiz1; private double private_quiz2; private double private_midTerm; private double private_final; private final char grade; public Assign7(double finalScore){ private_quiz1 = 1.25; private_quiz2 = 1.25; private_midTerm = 0.25; private_final = 0.50; if (finalScore >= 90) { grade = 'A'; } else if (finalScore >= 80) { grade = 'B'; } else if (finalScore >= 70) { grade = 'C'; } else if (finalScore>= 60) { grade = 'D'; } else { grade = 'F'; } } public String toString(){ return finalScore+":"+private_quiz1+":"+private_quiz2+":"+private_midTerm+":"+private_final; } } this code compiles as well as this one import java.util.*; import java.io.*; public class Assign7Test{ public static void main(String[] args)throws Exception{ int q1,q2; int m = 0; int f = 0; int Record ; String name; Scanner myIn = new Scanner( new File("scores.txt") ); System.out.println( myIn.nextLine() +" avg "+"letter"); while( myIn.hasNext() ){ name = myIn.next(); q1 = myIn.nextInt(); q2 = myIn.nextInt(); m = myIn.nextInt(); f = myIn.nextInt(); Record myR = new Record( name, q1,q2,m,f); System.out.println(myR); } } public static class Record { public Record() { } public Record(String name, int q1, int q2, int m, int f) { } } } once a compile the code i get this which dosent exactly compute the numbers I have in the scores.txt Name quiz1 quiz2 midterm final avg letter Assign7Test$Record@4bcc946b Assign7Test$Record@642423 Exception in thread "main" java.until.InputMismatchException at java.until.Scanner.throwFor(Unknown Source) at java.until.Scanner.next(Unknown Source) at java.until.Scanner.nextInt(Unknown Source) at java.until.Scanner.nextInt(Unknown Source) at Assign7Test.main(Assign7Test.java:25)
java
homework
null
null
null
null
open
Java program grading === I've been working on this program for hours and I can't figure out how to get the program to actually print the grades from the scores Text file public class Assign7{ private double finalScore; private double private_quiz1; private double private_quiz2; private double private_midTerm; private double private_final; private final char grade; public Assign7(double finalScore){ private_quiz1 = 1.25; private_quiz2 = 1.25; private_midTerm = 0.25; private_final = 0.50; if (finalScore >= 90) { grade = 'A'; } else if (finalScore >= 80) { grade = 'B'; } else if (finalScore >= 70) { grade = 'C'; } else if (finalScore>= 60) { grade = 'D'; } else { grade = 'F'; } } public String toString(){ return finalScore+":"+private_quiz1+":"+private_quiz2+":"+private_midTerm+":"+private_final; } } this code compiles as well as this one import java.util.*; import java.io.*; public class Assign7Test{ public static void main(String[] args)throws Exception{ int q1,q2; int m = 0; int f = 0; int Record ; String name; Scanner myIn = new Scanner( new File("scores.txt") ); System.out.println( myIn.nextLine() +" avg "+"letter"); while( myIn.hasNext() ){ name = myIn.next(); q1 = myIn.nextInt(); q2 = myIn.nextInt(); m = myIn.nextInt(); f = myIn.nextInt(); Record myR = new Record( name, q1,q2,m,f); System.out.println(myR); } } public static class Record { public Record() { } public Record(String name, int q1, int q2, int m, int f) { } } } once a compile the code i get this which dosent exactly compute the numbers I have in the scores.txt Name quiz1 quiz2 midterm final avg letter Assign7Test$Record@4bcc946b Assign7Test$Record@642423 Exception in thread "main" java.until.InputMismatchException at java.until.Scanner.throwFor(Unknown Source) at java.until.Scanner.next(Unknown Source) at java.until.Scanner.nextInt(Unknown Source) at java.until.Scanner.nextInt(Unknown Source) at Assign7Test.main(Assign7Test.java:25)
0
11,319,274
07/03/2012 21:13:12
243,896
01/05/2010 12:33:03
182
11
Entity Framework orderby does not update datagrid
I'm new to C#, MVVM, WPF and Entity Framework my problem is, if I order the reading of the database (orderby) the datagrid will not be changed if I add a new row. if i do not order the reading it works. so addition infos: my database looks like this Table Konto KontoID KontoName Table Buchung KontoID BuchungsID Name BuchDate after the Konto is loaded it will load all related Buchungen _entityKontoView = new CollectionViewSource(); _entityBuchungView = new CollectionViewSource(); // Loads the Konto _entityKontoView.Source = _database.Konto; _entityKontoView.View.CurrentChanged += (x, y) => { _entityBuchungView.Source = ((Konto)_entityKontoView.View.CurrentItem).Buchung //.OrderBy(date => date.BuchDate) //.ThenBy(buchnr => buchnr.BuchungsID) ; }; _entityKontoView.View.Refresh(); when i do now an `OrderBy` the datagrid will not be update after new inserted Row i open the the database entity as follow: public static databaseEntities _database = new databaseEntities(); my XAML binding on DataGrid: ItemsSource="{Binding EntityBuchungsView.View}" and my columns binding ; Binding="{Binding Name}" as far i used `_database.Buchung.AddObject(test);` and then `_database.SaveChanges();` and my DataGrid got updated. what do i false?
wpf
entity-framework
datagrid
sqlite3
order-by
null
open
Entity Framework orderby does not update datagrid === I'm new to C#, MVVM, WPF and Entity Framework my problem is, if I order the reading of the database (orderby) the datagrid will not be changed if I add a new row. if i do not order the reading it works. so addition infos: my database looks like this Table Konto KontoID KontoName Table Buchung KontoID BuchungsID Name BuchDate after the Konto is loaded it will load all related Buchungen _entityKontoView = new CollectionViewSource(); _entityBuchungView = new CollectionViewSource(); // Loads the Konto _entityKontoView.Source = _database.Konto; _entityKontoView.View.CurrentChanged += (x, y) => { _entityBuchungView.Source = ((Konto)_entityKontoView.View.CurrentItem).Buchung //.OrderBy(date => date.BuchDate) //.ThenBy(buchnr => buchnr.BuchungsID) ; }; _entityKontoView.View.Refresh(); when i do now an `OrderBy` the datagrid will not be update after new inserted Row i open the the database entity as follow: public static databaseEntities _database = new databaseEntities(); my XAML binding on DataGrid: ItemsSource="{Binding EntityBuchungsView.View}" and my columns binding ; Binding="{Binding Name}" as far i used `_database.Buchung.AddObject(test);` and then `_database.SaveChanges();` and my DataGrid got updated. what do i false?
0
11,319,278
07/03/2012 21:13:28
584,765
01/21/2011 17:09:26
122
0
Trying to use Gecko Engine with ABCPdf and classic ASP
i'm trying to create dynamic PDF's using ABCPdf and i'm having no success. I copied their sample code and tried it and i receive an error: Unable to render HTML. No MSHTML document is available. I'm trying to figure out how to use the Gecko engine to reder the page instead of IE and can't find how. Any help is greatly appreciated... thanks all!!! damien
abcpdf
null
null
null
null
null
open
Trying to use Gecko Engine with ABCPdf and classic ASP === i'm trying to create dynamic PDF's using ABCPdf and i'm having no success. I copied their sample code and tried it and i receive an error: Unable to render HTML. No MSHTML document is available. I'm trying to figure out how to use the Gecko engine to reder the page instead of IE and can't find how. Any help is greatly appreciated... thanks all!!! damien
0
1,388,597
09/07/2009 10:14:36
11,449
09/16/2008 08:03:12
2,697
140
std::vector and c-style arrays
I am experimenting with OpenCL to increase the speed of our software. We work with maps a lot and, to simplify, represent a map as a std::vector< std::vector<int> >. The OpenCL API takes raw c-style pointers as arguments, for example int* in the case above. My questions: - Are there implementation guarantees in the stl that vector is, internally, consecutive in memory? - Can I safely cast a std::vector<int> to int* and expect that to work? - In the case of a vector of vectors, can I still assume this holds true? I would expect the vector to hold other state data, or alignment issues, or maybe something else... - What is the best way to approach this? Write a custom 2d data structure that holds an internal, contiguous-in-memory buffer and work with that? I'd have to copy to/from vectors a lot... Thanks.
c++
stl
null
null
null
null
open
std::vector and c-style arrays === I am experimenting with OpenCL to increase the speed of our software. We work with maps a lot and, to simplify, represent a map as a std::vector< std::vector<int> >. The OpenCL API takes raw c-style pointers as arguments, for example int* in the case above. My questions: - Are there implementation guarantees in the stl that vector is, internally, consecutive in memory? - Can I safely cast a std::vector<int> to int* and expect that to work? - In the case of a vector of vectors, can I still assume this holds true? I would expect the vector to hold other state data, or alignment issues, or maybe something else... - What is the best way to approach this? Write a custom 2d data structure that holds an internal, contiguous-in-memory buffer and work with that? I'd have to copy to/from vectors a lot... Thanks.
0
11,372,742
07/07/2012 06:10:09
1,117,399
12/27/2011 09:40:46
23
0
I need help escaping string parameters for a javascript function using PHP
I am dynamically creating an anchor that calls a javascript function. It works with one string parameter but not with two. I believe I am not escaping the quotes around the parameters correctly. In search for an answer I came across the following onclick="alert('<?echo $row['username']?>')" and the next one I found left me completely baffled echo('<button type="button" id="button'.$ctr.'"onClick="showMapsInfo(\''.str_replace("'", "\\'", $maps_name).'\', \''.str_replace("'", "\\'", $ctr).'\');"><img src="img/maps_logo.gif"></button><br/>'); If someone would please 1) Explain why the single quotes around username do not have to be escaped? 2) Where there is a "dummies" write up on escaping characters so I could try to decipher the second example. Thank you.
php
javascript
null
null
null
null
open
I need help escaping string parameters for a javascript function using PHP === I am dynamically creating an anchor that calls a javascript function. It works with one string parameter but not with two. I believe I am not escaping the quotes around the parameters correctly. In search for an answer I came across the following onclick="alert('<?echo $row['username']?>')" and the next one I found left me completely baffled echo('<button type="button" id="button'.$ctr.'"onClick="showMapsInfo(\''.str_replace("'", "\\'", $maps_name).'\', \''.str_replace("'", "\\'", $ctr).'\');"><img src="img/maps_logo.gif"></button><br/>'); If someone would please 1) Explain why the single quotes around username do not have to be escaped? 2) Where there is a "dummies" write up on escaping characters so I could try to decipher the second example. Thank you.
0
11,372,713
07/07/2012 06:02:54
240,687
12/30/2009 06:37:24
53
1
A minimal example of boost parallel graph?
Can someone give a minimal example of boost parallel graph? Thanks a lot! I use the example in libs\graph_parallel\example\dijkstra_shortest_paths.cpp, but the program will fail in graph::metis_reader reader(in); Then I follow the tutorial in http://osl.iu.edu/research/pbgl/documentation/dijkstra_example.html. But it gives error: "error C2039: “process_group”: is not a member of “boost::mpi”" So I use "mpi::process_group<mpi::immediateS> process_group_type" instead, this time running error " test1.exe!boost::graph::distributed::mpi_process_group::impl::impl() + 0x216 字节 C++ " occurs...
boost
graph
parallel-processing
null
null
null
open
A minimal example of boost parallel graph? === Can someone give a minimal example of boost parallel graph? Thanks a lot! I use the example in libs\graph_parallel\example\dijkstra_shortest_paths.cpp, but the program will fail in graph::metis_reader reader(in); Then I follow the tutorial in http://osl.iu.edu/research/pbgl/documentation/dijkstra_example.html. But it gives error: "error C2039: “process_group”: is not a member of “boost::mpi”" So I use "mpi::process_group<mpi::immediateS> process_group_type" instead, this time running error " test1.exe!boost::graph::distributed::mpi_process_group::impl::impl() + 0x216 字节 C++ " occurs...
0
11,372,716
07/07/2012 06:03:26
1,388,882
05/11/2012 07:41:49
1
0
using jar in different OS
I Have created a jar in Eclipse of my Java project in JRE 1.7 compliance level in windows 7 OS. The generated jar is running well in my system in a sample test application. Now I want to use this Jar is my android application on Mac OS with JRE 1.6.0..... Is there any conflict will come due to this because there are errors lyk Class Not found exception in android aplication using ADT 20 or davlik conversion failed error 1.
java
android
jar
null
null
null
open
using jar in different OS === I Have created a jar in Eclipse of my Java project in JRE 1.7 compliance level in windows 7 OS. The generated jar is running well in my system in a sample test application. Now I want to use this Jar is my android application on Mac OS with JRE 1.6.0..... Is there any conflict will come due to this because there are errors lyk Class Not found exception in android aplication using ADT 20 or davlik conversion failed error 1.
0
11,372,747
07/07/2012 06:11:01
1,506,199
07/06/2012 08:43:00
3
0
information fill in info.plist file in iPhone Application
I am new in iPhone Application development want to know about info.plist what thing i need to set before code signing. please help Bundle Display name Executable Name Bundle identifier Bundle Name Bundle OS Type Code Bundle Creator OS Type Code Bundle Version please help
iphone
ios
xcode
null
null
null
open
information fill in info.plist file in iPhone Application === I am new in iPhone Application development want to know about info.plist what thing i need to set before code signing. please help Bundle Display name Executable Name Bundle identifier Bundle Name Bundle OS Type Code Bundle Creator OS Type Code Bundle Version please help
0
11,372,754
07/07/2012 06:12:28
145,682
07/27/2009 11:23:31
1,503
132
enabling start, stop feature for a folder watcher program
The code below doesn't work like I want it to. When I do `svc.run()` the programs runs okay. Any changes I've made to my folder works file. But when I do `svc.stop()` it doesn't exactly stop I think. Perhaps there must be a better way of doing the threading part... import pyinotify import threading import time import os class fs_event_handler(pyinotify.ProcessEvent): def __init__(self, callback): self._callback = callback def process_IN_CREATE(self, e): self._callback(e.path, e.name, 'created') def process_IN_DELETE(self, e): self._callback(e.path, e.name, 'deleted') def process_IN_MODIFY(self, e): self._callback(e.path, e.name, 'modified') class NotificationService(): def __init__(self, path, callback): mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE \ | pyinotify.IN_MODIFY w = pyinotify.WatchManager() self.__notifier = pyinotify.Notifier(w, fs_event_handler(callback)) wdd = w.add_watch(path, mask, rec=True, auto_add=True) self.__loop = True def start(self): while self.__loop: self.__notifier.process_events() if self.__notifier.check_events(): self.__notifier.read_events() def run(self): fm = FileMonitor(self) fm.start() print 'Service Running...' def stop(self): self.__notifier.stop() self.__loop = False class FileMonitor(threading.Thread): def __init__(self, srvc): threading.Thread.__init__(self) self.__svc = srvc def run(self): self.__svc.start() print 'Service stopped' def _callback(path, name, operation): zpad = lambda x: ''.join(['0', str(x)])[:2] ts = time.localtime() t = ':'.join(map(zpad, [ts.tm_hour, ts.tm_min, ts.tm_sec])) print t, ':', '%s was %s' % (os.path.join(path, name), operation) p = '/home/deostroll/scripts/tmp' svc = NotificationService(p, _callback) svc.run()
python
pyinotify
null
null
null
null
open
enabling start, stop feature for a folder watcher program === The code below doesn't work like I want it to. When I do `svc.run()` the programs runs okay. Any changes I've made to my folder works file. But when I do `svc.stop()` it doesn't exactly stop I think. Perhaps there must be a better way of doing the threading part... import pyinotify import threading import time import os class fs_event_handler(pyinotify.ProcessEvent): def __init__(self, callback): self._callback = callback def process_IN_CREATE(self, e): self._callback(e.path, e.name, 'created') def process_IN_DELETE(self, e): self._callback(e.path, e.name, 'deleted') def process_IN_MODIFY(self, e): self._callback(e.path, e.name, 'modified') class NotificationService(): def __init__(self, path, callback): mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE \ | pyinotify.IN_MODIFY w = pyinotify.WatchManager() self.__notifier = pyinotify.Notifier(w, fs_event_handler(callback)) wdd = w.add_watch(path, mask, rec=True, auto_add=True) self.__loop = True def start(self): while self.__loop: self.__notifier.process_events() if self.__notifier.check_events(): self.__notifier.read_events() def run(self): fm = FileMonitor(self) fm.start() print 'Service Running...' def stop(self): self.__notifier.stop() self.__loop = False class FileMonitor(threading.Thread): def __init__(self, srvc): threading.Thread.__init__(self) self.__svc = srvc def run(self): self.__svc.start() print 'Service stopped' def _callback(path, name, operation): zpad = lambda x: ''.join(['0', str(x)])[:2] ts = time.localtime() t = ':'.join(map(zpad, [ts.tm_hour, ts.tm_min, ts.tm_sec])) print t, ':', '%s was %s' % (os.path.join(path, name), operation) p = '/home/deostroll/scripts/tmp' svc = NotificationService(p, _callback) svc.run()
0
11,372,763
07/07/2012 06:15:57
686,227
06/29/2010 03:41:20
33
7
how to join a subquery with conditions in Squeel
I've embraced Squeel – and enjoying every step! Thank you so much for sharing, Ernie Miller! With ruby 1.9.2 and Squeel 1.0.2 and Rails 3.2.5, I'm building authorization of access to rows (and controllers and actions, actually,) on "the way to paginating" SELECT's in response to, say **user_groups#index**, and this had me wanting to add an "authorizations" column on each SELECT'ed row – in order for my partials to be able to add/leave out links to show/edit/delete rows. # # Class method to providing for index SELECT's being married with roleables (permissions) # used from abstraction_actions_controller where build_collection calls this method # the result 'should' be an ActiveRelation - used for the Kamanari 'result' call to readying pagination # def self.with_authorizations # # SELECT * FROM any_table at # left join ( # select r.roleable_id, r.roleable_type, group_concat( r.authorization ) # from roleables r # where r.authorization is not null # and r.roleable_id=at.id # and r.roleable_type=at.base_class # and r.role_id not in (1,2,3) # ) rm on rm.roleable_id=at.id and rm.roleable_type=at.base_class # # which will provide for this: # # |.......| last column in table 'at' | roleable_id | roleable_type | authorizations | # |.......| some value | 1 | 'User' | 'insert,create'| # |.......| yet another value | 92 | 'User' | 'read' | # # debugger self.where{ active==true } end I like the ```joins{ roleables(my{self}) }``` but I just cannot seem to get the rest of the SQL restructured :( I've tried with a subquery like Roleable.permissions.select{ group_concat( authorization ) }.where{ (roleable_id==1) & (roleable_type=='User') } and that does handle the subquery - except for the _id and the _type which will be the id of each selected row and the class.to_s of the selected row instance (or rather the class of the singleton doing the call in the first place - like User.joins... etc. - and then there's the business with the role_id in () - which translates into where{ roleables.role_id >> current_user.roles } but how do I amass this into the rest Arrgghhh, what a mess :( So - why don't I just fire the SQL away? Well, I'd like to, but the result has to be compatible with Kamanari - 'cause after this comes pagination - so, that's why <:) (but I'm certainly open for any alternative which will let me return something that Kamanari will pagination) :)
join
subquery
squeel
null
null
null
open
how to join a subquery with conditions in Squeel === I've embraced Squeel – and enjoying every step! Thank you so much for sharing, Ernie Miller! With ruby 1.9.2 and Squeel 1.0.2 and Rails 3.2.5, I'm building authorization of access to rows (and controllers and actions, actually,) on "the way to paginating" SELECT's in response to, say **user_groups#index**, and this had me wanting to add an "authorizations" column on each SELECT'ed row – in order for my partials to be able to add/leave out links to show/edit/delete rows. # # Class method to providing for index SELECT's being married with roleables (permissions) # used from abstraction_actions_controller where build_collection calls this method # the result 'should' be an ActiveRelation - used for the Kamanari 'result' call to readying pagination # def self.with_authorizations # # SELECT * FROM any_table at # left join ( # select r.roleable_id, r.roleable_type, group_concat( r.authorization ) # from roleables r # where r.authorization is not null # and r.roleable_id=at.id # and r.roleable_type=at.base_class # and r.role_id not in (1,2,3) # ) rm on rm.roleable_id=at.id and rm.roleable_type=at.base_class # # which will provide for this: # # |.......| last column in table 'at' | roleable_id | roleable_type | authorizations | # |.......| some value | 1 | 'User' | 'insert,create'| # |.......| yet another value | 92 | 'User' | 'read' | # # debugger self.where{ active==true } end I like the ```joins{ roleables(my{self}) }``` but I just cannot seem to get the rest of the SQL restructured :( I've tried with a subquery like Roleable.permissions.select{ group_concat( authorization ) }.where{ (roleable_id==1) & (roleable_type=='User') } and that does handle the subquery - except for the _id and the _type which will be the id of each selected row and the class.to_s of the selected row instance (or rather the class of the singleton doing the call in the first place - like User.joins... etc. - and then there's the business with the role_id in () - which translates into where{ roleables.role_id >> current_user.roles } but how do I amass this into the rest Arrgghhh, what a mess :( So - why don't I just fire the SQL away? Well, I'd like to, but the result has to be compatible with Kamanari - 'cause after this comes pagination - so, that's why <:) (but I'm certainly open for any alternative which will let me return something that Kamanari will pagination) :)
0
11,410,208
07/10/2012 09:18:08
863,584
07/26/2011 13:56:30
13
9
Issue while switching between two UIviewcontroller
HI I'm developing a app which is having two viewcontrollers. I'm loading login screen with calling UIModalPresentationFormSheet from firstviewcontroller. once the user clicks on the login button it should make a server call and should send the response. I'm calling that server call method like this in second view controller RatingsAndEquitiesService *REService = [[RatingsAndEquitiesService alloc] initWithTarget:self action:@selector(connectionSuccess:) failAction:@selector(connectionFailure:)]; In server call class I'm returning the received data like this [target performSelectorOnMainThread:action withObject:data waitUntilDone:YES]; After the server call either connectionSuccess/connectionFailure is calling respectively in the second view controller. But here my issue is I want to reload the table view data which is located in first view controller after server call has been done. In first view controller i created one method like reloadData and I'm calling this method from connectionSuccess method of first view controller. But my [tableview reloaddata] is not calling which is in first view controller. How to solve this problem? Can some one please suggest me.
uitableview
uiviewcontroller
null
null
null
null
open
Issue while switching between two UIviewcontroller === HI I'm developing a app which is having two viewcontrollers. I'm loading login screen with calling UIModalPresentationFormSheet from firstviewcontroller. once the user clicks on the login button it should make a server call and should send the response. I'm calling that server call method like this in second view controller RatingsAndEquitiesService *REService = [[RatingsAndEquitiesService alloc] initWithTarget:self action:@selector(connectionSuccess:) failAction:@selector(connectionFailure:)]; In server call class I'm returning the received data like this [target performSelectorOnMainThread:action withObject:data waitUntilDone:YES]; After the server call either connectionSuccess/connectionFailure is calling respectively in the second view controller. But here my issue is I want to reload the table view data which is located in first view controller after server call has been done. In first view controller i created one method like reloadData and I'm calling this method from connectionSuccess method of first view controller. But my [tableview reloaddata] is not calling which is in first view controller. How to solve this problem? Can some one please suggest me.
0
11,410,210
07/10/2012 09:18:18
1,289,834
03/24/2012 10:41:43
12
0
How to change particles' view in Unity 3D?
I have an empty game object.I added ellipsoid particle emitter,particle renderer and particle animator components to it.Particles which are being emitted from ellipsoid particle emitter are in square shape.I added them a C# script and thanks to this script they are moving like water.But the view is not water view.How can i give them a water view?I'm pretty new to Unity platform.With adding some code to script or doing sth. else?Thanks for help.
rendering
unity3d
particles
null
null
null
open
How to change particles' view in Unity 3D? === I have an empty game object.I added ellipsoid particle emitter,particle renderer and particle animator components to it.Particles which are being emitted from ellipsoid particle emitter are in square shape.I added them a C# script and thanks to this script they are moving like water.But the view is not water view.How can i give them a water view?I'm pretty new to Unity platform.With adding some code to script or doing sth. else?Thanks for help.
0
11,410,213
07/10/2012 09:18:37
1,469,523
06/20/2012 14:14:40
66
3
Why Object#wait is not a "reasonable opportunity" for Display.asyncExec or Display.asyncExec?
I am trying to show progress while I am reading an excel file. I share an Object that contains the maximum row number and the last row number read. Every 150 rows I save the value in my object, I put it to wait and my reading is stopped until the object is unlocked. In my dialog window I try to update the `ProgressBar` using syncExec or asyncExec methods with values within the Object. And the Object is unlocked just after calling the methods. I know that those methods are waiting for the most "suitable" occasion to run there runnables. However what I do not seem to understand is, why those methods are not executed if there is nothing running while they are called? My actual situation is that asyncExec updates the ProgressBar only at the end of the reading process and synExec hangs the application, because it cannot execute while Object#wait is running. Thanks for reading and more thanks for answering.
java
multithreading
swt
null
null
null
open
Why Object#wait is not a "reasonable opportunity" for Display.asyncExec or Display.asyncExec? === I am trying to show progress while I am reading an excel file. I share an Object that contains the maximum row number and the last row number read. Every 150 rows I save the value in my object, I put it to wait and my reading is stopped until the object is unlocked. In my dialog window I try to update the `ProgressBar` using syncExec or asyncExec methods with values within the Object. And the Object is unlocked just after calling the methods. I know that those methods are waiting for the most "suitable" occasion to run there runnables. However what I do not seem to understand is, why those methods are not executed if there is nothing running while they are called? My actual situation is that asyncExec updates the ProgressBar only at the end of the reading process and synExec hangs the application, because it cannot execute while Object#wait is running. Thanks for reading and more thanks for answering.
0
11,410,215
07/10/2012 09:18:44
1,279,929
03/20/2012 03:08:31
89
21
facebook get user_access_token error
I have used facebook graph api to get user access token via: https://graph.facebook.com/oauth/access_token?client_id=#{APP_ID}&redirect_uri=#{REDIRECT_URI}&client_secret=#{SECRET_ID}&code=" + facebookcode but what I get is: { "error": { "message": "client_secret must be passed over HTTPS", "type": "OAuthException", "code": 1 } } It just happened few hours ago. Need your help ! Thanks,
facebook
facebook-graph-api
null
null
null
null
open
facebook get user_access_token error === I have used facebook graph api to get user access token via: https://graph.facebook.com/oauth/access_token?client_id=#{APP_ID}&redirect_uri=#{REDIRECT_URI}&client_secret=#{SECRET_ID}&code=" + facebookcode but what I get is: { "error": { "message": "client_secret must be passed over HTTPS", "type": "OAuthException", "code": 1 } } It just happened few hours ago. Need your help ! Thanks,
0
11,409,669
07/10/2012 08:46:11
1,108,213
12/20/2011 15:53:11
4,683
370
Difference between ApplicationInfo and PackageInfo?
I have several general question about ApplicationInfo and PackageInfo classes. Here they are: 1. Can someone describe the difference between ApplicationInfo and PackageInfo? 2. How do they correlate with each other? 3. In which cases ApplicationInfo is used and when PackageInfo is used? Thank you for the help!
android
android-package-managers
null
null
null
null
open
Difference between ApplicationInfo and PackageInfo? === I have several general question about ApplicationInfo and PackageInfo classes. Here they are: 1. Can someone describe the difference between ApplicationInfo and PackageInfo? 2. How do they correlate with each other? 3. In which cases ApplicationInfo is used and when PackageInfo is used? Thank you for the help!
0
11,410,016
07/10/2012 09:06:41
1,016,200
10/27/2011 09:28:26
37
2
How to create login in windows phone application?
I want to make login page to my application ... But it is not save the data while sign up ... Here is my code ... //String data; Debug.WriteLine(username_signup_textbox.Text); Debug.WriteLine(password_signup_textbox.Password); WebClient signup = new WebClient(); StringBuilder data = new StringBuilder(); data.AppendFormat("{0}={1}&", "username", HttpUtility.UrlEncode(username_signup_textbox.Text)); data.AppendFormat("{0}={1}", "password", HttpUtility.UrlEncode(password_signup_textbox.Password)); //data = "username=" + username_signup_textbox.Text + "&password=" + password_signup_textbox.Text; //signup.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; //signup.Headers[HttpRequestHeader.ContentLength] = data.Length.ToString(); signup.Headers["Content-type"] = "application/xml"; signup.Encoding = Encoding.UTF8; Uri uri = new Uri("http://192.168.1.105/signup.xml", UriKind.Absolute); signup.UploadStringCompleted += new UploadStringCompletedEventHandler(signup_UploadStringCompleted); signup.UploadProgressChanged += new UploadProgressChangedEventHandler(signup_UploadProgressChanged); signup.UploadStringAsync(uri, "POST", data.ToString()); Debug.WriteLine(data.ToString()); any idea where is that not correct? thank you.
c#
windows-phone-7
login
null
null
null
open
How to create login in windows phone application? === I want to make login page to my application ... But it is not save the data while sign up ... Here is my code ... //String data; Debug.WriteLine(username_signup_textbox.Text); Debug.WriteLine(password_signup_textbox.Password); WebClient signup = new WebClient(); StringBuilder data = new StringBuilder(); data.AppendFormat("{0}={1}&", "username", HttpUtility.UrlEncode(username_signup_textbox.Text)); data.AppendFormat("{0}={1}", "password", HttpUtility.UrlEncode(password_signup_textbox.Password)); //data = "username=" + username_signup_textbox.Text + "&password=" + password_signup_textbox.Text; //signup.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; //signup.Headers[HttpRequestHeader.ContentLength] = data.Length.ToString(); signup.Headers["Content-type"] = "application/xml"; signup.Encoding = Encoding.UTF8; Uri uri = new Uri("http://192.168.1.105/signup.xml", UriKind.Absolute); signup.UploadStringCompleted += new UploadStringCompletedEventHandler(signup_UploadStringCompleted); signup.UploadProgressChanged += new UploadProgressChangedEventHandler(signup_UploadProgressChanged); signup.UploadStringAsync(uri, "POST", data.ToString()); Debug.WriteLine(data.ToString()); any idea where is that not correct? thank you.
0
11,410,017
07/10/2012 09:07:01
509,663
11/16/2010 15:13:30
6,277
325
Git Submodule update over https
I am sitting on a proxy which only allows http/https traffic only, I am able to clone a repository from Github, but I have to fetch/push using the https URL and username/password. Now my issues is a repository with submodules, when I execute `git submodule update` it times out, and I can only assume this is because it's using an SSH connection which is blocked. (it doesn't even ask me for a password on private repos)
git
proxy
git-submodules
null
null
null
open
Git Submodule update over https === I am sitting on a proxy which only allows http/https traffic only, I am able to clone a repository from Github, but I have to fetch/push using the https URL and username/password. Now my issues is a repository with submodules, when I execute `git submodule update` it times out, and I can only assume this is because it's using an SSH connection which is blocked. (it doesn't even ask me for a password on private repos)
0
11,410,018
07/10/2012 09:07:04
1,074,172
11/30/2011 20:12:01
92
1
Update data from another table, MSSQL
I need to update some data from another table.. I want to simply take the data from col1 in table1 to col1 in table2, the rows are at the same position so there aint really any id-comparing thats need to be done.. how can I do this?
sql
sql-server
null
null
null
null
open
Update data from another table, MSSQL === I need to update some data from another table.. I want to simply take the data from col1 in table1 to col1 in table2, the rows are at the same position so there aint really any id-comparing thats need to be done.. how can I do this?
0
11,410,218
07/10/2012 09:19:07
1,085,611
12/07/2011 12:38:35
68
2
C++ vector memory errors for a start/stop sorting algorithm
I have two problems, first the below code is quitting randomly because of a memory or uninitialized place error, I just can't see it. second, I'm not sure that the algorithm is correct. (The algorithm is suppose to simulate the [Hanbury Brown Twiss](http://en.wikipedia.org/wiki/Hanbury_Brown_and_Twiss_effect) photonics experiment for anyone who cares) The vectors are made up of linearly increasing time stamps, where the stop signal is delayed by 180 seconds, if the i_th start signal is less than the i_th stop signal, the timer starts, ignoring all start signals until the timer meets a stop signal, and vica versa, if the timer is stopped, all stops should be ignored until a start is registered. The code should then [bucket sort](http://en.wikipedia.org/wiki/Bucket_sort) the time difference between these start/stops. -If there is a name for this kind of sort please post it below. The below code takes these filled vectors and tries to simulate this process. but I cant figure out what wrong with the memory issues before I get back to fixing the algorithm. this is the code I have that doesn't work all the time, it works for start/stop vectors smaller than 10,000 double, but I need it to iterate through up to 100,000 doubles. while( starts.size() > 5 && stops.size() > 5 ){ if( start.at(0) >= stop.at(0) ){ thisStart = starts.at(0); } j=0; while( stops.at(j) <= starts.at(0) ){ j++; } stops.erase(stops.begin(), stops.begin() + j + 1 ); thisStop = stops.at(0); j=0; while( starts.at(j) <= thisStop){ j++; } starts.erase(starts.begin(), starts.begin() + j+1 ); bucketSort(thisStop - thisStart, bins, &counts); }
c++
stl
vector
simulation
null
null
open
C++ vector memory errors for a start/stop sorting algorithm === I have two problems, first the below code is quitting randomly because of a memory or uninitialized place error, I just can't see it. second, I'm not sure that the algorithm is correct. (The algorithm is suppose to simulate the [Hanbury Brown Twiss](http://en.wikipedia.org/wiki/Hanbury_Brown_and_Twiss_effect) photonics experiment for anyone who cares) The vectors are made up of linearly increasing time stamps, where the stop signal is delayed by 180 seconds, if the i_th start signal is less than the i_th stop signal, the timer starts, ignoring all start signals until the timer meets a stop signal, and vica versa, if the timer is stopped, all stops should be ignored until a start is registered. The code should then [bucket sort](http://en.wikipedia.org/wiki/Bucket_sort) the time difference between these start/stops. -If there is a name for this kind of sort please post it below. The below code takes these filled vectors and tries to simulate this process. but I cant figure out what wrong with the memory issues before I get back to fixing the algorithm. this is the code I have that doesn't work all the time, it works for start/stop vectors smaller than 10,000 double, but I need it to iterate through up to 100,000 doubles. while( starts.size() > 5 && stops.size() > 5 ){ if( start.at(0) >= stop.at(0) ){ thisStart = starts.at(0); } j=0; while( stops.at(j) <= starts.at(0) ){ j++; } stops.erase(stops.begin(), stops.begin() + j + 1 ); thisStop = stops.at(0); j=0; while( starts.at(j) <= thisStop){ j++; } starts.erase(starts.begin(), starts.begin() + j+1 ); bucketSort(thisStop - thisStart, bins, &counts); }
0
11,410,100
07/10/2012 09:11:50
1,514,204
07/10/2012 08:39:18
1
0
Worker can not be in the next HIT after finishing a HIT when using external quesiton
I'm working on mturk. I'm using external question to get anwser from workers. When a worker finishs the task on our server and successfully sends data to Amazon server, the site can not get to the next HIT. It just stays on same HIT I don't know whether i got mistake somewhere. Is there any way to get site to the next HIT in the current group after a worker has finished a HIT? The url used to submit to Amazon, https://workersandbox.mturk.com/mturk/externalSubmit?assignmentId=2X4WYB49F&workerId=ADMEX32 Beside that, the 'submit hit' button is disable in the external question
amazon-web-services
null
null
null
null
null
open
Worker can not be in the next HIT after finishing a HIT when using external quesiton === I'm working on mturk. I'm using external question to get anwser from workers. When a worker finishs the task on our server and successfully sends data to Amazon server, the site can not get to the next HIT. It just stays on same HIT I don't know whether i got mistake somewhere. Is there any way to get site to the next HIT in the current group after a worker has finished a HIT? The url used to submit to Amazon, https://workersandbox.mturk.com/mturk/externalSubmit?assignmentId=2X4WYB49F&workerId=ADMEX32 Beside that, the 'submit hit' button is disable in the external question
0
11,410,225
07/10/2012 09:19:26
1,264,741
03/12/2012 17:43:19
1
0
To adjust the view when keyboard is on the android
I have a activity in which there are 15 editText box. My problem is that when the soft keyboard comes up the editText present at bottom hides. I tried android:windowSoftInputMode="adjustResize" in Manifest file. But this did not worked. I want edit Text boxes present at bottom to come up when they are clicked.
android
null
null
null
null
null
open
To adjust the view when keyboard is on the android === I have a activity in which there are 15 editText box. My problem is that when the soft keyboard comes up the editText present at bottom hides. I tried android:windowSoftInputMode="adjustResize" in Manifest file. But this did not worked. I want edit Text boxes present at bottom to come up when they are clicked.
0
11,410,226
07/10/2012 09:19:37
877,644
08/04/2011 00:14:55
1,176
69
Running Node.js App with cluster module is meaningless in Heroku?
**Heroku** can run ##Web Dynos and ##Worker Dynos so that **Web Dynos** take care of routes and worker **Worker Dynos** take care of processing works. Since there is a unit of **Dyno**, It seems using Node.js cluster module is meaningless to me on Heroku. Because Node.js cluster module is to use all cores of server CPU and **Dyno** seems virtual unit of CPU core to me. Am I right? Or is it still worth to run a node.js app with cluster module?
node.js
heroku
cluster-computing
null
null
null
open
Running Node.js App with cluster module is meaningless in Heroku? === **Heroku** can run ##Web Dynos and ##Worker Dynos so that **Web Dynos** take care of routes and worker **Worker Dynos** take care of processing works. Since there is a unit of **Dyno**, It seems using Node.js cluster module is meaningless to me on Heroku. Because Node.js cluster module is to use all cores of server CPU and **Dyno** seems virtual unit of CPU core to me. Am I right? Or is it still worth to run a node.js app with cluster module?
0
11,410,228
07/10/2012 09:19:45
1,481,107
06/25/2012 21:09:00
16
2
How to give libusb 0.1.12 permissions for Android?
I have to use libusb in my Android project. So far I have read alot on the internet that it is not so easy to use libusb with Android. I read something about init.rc and ueventd.rc and that I have to give some permissions for the usb. But because I am Android beginner I wanted to ask whether you could give me some more details how to make libusb work on Android. What are the steps needed to be done? Thanks in advance.
android
android-ndk
libusb
null
null
null
open
How to give libusb 0.1.12 permissions for Android? === I have to use libusb in my Android project. So far I have read alot on the internet that it is not so easy to use libusb with Android. I read something about init.rc and ueventd.rc and that I have to give some permissions for the usb. But because I am Android beginner I wanted to ask whether you could give me some more details how to make libusb work on Android. What are the steps needed to be done? Thanks in advance.
0
11,401,042
07/09/2012 18:38:03
655,145
03/11/2011 10:01:19
322
10
Redirecting to correct view after login
I'm trying to implement login functionality for a webapp. There's a Javascript version using JQuery and there's a non-Javascript version. The Javascript version is working fine, but I have a problem with the non-JS version: Currently when the user clicks "login" I'm reloading the same page with a parameter which causes a loginform to be displayed (that means I don't have an explicit login view). After the login or in case of any input errors I want the ViewController to go back to the view where the user initiated the login process. I cannot use a redirect for that, because especially the rejectedValues would be lost then. What I really need to do is redirect to the view-name on which the login-form was opened. Is there a elegant way to do this or is it just a better idea to use a seperate login template? Thanks in advance for any input!
java
spring
spring-mvc
velocity
null
null
open
Redirecting to correct view after login === I'm trying to implement login functionality for a webapp. There's a Javascript version using JQuery and there's a non-Javascript version. The Javascript version is working fine, but I have a problem with the non-JS version: Currently when the user clicks "login" I'm reloading the same page with a parameter which causes a loginform to be displayed (that means I don't have an explicit login view). After the login or in case of any input errors I want the ViewController to go back to the view where the user initiated the login process. I cannot use a redirect for that, because especially the rejectedValues would be lost then. What I really need to do is redirect to the view-name on which the login-form was opened. Is there a elegant way to do this or is it just a better idea to use a seperate login template? Thanks in advance for any input!
0
11,401,045
07/09/2012 18:38:08
920,981
08/31/2011 05:17:05
59
4
SQL - Partitioning effect on indexes and Transaction log
Question: I'm wondering if I can apply an index on a table without filling the transaction log up. Detail: I have a table that is 800GB. A few months ago I went to apply an index on it and the transaction log filled up (for obvious reasons - was dumb of me to even attempt it). Instead I had to create the table over again, apply the index I wanted and then copy the records over. Now we are going to be setting up partitions on this table. I'm wondering if I remove the clustered index and apply the new clustered index on a partitioning layout if it will still fill up the transaction log (assume I have 10 million rows per partition)? Or will the tlog not fill up because the indexes would also be partitioned which would allow the SQL server to finish an index faster and be able to checkpoint? Does anybody have any idea? Otherwise I can just re-create the table again and apply the partition stuff to it and re-fill it but obviously that is much more involved. Thanks!
sql-server
database-partitioning
transaction-log
reindex
null
null
open
SQL - Partitioning effect on indexes and Transaction log === Question: I'm wondering if I can apply an index on a table without filling the transaction log up. Detail: I have a table that is 800GB. A few months ago I went to apply an index on it and the transaction log filled up (for obvious reasons - was dumb of me to even attempt it). Instead I had to create the table over again, apply the index I wanted and then copy the records over. Now we are going to be setting up partitions on this table. I'm wondering if I remove the clustered index and apply the new clustered index on a partitioning layout if it will still fill up the transaction log (assume I have 10 million rows per partition)? Or will the tlog not fill up because the indexes would also be partitioned which would allow the SQL server to finish an index faster and be able to checkpoint? Does anybody have any idea? Otherwise I can just re-create the table again and apply the partition stuff to it and re-fill it but obviously that is much more involved. Thanks!
0
11,401,046
07/09/2012 18:38:16
1,276,567
03/18/2012 05:51:22
103
8
Is there a web library preferably in PHP that will let me change all the given passwords of pdfs in a folder of the site?
I have some files that need to have their password changed everyweek. They will be placed along a bunch of other files. I need to find a library that can find all the pdfs in a folder and change their passwords given the old one (not for cracking). I have looked around and there really isn't much about this.
php
pdf
web
passwords
null
null
open
Is there a web library preferably in PHP that will let me change all the given passwords of pdfs in a folder of the site? === I have some files that need to have their password changed everyweek. They will be placed along a bunch of other files. I need to find a library that can find all the pdfs in a folder and change their passwords given the old one (not for cracking). I have looked around and there really isn't much about this.
0
11,401,048
07/09/2012 18:38:21
1,615
08/17/2008 15:19:59
2,618
40
Why is setBackgroundColor() failing with my custom theme?
I thought I successfully created a striped Android ListView, in which the background colors of the list items alternate. It works perfectly when I use Theme.Holo.Light as my application's theme (<application ..... android:theme="@android:style/Theme.Holo.Light">, in the Manifest.) However, when I defined a custom theme for my app, with a custom background color, the stripes disappeared, replaced by the single background color defined in my theme. **Why is it that my custom theme's background color cannot be overridden by setBackgroundColor() in getView()? How can I fix this issue?** Thanks! Theme: <style name="Basic"> <item name="android:textColor">#000000</item> <item name="android:background">@color/background_color</item> </style> getView(): @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout itemView; Resources res = getResources(); int[] colors = new int[] {res.getColor(R.color.list_stripe_1),res.getColor(R.color.list_stripe_2)}; if (convertView == null){ itemView = new LinearLayout(getContext()); String inflater = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater viewInflater; viewInflater = (LayoutInflater)getContext().getSystemService(inflater); viewInflater.inflate(resource, itemView, true); } else { itemView = (LinearLayout) convertView; } ////Omitting code for populating TextViews.. itemView.setBackgroundColor(colors[position%colors.length]); return itemView; }
java
android
styles
themes
null
null
open
Why is setBackgroundColor() failing with my custom theme? === I thought I successfully created a striped Android ListView, in which the background colors of the list items alternate. It works perfectly when I use Theme.Holo.Light as my application's theme (<application ..... android:theme="@android:style/Theme.Holo.Light">, in the Manifest.) However, when I defined a custom theme for my app, with a custom background color, the stripes disappeared, replaced by the single background color defined in my theme. **Why is it that my custom theme's background color cannot be overridden by setBackgroundColor() in getView()? How can I fix this issue?** Thanks! Theme: <style name="Basic"> <item name="android:textColor">#000000</item> <item name="android:background">@color/background_color</item> </style> getView(): @Override public View getView(int position, View convertView, ViewGroup parent) { LinearLayout itemView; Resources res = getResources(); int[] colors = new int[] {res.getColor(R.color.list_stripe_1),res.getColor(R.color.list_stripe_2)}; if (convertView == null){ itemView = new LinearLayout(getContext()); String inflater = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater viewInflater; viewInflater = (LayoutInflater)getContext().getSystemService(inflater); viewInflater.inflate(resource, itemView, true); } else { itemView = (LinearLayout) convertView; } ////Omitting code for populating TextViews.. itemView.setBackgroundColor(colors[position%colors.length]); return itemView; }
0
11,401,050
07/09/2012 18:38:32
69,993
02/23/2009 18:24:15
4,504
141
Problems with preventing caching of 500 internal error page in php
I'm having a problem completely properly configuring behavior for 500 Internal Server Error pages. I have two main use cases: No headers sent --------------- Fix here is simple, just throw http 500 errors without changing url. Partial page error ------------------ In this case, some html & http headers were already sent to the client. In order to prevent a partly broken page from displaying, I output javascript that causes a redirect completely to an error page url, /error.html . This is to avoid displaying part of a normal page and part of an error page, and make it clear that the resulting html is not optimal even if the section that the error message ends up being displayed in is currently hidden, by moving to a dedicated error page. Unfortunately, when hitting "back" from the dedicated error page, the original erroring page gets cached, and the javascript redirect is performed again, even if the error has been fixed in the meantime. For example, if there is an error after headers are sent in index.php, javascript will output that redirects a user to /error.html. Once there, they can return to the homepage (which should be fine), or hit back. When they hit back, they may get a cached page that re-redirects them to error.html. index.php > error.html (hit back) cached index.php > error.html What is the ideal way to avoid this situation? In the code below, I try to add #error hash in the url to redirect only the first time, and on subsequent visits to a broken partial page start a 60 second refresh attempt cycle. Unfortunately, when I set the #error hash and the redirect, then hit back, it goes to index.php, not index.php#error, so the cached infinite loop occurs. How do I gracefully handle partial-page 500 errors? Here is the code in my php custom error handler, which causes the above listed behavior: function showErrorPage() { if (headers_sent()) { // This is complicated due to the infastructure tending to have already sent headers, ... // ...requiring a tuned javascript redirection in many instances. // Output the following as html. ?> <meta http-equiv="Cache-control" content="no-cache, no-store"> <script type='text/javascript'> var currentHash = location.hash; // UNFORTUNATELY, HERE THE HASH NEVER SHOWS AS SET! if(!currentHash){ // If hash wasn't already set... location.hash = '#error'; location.href = 'error.html'; // Redirect once. } else { // Otherwise, the hash was already set, they were redirected once but came back. // So just display this page for a time but refresh on a slow schedule. setTimeout(function(){ location.reload(true); // Non-caching refresh. }, 60*1000); // Reload after 1 min delay } </script> <?php } else { // No headers sent, so set the right headers header("HTTP/1.1 500 Internal Server Error"); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past } // Regardless, include the visible error output and throw exit with error. include(WEB_ROOT.'error.html'); exit(1); }
php
javascript
error-handling
http-status-code-500
null
null
open
Problems with preventing caching of 500 internal error page in php === I'm having a problem completely properly configuring behavior for 500 Internal Server Error pages. I have two main use cases: No headers sent --------------- Fix here is simple, just throw http 500 errors without changing url. Partial page error ------------------ In this case, some html & http headers were already sent to the client. In order to prevent a partly broken page from displaying, I output javascript that causes a redirect completely to an error page url, /error.html . This is to avoid displaying part of a normal page and part of an error page, and make it clear that the resulting html is not optimal even if the section that the error message ends up being displayed in is currently hidden, by moving to a dedicated error page. Unfortunately, when hitting "back" from the dedicated error page, the original erroring page gets cached, and the javascript redirect is performed again, even if the error has been fixed in the meantime. For example, if there is an error after headers are sent in index.php, javascript will output that redirects a user to /error.html. Once there, they can return to the homepage (which should be fine), or hit back. When they hit back, they may get a cached page that re-redirects them to error.html. index.php > error.html (hit back) cached index.php > error.html What is the ideal way to avoid this situation? In the code below, I try to add #error hash in the url to redirect only the first time, and on subsequent visits to a broken partial page start a 60 second refresh attempt cycle. Unfortunately, when I set the #error hash and the redirect, then hit back, it goes to index.php, not index.php#error, so the cached infinite loop occurs. How do I gracefully handle partial-page 500 errors? Here is the code in my php custom error handler, which causes the above listed behavior: function showErrorPage() { if (headers_sent()) { // This is complicated due to the infastructure tending to have already sent headers, ... // ...requiring a tuned javascript redirection in many instances. // Output the following as html. ?> <meta http-equiv="Cache-control" content="no-cache, no-store"> <script type='text/javascript'> var currentHash = location.hash; // UNFORTUNATELY, HERE THE HASH NEVER SHOWS AS SET! if(!currentHash){ // If hash wasn't already set... location.hash = '#error'; location.href = 'error.html'; // Redirect once. } else { // Otherwise, the hash was already set, they were redirected once but came back. // So just display this page for a time but refresh on a slow schedule. setTimeout(function(){ location.reload(true); // Non-caching refresh. }, 60*1000); // Reload after 1 min delay } </script> <?php } else { // No headers sent, so set the right headers header("HTTP/1.1 500 Internal Server Error"); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past } // Regardless, include the visible error output and throw exit with error. include(WEB_ROOT.'error.html'); exit(1); }
0
11,401,052
07/09/2012 18:38:37
1,444,754
06/08/2012 14:28:11
15
0
R How to plot "samples" on the right and "variables" on the top in gplots heatmap2?
By using the command: heatmap.2(exp, col = greenred(100), scale="none", ColSideColors = Carcolors, # dendrogram = "row", key=T, symkey=FALSE, density.info="none", trace="none", cexRow=1, cexCol=0.9) The heatmap2 plots "samples" as columns and variables as rows. How can I rotate the heatmap counterclock wise 90 degree so the sample names are listed on the right and variables are listed on the top (with RowSideColors on the right also)? Thanks!
r
rotation
axis
heatmap
null
null
open
R How to plot "samples" on the right and "variables" on the top in gplots heatmap2? === By using the command: heatmap.2(exp, col = greenred(100), scale="none", ColSideColors = Carcolors, # dendrogram = "row", key=T, symkey=FALSE, density.info="none", trace="none", cexRow=1, cexCol=0.9) The heatmap2 plots "samples" as columns and variables as rows. How can I rotate the heatmap counterclock wise 90 degree so the sample names are listed on the right and variables are listed on the top (with RowSideColors on the right also)? Thanks!
0
11,401,054
07/09/2012 18:38:49
625,144
02/20/2011 10:17:32
20
1
Yii relations without keys
I have two tables as follows order_status {order_status_id, name, description, order_status_group_id} order_status_group {order_status_group_id, name, description} Though foreign key constraints have not implemented in these tables, order_status_group_id refers to order_status_group table's primary key(order_status_group.order_status_group_id). I tried to make relations from Yii models as follows OrderStatus Model - 'orderStatusGroup'=>array(self::BELONGS_TO, 'OrderStatusGroup', 'order_status_group_id') OrderStatusGroup Model - 'orderStatus'=>array(self::HAS_MANY, 'OrderStatus', 'order_status_group_id') But the above relations are not working. Is there anything I did wrong or the relations are not working without proper FK implementation? thanks.
yii
yii-db
null
null
null
null
open
Yii relations without keys === I have two tables as follows order_status {order_status_id, name, description, order_status_group_id} order_status_group {order_status_group_id, name, description} Though foreign key constraints have not implemented in these tables, order_status_group_id refers to order_status_group table's primary key(order_status_group.order_status_group_id). I tried to make relations from Yii models as follows OrderStatus Model - 'orderStatusGroup'=>array(self::BELONGS_TO, 'OrderStatusGroup', 'order_status_group_id') OrderStatusGroup Model - 'orderStatus'=>array(self::HAS_MANY, 'OrderStatus', 'order_status_group_id') But the above relations are not working. Is there anything I did wrong or the relations are not working without proper FK implementation? thanks.
0
11,401,055
07/09/2012 18:39:04
712,353
04/17/2011 17:45:34
1
0
Programmatic change Internet Options settings
I would like programmatic to change the internet options settings using asp.net c#. I know that I should work with registries and to use namespace System.Win32. Also all settings for IE are stored under HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\, but I don't know how to read the values for who is storing in this location?
c#
asp.net
visual-studio-2010
internet-explorer-8
internet-options
null
open
Programmatic change Internet Options settings === I would like programmatic to change the internet options settings using asp.net c#. I know that I should work with registries and to use namespace System.Win32. Also all settings for IE are stored under HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\, but I don't know how to read the values for who is storing in this location?
0
11,401,026
07/09/2012 18:36:41
596,065
01/30/2011 20:43:54
652
12
Is there an omniauth for php?
Omniauth is a wrapper that standardizes authentication with multiple third-party providers for Ruby on Rails applications. For more information, see https://github.com/intridea/omniauth/ Is there a similar library that does this for PHP web applications?
php
authentication
omniauth
null
null
null
open
Is there an omniauth for php? === Omniauth is a wrapper that standardizes authentication with multiple third-party providers for Ruby on Rails applications. For more information, see https://github.com/intridea/omniauth/ Is there a similar library that does this for PHP web applications?
0
11,401,030
07/09/2012 18:37:00
1,479,106
06/25/2012 05:32:41
3
0
frac vs fmod-- which calculation is faster?
I am optimizing some shaders. I can use both fmod or frac to achieve the result. Is one operation faster than the other? Thanks!
shader
cg
null
null
null
null
open
frac vs fmod-- which calculation is faster? === I am optimizing some shaders. I can use both fmod or frac to achieve the result. Is one operation faster than the other? Thanks!
0
11,401,015
07/09/2012 18:35:37
1,162,727
01/21/2012 19:50:31
359
10
PHPExcel example of use
I am trying to use PHPExcel lib. I already read some the API, but still didn't figure how to use it correctly. I'm trying to convert an array, to an excel table. If I have: $Array = array( array('key1' => 'Content1', 'key2' => 'Content2'), array('key1' => 'Content3', 'key2' => 'Content4') ); So the output in the excel file will be: key1 key2 Content1 Content2 Content3 Content4 `key1` and `key2` as headings. Can you help? Thank you
phpexcel
null
null
null
null
null
open
PHPExcel example of use === I am trying to use PHPExcel lib. I already read some the API, but still didn't figure how to use it correctly. I'm trying to convert an array, to an excel table. If I have: $Array = array( array('key1' => 'Content1', 'key2' => 'Content2'), array('key1' => 'Content3', 'key2' => 'Content4') ); So the output in the excel file will be: key1 key2 Content1 Content2 Content3 Content4 `key1` and `key2` as headings. Can you help? Thank you
0
11,401,017
07/09/2012 18:35:39
355,729
06/01/2010 18:19:37
416
43
Less percentage not work right
I`m trying to get percentage in lesscss file with 2 digits accuracy. In lesscss file @w: round(((100-((12-5)*3.8))/(12/5))*100); width: percentage(@w/10000); Compiles to width: 30.580000000000002%; What I`m doing wrong?
css
less
null
null
null
null
open
Less percentage not work right === I`m trying to get percentage in lesscss file with 2 digits accuracy. In lesscss file @w: round(((100-((12-5)*3.8))/(12/5))*100); width: percentage(@w/10000); Compiles to width: 30.580000000000002%; What I`m doing wrong?
0
11,401,061
07/09/2012 18:39:21
1,392,192
05/13/2012 13:13:54
5
0
Making lavalamp start on right
I'm using a lavalamp script for a navigation. http://jsfiddle.net/ripsraps/cwdJ3/1/ (it's not rendering correctly on fiddle) The lavalamp starts on the left side. Is it any way of making it start on the right side?
jquery
html
css
html5
null
null
open
Making lavalamp start on right === I'm using a lavalamp script for a navigation. http://jsfiddle.net/ripsraps/cwdJ3/1/ (it's not rendering correctly on fiddle) The lavalamp starts on the left side. Is it any way of making it start on the right side?
0
11,261,986
06/29/2012 12:42:22
615,120
02/13/2011 14:38:11
162
1
django - TypeError: coercing to Unicode
I'm getting **TypeError: coercing to Unicode: need string or buffer, int found** This is my models.py: class FollowingModel(models.Model): user = models.ForeignKey(User) person = models.IntegerField(max_length=20, blank=False) def __unicode__(self): return self.person When I retrieve the values from the **FollowingModel** in my views like this g = FollowingModel.objects.all() g[0] -----> I'm getting that error I tried changing the `def __unicode__(self):` as def __unicode__(self): return str(self.person) But no use, still I'm getting the same error. Could anyone guide me? Thanks! **UPDATE** >>>g = FollowingModel.objects.all() >>>g Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 72, in __repr__ return repr(data) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 370, in __repr__ u = unicode(self) TypeError: coercing to Unicode: need string or buffer, int found
python
django
null
null
null
null
open
django - TypeError: coercing to Unicode === I'm getting **TypeError: coercing to Unicode: need string or buffer, int found** This is my models.py: class FollowingModel(models.Model): user = models.ForeignKey(User) person = models.IntegerField(max_length=20, blank=False) def __unicode__(self): return self.person When I retrieve the values from the **FollowingModel** in my views like this g = FollowingModel.objects.all() g[0] -----> I'm getting that error I tried changing the `def __unicode__(self):` as def __unicode__(self): return str(self.person) But no use, still I'm getting the same error. Could anyone guide me? Thanks! **UPDATE** >>>g = FollowingModel.objects.all() >>>g Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 72, in __repr__ return repr(data) File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 370, in __repr__ u = unicode(self) TypeError: coercing to Unicode: need string or buffer, int found
0
11,262,034
06/29/2012 12:45:15
996,431
10/15/2011 02:40:34
1,330
1
MVC ViewBag Best Practice
For the ViewBag, I heard it was a no-no to use. I would assume have the content from the ViewBag should be incorporated into a view model? Question: 1) Is my assumption above the best practice. (Not to use a ViewBag and second to have it in the view model) 2) Are there situations where a ViewBag is absolutely necessary? ViewBag
asp.net-mvc
mvc
razor
null
null
null
open
MVC ViewBag Best Practice === For the ViewBag, I heard it was a no-no to use. I would assume have the content from the ViewBag should be incorporated into a view model? Question: 1) Is my assumption above the best practice. (Not to use a ViewBag and second to have it in the view model) 2) Are there situations where a ViewBag is absolutely necessary? ViewBag
0
11,262,036
06/29/2012 12:45:35
1,475,504
06/22/2012 17:10:55
12
2
covert label text to integer
i create an counting animation, now i want to create an integer that will contain the value of my label text, like that: if my label show the number then my integer will be equal to one and so on.. how can i do it? here is my code: -(void)countup { count = 1; MainInt += 1; numbersLabel.text = [NSString stringWithFormat:@"%i", MainInt]; NSLog(@"%d", count); } -(void)viewdidload { [numbersLabel setOutlineColor:[UIColor whiteColor]]; [numbersLabel setGradientColor:[UIColor blackColor]]; numbersLabel.drawOutline = YES; numbersLabel.drawDoubleOutline = YES; numbersLabel.text = @"start"; //numbersLabel.font = [UIFont fontWithName:@"Ballpark" size:220]; numbersLabel.font = [UIFont fontWithName:@"Arial" size:220]; MainInt = 1; numbersTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(countup) userInfo:nil repeats:YES]; } thanks!
objective-c
xcode
animation
uilabel
null
06/29/2012 19:38:36
not a real question
covert label text to integer === i create an counting animation, now i want to create an integer that will contain the value of my label text, like that: if my label show the number then my integer will be equal to one and so on.. how can i do it? here is my code: -(void)countup { count = 1; MainInt += 1; numbersLabel.text = [NSString stringWithFormat:@"%i", MainInt]; NSLog(@"%d", count); } -(void)viewdidload { [numbersLabel setOutlineColor:[UIColor whiteColor]]; [numbersLabel setGradientColor:[UIColor blackColor]]; numbersLabel.drawOutline = YES; numbersLabel.drawDoubleOutline = YES; numbersLabel.text = @"start"; //numbersLabel.font = [UIFont fontWithName:@"Ballpark" size:220]; numbersLabel.font = [UIFont fontWithName:@"Arial" size:220]; MainInt = 1; numbersTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(countup) userInfo:nil repeats:YES]; } thanks!
1
11,262,038
06/29/2012 12:45:41
754,087
05/14/2011 23:57:38
419
9
Outputting file with line numbers as html
I've noticed that you can use python libdiff to output a side by side comparison of files with their differences. Is there an easy way to output just one file in python as html with line numbers?
python
html
null
null
null
null
open
Outputting file with line numbers as html === I've noticed that you can use python libdiff to output a side by side comparison of files with their differences. Is there an easy way to output just one file in python as html with line numbers?
0
11,261,178
06/29/2012 11:44:54
1,231,112
02/24/2012 15:33:37
16
1
browserField memory management
I am doing application based on the browserField and everytime mobile show that low memory in the device,I searched on the forum and I found a tutorial but I didn't implement it as the tutorial said any help please
memory-management
blackberry
browserfield
low-memory
null
null
open
browserField memory management === I am doing application based on the browserField and everytime mobile show that low memory in the device,I searched on the forum and I found a tutorial but I didn't implement it as the tutorial said any help please
0
11,262,040
06/29/2012 12:45:44
1,446,087
06/09/2012 10:50:42
48
0
Playing and learning javascript
In last few days I'm playing and meanwhile learning JS and jQuery. So basically I already created a snake game and learned how to add a array of elements, so when snake moves, the blocks will get removed from tail and will be added before head. So I'm creating next JS game - a maze. Basically, player will be red dot, and black dots will be walls. My questions are - 1) How to make computer randomly generate maze map, which is finishable? 2) How to make black dots as walls, through which players can't move. Currently you see that only one wall is as wall currently. Here is the link to jsfiddle - http://jsfiddle.net/MwVHp/75/ And here is the js code - $(document).ready(function() { for(i = 0; i < 16; i++) { var randomheight = Math.floor(Math.random()*40); var randomwidth = Math.floor(Math.random()*40); var height = Number(randomheight*5)+1; var width = Number(randomwidth*5)+1; $("#content").append("<div class=\"block\" style=\"top:"+height+"px; left: "+width+"px; \"></div>"); } }); $(document).keydown(function(event) { if(event.which == 38) { if($("#player").position().top != 1) { if($("#player").position().top-5 == $(".block").position().top && $("#player").position().left == $(".block").position().left) { } else { $("#player").css({"top": $("#player").position().top - 5 + "px"}); } } } else if(event.which == 37) { if($("#player").position().left != 1) { if($("#player").position().top == $(".block").position().top && $("#player").position().left-5 == $(".block").position().left) { } else { $("#player").css({"left": $("#player").position().left - 5 + "px"}); } } } else if(event.which == 39) { if($("#player").position().left != 196) { if($("#player").position().top == $(".block").position().top && $("#player").position().left+5 == $(".block").position().left) { } else { $("#player").css({"left": $("#player").position().left + 5 + "px"}); } } } else if(event.which == 40) { if($("#player").position().top != 196) { if($("#player").position().top+5 == $(".block").position().top && $("#player").position().left == $(".block").position().left) { } else { $("#player").css({"top": $("#player").position().top + 5 + "px"}); } } } });​
javascript
jquery
null
null
null
null
open
Playing and learning javascript === In last few days I'm playing and meanwhile learning JS and jQuery. So basically I already created a snake game and learned how to add a array of elements, so when snake moves, the blocks will get removed from tail and will be added before head. So I'm creating next JS game - a maze. Basically, player will be red dot, and black dots will be walls. My questions are - 1) How to make computer randomly generate maze map, which is finishable? 2) How to make black dots as walls, through which players can't move. Currently you see that only one wall is as wall currently. Here is the link to jsfiddle - http://jsfiddle.net/MwVHp/75/ And here is the js code - $(document).ready(function() { for(i = 0; i < 16; i++) { var randomheight = Math.floor(Math.random()*40); var randomwidth = Math.floor(Math.random()*40); var height = Number(randomheight*5)+1; var width = Number(randomwidth*5)+1; $("#content").append("<div class=\"block\" style=\"top:"+height+"px; left: "+width+"px; \"></div>"); } }); $(document).keydown(function(event) { if(event.which == 38) { if($("#player").position().top != 1) { if($("#player").position().top-5 == $(".block").position().top && $("#player").position().left == $(".block").position().left) { } else { $("#player").css({"top": $("#player").position().top - 5 + "px"}); } } } else if(event.which == 37) { if($("#player").position().left != 1) { if($("#player").position().top == $(".block").position().top && $("#player").position().left-5 == $(".block").position().left) { } else { $("#player").css({"left": $("#player").position().left - 5 + "px"}); } } } else if(event.which == 39) { if($("#player").position().left != 196) { if($("#player").position().top == $(".block").position().top && $("#player").position().left+5 == $(".block").position().left) { } else { $("#player").css({"left": $("#player").position().left + 5 + "px"}); } } } else if(event.which == 40) { if($("#player").position().top != 196) { if($("#player").position().top+5 == $(".block").position().top && $("#player").position().left == $(".block").position().left) { } else { $("#player").css({"top": $("#player").position().top + 5 + "px"}); } } } });​
0
11,262,041
06/29/2012 12:45:46
399,250
07/22/2010 15:05:38
117
3
MVC3 webapp task scheduling with Quartz.NET
I need your advice for scheduling tasks in the MVC3 Webapp. My task is to create some generic scheduler for different services in the webapp that can be used later in development. For example we have some available tasks that user can schedule whenever he wants. I didn't want to reinvent the wheel and found the Quartz.Net library that can be used to create the scheduler. I know that it's not a good idea to host scheduling inside webapp cause webserver can recycle the application pools, etc, so i decided to use it inside a Windows Service and then using Quartz.NET remoting feature to trigger tasks inside my webapp. But i've found some issues with that. Correct me if I'm wrong, but when i tried to use the Quartz.NET remoting it runs the job inside the Windows Service process, it means that it needs to know about all types inside my webapp, so all the assemblies of the webapp should be referenced by it, and i need to have another config file for database, etc. So in case I write new job class, i can't easily schedule it, i need to stop the service and renew the library for it, so it's not very generic approach. I can't find any info that Quartz.NET can run jobs only based on it's interface. So I came up with idea to write my own scheduler that will be hosted in the Windows Service, and will have some IJob interface that will be implemented in the webapp. I will also use .Net remoting using IPC channel. So the webapp will be like .Net Remoting Server, and when i want to add some new job and then schedule it, i will just have to write new job that implements IJob interface. I will register it as IpcChannel channel = new IpcChannel("CurrentIPC"); ChannelServices.RegisterChannel(channel); RemotingConfiguration.RegisterWellKnownServiceType( typeof(SimpleJob), "SimpleJob", WellKnownObjectMode.SingleCall); RemotingConfiguration.RegisterWellKnownServiceType( typeof(ComplexObject), "ComplexObject", WellKnownObjectMode.SingleCall); in this case i will have two Job types registered. Then when scheduling the job i will pass the name of the class and on the Windows Service side that will stand for client (executing objects on the webapp side) i will just bind the passed name of the class with IJob like this: Dictionary<string, IJob> jobs = new Dictionary<string, IJob>(); void AddJob(string name) { IJob obj = (IJob)Activator.GetObject(typeof(IJob), string.Format("ipc://CurrentIPC/{0}", name)); jobs.Add(name, obj); } So now i don't need to bother about references to my app and other stuff, the scheduler will do it's job without knowing anything, just IJob interface and executing tasks on the webapp side. If i'm wrong or it's too complex and there are some other simpler methods of doing this, or there are some pitfalls that i'm not aware of, can you help me with that? Thank you. P.S. Also there was an idea to have separate scheduler that will run the web app methods directly by executing a link to specified service in the web app, for example "http://localhost:3030/Request/12" and that's all, but in my web app you should be authorized to execute such request and again we have issues we need to resolve, and we will have additional load to the webserver with such requests in case of thousands of scheduling tasks.
c#
.net
asp.net-mvc
quartz.net
.net-remoting
null
open
MVC3 webapp task scheduling with Quartz.NET === I need your advice for scheduling tasks in the MVC3 Webapp. My task is to create some generic scheduler for different services in the webapp that can be used later in development. For example we have some available tasks that user can schedule whenever he wants. I didn't want to reinvent the wheel and found the Quartz.Net library that can be used to create the scheduler. I know that it's not a good idea to host scheduling inside webapp cause webserver can recycle the application pools, etc, so i decided to use it inside a Windows Service and then using Quartz.NET remoting feature to trigger tasks inside my webapp. But i've found some issues with that. Correct me if I'm wrong, but when i tried to use the Quartz.NET remoting it runs the job inside the Windows Service process, it means that it needs to know about all types inside my webapp, so all the assemblies of the webapp should be referenced by it, and i need to have another config file for database, etc. So in case I write new job class, i can't easily schedule it, i need to stop the service and renew the library for it, so it's not very generic approach. I can't find any info that Quartz.NET can run jobs only based on it's interface. So I came up with idea to write my own scheduler that will be hosted in the Windows Service, and will have some IJob interface that will be implemented in the webapp. I will also use .Net remoting using IPC channel. So the webapp will be like .Net Remoting Server, and when i want to add some new job and then schedule it, i will just have to write new job that implements IJob interface. I will register it as IpcChannel channel = new IpcChannel("CurrentIPC"); ChannelServices.RegisterChannel(channel); RemotingConfiguration.RegisterWellKnownServiceType( typeof(SimpleJob), "SimpleJob", WellKnownObjectMode.SingleCall); RemotingConfiguration.RegisterWellKnownServiceType( typeof(ComplexObject), "ComplexObject", WellKnownObjectMode.SingleCall); in this case i will have two Job types registered. Then when scheduling the job i will pass the name of the class and on the Windows Service side that will stand for client (executing objects on the webapp side) i will just bind the passed name of the class with IJob like this: Dictionary<string, IJob> jobs = new Dictionary<string, IJob>(); void AddJob(string name) { IJob obj = (IJob)Activator.GetObject(typeof(IJob), string.Format("ipc://CurrentIPC/{0}", name)); jobs.Add(name, obj); } So now i don't need to bother about references to my app and other stuff, the scheduler will do it's job without knowing anything, just IJob interface and executing tasks on the webapp side. If i'm wrong or it's too complex and there are some other simpler methods of doing this, or there are some pitfalls that i'm not aware of, can you help me with that? Thank you. P.S. Also there was an idea to have separate scheduler that will run the web app methods directly by executing a link to specified service in the web app, for example "http://localhost:3030/Request/12" and that's all, but in my web app you should be authorized to execute such request and again we have issues we need to resolve, and we will have additional load to the webserver with such requests in case of thousands of scheduling tasks.
0
11,262,042
06/29/2012 12:45:47
958,282
09/22/2011 04:44:08
357
17
Maven Android integration error
I am beginner in maven. so consider this. I want to use maven for my android project. for that i have done steps as per http://rgladwell.github.com/m2e-android/ and http://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/wiki/GettingStarted i have eclipse helios version and installed Android sdk , ADT-plugin rev 20, also installed maven to eclipse plugin and my pom.xml declared **Parent Pom.xml** <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.1.1</version> <configuration> <sdk> <platform>15</platform> </sdk> <deleteConflictingFiles>true</deleteConflictingFiles> <undeployBeforeDeploy>true</undeployBeforeDeploy> </configuration> <extensions>true</extensions> </plugin> which installs android maven integration plugins. but in chield pom.xml i am getting error. **Child Pom.xml** <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>GROUPID</groupId> <artifactId>CHILDID</artifactId> <version>1.0</version> <packaging>apklib</packaging> *<parent>* [getting error here] <groupId>GROUPID</groupId> <artifactId>ARTIID</artifactId> <version>1.0</version> <relativePath>..</relativePath> </parent> ...... ...... <plugins> <plugin> <artifactId>ID</artifactId> <version>1.1</version> <executions> **<execution>** [getting error here] ..... ..... </execution> </plugin> </plugins> please help me to short out problem. Thanks in advance
android
maven
pom.xml
null
null
null
open
Maven Android integration error === I am beginner in maven. so consider this. I want to use maven for my android project. for that i have done steps as per http://rgladwell.github.com/m2e-android/ and http://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/wiki/GettingStarted i have eclipse helios version and installed Android sdk , ADT-plugin rev 20, also installed maven to eclipse plugin and my pom.xml declared **Parent Pom.xml** <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.1.1</version> <configuration> <sdk> <platform>15</platform> </sdk> <deleteConflictingFiles>true</deleteConflictingFiles> <undeployBeforeDeploy>true</undeployBeforeDeploy> </configuration> <extensions>true</extensions> </plugin> which installs android maven integration plugins. but in chield pom.xml i am getting error. **Child Pom.xml** <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>GROUPID</groupId> <artifactId>CHILDID</artifactId> <version>1.0</version> <packaging>apklib</packaging> *<parent>* [getting error here] <groupId>GROUPID</groupId> <artifactId>ARTIID</artifactId> <version>1.0</version> <relativePath>..</relativePath> </parent> ...... ...... <plugins> <plugin> <artifactId>ID</artifactId> <version>1.1</version> <executions> **<execution>** [getting error here] ..... ..... </execution> </plugin> </plugins> please help me to short out problem. Thanks in advance
0
11,261,796
06/29/2012 12:29:29
1,331,016
04/13/2012 07:56:49
1
0
Trying to hide image in dialog when mouseover another
I am fast realising that coding jquery inside a dialog doesn't follow quite the same syntax as in the parent DOC . That is why my code has .live("mouseover"... instead of .mouseover(... and working that out took ages. I have two images side by side reduced to 40% of their full size to fit inside the ajax-sourced form that is displayed in the dialog. Each has an id and my code happily expands each image individually when the cursor goes over it. I want to hide the other one when that happens and restore status quo on mouseout so the form isn't messed up. The mouseout gets me to status quo but mouseover does not hide the other image. $('#cadovr').live('mouseover', function() { $(this).css('position', 'relative').height("100%").width("100%"); $('#cadet').hide(); }).live('mouseout',function() { $(this).css('position', 'relative').height( "40%").width("40%"); $('#cadet').show(); }); $('#cadet').live('mouseover', function() { $(this).css('position', 'relative').height("100%").width("100%"); $('#cadovr').hide(); }).live('mouseout',function() { $(this).css('position', 'relative').height( "40%").width("40%"); $('#cadovr').show(); }); And has anyone a clue why I have to use .live in a dialog?
image
jquery-ui
dialog
mouseevent
null
null
open
Trying to hide image in dialog when mouseover another === I am fast realising that coding jquery inside a dialog doesn't follow quite the same syntax as in the parent DOC . That is why my code has .live("mouseover"... instead of .mouseover(... and working that out took ages. I have two images side by side reduced to 40% of their full size to fit inside the ajax-sourced form that is displayed in the dialog. Each has an id and my code happily expands each image individually when the cursor goes over it. I want to hide the other one when that happens and restore status quo on mouseout so the form isn't messed up. The mouseout gets me to status quo but mouseover does not hide the other image. $('#cadovr').live('mouseover', function() { $(this).css('position', 'relative').height("100%").width("100%"); $('#cadet').hide(); }).live('mouseout',function() { $(this).css('position', 'relative').height( "40%").width("40%"); $('#cadet').show(); }); $('#cadet').live('mouseover', function() { $(this).css('position', 'relative').height("100%").width("100%"); $('#cadovr').hide(); }).live('mouseout',function() { $(this).css('position', 'relative').height( "40%").width("40%"); $('#cadovr').show(); }); And has anyone a clue why I have to use .live in a dialog?
0
11,261,798
06/29/2012 12:29:32
355,375
06/01/2010 12:05:18
1,051
78
Git push on localhost with htaccess
I am looking into setting up a remote git repo. To start with I have created it on my Windows machine using xampp following this [guide][1]. All works fine except when I try to add some security, as per [step 6 of the guide][2] (for when I migrate it to my main web server). I have added passwords by using passwd and adding htaccess to the htdocs folder. This works fine (I have checked in my web browser), but when I try and push I get prompted for my password the it fails with a error (code 22). $ git push origin master Password for 'http://git@localhost': error: Cannot access URL http://git@localhost/s.git/, return code 22 fatal: git-http-push failed Any ideas? ---------- *Please note I have posted this on SuperUser will no response, so am moving here and will vote to delete from SuperUser* [1]: http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/ [2]: http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/
windows
git
apache
.htaccess
null
06/29/2012 16:38:05
off topic
Git push on localhost with htaccess === I am looking into setting up a remote git repo. To start with I have created it on my Windows machine using xampp following this [guide][1]. All works fine except when I try to add some security, as per [step 6 of the guide][2] (for when I migrate it to my main web server). I have added passwords by using passwd and adding htaccess to the htdocs folder. This works fine (I have checked in my web browser), but when I try and push I get prompted for my password the it fails with a error (code 22). $ git push origin master Password for 'http://git@localhost': error: Cannot access URL http://git@localhost/s.git/, return code 22 fatal: git-http-push failed Any ideas? ---------- *Please note I have posted this on SuperUser will no response, so am moving here and will vote to delete from SuperUser* [1]: http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/ [2]: http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/
2
11,226,450
06/27/2012 12:40:34
1,355,685
04/25/2012 08:49:26
11
0
JQuery Autocomplete to search countries names, provinces/sates and areas as well
I need to implement a location search into one of my projects. A location is either a city/town (e.g. Johannesburg), a province/state (e.g. Gauteng) or a country (e.g. South Africa) - If a person starts to type the city, the example result: ***Johannesburg, Gauteng, South Africa*** - If a person starts to type the province, the example result: ***Gauteng, South Africa*** - If a person starts to type the example country, the result: ***South Africa*** I've implemented GeoNames with [jquery autocomplete][1] [1]: http://jqueryui.com/demos/autocomplete/#remote-jsonp but my problem is that this search is only limited to a city search. I tried removing and playing around with the featureClass but could not get it right. Maybe someone has a better understanding of to geoname api and how I would get this right? Thanks.
jquery-autocomplete
country
geonames
null
null
null
open
JQuery Autocomplete to search countries names, provinces/sates and areas as well === I need to implement a location search into one of my projects. A location is either a city/town (e.g. Johannesburg), a province/state (e.g. Gauteng) or a country (e.g. South Africa) - If a person starts to type the city, the example result: ***Johannesburg, Gauteng, South Africa*** - If a person starts to type the province, the example result: ***Gauteng, South Africa*** - If a person starts to type the example country, the result: ***South Africa*** I've implemented GeoNames with [jquery autocomplete][1] [1]: http://jqueryui.com/demos/autocomplete/#remote-jsonp but my problem is that this search is only limited to a city search. I tried removing and playing around with the featureClass but could not get it right. Maybe someone has a better understanding of to geoname api and how I would get this right? Thanks.
0
11,226,453
06/27/2012 12:40:50
1,211,854
02/15/2012 16:29:26
1
0
squid /etc/hosts
I have a LAN X.X.X.X/24 and a gateway on which we were told to run Squid. In the same LAN we have the commercial department and software developers. We have a production version of our website on public IP Y.Y.Y.Y and a development version on a different private LAN Z.Z.Z.Z/24 Developers in X.X.X.X/24 need to do HTTP requests to the two different versions of our website. They used to do it changing /etc/hosts accordingly. Now we have transparent squid in the middle that resolves DNS before HTTP-requesting, so all requests end up in the public, production version of our website. I do not know how squid internals that allow transparent proxying work, but is there a workaround that allows only developers' machines to control locally on their machines where their requests will go? Something like "do not DNS-query if for these, say X.X.X.X/29, machines"? Thanks
dns
squid
null
null
null
null
open
squid /etc/hosts === I have a LAN X.X.X.X/24 and a gateway on which we were told to run Squid. In the same LAN we have the commercial department and software developers. We have a production version of our website on public IP Y.Y.Y.Y and a development version on a different private LAN Z.Z.Z.Z/24 Developers in X.X.X.X/24 need to do HTTP requests to the two different versions of our website. They used to do it changing /etc/hosts accordingly. Now we have transparent squid in the middle that resolves DNS before HTTP-requesting, so all requests end up in the public, production version of our website. I do not know how squid internals that allow transparent proxying work, but is there a workaround that allows only developers' machines to control locally on their machines where their requests will go? Something like "do not DNS-query if for these, say X.X.X.X/29, machines"? Thanks
0
11,226,455
06/27/2012 12:40:54
363,448
06/10/2010 12:44:22
168
16
Backbone direct url access breaks collection
When a user goes to `http://example.com/#/playlist`, I want to list some songs. It works (all songs are listed) when you first go to `http://example.com` and click on the link `<a href="#/playlist">Playlist</a>`. But if you directly go to `http://example.com/#/playlist`, nothing is shown. When I log the this.collection property, the collection is always the same (if you use the link, or directly access). The only difference is that `this.collection.each( function ( song ) {} );` in the render-function below, doesn't loop when directly accessing the URL. This is the code: define( [ 'jQuery', 'Underscore', 'Backbone', 'collections/songlist', 'views/song' ], function ($, _, Backbone, SonglistCollection, SongView) { var PlaylistView = Backbone.View.extend({ // properties el: '#content', tagName: 'ul', collection: new SonglistCollection(), /** * Initialize */ initialize: function() { // load songs this.collection.bind( 'reset', this.render(), this ); this.collection.fetch(); }, /** * Render */ render: function () { this.$el.html(''); console.log(this.collection); this.collection.each( function ( song ) { var songItem = new SongView( { model: song } ); this.$el.append( songItem.el ); }, this); } }); return new PlaylistView; } ); The problem occurs here, in the '*each-loop*': render: function () { this.$el.html(''); console.log(this.collection); this.collection.each( function ( song ) { var songItem = new SongView( { model: song } ); this.$el.append( songItem.el ); }, this); }
jquery
backbone.js
null
null
null
null
open
Backbone direct url access breaks collection === When a user goes to `http://example.com/#/playlist`, I want to list some songs. It works (all songs are listed) when you first go to `http://example.com` and click on the link `<a href="#/playlist">Playlist</a>`. But if you directly go to `http://example.com/#/playlist`, nothing is shown. When I log the this.collection property, the collection is always the same (if you use the link, or directly access). The only difference is that `this.collection.each( function ( song ) {} );` in the render-function below, doesn't loop when directly accessing the URL. This is the code: define( [ 'jQuery', 'Underscore', 'Backbone', 'collections/songlist', 'views/song' ], function ($, _, Backbone, SonglistCollection, SongView) { var PlaylistView = Backbone.View.extend({ // properties el: '#content', tagName: 'ul', collection: new SonglistCollection(), /** * Initialize */ initialize: function() { // load songs this.collection.bind( 'reset', this.render(), this ); this.collection.fetch(); }, /** * Render */ render: function () { this.$el.html(''); console.log(this.collection); this.collection.each( function ( song ) { var songItem = new SongView( { model: song } ); this.$el.append( songItem.el ); }, this); } }); return new PlaylistView; } ); The problem occurs here, in the '*each-loop*': render: function () { this.$el.html(''); console.log(this.collection); this.collection.each( function ( song ) { var songItem = new SongView( { model: song } ); this.$el.append( songItem.el ); }, this); }
0
11,225,211
06/27/2012 11:30:35
1,198,104
02/08/2012 19:44:04
27
3
Objective-C Indexing
I'm currently trying to implement some kind of search system in a program of mine, and wanted to use an index, but I'm fairly new at Objective-C. The main idea is to have a 'search' command or text box and when I type a word, it'll show me all the items that include that word. All these 'items' will be listed in a .txt file (hopefully) in alphabetical order. Any help is appreciated.
objective-c
indexing
null
null
null
null
open
Objective-C Indexing === I'm currently trying to implement some kind of search system in a program of mine, and wanted to use an index, but I'm fairly new at Objective-C. The main idea is to have a 'search' command or text box and when I type a word, it'll show me all the items that include that word. All these 'items' will be listed in a .txt file (hopefully) in alphabetical order. Any help is appreciated.
0
11,226,458
06/27/2012 12:41:04
1,292,656
03/26/2012 09:39:34
43
0
Always loop on row collection -1
I am working on a WinApp project using c#. I am using a datagridview and when i am trying to write inside a cell then a new row is created automatically. so if i use 2 rows then a 3rd is created automatically and it is counted in the collection. foreach (DataGridViewRow row in grdCrew.Rows) { } Thus this statement is executed 3 times insted of two. How can i avoid this and execute the statement 2. ?
c#
datagridview
null
null
null
null
open
Always loop on row collection -1 === I am working on a WinApp project using c#. I am using a datagridview and when i am trying to write inside a cell then a new row is created automatically. so if i use 2 rows then a 3rd is created automatically and it is counted in the collection. foreach (DataGridViewRow row in grdCrew.Rows) { } Thus this statement is executed 3 times insted of two. How can i avoid this and execute the statement 2. ?
0
11,209,131
06/26/2012 14:04:51
47,450
12/18/2008 15:46:55
536
11
.xib not loading properly on iPod Touch 2G (ios4.3), fine on later devices?
I'm running into a tricky glitch. I've got a .xib, which was created by XCode when I created a new `UIViewController` subclass. It has quite a few elements, including some `UIButton`s, a bunch of `UILabel`s, a small `UIView` with some other views inside it, and a `UIImageView` containing a mostly-transparent image. In `viewDidLoad`, I set the background color of the main view to a color using a pattern image. When I display this view controller in the simulator or on my iPhone 4 (both running iOS 5.1), everything goes smoothly; the patterned background displays, the labels show up in the proper font, the transparent image appears, and so on. When I test on my old iPod Touch 2G running 4.3, however, the view controller loads, the `UIButton`s, the `UIImageView` and the small `UIView` all display correctly... but the `UILabel`s don't show up at all, and the patterned background color doesn't display either. The only even vaguely unusual thing I'm doing when the view gets presented is this, which makes it size properly in a popover: - (void) viewWillAppear:(BOOL)animated { CGSize size = CGSizeMake(320, 480); // size of view in popover self.contentSizeForViewInPopover = size; [super viewWillAppear:animated]; } I really can't think of anything else that might be the problem. I've cleaned, rebuilt, all that stuff. Still no dice. Has anyone else encountered this?
ios
xcode
uiview
ios4
uiviewcontroller
null
open
.xib not loading properly on iPod Touch 2G (ios4.3), fine on later devices? === I'm running into a tricky glitch. I've got a .xib, which was created by XCode when I created a new `UIViewController` subclass. It has quite a few elements, including some `UIButton`s, a bunch of `UILabel`s, a small `UIView` with some other views inside it, and a `UIImageView` containing a mostly-transparent image. In `viewDidLoad`, I set the background color of the main view to a color using a pattern image. When I display this view controller in the simulator or on my iPhone 4 (both running iOS 5.1), everything goes smoothly; the patterned background displays, the labels show up in the proper font, the transparent image appears, and so on. When I test on my old iPod Touch 2G running 4.3, however, the view controller loads, the `UIButton`s, the `UIImageView` and the small `UIView` all display correctly... but the `UILabel`s don't show up at all, and the patterned background color doesn't display either. The only even vaguely unusual thing I'm doing when the view gets presented is this, which makes it size properly in a popover: - (void) viewWillAppear:(BOOL)animated { CGSize size = CGSizeMake(320, 480); // size of view in popover self.contentSizeForViewInPopover = size; [super viewWillAppear:animated]; } I really can't think of anything else that might be the problem. I've cleaned, rebuilt, all that stuff. Still no dice. Has anyone else encountered this?
0
11,226,469
06/27/2012 12:41:39
450,733
10/20/2009 15:20:58
120
12
Sharing System Clipboard with vim under cygwin
I built a pretty good cygwin setup under Windows7. I installed vim under cygwin. Now, I can't share the system clipboard with vim. `vim --version` gives: +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +xsmp_interact +xterm_clipboard -xterm_save I tried setting `set clipboard+=unnamed` inside my .vimrc but it was no use. I tried `P`, `"+p`, `*p` and `"*p` but none of these pasted from the system clipboard. However, pressing SHIFT+Ins on cygwin prompt pastes from system clipboard. Am I missing something?
vim
cygwin
vimrc
null
null
null
open
Sharing System Clipboard with vim under cygwin === I built a pretty good cygwin setup under Windows7. I installed vim under cygwin. Now, I can't share the system clipboard with vim. `vim --version` gives: +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +xsmp_interact +xterm_clipboard -xterm_save I tried setting `set clipboard+=unnamed` inside my .vimrc but it was no use. I tried `P`, `"+p`, `*p` and `"*p` but none of these pasted from the system clipboard. However, pressing SHIFT+Ins on cygwin prompt pastes from system clipboard. Am I missing something?
0
11,594,136
07/21/2012 17:01:25
1,494,756
07/01/2012 20:47:21
13
0
Rails: Routing error when using ajax with a button
I am new to rails and have followed the answer on this [question][1]. This is how things are in my project: Controller: def create def create current_user.likes.create(:post_id => params[:post_id]) render :layout => false end end .js file: $ -> $(".like").click -> post_id = $(this).attr('id') $.ajax type: 'POST' url: 'likes/' + post_id success: -> alert "succsess!" Routes.rb Have tried with both: `match '/likes/4', to: 'likes#create'` and `match "likes/4" => "likes#create", :as => :like` (I use '/likes/4' for testing proposes (it will be 'post_id' in the future)). When i click on the Like button in the view, I get this error: POST http://0.0.0.0:3000/likes/4 500 (Internal Server Error) Anyone know what makes this error? [1]: http://stackoverflow.com/questions/6899037/rails-ajax-fav-button-for-user-posts
ruby-on-rails
ajax
like
null
null
null
open
Rails: Routing error when using ajax with a button === I am new to rails and have followed the answer on this [question][1]. This is how things are in my project: Controller: def create def create current_user.likes.create(:post_id => params[:post_id]) render :layout => false end end .js file: $ -> $(".like").click -> post_id = $(this).attr('id') $.ajax type: 'POST' url: 'likes/' + post_id success: -> alert "succsess!" Routes.rb Have tried with both: `match '/likes/4', to: 'likes#create'` and `match "likes/4" => "likes#create", :as => :like` (I use '/likes/4' for testing proposes (it will be 'post_id' in the future)). When i click on the Like button in the view, I get this error: POST http://0.0.0.0:3000/likes/4 500 (Internal Server Error) Anyone know what makes this error? [1]: http://stackoverflow.com/questions/6899037/rails-ajax-fav-button-for-user-posts
0
11,594,158
07/21/2012 17:04:52
1,542,945
07/21/2012 16:44:59
1
0
getting JSON data from PHP to iOS
I'am developing an iPhone application to display data from php. Data are obtained from a Mysql database then encoded to JSON format in php file: <i> include_once 'connectionIncl.php'; if(function_exists($_GET['method'])){ $_GET['method'](); } function getSQLIntoJSONFormat() { $arr; $sql = mysql_query("SELECT * FROM pecivo"); while($pecivo = mysql_fetch_assoc($sql)){ $arr[] = $pecivo['typ']; } $arr= json_encode($arr); echo $_GET['jsoncallback'].'('.$arr.')'; } // --- http://127.0.0.1:8887/TeplyRohlik/pecivo.php?method=getSQLIntoJSONFormat&jsoncallback=? ?> </i> when i run this from browser, it returns correct data :(["sejra","knir","baba","vousy","sporitelna25"]) Also, on iOS a have this code: <i> NSString * urlString = [NSString stringWithFormat:@"http://192.168.0.10:8887/TeplyRohlik/pecivo.php?method=getSQLIntoJSONFormat&jsoncallback=?"]; NSURL * url = [NSURL URLWithString:urlString]; NSData * data = [NSData dataWithContentsOfURL:url]; NSError * error; NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; NSLog(@"%@",json); </i> And result is .... (null). I have no idea how to get this working...
php
ios
json
null
null
null
open
getting JSON data from PHP to iOS === I'am developing an iPhone application to display data from php. Data are obtained from a Mysql database then encoded to JSON format in php file: <i> include_once 'connectionIncl.php'; if(function_exists($_GET['method'])){ $_GET['method'](); } function getSQLIntoJSONFormat() { $arr; $sql = mysql_query("SELECT * FROM pecivo"); while($pecivo = mysql_fetch_assoc($sql)){ $arr[] = $pecivo['typ']; } $arr= json_encode($arr); echo $_GET['jsoncallback'].'('.$arr.')'; } // --- http://127.0.0.1:8887/TeplyRohlik/pecivo.php?method=getSQLIntoJSONFormat&jsoncallback=? ?> </i> when i run this from browser, it returns correct data :(["sejra","knir","baba","vousy","sporitelna25"]) Also, on iOS a have this code: <i> NSString * urlString = [NSString stringWithFormat:@"http://192.168.0.10:8887/TeplyRohlik/pecivo.php?method=getSQLIntoJSONFormat&jsoncallback=?"]; NSURL * url = [NSURL URLWithString:urlString]; NSData * data = [NSData dataWithContentsOfURL:url]; NSError * error; NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; NSLog(@"%@",json); </i> And result is .... (null). I have no idea how to get this working...
0
11,594,164
07/21/2012 17:05:32
1,542,952
07/21/2012 16:52:42
1
0
yii gridview use outside variable in value
I have a function in my Teacher model which returns categories array.. getCaterogies() { return array('1' => 'short tempered', '2' => 'funny', '3' => 'visionary', ...); } I am storing indexes in database and displaying values everywhere using the value of the array corresponding to that.. $categories = $teacher->categories; $category = $categories[$teacher->category]; > I am doing this because once somebaody suggested me that dont store > strings in database which are statuses..instead store integer values, > and either store the conversion in database or define it in ht model, problem with strings is that they are more prone to human errors in comparisions..maybe because of case sensitiveness.. **Now the problem I am facing is that while displaying values in gridview, I need to write the 2 lines in value field, but it is a expression, and outsisde variables also it doesn't take..** How can I get this working for gridview??
php
gridview
yii
null
null
null
open
yii gridview use outside variable in value === I have a function in my Teacher model which returns categories array.. getCaterogies() { return array('1' => 'short tempered', '2' => 'funny', '3' => 'visionary', ...); } I am storing indexes in database and displaying values everywhere using the value of the array corresponding to that.. $categories = $teacher->categories; $category = $categories[$teacher->category]; > I am doing this because once somebaody suggested me that dont store > strings in database which are statuses..instead store integer values, > and either store the conversion in database or define it in ht model, problem with strings is that they are more prone to human errors in comparisions..maybe because of case sensitiveness.. **Now the problem I am facing is that while displaying values in gridview, I need to write the 2 lines in value field, but it is a expression, and outsisde variables also it doesn't take..** How can I get this working for gridview??
0
11,594,167
07/21/2012 17:05:37
465,401
10/03/2010 21:47:20
2,980
131
Where can I find the "Visual Studio Package" Template for Visual Studio project?
I'm trying to create a plugin (tool window) for Visual Studio 2010, and am following the directives inn MSDN - http://msdn.microsoft.com/en-us/library/bb165051(v=vs.110) In step #3: 3. In the *Templates* pane click *Visual Studio Package*. However, in my visual studio I don't see that template (i only see *Visual Studio Add In*) Why is it missing? Where can I find it?
visual-studio-2010
templates
plugins
null
null
null
open
Where can I find the "Visual Studio Package" Template for Visual Studio project? === I'm trying to create a plugin (tool window) for Visual Studio 2010, and am following the directives inn MSDN - http://msdn.microsoft.com/en-us/library/bb165051(v=vs.110) In step #3: 3. In the *Templates* pane click *Visual Studio Package*. However, in my visual studio I don't see that template (i only see *Visual Studio Add In*) Why is it missing? Where can I find it?
0
11,594,168
07/21/2012 17:05:38
1,258,337
03/09/2012 01:44:11
74
0
PHP & MySQL - Most efficient way to display last ten entries in a database?
So I have a database, and I would like to display the last ten entries. So far I have tried several ways but run into a couple of issues. I have tried using a for-loop starting at the row count for the database and linking that to the ID, but then of course should I delete an entry the iterations will have data missing. For example if I have deleted lots of entries and have the first entry start at id 20 then if there are only 10 rows it will look to display 10 to 1, which don't exist. Any thoughts?
php
mysql
database
null
null
null
open
PHP & MySQL - Most efficient way to display last ten entries in a database? === So I have a database, and I would like to display the last ten entries. So far I have tried several ways but run into a couple of issues. I have tried using a for-loop starting at the row count for the database and linking that to the ID, but then of course should I delete an entry the iterations will have data missing. For example if I have deleted lots of entries and have the first entry start at id 20 then if there are only 10 rows it will look to display 10 to 1, which don't exist. Any thoughts?
0
11,594,174
07/21/2012 17:06:06
367,869
06/16/2010 03:42:31
659
17
How to encode encrypted data between iOS Objective-C app and Ruby on Rails?
I'm working on an iOS and Ruby on Rails application and need to transmit data encrypted from the iOS app to the Ruby on Rails application. My challenge is how to encode the data in Objective-C in a way that I can decode on the Rails side. I'm using the [example in this SO question][1] as the method to encrypt the data, and the example code shows what the encrypted data would look like this: printf("%s\n", [[plain description] UTF8String]); which creates output that looks like: > <3fe47b63 bd9a84ab 30dfb1a4 e409b60f> My challenge is that I need to find a way to get this across the wire to the Rails application in a way that I can decode for use with OpenSSL code like: def decrypt(data) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.decrypt cipher.key = cipher_key cipher.iv = cipher_iv decrypted_data = cipher.update(data) decrypted_data << cipher.final end I'm thinking that Base64 encoding may be the best way to go as this data will end up in an HTTP header in JSON requests. It seems like I could use Base64.decode64 to decode the data on the Ruby side and pass it as the data to decrypt, but I'm hoping someone can guide me on whether this really is the best way to do it and, regardless of the encoding, how to turn a pointer to an NSData object like this: NSData *cipher = [plain AES256EncryptWithKey:key]; into that encoded value to get it to the Rails app. Thanks! [1]: http://stackoverflow.com/questions/1400246/aes-encryption-for-an-nsstring-on-the-iphone
objective-c
ios
ruby
encryption
aes
null
open
How to encode encrypted data between iOS Objective-C app and Ruby on Rails? === I'm working on an iOS and Ruby on Rails application and need to transmit data encrypted from the iOS app to the Ruby on Rails application. My challenge is how to encode the data in Objective-C in a way that I can decode on the Rails side. I'm using the [example in this SO question][1] as the method to encrypt the data, and the example code shows what the encrypted data would look like this: printf("%s\n", [[plain description] UTF8String]); which creates output that looks like: > <3fe47b63 bd9a84ab 30dfb1a4 e409b60f> My challenge is that I need to find a way to get this across the wire to the Rails application in a way that I can decode for use with OpenSSL code like: def decrypt(data) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.decrypt cipher.key = cipher_key cipher.iv = cipher_iv decrypted_data = cipher.update(data) decrypted_data << cipher.final end I'm thinking that Base64 encoding may be the best way to go as this data will end up in an HTTP header in JSON requests. It seems like I could use Base64.decode64 to decode the data on the Ruby side and pass it as the data to decrypt, but I'm hoping someone can guide me on whether this really is the best way to do it and, regardless of the encoding, how to turn a pointer to an NSData object like this: NSData *cipher = [plain AES256EncryptWithKey:key]; into that encoded value to get it to the Rails app. Thanks! [1]: http://stackoverflow.com/questions/1400246/aes-encryption-for-an-nsstring-on-the-iphone
0
11,594,176
07/21/2012 17:06:47
1,516,416
07/11/2012 02:00:36
48
2
Change web page content in real time without ajax
I realized at a moment with the help of firebug in stackoverflow.com, when someone accepted your answer, suddenly your points got increased without any Ajax hit received to any method. Amazing, How is it possible? Please advice so that i can try to implement this technique into my upcoming projects. Thanks in advance.
javascript
jquery
html
ajax
null
null
open
Change web page content in real time without ajax === I realized at a moment with the help of firebug in stackoverflow.com, when someone accepted your answer, suddenly your points got increased without any Ajax hit received to any method. Amazing, How is it possible? Please advice so that i can try to implement this technique into my upcoming projects. Thanks in advance.
0
11,594,160
07/21/2012 17:04:56
945,273
09/14/2011 18:09:52
162
2
Delphi: WebBrowser's OnCownloadComplete happens multiple times at once
For example in this code: procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); begin ShowMessage('Download Completed'); end; procedure TForm1.FormCreate(Sender: TObject); begin WebBrowser1.Navigate('http://www.google.com/'); end; "WebBrowser1DownloadComplete" message appears several times on 1 Navigate.<br> This is annoying and makes this event almost useless.<br><br> Why is this happening? How to avoid this?<br> Thankyou
delphi
events
webbrowser
null
null
null
open
Delphi: WebBrowser's OnCownloadComplete happens multiple times at once === For example in this code: procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject); begin ShowMessage('Download Completed'); end; procedure TForm1.FormCreate(Sender: TObject); begin WebBrowser1.Navigate('http://www.google.com/'); end; "WebBrowser1DownloadComplete" message appears several times on 1 Navigate.<br> This is annoying and makes this event almost useless.<br><br> Why is this happening? How to avoid this?<br> Thankyou
0
11,594,178
07/21/2012 17:07:08
805,284
06/19/2011 11:44:34
381
18
bash: colorized man page
Where do I have to take a look at in the system to colorize the man pages? The man pages are viewed with less, so I tried adding the following lines to my .bashrc to change the colors: (Which works fine, btw.) # LESS COLORS FOR MAN PAGES export LESS_TERMCAP_mb=$'\E[1;31m' # begin blinking # change first number pair for command and flag color # currently brown, which is dark yellow for me export LESS_TERMCAP_md=$'\E[0;33;5;74m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode export LESS_TERMCAP_se=$'\E[0m' # end standout-mode export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box export LESS_TERMCAP_ue=$'\E[0m' # end underline # change first number pair for parameter color # currently cyan export LESS_TERMCAP_us=$'\E[0;36;5;146m' # begin underline ######################################### # Colorcodes: # Black 0;30 Dark Gray 1;30 # Blue 0;34 Light Blue 1;34 # Green 0;32 Light Green 1;32 # Cyan 0;36 Light Cyan 1;36 # Red 0;31 Light Red 1;31 # Purple 0;35 Light Purple 1;35 # Brown 0;33 Yellow 1;33 # Light Gray 0;37 White 1;37 ######################################### To my shame I have to admit that I did not find out what the second number pair meant, i.e. the `5;74` and the `5;146`. Can someone clarify that further?
bash
shell
colors
pager
man
07/22/2012 07:05:00
off topic
bash: colorized man page === Where do I have to take a look at in the system to colorize the man pages? The man pages are viewed with less, so I tried adding the following lines to my .bashrc to change the colors: (Which works fine, btw.) # LESS COLORS FOR MAN PAGES export LESS_TERMCAP_mb=$'\E[1;31m' # begin blinking # change first number pair for command and flag color # currently brown, which is dark yellow for me export LESS_TERMCAP_md=$'\E[0;33;5;74m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode export LESS_TERMCAP_se=$'\E[0m' # end standout-mode export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box export LESS_TERMCAP_ue=$'\E[0m' # end underline # change first number pair for parameter color # currently cyan export LESS_TERMCAP_us=$'\E[0;36;5;146m' # begin underline ######################################### # Colorcodes: # Black 0;30 Dark Gray 1;30 # Blue 0;34 Light Blue 1;34 # Green 0;32 Light Green 1;32 # Cyan 0;36 Light Cyan 1;36 # Red 0;31 Light Red 1;31 # Purple 0;35 Light Purple 1;35 # Brown 0;33 Yellow 1;33 # Light Gray 0;37 White 1;37 ######################################### To my shame I have to admit that I did not find out what the second number pair meant, i.e. the `5;74` and the `5;146`. Can someone clarify that further?
2
11,594,179
07/21/2012 17:07:10
1,296,724
03/27/2012 22:27:09
1
0
Need help to filter a chat window data
i am building a firefox add-on for a chat that i use, but i have a problem but i cant find any solution. The content of the chat is displayed on a iframe, and i can only modify the css and data after i stop the chat page. The status of the DOM is always loading (until i press the stop button), as it keeps getting new msgs from users. Is there any way of modifying the incoming data before DOM finishes the load? All msgs from users come inside a javascript, what i got is this: > $('body#chat').css("background-color", "#ddd"); This changes the color of the background for example, but just after i stop the connection. Thank you
javascript
jquery
dom
chat
null
null
open
Need help to filter a chat window data === i am building a firefox add-on for a chat that i use, but i have a problem but i cant find any solution. The content of the chat is displayed on a iframe, and i can only modify the css and data after i stop the chat page. The status of the DOM is always loading (until i press the stop button), as it keeps getting new msgs from users. Is there any way of modifying the incoming data before DOM finishes the load? All msgs from users come inside a javascript, what i got is this: > $('body#chat').css("background-color", "#ddd"); This changes the color of the background for example, but just after i stop the connection. Thank you
0
11,594,180
07/21/2012 17:07:16
655,561
03/11/2011 15:19:49
29
0
put Tabbar in the bottom of the screen
I want to put the tabbar widget on the button of the screen but i failed. here is my code: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:layout_height="fill_parent" android:layout_width="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /> </RelativeLayout> </TabHost> I am using android 2.3.3
android
android-layout
tabs
null
null
null
open
put Tabbar in the bottom of the screen === I want to put the tabbar widget on the button of the screen but i failed. here is my code: <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout android:layout_height="fill_parent" android:layout_width="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dp" /> </RelativeLayout> </TabHost> I am using android 2.3.3
0
11,327,287
07/04/2012 10:30:34
1,501,282
07/04/2012 10:25:36
1
0
Google Places Api in Turkey
Can i use google places api in Turkey ? Because when I send the parameters,i take zero results How can I fix it ?
google-places-api
null
null
null
null
null
open
Google Places Api in Turkey === Can i use google places api in Turkey ? Because when I send the parameters,i take zero results How can I fix it ?
0
11,327,293
07/04/2012 10:30:51
137,406
07/13/2009 12:34:14
123
8
Allow login via Facebook on a mobile app to authorize the user on a secondary OAuth API
I'm developing a native mobile app for a custom, web-based social network app. We're building a REST API to communicate with the web server, and we've chosen OAuth2 as the authentication method (the `grant_type=password` flow). The web-app allows users to login and signup using external services (ie. Facebook and Twitter). We need to allow the same also on the mobile app. The question is: how can we do that? The Pinterest mobile app is able to manage the situation (see attached image). What is the flow that's been used here? Do they behave like a classical OAuth-powered app (the mobile app acting as OAuth client directly with the Facebook API?). If so, then how can the mobile app be authenticated with the Pinterest server? Is it passing the Facebook OAuth access token as credentials? ![Pinterest Login View][1] [1]: http://i.stack.imgur.com/Tdety.png
ios
api
oauth-2.0
facebook-oauth
null
null
open
Allow login via Facebook on a mobile app to authorize the user on a secondary OAuth API === I'm developing a native mobile app for a custom, web-based social network app. We're building a REST API to communicate with the web server, and we've chosen OAuth2 as the authentication method (the `grant_type=password` flow). The web-app allows users to login and signup using external services (ie. Facebook and Twitter). We need to allow the same also on the mobile app. The question is: how can we do that? The Pinterest mobile app is able to manage the situation (see attached image). What is the flow that's been used here? Do they behave like a classical OAuth-powered app (the mobile app acting as OAuth client directly with the Facebook API?). If so, then how can the mobile app be authenticated with the Pinterest server? Is it passing the Facebook OAuth access token as credentials? ![Pinterest Login View][1] [1]: http://i.stack.imgur.com/Tdety.png
0
11,327,299
07/04/2012 10:31:25
1,465,929
06/19/2012 09:09:14
1
1
Writing data to sqlite xCode
first of all I am from spain so sorry about my grammar. I am writing some data to a sqlite data base, here is my code: > NSString *insertStatement=[NSString stringWithFormat:@"INSERT INTO captura(key,tecnico,fecha,provincia,municipio,latitud,longitud,altura,familia,especie,numero,comentario)Values(\"%@\",\"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\",\"%@\",\"%@\",\"%@\")",asd,tecnico,fechaHora,tecnico,municipio,latitud,longitud,altura,tecnico,animal,asd,coment]; > char *error; > if((sqlite3_exec(dbcapturas, [insertStatement UTF8String], NULL, NULL, &error))==SQLITE_OK) > { > > NSLog(@"Person inserted."); > } > else > { > NSLog(@"Error: %s", error); > } the first time I click on the save button I get: 2012-07-04 12:17:45.644 adasdasd[1783:f803] Person inserted. and the second time I get : 2012-07-04 12:29:18.959 adasdasd[1840:f803] Error: column key is not unique So my code should be ok but when I open the database its totally empty, any idea?
ios
xcode
sqlite
null
null
null
open
Writing data to sqlite xCode === first of all I am from spain so sorry about my grammar. I am writing some data to a sqlite data base, here is my code: > NSString *insertStatement=[NSString stringWithFormat:@"INSERT INTO captura(key,tecnico,fecha,provincia,municipio,latitud,longitud,altura,familia,especie,numero,comentario)Values(\"%@\",\"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\",\"%@\",\"%@\",\"%@\")",asd,tecnico,fechaHora,tecnico,municipio,latitud,longitud,altura,tecnico,animal,asd,coment]; > char *error; > if((sqlite3_exec(dbcapturas, [insertStatement UTF8String], NULL, NULL, &error))==SQLITE_OK) > { > > NSLog(@"Person inserted."); > } > else > { > NSLog(@"Error: %s", error); > } the first time I click on the save button I get: 2012-07-04 12:17:45.644 adasdasd[1783:f803] Person inserted. and the second time I get : 2012-07-04 12:29:18.959 adasdasd[1840:f803] Error: column key is not unique So my code should be ok but when I open the database its totally empty, any idea?
0
11,327,283
07/04/2012 10:30:12
1,365,637
04/30/2012 10:55:39
75
3
Create function - insert quote or set varibles in parentheses
I'm trying to create a function which selects a list of variables in a dataframe. The criterion is simple all variables between two selected ones. My code so far: var_bw <- function(v1, v2, data) { data[ ,which(names(data)==v1):which(names(data)==v2)] } However, `v1` and `v2` need quotes around them. Must be straightforward...
r
function
quotes
null
null
null
open
Create function - insert quote or set varibles in parentheses === I'm trying to create a function which selects a list of variables in a dataframe. The criterion is simple all variables between two selected ones. My code so far: var_bw <- function(v1, v2, data) { data[ ,which(names(data)==v1):which(names(data)==v2)] } However, `v1` and `v2` need quotes around them. Must be straightforward...
0
11,327,308
07/04/2012 10:32:03
420,905
08/15/2010 10:31:05
11
1
Webkit rendering quirks for element with "position:fixed" and "-webkit-backface-visibility: hidden;"?
Recently I encountered a rendering issue in Webkit which I suspect it to be a bug with the Webkit engine. But I am not confident enough to say do, so I would like to seek your advise. It'd be a bit difficult for me to describe the case in plain text, so I prepared a snippet: http://jsfiddle.net/2eQXa/1/ Visiting the site you should see a yellow background with red border. This is not a background of the <body> tag but a <div> with id "backdrop" which has 100% with and height. By default it is assigned to a class "backdrop-no-problem". Also there is a horizontal list with some images. The list is surrounded by a green border. Inside the list is the wikipedia image wrapped with a dotted red border. I am testing the page using 3 devices: 1. Chrome 21 on Windows 7 2. Mobile safari on the first generation iPad (running iOS4, I'll call it iPad1) 3. Mobile safari on the "new" iPad (running iOS5, I'll call it iPad3) Try clicking "right" or "left" to scroll the list. Pretty good. To reproduce the my problem, first click on "Issue #1". This will change the backdrop div from "position:absolute" to "position:fixed". Then click "Issue #2". This will add "-webkit-backface-visibility: hidden;" to the element. The reason of this is to ensure smooth animation on the iPad which is not included in this snippet. Now click "left/right" to scroll the list. You should see a strange behavior in all three browsers: The green div is scrolling properly and smoothly, but not its child elements. The child elements simply "out-sync" with the position of the scrolling parent. The movement is not only look laggy, it sometimes even stuck. And the child elements will stop at a wrong position when the scrolling animation finishes. You have to move your mouse over the picture (or tap on it in a tablet) to trigger an update to have the element re-draw at the right place. Even chrome experience this weirdness makes me feel that it is a webkit issue. In fact things gone worse in iPad3. In iPad3 you don't need to add "-webkit-backface-visibility: hidden;" (Issue #2) to see this weird behavior. Just add "position:fixed" (Issue #1) will do. The strange thing is that this doesn't happen when you view the snippet in jsFiddle. In case you are interested I have put the source in a single file at pastebin: http://pastebin.com/i4ARX4mD When writing this question I saw quite a number of questions regarding backface visibility. I've checked some but none of them matches my problem. Ideas or suggestions are welcome. Thanks!
css
ipad
google-chrome
webkit
mobile-safari
null
open
Webkit rendering quirks for element with "position:fixed" and "-webkit-backface-visibility: hidden;"? === Recently I encountered a rendering issue in Webkit which I suspect it to be a bug with the Webkit engine. But I am not confident enough to say do, so I would like to seek your advise. It'd be a bit difficult for me to describe the case in plain text, so I prepared a snippet: http://jsfiddle.net/2eQXa/1/ Visiting the site you should see a yellow background with red border. This is not a background of the <body> tag but a <div> with id "backdrop" which has 100% with and height. By default it is assigned to a class "backdrop-no-problem". Also there is a horizontal list with some images. The list is surrounded by a green border. Inside the list is the wikipedia image wrapped with a dotted red border. I am testing the page using 3 devices: 1. Chrome 21 on Windows 7 2. Mobile safari on the first generation iPad (running iOS4, I'll call it iPad1) 3. Mobile safari on the "new" iPad (running iOS5, I'll call it iPad3) Try clicking "right" or "left" to scroll the list. Pretty good. To reproduce the my problem, first click on "Issue #1". This will change the backdrop div from "position:absolute" to "position:fixed". Then click "Issue #2". This will add "-webkit-backface-visibility: hidden;" to the element. The reason of this is to ensure smooth animation on the iPad which is not included in this snippet. Now click "left/right" to scroll the list. You should see a strange behavior in all three browsers: The green div is scrolling properly and smoothly, but not its child elements. The child elements simply "out-sync" with the position of the scrolling parent. The movement is not only look laggy, it sometimes even stuck. And the child elements will stop at a wrong position when the scrolling animation finishes. You have to move your mouse over the picture (or tap on it in a tablet) to trigger an update to have the element re-draw at the right place. Even chrome experience this weirdness makes me feel that it is a webkit issue. In fact things gone worse in iPad3. In iPad3 you don't need to add "-webkit-backface-visibility: hidden;" (Issue #2) to see this weird behavior. Just add "position:fixed" (Issue #1) will do. The strange thing is that this doesn't happen when you view the snippet in jsFiddle. In case you are interested I have put the source in a single file at pastebin: http://pastebin.com/i4ARX4mD When writing this question I saw quite a number of questions regarding backface visibility. I've checked some but none of them matches my problem. Ideas or suggestions are welcome. Thanks!
0
11,327,309
07/04/2012 10:32:10
1,190,316
02/05/2012 07:18:40
120
1
how to set positions of buttons on drop target in a DND interface
import java.awt.*; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureRecognizer; import java.awt.dnd.DragSource; import java.awt.dnd.DropTarget; import javax.swing.*; import javax.swing.JComponent.*; import javax.swing.table.*; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class JPanels extends JFrame { private static ActionListener actionListener; public static void main(String[] args) { new JPanels(); } public JPanels() { JFrame frame = new JFrame("DND INTERFACE"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); JMenuItem newMenuItem = new JMenuItem("New", KeyEvent.VK_N); fileMenu.add(newMenuItem); frame.setJMenuBar(menuBar); frame.setSize(800, 500); frame.setVisible(true); WindowUtilities.setNativeLookAndFeel(); addWindowListener(new ExitListener()); Container content = getContentPane(); content.setBackground(Color.lightGray); JPanel SixChoicePanel1 = new JPanel (new GridLayout(15,1)); setBackground(Color.lightGray); SixChoicePanel1.setBorder(BorderFactory.createTitledBorder("Tools")); JButton option; option = new JButton("Drag this button1"); JButton option1 = new JButton("Drag this button"); JButton option2 = new JButton("Drag this button"); JButton option3 = new JButton("Drag this button"); JButton option4 = new JButton("Drag this button"); SixChoicePanel1.add(option); SixChoicePanel1.add(option1); SixChoicePanel1.add(option2); SixChoicePanel1.add(option3); SixChoicePanel1.add(option4); JPanel panel = new JPanel(new GridLayout(2,1)); panel.setBackground(Color.white); JTable table; DefaultTableModel modeltable = new DefaultTableModel(8,8); table = new JTable(modeltable); table.setBorder(BorderFactory.createLineBorder (Color.blue, 2)); int height = table.getRowHeight(); table.setRowHeight(height=50); table.setColumnSelectionAllowed(true); panel.add(table); panel.setSize(400,400); JPanel area = new JPanel(); JButton btnSave = new JButton("Save"); panel.add(area); frame.add(SixChoicePanel1); frame.add(panel, BorderLayout.EAST); pack(); NewClass dndListener = new NewClass(); DragSource dragSource = new DragSource(); DropTarget dropTarget1 = new DropTarget(table, DnDConstants.ACTION_COPY_OR_MOVE, dndListener); DropTarget dropTarget2 = new DropTarget(SixChoicePanel1,dndListener); DragGestureRecognizer dragRecognizer1 = dragSource. createDefaultDragGestureRecognizer(option, DnDConstants.ACTION_COPY, dndListener); DragGestureRecognizer dragRecognizer2 = dragSource. createDefaultDragGestureRecognizer(option1, DnDConstants.ACTION_COPY, dndListener); DragGestureRecognizer dragRecognizer3 = dragSource. createDefaultDragGestureRecognizer(option2, DnDConstants.ACTION_COPY, dndListener); } } in the above code when a button drags in to drop target(table), always buttons drop on to the same position. i just want drag them to the customized location. please help me with this problem. thanks in advance :)
java
interface
dnd
null
null
null
open
how to set positions of buttons on drop target in a DND interface === import java.awt.*; import java.awt.dnd.DnDConstants; import java.awt.dnd.DragGestureRecognizer; import java.awt.dnd.DragSource; import java.awt.dnd.DropTarget; import javax.swing.*; import javax.swing.JComponent.*; import javax.swing.table.*; import java.awt.event.*; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class JPanels extends JFrame { private static ActionListener actionListener; public static void main(String[] args) { new JPanels(); } public JPanels() { JFrame frame = new JFrame("DND INTERFACE"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu); JMenuItem newMenuItem = new JMenuItem("New", KeyEvent.VK_N); fileMenu.add(newMenuItem); frame.setJMenuBar(menuBar); frame.setSize(800, 500); frame.setVisible(true); WindowUtilities.setNativeLookAndFeel(); addWindowListener(new ExitListener()); Container content = getContentPane(); content.setBackground(Color.lightGray); JPanel SixChoicePanel1 = new JPanel (new GridLayout(15,1)); setBackground(Color.lightGray); SixChoicePanel1.setBorder(BorderFactory.createTitledBorder("Tools")); JButton option; option = new JButton("Drag this button1"); JButton option1 = new JButton("Drag this button"); JButton option2 = new JButton("Drag this button"); JButton option3 = new JButton("Drag this button"); JButton option4 = new JButton("Drag this button"); SixChoicePanel1.add(option); SixChoicePanel1.add(option1); SixChoicePanel1.add(option2); SixChoicePanel1.add(option3); SixChoicePanel1.add(option4); JPanel panel = new JPanel(new GridLayout(2,1)); panel.setBackground(Color.white); JTable table; DefaultTableModel modeltable = new DefaultTableModel(8,8); table = new JTable(modeltable); table.setBorder(BorderFactory.createLineBorder (Color.blue, 2)); int height = table.getRowHeight(); table.setRowHeight(height=50); table.setColumnSelectionAllowed(true); panel.add(table); panel.setSize(400,400); JPanel area = new JPanel(); JButton btnSave = new JButton("Save"); panel.add(area); frame.add(SixChoicePanel1); frame.add(panel, BorderLayout.EAST); pack(); NewClass dndListener = new NewClass(); DragSource dragSource = new DragSource(); DropTarget dropTarget1 = new DropTarget(table, DnDConstants.ACTION_COPY_OR_MOVE, dndListener); DropTarget dropTarget2 = new DropTarget(SixChoicePanel1,dndListener); DragGestureRecognizer dragRecognizer1 = dragSource. createDefaultDragGestureRecognizer(option, DnDConstants.ACTION_COPY, dndListener); DragGestureRecognizer dragRecognizer2 = dragSource. createDefaultDragGestureRecognizer(option1, DnDConstants.ACTION_COPY, dndListener); DragGestureRecognizer dragRecognizer3 = dragSource. createDefaultDragGestureRecognizer(option2, DnDConstants.ACTION_COPY, dndListener); } } in the above code when a button drags in to drop target(table), always buttons drop on to the same position. i just want drag them to the customized location. please help me with this problem. thanks in advance :)
0
11,471,372
07/13/2012 13:22:06
1,010,331
10/24/2011 06:08:56
78
1
How to prevent text selection on focus() in chrome
On Focus the text in the input box is getting selected in Chrome ,Works fine in FF .How do i get rid of that My selector is as follows $('.edit').click(function(){ $('input').focus(); });
jquery
google-chrome
textselection
null
null
null
open
How to prevent text selection on focus() in chrome === On Focus the text in the input box is getting selected in Chrome ,Works fine in FF .How do i get rid of that My selector is as follows $('.edit').click(function(){ $('input').focus(); });
0
11,471,032
07/13/2012 13:00:53
1,220,942
02/20/2012 11:43:48
321
15
Starting out on Linux/Ubuntu
Recently I decided I want to learn to do Django development and specifically on Linux (Ubuntu). So far I've managed a couple of things including setting up the wireless drivers with ndiswrapper that I needed to access the internet - going to 'repair' the MBR tonight and boot back into Windows 7 and use easybcd to setup the bootstrapper so I can use both Ubuntu and Windows. I would like some suggestions on getting started with Linux (perhaps more specifically Ubuntu) because I am not satisfied relying solely on google to solve my problems. Can you guys/girls recommend any Linux/Ubuntu resources that can help me out? (Links to tutorials/screencasts/courses/names of books etc.) Thanks a lot!
linux
ubuntu
null
null
null
07/13/2012 13:43:19
off topic
Starting out on Linux/Ubuntu === Recently I decided I want to learn to do Django development and specifically on Linux (Ubuntu). So far I've managed a couple of things including setting up the wireless drivers with ndiswrapper that I needed to access the internet - going to 'repair' the MBR tonight and boot back into Windows 7 and use easybcd to setup the bootstrapper so I can use both Ubuntu and Windows. I would like some suggestions on getting started with Linux (perhaps more specifically Ubuntu) because I am not satisfied relying solely on google to solve my problems. Can you guys/girls recommend any Linux/Ubuntu resources that can help me out? (Links to tutorials/screencasts/courses/names of books etc.) Thanks a lot!
2
11,471,033
07/13/2012 13:00:54
140,628
07/18/2009 11:50:00
312
4
ASP.NET shared machineKey across .NET 3.5 and .NET 4 applications
I have two ASP.NET applications. The first is a .NET 3.5 application and the second is a .NET 4 application. The .NET 3.5 application is responsible for authenticating users. They both share the same machine key, with SHA1 specified as the validation algorithm (as instructed by [http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770148][1]) <machineKey decryption="Auto" decryptionKey="FD6F049F1F1E91CC29576A2B5E2197C792EB28557D016E8C" validation="SHA1" validationKey="7A057944F91ABB19DDDE99425ECE9BF79F364492A2D1F555D9A46A703F5CB0B0ADAD955D05EBAF1B65C596B572BC6EE17FA8765885E74B8C22C0396B5E042201" /> However I cannot login to the second application. If I convert the first application to .NET 3.5 or the second to .NET 4, I can login. Unfortunately this is not possible in my production application. Am I missing anything here? Thanks, Ben [1]: http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770148
asp.net
authentication
forms-authentication
machinekey
null
null
open
ASP.NET shared machineKey across .NET 3.5 and .NET 4 applications === I have two ASP.NET applications. The first is a .NET 3.5 application and the second is a .NET 4 application. The .NET 3.5 application is responsible for authenticating users. They both share the same machine key, with SHA1 specified as the validation algorithm (as instructed by [http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770148][1]) <machineKey decryption="Auto" decryptionKey="FD6F049F1F1E91CC29576A2B5E2197C792EB28557D016E8C" validation="SHA1" validationKey="7A057944F91ABB19DDDE99425ECE9BF79F364492A2D1F555D9A46A703F5CB0B0ADAD955D05EBAF1B65C596B572BC6EE17FA8765885E74B8C22C0396B5E042201" /> However I cannot login to the second application. If I convert the first application to .NET 3.5 or the second to .NET 4, I can login. Unfortunately this is not possible in my production application. Am I missing anything here? Thanks, Ben [1]: http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770148
0
11,466,973
07/13/2012 08:39:57
1,372,560
05/03/2012 13:11:37
1
0
Python replace with re-using unknown strings
I have an XML in which I'd like to rename one of the tag groups like this: <string>ABC</string> <string>unknown string</string> should be <xyz>ABC</xyz> <xyz>unknown string</xyz> ABC is always the same, so that's no issue. However, "unknown string" is always different, but since I need this information extracted, I also want to keep the same string in the replacement. Here's what I got so far: import re #open the xml file for reading: file = open('path/file','r+') #convert to string: data = file.read() file.write(re.sub("<string>ABC</string>(\s+)<string>(.*)</string>","<xyz>ABC</xyz>[\1]<xyz>[\2]</xyz>",data)) print (data) file.close() I tried to use capture groups, but didn't do it correctly. The string is replaced with weird symbols in my XML. Plus, it's printed twice. I have both the unchanged and the changed version in my XML, which I don't want. I am grateful for any suggestions you might have. Thanks and kind regards.
python
replace
group
capture
null
null
open
Python replace with re-using unknown strings === I have an XML in which I'd like to rename one of the tag groups like this: <string>ABC</string> <string>unknown string</string> should be <xyz>ABC</xyz> <xyz>unknown string</xyz> ABC is always the same, so that's no issue. However, "unknown string" is always different, but since I need this information extracted, I also want to keep the same string in the replacement. Here's what I got so far: import re #open the xml file for reading: file = open('path/file','r+') #convert to string: data = file.read() file.write(re.sub("<string>ABC</string>(\s+)<string>(.*)</string>","<xyz>ABC</xyz>[\1]<xyz>[\2]</xyz>",data)) print (data) file.close() I tried to use capture groups, but didn't do it correctly. The string is replaced with weird symbols in my XML. Plus, it's printed twice. I have both the unchanged and the changed version in my XML, which I don't want. I am grateful for any suggestions you might have. Thanks and kind regards.
0
11,466,976
07/13/2012 08:40:07
1,475,042
06/22/2012 13:58:10
1
0
query to fetch the manager name by managerID
I have a table named Employee and it has the fields as ID,Name,EmpID,rankID,DeptID and managerID. i have set the managerID as foriegn key to the Employee table with reference to ID in employee table. now i want a query to fetch all the employee and their manager information. "manager information should be manager name not the managerID." pls help me.
sql
null
null
null
null
null
open
query to fetch the manager name by managerID === I have a table named Employee and it has the fields as ID,Name,EmpID,rankID,DeptID and managerID. i have set the managerID as foriegn key to the Employee table with reference to ID in employee table. now i want a query to fetch all the employee and their manager information. "manager information should be manager name not the managerID." pls help me.
0
11,471,462
07/13/2012 13:27:56
1,523,641
07/13/2012 13:13:11
1
0
SQL Server Management Studio Express 2012 "ONLY"
I have installed SQL Server Express(SSMS) 2012 with management tools. After a few months, the Management studio has stopped working. The error is: «« Evaluation period has expired. For more on how to upgrade your evaluation software please go to http://www.microsoft.com/howtobuy »» I dont know why this happened with the express edition. Maybe the Management studio is not released as express edition. What should I do now to get SSMS work with SQL Server 2012? The earlier releases of SSMS do not work with SQL Server 2012 and I must use SSMS 2012.
sql-server
ssms
sql-server-2012-express
null
null
07/14/2012 16:21:09
off topic
SQL Server Management Studio Express 2012 "ONLY" === I have installed SQL Server Express(SSMS) 2012 with management tools. After a few months, the Management studio has stopped working. The error is: «« Evaluation period has expired. For more on how to upgrade your evaluation software please go to http://www.microsoft.com/howtobuy »» I dont know why this happened with the express edition. Maybe the Management studio is not released as express edition. What should I do now to get SSMS work with SQL Server 2012? The earlier releases of SSMS do not work with SQL Server 2012 and I must use SSMS 2012.
2
11,471,465
07/13/2012 13:28:18
1,191,614
02/06/2012 05:38:38
106
7
What is the method to pass username and password in VpnService.Builder class?
I am developing the application in which i want to use VPN network. to create VPN network in device we need to configure it from (settings-wireless and network-VPN settings) menu of device.<br>I want to do this many settings via code with hard-coded information.<br> From API level 4.0 android provides API to handle the [VPN services][1]. To know the implementation of this methods i used the Sample project of Android ToyVPN.But in this many methods i didn't find any method to pass username and password. inforamtion which i have to connect VPN network is. (1) VPN Server name<br>(2)Username <br>(3) Password Using this three information i am successfully connecting to VPN network if i am configuring manually from device. But i want to do this programmatically.Here is the class file which is used to connect to VPN network.[ToyVpnClient.java][2] and [ToyVpnService.java][3] Any help will be appreciated.<br>Thanks [1]: http://developer.android.com/reference/android/net/VpnService.Builder.html [2]: http://pastie.org/4249892 [3]: http://pastie.org/4249896
android
vpn
null
null
null
null
open
What is the method to pass username and password in VpnService.Builder class? === I am developing the application in which i want to use VPN network. to create VPN network in device we need to configure it from (settings-wireless and network-VPN settings) menu of device.<br>I want to do this many settings via code with hard-coded information.<br> From API level 4.0 android provides API to handle the [VPN services][1]. To know the implementation of this methods i used the Sample project of Android ToyVPN.But in this many methods i didn't find any method to pass username and password. inforamtion which i have to connect VPN network is. (1) VPN Server name<br>(2)Username <br>(3) Password Using this three information i am successfully connecting to VPN network if i am configuring manually from device. But i want to do this programmatically.Here is the class file which is used to connect to VPN network.[ToyVpnClient.java][2] and [ToyVpnService.java][3] Any help will be appreciated.<br>Thanks [1]: http://developer.android.com/reference/android/net/VpnService.Builder.html [2]: http://pastie.org/4249892 [3]: http://pastie.org/4249896
0
11,541,232
07/18/2012 12:21:25
1,534,731
07/18/2012 12:09:32
1
0
google-api-javascript-client : How to get contents of file using Drive API?
First off, if there is a question/answer that solves my problem already then I sincerely apologize for creating a new one. However, I have been searching for 3 days now, and have not found an answer... My problem is, I cannot for the life of me figure out how to pull the contents of a file(any file). From reading the docs I've discovered that my returned file resource object is supposed to have a property named "downloadUrl", and from this I should be able to access the file contents. None of the file resource objects that are returned to me(via gapi.client.request) have this field/property. Below is the function I am using to get a file. Can someone please help point me in the right direction? I have to have this demo done by Monday and I've been stuck on this for 2 days.... Here is the code for my get function : Client.getFileContent = function getFileContent() { gapi.client.load('drive', 'v2', function() { var request = gapi.client.request({ path : '/drive/v2/files/1QmaofXyVqnw6ODXHE5KWlUTcWbA9KkLyb-lBdh_FLUs', method : 'GET', params : { projection: "FULL" } }); request.execute(function(response) { console.log(response); }); }); }; The file resource object that is returned to me does not have the downloadUrl property.
google-api
google-drive-sdk
null
null
null
null
open
google-api-javascript-client : How to get contents of file using Drive API? === First off, if there is a question/answer that solves my problem already then I sincerely apologize for creating a new one. However, I have been searching for 3 days now, and have not found an answer... My problem is, I cannot for the life of me figure out how to pull the contents of a file(any file). From reading the docs I've discovered that my returned file resource object is supposed to have a property named "downloadUrl", and from this I should be able to access the file contents. None of the file resource objects that are returned to me(via gapi.client.request) have this field/property. Below is the function I am using to get a file. Can someone please help point me in the right direction? I have to have this demo done by Monday and I've been stuck on this for 2 days.... Here is the code for my get function : Client.getFileContent = function getFileContent() { gapi.client.load('drive', 'v2', function() { var request = gapi.client.request({ path : '/drive/v2/files/1QmaofXyVqnw6ODXHE5KWlUTcWbA9KkLyb-lBdh_FLUs', method : 'GET', params : { projection: "FULL" } }); request.execute(function(response) { console.log(response); }); }); }; The file resource object that is returned to me does not have the downloadUrl property.
0
11,541,344
07/18/2012 12:27:21
1,278,359
03/19/2012 10:40:21
1
0
searching partial word in Apache-Solr
I have setup solr,and I want to search a word by providing charecter/s from that word.example :a word is "University" if I give "uni" it returns nothing. I used fieldtype is text. and defaultsearchfield is text and also copyfield is text. Thank you. Noman
php
apache
tomcat
solr
null
null
open
searching partial word in Apache-Solr === I have setup solr,and I want to search a word by providing charecter/s from that word.example :a word is "University" if I give "uni" it returns nothing. I used fieldtype is text. and defaultsearchfield is text and also copyfield is text. Thank you. Noman
0
11,541,345
07/18/2012 12:27:24
902,423
08/19/2011 12:27:39
328
35
Class Cast exception for the Hadoop new API
i have trying to cough up with some simple code using Map reduce framework. Previously I had implemented using mapred package and I was able to specify the input format class as KeyvalueTextInputFormat But in the new Api using mapreduce this class is not present. I tried using the TextInputFormat.class but i still get the following exception - job_local_0001 java.lang.ClassCastException: org.apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text at com.hp.hpl.mapReduceprocessing.MapReduceWrapper$HitFileProccesorMapper_internal.map(MapReduceWrapper.java:1) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:177) here is a sample snippet of the code Configuration conf = new Configuration(); conf.set("key.value.separator.output.line", ","); Job job = new Job(conf, "Result Aggregation"); job.setJarByClass(ProcessInputFile.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); job.setMapperClass(MultithreadedMapper.class); MultithreadedMapper.setMapperClass(job, HitFileProccesorMapper_internal.class); MultithreadedMapper.setNumberOfThreads(job, 3); //job.setMapperClass(HitFileProccesorMapper_internal.class); job.setReducerClass(HitFileReducer_internal.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); FileInputFormat.addInputPath(job, new Path(inputFileofhits.getName())); FileOutputFormat.setOutputPath(job, new Path(ProcessInputFile.resultAggProps .getProperty("OUTPUT_DIRECTORY"))); try { job.waitForCompletion(true); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Please do let me know what are the configuration changes to be made so that classcast exception can be avoided.
java
hadoop
mapreduce
null
null
null
open
Class Cast exception for the Hadoop new API === i have trying to cough up with some simple code using Map reduce framework. Previously I had implemented using mapred package and I was able to specify the input format class as KeyvalueTextInputFormat But in the new Api using mapreduce this class is not present. I tried using the TextInputFormat.class but i still get the following exception - job_local_0001 java.lang.ClassCastException: org.apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text at com.hp.hpl.mapReduceprocessing.MapReduceWrapper$HitFileProccesorMapper_internal.map(MapReduceWrapper.java:1) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:305) at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:177) here is a sample snippet of the code Configuration conf = new Configuration(); conf.set("key.value.separator.output.line", ","); Job job = new Job(conf, "Result Aggregation"); job.setJarByClass(ProcessInputFile.class); job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); job.setMapperClass(MultithreadedMapper.class); MultithreadedMapper.setMapperClass(job, HitFileProccesorMapper_internal.class); MultithreadedMapper.setNumberOfThreads(job, 3); //job.setMapperClass(HitFileProccesorMapper_internal.class); job.setReducerClass(HitFileReducer_internal.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); FileInputFormat.addInputPath(job, new Path(inputFileofhits.getName())); FileOutputFormat.setOutputPath(job, new Path(ProcessInputFile.resultAggProps .getProperty("OUTPUT_DIRECTORY"))); try { job.waitForCompletion(true); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Please do let me know what are the configuration changes to be made so that classcast exception can be avoided.
0
11,541,350
07/18/2012 12:27:33
1,534,733
07/18/2012 12:10:07
1
0
How to write a loop that I can store different sets in different container:
I have a big dic that contains different miRNA and their target genes. I use dic.values to pop out their target genes. Because I want to calculate their intersection of target genes (it's also called shared targets),using the set.(). Now I have a problem that is: How to write a loop that I can store different sets in different container: I want to modify this script: a1 = set(d1.values()[0]) a2 = set(d1.values()[1]) a3 = set(d1.values()[2]) Please give me a hand.T
python-2.7
null
null
null
null
null
open
How to write a loop that I can store different sets in different container: === I have a big dic that contains different miRNA and their target genes. I use dic.values to pop out their target genes. Because I want to calculate their intersection of target genes (it's also called shared targets),using the set.(). Now I have a problem that is: How to write a loop that I can store different sets in different container: I want to modify this script: a1 = set(d1.values()[0]) a2 = set(d1.values()[1]) a3 = set(d1.values()[2]) Please give me a hand.T
0
11,541,357
07/18/2012 12:28:10
1,533,946
07/18/2012 07:24:17
11
0
retrieve image from database using php
while($food_name=mysql_fetch_array($result)) { echo $food_name["food_name"]; $food_name["food_price"]; $content = $food_name['image']; header('Content-type: image/jpg'); echo $content; } I want to retrive the image from database and I am using the dataype LONGBLOG for images. I am getting error.
php
mysql
insert
where
null
07/18/2012 20:59:49
not a real question
retrieve image from database using php === while($food_name=mysql_fetch_array($result)) { echo $food_name["food_name"]; $food_name["food_price"]; $content = $food_name['image']; header('Content-type: image/jpg'); echo $content; } I want to retrive the image from database and I am using the dataype LONGBLOG for images. I am getting error.
1
11,541,361
07/18/2012 12:28:30
1,532,897
07/17/2012 20:08:37
1
0
Wordpress filter posts and sort by taxonomy
I've searched around for a way to filter and sort custom posts by taxonomy in WordPress but haven't found any solution. Found a similar problem without any answer in http://stackoverflow.com/q/7320372/1532897. I have custom posts with hierarchy taxonomies. Like: - Day 1 - 8-9 - 9-10 - 10-11 - Day 2 - 8-9 - 9-10 etc... I now want the posts with "Day 1" and then order them by "8-9", "9-10" and so forth... Thanks.
wordpress
sorting
filter
hierarchy
taxonomy
null
open
Wordpress filter posts and sort by taxonomy === I've searched around for a way to filter and sort custom posts by taxonomy in WordPress but haven't found any solution. Found a similar problem without any answer in http://stackoverflow.com/q/7320372/1532897. I have custom posts with hierarchy taxonomies. Like: - Day 1 - 8-9 - 9-10 - 10-11 - Day 2 - 8-9 - 9-10 etc... I now want the posts with "Day 1" and then order them by "8-9", "9-10" and so forth... Thanks.
0
11,692,974
07/27/2012 17:44:33
1,152,734
01/16/2012 21:38:06
633
42
app.LoadPackage method not working in script component of SSIS
I may be using the app.loadpackage method incorrectly below, but I used the same method in the script task successfully. Now I want to put the same in a script component so that I can create new rows for all the user variables in my package. Where am I going wrong? Any help is appreciated. When I try to use the app.LoadPackage method, it tells me "***No overload for method 'LoadPackage' takes '2' arguments***" using System; using System.Data; using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime.Wrapper; [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] public class ScriptMain : UserComponent { public override void CreateNewOutputRows() { //string packagepath; //packagepath = ; Application app = new Application(); Package pkg = new Package(); pkg = app.LoadPackage(@"C:\packagepath", null); }
c#
sql-server-2008
ssis
script-component
null
null
open
app.LoadPackage method not working in script component of SSIS === I may be using the app.loadpackage method incorrectly below, but I used the same method in the script task successfully. Now I want to put the same in a script component so that I can create new rows for all the user variables in my package. Where am I going wrong? Any help is appreciated. When I try to use the app.LoadPackage method, it tells me "***No overload for method 'LoadPackage' takes '2' arguments***" using System; using System.Data; using Microsoft.SqlServer.Dts.Pipeline.Wrapper; using Microsoft.SqlServer.Dts.Runtime.Wrapper; [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute] public class ScriptMain : UserComponent { public override void CreateNewOutputRows() { //string packagepath; //packagepath = ; Application app = new Application(); Package pkg = new Package(); pkg = app.LoadPackage(@"C:\packagepath", null); }
0
11,692,976
07/27/2012 17:44:40
1,440,585
06/06/2012 19:00:16
10
0
How can I take a JSON response from a RESTful web service and parse it to populate a google spreadsheet?
I got this working with XML (Thanks to the help of those on here), but now I need to do the same with a JSON response. I need to parse the response and populate a google spreadsheet. Any help with the code or pointers to where I can find examples for this are greatly appreciated! Here's the url "http://www.sciencebase.gov/catalog/items?s=Search&q=water&format=json&max=3" and here's what it returns { "rel": "self", "url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water& format=json", "total": 475972, "nextlink": { "rel": "next", "url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water &format=json&offset=3" }, "items": [ { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a0ae4b07f02db5fb83c"}, "id": "4f4e4a0ae4b07f02db5fb83c", "oldId": 1796213, "title": "Water Resources Data, Iowa, Water Year 2003--Volume 2. Ground Water and Quality of Precipitation", "summary": "Water resources data for Iowa for the 2003 water year consists of records of ground water levels and water quality of ground-water wells. This report volume contains water-level records for 166 ground- water observation wells; water-quality data for 150 municipal wells; and precipitation-quality data for 2 precipitation sites.", "hasChildren": false }, { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a62e4b07f02db6369dc" }, "id": "4f4e4a62e4b07f02db6369dc", "oldId": 1800335, "title": "Reconnaissance of the water resources of Beaver County, Oklahoma", "summary": "Ground water is the major source of water supply in Beaver County. Because of the rapidly increasing demand for the limited supply of water for irrigation, additional geologic and hydrologic data are needed for management of ground-water resources. This report presents general information on the availability of ground water, on the chemical quality of water, and on streamflow. The chemical quality of water generally is poorer than that of water elsewhere in the Oklahoma Panhandle, and the ability to obtain good quality water may become increasingly difficult as the water resources are developed.\r\nFurther studies are needed to determine the annual change in water levels, the rate of water-level decline in heavily pumped areas, the volume of water stored in the ground- water reservoir, and the quantity of water that may be withdrawn safely in a given area.", "hasChildren": false }, { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a0de4b07f02db5fd2c3" }, "id": "4f4e4a0de4b07f02db5fd2c3", "oldId": 1794688, "title": "Water Resources Data - Texas, Water Year 2003, Volume 6. Ground Water", "summary": "Water-resources data for the 2003 water year for Texas consists of records of stage, discharge, and water quality of streams; stage and contents in lakes and reservoirs; and water levels and water quality in wells. Volume 6 contains water levels for 880 ground-water observation wells and water-quality data for 158 monitoring wells. These data represent that part of the National Water Data System operated by the U.S. Geological Survey and cooperating Federal, State, and local agencies in Texas.", "hasChildren": false } ] } This is the code I have and this was based off of getting a return of XML function respondToSearch() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet1 = ss.getSheets()[0].setColumnWidth(2, 500); var cellSearch = sheet1 // Get the response back from the url as a string var response = UrlFetchApp.fetch("http://www.sciencebase.gov/catalog/items? s=Search&q=water&format=json&max=3"); // Parse the xml string, returns and xml document var parsedResponse = Utilities.jsonParse(response.getContentText()); // for loop to display imported data down (a1:a10) the spreadsheet. Sets a wider column width for for (var i = 0; i < parsedResponse.items.item; i++) { var result = parsedResponse.items[i]; var print = result.getElement("title").getText(); var cellLtrs = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"]; var cellLetter = cellLtrs[0]; var cellNum = [i + 1]; var both = cellLetter + cellNum; sheet1.setColumnWidth(1, 100).setActiveCell(both).setFontSize("9").setHorizontalAlignment("left"). setVerticalAlignment("top").setValue(print); } } Thanks again
google-apps-script
null
null
null
null
null
open
How can I take a JSON response from a RESTful web service and parse it to populate a google spreadsheet? === I got this working with XML (Thanks to the help of those on here), but now I need to do the same with a JSON response. I need to parse the response and populate a google spreadsheet. Any help with the code or pointers to where I can find examples for this are greatly appreciated! Here's the url "http://www.sciencebase.gov/catalog/items?s=Search&q=water&format=json&max=3" and here's what it returns { "rel": "self", "url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water& format=json", "total": 475972, "nextlink": { "rel": "next", "url": "https://www.sciencebase.gov/catalog/items?max=3&s=Search&q=water &format=json&offset=3" }, "items": [ { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a0ae4b07f02db5fb83c"}, "id": "4f4e4a0ae4b07f02db5fb83c", "oldId": 1796213, "title": "Water Resources Data, Iowa, Water Year 2003--Volume 2. Ground Water and Quality of Precipitation", "summary": "Water resources data for Iowa for the 2003 water year consists of records of ground water levels and water quality of ground-water wells. This report volume contains water-level records for 166 ground- water observation wells; water-quality data for 150 municipal wells; and precipitation-quality data for 2 precipitation sites.", "hasChildren": false }, { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a62e4b07f02db6369dc" }, "id": "4f4e4a62e4b07f02db6369dc", "oldId": 1800335, "title": "Reconnaissance of the water resources of Beaver County, Oklahoma", "summary": "Ground water is the major source of water supply in Beaver County. Because of the rapidly increasing demand for the limited supply of water for irrigation, additional geologic and hydrologic data are needed for management of ground-water resources. This report presents general information on the availability of ground water, on the chemical quality of water, and on streamflow. The chemical quality of water generally is poorer than that of water elsewhere in the Oklahoma Panhandle, and the ability to obtain good quality water may become increasingly difficult as the water resources are developed.\r\nFurther studies are needed to determine the annual change in water levels, the rate of water-level decline in heavily pumped areas, the volume of water stored in the ground- water reservoir, and the quantity of water that may be withdrawn safely in a given area.", "hasChildren": false }, { "link": { "rel": "self", "url": "https://www.sciencebase.gov/catalog/item/ 4f4e4a0de4b07f02db5fd2c3" }, "id": "4f4e4a0de4b07f02db5fd2c3", "oldId": 1794688, "title": "Water Resources Data - Texas, Water Year 2003, Volume 6. Ground Water", "summary": "Water-resources data for the 2003 water year for Texas consists of records of stage, discharge, and water quality of streams; stage and contents in lakes and reservoirs; and water levels and water quality in wells. Volume 6 contains water levels for 880 ground-water observation wells and water-quality data for 158 monitoring wells. These data represent that part of the National Water Data System operated by the U.S. Geological Survey and cooperating Federal, State, and local agencies in Texas.", "hasChildren": false } ] } This is the code I have and this was based off of getting a return of XML function respondToSearch() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet1 = ss.getSheets()[0].setColumnWidth(2, 500); var cellSearch = sheet1 // Get the response back from the url as a string var response = UrlFetchApp.fetch("http://www.sciencebase.gov/catalog/items? s=Search&q=water&format=json&max=3"); // Parse the xml string, returns and xml document var parsedResponse = Utilities.jsonParse(response.getContentText()); // for loop to display imported data down (a1:a10) the spreadsheet. Sets a wider column width for for (var i = 0; i < parsedResponse.items.item; i++) { var result = parsedResponse.items[i]; var print = result.getElement("title").getText(); var cellLtrs = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"]; var cellLetter = cellLtrs[0]; var cellNum = [i + 1]; var both = cellLetter + cellNum; sheet1.setColumnWidth(1, 100).setActiveCell(both).setFontSize("9").setHorizontalAlignment("left"). setVerticalAlignment("top").setValue(print); } } Thanks again
0
11,692,977
07/27/2012 17:44:54
382,745
07/03/2010 15:58:16
1,087
2
iPod Out, how does it work?
The iPod-Out feature since iOS4 seems to be targeted towards car-integration. Does anyone know how that iPod-Out interface actually works? Does it use private apis, if so which?
ios
ios5
ios4
null
null
07/30/2012 06:42:16
off topic
iPod Out, how does it work? === The iPod-Out feature since iOS4 seems to be targeted towards car-integration. Does anyone know how that iPod-Out interface actually works? Does it use private apis, if so which?
2
11,693,018
07/27/2012 17:47:59
790,068
06/09/2011 00:12:12
81
2
PhoneGap iOS using an iframe won't load page
I have an iframe that fetches information about a song and then it tries to launch iTunes. I have `OpenAllWhitelistURLsInWebView` with `YES` as the value, but when the frame tries to load the iTunes store. Here is the error: shouldStartLoadWithRequest: Received Unhandled URL itms://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=It%27s+Happening+++Daniel+Bashta&partnerId=30&siteID=aOx3s4PxaYI-u3VQ6FY0xTj9XV2LxTTfDg 2012-07-27 13:46:05.115 Victory 91.5[7024:13403] Failed to load webpage with error: Frame load interrupted If you have any suggestions, let me know. Thanks!
ios
xcode
phonegap
null
null
null
open
PhoneGap iOS using an iframe won't load page === I have an iframe that fetches information about a song and then it tries to launch iTunes. I have `OpenAllWhitelistURLsInWebView` with `YES` as the value, but when the frame tries to load the iTunes store. Here is the error: shouldStartLoadWithRequest: Received Unhandled URL itms://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=It%27s+Happening+++Daniel+Bashta&partnerId=30&siteID=aOx3s4PxaYI-u3VQ6FY0xTj9XV2LxTTfDg 2012-07-27 13:46:05.115 Victory 91.5[7024:13403] Failed to load webpage with error: Frame load interrupted If you have any suggestions, let me know. Thanks!
0
11,693,019
07/27/2012 17:48:03
27,482
10/13/2008 15:31:04
5,797
370
How can I split a PDF file by file size using C#?
I found a [How to break a PDF into parts][1] tutorial that demonstrates how to split a PDF file into separate files either by pages or by maximum file size using Adobe Acrobat: ![Tools > Split Document > Split document by File size][2] I have [found][3] [many][4] [examples][5] on StackOverflow on how to split a PDF by page with C#. But how can I do the latter? How can I split a PDF file by a maximum file size using C#? For example, say I have a PDF file that is 70 pages and 40 MB. Instead of splitting into 7 files of 10 pages each, how can I split the file into around 5 files that are no greater than 10 MB each using C#? So far, the best method I have seen was in [Using itextsharp to split a pdf into smaller pdf's based on size][6] where [Cyfer13][7] used [iTextSharp][8] to split the file by page and then group those page files by size. But is a more direct way to accomplish this without having to first split by page? [1]: http://acrobatusers.com/tutorials/how-to-break-a-pdf-into-parts [2]: http://i.stack.imgur.com/fiIMV.png [3]: http://stackoverflow.com/questions/122109/how-can-i-split-up-a-pdf-file-into-pages-preferably-c [4]: http://stackoverflow.com/questions/6999296/split-huge-40000-page-pdf-into-single-pages-itextsharp-outofmemoryexception [5]: http://stackoverflow.com/questions/3574505/split-pdf-into-multiple-files-in-c-sharp [6]: http://stackoverflow.com/questions/9024839/using-itextsharp-to-split-a-pdf-into-smaller-pdfs-based-on-size?rq=1 [7]: http://stackoverflow.com/users/105172/cyfer13 [8]: http://itextpdf.com/
c#
pdf
null
null
null
null
open
How can I split a PDF file by file size using C#? === I found a [How to break a PDF into parts][1] tutorial that demonstrates how to split a PDF file into separate files either by pages or by maximum file size using Adobe Acrobat: ![Tools > Split Document > Split document by File size][2] I have [found][3] [many][4] [examples][5] on StackOverflow on how to split a PDF by page with C#. But how can I do the latter? How can I split a PDF file by a maximum file size using C#? For example, say I have a PDF file that is 70 pages and 40 MB. Instead of splitting into 7 files of 10 pages each, how can I split the file into around 5 files that are no greater than 10 MB each using C#? So far, the best method I have seen was in [Using itextsharp to split a pdf into smaller pdf's based on size][6] where [Cyfer13][7] used [iTextSharp][8] to split the file by page and then group those page files by size. But is a more direct way to accomplish this without having to first split by page? [1]: http://acrobatusers.com/tutorials/how-to-break-a-pdf-into-parts [2]: http://i.stack.imgur.com/fiIMV.png [3]: http://stackoverflow.com/questions/122109/how-can-i-split-up-a-pdf-file-into-pages-preferably-c [4]: http://stackoverflow.com/questions/6999296/split-huge-40000-page-pdf-into-single-pages-itextsharp-outofmemoryexception [5]: http://stackoverflow.com/questions/3574505/split-pdf-into-multiple-files-in-c-sharp [6]: http://stackoverflow.com/questions/9024839/using-itextsharp-to-split-a-pdf-into-smaller-pdfs-based-on-size?rq=1 [7]: http://stackoverflow.com/users/105172/cyfer13 [8]: http://itextpdf.com/
0
11,692,994
07/27/2012 17:45:56
445,663
09/12/2010 16:40:39
190
1
chat application, sockets vs RMI
I want to build a chat application and am confused about deciding whether to use sockets or RMI to build the application. I have heard that RMI is difficult to configure and deploy over the Internet, since that is my intention I was wondering what would be more appropriate to go with, sockets or RMI. Also is it easier to solve issues because of NAT in sockets or RMI ? What if I want to add voice support at some later point, does it help deciding which way to go ?
java
sockets
rmi
null
null
null
open
chat application, sockets vs RMI === I want to build a chat application and am confused about deciding whether to use sockets or RMI to build the application. I have heard that RMI is difficult to configure and deploy over the Internet, since that is my intention I was wondering what would be more appropriate to go with, sockets or RMI. Also is it easier to solve issues because of NAT in sockets or RMI ? What if I want to add voice support at some later point, does it help deciding which way to go ?
0
11,692,995
07/27/2012 17:46:01
536,607
12/09/2010 15:14:36
1,147
5
Trackbars in VS2008
I've been looking around the toolbox but I can't seem to find a trackbar control. Is it hidden somewhere? Or is it just not available on the designer and instead I have to code it?
c#
winforms
visual-studio-2008
null
null
null
open
Trackbars in VS2008 === I've been looking around the toolbox but I can't seem to find a trackbar control. Is it hidden somewhere? Or is it just not available on the designer and instead I have to code it?
0
11,693,028
07/27/2012 17:48:49
1,556,765
07/27/2012 06:02:31
1
0
JSOUP: Error while getting image's absolute url
I'm getting a error while using jsoup to get the image's absolute url. #code: package org.zzz.parser; import java.io.File; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class DocumentParser { /** * Parsing html from file */ public static void main(String[] args) { String url = "www.guiabh.com.br/evento/back-in-jack-seu-madruga.aspx"; File input = new File("/home/thalesfc/Code/recSystem/wgetao/" + url); Document doc = null; // parsing the document try { doc = Jsoup.parse(input, "ISO8859-1", url); } catch (IOException e) { System.err.println("$ Erro ao fazer o parsing do arquivo: " + input.getName()); e.printStackTrace(); } //getting the image url Element image = doc.getElementById("ctl00_ContentPlaceHolderConteudo_controleInternoAgito1_imageFotoCasa"); String imageUrl = image.attr("src"); String imageRealUrl = image.absUrl("src"); String imageRealUrl2 = image.attr("abs:src"); System.out.println("# image: " + imageUrl); System.out.println("# real image: " + imageRealUrl); System.out.println("# real image 2: " + imageRealUrl2); } } # output: \# image: ../imgs_cadastradas/seu madruga.jpg \# real image: \# real image 2: The desirable output is: http://www.guiabh.com.br/imgs_cadastradas/seu madruga.jpg Am I doing something wrong??
image
url
jsoup
absolute
null
null
open
JSOUP: Error while getting image's absolute url === I'm getting a error while using jsoup to get the image's absolute url. #code: package org.zzz.parser; import java.io.File; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class DocumentParser { /** * Parsing html from file */ public static void main(String[] args) { String url = "www.guiabh.com.br/evento/back-in-jack-seu-madruga.aspx"; File input = new File("/home/thalesfc/Code/recSystem/wgetao/" + url); Document doc = null; // parsing the document try { doc = Jsoup.parse(input, "ISO8859-1", url); } catch (IOException e) { System.err.println("$ Erro ao fazer o parsing do arquivo: " + input.getName()); e.printStackTrace(); } //getting the image url Element image = doc.getElementById("ctl00_ContentPlaceHolderConteudo_controleInternoAgito1_imageFotoCasa"); String imageUrl = image.attr("src"); String imageRealUrl = image.absUrl("src"); String imageRealUrl2 = image.attr("abs:src"); System.out.println("# image: " + imageUrl); System.out.println("# real image: " + imageRealUrl); System.out.println("# real image 2: " + imageRealUrl2); } } # output: \# image: ../imgs_cadastradas/seu madruga.jpg \# real image: \# real image 2: The desirable output is: http://www.guiabh.com.br/imgs_cadastradas/seu madruga.jpg Am I doing something wrong??
0
11,693,008
07/27/2012 17:47:08
1,529,199
07/16/2012 14:37:05
18
1
maven install failed"generics not supported"
I'm using embedded jetty server to build a war, I ran maven clean through eclipse, then maven install. I get a bunch of "not supported" errors \RoleDao.java:[86,13] generics are not supported in -source 1.3 (use -source 5 or higher to enable generics) public List<Role> findAllRoles() UserAuth.java:[44,1] annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) @SuppressWarnings("deprecation") Anyone have an idea? Thanks
eclipse
maven
null
null
null
null
open
maven install failed"generics not supported" === I'm using embedded jetty server to build a war, I ran maven clean through eclipse, then maven install. I get a bunch of "not supported" errors \RoleDao.java:[86,13] generics are not supported in -source 1.3 (use -source 5 or higher to enable generics) public List<Role> findAllRoles() UserAuth.java:[44,1] annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) @SuppressWarnings("deprecation") Anyone have an idea? Thanks
0
11,262,048
06/29/2012 12:46:04
1,225,875
02/22/2012 13:00:53
38
0
How to set background into Android Gridview?
i need to set image as background in android gridview. I have code which is using image view to load images. Following codes are my codes, please help me out to solve this issue. public void onCreate(Bundle savedInstanceState) { if(!isNetworkAvailbale()){ Toast.makeText(getApplicationContext(), "Internet Connection not available", Toast.LENGTH_SHORT).show(); finish(); } super.onCreate(savedInstanceState); setContentView(R.layout.gridview); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Log.d("taust","sds"); Toast.makeText(NuesHoundRSSActivity.this, "Item co" + position, Toast.LENGTH_SHORT).show(); } }); } ImageAdapter package com.nues.rss; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(150, 150)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(1, 1, 1, 1); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); // imageView.setTag(mThumbIds[position]); return imageView; } // references to our images private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7 }; } Any body knows how to set images as background of grid items ?
android
image
android-layout
gridview
background
null
open
How to set background into Android Gridview? === i need to set image as background in android gridview. I have code which is using image view to load images. Following codes are my codes, please help me out to solve this issue. public void onCreate(Bundle savedInstanceState) { if(!isNetworkAvailbale()){ Toast.makeText(getApplicationContext(), "Internet Connection not available", Toast.LENGTH_SHORT).show(); finish(); } super.onCreate(savedInstanceState); setContentView(R.layout.gridview); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Log.d("taust","sds"); Toast.makeText(NuesHoundRSSActivity.this, "Item co" + position, Toast.LENGTH_SHORT).show(); } }); } ImageAdapter package com.nues.rss; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(150, 150)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(1, 1, 1, 1); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); // imageView.setTag(mThumbIds[position]); return imageView; } // references to our images private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7 }; } Any body knows how to set images as background of grid items ?
0
11,262,049
06/29/2012 12:46:05
29,573
10/20/2008 11:39:35
454
17
retrieving group members/membership from active directory when members attrib doesn't work
I am trying to get all group members from "Domain Users". When using AD Users MMC tab, I get a lot of results. When using ADSI - not. The following DOESN'T work as expected: - looking at members attribute of the group entry via LDAP/ADSI. It returns only 56 members when there are considerably more. - searching by memberOf (returns just a few entries) - searching by primaryGroup (it is not a primary group) - searching by tokenGrops (it is a constructed attribute) any ideas appreciated.
active-directory
adsi
null
null
null
null
open
retrieving group members/membership from active directory when members attrib doesn't work === I am trying to get all group members from "Domain Users". When using AD Users MMC tab, I get a lot of results. When using ADSI - not. The following DOESN'T work as expected: - looking at members attribute of the group entry via LDAP/ADSI. It returns only 56 members when there are considerably more. - searching by memberOf (returns just a few entries) - searching by primaryGroup (it is not a primary group) - searching by tokenGrops (it is a constructed attribute) any ideas appreciated.
0
11,262,050
06/29/2012 12:46:07
680,446
03/28/2011 14:57:46
1
0
ExtJS: How to position SplitButton menu relative to SplitButton
I have a SplitButton at the bottom of the page and is not visible initially(we need to scroll down to see the bottom). When I scroll to SplitButton, then press arrow button to expand splitbutton's menu, menu appears **under** SplitButton(just as planned), and then scroll up, **the menu remains on screen**, and it is **positioned relative to window**, not the containing div. I tried to initialize menu by passing ***floating: false*** to it's config, but in this case menu doesn't expands at all. How can I posision SplitButton's menu to have it **always** under SplitButton? My ExtJS version is 4.07
extjs
null
null
null
null
null
open
ExtJS: How to position SplitButton menu relative to SplitButton === I have a SplitButton at the bottom of the page and is not visible initially(we need to scroll down to see the bottom). When I scroll to SplitButton, then press arrow button to expand splitbutton's menu, menu appears **under** SplitButton(just as planned), and then scroll up, **the menu remains on screen**, and it is **positioned relative to window**, not the containing div. I tried to initialize menu by passing ***floating: false*** to it's config, but in this case menu doesn't expands at all. How can I posision SplitButton's menu to have it **always** under SplitButton? My ExtJS version is 4.07
0
11,262,052
06/29/2012 12:46:22
1,507,726
06/15/2012 18:44:53
23
0
Drop Shadow in Raphael
I am wanting to create a drop shadow for an object (or anything for that matter) with Raphael. I was searching around the web and found some sources, but was unclear as to how I would apply it to my code. From what I understand there is a blur() method in Raphael but I didn't find it in their documentation. Anyways I am new to Raphael so if someone could provide some assistance I would appreciate it. Here is the code I have so far... <html> <head><title></title> <script src="raphael-min.js"></script> <script src="jquery-1.7.2.js"></script> </head> <body> <div id="draw-here-raphael" style="height: 200px; width: 400px;"> </div> <script type="text/javascript"> //all your javascript goes here var r = new Raphael("draw-here-raphael"), // Store where the box is position = 'left', // Make our pink rectangle rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"}); var shadow = canvas.path(p); shadow.attr({stroke: "none", fill: "#555", translation: "4,4"}); var shape = canvas.path(p); </script> </body> </html> Live Long and Fucking Prosper.
javascript
raphael
dropshadow
null
null
06/29/2012 19:38:10
not a real question
Drop Shadow in Raphael === I am wanting to create a drop shadow for an object (or anything for that matter) with Raphael. I was searching around the web and found some sources, but was unclear as to how I would apply it to my code. From what I understand there is a blur() method in Raphael but I didn't find it in their documentation. Anyways I am new to Raphael so if someone could provide some assistance I would appreciate it. Here is the code I have so far... <html> <head><title></title> <script src="raphael-min.js"></script> <script src="jquery-1.7.2.js"></script> </head> <body> <div id="draw-here-raphael" style="height: 200px; width: 400px;"> </div> <script type="text/javascript"> //all your javascript goes here var r = new Raphael("draw-here-raphael"), // Store where the box is position = 'left', // Make our pink rectangle rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"}); var shadow = canvas.path(p); shadow.attr({stroke: "none", fill: "#555", translation: "4,4"}); var shape = canvas.path(p); </script> </body> </html> Live Long and Fucking Prosper.
1
11,262,055
06/29/2012 12:46:37
1,345,309
04/19/2012 23:43:12
633
34
More Effective way of picking a part a String from JTextPane?
It's not that my code doesn't work, but I am doubting whether it's very efficient or not. My theory is, that it isn't xD I have a JTextPane where I have to take the text in it (Making a new line every time the JTextPane got a new line basically), and put it into a .txt file. As I said everything works but I am doubting the implementation of it. This is the part I am doubting: public void printLog() { String s = logTextArea.getText(); ArrayList<String> log = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < s.length(); i++) { if(s.charAt(i) != '\n') { sb.append(s.charAt(i)); } else { log.add(sb.toString()); sb.delete(0, sb.length()); } } This is the entire thing just for reference: public void printLog() { String s = logTextArea.getText(); ArrayList<String> log = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < s.length(); i++) { if(s.charAt(i) != '\n') { sb.append(s.charAt(i)); } else { log.add(sb.toString()); sb.delete(0, sb.length()); } } File f = new File("JServer_Log.txt"); BufferedWriter bw = null; FileWriter fr = null; try { if(f.exists()) { fr = new FileWriter(f,true); } else { fr = new FileWriter(f); } } catch (IOException e) { // Nothing to do really. } try { bw = new BufferedWriter(fr); Iterator<String> itr = log.iterator(); bw.newLine(); while(itr.hasNext()) { bw.write(itr.next()); bw.newLine(); } } catch (IOException e) { // Nothing to do really. We lost the log? } finally { try { bw.close(); } catch(IOException ioe) { // The program is closing any way. } } }
java
io
stringbuilder
jtextpane
null
null
open
More Effective way of picking a part a String from JTextPane? === It's not that my code doesn't work, but I am doubting whether it's very efficient or not. My theory is, that it isn't xD I have a JTextPane where I have to take the text in it (Making a new line every time the JTextPane got a new line basically), and put it into a .txt file. As I said everything works but I am doubting the implementation of it. This is the part I am doubting: public void printLog() { String s = logTextArea.getText(); ArrayList<String> log = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < s.length(); i++) { if(s.charAt(i) != '\n') { sb.append(s.charAt(i)); } else { log.add(sb.toString()); sb.delete(0, sb.length()); } } This is the entire thing just for reference: public void printLog() { String s = logTextArea.getText(); ArrayList<String> log = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < s.length(); i++) { if(s.charAt(i) != '\n') { sb.append(s.charAt(i)); } else { log.add(sb.toString()); sb.delete(0, sb.length()); } } File f = new File("JServer_Log.txt"); BufferedWriter bw = null; FileWriter fr = null; try { if(f.exists()) { fr = new FileWriter(f,true); } else { fr = new FileWriter(f); } } catch (IOException e) { // Nothing to do really. } try { bw = new BufferedWriter(fr); Iterator<String> itr = log.iterator(); bw.newLine(); while(itr.hasNext()) { bw.write(itr.next()); bw.newLine(); } } catch (IOException e) { // Nothing to do really. We lost the log? } finally { try { bw.close(); } catch(IOException ioe) { // The program is closing any way. } } }
0
11,262,061
06/29/2012 12:46:53
658,243
03/14/2011 04:47:12
32
3
Tool bar in editor missing in WP
I am having somewhat amazing problem. My client is in sweden. When I check the site from my country (Nepal), everything is fine. But tool in editor in wordpress panel is missing in sweden. I checked with teamwork and remote desktop. And he was right. And tool bar is missing in all browsers ( i checked in firefox , safari and chrome) And this is problem in current project only. My other projects in WP is working fine. So getting crazy.. I have disabled all plugins, update wordpress to latest verion 3.4. And still the problem exists. Please kindly help me to solve this problem.
wordpress
editor
null
null
null
07/02/2012 09:04:30
off topic
Tool bar in editor missing in WP === I am having somewhat amazing problem. My client is in sweden. When I check the site from my country (Nepal), everything is fine. But tool in editor in wordpress panel is missing in sweden. I checked with teamwork and remote desktop. And he was right. And tool bar is missing in all browsers ( i checked in firefox , safari and chrome) And this is problem in current project only. My other projects in WP is working fine. So getting crazy.. I have disabled all plugins, update wordpress to latest verion 3.4. And still the problem exists. Please kindly help me to solve this problem.
2
11,262,062
06/29/2012 12:46:55
57,083
01/20/2009 12:44:23
841
18
jqPlot Cursor follow series line
I have a line graph using jqPlot with one series and several data points across it and smoothed lines. I'm using the Cursor plugin to show crosshairs and a tooltip to show x and y points. Is it possible to have the cross hairs follow the line on the series? So the horizontal line would fix to the y position of the line and not following the mouse. I see you can get the x/y position of each data point but not of the lines inbetween points. Thanks
jqplot
null
null
null
null
null
open
jqPlot Cursor follow series line === I have a line graph using jqPlot with one series and several data points across it and smoothed lines. I'm using the Cursor plugin to show crosshairs and a tooltip to show x and y points. Is it possible to have the cross hairs follow the line on the series? So the horizontal line would fix to the y position of the line and not following the mouse. I see you can get the x/y position of each data point but not of the lines inbetween points. Thanks
0
11,262,064
06/29/2012 12:46:55
149,664
08/03/2009 11:09:18
2,156
60
Embedding PDF in Firefox
After my script has generated a PDF I'd like to display it inside the browser. I'm using an iframe which works fine in all browsers except Firefox (it forces download). Sometimes FF can do it, sometimes not, depending on whatever plugin is installed but I have no control over the FF config of my users. I've tried using Google Docs to embed the PDF which works fine except the lines of text that have PraxisCom-Bold.ttf as font - these don't display in Google Docs (even when I view it in Google Docs non embedded). Zoho viewer displays these lines but not in the proper font. Before I start trying to convert my PDF to a JPG - are there any other options at all to reliably display a PDF in Firefox?
firefox
pdf
null
null
null
null
open
Embedding PDF in Firefox === After my script has generated a PDF I'd like to display it inside the browser. I'm using an iframe which works fine in all browsers except Firefox (it forces download). Sometimes FF can do it, sometimes not, depending on whatever plugin is installed but I have no control over the FF config of my users. I've tried using Google Docs to embed the PDF which works fine except the lines of text that have PraxisCom-Bold.ttf as font - these don't display in Google Docs (even when I view it in Google Docs non embedded). Zoho viewer displays these lines but not in the proper font. Before I start trying to convert my PDF to a JPG - are there any other options at all to reliably display a PDF in Firefox?
0