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,567,798
07/19/2012 19:18:13
1,114,664
12/24/2011 15:08:24
89
2
C++: Static and Dynamic libraries ( compiling and running)
I'm working on a library project which is pretty much finished. So I'm giving it a test run now. I have no problem running my test project. However I'm not entirely sure if I'm doing it right. Mainly because I don't really understand what is happening exactly( at least im not entirely sure). I've compiled both the DLL and Static library(.a). For my test project i'm using the Headers from my library and linking against the static library. I'm able to compile. But then It seems that I also need the DLL where the executable resides in order for it to run. So to my understanding, I compile using the static library but I don't exactly embed it into my executable, therefor at runtime it's looking for the DLL? My confusion comes from the fact that I read that static libraries are usually embedded into the executable. But doesn't that only happen if you specify that in the compiler options? I'm rather confused about the relationship in my sittuation. Can someone clarify this?
c++
dll
static
compilation
null
null
open
C++: Static and Dynamic libraries ( compiling and running) === I'm working on a library project which is pretty much finished. So I'm giving it a test run now. I have no problem running my test project. However I'm not entirely sure if I'm doing it right. Mainly because I don't really understand what is happening exactly( at least im not entirely sure). I've compiled both the DLL and Static library(.a). For my test project i'm using the Headers from my library and linking against the static library. I'm able to compile. But then It seems that I also need the DLL where the executable resides in order for it to run. So to my understanding, I compile using the static library but I don't exactly embed it into my executable, therefor at runtime it's looking for the DLL? My confusion comes from the fact that I read that static libraries are usually embedded into the executable. But doesn't that only happen if you specify that in the compiler options? I'm rather confused about the relationship in my sittuation. Can someone clarify this?
0
11,567,799
07/19/2012 19:18:16
1,469,655
06/20/2012 14:57:59
44
1
How do I design MVC apps with view auditing in mind?
We're going to be building an application using MVC 4. A key requirement is view-level auditing. In other words, we must be able to show who accessed a view, the parameters to create the view and when the view was accessed. This is a new application so we can do almost whatever needs to be done to address this requirement. The database will be SQL Server 2008. Data access will include EF 4.x, possibly 5.x but not a sure thing. My question, how do I get started designing this feature? Are there any sample applications out there?
asp.net-mvc
null
null
null
null
null
open
How do I design MVC apps with view auditing in mind? === We're going to be building an application using MVC 4. A key requirement is view-level auditing. In other words, we must be able to show who accessed a view, the parameters to create the view and when the view was accessed. This is a new application so we can do almost whatever needs to be done to address this requirement. The database will be SQL Server 2008. Data access will include EF 4.x, possibly 5.x but not a sure thing. My question, how do I get started designing this feature? Are there any sample applications out there?
0
11,567,802
07/19/2012 19:18:39
513,006
11/19/2010 02:49:00
432
3
R: return "1.0" from FUN(1.01)?
I would like to convert a number to a specified number of significant figures, e.g. some function that returns `"1.0"` (as a character) from `FUN(1.01)`. (I need a character because the value will be used in an `xtable`. I suspect that this is trivial, but I am having trouble. Here is what I have tried: > signif(1.01, 2) [1] 1 > round(1.01, 2) [1] 1.01 > format(1.01, digits = 2) [1] "1" > as.character(trunc(1.20, 3)) [1] "1" > as.character(round(1.01, digits = 2)) [1] "1" Is there a function that will do this?
string
r
xtable
null
null
null
open
R: return "1.0" from FUN(1.01)? === I would like to convert a number to a specified number of significant figures, e.g. some function that returns `"1.0"` (as a character) from `FUN(1.01)`. (I need a character because the value will be used in an `xtable`. I suspect that this is trivial, but I am having trouble. Here is what I have tried: > signif(1.01, 2) [1] 1 > round(1.01, 2) [1] 1.01 > format(1.01, digits = 2) [1] "1" > as.character(trunc(1.20, 3)) [1] "1" > as.character(round(1.01, digits = 2)) [1] "1" Is there a function that will do this?
0
11,567,803
07/19/2012 19:18:39
1,051,671
11/17/2011 11:37:35
1
0
Is there any way to use ssh key in jboss?
I just want to call a services that deployed on the Jboss. I want to restrict those user whose ssh keys not in the Jboss. I have done with the IP address restriction but now wanted to restrict the users with ssh Keys also. Also wanted to allow a user only particular web-service Like abc-ws.war has the three web-service `/resource/user/getUser();` `/resource/user/addUser();` `/resource/user/deleteUser();` i want only `/resource/user/addUser()` service is accessible by the user directly by pass Xml to the jboss that has the war file and restrict other two services. Thanks in advance
spring
spring-mvc
jboss
spring-security
jboss5.x
null
open
Is there any way to use ssh key in jboss? === I just want to call a services that deployed on the Jboss. I want to restrict those user whose ssh keys not in the Jboss. I have done with the IP address restriction but now wanted to restrict the users with ssh Keys also. Also wanted to allow a user only particular web-service Like abc-ws.war has the three web-service `/resource/user/getUser();` `/resource/user/addUser();` `/resource/user/deleteUser();` i want only `/resource/user/addUser()` service is accessible by the user directly by pass Xml to the jboss that has the war file and restrict other two services. Thanks in advance
0
11,567,810
07/19/2012 19:19:10
587,406
01/24/2011 11:26:10
420
28
Permission denied after deploy app with capistrano
I have a `deploy.rb`like this set :application, "api" set :repository, "[email protected]/org/api.git" default_run_options[:pty] = true set :scm_passphrase, "passwd" set :scm, :git set :user, "deploy" set :use_sudo, false set :deploy_to, "/var/www" set :deploy_via, :remote_cache role :web, "192.168.0.95" # Your HTTP server, Apache/etc role :app, "192.168.0.95" # This may be the same as your `Web` server role :db, "192.168.0.95", :primary => true # This is where Rails migrations will run role :db, "192.168.0.95" as you can see, I'm doing a deploy to our intranet... After this, I executed `bundle exec foreman start` on our server and when I access the app, i see this: Permission denied - /var/www/releases/20120719190900/tmp/cache I tried to chmod and chown our www folder, but nothing changed... What am I missing here? Thanks
ruby
ruby-on-rails-3
deployment
capistrano
null
null
open
Permission denied after deploy app with capistrano === I have a `deploy.rb`like this set :application, "api" set :repository, "[email protected]/org/api.git" default_run_options[:pty] = true set :scm_passphrase, "passwd" set :scm, :git set :user, "deploy" set :use_sudo, false set :deploy_to, "/var/www" set :deploy_via, :remote_cache role :web, "192.168.0.95" # Your HTTP server, Apache/etc role :app, "192.168.0.95" # This may be the same as your `Web` server role :db, "192.168.0.95", :primary => true # This is where Rails migrations will run role :db, "192.168.0.95" as you can see, I'm doing a deploy to our intranet... After this, I executed `bundle exec foreman start` on our server and when I access the app, i see this: Permission denied - /var/www/releases/20120719190900/tmp/cache I tried to chmod and chown our www folder, but nothing changed... What am I missing here? Thanks
0
11,594,389
07/21/2012 17:32:40
1,542,968
07/21/2012 17:04:35
1
0
How to order SQL rows by value?
How to **select** user_ids **by B** meta_key and **order by ratings** meta_value? <pre> user_id | meta_key | meta_value ----------------------------------------------------- 1 A 1 1 B 1 1 C 1 1 rating 9 8 A 1 8 C 1 8 rating 99999 8 A 1 7 B 1 7 C 1 7 rating 999 </pre> I need to get an IDs of users who have **B** meta_key and, then, to order IDs by user **rating** values.
sql
wordpress
user
null
null
null
open
How to order SQL rows by value? === How to **select** user_ids **by B** meta_key and **order by ratings** meta_value? <pre> user_id | meta_key | meta_value ----------------------------------------------------- 1 A 1 1 B 1 1 C 1 1 rating 9 8 A 1 8 C 1 8 rating 99999 8 A 1 7 B 1 7 C 1 7 rating 999 </pre> I need to get an IDs of users who have **B** meta_key and, then, to order IDs by user **rating** values.
0
11,594,377
07/21/2012 17:31:32
1,082,555
12/05/2011 23:55:10
51
4
How to redirect all child directories to a single directories - over 240,000 directories to re-point
So this maybe simple so sorry if its obvious, and I've search for the answer already but not real answer came out. I've just taken over a new site, and it has a game on it which was made in Flash 4.1 so its been taken off now. But each users results had a URL so they could share it, i.e. /games/thegame/users/*#useridnumber#*/ Now Google is picking up a seriously vast amount of 404 errors because all of those user results have gone - and I mean big, like over 240,000 directories were there. So simply, how can I redirect all sub directories of "/games/thegame/" to one folder of "/games/newversion/" I've tried this, but it doesn't have any result: RedirectMatch 301 /games/thegame/*(.*) /games/newversion//$1 Thanks!
.htaccess
redirect
null
null
null
null
open
How to redirect all child directories to a single directories - over 240,000 directories to re-point === So this maybe simple so sorry if its obvious, and I've search for the answer already but not real answer came out. I've just taken over a new site, and it has a game on it which was made in Flash 4.1 so its been taken off now. But each users results had a URL so they could share it, i.e. /games/thegame/users/*#useridnumber#*/ Now Google is picking up a seriously vast amount of 404 errors because all of those user results have gone - and I mean big, like over 240,000 directories were there. So simply, how can I redirect all sub directories of "/games/thegame/" to one folder of "/games/newversion/" I've tried this, but it doesn't have any result: RedirectMatch 301 /games/thegame/*(.*) /games/newversion//$1 Thanks!
0
11,594,338
07/21/2012 17:25:53
522,877
11/28/2010 10:50:22
3,928
237
How to get stroke-dasharray to look the same on path as it does on line
I'm trying to create a dashed pattern with 16px of path and then a 14px gap. I've tried using: stroke-dasharray: 16px 14px; which works on my `<line>` element but doesn't seem to do anything on my `<path>` element. Here's a fiddle to play with: http://jsfiddle.net/Wexcode/avTY6/
html
css
svg
null
null
null
open
How to get stroke-dasharray to look the same on path as it does on line === I'm trying to create a dashed pattern with 16px of path and then a 14px gap. I've tried using: stroke-dasharray: 16px 14px; which works on my `<line>` element but doesn't seem to do anything on my `<path>` element. Here's a fiddle to play with: http://jsfiddle.net/Wexcode/avTY6/
0
11,594,339
07/21/2012 17:26:01
188,461
10/12/2009 14:07:10
2,916
80
Adding a weak ivar to a Objective-C class using the runtime
Is it possible to add a weak ref instance variable to a class created using the runtime? If so how? There is a function called `class_setWeakIvarLayout()` which seems to be related to this but the documentation (both for this function and the non-weak counterpart) is *very* thin unfortunately.
objective-c
weak-references
objective-c-runtime
null
null
null
open
Adding a weak ivar to a Objective-C class using the runtime === Is it possible to add a weak ref instance variable to a class created using the runtime? If so how? There is a function called `class_setWeakIvarLayout()` which seems to be related to this but the documentation (both for this function and the non-weak counterpart) is *very* thin unfortunately.
0
11,594,396
07/21/2012 17:33:38
197,017
10/27/2009 02:29:08
790
13
how to find out when a link was first tweeted
http://isitold.com/ somehow determines when a link/url was first tweeted. I can't seem to figure out how to do this with the twitter api, does anybody know? I'd like to use when a link was first tweeted in a time decay function in my app.
twitter
twitter-api
null
null
null
null
open
how to find out when a link was first tweeted === http://isitold.com/ somehow determines when a link/url was first tweeted. I can't seem to figure out how to do this with the twitter api, does anybody know? I'd like to use when a link was first tweeted in a time decay function in my app.
0
11,594,397
07/21/2012 17:33:39
1,542,896
07/21/2012 16:00:28
1
0
Java, using an interface as a callback
I have been developing a simple touch handler for Android with the possibilites of firing callbacks like onUpdate (when the screen is touched) without having to setup threads. My problem is that my knowledge of Java is fairly limited and i can't do it because i know very little of how to use interfaces. I'm pretty sure that my problem may be a simple typo or something, but i get a NullPointerException when i execute the method from the touch handler (which processed the touch information) so that i can do what i need in the main activity class. This is the main class code (cut from the irrelevant stuff): //package and imports public class Test extends Activity implements TouchHelper { StringBuilder builder = new StringBuilder(); TextView textView; TouchReader touchReader; List<TouchTable> touchTablesArray; TouchTable touchTable; public static final String Tag = "TouchTest"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); textView = new TextView(this); Log.d(Tag, "TextView initialized " + textView); textView.setText("Touch and drag (multiple fingers supported)!"); touchReader = new TouchReader(textView); Log.d(Tag, "touchReader initialized"); touchTablesArray = touchReader.getTouchTables(); setContentView(textView); } @Override public void onTouchUpdate(int pointerId) { Log.d(Tag, "onTouchUpdate called"); touchTable = touchTablesArray.get(pointerId); Log.d(Tag, "touchTable get successful"); //writing on stringbuilder } } This is the code of the handler itself: //package and imports public class TouchReader implements OnTouchListener { public final static String Tag = "TouchReader"; List<TouchTable> touchTables; TouchHelper helper; TouchTable touchTable = new TouchTable(); public TouchReader(View view) { view.setOnTouchListener(this); touchTables = new ArrayList<TouchTable>(10); Log.d(Tag, "TouchReader initialized"); } public boolean onTouch(View v, MotionEvent event) { synchronized(this) { //all the common code handling the actual handling, with switches and such touchTables.add(pointerId, touchTable); //obviously the pointerId is defined earlier Log.d(Tag, "Values updated"); helper.onTouchUpdate(pointerId); //the exception is here Log.d(Tag, "Update called"); } return true; } public List<TouchTable> getTouchTables() { synchronized(this) { return touchTables; } } } As you can see the error is most likely due to my inability to correctly use an interface, and yet all the official docs confused me even more. Finally, the tiny code of the interface: //package public interface TouchHelper { public void onTouchUpdate(int pointerId); } I hope this question isn't too noobish to post it here :)
java
android
interface
callback
touch
null
open
Java, using an interface as a callback === I have been developing a simple touch handler for Android with the possibilites of firing callbacks like onUpdate (when the screen is touched) without having to setup threads. My problem is that my knowledge of Java is fairly limited and i can't do it because i know very little of how to use interfaces. I'm pretty sure that my problem may be a simple typo or something, but i get a NullPointerException when i execute the method from the touch handler (which processed the touch information) so that i can do what i need in the main activity class. This is the main class code (cut from the irrelevant stuff): //package and imports public class Test extends Activity implements TouchHelper { StringBuilder builder = new StringBuilder(); TextView textView; TouchReader touchReader; List<TouchTable> touchTablesArray; TouchTable touchTable; public static final String Tag = "TouchTest"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); textView = new TextView(this); Log.d(Tag, "TextView initialized " + textView); textView.setText("Touch and drag (multiple fingers supported)!"); touchReader = new TouchReader(textView); Log.d(Tag, "touchReader initialized"); touchTablesArray = touchReader.getTouchTables(); setContentView(textView); } @Override public void onTouchUpdate(int pointerId) { Log.d(Tag, "onTouchUpdate called"); touchTable = touchTablesArray.get(pointerId); Log.d(Tag, "touchTable get successful"); //writing on stringbuilder } } This is the code of the handler itself: //package and imports public class TouchReader implements OnTouchListener { public final static String Tag = "TouchReader"; List<TouchTable> touchTables; TouchHelper helper; TouchTable touchTable = new TouchTable(); public TouchReader(View view) { view.setOnTouchListener(this); touchTables = new ArrayList<TouchTable>(10); Log.d(Tag, "TouchReader initialized"); } public boolean onTouch(View v, MotionEvent event) { synchronized(this) { //all the common code handling the actual handling, with switches and such touchTables.add(pointerId, touchTable); //obviously the pointerId is defined earlier Log.d(Tag, "Values updated"); helper.onTouchUpdate(pointerId); //the exception is here Log.d(Tag, "Update called"); } return true; } public List<TouchTable> getTouchTables() { synchronized(this) { return touchTables; } } } As you can see the error is most likely due to my inability to correctly use an interface, and yet all the official docs confused me even more. Finally, the tiny code of the interface: //package public interface TouchHelper { public void onTouchUpdate(int pointerId); } I hope this question isn't too noobish to post it here :)
0
11,594,399
07/21/2012 17:33:47
1,320,596
04/08/2012 17:44:59
161
0
find href based on word
I have a set of links I want to find on a page, but only if the href contains the word "PlaySounds" I tried the following code but i get undefined. http://www.website.com/uno/PlaySounds.aspx?Id=546444456 http://www.website.com/uno/PlaySounds.aspx?Id=347457458 http://www.website.com/uno/PlaySounds.aspx?Id=275656573 http://www.website.com/uno/PlaySounds.aspx?Id=976645654 hrefs = Array.prototype.filter.call(document.getElementsByTagName("a"), function(node) { return node.href.indexOf("PlaySounds") === 0; }).map(function(node) { return node.href; }); randomHref = hrefs[Math.floor(Math.random() * hrefs.length)]; console.log(randomHref );
javascript
null
null
null
null
null
open
find href based on word === I have a set of links I want to find on a page, but only if the href contains the word "PlaySounds" I tried the following code but i get undefined. http://www.website.com/uno/PlaySounds.aspx?Id=546444456 http://www.website.com/uno/PlaySounds.aspx?Id=347457458 http://www.website.com/uno/PlaySounds.aspx?Id=275656573 http://www.website.com/uno/PlaySounds.aspx?Id=976645654 hrefs = Array.prototype.filter.call(document.getElementsByTagName("a"), function(node) { return node.href.indexOf("PlaySounds") === 0; }).map(function(node) { return node.href; }); randomHref = hrefs[Math.floor(Math.random() * hrefs.length)]; console.log(randomHref );
0
11,594,358
07/21/2012 17:29:30
423,455
08/18/2010 00:22:01
49
0
How to spawn for a different function after the first one finishes using gevent?
The basic idea is as follows: a request comes to `views1` and it first returns the username. There is some heavy job separate done by `do_something_else` right after views1 is done. You can think of this as creating a new user, but has to do some heavy checking on the background. def views1(..): username = get_uername(...) return username from lib import do_something_else def do_something_else(...): // do heavy stuff here gevent.joinall([ gevent.spawn(views1, parmeter1, parmeter2, ...), gevent.spawn(do_something_else, parmeter1, parmeter2, ...) ]) The problem is I don't think `do_something_else` was ever called based on my logging. I read tutorial and I don't know where to place `gevent.sleep(0)`. I don't want blocking. I want the user sees the username right away, and let `do_something_else` runs in the background. Any idea?
python
asynchronous
gevent
null
null
null
open
How to spawn for a different function after the first one finishes using gevent? === The basic idea is as follows: a request comes to `views1` and it first returns the username. There is some heavy job separate done by `do_something_else` right after views1 is done. You can think of this as creating a new user, but has to do some heavy checking on the background. def views1(..): username = get_uername(...) return username from lib import do_something_else def do_something_else(...): // do heavy stuff here gevent.joinall([ gevent.spawn(views1, parmeter1, parmeter2, ...), gevent.spawn(do_something_else, parmeter1, parmeter2, ...) ]) The problem is I don't think `do_something_else` was ever called based on my logging. I read tutorial and I don't know where to place `gevent.sleep(0)`. I don't want blocking. I want the user sees the username right away, and let `do_something_else` runs in the background. Any idea?
0
11,734,417
07/31/2012 06:33:56
24,718
10/03/2008 02:51:44
8,338
236
Javascript equivalent of Python's values() dictionary method
In Python I can use the `.values()` method to iterate over the *values* of a dictionary. For example: mydict = {'a': [3,5,6,43,3,6,3,], 'b': [87,65,3,45,7,8], 'c': [34,57,8,9,9,2],} for value in mydict.values(): print value gives me: [3,5,6,43,3,6,3,] [87,65,3,45,7,8] [34,57,8,9,9,2] How can I do something similar in Javascript?
javascript
null
null
null
null
null
open
Javascript equivalent of Python's values() dictionary method === In Python I can use the `.values()` method to iterate over the *values* of a dictionary. For example: mydict = {'a': [3,5,6,43,3,6,3,], 'b': [87,65,3,45,7,8], 'c': [34,57,8,9,9,2],} for value in mydict.values(): print value gives me: [3,5,6,43,3,6,3,] [87,65,3,45,7,8] [34,57,8,9,9,2] How can I do something similar in Javascript?
0
11,734,262
07/31/2012 06:21:31
1,564,837
07/31/2012 06:08:42
1
0
API to make Video call using Wi-fi/LAN in iPad
I'm currently working on how to make a video call to other ipad using Wi-fi or through LAN, can anyone list some API which supports video call functioning? please provide any links or codings regarding how video call works? thanks in advance
iphone
ios
ipad
null
null
null
open
API to make Video call using Wi-fi/LAN in iPad === I'm currently working on how to make a video call to other ipad using Wi-fi or through LAN, can anyone list some API which supports video call functioning? please provide any links or codings regarding how video call works? thanks in advance
0
11,734,266
07/31/2012 06:21:54
1,553,689
07/26/2012 06:39:28
1
0
Redirect Loop Error.
**This web page has a redirect loop The web page at localhost:3613/SqaSuite/LessPermission[dot]aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this web page later. Learn more about this problem. Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.** Despite of clearing cookies and having no recursive and/or many loop redirecting, i am having this error. help ?
asp.net
null
null
null
null
null
open
Redirect Loop Error. === **This web page has a redirect loop The web page at localhost:3613/SqaSuite/LessPermission[dot]aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this web page later. Learn more about this problem. Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.** Despite of clearing cookies and having no recursive and/or many loop redirecting, i am having this error. help ?
0
11,734,429
07/31/2012 06:35:40
79,891
03/19/2009 06:44:03
3,295
33
Get the Device ID on the Windows Mobile device in compact framework?
When I connect to a windows mobile device from the PC using the RAPI API I can get its device ID like so: using (RemoteDeviceManager r = new RemoteDeviceManager()) { using (RemoteDevice dev = r.Devices.FirstConnectedDevice) { //dev.DeviceId; <--the id } } How cna I get the same 'DeviceId' value on the device itself in compact framework?
c#
windows-mobile
compact-framework
rapi
null
null
open
Get the Device ID on the Windows Mobile device in compact framework? === When I connect to a windows mobile device from the PC using the RAPI API I can get its device ID like so: using (RemoteDeviceManager r = new RemoteDeviceManager()) { using (RemoteDevice dev = r.Devices.FirstConnectedDevice) { //dev.DeviceId; <--the id } } How cna I get the same 'DeviceId' value on the device itself in compact framework?
0
11,734,430
07/31/2012 06:35:46
1,540,297
07/20/2012 09:19:29
9
1
How to updrade database version in android?
I want to upgrade my databae version to 4 i have changed version code in manifest file and my database openhelper is @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { DTLog.w("Old Version" + oldVersion, "new Version" + newVersion); DTLog.w("UPDATING DB", "Updating database"); if (oldVersion == 1 && newVersion == 2) { db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle1 TEXT"); db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle2 TEXT"); db.delete("moduleRecord", null, null); } else if ((oldVersion == 2&&newVersion == 3)) { db.execSQL("CREATE TABLE " + "moduleDesc" + "(deleteable INTEGER,createable INTEGER,updateable INTEGER,name TEXT,label TEXT,labelfields TEXT,fields TEXT);"); } else { db.execSQL("DROP TABLE IF EXISTS " + "moduleRecord"); db.execSQL("DROP TABLE IF EXISTS " + "ModuleName"); db.execSQL("DROP TABLE IF EXISTS " + "EventStatus"); db.execSQL("DROP TABLE IF EXISTS " + "moduleDesc"); onCreate(db); } } the error that i get is 07-31 12:01:15.267: W/System.err(632): android.database.sqlite.SQLiteException: no such table: moduleDesc: , while compiling: insert into moduleDesc(deleteable,createable,updateable,name,label,labelfields,fields)values(?,?,?,?,?,?,?) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83) can anyone tell me how to upgrade database
android
sqlite
null
null
null
null
open
How to updrade database version in android? === I want to upgrade my databae version to 4 i have changed version code in manifest file and my database openhelper is @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { DTLog.w("Old Version" + oldVersion, "new Version" + newVersion); DTLog.w("UPDATING DB", "Updating database"); if (oldVersion == 1 && newVersion == 2) { db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle1 TEXT"); db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle2 TEXT"); db.delete("moduleRecord", null, null); } else if ((oldVersion == 2&&newVersion == 3)) { db.execSQL("CREATE TABLE " + "moduleDesc" + "(deleteable INTEGER,createable INTEGER,updateable INTEGER,name TEXT,label TEXT,labelfields TEXT,fields TEXT);"); } else { db.execSQL("DROP TABLE IF EXISTS " + "moduleRecord"); db.execSQL("DROP TABLE IF EXISTS " + "ModuleName"); db.execSQL("DROP TABLE IF EXISTS " + "EventStatus"); db.execSQL("DROP TABLE IF EXISTS " + "moduleDesc"); onCreate(db); } } the error that i get is 07-31 12:01:15.267: W/System.err(632): android.database.sqlite.SQLiteException: no such table: moduleDesc: , while compiling: insert into moduleDesc(deleteable,createable,updateable,name,label,labelfields,fields)values(?,?,?,?,?,?,?) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65) 07-31 12:01:15.267: W/System.err(632): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83) can anyone tell me how to upgrade database
0
11,734,431
07/31/2012 06:35:48
1,490,355
06/29/2012 05:43:49
2,535
105
QPushButton visual issur
I have two custom-styled `QPushButton` buttons. Here is the stylesheet for the `Ok` button: QPushButton { background-color:#9dce2c; border-radius:7px; border:1px solid #83c41a; color:#ffffff; font-size:15px; font-weight:bold; padding:4px 24px; text-decoration:none; } QPushButton:pressed { border:2px solid black; } Now here's what it looks like: ![Ok button][1] which is fine. However, if the button is clicked (gets focus), it starts to look like this: ![Ok button focused][2] Note that slight shadowy rectangle around the text. It looks as if the text is being "selected". When the button loses focus, it starts looking normal again. Is there any way to solve this issue? I want the button to always look like it does when it's not focused. [1]: http://i.stack.imgur.com/4ml3X.png [2]: http://i.stack.imgur.com/tsH41.png
c++
qt
qt-stylesheet
qpushbutton
null
null
open
QPushButton visual issur === I have two custom-styled `QPushButton` buttons. Here is the stylesheet for the `Ok` button: QPushButton { background-color:#9dce2c; border-radius:7px; border:1px solid #83c41a; color:#ffffff; font-size:15px; font-weight:bold; padding:4px 24px; text-decoration:none; } QPushButton:pressed { border:2px solid black; } Now here's what it looks like: ![Ok button][1] which is fine. However, if the button is clicked (gets focus), it starts to look like this: ![Ok button focused][2] Note that slight shadowy rectangle around the text. It looks as if the text is being "selected". When the button loses focus, it starts looking normal again. Is there any way to solve this issue? I want the button to always look like it does when it's not focused. [1]: http://i.stack.imgur.com/4ml3X.png [2]: http://i.stack.imgur.com/tsH41.png
0
11,650,725
07/25/2012 13:23:14
1,551,625
07/25/2012 12:39:42
1
0
finding two newest files, in two seperate direcories and merging them, perl
Hello newbi to perl here. i have two direcotries, each containing pictures. the regional directory is updated every 5 minutes, the watch directory is updated every 15. what i am trying to do is find the newest file in each directory and take those files and use image magik to create a third immage. what i have works for some but is very inconsistant, for example my code will sometimes miss the regional files when it's time matches the watch files. others it will merge two watch files, eventhogh the watch files and regional files are in two seperate directories. I have no clue how to fix it. here is my code. `enter code here` #!/usr/bin/perl use strict; use warnings; use File::Find; use vars qw/%files_watch/; use vars qw/%files_regional/; sub findNewestFiles { my $element = $File::Find::name; return if (!-f $element); $files_watch{$element} = (stat($element))[10]; $files_regional{$element} = (stat($element))[10]; } my $image_magick_exe = "composite.exe\""; my $pic_dir ="C:\\eterra\\eterravision\\weather"; my $watch_dir = "C:\\eterra\\eterravision\\weather\\watch"; my $regional_dir = "C:\\eterra\\eterravision\\weather\\regional"; open (OUT, ">>names.txt")|| die; find(\&findNewestFiles, $watch_dir); my $newestfile_watch; my $time_watch = 0; while(my ($t1, $t2) = each(%files_watch)) { if ($t2 > $time_watch) { $newestfile_watch = $t1; $time_watch = $t2; } } $time_watch = localtime($time_watch); ###### find(\&findNewestFiles, $regional_dir); my $newestfile_regional; my $time_regional = 0; while (my ($t3, $t4) = each(%files_regional)) { if ($t4 > $time_regional) { $newestfile_regional = $t3; $time_regional = $t4; } } $time_regional = localtime($time_regional); ##### $newestfile_watch=~s/\//\\/g; $newestfile_regional=~s/\//\\/g; #replacing the "/" in the file path to "\" my @temp = split(/_/, $newestfile_regional); my $type = $temp[0]; my $date = $temp[1]; my $time = $temp[2]; my $check= "$pic_dir/radarwatch\_$date\_$time"; #check if file was created unless (-e $check) { system("\"$image_magick_exe \"$newestfile_regional\" \"$newestfile_watch\" \"$pic_dir\\radarwatch\_$date\_$time\""); print"file created\n"; } **strong text** i applogize for not writing the code any better. i also changed the [10] in the sub function to an [8], and a [9]. 8 is access time, 9 is modification time, and 10 is creation time, 10 hase been the most successful. any help is appritiatd.
perl
null
null
null
null
null
open
finding two newest files, in two seperate direcories and merging them, perl === Hello newbi to perl here. i have two direcotries, each containing pictures. the regional directory is updated every 5 minutes, the watch directory is updated every 15. what i am trying to do is find the newest file in each directory and take those files and use image magik to create a third immage. what i have works for some but is very inconsistant, for example my code will sometimes miss the regional files when it's time matches the watch files. others it will merge two watch files, eventhogh the watch files and regional files are in two seperate directories. I have no clue how to fix it. here is my code. `enter code here` #!/usr/bin/perl use strict; use warnings; use File::Find; use vars qw/%files_watch/; use vars qw/%files_regional/; sub findNewestFiles { my $element = $File::Find::name; return if (!-f $element); $files_watch{$element} = (stat($element))[10]; $files_regional{$element} = (stat($element))[10]; } my $image_magick_exe = "composite.exe\""; my $pic_dir ="C:\\eterra\\eterravision\\weather"; my $watch_dir = "C:\\eterra\\eterravision\\weather\\watch"; my $regional_dir = "C:\\eterra\\eterravision\\weather\\regional"; open (OUT, ">>names.txt")|| die; find(\&findNewestFiles, $watch_dir); my $newestfile_watch; my $time_watch = 0; while(my ($t1, $t2) = each(%files_watch)) { if ($t2 > $time_watch) { $newestfile_watch = $t1; $time_watch = $t2; } } $time_watch = localtime($time_watch); ###### find(\&findNewestFiles, $regional_dir); my $newestfile_regional; my $time_regional = 0; while (my ($t3, $t4) = each(%files_regional)) { if ($t4 > $time_regional) { $newestfile_regional = $t3; $time_regional = $t4; } } $time_regional = localtime($time_regional); ##### $newestfile_watch=~s/\//\\/g; $newestfile_regional=~s/\//\\/g; #replacing the "/" in the file path to "\" my @temp = split(/_/, $newestfile_regional); my $type = $temp[0]; my $date = $temp[1]; my $time = $temp[2]; my $check= "$pic_dir/radarwatch\_$date\_$time"; #check if file was created unless (-e $check) { system("\"$image_magick_exe \"$newestfile_regional\" \"$newestfile_watch\" \"$pic_dir\\radarwatch\_$date\_$time\""); print"file created\n"; } **strong text** i applogize for not writing the code any better. i also changed the [10] in the sub function to an [8], and a [9]. 8 is access time, 9 is modification time, and 10 is creation time, 10 hase been the most successful. any help is appritiatd.
0
11,650,731
07/25/2012 13:23:19
351,711
05/27/2010 07:57:33
81
3
Sql Server Full Text Index Ranking Multiple Indexes
We have several parts of our system that we have added a full text index to such as forums, news, etc. These are unrelated to each other but we have a site wide search functionality that returns results from each of these full text indexes. My question is how do I rank these to show the most relevant as the ranking scores I am getting are unrelated or is there a better way to do this? Many thanks for any help.
sql-server-2008
full-text-search
null
null
null
null
open
Sql Server Full Text Index Ranking Multiple Indexes === We have several parts of our system that we have added a full text index to such as forums, news, etc. These are unrelated to each other but we have a site wide search functionality that returns results from each of these full text indexes. My question is how do I rank these to show the most relevant as the ranking scores I am getting are unrelated or is there a better way to do this? Many thanks for any help.
0
11,650,743
07/25/2012 13:24:04
1,551,714
07/25/2012 13:08:14
1
0
IIS 7.5 difference when querying css item from localhost and externally
After 4 hours of looking through stack overflow and searching Google I've finally decided to go check in with the "hopefully" gurus... My problem is this, when querying from the local machine through remote desktop, querying for www.domainname.com/Content/Styles/reset.css i get the css fine. When doing the same from an external machine, I get a 404 error... I know why, the reason is that it's trying to get the file from: C:\inetpub\wwwroot\Content\Styles\reset.css This is kind of bad considering that the website is actually hosted at: c:\http\www.domainname.com\ The error in the browser, from IIS, gives the following information: Module IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL http://www.domainname.com:80/Content/Styles/reset.css Physical Path C:\inetpub\wwwroot\Content\Styles\reset.css Logon Method Anonymous Logon User Anonymous I've been looking at the other sites running on the IIS, and none of them point to InetPub as their directory, so I simply can't see why it's trying to get the item from this path. Calling the main application, a MVC based site running Umbraco, works fine, or rather, all the dynamic content works fine, just not static content. To give a little more information: Currently the IIS 7.5 has 4 sites and 1 ftp server running. 1 site with the following bindings: http - this 1st site host name - port 80 - ip address * https - blank host name - port 443 - ip address * 1 site with the following bindings: http - the 2nd site host name - port 80 - ip address * 1 domain with the following bindings: http - the 3rd site host name - port 80 - ip address * The actual domain http - www.domainname.com - port 80 - ip address * And finally a ftp server I hope that someone have any idea what is going on... Best regards and praying (despite being an atheist), Poul
security
iis-7.5
null
null
null
null
open
IIS 7.5 difference when querying css item from localhost and externally === After 4 hours of looking through stack overflow and searching Google I've finally decided to go check in with the "hopefully" gurus... My problem is this, when querying from the local machine through remote desktop, querying for www.domainname.com/Content/Styles/reset.css i get the css fine. When doing the same from an external machine, I get a 404 error... I know why, the reason is that it's trying to get the file from: C:\inetpub\wwwroot\Content\Styles\reset.css This is kind of bad considering that the website is actually hosted at: c:\http\www.domainname.com\ The error in the browser, from IIS, gives the following information: Module IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL http://www.domainname.com:80/Content/Styles/reset.css Physical Path C:\inetpub\wwwroot\Content\Styles\reset.css Logon Method Anonymous Logon User Anonymous I've been looking at the other sites running on the IIS, and none of them point to InetPub as their directory, so I simply can't see why it's trying to get the item from this path. Calling the main application, a MVC based site running Umbraco, works fine, or rather, all the dynamic content works fine, just not static content. To give a little more information: Currently the IIS 7.5 has 4 sites and 1 ftp server running. 1 site with the following bindings: http - this 1st site host name - port 80 - ip address * https - blank host name - port 443 - ip address * 1 site with the following bindings: http - the 2nd site host name - port 80 - ip address * 1 domain with the following bindings: http - the 3rd site host name - port 80 - ip address * The actual domain http - www.domainname.com - port 80 - ip address * And finally a ftp server I hope that someone have any idea what is going on... Best regards and praying (despite being an atheist), Poul
0
11,650,747
07/25/2012 13:24:12
1,428,396
05/31/2012 12:30:51
13
2
unrecoverable data loss of OpenPGM on Windows 7
I recently started to try the OpenPGM out for a distribution feature, which basically needs to transfer data to multiple receivers. On testing of OpenPGM with pgm_send and pgm_recvfrom, The situation is I am sending the package between a Windows 7 computer and a Windows XP computer. They are connected directly and only to a gigabits switch.I got following problems: 1. Windows 7 does not receive any data on application layer, even though I did see data arrived from its wireshark log. 2. unrecoverable data loss, I tried to send data from a Windows 7 to Windows XP computer. Data packages arrived, but after about 10KB, unrecoverable data loss came. Data packages got lost in transfering, NAK is sent from receiver to sender, sender also received the NAK, which I can see from wireshark log. But it seems the sender does not react on the NAK, I did not see any NCF log. - I tried to introduce the speed limit, it did not work until I reduced it to 1500 bits. - I tried to introduce sleep between pgm_send, it worked when I added a sleep(500) for each 10KB. From the announcement of OpenPGM, it is stated achieve a speed of 700mb/s. So I am not sure if something is missing in my implementation. Is there any specific configuration for responding on NAK? Parameters: const int PGM_BUFFER_SIZE = 1024; const std::string PGM_MULTICAST_ADDRESS = ";224.0.12.136"; const bool USE_UDP_ENCAP_PORT = false; const int MAX_RTE = 0; const int RS_K = 0; const int RS_N = 0; const int MAX_TPDU = 1500; const int SQNS = 5* 1000 * 1000; const int USE_MULTICAST_LOOP = 0; const int MULTICAST_HOPS = 16; const int NO_ROUTER_ASSIST = 0; const int DSCP = 0x2e << 2; // const UINT32 PGM_TXW_MAX_RATE = 75 * 1000 * 1000; const int MAX_ODATA_RTE = 1*1000*1000; // mbits // const size_t RATE_KBITS_PER_SEC = 50 * 1000; // const size_t WINDOW_SIZE_IN_MSECS = 60 * 1000; // sender only const int SEND_ONLY = 1; const int SENDER_NON_BLOCKING = 0; const int AMBIENT_SPM = pgm_secs(30); // receiver only const int RECEIVE_ONLY = 1; const int PASSIVE = 0; const int PEER_EXPIRY_SECS = pgm_secs(300); const int SPMR_EXPIRY_MSECS = pgm_msecs(250); const int NAK_BO_IVL_MSECS = pgm_msecs(50); const int NAK_RPT_IVL_SECS = pgm_secs(2); const int NAK_RDATA_IVL_SECS = pgm_secs(2); const int NAK_DATA_RETRIES = 50; const int NAK_NCF_RETRIES = 50; const int RECEIVER_NON_BLOCKING = 1; Sender struct pgm_addrinfo_t* res = NULL; pgm_error_t* pgm_err = NULL; sa_family_t sa_family = AF_UNSPEC; if (!pgm_getaddrinfo( mNetwork.c_str(), NULL, &res, &pgm_err ) ) sa_family = res->ai_send_addrs[0].gsr_group.ss_family; if (!pgm_socket (&mSock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { /* Use RFC 2113 tagging for PGM Router Assist */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &m_no_router_assist, sizeof(m_no_router_assist)); pgm_drop_superuser(); /* set PGM parameters */ const int m_heartbeat_spm[] = { pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (1300), pgm_secs (7), pgm_secs (16), pgm_secs (25), pgm_secs (30) }; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_ONLY, &m_send_only, sizeof(m_send_only)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MTU, &mMaxTpDu, sizeof(mMaxTpDu)); pgm_setsockopt( mSock, IPPROTO_PGM, PGM_ODATA_MAX_RTE, &mMaxODataRTE, sizeof( mMaxODataRTE ) ); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TXW_SQNS, &mSqns, sizeof(mSqns)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &mMaxRte, sizeof(mMaxRte)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_AMBIENT_SPM, &m_ambient_spm, sizeof(m_ambient_spm)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &m_heartbeat_spm, sizeof(m_heartbeat_spm)); if (mUseFec) { struct pgm_fecinfo_t fecinfo; fecinfo.block_size = mRsN; fecinfo.proactive_packets = 0; fecinfo.group_size = mRsK; fecinfo.ondemand_parity_enabled = TRUE; fecinfo.var_pktlen_enabled = TRUE; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo)); } /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = mPort ? mPort : DEFAULT_DATA_DESTINATION_PORT; addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { } /* assign socket to specified address */ struct pgm_interface_req_t if_req; memset (&if_req, 0, sizeof(if_req)); if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface; if_req.ir_scope_id = 0; if (!pgm_bind3 (mSock, &addr, sizeof(addr), &if_req, sizeof(if_req), /* tx interface */ &if_req, sizeof(if_req), /* rx interface */ &pgm_err)) /* join IP multicast groups */ unsigned i; for (i = 0; i < res->ai_recv_addrs_len; i++) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req)); pgm_freeaddrinfo (res); /* set IP parameters */ const int multicast_loop = mUseMulticastLoop ? 1 : 0; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &m_multicast_hops, sizeof(m_multicast_hops)); if (AF_INET6 != sa_family) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TOS, &m_dscp, sizeof(m_dscp)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NOBLOCK, &m_nonblocking, sizeof(m_nonblocking)); if (!pgm_connect (mSock, &pgm_err)) { } status = pgm_send (mSock, buffer, readResult, NULL); if (PGM_IO_STATUS_NORMAL != status) Receiver: struct pgm_addrinfo_t* res = NULL; pgm_error_t* pgm_err = NULL; sa_family_t sa_family = AF_UNSPEC; /* parse network parameter into PGM socket address structure */ if (!pgm_getaddrinfo (mNetwork.c_str(), NULL, &res, &pgm_err)) { sa_family = res->ai_send_addrs[0].gsr_group.ss_family; { puts ("Create PGM/IP socket."); if (!pgm_socket (&mSock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message); goto err_abort; } } /* Use RFC 2113 tagging for PGM Router Assist */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &m_no_router_assist, sizeof(m_no_router_assist)); pgm_drop_superuser(); /* set PGM parameters */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_RECV_ONLY, &m_recv_only, sizeof(m_recv_only)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_PASSIVE, &m_passive, sizeof(m_passive)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MTU, &mMaxTpDu, sizeof(mMaxTpDu)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_RXW_SQNS, &mSqns, sizeof(mSqns)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_PEER_EXPIRY, &m_peer_expiry, sizeof(m_peer_expiry)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &m_spmr_expiry, sizeof(m_spmr_expiry)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_BO_IVL, &m_nak_bo_ivl, sizeof(m_nak_bo_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &m_nak_rpt_ivl, sizeof(m_nak_rpt_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &m_nak_rdata_ivl, sizeof(m_nak_rdata_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &m_nak_data_retries, sizeof(m_nak_data_retries)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &m_nak_ncf_retries, sizeof(m_nak_ncf_retries)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_ODATA_MAX_RTE, &m_odata_max_rate, sizeof(m_odata_max_rate)); /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = mPort ? mPort : DEFAULT_DATA_DESTINATION_PORT; addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { } /* assign socket to specified address */ struct pgm_interface_req_t if_req; memset (&if_req, 0, sizeof(if_req)); if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface; if_req.ir_scope_id = 0; if (!pgm_bind3 (mSock, &addr, sizeof(addr), &if_req, sizeof(if_req), /* tx interface */ &if_req, sizeof(if_req), /* rx interface */ &pgm_err)) /* join IP multicast groups */ for (unsigned i = 0; i < res->ai_recv_addrs_len; i++) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req)); pgm_freeaddrinfo (res); /* set IP parameters */ const int multicast_loop = mUseMulticastLoop ? 1 : 0; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &m_multicast_hops, sizeof(m_multicast_hops)); if (AF_INET6 != sa_family) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TOS, &m_dscp, sizeof(m_dscp)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NOBLOCK, &m_nonblocking, sizeof(m_nonblocking)); if (!pgm_connect (mSock, &pgm_err)) { } pgm_getsockopt (mSock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen); WSAEventSelect (recv_sock, waitEvents[1], FD_READ); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen); WSAEventSelect (pending_sock, waitEvents[2], FD_READ); const int status = pgm_recvfrom (mSock, buffer, PGM_BUFFER_SIZE, 0, &len, &from, &fromlen, &pgm_err); switch (status) { case PGM_IO_STATUS_NORMAL: onData (buffer, len, &from); break; case PGM_IO_STATUS_TIMER_PENDING: { socklen_t optlen = sizeof (tv); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen); } // fall through case PGM_IO_STATUS_WOULD_BLOCK: /* select for next event */ dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE); switch (dwEvents) { case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break; case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break; default: break; } break; case PGM_IO_STATUS_RATE_LIMITED: { socklen_t optlen = sizeof (tv); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen); } default: printf("status: %d\n", status); if (pgm_err) { fprintf (stderr, "%s\n", pgm_err->message); pgm_error_free (pgm_err); pgm_err = NULL; } if (PGM_IO_STATUS_ERROR == status) break; }
c++
multicast
pgm
null
null
null
open
unrecoverable data loss of OpenPGM on Windows 7 === I recently started to try the OpenPGM out for a distribution feature, which basically needs to transfer data to multiple receivers. On testing of OpenPGM with pgm_send and pgm_recvfrom, The situation is I am sending the package between a Windows 7 computer and a Windows XP computer. They are connected directly and only to a gigabits switch.I got following problems: 1. Windows 7 does not receive any data on application layer, even though I did see data arrived from its wireshark log. 2. unrecoverable data loss, I tried to send data from a Windows 7 to Windows XP computer. Data packages arrived, but after about 10KB, unrecoverable data loss came. Data packages got lost in transfering, NAK is sent from receiver to sender, sender also received the NAK, which I can see from wireshark log. But it seems the sender does not react on the NAK, I did not see any NCF log. - I tried to introduce the speed limit, it did not work until I reduced it to 1500 bits. - I tried to introduce sleep between pgm_send, it worked when I added a sleep(500) for each 10KB. From the announcement of OpenPGM, it is stated achieve a speed of 700mb/s. So I am not sure if something is missing in my implementation. Is there any specific configuration for responding on NAK? Parameters: const int PGM_BUFFER_SIZE = 1024; const std::string PGM_MULTICAST_ADDRESS = ";224.0.12.136"; const bool USE_UDP_ENCAP_PORT = false; const int MAX_RTE = 0; const int RS_K = 0; const int RS_N = 0; const int MAX_TPDU = 1500; const int SQNS = 5* 1000 * 1000; const int USE_MULTICAST_LOOP = 0; const int MULTICAST_HOPS = 16; const int NO_ROUTER_ASSIST = 0; const int DSCP = 0x2e << 2; // const UINT32 PGM_TXW_MAX_RATE = 75 * 1000 * 1000; const int MAX_ODATA_RTE = 1*1000*1000; // mbits // const size_t RATE_KBITS_PER_SEC = 50 * 1000; // const size_t WINDOW_SIZE_IN_MSECS = 60 * 1000; // sender only const int SEND_ONLY = 1; const int SENDER_NON_BLOCKING = 0; const int AMBIENT_SPM = pgm_secs(30); // receiver only const int RECEIVE_ONLY = 1; const int PASSIVE = 0; const int PEER_EXPIRY_SECS = pgm_secs(300); const int SPMR_EXPIRY_MSECS = pgm_msecs(250); const int NAK_BO_IVL_MSECS = pgm_msecs(50); const int NAK_RPT_IVL_SECS = pgm_secs(2); const int NAK_RDATA_IVL_SECS = pgm_secs(2); const int NAK_DATA_RETRIES = 50; const int NAK_NCF_RETRIES = 50; const int RECEIVER_NON_BLOCKING = 1; Sender struct pgm_addrinfo_t* res = NULL; pgm_error_t* pgm_err = NULL; sa_family_t sa_family = AF_UNSPEC; if (!pgm_getaddrinfo( mNetwork.c_str(), NULL, &res, &pgm_err ) ) sa_family = res->ai_send_addrs[0].gsr_group.ss_family; if (!pgm_socket (&mSock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { /* Use RFC 2113 tagging for PGM Router Assist */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &m_no_router_assist, sizeof(m_no_router_assist)); pgm_drop_superuser(); /* set PGM parameters */ const int m_heartbeat_spm[] = { pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (100), pgm_msecs (1300), pgm_secs (7), pgm_secs (16), pgm_secs (25), pgm_secs (30) }; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_ONLY, &m_send_only, sizeof(m_send_only)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MTU, &mMaxTpDu, sizeof(mMaxTpDu)); pgm_setsockopt( mSock, IPPROTO_PGM, PGM_ODATA_MAX_RTE, &mMaxODataRTE, sizeof( mMaxODataRTE ) ); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TXW_SQNS, &mSqns, sizeof(mSqns)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TXW_MAX_RTE, &mMaxRte, sizeof(mMaxRte)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_AMBIENT_SPM, &m_ambient_spm, sizeof(m_ambient_spm)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_HEARTBEAT_SPM, &m_heartbeat_spm, sizeof(m_heartbeat_spm)); if (mUseFec) { struct pgm_fecinfo_t fecinfo; fecinfo.block_size = mRsN; fecinfo.proactive_packets = 0; fecinfo.group_size = mRsK; fecinfo.ondemand_parity_enabled = TRUE; fecinfo.var_pktlen_enabled = TRUE; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_USE_FEC, &fecinfo, sizeof(fecinfo)); } /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = mPort ? mPort : DEFAULT_DATA_DESTINATION_PORT; addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { } /* assign socket to specified address */ struct pgm_interface_req_t if_req; memset (&if_req, 0, sizeof(if_req)); if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface; if_req.ir_scope_id = 0; if (!pgm_bind3 (mSock, &addr, sizeof(addr), &if_req, sizeof(if_req), /* tx interface */ &if_req, sizeof(if_req), /* rx interface */ &pgm_err)) /* join IP multicast groups */ unsigned i; for (i = 0; i < res->ai_recv_addrs_len; i++) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req)); pgm_freeaddrinfo (res); /* set IP parameters */ const int multicast_loop = mUseMulticastLoop ? 1 : 0; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &m_multicast_hops, sizeof(m_multicast_hops)); if (AF_INET6 != sa_family) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TOS, &m_dscp, sizeof(m_dscp)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NOBLOCK, &m_nonblocking, sizeof(m_nonblocking)); if (!pgm_connect (mSock, &pgm_err)) { } status = pgm_send (mSock, buffer, readResult, NULL); if (PGM_IO_STATUS_NORMAL != status) Receiver: struct pgm_addrinfo_t* res = NULL; pgm_error_t* pgm_err = NULL; sa_family_t sa_family = AF_UNSPEC; /* parse network parameter into PGM socket address structure */ if (!pgm_getaddrinfo (mNetwork.c_str(), NULL, &res, &pgm_err)) { sa_family = res->ai_send_addrs[0].gsr_group.ss_family; { puts ("Create PGM/IP socket."); if (!pgm_socket (&mSock, sa_family, SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { fprintf (stderr, "Creating PGM/IP socket: %s\n", pgm_err->message); goto err_abort; } } /* Use RFC 2113 tagging for PGM Router Assist */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_IP_ROUTER_ALERT, &m_no_router_assist, sizeof(m_no_router_assist)); pgm_drop_superuser(); /* set PGM parameters */ pgm_setsockopt (mSock, IPPROTO_PGM, PGM_RECV_ONLY, &m_recv_only, sizeof(m_recv_only)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_PASSIVE, &m_passive, sizeof(m_passive)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MTU, &mMaxTpDu, sizeof(mMaxTpDu)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_RXW_SQNS, &mSqns, sizeof(mSqns)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_PEER_EXPIRY, &m_peer_expiry, sizeof(m_peer_expiry)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SPMR_EXPIRY, &m_spmr_expiry, sizeof(m_spmr_expiry)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_BO_IVL, &m_nak_bo_ivl, sizeof(m_nak_bo_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_RPT_IVL, &m_nak_rpt_ivl, sizeof(m_nak_rpt_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_RDATA_IVL, &m_nak_rdata_ivl, sizeof(m_nak_rdata_ivl)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_DATA_RETRIES, &m_nak_data_retries, sizeof(m_nak_data_retries)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NAK_NCF_RETRIES, &m_nak_ncf_retries, sizeof(m_nak_ncf_retries)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_ODATA_MAX_RTE, &m_odata_max_rate, sizeof(m_odata_max_rate)); /* create global session identifier */ struct pgm_sockaddr_t addr; memset (&addr, 0, sizeof(addr)); addr.sa_port = mPort ? mPort : DEFAULT_DATA_DESTINATION_PORT; addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT; if (!pgm_gsi_create_from_hostname (&addr.sa_addr.gsi, &pgm_err)) { } /* assign socket to specified address */ struct pgm_interface_req_t if_req; memset (&if_req, 0, sizeof(if_req)); if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface; if_req.ir_scope_id = 0; if (!pgm_bind3 (mSock, &addr, sizeof(addr), &if_req, sizeof(if_req), /* tx interface */ &if_req, sizeof(if_req), /* rx interface */ &pgm_err)) /* join IP multicast groups */ for (unsigned i = 0; i < res->ai_recv_addrs_len; i++) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_JOIN_GROUP, &res->ai_recv_addrs[i], sizeof(struct group_req)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_SEND_GROUP, &res->ai_send_addrs[0], sizeof(struct group_req)); pgm_freeaddrinfo (res); /* set IP parameters */ const int multicast_loop = mUseMulticastLoop ? 1 : 0; pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_MULTICAST_HOPS, &m_multicast_hops, sizeof(m_multicast_hops)); if (AF_INET6 != sa_family) pgm_setsockopt (mSock, IPPROTO_PGM, PGM_TOS, &m_dscp, sizeof(m_dscp)); pgm_setsockopt (mSock, IPPROTO_PGM, PGM_NOBLOCK, &m_nonblocking, sizeof(m_nonblocking)); if (!pgm_connect (mSock, &pgm_err)) { } pgm_getsockopt (mSock, IPPROTO_PGM, PGM_RECV_SOCK, &recv_sock, &socklen); WSAEventSelect (recv_sock, waitEvents[1], FD_READ); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_PENDING_SOCK, &pending_sock, &socklen); WSAEventSelect (pending_sock, waitEvents[2], FD_READ); const int status = pgm_recvfrom (mSock, buffer, PGM_BUFFER_SIZE, 0, &len, &from, &fromlen, &pgm_err); switch (status) { case PGM_IO_STATUS_NORMAL: onData (buffer, len, &from); break; case PGM_IO_STATUS_TIMER_PENDING: { socklen_t optlen = sizeof (tv); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen); } // fall through case PGM_IO_STATUS_WOULD_BLOCK: /* select for next event */ dwTimeout = PGM_IO_STATUS_WOULD_BLOCK == status ? WSA_INFINITE : (DWORD)((tv.tv_sec * 1000) + (tv.tv_usec / 1000)); dwEvents = WSAWaitForMultipleEvents (cEvents, waitEvents, FALSE, dwTimeout, FALSE); switch (dwEvents) { case WSA_WAIT_EVENT_0+1: WSAResetEvent (waitEvents[1]); break; case WSA_WAIT_EVENT_0+2: WSAResetEvent (waitEvents[2]); break; default: break; } break; case PGM_IO_STATUS_RATE_LIMITED: { socklen_t optlen = sizeof (tv); pgm_getsockopt (mSock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen); } default: printf("status: %d\n", status); if (pgm_err) { fprintf (stderr, "%s\n", pgm_err->message); pgm_error_free (pgm_err); pgm_err = NULL; } if (PGM_IO_STATUS_ERROR == status) break; }
0
11,472,062
07/13/2012 14:03:56
242,933
01/04/2010 02:28:02
8,132
197
Extract Build Identifier from Crash Report?
[Technical Q&A QA1765 : How to Match a Crash Report to a Build][1] explains how to "Find the Build Identifier in a Crash Report" using `grep`. $ grep -A=1 "Binary Images:" Example.crash Binary Images: 0xb6000 - 0xb7fff +Example armv7 <270a9b9d7a333a4a9f1aaf8186f81394> /var/mobile/Applications/28D4F177-D312-4D3B-A76C-C2ACB4CB7DAD/Example.app/Example But, what's the best way to extract just the build identifier: `270a9b9d7a333a4a9f1aaf8186f81394`? [1]: http://developer.apple.com/library/ios/#qa/qa1765/_index.html
xcode
crash-reports
build-identifier
null
null
null
open
Extract Build Identifier from Crash Report? === [Technical Q&A QA1765 : How to Match a Crash Report to a Build][1] explains how to "Find the Build Identifier in a Crash Report" using `grep`. $ grep -A=1 "Binary Images:" Example.crash Binary Images: 0xb6000 - 0xb7fff +Example armv7 <270a9b9d7a333a4a9f1aaf8186f81394> /var/mobile/Applications/28D4F177-D312-4D3B-A76C-C2ACB4CB7DAD/Example.app/Example But, what's the best way to extract just the build identifier: `270a9b9d7a333a4a9f1aaf8186f81394`? [1]: http://developer.apple.com/library/ios/#qa/qa1765/_index.html
0
11,472,091
07/13/2012 14:06:24
1,041,336
11/11/2011 08:40:19
431
20
default_searchable on Android ICS
My application declares an activity as the default searchable for the application: <application ... > <meta-data android:name="android.app.default_searchable" android:value=".SearchActivity" /> Thus on pre-ICS the application search can be initiated for the complete application via the search key. However On ICS devices there's no search key. So what's the recommended solution to offer application search on ICS devices? Do I have to add a search action to my actionbar (using ABS), possibly hiding it on devices which have a search button? How do I know whether the device has a search button? Thanks
android
null
null
null
null
null
open
default_searchable on Android ICS === My application declares an activity as the default searchable for the application: <application ... > <meta-data android:name="android.app.default_searchable" android:value=".SearchActivity" /> Thus on pre-ICS the application search can be initiated for the complete application via the search key. However On ICS devices there's no search key. So what's the recommended solution to offer application search on ICS devices? Do I have to add a search action to my actionbar (using ABS), possibly hiding it on devices which have a search button? How do I know whether the device has a search button? Thanks
0
11,472,093
07/13/2012 14:06:28
1,451,662
06/12/2012 15:48:36
48
5
Git Aptana integration in remote file explorer
Aptana provides Git integrations (Right click > Team) only if a git project is checked out into my local filesystem. This doesn't happen if I am working on a Git repository hosted on a remote server.. I know it is less than ideal to work on a remote repository but is there a way to have Aptana recognize remote git repositories and have the git commands enabled for them as well?
git
aptana
null
null
null
null
open
Git Aptana integration in remote file explorer === Aptana provides Git integrations (Right click > Team) only if a git project is checked out into my local filesystem. This doesn't happen if I am working on a Git repository hosted on a remote server.. I know it is less than ideal to work on a remote repository but is there a way to have Aptana recognize remote git repositories and have the git commands enabled for them as well?
0
11,472,100
07/13/2012 14:06:39
279,966
02/24/2010 00:42:09
2,345
213
ajax response from node
I'm calling a node'js process to scrape twitter and create a graph from the data... here's the code. var http = require('http'); var url = require('url'); var exec = require('child_process').exec; var fs = require('fs'); var filepath = 'filenamegraph.png'; http.createServer(function(req,res){ var urlstr = url.parse(req.url,true); var twit = exec("php -f twitter-scraper.php "+urlstr.query.term ,function(error, stdout, stderr){ var graphstring = stdout; var stream = fs.createWriteStream("graph.txt"); stream.once('open', function(fd){ stream.write(graphstring, function(){ exec('dot -T png -o filenamegraph.png graph.txt', function(){ fs.stat(filepath,function(err,stat){ res.writeHead(200,{'Content-Type':'image/png', 'Content-Length': stat.size }); fs.readFile(filepath,function(err,file_conts){ res.write(file_conts); res.end(); }); }); }); }); }); }); }).listen(1337); all thats is hunky dory... now I call this with: $.ajax({ url: 'http://eavesdropper.dev:1337', data: { term : $.url.parse().params.term }, success: function(data) { var res = $.parseJSON(data); console.log(res); $("body").append('<img src="filenamegraph.png" />'); }, error: function(jqXHR, textStatus, errorThrown) { console.log(jqXHR,'errror - ' + textStatus + " - " + errorThrown + ' ||'); }, complete: function(jqXHR, textStatus){ console.log(jqXHR, textStatus) } }); the work behind the scenes is fine BUT i get this... Object { readyState=0, status=0, statusText="error"} error - error - || Not sure what next step is so any tips muchly appreciated.
node.js
jquery-ajax
null
null
null
null
open
ajax response from node === I'm calling a node'js process to scrape twitter and create a graph from the data... here's the code. var http = require('http'); var url = require('url'); var exec = require('child_process').exec; var fs = require('fs'); var filepath = 'filenamegraph.png'; http.createServer(function(req,res){ var urlstr = url.parse(req.url,true); var twit = exec("php -f twitter-scraper.php "+urlstr.query.term ,function(error, stdout, stderr){ var graphstring = stdout; var stream = fs.createWriteStream("graph.txt"); stream.once('open', function(fd){ stream.write(graphstring, function(){ exec('dot -T png -o filenamegraph.png graph.txt', function(){ fs.stat(filepath,function(err,stat){ res.writeHead(200,{'Content-Type':'image/png', 'Content-Length': stat.size }); fs.readFile(filepath,function(err,file_conts){ res.write(file_conts); res.end(); }); }); }); }); }); }); }).listen(1337); all thats is hunky dory... now I call this with: $.ajax({ url: 'http://eavesdropper.dev:1337', data: { term : $.url.parse().params.term }, success: function(data) { var res = $.parseJSON(data); console.log(res); $("body").append('<img src="filenamegraph.png" />'); }, error: function(jqXHR, textStatus, errorThrown) { console.log(jqXHR,'errror - ' + textStatus + " - " + errorThrown + ' ||'); }, complete: function(jqXHR, textStatus){ console.log(jqXHR, textStatus) } }); the work behind the scenes is fine BUT i get this... Object { readyState=0, status=0, statusText="error"} error - error - || Not sure what next step is so any tips muchly appreciated.
0
11,472,102
07/13/2012 14:06:43
781,182
06/02/2011 13:22:29
17
5
Inserting GWT widget into a div element
I'm using a GWT library (gwt-openlayers) which allows me to create a map popup containing arbitrary HTML, similar to Google Maps. I need this HTML to contain a GWT Button widget. I'm creating some HTML elements on-the-fly like this: Element outerDiv = DOM.createDiv(); outerDiv.getStyle().setOverflow(Overflow.HIDDEN); outerDiv.getStyle().setWidth(100, Unit.PCT); outerDiv.appendChild(new HTML(mapPOI.getHtmlDetails()).getElement()); Button popupButton = new Button("View Property"); popupButton.getElement().getStyle().setFloat(com.google.gwt.dom.client.Style.Float.RIGHT); outerDiv.appendChild(popupButton.getElement()); Then I'm getting the source HTML for these elements by calling String src = outerDiv.toString(); and inserting this html into my map marker. Now my map marker displays the content ok, including the button. However, the button won't respond to any events! From what I can gather, this is because the buttons onAttach() method is never being called. Is there a better way to do this? Thanks, Jon
html
gwt
div
null
null
null
open
Inserting GWT widget into a div element === I'm using a GWT library (gwt-openlayers) which allows me to create a map popup containing arbitrary HTML, similar to Google Maps. I need this HTML to contain a GWT Button widget. I'm creating some HTML elements on-the-fly like this: Element outerDiv = DOM.createDiv(); outerDiv.getStyle().setOverflow(Overflow.HIDDEN); outerDiv.getStyle().setWidth(100, Unit.PCT); outerDiv.appendChild(new HTML(mapPOI.getHtmlDetails()).getElement()); Button popupButton = new Button("View Property"); popupButton.getElement().getStyle().setFloat(com.google.gwt.dom.client.Style.Float.RIGHT); outerDiv.appendChild(popupButton.getElement()); Then I'm getting the source HTML for these elements by calling String src = outerDiv.toString(); and inserting this html into my map marker. Now my map marker displays the content ok, including the button. However, the button won't respond to any events! From what I can gather, this is because the buttons onAttach() method is never being called. Is there a better way to do this? Thanks, Jon
0
11,472,103
07/13/2012 14:06:44
1,170,730
01/26/2012 06:34:08
11
0
Website-scraping , robot-identification
Are there websites which identify it as a script that is accessing it , inspite of changing the User-Agent headers which I assume is like this and gives an error. import urllib,urllib2 req_headers = {'User-Agent':'Mozilla/5.0'} req = urllib2.Request(url,headers = req_headers) html = req.open(url) If yes , then how?
python
authentication
urllib
null
null
null
open
Website-scraping , robot-identification === Are there websites which identify it as a script that is accessing it , inspite of changing the User-Agent headers which I assume is like this and gives an error. import urllib,urllib2 req_headers = {'User-Agent':'Mozilla/5.0'} req = urllib2.Request(url,headers = req_headers) html = req.open(url) If yes , then how?
0
11,472,110
07/13/2012 14:07:06
1,238,894
02/28/2012 21:40:51
28
0
How to expand child <div> with 100% of body width?
I have something like this: <body> <div style="width:700px; margin:0 auto;"> <div class="inner-div"></div> </div> </body> Is there a way to expand child div with class "inner-div", to 100% of body width?
javascript
html
css
html5
css3
null
open
How to expand child <div> with 100% of body width? === I have something like this: <body> <div style="width:700px; margin:0 auto;"> <div class="inner-div"></div> </div> </body> Is there a way to expand child div with class "inner-div", to 100% of body width?
0
1,919,448
12/17/2009 04:23:11
208,582
11/11/2009 10:49:05
3
0
Hi! Look at this Code.
these are two record which exist in table. ibrahim_balouch ibrahim.tasal I want to send mail to ibrahim.tasal. is it correct? string user2 = dt1.Rows[1].ItemArray[0].ToString(); mail.Cc = dt1.Rows[1].ItemArray[0].ToString() + "@Roshan.af";
c#
null
null
null
null
null
open
Hi! Look at this Code. === these are two record which exist in table. ibrahim_balouch ibrahim.tasal I want to send mail to ibrahim.tasal. is it correct? string user2 = dt1.Rows[1].ItemArray[0].ToString(); mail.Cc = dt1.Rows[1].ItemArray[0].ToString() + "@Roshan.af";
0
1,919,449
12/17/2009 04:23:17
113,247
05/27/2009 15:31:29
303
0
Copy from search mode to ex mode
While in the "`/`" mode to search, what should I do if need to copy it to the ex mode. E.g. I searched for `/sa.*th`, now I need it as `%s/sa.*th/.../g`. My intention is to test my search and then use that for a search replace
vim
command
copy
null
null
null
open
Copy from search mode to ex mode === While in the "`/`" mode to search, what should I do if need to copy it to the ex mode. E.g. I searched for `/sa.*th`, now I need it as `%s/sa.*th/.../g`. My intention is to test my search and then use that for a search replace
0
11,472,117
07/13/2012 14:07:23
913,336
08/26/2011 04:14:52
33
0
Draw a bitmap tiled across a Rect android
I am attempting to draw a bitmap along a rectangle, but I am not sure how to go about it. Is there a way to tile a bitmap along a Rect object using a paint property or something? I have looked, but I can't find anything that makes it do what I need it too, most of the tiling options won't tile it for a specific instance, they tile it along the entire screen, so everything using that bitmap ends up having one big bitmap tiling along all of them at the same time, without scrolling or anything. Any ideas? If you need more info let me know, its kind of a weird question so I know I probably didn't mention something important. William
android
bitmap
rect
null
null
null
open
Draw a bitmap tiled across a Rect android === I am attempting to draw a bitmap along a rectangle, but I am not sure how to go about it. Is there a way to tile a bitmap along a Rect object using a paint property or something? I have looked, but I can't find anything that makes it do what I need it too, most of the tiling options won't tile it for a specific instance, they tile it along the entire screen, so everything using that bitmap ends up having one big bitmap tiling along all of them at the same time, without scrolling or anything. Any ideas? If you need more info let me know, its kind of a weird question so I know I probably didn't mention something important. William
0
11,499,893
07/16/2012 07:32:45
77,121
03/12/2009 09:39:03
277
10
How to properly read columns from text file
Im trying to read data from a text file and loading it into a dataset but the different columns as in the image below are coming as just one long column. I want to return the data as 7 columns (in the same way as its appearing in the image below). This is the code am using, public DataSet LoadTxtFile(int numberOfRows) { DataSet ds = new DataSet(); //try //{ // Creates and opens an ODBC connection string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + this.dirCSV.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"; string sql_select; OdbcConnection conn; conn = new OdbcConnection(strConnString.Trim()); conn.Open(); //Creates the select command text if (numberOfRows == -1) { sql_select = "select * from [" + this.FileNevCSV.Trim() + "]"; } else { sql_select = "select top " + numberOfRows + " * from [" + this.FileNevCSV.Trim() + "]"; } //Creates the data adapter OdbcDataAdapter obj_oledb_da = new OdbcDataAdapter(sql_select, conn); //Fills dataset with the records from CSV file obj_oledb_da.Fill(ds, "csv"); //closes the connection conn.Close(); //} //catch (Exception e) //Error //{ //MessageBox.Show(e.Message, "Error - LoadCSV",MessageBoxButtons.OK,MessageBoxIcon.Error); //} return ds; } ![Text File Sample Data][1] [1]: http://i.stack.imgur.com/pjtbx.png
csv
text-files
null
null
null
null
open
How to properly read columns from text file === Im trying to read data from a text file and loading it into a dataset but the different columns as in the image below are coming as just one long column. I want to return the data as 7 columns (in the same way as its appearing in the image below). This is the code am using, public DataSet LoadTxtFile(int numberOfRows) { DataSet ds = new DataSet(); //try //{ // Creates and opens an ODBC connection string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + this.dirCSV.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"; string sql_select; OdbcConnection conn; conn = new OdbcConnection(strConnString.Trim()); conn.Open(); //Creates the select command text if (numberOfRows == -1) { sql_select = "select * from [" + this.FileNevCSV.Trim() + "]"; } else { sql_select = "select top " + numberOfRows + " * from [" + this.FileNevCSV.Trim() + "]"; } //Creates the data adapter OdbcDataAdapter obj_oledb_da = new OdbcDataAdapter(sql_select, conn); //Fills dataset with the records from CSV file obj_oledb_da.Fill(ds, "csv"); //closes the connection conn.Close(); //} //catch (Exception e) //Error //{ //MessageBox.Show(e.Message, "Error - LoadCSV",MessageBoxButtons.OK,MessageBoxIcon.Error); //} return ds; } ![Text File Sample Data][1] [1]: http://i.stack.imgur.com/pjtbx.png
0
11,499,902
07/16/2012 07:33:08
1,436,685
06/05/2012 06:46:17
16
0
Type directly in notepad using windows form c#
I created a numeric keyboard using windows form in c#. Now i want to use it writing on a notepad or in microsoft word. How can i do it??
c#
winforms
notepad
null
null
07/16/2012 19:00:47
not a real question
Type directly in notepad using windows form c# === I created a numeric keyboard using windows form in c#. Now i want to use it writing on a notepad or in microsoft word. How can i do it??
1
11,499,076
07/16/2012 06:28:01
645,924
11/27/2010 20:01:40
714
3
do I have to pay for google maps license if I show markers on the map specific to the loged in user
I log in the user in my app and after this I display his position and other information relevant to this user. However, I allow the map to be visible with some markers even before the user logs in. When the user logs in, I just display some more specifi markers. Can I do this free, Or do I have to pay the $10K+ license?
google
maps
null
null
null
null
open
do I have to pay for google maps license if I show markers on the map specific to the loged in user === I log in the user in my app and after this I display his position and other information relevant to this user. However, I allow the map to be visible with some markers even before the user logs in. When the user logs in, I just display some more specifi markers. Can I do this free, Or do I have to pay the $10K+ license?
0
11,499,077
07/16/2012 06:28:15
1,528,050
07/16/2012 06:21:15
1
0
Oracel 10 g -SQL
How to find top 2 salaries in each department in emp table? Emp Table ----------- Row_id Salary Dept R1 2000 D1 R2 3000 D1 R3 4000 D1 R4 5000 D1 R5 2000 D2 R6 3000 D2 R7 4000 D2 R8 5000 D2
sql
oracle
oracle10g
null
null
null
open
Oracel 10 g -SQL === How to find top 2 salaries in each department in emp table? Emp Table ----------- Row_id Salary Dept R1 2000 D1 R2 3000 D1 R3 4000 D1 R4 5000 D1 R5 2000 D2 R6 3000 D2 R7 4000 D2 R8 5000 D2
0
11,499,908
07/16/2012 07:33:52
1,298,059
03/28/2012 11:43:02
77
10
action object overwrite by component last object in symfony 1.0
I am working on project which is in symfony 1.0 I have created result set in action file as follows $perform = new Criteria(); $perform->clearSelectColumns(); $perform->addSelectColumn(ProductionPeer::PREVIEW_DATE); $perform->addSelectColumn(ProductionPeer::OPENED); $perform->addSelectColumn(ProductionPeer::CLOSED); $perform->addSelectColumn(ProductionPeer::PERFORMANCES); $perform->addSelectColumn(VenuePeer::NAME); $perform->addJoin(ProductionPeer::VENUE_ID, VenuePeer::ID, Criteria::LEFT_JOIN); $perform->add(ProductionPeer::TITLE_ID,3); $this->performRsCnt = ProductionPeer::doCount($perform); if($this->performRsCnt > 0) { $this->performRs = ProductionPeer::doSelectRS($perform); $this->performRs->setFetchmode(ResultSet::FETCHMODE_ASSOC); } when I print_r($this->performRs) in action itself then it gives desired output Now the problem is I have created one pratial file which is included in success file and in partial file there is component included within partial file. when I print my action object i.e. $performRs before include code for component then it gives desired output but when i print after include code then it overwrite by last result set which is in component below is sample code for component component file code class defaultComponents extends sfComponents { public function executeMediaDetail() { $mediaHardeep = new Criteria(); $mediaHardeep->addSelectColumn(PhotosPeer::PHOTO); $mediaHardeep->addSelectColumn(PhotosConcernsPeer::PHOTOS_ID); $mediaHardeep->addJoin(PhotosConcernsPeer::PHOTOS_ID, PhotosPeer::ID, Criteria::LEFT_JOIN); $mediaHardeep->add(PhotosConcernsPeer::REF_ID, $this->ref_id); $mediaHardeep->add(PhotosConcernsPeer::TYPE, $this->type); $imgRsCntHardeep = PhotosConcernsPeer::doCount($mediaHardeep); } } component include code in partial <?php print_r($performRs);?> //desired output <!-- start media section --> <?php include_component('default', 'mediaDetail',array('ref_id' => $titleData['ID'], 'type' => 'title','abc123'=>$abcRs));?> <!-- end media section --> <?php print_r($performRs);?> //gives the output of $imgRsCntHardeep which is in component I have checked my code multiple times and I assure that code does not contain any type of errors like variable mismatch, passing variable to partial or component, using variable name multiple time. I hope I will find solution from here because I am solving this problem since saturday
php
orm
symfony
propel
null
null
open
action object overwrite by component last object in symfony 1.0 === I am working on project which is in symfony 1.0 I have created result set in action file as follows $perform = new Criteria(); $perform->clearSelectColumns(); $perform->addSelectColumn(ProductionPeer::PREVIEW_DATE); $perform->addSelectColumn(ProductionPeer::OPENED); $perform->addSelectColumn(ProductionPeer::CLOSED); $perform->addSelectColumn(ProductionPeer::PERFORMANCES); $perform->addSelectColumn(VenuePeer::NAME); $perform->addJoin(ProductionPeer::VENUE_ID, VenuePeer::ID, Criteria::LEFT_JOIN); $perform->add(ProductionPeer::TITLE_ID,3); $this->performRsCnt = ProductionPeer::doCount($perform); if($this->performRsCnt > 0) { $this->performRs = ProductionPeer::doSelectRS($perform); $this->performRs->setFetchmode(ResultSet::FETCHMODE_ASSOC); } when I print_r($this->performRs) in action itself then it gives desired output Now the problem is I have created one pratial file which is included in success file and in partial file there is component included within partial file. when I print my action object i.e. $performRs before include code for component then it gives desired output but when i print after include code then it overwrite by last result set which is in component below is sample code for component component file code class defaultComponents extends sfComponents { public function executeMediaDetail() { $mediaHardeep = new Criteria(); $mediaHardeep->addSelectColumn(PhotosPeer::PHOTO); $mediaHardeep->addSelectColumn(PhotosConcernsPeer::PHOTOS_ID); $mediaHardeep->addJoin(PhotosConcernsPeer::PHOTOS_ID, PhotosPeer::ID, Criteria::LEFT_JOIN); $mediaHardeep->add(PhotosConcernsPeer::REF_ID, $this->ref_id); $mediaHardeep->add(PhotosConcernsPeer::TYPE, $this->type); $imgRsCntHardeep = PhotosConcernsPeer::doCount($mediaHardeep); } } component include code in partial <?php print_r($performRs);?> //desired output <!-- start media section --> <?php include_component('default', 'mediaDetail',array('ref_id' => $titleData['ID'], 'type' => 'title','abc123'=>$abcRs));?> <!-- end media section --> <?php print_r($performRs);?> //gives the output of $imgRsCntHardeep which is in component I have checked my code multiple times and I assure that code does not contain any type of errors like variable mismatch, passing variable to partial or component, using variable name multiple time. I hope I will find solution from here because I am solving this problem since saturday
0
11,499,914
07/16/2012 07:34:42
1,492,967
06/30/2012 12:07:31
39
1
How to move a div using a slide effect?
This code switches the visibility of frm01 $(document).ready(function() { $("#reg").click(function () { if ($("#frm01").is(":visible")) $("#frm01").hide("slide", { direction: "down" }, 1000); else $("#frm01").show("slide", { direction: "down" }, 1000); }); }); But underlying div (div bellow frm01) is moved up/down momentarily, without slide effect. I want to move it also using slide effect. Please, help.
php
javascript
effects
null
null
null
open
How to move a div using a slide effect? === This code switches the visibility of frm01 $(document).ready(function() { $("#reg").click(function () { if ($("#frm01").is(":visible")) $("#frm01").hide("slide", { direction: "down" }, 1000); else $("#frm01").show("slide", { direction: "down" }, 1000); }); }); But underlying div (div bellow frm01) is moved up/down momentarily, without slide effect. I want to move it also using slide effect. Please, help.
0
11,499,916
07/16/2012 07:34:54
1,528,167
07/16/2012 07:29:11
1
0
The Standard Price Tab is missing from my Bill of Materials
The Standard Price Tab is missing from my Bill of Materials. I am using Openerp v6.1.1.
openerp
null
null
null
null
07/16/2012 13:39:18
not a real question
The Standard Price Tab is missing from my Bill of Materials === The Standard Price Tab is missing from my Bill of Materials. I am using Openerp v6.1.1.
1
11,499,918
07/16/2012 07:34:58
1,527,902
07/16/2012 04:32:06
1
0
Reading Superscript and Subscript in excel cell using Apache POI in java
This is my first question in this portal. I am working on a Java project where there is a need to convert a printarea excel sheet to pdf table format. In that i already done the excel reading and pdf conversion using Apache POI and iText. Now, the problem is that from excel reading I am not able to get the **superscript** and **subscript** content from cell. when I getting for ex. a<sup>2</sup> it is giving the output as a2. Please help me on this. Thanks in advance.
java
apache-poi
null
null
null
null
open
Reading Superscript and Subscript in excel cell using Apache POI in java === This is my first question in this portal. I am working on a Java project where there is a need to convert a printarea excel sheet to pdf table format. In that i already done the excel reading and pdf conversion using Apache POI and iText. Now, the problem is that from excel reading I am not able to get the **superscript** and **subscript** content from cell. when I getting for ex. a<sup>2</sup> it is giving the output as a2. Please help me on this. Thanks in advance.
0
11,499,919
07/16/2012 07:35:01
1,516,551
07/11/2012 03:49:08
17
1
What is the step for sharing data in Vmware Mac OsX Guest OS in Windows Host
I am using Windos-7 And Installed Vmware WorkStation for MAC-OSX And I done it successfully now I am facing problem to share windows Folder in MAC-OSX.I am using VmWare Vesio-8.....Please help me.
windows-7
vmware
null
null
null
null
open
What is the step for sharing data in Vmware Mac OsX Guest OS in Windows Host === I am using Windos-7 And Installed Vmware WorkStation for MAC-OSX And I done it successfully now I am facing problem to share windows Folder in MAC-OSX.I am using VmWare Vesio-8.....Please help me.
0
11,373,174
07/07/2012 07:31:46
1,430,119
06/01/2012 07:22:08
41
3
BlackBerry Date Validator
Is there any easy way to validate input date in balckberry? I tried RegEx but couldn't success. Does any one have a validation method. Thanks.
validation
date
blackberry
blackberry-jde
null
null
open
BlackBerry Date Validator === Is there any easy way to validate input date in balckberry? I tried RegEx but couldn't success. Does any one have a validation method. Thanks.
0
11,373,176
07/07/2012 07:32:11
477,228
10/15/2010 17:23:17
1,417
19
Iregular plot of k-means clustering
Hi Im working on trying to cluster network data from the 1999 darpa data set. Unfortunately Im not really getting clustered data, not compared to some of the lit out there on the same technique. My data comes out like this: ![enter image description here][1] [1]: http://i.stack.imgur.com/p0pcN.jpg As you can see not very informative. Its more of a splatter. This is the code I used on the data: %% load data %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end attribNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format string used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as string frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class attribute %# read dataset fid = fopen('kddcup.data_10_percent_corrected','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal attributes to numeric ind = find(attribNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset fulldata = cell2mat(C); %% dimensionality reduction columns = 42 [U,S,V]=svds(fulldata,columns) %% randomly select dataset rows = 5000; %# pick random rows indX = randperm( size(fulldata,1) ); indX = indX(1:rows); %# pick random columns indY = randperm( size(fulldata,2) ); indY = indY(1:columns); %# filter data data = U(indX,indY) %% apply normalization method to every cell data = data./repmat(sqrt(sum(data.^2)),size(data,1),1) %% generate sample data K = 4; numObservarations = 5000; dimensions = 42; %% cluster opts = statset('MaxIter', 500, 'Display', 'iter'); [clustIDX, clusters, interClustSum, Dist] = kmeans(data, K, 'options',opts, ... 'distance','sqEuclidean', 'EmptyAction','singleton', 'replicates',3); %% plot data+clusters figure, hold on scatter3(data(:,1),data(:,2),data(:,3), 5, clustIDX, 'filled') scatter3(clusters(:,1),clusters(:,2),clusters(:,3), 100, (1:K)', 'filled') hold off, xlabel('x'), ylabel('y'), zlabel('z') %% plot clusters quality figure [silh,h] = silhouette(data, clustIDX); avrgScore = mean(silh); %% Assign data to clusters % calculate distance (squared) of all instances to each cluster centroid D = zeros(numObservarations, K); % init distances for k=1:K %d = sum((x-y).^2).^0.5 D(:,k) = sum( ((data - repmat(clusters(k,:),numObservarations,1)).^2), 2); end % find for all instances the cluster closet to it [minDists, clusterIndices] = min(D, [], 2); % compare it with what you expect it to be sum(clusterIndices == clustIDX) Anyone have an idea and solution on how I can remedy this to get more **regular** looking clusters?
matlab
plot
cluster-analysis
k-means
null
null
open
Iregular plot of k-means clustering === Hi Im working on trying to cluster network data from the 1999 darpa data set. Unfortunately Im not really getting clustered data, not compared to some of the lit out there on the same technique. My data comes out like this: ![enter image description here][1] [1]: http://i.stack.imgur.com/p0pcN.jpg As you can see not very informative. Its more of a splatter. This is the code I used on the data: %% load data %# read the list of features fid = fopen('kddcup.names','rt'); C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1); fclose(fid); %# determine type of features C{2} = regexprep(C{2}, '.$',''); %# remove "." at the end attribNom = [ismember(C{2},'symbolic');true]; %# nominal features %# build format string used to read/parse the actual data frmt = cell(1,numel(C{1})); frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number frmt( ismember(C{2},'symbolic') ) = {'%s'}; %# nominal features: read as string frmt = [frmt{:}]; frmt = [frmt '%s']; %# add the class attribute %# read dataset fid = fopen('kddcup.data_10_percent_corrected','rt'); C = textscan(fid, frmt, 'Delimiter',','); fclose(fid); %# convert nominal attributes to numeric ind = find(attribNom); G = cell(numel(ind),1); for i=1:numel(ind) [C{ind(i)},G{i}] = grp2idx( C{ind(i)} ); end %# all numeric dataset fulldata = cell2mat(C); %% dimensionality reduction columns = 42 [U,S,V]=svds(fulldata,columns) %% randomly select dataset rows = 5000; %# pick random rows indX = randperm( size(fulldata,1) ); indX = indX(1:rows); %# pick random columns indY = randperm( size(fulldata,2) ); indY = indY(1:columns); %# filter data data = U(indX,indY) %% apply normalization method to every cell data = data./repmat(sqrt(sum(data.^2)),size(data,1),1) %% generate sample data K = 4; numObservarations = 5000; dimensions = 42; %% cluster opts = statset('MaxIter', 500, 'Display', 'iter'); [clustIDX, clusters, interClustSum, Dist] = kmeans(data, K, 'options',opts, ... 'distance','sqEuclidean', 'EmptyAction','singleton', 'replicates',3); %% plot data+clusters figure, hold on scatter3(data(:,1),data(:,2),data(:,3), 5, clustIDX, 'filled') scatter3(clusters(:,1),clusters(:,2),clusters(:,3), 100, (1:K)', 'filled') hold off, xlabel('x'), ylabel('y'), zlabel('z') %% plot clusters quality figure [silh,h] = silhouette(data, clustIDX); avrgScore = mean(silh); %% Assign data to clusters % calculate distance (squared) of all instances to each cluster centroid D = zeros(numObservarations, K); % init distances for k=1:K %d = sum((x-y).^2).^0.5 D(:,k) = sum( ((data - repmat(clusters(k,:),numObservarations,1)).^2), 2); end % find for all instances the cluster closet to it [minDists, clusterIndices] = min(D, [], 2); % compare it with what you expect it to be sum(clusterIndices == clustIDX) Anyone have an idea and solution on how I can remedy this to get more **regular** looking clusters?
0
11,373,180
07/07/2012 07:32:45
1,508,394
07/07/2012 07:20:12
1
0
Ruby yield newbie issue
I have recently started using Ruby, so quite new to this. My current objective is to use a ruby module called retort, my problem is that I don't understand the configure method which is looking like this: def configure config = Config.new yield config @@service = XMLRPC::Client.new2(config.url) end Config class is simple and looks like: class Config attr_accessor :url end I tried to create a small example to play around in order to understand how exactly that is supposed to work: class TestClass def test_method config = String.new yield config p config end end d = TestClass.new d.test_method { 'test string' } Of course it doesn't return 'test string' but an empty string. Thank you for any help :)
ruby
yield
null
null
null
null
open
Ruby yield newbie issue === I have recently started using Ruby, so quite new to this. My current objective is to use a ruby module called retort, my problem is that I don't understand the configure method which is looking like this: def configure config = Config.new yield config @@service = XMLRPC::Client.new2(config.url) end Config class is simple and looks like: class Config attr_accessor :url end I tried to create a small example to play around in order to understand how exactly that is supposed to work: class TestClass def test_method config = String.new yield config p config end end d = TestClass.new d.test_method { 'test string' } Of course it doesn't return 'test string' but an empty string. Thank you for any help :)
0
11,373,138
07/07/2012 07:26:59
1,434,837
06/04/2012 09:40:18
123
3
WebSphere JVM MXBeans
When using Oracle JVM, we can obtain a large amount of useful JVM data using the provided MXBeans like GarbageCollectorMXBean, MemoryMXBean etc. Are the same MXBeans available in case of a WebSphere JVM ? Thanks in advance.
jvm
websphere
jmx
null
null
null
open
WebSphere JVM MXBeans === When using Oracle JVM, we can obtain a large amount of useful JVM data using the provided MXBeans like GarbageCollectorMXBean, MemoryMXBean etc. Are the same MXBeans available in case of a WebSphere JVM ? Thanks in advance.
0
11,373,181
07/07/2012 07:33:02
285,614
03/03/2010 18:33:52
2,227
109
Deffer parts of scrape in scrapy
I have the parse method given below, I uses selenium to first load a page, visits certain pages that cannot be accessed by a scraping directly from the spider, collects individual urls to another parse method which extracts items from the pages. The problem is, this parse method blocks other parsing untill all pages are visited. This chokes the system. I tried adding a sleep, but this stops the engine alltogether, and not just this `parse` method. Any pointers as to how I could optimize this, or atleast make sleep work so that it doesnt stop the engine? def parse(self, response): '''Parse first page and extract page links''' item_link_xpath = "/html/body/form/div[@class='wrapper']//a[@title='View & Apply']" pagination_xpath = "//div[@class='pagination']/input" page_xpath = pagination_xpath + "[@value=%d]" display = Display(visible=0, size=(800, 600)) display.start() browser = webdriver.Firefox() browser.get(response.url) log.msg('Loaded search results', level=log.DEBUG) page_no = 1 while True: log.msg('Scraping page: %d'%page_no, level=log.DEBUG) for link in [item_link.get_attribute('href') for item_link in browser.find_elements_by_xpath(item_link_xpath)]: yield Request(link, callback=self.parse_item_page) page_no += 1 log.msg('Using xpath: %s'%(page_xpath%page_no), level=log.DEBUG) page_element = browser.find_element_by_xpath(page_xpath%page_no) if not page_element or page_no > settings['PAGINATION_PAGES']: break page_element.click() if settings['PAGINATION_SLEEP_INTERVAL']: seconds = int(settings['PAGINATION_SLEEP_INTERVAL']) log.msg('Sleeping for %d'%seconds, level=log.DEBUG) time.sleep(seconds) log.msg('Scraped listing pages, closing browser.', level=log.DEBUG) browser.close() display.stop()
selenium
web-scraping
twisted
scrapy
null
null
open
Deffer parts of scrape in scrapy === I have the parse method given below, I uses selenium to first load a page, visits certain pages that cannot be accessed by a scraping directly from the spider, collects individual urls to another parse method which extracts items from the pages. The problem is, this parse method blocks other parsing untill all pages are visited. This chokes the system. I tried adding a sleep, but this stops the engine alltogether, and not just this `parse` method. Any pointers as to how I could optimize this, or atleast make sleep work so that it doesnt stop the engine? def parse(self, response): '''Parse first page and extract page links''' item_link_xpath = "/html/body/form/div[@class='wrapper']//a[@title='View & Apply']" pagination_xpath = "//div[@class='pagination']/input" page_xpath = pagination_xpath + "[@value=%d]" display = Display(visible=0, size=(800, 600)) display.start() browser = webdriver.Firefox() browser.get(response.url) log.msg('Loaded search results', level=log.DEBUG) page_no = 1 while True: log.msg('Scraping page: %d'%page_no, level=log.DEBUG) for link in [item_link.get_attribute('href') for item_link in browser.find_elements_by_xpath(item_link_xpath)]: yield Request(link, callback=self.parse_item_page) page_no += 1 log.msg('Using xpath: %s'%(page_xpath%page_no), level=log.DEBUG) page_element = browser.find_element_by_xpath(page_xpath%page_no) if not page_element or page_no > settings['PAGINATION_PAGES']: break page_element.click() if settings['PAGINATION_SLEEP_INTERVAL']: seconds = int(settings['PAGINATION_SLEEP_INTERVAL']) log.msg('Sleeping for %d'%seconds, level=log.DEBUG) time.sleep(seconds) log.msg('Scraped listing pages, closing browser.', level=log.DEBUG) browser.close() display.stop()
0
11,373,182
07/07/2012 07:33:32
494,793
11/02/2010 13:41:48
16
0
What's the difference between 2 lines in PHP?
I have found in jqGrid server side PHP example next line == ... $start = $limit*$page - $limit; // do not put $limit*($page - 1) .. === What's the difference between $start = $limit*$page - $limit; and $start = $limit*($page - 1); ? Why authors do not recommend to use second way ? Thanks in advance.
php
jqgrid
null
null
null
null
open
What's the difference between 2 lines in PHP? === I have found in jqGrid server side PHP example next line == ... $start = $limit*$page - $limit; // do not put $limit*($page - 1) .. === What's the difference between $start = $limit*$page - $limit; and $start = $limit*($page - 1); ? Why authors do not recommend to use second way ? Thanks in advance.
0
11,373,183
07/07/2012 07:33:39
653,819
03/10/2011 15:35:03
127
17
Get billing information in order review section of one page checkout in Magento
I am trying to display the billing and shipping information in the "Order Review" section of One Page Checkout in Magento 1.7.0. However, it just doesn't want to co-operate at all. I tried several methods mentioned in various forums and in SO as well. But none of these methods seem to work. Here are the ones I have already tried. [http://www.magentocommerce.com/boards/viewthread/55281/][1] [http://www.magentocommerce.com/boards/viewthread/55281/][2] [1]: http://www.magentocommerce.com/boards/viewthread/55281/ [2]: http://www.magentocommerce.com/boards/viewthread/55281/ Any help would be greatly appreciated! Thanks in advance.
php
magento
checkout
null
null
null
open
Get billing information in order review section of one page checkout in Magento === I am trying to display the billing and shipping information in the "Order Review" section of One Page Checkout in Magento 1.7.0. However, it just doesn't want to co-operate at all. I tried several methods mentioned in various forums and in SO as well. But none of these methods seem to work. Here are the ones I have already tried. [http://www.magentocommerce.com/boards/viewthread/55281/][1] [http://www.magentocommerce.com/boards/viewthread/55281/][2] [1]: http://www.magentocommerce.com/boards/viewthread/55281/ [2]: http://www.magentocommerce.com/boards/viewthread/55281/ Any help would be greatly appreciated! Thanks in advance.
0
11,373,169
07/07/2012 07:31:25
1,288,005
03/23/2012 10:06:41
27
0
createing custom tableview in iphone
Can we create tableview with tableview cell in horizontal as well as vertically aligned ![enter image description here][1] [1]: http://i.stack.imgur.com/MRaBN.png Please advice.
iphone
uitableview
uitableviewcell
null
null
null
open
createing custom tableview in iphone === Can we create tableview with tableview cell in horizontal as well as vertically aligned ![enter image description here][1] [1]: http://i.stack.imgur.com/MRaBN.png Please advice.
0
11,541,742
07/18/2012 12:46:39
853,789
07/20/2011 11:03:53
1
0
using nested validation/ajax in custom tag
ih have a custom tag like this textfield.xhtml: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:x="http://blub.com/jsf"> <h:panelGrid columns="3"> <p:outputLabel id="#{id}_label" value="#{label}" for="#{id}" styleClass="label"/> <p:inputText id="#{id}" value="#{value}" required="#{required}" readonly="#{readonly}"> <c:if test="#{!empty style}"> <f:attribute name="style" value="#{style}"/> </c:if> <c:if test="#{empty style}"> <f:attribute name="style" value="width: 134%"/> </c:if> </p:inputText> <p:message id="#{id}_msg" for="#{id}"/> </h:panelGrid> </ui:composition> What do I have to make it work? <x:textfield id="blub" label="Label" value="#{bean.value}"> <f:convertNumber currencyCode="EUR" type="currency"/> <p:ajax event="keyup" update="someComponent"/> .... something else .... </x:textfield> Or should I add anything to <c:if ..> and with <f:param ..>? What I can say that all elements are nested inputText for? Or is there a better way to do this? Thanks Thanks in advance.
java
jsf-2.0
custom-tag
null
null
null
open
using nested validation/ajax in custom tag === ih have a custom tag like this textfield.xhtml: <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:x="http://blub.com/jsf"> <h:panelGrid columns="3"> <p:outputLabel id="#{id}_label" value="#{label}" for="#{id}" styleClass="label"/> <p:inputText id="#{id}" value="#{value}" required="#{required}" readonly="#{readonly}"> <c:if test="#{!empty style}"> <f:attribute name="style" value="#{style}"/> </c:if> <c:if test="#{empty style}"> <f:attribute name="style" value="width: 134%"/> </c:if> </p:inputText> <p:message id="#{id}_msg" for="#{id}"/> </h:panelGrid> </ui:composition> What do I have to make it work? <x:textfield id="blub" label="Label" value="#{bean.value}"> <f:convertNumber currencyCode="EUR" type="currency"/> <p:ajax event="keyup" update="someComponent"/> .... something else .... </x:textfield> Or should I add anything to <c:if ..> and with <f:param ..>? What I can say that all elements are nested inputText for? Or is there a better way to do this? Thanks Thanks in advance.
0
11,542,017
07/18/2012 13:00:57
707,451
04/14/2011 07:11:37
66
1
What does fn in jQuery stand for?
I know jQuery.fn is just an alias of jQuery.prototype, but what does "fn" stand for? Does it have a full name? For example, "formal name"? "formal namespace"? I've no idea.
jquery
null
null
null
null
null
open
What does fn in jQuery stand for? === I know jQuery.fn is just an alias of jQuery.prototype, but what does "fn" stand for? Does it have a full name? For example, "formal name"? "formal namespace"? I've no idea.
0
11,542,026
07/18/2012 13:01:35
474,442
10/13/2010 12:26:17
352
25
Ocunit - Creating singleton test class to share code among classes
I just started to write unit test case for my code. While writing I just absorbed that many test case classes are using some common code and also it need a common variable in among the classes. So I have decided to create a singleton class to hold all these values. In which this singleton class will be inherited with sentesting. So Here my question is it possible to create a singleton test class. ? Note : I have created a singleton but it is not at all working.
objective-c
unit-testing
singleton
ocunit
null
null
open
Ocunit - Creating singleton test class to share code among classes === I just started to write unit test case for my code. While writing I just absorbed that many test case classes are using some common code and also it need a common variable in among the classes. So I have decided to create a singleton class to hold all these values. In which this singleton class will be inherited with sentesting. So Here my question is it possible to create a singleton test class. ? Note : I have created a singleton but it is not at all working.
0
11,542,036
07/18/2012 13:02:09
1,131,461
01/05/2012 06:03:44
80
5
on server webservice call not working
I m developing app using **android-phonegap**.<br> its working fine when i call webservice hosted on my pc.<br> But when i deploy it on ssl server, i a not getting any output.<br> my code is :<br> function CallService() { $.ajax({ type: "GET", url: "http://devpc4:5566/Service1.asmx/GetItems", dataType: "json", data: "{}", contentType: "application/json; charset=utf-8", success: OnSuccess, error: OnError }); } can any one help me?
android
web-services
phonegap
null
null
null
open
on server webservice call not working === I m developing app using **android-phonegap**.<br> its working fine when i call webservice hosted on my pc.<br> But when i deploy it on ssl server, i a not getting any output.<br> my code is :<br> function CallService() { $.ajax({ type: "GET", url: "http://devpc4:5566/Service1.asmx/GetItems", dataType: "json", data: "{}", contentType: "application/json; charset=utf-8", success: OnSuccess, error: OnError }); } can any one help me?
0
11,542,038
07/18/2012 13:02:15
707,398
04/14/2011 06:36:21
31
2
Looking options for xalan TransformerFactoryImpl
I m using SAX based xml parser, things are working fine but i m getting following warning message in log <code> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl is Sun proprietary API and may be removed in a future release transformerFactory = new TransformerFactoryImpl(); ^ </code> i want to get rid of this, can anybody suggest me other options for TransformerFactoryImpl? Thanks in advance,
java-ee
xml-parsing
sax
saxparser
xalan
null
open
Looking options for xalan TransformerFactoryImpl === I m using SAX based xml parser, things are working fine but i m getting following warning message in log <code> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl is Sun proprietary API and may be removed in a future release transformerFactory = new TransformerFactoryImpl(); ^ </code> i want to get rid of this, can anybody suggest me other options for TransformerFactoryImpl? Thanks in advance,
0
11,542,039
07/18/2012 13:02:26
1,271,131
03/15/2012 09:13:01
124
6
Compare Calendar and java.util.date dates
Hi i am creating instance of Calendar Using: Calendar calendarDate=Calendar.getInstance(); calendarDate.set(2012, 6, 1,0,0,0); After that i create instance of java.util.date using: Date date2=new Date(2012 - 1900,7-1, 01); Now when i am trying to compare dates using following code: System.out.println(date2.compareTo(date1)); System.out.println(date1.compareTo(date2)); it prints -1 and 1 instead of 0(zero).<br> **Can any one help me to find what's goes wrong ?**
java
javascript
null
null
null
null
open
Compare Calendar and java.util.date dates === Hi i am creating instance of Calendar Using: Calendar calendarDate=Calendar.getInstance(); calendarDate.set(2012, 6, 1,0,0,0); After that i create instance of java.util.date using: Date date2=new Date(2012 - 1900,7-1, 01); Now when i am trying to compare dates using following code: System.out.println(date2.compareTo(date1)); System.out.println(date1.compareTo(date2)); it prints -1 and 1 instead of 0(zero).<br> **Can any one help me to find what's goes wrong ?**
0
11,541,952
07/18/2012 12:57:49
1,408,483
05/21/2012 17:35:31
8
0
PHP - check SSL certificate of the request
Is it possible for PHP to obtain the certificate of the request, and in particular the website name on the certificate and the CA? I want to check that a call to my PHP file can only be made from my website via an AJAX call. Like this: 1) User logs onto my website and then uses https for subsequent interaction 2) User loads a page https:// domain/mypage.php 3) https:// domain/mypage.php has an AJAX call to https:// domain/getinfo.php in getinfo.php I want to check the certificate details of the request to ensure that the request was made from my website, i.e. not from a direct hit on the URL, or using a scraping tool. Possible?
php
ajax
ssl
null
null
null
open
PHP - check SSL certificate of the request === Is it possible for PHP to obtain the certificate of the request, and in particular the website name on the certificate and the CA? I want to check that a call to my PHP file can only be made from my website via an AJAX call. Like this: 1) User logs onto my website and then uses https for subsequent interaction 2) User loads a page https:// domain/mypage.php 3) https:// domain/mypage.php has an AJAX call to https:// domain/getinfo.php in getinfo.php I want to check the certificate details of the request to ensure that the request was made from my website, i.e. not from a direct hit on the URL, or using a scraping tool. Possible?
0
11,541,953
07/18/2012 12:57:49
1,516,779
07/11/2012 06:07:03
4
0
is it possible html text send to iMessage and also send to image with text to iMessage in our apps?
I am beginner of iPhone. I have used iMessage in my apps, so is it possible image with text send to simultanesouly in iMessage. and html text is possible send in iMessage. give suggestion and source code..
iphone
objective-c
ios5
null
null
null
open
is it possible html text send to iMessage and also send to image with text to iMessage in our apps? === I am beginner of iPhone. I have used iMessage in my apps, so is it possible image with text send to simultanesouly in iMessage. and html text is possible send in iMessage. give suggestion and source code..
0
11,541,944
07/18/2012 12:57:32
263,924
02/01/2010 22:49:57
331
5
Behavior of ntohl and htonl different between Python and C
I'm trying to imitate the behavior of some parts of a C program in Python. They are both reading a binary file where each record is length->data. The C program will pull the length byte from the file, and regardless of whether it's positive or negative, ntohl() will return the correct length. However, in Python, even though the length record is the same value, when it's negative I'm getting an OverflowError: > length: 419495936 > > htonl: 281 > > length: -2147418112 > > OverflowError: can't convert negative number to unsigned long as compared to C: > length: 419495936 > > ntohl: 281 > > length: -2147418112 > > ntohl: 384 What am I doing wrong here? How do I get Python to produce the same results as C?
python
c
sockets
htonl
null
null
open
Behavior of ntohl and htonl different between Python and C === I'm trying to imitate the behavior of some parts of a C program in Python. They are both reading a binary file where each record is length->data. The C program will pull the length byte from the file, and regardless of whether it's positive or negative, ntohl() will return the correct length. However, in Python, even though the length record is the same value, when it's negative I'm getting an OverflowError: > length: 419495936 > > htonl: 281 > > length: -2147418112 > > OverflowError: can't convert negative number to unsigned long as compared to C: > length: 419495936 > > ntohl: 281 > > length: -2147418112 > > ntohl: 384 What am I doing wrong here? How do I get Python to produce the same results as C?
0
11,542,040
07/18/2012 13:02:28
1,534,835
07/18/2012 12:55:59
1
0
Delphi: (Indy) Send a header Record followed by a file
I am currently trying to use Indy to write a custom higher level protocol on top of TCP. Essentially, I want to send a record across (using a stream) but this record can indicate that x bytes to follow will be an image file. As such, when the record is recieved on the server, if it's contents indicate it's followed by an image, it needs to separate the record and image data. var Segment: TDPPSegment; Segment2: TDPPSegment; Buffer: TIdBytes; Buffer2: TIdBytes; Mem: TMemoryStream; begin if (Client.Connected) then begin Segment.NameStr := 'Adrian'; Segment2.NameStr := 'Jon'; Mem := TMemoryStream.Create; Mem.Write(Segment, SizeOf(Segment)); Mem.Write(Segment2, SizeOf(Segment2)); //The Size of the stream is 8 bytes here! Client.IOHandler.Write(Mem, 0, False); end; To simulate the 'image file' I simply want to send TWO records consecutively; thats the aim. Notice here I am sending the whole memory stream at once (!) and NOT record by record. But interestingly, the server runs the OnExecute event twice! var Buffer: TIdBytes; Segment: TDPPSegment; Mem: TMemoryStream; begin Mem := TMemoryStream.Create; AContext.Connection.IOHandler.ReadStream(Mem, SizeOf(TDPPSegment), False); //Incoming stream size is FOUR bytes but TWICE! Mem.Position := 0; Mem.Read(Segment, SizeOf(TDPPSegment)); Showmessage(Segment.NameStr); I want it to execute once, so in the future I can first read the header record (known size) and THEN see what/if anything is to follow and act accordingly.. Help would be greatly appreciated! Thanks for reading, Adrian
delphi
tcp
stream
record
indy
null
open
Delphi: (Indy) Send a header Record followed by a file === I am currently trying to use Indy to write a custom higher level protocol on top of TCP. Essentially, I want to send a record across (using a stream) but this record can indicate that x bytes to follow will be an image file. As such, when the record is recieved on the server, if it's contents indicate it's followed by an image, it needs to separate the record and image data. var Segment: TDPPSegment; Segment2: TDPPSegment; Buffer: TIdBytes; Buffer2: TIdBytes; Mem: TMemoryStream; begin if (Client.Connected) then begin Segment.NameStr := 'Adrian'; Segment2.NameStr := 'Jon'; Mem := TMemoryStream.Create; Mem.Write(Segment, SizeOf(Segment)); Mem.Write(Segment2, SizeOf(Segment2)); //The Size of the stream is 8 bytes here! Client.IOHandler.Write(Mem, 0, False); end; To simulate the 'image file' I simply want to send TWO records consecutively; thats the aim. Notice here I am sending the whole memory stream at once (!) and NOT record by record. But interestingly, the server runs the OnExecute event twice! var Buffer: TIdBytes; Segment: TDPPSegment; Mem: TMemoryStream; begin Mem := TMemoryStream.Create; AContext.Connection.IOHandler.ReadStream(Mem, SizeOf(TDPPSegment), False); //Incoming stream size is FOUR bytes but TWICE! Mem.Position := 0; Mem.Read(Segment, SizeOf(TDPPSegment)); Showmessage(Segment.NameStr); I want it to execute once, so in the future I can first read the header record (known size) and THEN see what/if anything is to follow and act accordingly.. Help would be greatly appreciated! Thanks for reading, Adrian
0
11,628,194
07/24/2012 09:45:03
250,741
01/14/2010 13:56:24
413
8
How to develop interface like Eclipse using GTK?
I want a write a desktop application using GTKMM. I want the interface to be made of different panels like in Eclipse you have the Project Explorer, Console, Properties, etc. You should be able to drag the panels to change their position, close them and popout them (not sure if you can popout the panels in Eclipse but you can do it in Visual Studio). I am using the word panels here as I am not sure what the right term is. I guess some call it dockable windows. Any pointers on how this can be achieved in GTKMM?
gtk
gtkmm
null
null
null
null
open
How to develop interface like Eclipse using GTK? === I want a write a desktop application using GTKMM. I want the interface to be made of different panels like in Eclipse you have the Project Explorer, Console, Properties, etc. You should be able to drag the panels to change their position, close them and popout them (not sure if you can popout the panels in Eclipse but you can do it in Visual Studio). I am using the word panels here as I am not sure what the right term is. I guess some call it dockable windows. Any pointers on how this can be achieved in GTKMM?
0
11,628,195
07/24/2012 09:45:09
568,104
01/08/2011 14:57:06
66
1
IOKit device adding/removal notifications - only fire once?
I have been trying to get notified when a specific USB device is added or removed. I have read 'Accessing Hardware From Applications' document and have a bare-bones demo application, mainly based on the code provided in that document. It works the first time a device is added or removed, but after that my callbacks never get called. I cannot work out why? Can anyone spot where I am going wrong? Thanks. // // AppDelegate.m // testIOKitNotification // // Created by Diggory Laycock on 23/07/2012. // Copyright (c) 2012 MonkeyFood.com. All rights reserved. // #import "AppDelegate.h" @implementation AppDelegate // Arduino USB info #define matchVendorID 0x2341 #define matchProductID 0x0043 #pragma mark - #pragma mark C Callback functions #pragma mark - void usbDeviceAppeared(void *refCon, io_iterator_t iterator){ NSLog(@"Matching USB device appeared"); } void usbDeviceDisappeared(void *refCon, io_iterator_t iterator){ NSLog(@"Matching USB device disappeared"); } @synthesize window = _window; #pragma mark - #pragma mark Application Methods #pragma mark - - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { io_iterator_t newDevicesIterator; io_iterator_t lostDevicesIterator; newDevicesIterator = 0; lostDevicesIterator = 0; NSLog(@" "); NSMutableDictionary *matchingDict = (__bridge NSMutableDictionary *)IOServiceMatching(kIOUSBDeviceClassName); if (matchingDict == nil){ NSLog(@"Could not create matching dictionary"); return; } [matchingDict setObject:[NSNumber numberWithShort:matchVendorID] forKey:(NSString *)CFSTR(kUSBVendorID)]; [matchingDict setObject:[NSNumber numberWithShort:matchProductID] forKey:(NSString *)CFSTR(kUSBProductID)]; // Add notification ports to runloop IONotificationPortRef notificationPort = IONotificationPortCreate(kIOMasterPortDefault); CFRunLoopSourceRef notificationRunLoopSource = IONotificationPortGetRunLoopSource(notificationPort); CFRunLoopAddSource([[NSRunLoop currentRunLoop] getCFRunLoop], notificationRunLoopSource, kCFRunLoopDefaultMode); kern_return_t err; err = IOServiceAddMatchingNotification(notificationPort, kIOMatchedNotification, (__bridge CFDictionaryRef)matchingDict, usbDeviceAppeared, (__bridge void *)self, &newDevicesIterator); if (err) { NSLog(@"error adding publish notification"); } [self matchingDevicesAdded: newDevicesIterator]; NSMutableDictionary *matchingDictRemoved = (__bridge NSMutableDictionary *)IOServiceMatching(kIOUSBDeviceClassName); if (matchingDictRemoved == nil){ NSLog(@"Could not create matching dictionary"); return; } [matchingDictRemoved setObject:[NSNumber numberWithShort:matchVendorID] forKey:(NSString *)CFSTR(kUSBVendorID)]; [matchingDictRemoved setObject:[NSNumber numberWithShort:matchProductID] forKey:(NSString *)CFSTR(kUSBProductID)]; err = IOServiceAddMatchingNotification(notificationPort, kIOTerminatedNotification, (__bridge CFDictionaryRef)matchingDictRemoved, usbDeviceDisappeared, (__bridge void *)self, &lostDevicesIterator); if (err) { NSLog(@"error adding removed notification"); } [self matchingDevicesRemoved: lostDevicesIterator]; // CFRunLoopRun(); // [[NSRunLoop currentRunLoop] run]; } #pragma mark - #pragma mark ObjC Callback functions #pragma mark - - (void)matchingDevicesAdded:(io_iterator_t)devices { io_object_t thisObject; while ( (thisObject = IOIteratorNext(devices))) { NSLog(@"new Matching device added "); IOObjectRelease(thisObject); } } - (void)matchingDevicesRemoved:(io_iterator_t)devices { io_object_t thisObject; while ( (thisObject = IOIteratorNext(devices))) { NSLog(@"A matching device was removed "); IOObjectRelease(thisObject); } } @end
osx
cocoa
iokit
null
null
null
open
IOKit device adding/removal notifications - only fire once? === I have been trying to get notified when a specific USB device is added or removed. I have read 'Accessing Hardware From Applications' document and have a bare-bones demo application, mainly based on the code provided in that document. It works the first time a device is added or removed, but after that my callbacks never get called. I cannot work out why? Can anyone spot where I am going wrong? Thanks. // // AppDelegate.m // testIOKitNotification // // Created by Diggory Laycock on 23/07/2012. // Copyright (c) 2012 MonkeyFood.com. All rights reserved. // #import "AppDelegate.h" @implementation AppDelegate // Arduino USB info #define matchVendorID 0x2341 #define matchProductID 0x0043 #pragma mark - #pragma mark C Callback functions #pragma mark - void usbDeviceAppeared(void *refCon, io_iterator_t iterator){ NSLog(@"Matching USB device appeared"); } void usbDeviceDisappeared(void *refCon, io_iterator_t iterator){ NSLog(@"Matching USB device disappeared"); } @synthesize window = _window; #pragma mark - #pragma mark Application Methods #pragma mark - - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { io_iterator_t newDevicesIterator; io_iterator_t lostDevicesIterator; newDevicesIterator = 0; lostDevicesIterator = 0; NSLog(@" "); NSMutableDictionary *matchingDict = (__bridge NSMutableDictionary *)IOServiceMatching(kIOUSBDeviceClassName); if (matchingDict == nil){ NSLog(@"Could not create matching dictionary"); return; } [matchingDict setObject:[NSNumber numberWithShort:matchVendorID] forKey:(NSString *)CFSTR(kUSBVendorID)]; [matchingDict setObject:[NSNumber numberWithShort:matchProductID] forKey:(NSString *)CFSTR(kUSBProductID)]; // Add notification ports to runloop IONotificationPortRef notificationPort = IONotificationPortCreate(kIOMasterPortDefault); CFRunLoopSourceRef notificationRunLoopSource = IONotificationPortGetRunLoopSource(notificationPort); CFRunLoopAddSource([[NSRunLoop currentRunLoop] getCFRunLoop], notificationRunLoopSource, kCFRunLoopDefaultMode); kern_return_t err; err = IOServiceAddMatchingNotification(notificationPort, kIOMatchedNotification, (__bridge CFDictionaryRef)matchingDict, usbDeviceAppeared, (__bridge void *)self, &newDevicesIterator); if (err) { NSLog(@"error adding publish notification"); } [self matchingDevicesAdded: newDevicesIterator]; NSMutableDictionary *matchingDictRemoved = (__bridge NSMutableDictionary *)IOServiceMatching(kIOUSBDeviceClassName); if (matchingDictRemoved == nil){ NSLog(@"Could not create matching dictionary"); return; } [matchingDictRemoved setObject:[NSNumber numberWithShort:matchVendorID] forKey:(NSString *)CFSTR(kUSBVendorID)]; [matchingDictRemoved setObject:[NSNumber numberWithShort:matchProductID] forKey:(NSString *)CFSTR(kUSBProductID)]; err = IOServiceAddMatchingNotification(notificationPort, kIOTerminatedNotification, (__bridge CFDictionaryRef)matchingDictRemoved, usbDeviceDisappeared, (__bridge void *)self, &lostDevicesIterator); if (err) { NSLog(@"error adding removed notification"); } [self matchingDevicesRemoved: lostDevicesIterator]; // CFRunLoopRun(); // [[NSRunLoop currentRunLoop] run]; } #pragma mark - #pragma mark ObjC Callback functions #pragma mark - - (void)matchingDevicesAdded:(io_iterator_t)devices { io_object_t thisObject; while ( (thisObject = IOIteratorNext(devices))) { NSLog(@"new Matching device added "); IOObjectRelease(thisObject); } } - (void)matchingDevicesRemoved:(io_iterator_t)devices { io_object_t thisObject; while ( (thisObject = IOIteratorNext(devices))) { NSLog(@"A matching device was removed "); IOObjectRelease(thisObject); } } @end
0
11,628,196
07/24/2012 09:45:10
83,950
03/28/2009 08:09:17
339
8
sharing variables between controller an view in a rails app
in my controller I am collecting data (into a hash) like this (note that I do not have a `BillingAddress` model in my app, `@billing_address` is standard ruby hash @billing_address = params[:billing_address] my view is laid out like this <%= text_field_tag 'billing_address[phone]' %> I want to show the previous value that user entered (in case of errors), like this: <%= text_field_tag 'billing_address[phone]', @billing_address['phone'] %> however, this gives me an exception saying I am trying to access nil, ideas?
ruby-on-rails
null
null
null
null
null
open
sharing variables between controller an view in a rails app === in my controller I am collecting data (into a hash) like this (note that I do not have a `BillingAddress` model in my app, `@billing_address` is standard ruby hash @billing_address = params[:billing_address] my view is laid out like this <%= text_field_tag 'billing_address[phone]' %> I want to show the previous value that user entered (in case of errors), like this: <%= text_field_tag 'billing_address[phone]', @billing_address['phone'] %> however, this gives me an exception saying I am trying to access nil, ideas?
0
11,627,748
07/24/2012 09:18:07
1,548,114
07/24/2012 09:01:20
1
0
air for android push notification stops working
Working on an Air Android app using push notifications ane from disqrit.com Got it working just fine when the app is in the foreground. Close the app to background and it still works. Let the app stay in background for awhile and it quites receiving push notifications. Server side it goes through. The documentation on android developer site says it should be able to wake the app up but i am finding no luck. Is this a limitation,? Do i need a different ANE or have i missed something? I really hope i dont have to open the app every hour or so just to be sure not to miss a notification. Thanks all
android
notifications
extension
push
native
null
open
air for android push notification stops working === Working on an Air Android app using push notifications ane from disqrit.com Got it working just fine when the app is in the foreground. Close the app to background and it still works. Let the app stay in background for awhile and it quites receiving push notifications. Server side it goes through. The documentation on android developer site says it should be able to wake the app up but i am finding no luck. Is this a limitation,? Do i need a different ANE or have i missed something? I really hope i dont have to open the app every hour or so just to be sure not to miss a notification. Thanks all
0
11,628,197
07/24/2012 09:45:24
474,189
10/13/2010 07:40:02
127
8
Enable certain Maven tests by passing a command line switch
I have a single module project that has some unit tests that require an external resource. I don't want these tests to execute unless I indicate that the resource is available. I feel like this is solvable using Maven properties and the SureFire exclusion/inclusion configuration, but I can't quite see how to do it. A [similar question][1] shows how to disable/enable all the tests in a project based on a Maven property, but doesn't quite answer my issue. In summary, I wish to identify a pattern (e.g. `**/*ResourceTest.java`) that describes the tests I don't want to run, unless I pass a Maven property to enable them. E.g. `mvn clean install` (*runs the standard tests, but skips resource tests*) `mvn -Drun.resource.tests=true clean install` (*runs all the tests*) Thanks in advance. [1]: http://stackoverflow.com/questions/9123075/maven-how-can-i-skip-test-in-some-projects-via-command-line-options
maven
surefire
null
null
null
null
open
Enable certain Maven tests by passing a command line switch === I have a single module project that has some unit tests that require an external resource. I don't want these tests to execute unless I indicate that the resource is available. I feel like this is solvable using Maven properties and the SureFire exclusion/inclusion configuration, but I can't quite see how to do it. A [similar question][1] shows how to disable/enable all the tests in a project based on a Maven property, but doesn't quite answer my issue. In summary, I wish to identify a pattern (e.g. `**/*ResourceTest.java`) that describes the tests I don't want to run, unless I pass a Maven property to enable them. E.g. `mvn clean install` (*runs the standard tests, but skips resource tests*) `mvn -Drun.resource.tests=true clean install` (*runs all the tests*) Thanks in advance. [1]: http://stackoverflow.com/questions/9123075/maven-how-can-i-skip-test-in-some-projects-via-command-line-options
0
11,628,198
07/24/2012 09:45:24
1,235,144
02/27/2012 08:44:22
27
1
ExecuteNonQuery: Connection property has not been initialized
I have this code and when I run it gives this error ExecuteNonQuery: Connection property has not been initialized. And I have sql database. its name is Cost. I have this code and when I run it gives this error ExecuteNonQuery: Connection property has not been initialized. And I have sql database. its name is Cost. My code is: namespace Accountingss { public partial class WebForm1 : System.Web.UI.Page { public SqlConnection conn; protected void Page_Load(object sender, EventArgs e) { } protected void Connect(string cmdtxt, Hashtable parameters) { conn = new SqlConnection(); string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Cost.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; conn.ConnectionString = connString; SqlCommand cmd = new SqlCommand(); cmd.CommandText = cmdtxt; cmd.Parameters.Clear(); var ieParams = parameters.GetEnumerator(); while (ieParams.MoveNext()) { cmd.Parameters.AddWithValue(ieParams.Key.ToString(), ieParams.Value.ToString()); //cmd.Parameters.Add(new SqlParameter(ieParams.Key.ToString(), ieParams.Value.ToString())); } conn.Open(); cmd.ExecuteNonQuery(); //SqlDataAdapter costdataAdpater = new SqlDataAdapter(); //DataTable costdataTable = new DataTable(); } protected void Button1_Click(object sender, EventArgs e) { string insert = "INSERT INTO Cost (Type, Amount) VALUES (@type, @amount)";// +type.Text + ',' + a.Text + ")"; var addpTA = new Hashtable(); addpTA.Add("@type", txtType.Text); addpTA.Add("@amount", txtAmount.Text); Connect(insert, addpTA); } } }
c#
sql
asp-classic
null
null
null
open
ExecuteNonQuery: Connection property has not been initialized === I have this code and when I run it gives this error ExecuteNonQuery: Connection property has not been initialized. And I have sql database. its name is Cost. I have this code and when I run it gives this error ExecuteNonQuery: Connection property has not been initialized. And I have sql database. its name is Cost. My code is: namespace Accountingss { public partial class WebForm1 : System.Web.UI.Page { public SqlConnection conn; protected void Page_Load(object sender, EventArgs e) { } protected void Connect(string cmdtxt, Hashtable parameters) { conn = new SqlConnection(); string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Cost.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"; conn.ConnectionString = connString; SqlCommand cmd = new SqlCommand(); cmd.CommandText = cmdtxt; cmd.Parameters.Clear(); var ieParams = parameters.GetEnumerator(); while (ieParams.MoveNext()) { cmd.Parameters.AddWithValue(ieParams.Key.ToString(), ieParams.Value.ToString()); //cmd.Parameters.Add(new SqlParameter(ieParams.Key.ToString(), ieParams.Value.ToString())); } conn.Open(); cmd.ExecuteNonQuery(); //SqlDataAdapter costdataAdpater = new SqlDataAdapter(); //DataTable costdataTable = new DataTable(); } protected void Button1_Click(object sender, EventArgs e) { string insert = "INSERT INTO Cost (Type, Amount) VALUES (@type, @amount)";// +type.Text + ',' + a.Text + ")"; var addpTA = new Hashtable(); addpTA.Add("@type", txtType.Text); addpTA.Add("@amount", txtAmount.Text); Connect(insert, addpTA); } } }
0
11,628,199
07/24/2012 09:45:28
1,365,098
04/30/2012 05:16:57
92
0
Issue With Jellybean Menu button Android
When I press the menu the screen button the screen fades away slowly and up pops my apparently in Jellybean. Is these bug on Jellybean or any other stuff going on? I can't seem to find out how to change it. Anyone know this thing? Thanks, Jay Patel
android
menu
null
null
null
null
open
Issue With Jellybean Menu button Android === When I press the menu the screen button the screen fades away slowly and up pops my apparently in Jellybean. Is these bug on Jellybean or any other stuff going on? I can't seem to find out how to change it. Anyone know this thing? Thanks, Jay Patel
0
11,627,810
07/24/2012 09:21:55
1,463,830
06/18/2012 13:31:28
1
0
Get image by CMS page name in magento
For my magento CMS pages I would like to place a top image similar to category images (bild.phtml) and I will use a different layout for them so I can write the code inside this layout's code. <div class="bild"><img src="images/[CMS PAGE NAME].jpg" alt="[CMS PAGE NAME]" /></div> How can this be done?
image
magento
content-management-system
name
null
null
open
Get image by CMS page name in magento === For my magento CMS pages I would like to place a top image similar to category images (bild.phtml) and I will use a different layout for them so I can write the code inside this layout's code. <div class="bild"><img src="images/[CMS PAGE NAME].jpg" alt="[CMS PAGE NAME]" /></div> How can this be done?
0
11,628,104
07/24/2012 09:38:44
1,089,151
12/09/2011 06:00:36
31
1
How to fetch static contents with http 200 cache
How to fetch Java script, css etc with status 200 cache because it doesn't make any request to server and instead get it from cache and also it always perform better then 304. I am using IIS7 and .net. Right now I am using following setttings in my web.config - <system.webServer> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" cacheControlCustom="public"/> </staticContent> </system.webServer> I also used httpexpires attribute but total waste.
http
null
null
null
null
null
open
How to fetch static contents with http 200 cache === How to fetch Java script, css etc with status 200 cache because it doesn't make any request to server and instead get it from cache and also it always perform better then 304. I am using IIS7 and .net. Right now I am using following setttings in my web.config - <system.webServer> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" cacheControlCustom="public"/> </staticContent> </system.webServer> I also used httpexpires attribute but total waste.
0
11,628,107
07/24/2012 09:38:54
1,548,134
07/24/2012 09:08:15
1
0
How can i use oauth plugin for twitter connect in yii?
> How can i use oauth plugin for *twitter connect* in yii ?. I have the OAuth library and how can i make it works through mvc structure..?
twitter
oauth
yii
null
null
null
open
How can i use oauth plugin for twitter connect in yii? === > How can i use oauth plugin for *twitter connect* in yii ?. I have the OAuth library and how can i make it works through mvc structure..?
0
11,628,206
07/24/2012 09:45:54
229,555
12/11/2009 10:53:03
1,234
6
Running mysql in medium trust mode?
Here I am using .Net framework 4.0 and Mysql. My service provider allow me to run my website in medium trust mode. when I host my site following error get generate : Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. To over come this I have gone through following link to run mysql in medium trust mode: https://rbrundritt.wordpress.com/2010/09/18/mysql-net-4-entity-framework-and-medium-trust-hosting-environments/#comment-1471 http://www.marthijnvandenheuvel.com/2011/04/14/fix-net-4-socketpermission-for-mysql-driver-in-medium-trust/ when I used above code then my code works fine with all select query but when I going for any insert option following error get generate : Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. let me know if you have any idea to solve it.. Thanks in advanced.....
asp.net
mysql
asp.net-mvc
mysql-error-1064
null
null
open
Running mysql in medium trust mode? === Here I am using .Net framework 4.0 and Mysql. My service provider allow me to run my website in medium trust mode. when I host my site following error get generate : Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. To over come this I have gone through following link to run mysql in medium trust mode: https://rbrundritt.wordpress.com/2010/09/18/mysql-net-4-entity-framework-and-medium-trust-hosting-environments/#comment-1471 http://www.marthijnvandenheuvel.com/2011/04/14/fix-net-4-socketpermission-for-mysql-driver-in-medium-trust/ when I used above code then my code works fine with all select query but when I going for any insert option following error get generate : Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. let me know if you have any idea to solve it.. Thanks in advanced.....
0
11,628,207
07/24/2012 09:45:59
40,322
11/24/2008 16:54:48
8,817
252
How to fix Visual Studio 2010 SP1 install error ? INSTALLMESSAGE_OUTOFDISKSPACE
I installed Visual Studio 2010 and applied SP1 and then my HDD died and I had to uninstall and install Visual Studio. Now trying to apply SP1 again however the installer gets stuck. When I check the logs, this is the error : > INSTALLMESSAGE_OUTOFDISKSPACE It's trying to check the disk space in a non-existent volume (D:) in this case instead of the new volume of installation and gets in a recursive loop. The following repeats itself thousands times in the logs Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] I tried Microsoft Fix it for cleanup uninstall but didn't work, it's still same. What's the way to actually clean up after Visual Studio SP1 so it won't look at the previous installation directory?
visual-studio-2010
installation
sp1
null
null
null
open
How to fix Visual Studio 2010 SP1 install error ? INSTALLMESSAGE_OUTOFDISKSPACE === I installed Visual Studio 2010 and applied SP1 and then my HDD died and I had to uninstall and install Visual Studio. Now trying to apply SP1 again however the installer gets stuck. When I check the logs, this is the error : > INSTALLMESSAGE_OUTOFDISKSPACE It's trying to check the disk space in a non-existent volume (D:) in this case instead of the new volume of installation and gets in a recursive loop. The following repeats itself thousands times in the logs Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] Returning IDCANCEL. INSTALLMESSAGE_OUTOFDISKSPACE [Out of disk space -- Volume: 'D:'; required space: 7,090 KB; available space: 0 KB. Free some disk space and retry.] Returning IDNO. INSTALLMESSAGE_USER [Are you sure you want to cancel?] I tried Microsoft Fix it for cleanup uninstall but didn't work, it's still same. What's the way to actually clean up after Visual Studio SP1 so it won't look at the previous installation directory?
0
11,660,464
07/25/2012 23:59:28
98,422
04/30/2009 09:51:51
4,679
154
Can a FlowLayoutPanel auto-fit to a resizable panel?
I'm trying to create a form that I can most easily describe as being like an Explorer view, with two panels side-by-side (a list of folders on the left, files within the selected folder shown on the right). The left-hand panel is fixed-width, and docked to the left of the form. It works fine, and isn't relevant here. The right-hand panel is positioned to the right of the left-hand panel, filling the remainder of the form, and anchored top, left, bottom & right so that, as the form resizes, it continues to occupy the whole of the form except that part occupied by the left-hand panel. It also has `AutoScroll` set to `True` so that whenever the content is too big to fit, it automatically displays scrollbars. That part works fine too. Because I want to show different things in the right-hand panel at different times, I've created an ordinary `Panel` as a container, and am using child panels for each of the different types of content. Only one of these child panels will be visible at any one time. One of the things I (sometimes) want to display in the right-hand panel is a very much like the "icon" view in Explorer - i.e. a bunch of file icons, and for this a `FlowLayoutPanel` sounds perfect, since I do want them to be arranged left-to-right but then wrapping onto a new row as required. I would have thought this was exactly what a `FlowLayoutPanel` was designed for, but I can't get it to work! [I set the `Dock` property of the `FlowLayoutPanel` to `Fill` so that it uses all the space available in the parent `Panel`.] What actually happens is that it just displays all the icons in a single row, and never wraps them. I end up with a horizontal scrollbar on the parent `Panel` because the `FlowLayoutPanel` does not fit. I think this might be because the parent `Panel` that contains the `FlowLayoutPanel` does not have a fixed size (since it will grow and shrink with the form), and so I guess when the `FlowLayoutPanel` decides how wide it can afford to be, it decides that it can be as wide as it likes. However, that's not very helpful. Is there any way I can persuade the `FlowLayoutPanel` that it should only be as wide as its parent `Panel`?
.net
winforms
flowlayoutpanel
null
null
null
open
Can a FlowLayoutPanel auto-fit to a resizable panel? === I'm trying to create a form that I can most easily describe as being like an Explorer view, with two panels side-by-side (a list of folders on the left, files within the selected folder shown on the right). The left-hand panel is fixed-width, and docked to the left of the form. It works fine, and isn't relevant here. The right-hand panel is positioned to the right of the left-hand panel, filling the remainder of the form, and anchored top, left, bottom & right so that, as the form resizes, it continues to occupy the whole of the form except that part occupied by the left-hand panel. It also has `AutoScroll` set to `True` so that whenever the content is too big to fit, it automatically displays scrollbars. That part works fine too. Because I want to show different things in the right-hand panel at different times, I've created an ordinary `Panel` as a container, and am using child panels for each of the different types of content. Only one of these child panels will be visible at any one time. One of the things I (sometimes) want to display in the right-hand panel is a very much like the "icon" view in Explorer - i.e. a bunch of file icons, and for this a `FlowLayoutPanel` sounds perfect, since I do want them to be arranged left-to-right but then wrapping onto a new row as required. I would have thought this was exactly what a `FlowLayoutPanel` was designed for, but I can't get it to work! [I set the `Dock` property of the `FlowLayoutPanel` to `Fill` so that it uses all the space available in the parent `Panel`.] What actually happens is that it just displays all the icons in a single row, and never wraps them. I end up with a horizontal scrollbar on the parent `Panel` because the `FlowLayoutPanel` does not fit. I think this might be because the parent `Panel` that contains the `FlowLayoutPanel` does not have a fixed size (since it will grow and shrink with the form), and so I guess when the `FlowLayoutPanel` decides how wide it can afford to be, it decides that it can be as wide as it likes. However, that's not very helpful. Is there any way I can persuade the `FlowLayoutPanel` that it should only be as wide as its parent `Panel`?
0
11,660,466
07/25/2012 23:59:43
328,397
04/28/2010 23:54:42
5,040
109
Tracking and listing all sessions for a user in ASP SessionStateProvider
I want to track and list all active sessions for a individual who is logged into my site. Is it correct to say that I can use or extend ASP.NET's SessionProvider for this purpose? My intent is to edit or enhance the existing Azure Table Session Provider for this purpose. What methods will be reliably (or not reliably) called to track who is active, and who isn't? Should I ignore the session provider all together and implement my own logic?
asp.net
asp.net-mvc
session
azure
session-state
null
open
Tracking and listing all sessions for a user in ASP SessionStateProvider === I want to track and list all active sessions for a individual who is logged into my site. Is it correct to say that I can use or extend ASP.NET's SessionProvider for this purpose? My intent is to edit or enhance the existing Azure Table Session Provider for this purpose. What methods will be reliably (or not reliably) called to track who is active, and who isn't? Should I ignore the session provider all together and implement my own logic?
0
11,660,468
07/25/2012 23:59:52
1,458,856
06/15/2012 13:48:41
1
0
Email provide...what kind of security model it has?
So lets try again for my question. Email providers use the secret question way in order to reset the password of a user(when the user dont remember his password), right? Generally how this security model works? I mean how this security question identifies the user? How the reset password model works? what is its architecture?
security
email
null
null
null
null
open
Email provide...what kind of security model it has? === So lets try again for my question. Email providers use the secret question way in order to reset the password of a user(when the user dont remember his password), right? Generally how this security model works? I mean how this security question identifies the user? How the reset password model works? what is its architecture?
0
11,660,469
07/25/2012 23:59:52
1,553,103
07/25/2012 23:40:10
1
0
Get content from javascript onClick hyperlink
I'm trying to get the content from a website, that uses "onClick" instead of "href" in hyperlinks, so the url is always the same, despite of the page you are seeing. http://www.sas.ul.pt/index.php This is the website, and the content i'm trying to get is inside "Alimentação" > "Estudantes". <a href="#" onclick="return go('','4;02');" title="Estudantes">Estudantes</a> Is this possible with Jsoup?
javascript
jsoup
null
null
null
null
open
Get content from javascript onClick hyperlink === I'm trying to get the content from a website, that uses "onClick" instead of "href" in hyperlinks, so the url is always the same, despite of the page you are seeing. http://www.sas.ul.pt/index.php This is the website, and the content i'm trying to get is inside "Alimentação" > "Estudantes". <a href="#" onclick="return go('','4;02');" title="Estudantes">Estudantes</a> Is this possible with Jsoup?
0
11,660,428
07/25/2012 23:55:34
1,553,110
07/25/2012 23:48:20
1
0
Numpy statsmodels.api objects not aligned error
I'm using python 2.7 And trying to get this code to work and keep receiving an error nsample = 50 sig = 0.25 x1 = np.linspace(0,20, nsample) X = np.c_[x1, np.sin(x1), (x1-5)**2, np.ones(nsample)] beta = masterAverageList y_true = np.dot(X, beta) y = y_true + sig * np.random.normal(size=nsample) However I keep getting objects are not aligned error I think it has something to do with master average list being a list? How can I correct this? Thanks for any sugguestions
arrays
numpy
python-2.7
null
null
null
open
Numpy statsmodels.api objects not aligned error === I'm using python 2.7 And trying to get this code to work and keep receiving an error nsample = 50 sig = 0.25 x1 = np.linspace(0,20, nsample) X = np.c_[x1, np.sin(x1), (x1-5)**2, np.ones(nsample)] beta = masterAverageList y_true = np.dot(X, beta) y = y_true + sig * np.random.normal(size=nsample) However I keep getting objects are not aligned error I think it has something to do with master average list being a list? How can I correct this? Thanks for any sugguestions
0
11,660,476
07/26/2012 00:01:27
898,247
08/17/2011 08:38:08
187
11
Markdown library isn't installed/urllib ImportError
I'm trying to use Markdown with Django as shown in [this tutorial](http://freewisdom.org/projects/python-markdown/Django). I've got the library installed and configured in Django using `django.contrib.markup`, but when I go to a page using markup, I get: Error in 'markdown' filter: The Python markdown library isn't installed. Then, through the interpreter I try running `import markdown`, which results in the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 43, in <module> from .treeprocessors import build_treeprocessors File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 2, in <module> from . import inlinepatterns File "/usr/lib/python2.7/site-packages/markdown/inlinepatterns.py", line 47, in <module> from urllib.parse import urlparse, urlunparse ImportError: No module named parse The Python documentation, however, tells me that `urlparse` has been renamed to `urllib.parse` in Python 3, which doesn't make any sense, because the Markdown library was installed through pip2, which put in into the python2.7 site-packages directory. Changing that one line, by the way, results in more import errors.
python
django
markdown
2to3
null
null
open
Markdown library isn't installed/urllib ImportError === I'm trying to use Markdown with Django as shown in [this tutorial](http://freewisdom.org/projects/python-markdown/Django). I've got the library installed and configured in Django using `django.contrib.markup`, but when I go to a page using markup, I get: Error in 'markdown' filter: The Python markdown library isn't installed. Then, through the interpreter I try running `import markdown`, which results in the following traceback: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/markdown/__init__.py", line 43, in <module> from .treeprocessors import build_treeprocessors File "/usr/lib/python2.7/site-packages/markdown/treeprocessors.py", line 2, in <module> from . import inlinepatterns File "/usr/lib/python2.7/site-packages/markdown/inlinepatterns.py", line 47, in <module> from urllib.parse import urlparse, urlunparse ImportError: No module named parse The Python documentation, however, tells me that `urlparse` has been renamed to `urllib.parse` in Python 3, which doesn't make any sense, because the Markdown library was installed through pip2, which put in into the python2.7 site-packages directory. Changing that one line, by the way, results in more import errors.
0
11,660,478
07/26/2012 00:01:57
1,502,504
07/04/2012 21:17:29
15
1
Integrate Postgresql database with Ruby Application
I just started building my very first Ruby on Rails application and in order for me to host it on heroku I have change my database setting in my application. I did just that by changing the database.yml file in my application. This is what I have in it now. # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter:postgresql encoding:unicode database:dezirus_dev pool:5 host:localhost username:postgres password: port:5432 # timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter:postgresql encoding:unicode database:dezirus_test pool:5 username:postgres password: host:localhost port:5432 production: adapter:postgresql encoding:unicode database:dezirus pool:5 username:postgres password: host:localhost port:5432 When i try to rake the DB this is the error I get. RAHMAN@IMLDEV1-LT ~/rails-projects/dezirus $ rake db:migrate --trace rake aborted! no such file to load -- pg /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler.rb:122:in `require' /home/RAHMAN/rails-projects/dezirus/config/application.rb:7 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' /home/RAHMAN/rails-projects/dezirus/Rakefile:4 /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33 /usr/bin/rake:23:in `load' /usr/bin/rake:23 Please note that the database was prebuilt using postgreSQL and i already have my tables, primary and foreign keys set. I'm not sure if maybe this is why its refusing to work or not. Any help would be really appreciated. Thanks
ruby-on-rails
database
postgresql
null
null
null
open
Integrate Postgresql database with Ruby Application === I just started building my very first Ruby on Rails application and in order for me to host it on heroku I have change my database setting in my application. I did just that by changing the database.yml file in my application. This is what I have in it now. # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter:postgresql encoding:unicode database:dezirus_dev pool:5 host:localhost username:postgres password: port:5432 # timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter:postgresql encoding:unicode database:dezirus_test pool:5 username:postgres password: host:localhost port:5432 production: adapter:postgresql encoding:unicode database:dezirus pool:5 username:postgres password: host:localhost port:5432 When i try to rake the DB this is the error I get. RAHMAN@IMLDEV1-LT ~/rails-projects/dezirus $ rake db:migrate --trace rake aborted! no such file to load -- pg /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler.rb:122:in `require' /home/RAHMAN/rails-projects/dezirus/config/application.rb:7 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' /home/RAHMAN/rails-projects/dezirus/Rakefile:4 /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33 /usr/bin/rake:23:in `load' /usr/bin/rake:23 Please note that the database was prebuilt using postgreSQL and i already have my tables, primary and foreign keys set. I'm not sure if maybe this is why its refusing to work or not. Any help would be really appreciated. Thanks
0
11,660,481
07/26/2012 00:02:14
1,553,117
07/25/2012 23:55:02
1
0
Fatal error: Call to a member function query() on a non-object on line 7
<center> <?php $lasttime = $_SERVER['REQUEST_TIME'] - 3600*24*30; // 1 month Calling to database? $q = $db->query('SELECT * from votes where lasttime > '.$lasttime); if($q->num_rows>0) { $users = array(); while($r = $q->fetch_object()) {   $users[$r->username] += 1; } if(!empty($users)) { foreach($users as $user => $t) { echo"<br /><strong>$user</strong> has voted $t times"; } } If no votes no vote logs. }else{ echo"NO VOTE LOGS YET"; } ?> </center> From what I understand it cant log in to the MYSQL Database? And im not really sure how to do that. Thanks!
php
mysql
database
fatal
null
null
open
Fatal error: Call to a member function query() on a non-object on line 7 === <center> <?php $lasttime = $_SERVER['REQUEST_TIME'] - 3600*24*30; // 1 month Calling to database? $q = $db->query('SELECT * from votes where lasttime > '.$lasttime); if($q->num_rows>0) { $users = array(); while($r = $q->fetch_object()) {   $users[$r->username] += 1; } if(!empty($users)) { foreach($users as $user => $t) { echo"<br /><strong>$user</strong> has voted $t times"; } } If no votes no vote logs. }else{ echo"NO VOTE LOGS YET"; } ?> </center> From what I understand it cant log in to the MYSQL Database? And im not really sure how to do that. Thanks!
0
11,660,482
07/26/2012 00:02:16
1,415,625
05/24/2012 16:48:45
172
17
SELECTing SUM Across Two Tables for Each User
I have an application with a users table, credit_purchase table, and credit_spend table. I am trying to get the amount of credits the user currently has. The credit tables are as follows: credit_purchase +----+---------+-------+---------------------+ | id | user_id | coins | timestamp | +----+---------+-------+---------------------+ credit_spend +----+---------+-------+---------------------+ | id | user_id | coins | timestamp | +----+---------+-------+---------------------+ What I'm trying to do is select the SUM(credit_purchase.coins) - SUM(credit_spend.coins) for each user. Right now I have something like this: SELECT users.*, COALESCE(SUM(credit_purchase.coins) - SUM(credit_spend.coins), 0) FROM users LEFT JOIN credit_spend ON users.id = credit_purchase.user_id LEFT JOIN credit_spend ON users.id = credit_spend.user_id GROUP BY users.id but, it the result is not the correct number. It seems to be SUMing the purchases properly, but multiplying the SUM from the spend by the number of purchases. What am I doing wrong? Thanks!
mysql
math
join
columns
sum
null
open
SELECTing SUM Across Two Tables for Each User === I have an application with a users table, credit_purchase table, and credit_spend table. I am trying to get the amount of credits the user currently has. The credit tables are as follows: credit_purchase +----+---------+-------+---------------------+ | id | user_id | coins | timestamp | +----+---------+-------+---------------------+ credit_spend +----+---------+-------+---------------------+ | id | user_id | coins | timestamp | +----+---------+-------+---------------------+ What I'm trying to do is select the SUM(credit_purchase.coins) - SUM(credit_spend.coins) for each user. Right now I have something like this: SELECT users.*, COALESCE(SUM(credit_purchase.coins) - SUM(credit_spend.coins), 0) FROM users LEFT JOIN credit_spend ON users.id = credit_purchase.user_id LEFT JOIN credit_spend ON users.id = credit_spend.user_id GROUP BY users.id but, it the result is not the correct number. It seems to be SUMing the purchases properly, but multiplying the SUM from the spend by the number of purchases. What am I doing wrong? Thanks!
0
11,660,486
07/26/2012 00:02:40
1,136,700
01/08/2012 04:02:19
832
0
How to make the following dialog re-appear?
I happened to select the "remember my decison" on the following dialog![enter image description here][1] [1]: http://i.stack.imgur.com/oPkcu.png How to make this dialog reappear?
java
eclipse
null
null
null
null
open
How to make the following dialog re-appear? === I happened to select the "remember my decison" on the following dialog![enter image description here][1] [1]: http://i.stack.imgur.com/oPkcu.png How to make this dialog reappear?
0
11,571,735
07/20/2012 01:43:27
1,539,484
07/20/2012 01:31:21
1
0
Does leaning Java help it easier to understand C++ in the future?
My objective is to learn C++ for game programming, but it's kind of too much for me to handle right now. I had leaned Java for a few months, and thinking of sticking to Java for the time being. So, I just want to know, if I LEARN JAVA FIRST, THAN LEARN C++ LATER, WILL IT BE "MUCH" EASIER TO LEARN C++ AFTER LEARNING JAVA? Thanks in advance.
java
c++
compare
null
null
07/20/2012 01:49:04
not constructive
Does leaning Java help it easier to understand C++ in the future? === My objective is to learn C++ for game programming, but it's kind of too much for me to handle right now. I had leaned Java for a few months, and thinking of sticking to Java for the time being. So, I just want to know, if I LEARN JAVA FIRST, THAN LEARN C++ LATER, WILL IT BE "MUCH" EASIER TO LEARN C++ AFTER LEARNING JAVA? Thanks in advance.
4
11,571,742
07/20/2012 01:44:22
1,357,241
04/25/2012 21:09:05
46
5
$GLOBALS being cleared in URL included page
When I include a page using it's full URL (like `include 'http://mysite.tld/mypage.php'`), I can't use the `$GLOBALS` in `mypage.php`, it returns `Undefined index` error. But when I include it using it's relative path (like `include 'mypage.php'`), then it's OK. The reason why am I using URL instead of relative path is that I want to include `$_GET` parameters to `mypage.php` Is there any logical explanation of this strange behaviour? <hr /> *Note that both files are on the same server, in the same directory.*
php
superglobals
null
null
null
null
open
$GLOBALS being cleared in URL included page === When I include a page using it's full URL (like `include 'http://mysite.tld/mypage.php'`), I can't use the `$GLOBALS` in `mypage.php`, it returns `Undefined index` error. But when I include it using it's relative path (like `include 'mypage.php'`), then it's OK. The reason why am I using URL instead of relative path is that I want to include `$_GET` parameters to `mypage.php` Is there any logical explanation of this strange behaviour? <hr /> *Note that both files are on the same server, in the same directory.*
0
11,571,743
07/20/2012 01:44:36
275,561
02/17/2010 20:02:11
529
10
Combobox and Lightswitch
I have a table with the Field gender that I would like to turn into a custom control with fields of Male and Female. Relatively new to Lightswitch and I am not sure how to go about doing that aspect. I have tried looking but couldn't find any information. I am using the 2012RC. Thanks
c#
visual-studio-lightswitch
null
null
null
null
open
Combobox and Lightswitch === I have a table with the Field gender that I would like to turn into a custom control with fields of Male and Female. Relatively new to Lightswitch and I am not sure how to go about doing that aspect. I have tried looking but couldn't find any information. I am using the 2012RC. Thanks
0
11,571,746
07/20/2012 01:45:00
1,514,317
07/10/2012 09:21:22
12
2
CAPTURE IMAGE VIA ANDROID CAMERA FROM BROWSER USING PHP
is it possible to capture image using android camera via browser, and programming language using PHP or other Library for PHP?. I know it can be done by the phone gap, but I'm still trying to do with PHP. Because my other Project using PHP too. Can Anyone help me to find the solution?
php
android
null
null
null
null
open
CAPTURE IMAGE VIA ANDROID CAMERA FROM BROWSER USING PHP === is it possible to capture image using android camera via browser, and programming language using PHP or other Library for PHP?. I know it can be done by the phone gap, but I'm still trying to do with PHP. Because my other Project using PHP too. Can Anyone help me to find the solution?
0
11,571,747
07/20/2012 01:45:07
609,183
02/09/2011 04:23:32
11
0
iOS - Lauch other apps with search keywords
It is possible to launch another app (such as youtube, AppStore,Map, etc) from my iOS app & give it keyword for searching? For example, I would like provide to user ability search cartoon video from my app & show the results in Youtube app. Please share your though/ Thanks, Huy
ios
app-store
youtube-api
null
null
null
open
iOS - Lauch other apps with search keywords === It is possible to launch another app (such as youtube, AppStore,Map, etc) from my iOS app & give it keyword for searching? For example, I would like provide to user ability search cartoon video from my app & show the results in Youtube app. Please share your though/ Thanks, Huy
0
11,571,748
07/20/2012 01:45:08
369,867
06/17/2010 23:28:34
44
2
Git submodule update error
I'm starting to git right now, and running some tests to learn it better, but a got stucked on an error... I've started a git repository of a framework I'm developing which is used on a lot projects I'm working on, to update these projects easily. To test, I've started a new project and added the framework as a submodule. I've cloned the project on a new folder, executed the following commands `git submodule init; git submodule update` and the submodule was cloned into it's directory perfectly. After that, I've made some modifications to the source accordingly to the project needs and committed the modifications made on the source and pushed to the server. Everything went fine. On the another folder which I've cloned, I've pulled the modifications and everything seems to be ok. DennyMac:app DennyLoko$ git commit -a -m "Teste" [master 68fee42] Teste 1 files changed, 1 insertions(+), 0 deletions(-) DennyMac:app DennyLoko$ cd .. DennyMac:vesti DennyLoko$ git add app DennyMac:vesti DennyLoko$ git commit -m "Teste" [master 3a2b13d] Teste 1 files changed, 1 insertions(+), 1 deletions(-) DennyMac:vesti DennyLoko$ git push Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 243 bytes, done. Total 2 (delta 1), reused 0 (delta 0) To [email protected]:vesti.git 33fc470..3a2b13d master -> master But when I've checked the source of the modified file, nothing have changed. Running `git submodule update` it gives the following error: DennyMac:testelol DennyLoko$ git submodule update fatal: reference is not a tree: 68fee423f5dba537956fec51dcab0901856ad4e6 Unable to checkout '68fee423f5dba537956fec51dcab0901856ad4e6' in submodule path 'app' What do I have to do to fix this? I'm doing the best thing using a submodule or exists a better approach to that? Thank you guys!
git
null
null
null
null
null
open
Git submodule update error === I'm starting to git right now, and running some tests to learn it better, but a got stucked on an error... I've started a git repository of a framework I'm developing which is used on a lot projects I'm working on, to update these projects easily. To test, I've started a new project and added the framework as a submodule. I've cloned the project on a new folder, executed the following commands `git submodule init; git submodule update` and the submodule was cloned into it's directory perfectly. After that, I've made some modifications to the source accordingly to the project needs and committed the modifications made on the source and pushed to the server. Everything went fine. On the another folder which I've cloned, I've pulled the modifications and everything seems to be ok. DennyMac:app DennyLoko$ git commit -a -m "Teste" [master 68fee42] Teste 1 files changed, 1 insertions(+), 0 deletions(-) DennyMac:app DennyLoko$ cd .. DennyMac:vesti DennyLoko$ git add app DennyMac:vesti DennyLoko$ git commit -m "Teste" [master 3a2b13d] Teste 1 files changed, 1 insertions(+), 1 deletions(-) DennyMac:vesti DennyLoko$ git push Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 243 bytes, done. Total 2 (delta 1), reused 0 (delta 0) To [email protected]:vesti.git 33fc470..3a2b13d master -> master But when I've checked the source of the modified file, nothing have changed. Running `git submodule update` it gives the following error: DennyMac:testelol DennyLoko$ git submodule update fatal: reference is not a tree: 68fee423f5dba537956fec51dcab0901856ad4e6 Unable to checkout '68fee423f5dba537956fec51dcab0901856ad4e6' in submodule path 'app' What do I have to do to fix this? I'm doing the best thing using a submodule or exists a better approach to that? Thank you guys!
0
11,571,751
07/20/2012 01:45:48
392,184
07/15/2010 00:23:46
1,124
7
ProtocolViolationException Load testing web service (GET action with content-body)
I created an ASP.NET MVC4 Web API service (REST) with a single GET action. The action currently needs 11 input values, so rather than passing all of those values in the URL, I opted to encapsulate those values into a single class type and have it passed as Content-Body. When I test in Fiddler, I specify the verb as GET, and enter the JSON text in the "Request Body" input box. This works great! The problem is when I attempt to perform Load Testing in Visual Studio 2010 Ultimate. I am able to specify the GET action and the JSON Content-Body just fine. But when I run the Load test, VS reports exceptions of type ProtocolViolationException (Cannot send a content-body with this verb-type) in the test results. The test executes in 1ms so I suspect the exceptions are causing the test to immediately abort. What can I do to avoid those exceptions? I'd prefer to not change my API to use URL arguments just to work-around the test tooling. If I should change the API for other reasons, let me know. Thanks!
visual-studio-2010
exception
rest
asp.net-web-api
load-testing
null
open
ProtocolViolationException Load testing web service (GET action with content-body) === I created an ASP.NET MVC4 Web API service (REST) with a single GET action. The action currently needs 11 input values, so rather than passing all of those values in the URL, I opted to encapsulate those values into a single class type and have it passed as Content-Body. When I test in Fiddler, I specify the verb as GET, and enter the JSON text in the "Request Body" input box. This works great! The problem is when I attempt to perform Load Testing in Visual Studio 2010 Ultimate. I am able to specify the GET action and the JSON Content-Body just fine. But when I run the Load test, VS reports exceptions of type ProtocolViolationException (Cannot send a content-body with this verb-type) in the test results. The test executes in 1ms so I suspect the exceptions are causing the test to immediately abort. What can I do to avoid those exceptions? I'd prefer to not change my API to use URL arguments just to work-around the test tooling. If I should change the API for other reasons, let me know. Thanks!
0
11,571,752
07/20/2012 01:45:49
1,535,422
07/18/2012 16:05:02
3
0
Lua Prime Number Checker
Here is my Lua code for taking user input, and checking if the number entered is prime. My issue is that the program thinks that any even number is not prime, and any odd number is. There is a small error somewhere in the code, my code looks identical to my computer science course classmates. Please try and find what is wrong. Thank you! print("Enter a number.") local number = io.read("*n") function prime(n) for i = 2, n^(1/2) do if (n % i) == 0 then return false end return true end end if prime(number) == true then print("Your number is prime!") end if prime(number) == false then print("Your number is not prime!") end
lua
numbers
null
null
null
null
open
Lua Prime Number Checker === Here is my Lua code for taking user input, and checking if the number entered is prime. My issue is that the program thinks that any even number is not prime, and any odd number is. There is a small error somewhere in the code, my code looks identical to my computer science course classmates. Please try and find what is wrong. Thank you! print("Enter a number.") local number = io.read("*n") function prime(n) for i = 2, n^(1/2) do if (n % i) == 0 then return false end return true end end if prime(number) == true then print("Your number is prime!") end if prime(number) == false then print("Your number is not prime!") end
0
11,571,757
07/20/2012 01:47:06
968,277
09/28/2011 03:42:36
1
0
UIDatePicker Date property won't set with the date selected - rather gives the current date
I have a UIDatePicker in my app and although I change the date selected in the simulator, when I NSLog the `datePicker.date`, it outputs the current date rather than the one I selected. Here is an extract of my code: (where the picker is generated) self.pickerView = [[UIDatePicker alloc] initWithFrame:pickerFrame]; //self.pickerView.frame = pickerFrame; self.pickerView.datePickerMode = UIDatePickerModeDate; actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; [actionSheet addSubview:pickerView]; UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]]; closeButton.momentary = YES; closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f); closeButton.segmentedControlStyle = UISegmentedControlStyleBar; closeButton.tintColor = [UIColor blackColor]; [closeButton addTarget:self action:@selector(dismissActionSheet) forControlEvents:UIControlEventValueChanged]; [pickerView addTarget:self action:@selector(pickerChange) forControlEvents:UIControlEventValueChanged]; [actionSheet addSubview:closeButton]; [actionSheet setBounds:CGRectMake(0, 0, 320, 251)]; pickerView.maximumDate = [NSDate dateWithTimeIntervalSinceNow:315360000]; pickerView.minimumDate = [NSDate dateWithTimeIntervalSinceNow:-315360000]; Then in my **pickerChange** function: -(void)pickerChange{ NSLog(@"DEBUG: Picker Value Changed"); NSLog(@"%@",self.pickerView.date ); } The output of that NSLog is always the CURRENT DATE rather than the date that is selected in the UIDatePicker. Not sure why this is, because from what I can tell, the `date` property should display what is selected, not the current date (or what was originally selected prior to the user changing the value). Any help would be appreciated. (message me if you need further info). **Thanks!** I'm sure it must be something I've overlooked whilst in a rush.
objective-c
ios
ios5
null
null
null
open
UIDatePicker Date property won't set with the date selected - rather gives the current date === I have a UIDatePicker in my app and although I change the date selected in the simulator, when I NSLog the `datePicker.date`, it outputs the current date rather than the one I selected. Here is an extract of my code: (where the picker is generated) self.pickerView = [[UIDatePicker alloc] initWithFrame:pickerFrame]; //self.pickerView.frame = pickerFrame; self.pickerView.datePickerMode = UIDatePickerModeDate; actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; [actionSheet addSubview:pickerView]; UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]]; closeButton.momentary = YES; closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f); closeButton.segmentedControlStyle = UISegmentedControlStyleBar; closeButton.tintColor = [UIColor blackColor]; [closeButton addTarget:self action:@selector(dismissActionSheet) forControlEvents:UIControlEventValueChanged]; [pickerView addTarget:self action:@selector(pickerChange) forControlEvents:UIControlEventValueChanged]; [actionSheet addSubview:closeButton]; [actionSheet setBounds:CGRectMake(0, 0, 320, 251)]; pickerView.maximumDate = [NSDate dateWithTimeIntervalSinceNow:315360000]; pickerView.minimumDate = [NSDate dateWithTimeIntervalSinceNow:-315360000]; Then in my **pickerChange** function: -(void)pickerChange{ NSLog(@"DEBUG: Picker Value Changed"); NSLog(@"%@",self.pickerView.date ); } The output of that NSLog is always the CURRENT DATE rather than the date that is selected in the UIDatePicker. Not sure why this is, because from what I can tell, the `date` property should display what is selected, not the current date (or what was originally selected prior to the user changing the value). Any help would be appreciated. (message me if you need further info). **Thanks!** I'm sure it must be something I've overlooked whilst in a rush.
0
11,571,758
07/20/2012 01:47:07
887,050
08/10/2011 02:38:10
281
4
Insert null fails with Model First EF
I'm using a context generated from an EDMX for a mvc3 webapp. I'm getting a NULL insert fails error on an entity [Serializable] [DataContract(IsReference = true)] [EdmEntityType(NamespaceName = "Model", Name = "Thing")] public class Thing: EntityObject { public RolloverEntry(); [DataMember] [EdmScalarProperty(EntityKeyProperty = true, IsNullable = false)] public int id { get; set; } [SoapIgnore] [EdmRelationshipNavigationProperty("Model", "FK_ThingStep1", "Step1")] [DataMember] [XmlIgnore] public EntityCollection<Step1> Step1 { get; set; } [SoapIgnore] [EdmRelationshipNavigationProperty("Model", "FK_ThingStep2", "Step2")] [XmlIgnore] [DataMember] public EntityCollection<Step2> Step2 { get; set; } public static Thing CreateThing(int id); } Data access to other parent-child relationships are working and persisted correctly - I can't seem to find what's wrong with this table tho - any ideas appreciated Thanks
asp.net-mvc-3
entity-framework
null
null
null
null
open
Insert null fails with Model First EF === I'm using a context generated from an EDMX for a mvc3 webapp. I'm getting a NULL insert fails error on an entity [Serializable] [DataContract(IsReference = true)] [EdmEntityType(NamespaceName = "Model", Name = "Thing")] public class Thing: EntityObject { public RolloverEntry(); [DataMember] [EdmScalarProperty(EntityKeyProperty = true, IsNullable = false)] public int id { get; set; } [SoapIgnore] [EdmRelationshipNavigationProperty("Model", "FK_ThingStep1", "Step1")] [DataMember] [XmlIgnore] public EntityCollection<Step1> Step1 { get; set; } [SoapIgnore] [EdmRelationshipNavigationProperty("Model", "FK_ThingStep2", "Step2")] [XmlIgnore] [DataMember] public EntityCollection<Step2> Step2 { get; set; } public static Thing CreateThing(int id); } Data access to other parent-child relationships are working and persisted correctly - I can't seem to find what's wrong with this table tho - any ideas appreciated Thanks
0
11,350,214
07/05/2012 18:20:00
103,999
05/09/2009 08:40:05
2,405
122
Regex to remove first set of zeros
I have the following example string and I would like to remove only one set of zeros. The example string is > AAL000007200100000787777388300000 I would like to remove only the first set of zero's and leave the rest intact. I want to end up with > AAL7200100000787777388300000 I have tried the following but it is always too greedy and takes the second set of zeros as well! #!/usr/bin/env python3 import re suffixdrop = re.split("\B0+\B", "AAL000007200100000787777388300000", re.I) if suffixdrop: #found a suffix here print(suffix drop) The result of the print is > ['AAL', '72', '100000787777388300000']
python
regex
null
null
null
null
open
Regex to remove first set of zeros === I have the following example string and I would like to remove only one set of zeros. The example string is > AAL000007200100000787777388300000 I would like to remove only the first set of zero's and leave the rest intact. I want to end up with > AAL7200100000787777388300000 I have tried the following but it is always too greedy and takes the second set of zeros as well! #!/usr/bin/env python3 import re suffixdrop = re.split("\B0+\B", "AAL000007200100000787777388300000", re.I) if suffixdrop: #found a suffix here print(suffix drop) The result of the print is > ['AAL', '72', '100000787777388300000']
0
11,350,049
07/05/2012 18:07:52
1,504,801
07/05/2012 17:49:00
1
0
Login to Google Account iOS
I would like to make an application in Xcode for iOS that login me to Google account. I did this so that I am using textfields filled with javascript - name and password and it's working. And I want to ask whether it is better to do with javascript or HTTP POST. Thank you very much!
objective-c
ios
xcode
google
login
null
open
Login to Google Account iOS === I would like to make an application in Xcode for iOS that login me to Google account. I did this so that I am using textfields filled with javascript - name and password and it's working. And I want to ask whether it is better to do with javascript or HTTP POST. Thank you very much!
0
11,349,618
07/05/2012 17:39:31
922,377
08/31/2011 20:06:42
1
0
Errors occur when updated from Java 1.6 to 1.7
I had projects that were running fine but when I updated from Java 1.6 to 1.7 two of the projects I have ended up getting errors Failed to run com.android.ide.eclipse.adt.internal.build.AidlProcessor. Check workspace log for detail. and am not sure how to fix these has anyone already found this out.
android
null
null
null
null
null
open
Errors occur when updated from Java 1.6 to 1.7 === I had projects that were running fine but when I updated from Java 1.6 to 1.7 two of the projects I have ended up getting errors Failed to run com.android.ide.eclipse.adt.internal.build.AidlProcessor. Check workspace log for detail. and am not sure how to fix these has anyone already found this out.
0
11,350,222
07/05/2012 18:20:29
1,399,797
05/16/2012 23:08:36
13
0
Class cannot be found in Eclipse Graphical Layout editor
I'm writing an sdk of sorts that includes a subclass -- call it `com.my.company.PublicViewClass` -- of an obfuscated subclass of `RelativeLayout`. When I test the sdk with the obfuscated jar that ProGuard spits out, the graphical layout editor in Eclipse says that it cannot find the class: The following classes could not be found: - com.my.company.PublicViewClass (Fix Build Path, Edit XML, Create Class) The jar is indeed included on the build path of the project's properties and marked for export, but the editor can't seem to find the class. This is not a null pointer exception nor is this a build error. The test project that I created builds and runs fine, finding `PublicViewClass` properly. A placeholder shows up in the layout editor for that class, but that "error" message shows up under the sample view. The XML layout file is using the class's full path: <com.my.company.PublicViewClass android:layout_width="200dp" android:layout_height="200dp" android:layout_marginTop="10dp" android:layout_gravity="center"/> I'm using ADT 18 and the test Android project is targeting Android 2.1. What might I be doing wrong?
android
android-layout
android-2.1
null
null
null
open
Class cannot be found in Eclipse Graphical Layout editor === I'm writing an sdk of sorts that includes a subclass -- call it `com.my.company.PublicViewClass` -- of an obfuscated subclass of `RelativeLayout`. When I test the sdk with the obfuscated jar that ProGuard spits out, the graphical layout editor in Eclipse says that it cannot find the class: The following classes could not be found: - com.my.company.PublicViewClass (Fix Build Path, Edit XML, Create Class) The jar is indeed included on the build path of the project's properties and marked for export, but the editor can't seem to find the class. This is not a null pointer exception nor is this a build error. The test project that I created builds and runs fine, finding `PublicViewClass` properly. A placeholder shows up in the layout editor for that class, but that "error" message shows up under the sample view. The XML layout file is using the class's full path: <com.my.company.PublicViewClass android:layout_width="200dp" android:layout_height="200dp" android:layout_marginTop="10dp" android:layout_gravity="center"/> I'm using ADT 18 and the test Android project is targeting Android 2.1. What might I be doing wrong?
0
11,350,225
07/05/2012 18:20:33
471,384
01/22/2010 19:53:25
26
5
Boyer Moore Algorithm Delta2 Table
The paper on algorithm can be found [here][1] [1]: http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf Almost everyone knows how Boyer Moore and Knuth Morris Pratt algorithm works. I recently looked into BM algo and i looking at how the delta1 and delta2 tables are formed, the logic behind it. The explanations and examples are understandable but the RPR table that is rightmost plausible reocurrence table manipulation is not explained well anywhere. The paper says delta2(j) = patlen + 1 - rpr(j) but the calculation of rpr is still not vivid. i have gone through many articles on internet and still nothing is upto the mark.
boyer-moore
null
null
null
null
null
open
Boyer Moore Algorithm Delta2 Table === The paper on algorithm can be found [here][1] [1]: http://www.cs.utexas.edu/~moore/publications/fstrpos.pdf Almost everyone knows how Boyer Moore and Knuth Morris Pratt algorithm works. I recently looked into BM algo and i looking at how the delta1 and delta2 tables are formed, the logic behind it. The explanations and examples are understandable but the RPR table that is rightmost plausible reocurrence table manipulation is not explained well anywhere. The paper says delta2(j) = patlen + 1 - rpr(j) but the calculation of rpr is still not vivid. i have gone through many articles on internet and still nothing is upto the mark.
0
11,350,227
07/05/2012 18:20:41
651,174
03/09/2011 08:26:41
2,364
60
Mapping string based on first letter
I have a list of items that I want to obfuscate based on the letter of the item's name. For example: ABC_Classified BXY_Classified ZX_Classified Key: A -> Adam B -> Bale Z -> Talking Result: ABC_Classified ==> Adam BXY_Classified ==> Bale ZX_Classified ==> Talking The first way to do this, which would be extremely repetitious, would be having 26 `if/elif` statements for this. What would be the best and most concise way to accomplish the above?
python
null
null
null
null
null
open
Mapping string based on first letter === I have a list of items that I want to obfuscate based on the letter of the item's name. For example: ABC_Classified BXY_Classified ZX_Classified Key: A -> Adam B -> Bale Z -> Talking Result: ABC_Classified ==> Adam BXY_Classified ==> Bale ZX_Classified ==> Talking The first way to do this, which would be extremely repetitious, would be having 26 `if/elif` statements for this. What would be the best and most concise way to accomplish the above?
0
11,350,228
07/05/2012 18:20:44
434,337
08/29/2010 17:38:57
2,274
149
Is every single file compiled in Objective-C?
I would like to know, which code is compiled when i build the project in Objective-C - every single line of code in my project, or only those, that are called from the main.c and then from the ones that are called from them? I mean, does the compiler separate the project to the simply connected domains and compiles the one that is linked to the main, or it just compiles it all? Thank you, guys!
objective-c
xcode
compiler
clang
null
null
open
Is every single file compiled in Objective-C? === I would like to know, which code is compiled when i build the project in Objective-C - every single line of code in my project, or only those, that are called from the main.c and then from the ones that are called from them? I mean, does the compiler separate the project to the simply connected domains and compiles the one that is linked to the main, or it just compiles it all? Thank you, guys!
0
11,350,232
07/05/2012 18:21:04
1,504,851
07/05/2012 18:14:19
1
0
How to IF check and do multiple things else in dos
I am trying to check a variable=="string" then echo message and run program else it must quit exit 1 if anything else or even empty. I have tried so much already and used google i just seem to continually receive syntax errors and unexpected at this time errors, dos is really a struggle to trouble although it is pretty old and yet powerful. my structure was like : echo off if "%1"=="imre" goto imre ( echo found parameter "%1" ) else if NOT %1=="imre" echo you failed just not working i get ( was unexpected and other syntax errors if i try to tweak this... its not exactly what i want though because i have manipulated it so many times. All i want is to: if %variable%=="hello" ( echo hello is correct echo now lets start this program start /w excel.exe ) else ( exit 1 ) this does not work, i dont understand what i am doing wrong.
string
if-statement
dos
statement
else
null
open
How to IF check and do multiple things else in dos === I am trying to check a variable=="string" then echo message and run program else it must quit exit 1 if anything else or even empty. I have tried so much already and used google i just seem to continually receive syntax errors and unexpected at this time errors, dos is really a struggle to trouble although it is pretty old and yet powerful. my structure was like : echo off if "%1"=="imre" goto imre ( echo found parameter "%1" ) else if NOT %1=="imre" echo you failed just not working i get ( was unexpected and other syntax errors if i try to tweak this... its not exactly what i want though because i have manipulated it so many times. All i want is to: if %variable%=="hello" ( echo hello is correct echo now lets start this program start /w excel.exe ) else ( exit 1 ) this does not work, i dont understand what i am doing wrong.
0