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,660,705 | 07/26/2012 00:28:52 | 186,100 | 10/08/2009 03:27:39 | 316 | 2 | Why is parentNode sometimes null? (using Pagedown AKA WMD Editor) | I'm experiencing a really odd error in Pagedown (AKA WMD Editor, the open-source version of the markdown editor used here on StackOverflow), but I think someone with the proper JS experience could help me without actual knowledge of Pagedown.
The "insert link" and "insert image" buttons put a shaded background over the page when they are clicked. This is then removed by code `background.parentNode.removeChild(background);` where `background` is a variable that was set earlier, and references the `div` that holds the background.
At times, when the background is obviously visible in the page, the code above fails, and the browser console says `Uncaught TypeError: Cannot read property 'parentNode' of null` except that I have verified that `background` at that exact time is NOT null.
Note that when I say "at times", it is actually always the second time clicking the button. (i.e. click insert button, cancel, click insert button again, try canceling again........instant failure.)
Can anyone take a guess as to how/why this is happening? I don't have any "hacks" in place that could be causing this, but I am using the "hooks" feature which I'd guess is not often used. | javascript | wmd | null | null | null | null | open | Why is parentNode sometimes null? (using Pagedown AKA WMD Editor)
===
I'm experiencing a really odd error in Pagedown (AKA WMD Editor, the open-source version of the markdown editor used here on StackOverflow), but I think someone with the proper JS experience could help me without actual knowledge of Pagedown.
The "insert link" and "insert image" buttons put a shaded background over the page when they are clicked. This is then removed by code `background.parentNode.removeChild(background);` where `background` is a variable that was set earlier, and references the `div` that holds the background.
At times, when the background is obviously visible in the page, the code above fails, and the browser console says `Uncaught TypeError: Cannot read property 'parentNode' of null` except that I have verified that `background` at that exact time is NOT null.
Note that when I say "at times", it is actually always the second time clicking the button. (i.e. click insert button, cancel, click insert button again, try canceling again........instant failure.)
Can anyone take a guess as to how/why this is happening? I don't have any "hacks" in place that could be causing this, but I am using the "hooks" feature which I'd guess is not often used. | 0 |
11,430,541 | 07/11/2012 10:21:49 | 517,369 | 11/23/2010 11:45:50 | 7,103 | 440 | Character Limit not working inside update panel |
I'm using Jquery plugin called [Limit][1] as below
$(document).ready(
function () {
$('[id$=Textarea1]').limit('150', '#charsLeft');
});
Relevant ASPX section,
<td align="left" valign="top">
<textarea id="Textarea1" class ="limit" runat="server" rows="4" cols="30" style="resize: none;
background-color: #F9E8EC; font-family: 'Times New Roman', Times, serif;" ></textarea>
<br />
You have <span id="charsLeft">160</span> chars left.
</td>
both above controls are inside update panel. fist time I can see this limit function works fine. but when update panel updated span shows 160 characters and not updating when typing on text area. How to fix this issue?
[1]: http://unwrongest.com/projects/limit/ | jquery | asp.net | updatepanel | limit | null | null | open | Character Limit not working inside update panel
===
I'm using Jquery plugin called [Limit][1] as below
$(document).ready(
function () {
$('[id$=Textarea1]').limit('150', '#charsLeft');
});
Relevant ASPX section,
<td align="left" valign="top">
<textarea id="Textarea1" class ="limit" runat="server" rows="4" cols="30" style="resize: none;
background-color: #F9E8EC; font-family: 'Times New Roman', Times, serif;" ></textarea>
<br />
You have <span id="charsLeft">160</span> chars left.
</td>
both above controls are inside update panel. fist time I can see this limit function works fine. but when update panel updated span shows 160 characters and not updating when typing on text area. How to fix this issue?
[1]: http://unwrongest.com/projects/limit/ | 0 |
11,430,543 | 07/11/2012 10:21:53 | 129,871 | 06/27/2009 17:25:59 | 501 | 6 | Java, "pointer" equality and string comparison | I've C code that use a lot of commands identified by static string constants.
static char* KCmdA = "commandA"
static char* KCmdB = "commandB"
static char* KCmdC = "commandC"
In C I can compare two strings with strcmp(A, B) for example but as I only refer those command via their static string identifier it's faster to only check for pointer inequality since I know my unknowCMD can only be a pointer to one of my static strings.
switch(unknowCMD)
{
case KCmdA:
...
case KCmdB:
...
}
I guess in Java the equivalent to strcmp would be the method equals:
unknowCMD.equals(KCmdA)
Is there an equivalent of the pointer equality in Java ? I know Java uses only references. Is it possible to use those references for equality test without actually comparing the strings ?
Sorry if this is obvious I've check the doc but did not find any definitive answer.
| java | string | pointers | reference | equality | null | open | Java, "pointer" equality and string comparison
===
I've C code that use a lot of commands identified by static string constants.
static char* KCmdA = "commandA"
static char* KCmdB = "commandB"
static char* KCmdC = "commandC"
In C I can compare two strings with strcmp(A, B) for example but as I only refer those command via their static string identifier it's faster to only check for pointer inequality since I know my unknowCMD can only be a pointer to one of my static strings.
switch(unknowCMD)
{
case KCmdA:
...
case KCmdB:
...
}
I guess in Java the equivalent to strcmp would be the method equals:
unknowCMD.equals(KCmdA)
Is there an equivalent of the pointer equality in Java ? I know Java uses only references. Is it possible to use those references for equality test without actually comparing the strings ?
Sorry if this is obvious I've check the doc but did not find any definitive answer.
| 0 |
11,430,553 | 07/11/2012 10:22:27 | 658,031 | 03/13/2011 23:52:31 | 1,754 | 55 | String comparison to consider numbers | I am trying to sort nodes of a treeview with respect to their text property of course. The problem is that my comparison class does not care about numbers. Here is the code:
public class TreeNodeSorter : IComparer
{
public int Compare(object x, object y)
{
var tx = x as TreeNode;
var ty = y as TreeNode;
return string.Compare(tx.Text, ty.Text);
}
}
And here is the result:
![enter image description here][1]
The first child node (Debug...) is ok, but my problem is why on earth "HBM\D10" is sorted before "HBM\D7" and so on...
[1]: http://i.stack.imgur.com/VWmTI.png | c# | winforms | sorting | treeview | null | null | open | String comparison to consider numbers
===
I am trying to sort nodes of a treeview with respect to their text property of course. The problem is that my comparison class does not care about numbers. Here is the code:
public class TreeNodeSorter : IComparer
{
public int Compare(object x, object y)
{
var tx = x as TreeNode;
var ty = y as TreeNode;
return string.Compare(tx.Text, ty.Text);
}
}
And here is the result:
![enter image description here][1]
The first child node (Debug...) is ok, but my problem is why on earth "HBM\D10" is sorted before "HBM\D7" and so on...
[1]: http://i.stack.imgur.com/VWmTI.png | 0 |
11,430,554 | 07/11/2012 10:22:31 | 1,509,421 | 07/08/2012 00:29:11 | 8 | 1 | Does Ruby have a this.var = "somevalue" functionality? | I'm writing my first application in Ruby and I had a question.
Here is a sample:
class SomeClass
def initialize(host)
@host = host
end
end
How can I change the value of @host within another method? I have tried using
`self.host = "somenewvalue"` but that doesn't work. | ruby | null | null | null | null | null | open | Does Ruby have a this.var = "somevalue" functionality?
===
I'm writing my first application in Ruby and I had a question.
Here is a sample:
class SomeClass
def initialize(host)
@host = host
end
end
How can I change the value of @host within another method? I have tried using
`self.host = "somenewvalue"` but that doesn't work. | 0 |
11,430,471 | 07/11/2012 10:17:22 | 927,511 | 09/04/2011 11:59:01 | 1,142 | 65 | Silverlight OOB Installation on Mac with download of latest XAP | I have created an offline installation for an OOB Silverlight application on Mac, following this Guide:
http://sharppdf-sl.sourceforge.net/offlineoob.html
It uses Apples `Package Manager`. Here, you have to install the Silverlight OOB application and then use some of the installed data to create a package.
I was wondering, if it is possible to create an installer that downloads the latest xap while installing, i.e. by specifying an URL where the latest xap can be downloaded.
Has anybody made any experiences with such an approach already or any ideas that could lead me in the right direction?
Thanks in advance! | osx | installer | silverlight-oob | null | null | null | open | Silverlight OOB Installation on Mac with download of latest XAP
===
I have created an offline installation for an OOB Silverlight application on Mac, following this Guide:
http://sharppdf-sl.sourceforge.net/offlineoob.html
It uses Apples `Package Manager`. Here, you have to install the Silverlight OOB application and then use some of the installed data to create a package.
I was wondering, if it is possible to create an installer that downloads the latest xap while installing, i.e. by specifying an URL where the latest xap can be downloaded.
Has anybody made any experiences with such an approach already or any ideas that could lead me in the right direction?
Thanks in advance! | 0 |
11,430,515 | 07/11/2012 10:20:10 | 904,692 | 08/21/2011 15:42:52 | 80 | 7 | Problems with running Android APK file when merging dex files using Scala | I've been trying to create Android applications using Scala 2.9.1 and SBT 0.13 and Android-Plugin.
However, running ProGuard can be extremely slow.
So, instead, when I'm not using any new classes/methods since the previous build, I'm just trying to merge classes.dex with my own dexed android-app classes (like `MainActivity.scala` and such).
The problem I get (on Android 4.0.x) is that the merging goes without any errors, but when I try to run the application, I get this `"Unfortunately, MyAndroidApp has stopped"`.
Here's the logcat log:
EmbeddedLogger E App crashed! Package: com.my.app v0 (0.1)
300 EmbeddedLogger E Application Label: MyAndroidApp
24137 AndroidRuntime E FATAL EXCEPTION: main
24137 AndroidRuntime E java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.my.app/com.my.app.MainActivity}: java.lang.ClassNotFoundException: com.my.app.MainActivity
24137 AndroidRuntime E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2118)
24137 AndroidRuntime E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2237)
24137 AndroidRuntime E at android.app.ActivityThread.access$600(ActivityThread.java:139)
24137 AndroidRuntime E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
24137 AndroidRuntime E at android.os.Handler.dispatchMessage(Handler.java:99)
24137 AndroidRuntime E at android.os.Looper.loop(Looper.java:156)
24137 AndroidRuntime E at android.app.ActivityThread.main(ActivityThread.java:5005)
24137 AndroidRuntime E at java.lang.reflect.Method.invokeNative(Native Method)
24137 AndroidRuntime E at java.lang.reflect.Method.invoke(Method.java:511)
24137 AndroidRuntime E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
24137 AndroidRuntime E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
24137 AndroidRuntime E at dalvik.system.NativeStart.main(Native Method)
24137 AndroidRuntime E Caused by: java.lang.ClassNotFoundException: com.my.app.MainActivity
24137 AndroidRuntime E at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
24137 AndroidRuntime E at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
24137 AndroidRuntime E at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
24137 AndroidRuntime E at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
24137 AndroidRuntime E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2109)
24137 AndroidRuntime E ... 11 more
300 ActivityManager W Force finishing activity com.my.app/.MainActivity
5864 OpenGLRenderer D Flushing caches (mode 1)
300 ViewRootImpl D @@@- disable SystemServer HW acceleration
I have manually opened the generated apk, and classes.dex inside it, navigated thru the packages and found MainActivity there.
Any help will be greatly appreciated. | android | scala | merge | apk | dex | null | open | Problems with running Android APK file when merging dex files using Scala
===
I've been trying to create Android applications using Scala 2.9.1 and SBT 0.13 and Android-Plugin.
However, running ProGuard can be extremely slow.
So, instead, when I'm not using any new classes/methods since the previous build, I'm just trying to merge classes.dex with my own dexed android-app classes (like `MainActivity.scala` and such).
The problem I get (on Android 4.0.x) is that the merging goes without any errors, but when I try to run the application, I get this `"Unfortunately, MyAndroidApp has stopped"`.
Here's the logcat log:
EmbeddedLogger E App crashed! Package: com.my.app v0 (0.1)
300 EmbeddedLogger E Application Label: MyAndroidApp
24137 AndroidRuntime E FATAL EXCEPTION: main
24137 AndroidRuntime E java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.my.app/com.my.app.MainActivity}: java.lang.ClassNotFoundException: com.my.app.MainActivity
24137 AndroidRuntime E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2118)
24137 AndroidRuntime E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2237)
24137 AndroidRuntime E at android.app.ActivityThread.access$600(ActivityThread.java:139)
24137 AndroidRuntime E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
24137 AndroidRuntime E at android.os.Handler.dispatchMessage(Handler.java:99)
24137 AndroidRuntime E at android.os.Looper.loop(Looper.java:156)
24137 AndroidRuntime E at android.app.ActivityThread.main(ActivityThread.java:5005)
24137 AndroidRuntime E at java.lang.reflect.Method.invokeNative(Native Method)
24137 AndroidRuntime E at java.lang.reflect.Method.invoke(Method.java:511)
24137 AndroidRuntime E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
24137 AndroidRuntime E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
24137 AndroidRuntime E at dalvik.system.NativeStart.main(Native Method)
24137 AndroidRuntime E Caused by: java.lang.ClassNotFoundException: com.my.app.MainActivity
24137 AndroidRuntime E at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
24137 AndroidRuntime E at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
24137 AndroidRuntime E at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
24137 AndroidRuntime E at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
24137 AndroidRuntime E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2109)
24137 AndroidRuntime E ... 11 more
300 ActivityManager W Force finishing activity com.my.app/.MainActivity
5864 OpenGLRenderer D Flushing caches (mode 1)
300 ViewRootImpl D @@@- disable SystemServer HW acceleration
I have manually opened the generated apk, and classes.dex inside it, navigated thru the packages and found MainActivity there.
Any help will be greatly appreciated. | 0 |
11,472,642 | 07/13/2012 14:34:53 | 915,836 | 08/27/2011 20:09:36 | 41 | 2 | Is directly manipulating the Rails form params hash considered code smell? | I have a Rails form with a parent model and nested attributes for potentially multiple children of another model.
The child model has an attribute which is manipulated in logic as an array, but is serialized to a YAML string using the Rails built-in serialize method.
Within the form, I display each individual member of the array so that the user can selectively delete members.
The problem happens when the user destroys all members. The form will not pass any value for the param to the Rails controller and when the UPDATE action is called, it ignores the attribute since there is no key for it in the forms params hash. This is of course a known problem with things like checkboxes, so Rails automatically puts 2 checkbox HTML elements for each checkbox, one hidden that only processes if the checkbox is checked off.
I'm not dealing with checkboxes here but rather hidden input text fields.
The solution I've implemented is to manipulate the params hash directly in the UPDATE action of the controller, like this:
params[:series][:time_slots_attributes].each { |k,v| v[:exdates] ||= [] }
Is this considered code smell?
Should I instead add an extra hidden field that is disabled and only gets enabled when the user removes the last member? This solution works as well, but it seems clunky to me. | html | ruby-on-rails | ruby-on-rails-3 | forms | null | null | open | Is directly manipulating the Rails form params hash considered code smell?
===
I have a Rails form with a parent model and nested attributes for potentially multiple children of another model.
The child model has an attribute which is manipulated in logic as an array, but is serialized to a YAML string using the Rails built-in serialize method.
Within the form, I display each individual member of the array so that the user can selectively delete members.
The problem happens when the user destroys all members. The form will not pass any value for the param to the Rails controller and when the UPDATE action is called, it ignores the attribute since there is no key for it in the forms params hash. This is of course a known problem with things like checkboxes, so Rails automatically puts 2 checkbox HTML elements for each checkbox, one hidden that only processes if the checkbox is checked off.
I'm not dealing with checkboxes here but rather hidden input text fields.
The solution I've implemented is to manipulate the params hash directly in the UPDATE action of the controller, like this:
params[:series][:time_slots_attributes].each { |k,v| v[:exdates] ||= [] }
Is this considered code smell?
Should I instead add an extra hidden field that is disabled and only gets enabled when the user removes the last member? This solution works as well, but it seems clunky to me. | 0 |
11,472,663 | 07/13/2012 14:36:20 | 759,355 | 05/18/2011 14:15:35 | 31 | 1 | Counting distinct use rids from multiple tables | I have about 5 tables with common field “userid” I want to count distinct userids across all these tables. Certain user ids may occur in about 2 of these tables. But I want to count the UNION of distinct user ids in the 5 tables together. I am able to count distinct userids in one table with the ff code. I want to be able count from all tables.
`//just count the nuber of distict userids in table1
$query2 = ("SELECT COUNT(DISTINCT userid) FROM table1");
$result2 = mysql_query($query2) or die(mysql_error());
$row2 = mysql_fetch_row($result2);
echo "Number of users in table 1 = ".$row2[0] ."<br />";`
**Table 1**
Id userid name adresss
**Table 2**
Id Title Sex userid
**Table 3**
Id userid amount
**Table 4**
Id price promotion userid productid
**Table 5**
Id userid category tax weight
| php | mysql | sql | database | null | null | open | Counting distinct use rids from multiple tables
===
I have about 5 tables with common field “userid” I want to count distinct userids across all these tables. Certain user ids may occur in about 2 of these tables. But I want to count the UNION of distinct user ids in the 5 tables together. I am able to count distinct userids in one table with the ff code. I want to be able count from all tables.
`//just count the nuber of distict userids in table1
$query2 = ("SELECT COUNT(DISTINCT userid) FROM table1");
$result2 = mysql_query($query2) or die(mysql_error());
$row2 = mysql_fetch_row($result2);
echo "Number of users in table 1 = ".$row2[0] ."<br />";`
**Table 1**
Id userid name adresss
**Table 2**
Id Title Sex userid
**Table 3**
Id userid amount
**Table 4**
Id price promotion userid productid
**Table 5**
Id userid category tax weight
| 0 |
11,472,666 | 07/13/2012 14:36:47 | 270,398 | 02/10/2010 15:27:57 | 62 | 2 | use of MARK target in iptables -? | I learned that iptables can "mark" the packet in the mangle table to change routing decisions for the packet... But what does the "--set-mark" actually change in ip header and can it be used to drop the packet?
I work with firewall code with the rule to drop certain UDP "flows" ( src ip/port, dest ip/port). Right now packets are dropped after examination of ip headers (by pcap, or netlink hook ) in application code. Can the iptable rule be possibly made to "mark" such flows so that the packets belonging to them could be dropped without inspection of ip header in user space?
Thank you,
-V
| iptables | netlink | null | null | null | null | open | use of MARK target in iptables -?
===
I learned that iptables can "mark" the packet in the mangle table to change routing decisions for the packet... But what does the "--set-mark" actually change in ip header and can it be used to drop the packet?
I work with firewall code with the rule to drop certain UDP "flows" ( src ip/port, dest ip/port). Right now packets are dropped after examination of ip headers (by pcap, or netlink hook ) in application code. Can the iptable rule be possibly made to "mark" such flows so that the packets belonging to them could be dropped without inspection of ip header in user space?
Thank you,
-V
| 0 |
11,472,673 | 07/13/2012 14:37:23 | 383,191 | 07/04/2010 17:46:22 | 46 | 5 | Outlook 2010 email rendering | i am trying to set a global font in an email. The Mail is built using tables to keep compatibility but there is one table that just does not accept my styles. What I have done:
{literal}
<style>
*,table, div, p, td, tr, #tabledetails, .tabledetails {
margin: 0;
font-family: Verdana, Arial, Helvetica, sans-serif !important;
color: #000000;
font-size: 12px;
}
</style>
{/literal}
...
<table id="tabledetails" class="tabledetails" width="100%" border="0" cellspacing="0" cellpadding="4" style="font-family: Verdana, Arial, Helvetica, sans-serif !important; font-size: 12px !important;">...
<td class="left" style="font-family: Verdana, Arial, Helvetica, sans-serif !important; font-size: 12px !important;">{$order_values.products_quantity} x</td>
So as you see I tried about everything i could to set the font (and not use Times New Roman like Outlook loves to do) but it still doesnt work. What else can i possibly do?
| html | css | email | outlook | null | null | open | Outlook 2010 email rendering
===
i am trying to set a global font in an email. The Mail is built using tables to keep compatibility but there is one table that just does not accept my styles. What I have done:
{literal}
<style>
*,table, div, p, td, tr, #tabledetails, .tabledetails {
margin: 0;
font-family: Verdana, Arial, Helvetica, sans-serif !important;
color: #000000;
font-size: 12px;
}
</style>
{/literal}
...
<table id="tabledetails" class="tabledetails" width="100%" border="0" cellspacing="0" cellpadding="4" style="font-family: Verdana, Arial, Helvetica, sans-serif !important; font-size: 12px !important;">...
<td class="left" style="font-family: Verdana, Arial, Helvetica, sans-serif !important; font-size: 12px !important;">{$order_values.products_quantity} x</td>
So as you see I tried about everything i could to set the font (and not use Times New Roman like Outlook loves to do) but it still doesnt work. What else can i possibly do?
| 0 |
11,472,674 | 07/13/2012 14:37:23 | 954,724 | 09/20/2011 12:13:27 | 376 | 2 | Using collections in ATL application | How can I use std collections as vector and list in an ATL application? if it is not possible what can I do instead, aside from using the collections described in http://msdn.microsoft.com/en-us/library/15e672bd.aspx ? I want for example to store some strings in a list as
std::list< CString > alist. | c++ | collections | atl | null | null | null | open | Using collections in ATL application
===
How can I use std collections as vector and list in an ATL application? if it is not possible what can I do instead, aside from using the collections described in http://msdn.microsoft.com/en-us/library/15e672bd.aspx ? I want for example to store some strings in a list as
std::list< CString > alist. | 0 |
11,441,498 | 07/11/2012 21:06:54 | 559,850 | 12/21/2010 14:31:18 | 926 | 59 | Opening source code from debug view | When I'm debugging my code in Eclipse, I get annoyed when I open up the editor to find out I cant edit it because I'm actually viewing the source of the .class file. How do I get Eclipse to open up the .java file instead of the .class file when in debug mode?
EDIT: When I hit a breakpoint in *my* code, it brings me to MyFile.class, instead of MyFile.java, so I can see *my* code but not edit it. | java | eclipse | debugging | null | null | null | open | Opening source code from debug view
===
When I'm debugging my code in Eclipse, I get annoyed when I open up the editor to find out I cant edit it because I'm actually viewing the source of the .class file. How do I get Eclipse to open up the .java file instead of the .class file when in debug mode?
EDIT: When I hit a breakpoint in *my* code, it brings me to MyFile.class, instead of MyFile.java, so I can see *my* code but not edit it. | 0 |
11,472,679 | 07/13/2012 14:37:36 | 1,451,679 | 06/12/2012 15:53:22 | 1 | 0 | Trying to pass URL from iFrame to SharePoint site URL? | I have an application running in an iFrame that is embedded in a SharePoint site. The problem with this is navigation within the application does not result in a change in the SharePoint site URL. Therefore, if you were to refresh the overall page, you would be sent back to the default page of the application, not stay on the same page of the application. The reason this is an issue is sharing for social media. I have added a Facebook Share button to the application, but when it pulls the URL of the application which does not match or reference the URL of the overall site, so it just shares the application (which is not visually appealing and does not allow you to access the rest of the site).
Any body have any suggestions or know a place I can go for help? Thanks! | facebook | sharepoint | url | iframe | null | null | open | Trying to pass URL from iFrame to SharePoint site URL?
===
I have an application running in an iFrame that is embedded in a SharePoint site. The problem with this is navigation within the application does not result in a change in the SharePoint site URL. Therefore, if you were to refresh the overall page, you would be sent back to the default page of the application, not stay on the same page of the application. The reason this is an issue is sharing for social media. I have added a Facebook Share button to the application, but when it pulls the URL of the application which does not match or reference the URL of the overall site, so it just shares the application (which is not visually appealing and does not allow you to access the rest of the site).
Any body have any suggestions or know a place I can go for help? Thanks! | 0 |
11,693,320 | 07/27/2012 18:09:15 | 753,909 | 05/14/2011 18:51:09 | 183 | 2 | Linking GLIBC statically and propreitary software licensing | I have basic understanding problem with open source and licenses. Could someone please clarify some questions for the below scenario. Excuse me if it is very basic
1. I'm writing a proprietary software in which i plan to use some open source libraries. I will also need glibc and a C compiler, but did not want to use the default gcc toolchain from my OS, so built my own using crosstools-ng
2. Now in ct-ng, i guess the glibc library gets linked statically. If that is the case, given that glibc is LGPL, and that i can link it to my proprietary software, will this static linking cause any issues to me wrt licensing? Can my software still be close sourced? or do i have to release the compiled objects. If that is the case, if i rebuild the toolchain to make link glibc link dynamically i wouldn't have to release my compiled objects?
My toolchain configuration is below, from this could someone point to me if glibc is statically or dynamically linked?
Target: x86_64-some-linux-gnu
Configured with: /home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/src/gcc-4.4.7/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=x86_64-some-linux-gnu --prefix=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu --with-sysroot=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu/x86_64-some-linux-gnu/sysroot --enable-languages=c,c++,fortran --with-pkgversion='crosstool-NG 1.15.3' --disable-sjlj-exceptions --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-mpfr=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-ppl=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-cloog=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --with-long-double-128 --disable-multilib --with-local-prefix=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu/x86_64-some-linux-gnu/sysroot --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.4.7 (crosstool-NG 1.15.3)
| gcc | cross-compiling | glibc | lgpl | null | null | open | Linking GLIBC statically and propreitary software licensing
===
I have basic understanding problem with open source and licenses. Could someone please clarify some questions for the below scenario. Excuse me if it is very basic
1. I'm writing a proprietary software in which i plan to use some open source libraries. I will also need glibc and a C compiler, but did not want to use the default gcc toolchain from my OS, so built my own using crosstools-ng
2. Now in ct-ng, i guess the glibc library gets linked statically. If that is the case, given that glibc is LGPL, and that i can link it to my proprietary software, will this static linking cause any issues to me wrt licensing? Can my software still be close sourced? or do i have to release the compiled objects. If that is the case, if i rebuild the toolchain to make link glibc link dynamically i wouldn't have to release my compiled objects?
My toolchain configuration is below, from this could someone point to me if glibc is statically or dynamically linked?
Target: x86_64-some-linux-gnu
Configured with: /home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/src/gcc-4.4.7/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=x86_64-some-linux-gnu --prefix=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu --with-sysroot=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu/x86_64-some-linux-gnu/sysroot --enable-languages=c,c++,fortran --with-pkgversion='crosstool-NG 1.15.3' --disable-sjlj-exceptions --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-mpfr=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-ppl=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-cloog=/home/balravin/tools/platform/x86/src/gnu/gcc/4.4.7/.build/x86_64-some-linux-gnu/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --with-long-double-128 --disable-multilib --with-local-prefix=/home/balravin/tools/platform/x86/obj/gnu/gcc/4.4.7/x86_64-some-linux-gnu/x86_64-some-linux-gnu/sysroot --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.4.7 (crosstool-NG 1.15.3)
| 0 |
11,693,330 | 07/27/2012 18:09:57 | 652,046 | 03/09/2011 17:25:33 | 1 | 1 | Convert object to struct with generics | I'm looking for a way to convert an object to one of several different types of structs. I need structs because I need it to be non-nullable. I'm not sure how to go about this, but this is what I've tried so far and it doesn't work because:
"Object must implement IConvertible." <- trying Convert.ChangeType
public class Something
{
private object[] things;
public Something()
{
//I don't know at compile time if this will
//be an array of ThingA's or ThingB's
things = new object[1];
things[0] = new ThingA();
ThingA[] thingsArrayA = GetArrayofThings<ThingA>();
things[0] = new ThingB();
ThingB[] thingsArrayB = GetArrayofThings<ThingB>();
}
public TData[] GetArrayofThings<TData>() where TData : struct
{
return (TData[])Convert.ChangeType(things, typeof(TData[]));
}
}
[Serializable]
public struct ThingA
{
//...
}
[Serializable]
public struct ThingB
{
//...
}
| c# | generics | struct | convert | null | null | open | Convert object to struct with generics
===
I'm looking for a way to convert an object to one of several different types of structs. I need structs because I need it to be non-nullable. I'm not sure how to go about this, but this is what I've tried so far and it doesn't work because:
"Object must implement IConvertible." <- trying Convert.ChangeType
public class Something
{
private object[] things;
public Something()
{
//I don't know at compile time if this will
//be an array of ThingA's or ThingB's
things = new object[1];
things[0] = new ThingA();
ThingA[] thingsArrayA = GetArrayofThings<ThingA>();
things[0] = new ThingB();
ThingB[] thingsArrayB = GetArrayofThings<ThingB>();
}
public TData[] GetArrayofThings<TData>() where TData : struct
{
return (TData[])Convert.ChangeType(things, typeof(TData[]));
}
}
[Serializable]
public struct ThingA
{
//...
}
[Serializable]
public struct ThingB
{
//...
}
| 0 |
11,693,331 | 07/27/2012 18:09:58 | 1,558,422 | 07/27/2012 18:04:02 | 1 | 0 | Google Bigquery create table with no code? syntax | I was hoping to use basic SQL Create Table syntax within Google BigQuery to create a table based on columns in 2 existing tables already in BQ. The Google SQL dialect (https://developers.google.com/bigquery/docs/query-reference) does not show a CREATE. All the documentation seems to imply that I need to know how to code (I don't) to do such a thing. Is there any syntax or way to do a CREATE TABLE XYZ AS SELECT ABC.123, DFG.234 from ABC, DFG? | google-bigquery | null | null | null | null | null | open | Google Bigquery create table with no code? syntax
===
I was hoping to use basic SQL Create Table syntax within Google BigQuery to create a table based on columns in 2 existing tables already in BQ. The Google SQL dialect (https://developers.google.com/bigquery/docs/query-reference) does not show a CREATE. All the documentation seems to imply that I need to know how to code (I don't) to do such a thing. Is there any syntax or way to do a CREATE TABLE XYZ AS SELECT ABC.123, DFG.234 from ABC, DFG? | 0 |
11,693,339 | 07/27/2012 18:10:26 | 824,904 | 05/05/2011 12:44:47 | 447 | 7 | wordpress pagination, links appear but go nowhere when clicked | First let me say that, ive been digging for the past 2 hrs and the problem is that, although
the links do appear on the bottom of the page where i place the function that calls the pagination.
when clicked, the page does nothing.
Ive found countless similar questions on the web (many here on SO ) but when i try to implement
those posts resolutions, the same thing happens. ALL the different pagination methods,loops,functions....and EVEN plugins that i try WORK in that they **appear** on the page but when clicked, the url changes accordingly but the page content doesn't change.
So as an example, im using this loop that i found in an "accepted answer" from someone elses question here on SO
function pagination($pages = '', $range = 3){
$showitems = ($range * 2)+1;
global $paged; if(empty($paged)) $paged = 1;
if($pages == '') {
global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages)
{ $pages = 1; }
}
if(1 != $pages) { echo "<div class='pagination'><span>Page ".$paged." of ".$pages."</span>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) {
echo "<a href='".get_pagenum_link(1)."'>« First</a>";
}
if($paged > 1 && $showitems < $pages) {
echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>";
}
for ($i=1; $i <= $pages; $i++){
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){
echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive'>".$i."</a>";
}
}
if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>Next ›</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>";
echo "</div>n"; }
}
and applied the function call to the bottom of my post loop under the endwhile//if so that it doesnt repeat through each post shown on the page, and again, it shows (just like all the others)
but the page itself doesnt do anything.
My question is, with this type of a problem where the links are showing up and all types of different versions ive tried, **do** appear on the page but when clicked, go nowhere, what is it i could be missing???
do i need to enable pagination somewhere like the way one enables widgets or..or do my pages have to have any type of hook or ..... like when one inserts "**<?php wp_head(); ?>**" etc...
im at a loss.
thanks in advanced
| wordpress | pagination | null | null | null | null | open | wordpress pagination, links appear but go nowhere when clicked
===
First let me say that, ive been digging for the past 2 hrs and the problem is that, although
the links do appear on the bottom of the page where i place the function that calls the pagination.
when clicked, the page does nothing.
Ive found countless similar questions on the web (many here on SO ) but when i try to implement
those posts resolutions, the same thing happens. ALL the different pagination methods,loops,functions....and EVEN plugins that i try WORK in that they **appear** on the page but when clicked, the url changes accordingly but the page content doesn't change.
So as an example, im using this loop that i found in an "accepted answer" from someone elses question here on SO
function pagination($pages = '', $range = 3){
$showitems = ($range * 2)+1;
global $paged; if(empty($paged)) $paged = 1;
if($pages == '') {
global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages)
{ $pages = 1; }
}
if(1 != $pages) { echo "<div class='pagination'><span>Page ".$paged." of ".$pages."</span>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) {
echo "<a href='".get_pagenum_link(1)."'>« First</a>";
}
if($paged > 1 && $showitems < $pages) {
echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a>";
}
for ($i=1; $i <= $pages; $i++){
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){
echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive'>".$i."</a>";
}
}
if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>Next ›</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last »</a>";
echo "</div>n"; }
}
and applied the function call to the bottom of my post loop under the endwhile//if so that it doesnt repeat through each post shown on the page, and again, it shows (just like all the others)
but the page itself doesnt do anything.
My question is, with this type of a problem where the links are showing up and all types of different versions ive tried, **do** appear on the page but when clicked, go nowhere, what is it i could be missing???
do i need to enable pagination somewhere like the way one enables widgets or..or do my pages have to have any type of hook or ..... like when one inserts "**<?php wp_head(); ?>**" etc...
im at a loss.
thanks in advanced
| 0 |
11,693,343 | 07/27/2012 18:10:45 | 664,177 | 03/17/2011 10:59:52 | 535 | 58 | UIWebView usage | Now I need to display webview in cocos2D game. I used this code. But it is not displaying close button, how can I enable close button? Here is screen that I want. !
![enter image description here][1]
Code Used:
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
UIWebView* myWebView = [[[UIWebView alloc] initWithFrame:webFrame] autorelease];
myWebView.backgroundColor = [UIColor whiteColor];
myWebView.scalesPageToFit = YES;
myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
myWebView.delegate = self;
[self.navController.view addSubview:myWebView];
[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://biggooseegg.com/moregamesscreen"]]];
Some other Doubts: How can I get rounded border for this web view?
Here is my sample that not completed: [CLICK HERE][2]
[1]: http://i.stack.imgur.com/YJX3B.png
[2]: http://is.gd/eSlTug | ios | xcode | cocos2d-iphone | null | null | null | open | UIWebView usage
===
Now I need to display webview in cocos2D game. I used this code. But it is not displaying close button, how can I enable close button? Here is screen that I want. !
![enter image description here][1]
Code Used:
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
UIWebView* myWebView = [[[UIWebView alloc] initWithFrame:webFrame] autorelease];
myWebView.backgroundColor = [UIColor whiteColor];
myWebView.scalesPageToFit = YES;
myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
myWebView.delegate = self;
[self.navController.view addSubview:myWebView];
[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://biggooseegg.com/moregamesscreen"]]];
Some other Doubts: How can I get rounded border for this web view?
Here is my sample that not completed: [CLICK HERE][2]
[1]: http://i.stack.imgur.com/YJX3B.png
[2]: http://is.gd/eSlTug | 0 |
11,542,491 | 07/18/2012 13:25:19 | 769,548 | 05/25/2011 12:26:56 | 32 | 2 | compiling problems with latex and embedded python code | I'm using Ubuntu server with Python 2.7 and LaTeX and I try try to compile this LaTeX code with the shell command: pdflatex test.tex
\documentclass{article}
\usepackage{python}
\begin{document}
\begin{python}
print "Hello World"
\end{python}
\end{document}
It's pretty simple, because it's my first attempt with both together but I get this error message:
(/usr/share/texmf/tex/latex/python/python.sty
Package: python 2007/06/07 v0.21 Python in LaTeX
\@out=\write3
\@module=\write4
) (./test.aux)
! I can't write on file `test.aux'.
\document ...ate \openout \@mainaux \jobname .aux
\immediate \write \@mainau...
l.5 \begin{document}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name:
! Emergency stop.
\document ...ate \openout \@mainaux \jobname .aux
Is it maybe a permission problem or anything else? | python | latex | pdflatex | null | null | 07/19/2012 14:37:23 | too localized | compiling problems with latex and embedded python code
===
I'm using Ubuntu server with Python 2.7 and LaTeX and I try try to compile this LaTeX code with the shell command: pdflatex test.tex
\documentclass{article}
\usepackage{python}
\begin{document}
\begin{python}
print "Hello World"
\end{python}
\end{document}
It's pretty simple, because it's my first attempt with both together but I get this error message:
(/usr/share/texmf/tex/latex/python/python.sty
Package: python 2007/06/07 v0.21 Python in LaTeX
\@out=\write3
\@module=\write4
) (./test.aux)
! I can't write on file `test.aux'.
\document ...ate \openout \@mainaux \jobname .aux
\immediate \write \@mainau...
l.5 \begin{document}
(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name:
! Emergency stop.
\document ...ate \openout \@mainaux \jobname .aux
Is it maybe a permission problem or anything else? | 3 |
11,542,493 | 07/18/2012 13:25:28 | 1,504,293 | 07/05/2012 14:19:22 | 6 | 0 | Delete entire row when a column reaches 0? | So I have this database table "userDeck", with three columns: idUser, idCard, amount. Amount is a counter that keeps track of how many cards the user has added of a specific card. Right now I'm using this query:
$query1 = "UPDATE userDeck SET amount=amount-$amount WHERE idCard=$idCard";
$result2 = mysql_query($query1) or die(mysql_error());
when the user wants to delete cards he/she added.
This works just fine except it continues below 0 if you delete more cards than you have listed. I want it to remove the row when amount reaches 0. | mysql | sql | null | null | null | null | open | Delete entire row when a column reaches 0?
===
So I have this database table "userDeck", with three columns: idUser, idCard, amount. Amount is a counter that keeps track of how many cards the user has added of a specific card. Right now I'm using this query:
$query1 = "UPDATE userDeck SET amount=amount-$amount WHERE idCard=$idCard";
$result2 = mysql_query($query1) or die(mysql_error());
when the user wants to delete cards he/she added.
This works just fine except it continues below 0 if you delete more cards than you have listed. I want it to remove the row when amount reaches 0. | 0 |
11,542,494 | 07/18/2012 13:25:36 | 967,977 | 09/27/2011 21:49:29 | 34 | 0 | How should I incorporate SSH passwords into this code? | With a asp.net web page I need the user (the site will be on an intranet page) to be able to log into multiple UNIX systems to execute perl scripts. The user may only need to run the script once on a system.
I looked into creating a public/private key but since we will only be connecting (usually) once per system, it would be troublesome to do.
I also want to get the username and password through a JQuery UI Dialog that pops up when the user specifies that they want to connect to a UNIX system, and then pass that into what I need...if this is the route I will go.
| asp.net | vb.net | security | ssh | null | null | open | How should I incorporate SSH passwords into this code?
===
With a asp.net web page I need the user (the site will be on an intranet page) to be able to log into multiple UNIX systems to execute perl scripts. The user may only need to run the script once on a system.
I looked into creating a public/private key but since we will only be connecting (usually) once per system, it would be troublesome to do.
I also want to get the username and password through a JQuery UI Dialog that pops up when the user specifies that they want to connect to a UNIX system, and then pass that into what I need...if this is the route I will go.
| 0 |
11,524,756 | 07/17/2012 14:30:41 | 1,403,568 | 05/18/2012 14:11:27 | 26 | 0 | view in base.html django |
I have notification scrollbar like on fb or twitter. Top menu.html is directly included by base.html Unfortunatelly, I can use only User method there. Is it possible to not write in every view that I need notifications? I want to once paste in one view and have it always in top menu.html which is in base!
`from intarface import
menu_nots`
`nots = menu_nots(request)`
| python | django | view | null | null | null | open | view in base.html django
===
I have notification scrollbar like on fb or twitter. Top menu.html is directly included by base.html Unfortunatelly, I can use only User method there. Is it possible to not write in every view that I need notifications? I want to once paste in one view and have it always in top menu.html which is in base!
`from intarface import
menu_nots`
`nots = menu_nots(request)`
| 0 |
11,542,495 | 07/18/2012 13:25:41 | 902,144 | 08/19/2011 09:17:50 | 28 | 0 | Calling Enviroment in system() under Perl | Thank you for your time. I am trying to use a Perl script to add certain directories in a tool(wpj) we have. The direct command would look something like
wpj add path/to/desired/library makefile.wpj
I want to do a script to automate this since a lot of this has to be done. However, a very special set of environment variables among other things are setup to make 'wpj'. If I call wpj with backquotes from Perl, the call fails. You can see the code below
$command = "wpj add library path\\to\\file.wpj \\path\\to\\add";
print $command."\n";
$result = `$command`;
print "->".$result."\n";
For this I get
wpj: not found
However, the same call from the shell succeeds. Something is not correctly exported, could you please give me suggestions on how to export the calling enviroment into the subshell created by backquoutes? thank you.
| perl | path | environment | null | null | null | open | Calling Enviroment in system() under Perl
===
Thank you for your time. I am trying to use a Perl script to add certain directories in a tool(wpj) we have. The direct command would look something like
wpj add path/to/desired/library makefile.wpj
I want to do a script to automate this since a lot of this has to be done. However, a very special set of environment variables among other things are setup to make 'wpj'. If I call wpj with backquotes from Perl, the call fails. You can see the code below
$command = "wpj add library path\\to\\file.wpj \\path\\to\\add";
print $command."\n";
$result = `$command`;
print "->".$result."\n";
For this I get
wpj: not found
However, the same call from the shell succeeds. Something is not correctly exported, could you please give me suggestions on how to export the calling enviroment into the subshell created by backquoutes? thank you.
| 0 |
11,542,251 | 07/18/2012 13:13:18 | 127,735 | 06/23/2009 17:33:36 | 596 | 24 | hasAndBelongsToMany for two types of objects in same model on CakePHP | I have an object that has hasAndBelongsToMany of two kinds, but using the same holder table.
Let me try to explain:
I have an object called Task, the task can be done either by a user and a group of users.
so I have the tables: tasks, users, groups and taskowners.
The taskowners has these fields: id_task, id_owner, typeofowner(which is 1 for groups and 2 for users).
Could you give me an example of how to construct this model in cakephp?
I am kinda new to it.
Or should I create tasks, users, groups, taskgroups and taskusers? Theorically, the task can be owned only by these two, but I don't know if there will be more in the future, thats why the generic connection table.
Thanks,
Jonathan | php | cakephp | has-and-belongs-to-many | null | null | null | open | hasAndBelongsToMany for two types of objects in same model on CakePHP
===
I have an object that has hasAndBelongsToMany of two kinds, but using the same holder table.
Let me try to explain:
I have an object called Task, the task can be done either by a user and a group of users.
so I have the tables: tasks, users, groups and taskowners.
The taskowners has these fields: id_task, id_owner, typeofowner(which is 1 for groups and 2 for users).
Could you give me an example of how to construct this model in cakephp?
I am kinda new to it.
Or should I create tasks, users, groups, taskgroups and taskusers? Theorically, the task can be owned only by these two, but I don't know if there will be more in the future, thats why the generic connection table.
Thanks,
Jonathan | 0 |
11,542,502 | 07/18/2012 13:26:13 | 1,016,409 | 10/27/2011 11:55:37 | 62 | 3 | A simple play button for YouTube and JQuery | I want 2 simple buttons to play and stop a YouTube video. I tried something like this with jQuery and doesn't work.
1-Can anyone help me with a simple and clean solution to do a play button for a YouTube video?
2-Can I hide the video in order to just hear the sound?
http://codepen.io/anon/pen/Carwu
$(function(){
$("#escolta").click(function() {
$("#video").playVideo();
//$("#video").trigger('play');
//$(".player").playVideo()
});
$("#pausa").click(function() {
$("#video").trigger('pause');
});
});
CSS:
#escolta,#pausa{ font-family: Tahoma;letter-spacing:1px;font-size:11px;color: #666;width: 80px;text-align: center;height: 20px;line-height: 20px;background-color: #ccc;cursor: pointer;}
#escolta {position:absolute;top: 20px;left:20px;}
#pausa{position: absolute;top:20px;left: 150px;}
#pausa{position: absolute;top:20px;left: 150px;}
#video{position:absolute;top:100px;left:20px;}
HTML:
<div id="escolta">escolta</div>
<div id="pausa">pausa</div>
<iframe id="video" width="640" height="360" src="http://www.youtube.com/embed/4G1mundpq-Q?rel=0" frameborder="0" allowfullscreen></iframe> | jquery | youtube | youtube-api | null | null | null | open | A simple play button for YouTube and JQuery
===
I want 2 simple buttons to play and stop a YouTube video. I tried something like this with jQuery and doesn't work.
1-Can anyone help me with a simple and clean solution to do a play button for a YouTube video?
2-Can I hide the video in order to just hear the sound?
http://codepen.io/anon/pen/Carwu
$(function(){
$("#escolta").click(function() {
$("#video").playVideo();
//$("#video").trigger('play');
//$(".player").playVideo()
});
$("#pausa").click(function() {
$("#video").trigger('pause');
});
});
CSS:
#escolta,#pausa{ font-family: Tahoma;letter-spacing:1px;font-size:11px;color: #666;width: 80px;text-align: center;height: 20px;line-height: 20px;background-color: #ccc;cursor: pointer;}
#escolta {position:absolute;top: 20px;left:20px;}
#pausa{position: absolute;top:20px;left: 150px;}
#pausa{position: absolute;top:20px;left: 150px;}
#video{position:absolute;top:100px;left:20px;}
HTML:
<div id="escolta">escolta</div>
<div id="pausa">pausa</div>
<iframe id="video" width="640" height="360" src="http://www.youtube.com/embed/4G1mundpq-Q?rel=0" frameborder="0" allowfullscreen></iframe> | 0 |
11,542,503 | 07/18/2012 13:26:15 | 874,440 | 08/02/2011 10:51:29 | 356 | 6 | Android. Calling dismiss on a dialog | When you call `dismiss()` on a dialog, besides hiding it, does it also remove it from memory? Does it remove all the Objects that were placed inside the dialog, like `ImageViews`, `Buttons`, etc, from memory?
Is there a way i could free up the memory of these objects myself, and not wait for the Garbage Collector to do it's job? | android | null | null | null | null | null | open | Android. Calling dismiss on a dialog
===
When you call `dismiss()` on a dialog, besides hiding it, does it also remove it from memory? Does it remove all the Objects that were placed inside the dialog, like `ImageViews`, `Buttons`, etc, from memory?
Is there a way i could free up the memory of these objects myself, and not wait for the Garbage Collector to do it's job? | 0 |
11,542,505 | 07/18/2012 13:26:18 | 184,883 | 10/06/2009 10:00:49 | 4,686 | 235 | Get the last hash after the hash has changed | I've a backbone app where I wanna open an overlay wich is just a page with its on url. You can also navigate in this overlay with different pages/urls. So when the overlay is closed I wanna set back the hash to the state before the overlay was opened. As the overlay is opened by a link I can't get the hash from the state before.
So is there a way to get the previous hash when a hash changed? | javascript | backbone.js | browser-history | null | null | null | open | Get the last hash after the hash has changed
===
I've a backbone app where I wanna open an overlay wich is just a page with its on url. You can also navigate in this overlay with different pages/urls. So when the overlay is closed I wanna set back the hash to the state before the overlay was opened. As the overlay is opened by a link I can't get the hash from the state before.
So is there a way to get the previous hash when a hash changed? | 0 |
11,542,448 | 07/18/2012 13:23:32 | 1,321,497 | 04/09/2012 08:51:46 | 43 | 3 | How to get "local address book" in Name Picker? | We have a name picker in **Xpages** which should get the values from current server's NAB & local address book .
Our code to get values from server's NAB is working fine.
But i don't know how to write for "Local Address Book"
i tried with ("") & others for server name , no luck.
Can any one tell me how should i give the server name in dblookup?
Thanks | xpages | null | null | null | null | null | open | How to get "local address book" in Name Picker?
===
We have a name picker in **Xpages** which should get the values from current server's NAB & local address book .
Our code to get values from server's NAB is working fine.
But i don't know how to write for "Local Address Book"
i tried with ("") & others for server name , no luck.
Can any one tell me how should i give the server name in dblookup?
Thanks | 0 |
11,542,451 | 07/18/2012 13:23:42 | 1,530,197 | 07/16/2012 22:17:06 | 8 | 0 | can't access listBox1 | I have listBox1 but when I am using that listBox1 inside the buttonClick I can access but outside the buttonClick I can't access .
Where I am doing mistakes ? Thanks
namespace design
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Add(button1.Text);// I can access listBox1 here...
}
listBox1.//I can't access listBox1 here....
}
}
| c# | accessibility | null | null | null | null | open | can't access listBox1
===
I have listBox1 but when I am using that listBox1 inside the buttonClick I can access but outside the buttonClick I can't access .
Where I am doing mistakes ? Thanks
namespace design
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button4_Click(object sender, EventArgs e)
{
listBox1.Items.Add(button1.Text);// I can access listBox1 here...
}
listBox1.//I can't access listBox1 here....
}
}
| 0 |
4,662,926 | 01/11/2011 21:36:43 | 238,660 | 12/25/2009 19:40:44 | 58 | 0 | Can I have my UITableView detect and respond to a swipe jesture? | I don't want the swipe to delete the row but do something else.
What code do I need to add to the UITableViewController to have that happen | uitableview | iphone-sdk-3.0 | swipe | null | null | null | open | Can I have my UITableView detect and respond to a swipe jesture?
===
I don't want the swipe to delete the row but do something else.
What code do I need to add to the UITableViewController to have that happen | 0 |
11,350,993 | 07/05/2012 19:12:58 | 1,504,953 | 07/05/2012 19:01:22 | 1 | 0 | Using JQuery loop to alternate image scr | Okay so I have an image (id = "slideshow") in my content section of my site. I'm trying to create a loop that alternates the image src using JQuery. Here is the code I have so far. It seems to loop through but the only src change that it shows is the last one. As a result glossy.jpg is the only image I see. I know it must be working to some extent seeing as glossy.jpg is not the original src that I have set. Once I get each picture to show I'll tidy up the rest of the code. Any answers are much appreciated =)
$(document).ready(function() {
for (i = 1; i <= 100; i++){
$("#slideshow").attr("src", "Images/image1.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
$("#slideshow").attr("src", "Images/image2.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
$("#slideshow").attr("src", "Images/glossy1.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
}
}); | jquery | image | loops | src | null | null | open | Using JQuery loop to alternate image scr
===
Okay so I have an image (id = "slideshow") in my content section of my site. I'm trying to create a loop that alternates the image src using JQuery. Here is the code I have so far. It seems to loop through but the only src change that it shows is the last one. As a result glossy.jpg is the only image I see. I know it must be working to some extent seeing as glossy.jpg is not the original src that I have set. Once I get each picture to show I'll tidy up the rest of the code. Any answers are much appreciated =)
$(document).ready(function() {
for (i = 1; i <= 100; i++){
$("#slideshow").attr("src", "Images/image1.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
$("#slideshow").attr("src", "Images/image2.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
$("#slideshow").attr("src", "Images/glossy1.jpg").fadeTo(3000, 1.00);
$("#slideshow").fadeTo("slow", 0.00);
}
}); | 0 |
11,350,999 | 07/05/2012 19:13:34 | 640,694 | 03/02/2011 06:47:05 | 16 | 0 | C# How to correctly unload the class from memory? | I'm developing a solution where a service runs continuously in background, and plugin DLLs can be added/deleted at runtime. The service would load the necessary plugins when needed, run them and unload them. This is the unloading part is what currently gives me trouble: once certain class is successfully loaded first time (variable tc), it never is reloaded, even though the DLL file is updated. I think I am not unloading the class/assembly/appdomain properly, so I'd appreciate some advice for walking this last mile.
using System;
using System.Reflection;
namespace TestMonoConsole
{
public interface ITestClass
{
void Talk();
}
class MainClass
{
public static void Main (string[] args)
{
string pluginPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string classAssembly = "TestClass";
string className = "TestMonoConsole.TestClass";
string command = "";
do
{
System.AppDomain domain = System.AppDomain.CreateDomain(classAssembly);
Assembly pluginAssembly = null;
try
{
string pluginAssemblyFile = pluginPath + "/" + classAssembly + ".dll";
System.IO.StreamReader reader = new System.IO.StreamReader(pluginAssemblyFile, System.Text.Encoding.GetEncoding(1252), false);
byte[] b = new byte[reader.BaseStream.Length];
reader.BaseStream.Read(b, 0, System.Convert.ToInt32(reader.BaseStream.Length));
domain.Load(b);
System.Reflection.Assembly[] da = domain.GetAssemblies();
foreach (System.Reflection.Assembly a in da)
{
if (a.GetName().Name == classAssembly)
{
pluginAssembly = a;
}
}
reader.Close();
}
catch (System.IO.FileNotFoundException e)
{
Console.WriteLine (String.Format("Error loading plugin: assembly {0} not found", classAssembly));
pluginAssembly = null;
}
Console.WriteLine (String.Format("Assembly loaded: {0}", pluginAssembly == null ? "error" : "Ok"));
if (pluginAssembly != null)
{
Type pluginType = pluginAssembly.GetType(className);
Console.WriteLine (String.Format("type loaded: {0}", pluginType == null ? "error" : "Ok"));
if (pluginType != null)
{
ITestClass tc = (ITestClass) Activator.CreateInstance(pluginType);
tc.Talk();
}
}
System.AppDomain.Unload(domain);
domain = null;
command = Console.ReadLine();
} while (command == "");
}
}
} | c# | dynamic | assembly | loading | null | null | open | C# How to correctly unload the class from memory?
===
I'm developing a solution where a service runs continuously in background, and plugin DLLs can be added/deleted at runtime. The service would load the necessary plugins when needed, run them and unload them. This is the unloading part is what currently gives me trouble: once certain class is successfully loaded first time (variable tc), it never is reloaded, even though the DLL file is updated. I think I am not unloading the class/assembly/appdomain properly, so I'd appreciate some advice for walking this last mile.
using System;
using System.Reflection;
namespace TestMonoConsole
{
public interface ITestClass
{
void Talk();
}
class MainClass
{
public static void Main (string[] args)
{
string pluginPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string classAssembly = "TestClass";
string className = "TestMonoConsole.TestClass";
string command = "";
do
{
System.AppDomain domain = System.AppDomain.CreateDomain(classAssembly);
Assembly pluginAssembly = null;
try
{
string pluginAssemblyFile = pluginPath + "/" + classAssembly + ".dll";
System.IO.StreamReader reader = new System.IO.StreamReader(pluginAssemblyFile, System.Text.Encoding.GetEncoding(1252), false);
byte[] b = new byte[reader.BaseStream.Length];
reader.BaseStream.Read(b, 0, System.Convert.ToInt32(reader.BaseStream.Length));
domain.Load(b);
System.Reflection.Assembly[] da = domain.GetAssemblies();
foreach (System.Reflection.Assembly a in da)
{
if (a.GetName().Name == classAssembly)
{
pluginAssembly = a;
}
}
reader.Close();
}
catch (System.IO.FileNotFoundException e)
{
Console.WriteLine (String.Format("Error loading plugin: assembly {0} not found", classAssembly));
pluginAssembly = null;
}
Console.WriteLine (String.Format("Assembly loaded: {0}", pluginAssembly == null ? "error" : "Ok"));
if (pluginAssembly != null)
{
Type pluginType = pluginAssembly.GetType(className);
Console.WriteLine (String.Format("type loaded: {0}", pluginType == null ? "error" : "Ok"));
if (pluginType != null)
{
ITestClass tc = (ITestClass) Activator.CreateInstance(pluginType);
tc.Talk();
}
}
System.AppDomain.Unload(domain);
domain = null;
command = Console.ReadLine();
} while (command == "");
}
}
} | 0 |
11,351,000 | 07/05/2012 19:13:43 | 1,456,149 | 06/14/2012 12:00:04 | 3 | 0 | xsl Template match | I am creating xml using xsl with xml
Here is the code for XML
<?xml version="1.0" encoding="utf-8"?>
<example>
<sample>245 34</sample>
<sample1>24 36</sample1>
</example>
With the help of XSL I want to split the xml value
When i am checking in google i saw there is a method we can use substring-before or substring-after(query)
but i am little confused how to bring the values like below
<example>
<text>245</text>
<text>34</text
<text>24</text>
<text>36</text>
</example>
Could any one help me how to bring the value as above
Thanks
m
| xml | xslt | null | null | null | null | open | xsl Template match
===
I am creating xml using xsl with xml
Here is the code for XML
<?xml version="1.0" encoding="utf-8"?>
<example>
<sample>245 34</sample>
<sample1>24 36</sample1>
</example>
With the help of XSL I want to split the xml value
When i am checking in google i saw there is a method we can use substring-before or substring-after(query)
but i am little confused how to bring the values like below
<example>
<text>245</text>
<text>34</text
<text>24</text>
<text>36</text>
</example>
Could any one help me how to bring the value as above
Thanks
m
| 0 |
11,351,002 | 07/05/2012 19:13:44 | 965,856 | 09/26/2011 21:18:01 | 98 | 2 | jsf richfaces insert only numbers | this is what i have atm:
<h:outputLabel value="#{locale.nroEmployees}:"/>
<h:inputText value="#{companyEditBean.companyEmployeesAmount}"
disabled="#{not companyEditBean.editingAllowed}">
</h:inputText>
is it possible by any chance to only allow user to insert numbers?
Regards. | java | jsf | richfaces | null | null | null | open | jsf richfaces insert only numbers
===
this is what i have atm:
<h:outputLabel value="#{locale.nroEmployees}:"/>
<h:inputText value="#{companyEditBean.companyEmployeesAmount}"
disabled="#{not companyEditBean.editingAllowed}">
</h:inputText>
is it possible by any chance to only allow user to insert numbers?
Regards. | 0 |
11,351,006 | 07/05/2012 19:14:00 | 136,946 | 07/10/2009 15:38:39 | 101 | 11 | Extract minutes and seconds (ex '02m12s') from YouTube URL param | Best way to extract the minutes and seconds from youtube urls?
http://www.youtube.com/watch?v=TjTbNWhsG28#t=1m40s&foo=1&bar=2
where '1m40s' is the string i need and either '#t=' or '&t=' may be used.
could be at the end too (or in middle but unlikely. i will rule that one out)
http://www.youtube.com/watch?v=TjTbNWhsG28?foo=1&bar=2#t=1m40s
'x' in 'xmxs' can be a one or two digit number and only one of them might be passed
"#t=10m3s" or
"&t=09m12s"
and they are each optional as in
"#t=10m" or
"&t=3s" or
"#t=10m03"s
YouTube now accepts '#t=' as well as '&t=' for this param so ideally I need to consider both. Users will be pasting these into the comments section of a blog and the output generates the embed. The script I am currently using does not parse these time values.
Once I know the minutes and seconds I will pass the total seconds on to the script that generates embed code using the 'start' param.
https://developers.google.com/youtube/player_parameters#start
I need a php solution. I assume a nice combination of substr() and regex.
| php | regex | string | youtube | null | null | open | Extract minutes and seconds (ex '02m12s') from YouTube URL param
===
Best way to extract the minutes and seconds from youtube urls?
http://www.youtube.com/watch?v=TjTbNWhsG28#t=1m40s&foo=1&bar=2
where '1m40s' is the string i need and either '#t=' or '&t=' may be used.
could be at the end too (or in middle but unlikely. i will rule that one out)
http://www.youtube.com/watch?v=TjTbNWhsG28?foo=1&bar=2#t=1m40s
'x' in 'xmxs' can be a one or two digit number and only one of them might be passed
"#t=10m3s" or
"&t=09m12s"
and they are each optional as in
"#t=10m" or
"&t=3s" or
"#t=10m03"s
YouTube now accepts '#t=' as well as '&t=' for this param so ideally I need to consider both. Users will be pasting these into the comments section of a blog and the output generates the embed. The script I am currently using does not parse these time values.
Once I know the minutes and seconds I will pass the total seconds on to the script that generates embed code using the 'start' param.
https://developers.google.com/youtube/player_parameters#start
I need a php solution. I assume a nice combination of substr() and regex.
| 0 |
11,351,008 | 07/05/2012 19:14:01 | 1,504,926 | 07/05/2012 18:48:07 | 1 | 0 | How to return IDispatch pointer to JavaScript inside a webkit browser control | I've been able to embed webkit control into a windows (c++) application, and registered my custom object for javascript to access (using JSGlobalContextRef, JSObjectMake etc.). Successfully tested calls from JavaScript to c++ layer for simple methods that returns string or int.
Now i want to expose one custom method that would internally use a COM library & ultimately return a IDispatch pointer (wrapped as VARIANT or otherwise). How to I convert IDispatch pointer to JSValueRef, JSObjectRef or anything else that JavaScript (inside webkit) would understand ?
In the IE browser control world, I could simply expose the IDispatch via the "getExternal" (IDocHostUIHandler interface) or even wrap it up in a VARIANT and return as Out-Param of any other API inside the custom "external" object.
| c++ | windows | com | webkit | control | null | open | How to return IDispatch pointer to JavaScript inside a webkit browser control
===
I've been able to embed webkit control into a windows (c++) application, and registered my custom object for javascript to access (using JSGlobalContextRef, JSObjectMake etc.). Successfully tested calls from JavaScript to c++ layer for simple methods that returns string or int.
Now i want to expose one custom method that would internally use a COM library & ultimately return a IDispatch pointer (wrapped as VARIANT or otherwise). How to I convert IDispatch pointer to JSValueRef, JSObjectRef or anything else that JavaScript (inside webkit) would understand ?
In the IE browser control world, I could simply expose the IDispatch via the "getExternal" (IDocHostUIHandler interface) or even wrap it up in a VARIANT and return as Out-Param of any other API inside the custom "external" object.
| 0 |
11,351,010 | 07/05/2012 19:14:10 | 1,504,924 | 07/05/2012 18:47:24 | 1 | 0 | Javascript and Raphael.js Custom Class for draing Donut Charts | I am new to javascript and Raphael.js so bare with me please. I am working on a project that requires a circular user interface. The interface will be created using Raphael.js to create rings(donut chart style) with each section being a menu item. When selected the a new ring will be generated with the number of selections needed for the next task.
So the problem I have is creating the actual javascript class to do this. As separate functions it works great but it's not very efficient. How do I call the new object and get the ring to show up on the screen? here is the code i am using:
var paper = Raphael('paper', 600, 600);
function RingObj(centerX, centerY, innerR, outerR, startAngle, endAngle, sections) {
this.centerX = centerX;
this.centerY = centerY;
this.innerR = innerR;
this.outerR = outerR;
this.startAngle = startAngle;
this.endAngle = endAngle;
this.sections = sections;
this.donutRing = function(){
this.endAngle = 360 / this.sections;
this.endAng = this.endAngle;
paper.setStart();
for (i = 1; i <= this.sections; i++){
this.arc = function(){
radians = Math.PI / 180,
largeArc = +(this.endAngle - this.startAngle > 180);
outerX1 = this.centerX + this.outerR * Math.cos((this.startAngle-90) * radians),
outerY1 = this.centerY + this.outerR * Math.sin((this.startAngle-90) * radians),
outerX2 = this.centerX + this.outerR * Math.cos((this.endAngle-90) * radians),
outerY2 = this.centerY + this.outerR * Math.sin((this.endAngle-90) * radians),
innerX1 = this.centerX + this.innerR * Math.cos((this.endAngle-90) * radians),
innerY1 = this.centerY + this.innerR * Math.sin((this.endAngle-90) * radians),
innerX2 = this.centerX + this.innerR * Math.cos((this.startAngle-90) * radians),
innerY2 = this.centerY + this.innerR * Math.sin((this.startAngle-90) * radians);
// build the path array
this.path = [
["M", outerX1, outerY1], //move to the start point
["A", outerR, outerR, 0, largeArc, 1, outerX2, outerY2],
["L", innerX1, innerY1],
["A", innerR, innerR, 0, largeArc, 0, innerX2, innerY2],
["z"] //close the path
];
return this.path;
};
this.ringpath = paper.path(this.arc);
this.startAngle = this.endAngle;
this.endAngle = this.endAngle + this.endAng;
}
this.ringP = paper.setFinish();
this.ringP.attr({
fill :'#f60',
stroke: '#eee'
});
return this.ringP;
};
};
var Ring = new RingObj (300, 300, 65, 125, 0, 45, 8);
| javascript | class | methods | scope | raphael | null | open | Javascript and Raphael.js Custom Class for draing Donut Charts
===
I am new to javascript and Raphael.js so bare with me please. I am working on a project that requires a circular user interface. The interface will be created using Raphael.js to create rings(donut chart style) with each section being a menu item. When selected the a new ring will be generated with the number of selections needed for the next task.
So the problem I have is creating the actual javascript class to do this. As separate functions it works great but it's not very efficient. How do I call the new object and get the ring to show up on the screen? here is the code i am using:
var paper = Raphael('paper', 600, 600);
function RingObj(centerX, centerY, innerR, outerR, startAngle, endAngle, sections) {
this.centerX = centerX;
this.centerY = centerY;
this.innerR = innerR;
this.outerR = outerR;
this.startAngle = startAngle;
this.endAngle = endAngle;
this.sections = sections;
this.donutRing = function(){
this.endAngle = 360 / this.sections;
this.endAng = this.endAngle;
paper.setStart();
for (i = 1; i <= this.sections; i++){
this.arc = function(){
radians = Math.PI / 180,
largeArc = +(this.endAngle - this.startAngle > 180);
outerX1 = this.centerX + this.outerR * Math.cos((this.startAngle-90) * radians),
outerY1 = this.centerY + this.outerR * Math.sin((this.startAngle-90) * radians),
outerX2 = this.centerX + this.outerR * Math.cos((this.endAngle-90) * radians),
outerY2 = this.centerY + this.outerR * Math.sin((this.endAngle-90) * radians),
innerX1 = this.centerX + this.innerR * Math.cos((this.endAngle-90) * radians),
innerY1 = this.centerY + this.innerR * Math.sin((this.endAngle-90) * radians),
innerX2 = this.centerX + this.innerR * Math.cos((this.startAngle-90) * radians),
innerY2 = this.centerY + this.innerR * Math.sin((this.startAngle-90) * radians);
// build the path array
this.path = [
["M", outerX1, outerY1], //move to the start point
["A", outerR, outerR, 0, largeArc, 1, outerX2, outerY2],
["L", innerX1, innerY1],
["A", innerR, innerR, 0, largeArc, 0, innerX2, innerY2],
["z"] //close the path
];
return this.path;
};
this.ringpath = paper.path(this.arc);
this.startAngle = this.endAngle;
this.endAngle = this.endAngle + this.endAng;
}
this.ringP = paper.setFinish();
this.ringP.attr({
fill :'#f60',
stroke: '#eee'
});
return this.ringP;
};
};
var Ring = new RingObj (300, 300, 65, 125, 0, 45, 8);
| 0 |
11,351,011 | 07/05/2012 19:14:12 | 1,031,701 | 11/06/2011 00:31:48 | 78 | 6 | c# DirectoryInfo.GetFiles by generic mime type | Is there a way to get files by generic mime types?
Example: For all the images ("image/png, image/jpeg, ..."):
DirectoryInfo.GetFiles("image") | c# | null | null | null | null | null | open | c# DirectoryInfo.GetFiles by generic mime type
===
Is there a way to get files by generic mime types?
Example: For all the images ("image/png, image/jpeg, ..."):
DirectoryInfo.GetFiles("image") | 0 |
11,447,042 | 07/12/2012 07:34:37 | 558,639 | 03/30/2010 23:26:32 | 2,362 | 52 | Rails / Delayed::Job tasks are gobbling up VM | [Prescript: I know that nothing here is specific to Delayed::Job. But it helps establish the context.]
I have delayed tasks that slurp data from the web and create records in a PostgreSQL database. They seem to be working okay, but they start at vmemsize=100M and within ten minutes bulk up to vmemsize=500M and just keeps growing. My MacBook Pro with 8G of RAM starts thrashing when the VM runs out.
How can I find where the memory is going?
Before you refer me to other SO posts on the topic:
I've added the following to my #after(job) method:
def after(job)
clss = [Object, String, Array, Hash, ActiveRecord::Base, ActiveRecord::Relation]
clss.each {|cls| object_report(cls, " pre-gc")}
ObjectSpace.each_object(ActiveRecord::Relation).each(&:reset)
GC.start
clss.each {|cls| object_report(cls, "post-gc")}
end
def object_report(cls, msg)
log(sprintf("%s: %9d %s", msg, ObjectSpace.each_object(cls).count, cls))
end
It reports usage on the fundamental classes, explicitly resets ActiveRecord::Relation objects (suggested by [this SO post](http://stackoverflow.com/questions/11149837)), explicitly does a GC (as suggested by [this SO post](http://stackoverflow.com/questions/7278454)), and reports on how many Objects / Strings / Arrays / Hashes, etc there are (as suggested by [this SO post](http://stackoverflow.com/questions/3839262/)). For what it's worth, none of those classes are growing significantly. (Are there other classes I should be looking at? But wouldn't that be reflected in the number of Objects anyway?)
I can't use [memprof](https://github.com/ice799/memprof) because I'm running Ruby 1.9.
And there are other tools that I'd consider if I were running on Linux, but I'm on OS X.
| ruby-on-rails-3 | memory-leaks | delayed-job | null | null | null | open | Rails / Delayed::Job tasks are gobbling up VM
===
[Prescript: I know that nothing here is specific to Delayed::Job. But it helps establish the context.]
I have delayed tasks that slurp data from the web and create records in a PostgreSQL database. They seem to be working okay, but they start at vmemsize=100M and within ten minutes bulk up to vmemsize=500M and just keeps growing. My MacBook Pro with 8G of RAM starts thrashing when the VM runs out.
How can I find where the memory is going?
Before you refer me to other SO posts on the topic:
I've added the following to my #after(job) method:
def after(job)
clss = [Object, String, Array, Hash, ActiveRecord::Base, ActiveRecord::Relation]
clss.each {|cls| object_report(cls, " pre-gc")}
ObjectSpace.each_object(ActiveRecord::Relation).each(&:reset)
GC.start
clss.each {|cls| object_report(cls, "post-gc")}
end
def object_report(cls, msg)
log(sprintf("%s: %9d %s", msg, ObjectSpace.each_object(cls).count, cls))
end
It reports usage on the fundamental classes, explicitly resets ActiveRecord::Relation objects (suggested by [this SO post](http://stackoverflow.com/questions/11149837)), explicitly does a GC (as suggested by [this SO post](http://stackoverflow.com/questions/7278454)), and reports on how many Objects / Strings / Arrays / Hashes, etc there are (as suggested by [this SO post](http://stackoverflow.com/questions/3839262/)). For what it's worth, none of those classes are growing significantly. (Are there other classes I should be looking at? But wouldn't that be reflected in the number of Objects anyway?)
I can't use [memprof](https://github.com/ice799/memprof) because I'm running Ruby 1.9.
And there are other tools that I'd consider if I were running on Linux, but I'm on OS X.
| 0 |
11,500,128 | 07/16/2012 07:51:21 | 978,320 | 10/04/2011 11:30:54 | 84 | 0 | Python set filemode in logging configuration file | I am trying to config the loggers in a text configuration file using Python. Here is partial content:
[logger_root]
handlers=result
level=NOTSET
[handler_result]
class=handlers.TimedRotatingFileHandler
interval=midnight
backupCount=5
formatter=simple
level=DEBUG
args=('result_log.txt')
I would like to rewrite the log file every time I run the system. But not know how to set it in the file. I try this but fails:
args=('result_log.txt',filemode='w')
A lot of articles talk about how to set it from the Python code. But I would like to set it in the file. How to do it? Thanks. | python | null | null | null | null | null | open | Python set filemode in logging configuration file
===
I am trying to config the loggers in a text configuration file using Python. Here is partial content:
[logger_root]
handlers=result
level=NOTSET
[handler_result]
class=handlers.TimedRotatingFileHandler
interval=midnight
backupCount=5
formatter=simple
level=DEBUG
args=('result_log.txt')
I would like to rewrite the log file every time I run the system. But not know how to set it in the file. I try this but fails:
args=('result_log.txt',filemode='w')
A lot of articles talk about how to set it from the Python code. But I would like to set it in the file. How to do it? Thanks. | 0 |
11,500,143 | 07/16/2012 07:52:49 | 1,120,454 | 12/29/2011 04:35:05 | 33 | 1 | Sqlite union and sort order | select 'none', '0' union select * from category where id='2'
Can I retrieve the output of above sqlite query as 'none' should always be the first item ?, ie I want to block from a combined sort of two resultsets. plz help... | sql | sqlite | null | null | null | null | open | Sqlite union and sort order
===
select 'none', '0' union select * from category where id='2'
Can I retrieve the output of above sqlite query as 'none' should always be the first item ?, ie I want to block from a combined sort of two resultsets. plz help... | 0 |
11,500,147 | 07/16/2012 07:53:06 | 1,293,807 | 03/26/2012 19:06:53 | 548 | 51 | how to convert Nsstring to Nsdate with time | > possibly many duplicate "convert nsstring to nsdate" in stackflow. but i want
> convert nsstring to nsdate with time..
NSString *myDateIs= @"2012-07-14 11:30:40 AM ";
NSDateFormatter* startTimeFormat = [[NSDateFormatter alloc] init];
[startTimeFormat setDateFormat:@"YYYY-MM-dd hh:mm:ss a "];
NSDate*newStartTime = [startTimeFormat dateFromString:myDateIs];
> and i am getting output is : 2012-07-14 06:00:40 +0000 date is correct but time is not correct.
how can i get correct time.. ?
Thanks
| objective-c | ios | nsstring | nsdate | null | null | open | how to convert Nsstring to Nsdate with time
===
> possibly many duplicate "convert nsstring to nsdate" in stackflow. but i want
> convert nsstring to nsdate with time..
NSString *myDateIs= @"2012-07-14 11:30:40 AM ";
NSDateFormatter* startTimeFormat = [[NSDateFormatter alloc] init];
[startTimeFormat setDateFormat:@"YYYY-MM-dd hh:mm:ss a "];
NSDate*newStartTime = [startTimeFormat dateFromString:myDateIs];
> and i am getting output is : 2012-07-14 06:00:40 +0000 date is correct but time is not correct.
how can i get correct time.. ?
Thanks
| 0 |
11,500,155 | 07/16/2012 07:53:35 | 1,307,879 | 04/02/2012 11:19:40 | 18 | 1 | WebDriver close Internet Explorer after test | I'm running **WebDriver** tests in **Ruby** and I've got a problem with closing **Internet Explorer** browser: when I suppose to close browser's window, IE pop-ups with the prompt "**Are you sure want to leave this page**" and two options are available "Leave this page" and "Stay on this page".
I've tried several methods for closing browser, both without success:
driver.quit
driver.close
Also WebDriver doesn't recognize this pop-up as JavaScript pop-up so
driver.alert.ok
driver.switch_to.alert
methods are also not applicable.
I'm using **IE9** and **IEDriverServerx86 v. 2.24.2**
I appreciate any help you can provide | ruby | internet-explorer | webdriver | null | null | null | open | WebDriver close Internet Explorer after test
===
I'm running **WebDriver** tests in **Ruby** and I've got a problem with closing **Internet Explorer** browser: when I suppose to close browser's window, IE pop-ups with the prompt "**Are you sure want to leave this page**" and two options are available "Leave this page" and "Stay on this page".
I've tried several methods for closing browser, both without success:
driver.quit
driver.close
Also WebDriver doesn't recognize this pop-up as JavaScript pop-up so
driver.alert.ok
driver.switch_to.alert
methods are also not applicable.
I'm using **IE9** and **IEDriverServerx86 v. 2.24.2**
I appreciate any help you can provide | 0 |
11,500,068 | 07/16/2012 07:47:36 | 1,468,468 | 06/20/2012 07:38:58 | 8 | 0 | Decision tree : switch vs functions | I have to evaluate a decision tree. This tree has a template parameter (called EvalStrategy). Depending on the strategy, a node could fail this evaluation, and "bailout".
In this case, it must be called with a better stragtegy. But the previous computed nodes remain valid.
The first idea i had was using nested switchs :
enum Exbool { TRUE = 0, FALSE = 1, UNDEF = -1 };
template <class STRATEGY>
Exbool evalNode1(args..., ResultCache &Cache);
template <class STRATEGY>
Exbool evalNode2(args..., ResultCache &Cache);
etc
template <class STRATEGY>
Exbool evalTree(args..., ResultCaches &Caches) {
switch(evalNode1<STRATEGY>(args, Cache.Node1)) {
case UNDEF:
return UNDEF;
case TRUE:
switch(EvalNode2<STRATEGY>(args, Cache.Node2)) {
...
}
A cache structure is used to store results, and calling evalStree with another strategy can use the cache to evaluate the nodes. But it needs to test each nodes which were already tested in a previous call with a weaker strategy. Not optimal.
Another idea uses functions calls :
template <class STRATEGY>
Exbool Node0(args...) {
switch(EvalNode1<STRATEGY>(args)) {
case UNDEF:
return UNDEF;
case TRUE;
return Node1<STRATEGY>(args...);
...
}
and
template <class STRATEGY>
Exbool Node1(args...) {
switch(EvalNode2<STRATEGY>(args)) {
...
}
Then, after bailout, it can be calls at the nodes which were invalidated, without re-evaluating all of the tree.
But how ? Function pointers do not work with templates. | c++ | templates | null | null | null | null | open | Decision tree : switch vs functions
===
I have to evaluate a decision tree. This tree has a template parameter (called EvalStrategy). Depending on the strategy, a node could fail this evaluation, and "bailout".
In this case, it must be called with a better stragtegy. But the previous computed nodes remain valid.
The first idea i had was using nested switchs :
enum Exbool { TRUE = 0, FALSE = 1, UNDEF = -1 };
template <class STRATEGY>
Exbool evalNode1(args..., ResultCache &Cache);
template <class STRATEGY>
Exbool evalNode2(args..., ResultCache &Cache);
etc
template <class STRATEGY>
Exbool evalTree(args..., ResultCaches &Caches) {
switch(evalNode1<STRATEGY>(args, Cache.Node1)) {
case UNDEF:
return UNDEF;
case TRUE:
switch(EvalNode2<STRATEGY>(args, Cache.Node2)) {
...
}
A cache structure is used to store results, and calling evalStree with another strategy can use the cache to evaluate the nodes. But it needs to test each nodes which were already tested in a previous call with a weaker strategy. Not optimal.
Another idea uses functions calls :
template <class STRATEGY>
Exbool Node0(args...) {
switch(EvalNode1<STRATEGY>(args)) {
case UNDEF:
return UNDEF;
case TRUE;
return Node1<STRATEGY>(args...);
...
}
and
template <class STRATEGY>
Exbool Node1(args...) {
switch(EvalNode2<STRATEGY>(args)) {
...
}
Then, after bailout, it can be calls at the nodes which were invalidated, without re-evaluating all of the tree.
But how ? Function pointers do not work with templates. | 0 |
11,650,997 | 07/25/2012 13:36:05 | 1,486,579 | 06/27/2012 18:24:23 | 16 | 1 | WebResource.axd and ScriptResource.axd Get Method Failed | I have been searching around here and elsewhere on the internet searching for a solution, and have wasted too much time on this. Keep in mind I am fairly new to web design and am self taught. It is possible I just completely missing something.
When I click the but who calls the CallMeMaybe() function I will get the "Starting 1" and "passed test 1" alerts only. So my pagemethods gethello() I am assuming is not getting called, or at least not doing anything.
function CallMeMaybe() {
var dest;
// call server side method
alert("Starting 1");
if (typeof (PageMethods) == "undefined") {
alert("Not Working");
}
else {
alert("passed test 1");
var prm = Sys.WebForms.PageRequestManager.getInstance();
PageMethods.GetHello(CallSuccess, CallFailed, dest);
}
alert("Sent");
}
function CallSuccess(res, destCtrl) {
alert("success");
var dest = document.getElementById(destCtrl);
alert(res);
var str = "";
var table_result = "<table border='1'>";
for (var i = 1; i < res.length - 1; i++) {
str += (res[i] + "<br />");
table_result += "<tr><td><img src='Images/img" + i + ".jpg' alt='' width='100' height='100'/></td></tr>";
}
table_result += "</table>";
//document.querySelector('#results').innerHTML += str;
document.querySelector('#results').innerHTML += table_result;
}
// alert message on some failure
function CallFailed(res, destCtrl) {
alert(res.get_message());
}
When I run the Developer Tools in Chrome I get this:
![Screen Shot][1]
If any of you could help me or point me into the right direction that would be awesome! Like I said I have wasted too much time trying to figure this out and finally decided to come here to ask for help.
[1]: http://i.stack.imgur.com/p3peX.png | asp.net | get | webresource.axd | sys | scriptresource.axd | null | open | WebResource.axd and ScriptResource.axd Get Method Failed
===
I have been searching around here and elsewhere on the internet searching for a solution, and have wasted too much time on this. Keep in mind I am fairly new to web design and am self taught. It is possible I just completely missing something.
When I click the but who calls the CallMeMaybe() function I will get the "Starting 1" and "passed test 1" alerts only. So my pagemethods gethello() I am assuming is not getting called, or at least not doing anything.
function CallMeMaybe() {
var dest;
// call server side method
alert("Starting 1");
if (typeof (PageMethods) == "undefined") {
alert("Not Working");
}
else {
alert("passed test 1");
var prm = Sys.WebForms.PageRequestManager.getInstance();
PageMethods.GetHello(CallSuccess, CallFailed, dest);
}
alert("Sent");
}
function CallSuccess(res, destCtrl) {
alert("success");
var dest = document.getElementById(destCtrl);
alert(res);
var str = "";
var table_result = "<table border='1'>";
for (var i = 1; i < res.length - 1; i++) {
str += (res[i] + "<br />");
table_result += "<tr><td><img src='Images/img" + i + ".jpg' alt='' width='100' height='100'/></td></tr>";
}
table_result += "</table>";
//document.querySelector('#results').innerHTML += str;
document.querySelector('#results').innerHTML += table_result;
}
// alert message on some failure
function CallFailed(res, destCtrl) {
alert(res.get_message());
}
When I run the Developer Tools in Chrome I get this:
![Screen Shot][1]
If any of you could help me or point me into the right direction that would be awesome! Like I said I have wasted too much time trying to figure this out and finally decided to come here to ask for help.
[1]: http://i.stack.imgur.com/p3peX.png | 0 |
10,868,977 | 06/03/2012 08:39:18 | 1,395,873 | 05/15/2012 10:16:05 | 34 | 0 | pdf reader for iPhone | I'm new in iPhone, I want to create application to open pdf document like Adobe Reader
and contain many features like:
- sets and gets bookmarks
- allows user to add comments in any paragraph
- allows user to add highlight
- allows for the search for a word (supporting Arabic and English)
- allows for leaves movement (optional)
is there is any code to do this?
Note: I tried fastpdfkit but it is not allows to add comments and highlight and not support arabic search | iphone | objective-c | ios | ipad | null | null | open | pdf reader for iPhone
===
I'm new in iPhone, I want to create application to open pdf document like Adobe Reader
and contain many features like:
- sets and gets bookmarks
- allows user to add comments in any paragraph
- allows user to add highlight
- allows for the search for a word (supporting Arabic and English)
- allows for leaves movement (optional)
is there is any code to do this?
Note: I tried fastpdfkit but it is not allows to add comments and highlight and not support arabic search | 0 |
11,651,116 | 07/25/2012 13:42:22 | 1,542,067 | 02/09/2012 18:40:12 | 8 | 1 | displaying multiple scenes Xcode | I am building a project in Xcode using storyboards. I will be starting off using a UINavigation Controller. From there I need to have five scenes, each built in a UIScrollView. So, should I have an individual View Controller for each UIScrollView or should I nest all of the scrollviews into one ViewController.
If I nest them all into one VC, then how would the VC know which one to display? I will have a button in the navigation bar that says "Next Page" so when the user clicks it, they will see the next UIScrollview. How would I code that?
Thank you in advance for any tips on this. | xcode | null | null | null | null | null | open | displaying multiple scenes Xcode
===
I am building a project in Xcode using storyboards. I will be starting off using a UINavigation Controller. From there I need to have five scenes, each built in a UIScrollView. So, should I have an individual View Controller for each UIScrollView or should I nest all of the scrollviews into one ViewController.
If I nest them all into one VC, then how would the VC know which one to display? I will have a button in the navigation bar that says "Next Page" so when the user clicks it, they will see the next UIScrollview. How would I code that?
Thank you in advance for any tips on this. | 0 |
11,651,118 | 07/25/2012 13:42:27 | 456,028 | 09/23/2010 10:06:23 | 54 | 5 | soql join query in SalesForce | I'm struggling with a query, I want to select all Branches, and 'join' Companies (of type Account) with again the Contacts in there. Until now no luck, what am i doing wrong?
SELECT
b.Id, b.Location,
(SELECT FirstName, LastName, FROM b.Companies.Contacts
//i've tried combinations of __r and __c
WHERE City == 'New York')
FROM Branche__c b
my WSDL for this part is built up like this:
<pre>
<complexType name="Branche__c">
..
<element name="Companies__r" nillable="true" minOccurs="0" type="ens:Account"/>
..
</complexType>
..
<complexType name="Account">
..
<element name="Contacts" nillable="true" minOccurs="0" type="tns:QueryResult"/>
..
</complexType></pre> | salesforce | soql | null | null | null | null | open | soql join query in SalesForce
===
I'm struggling with a query, I want to select all Branches, and 'join' Companies (of type Account) with again the Contacts in there. Until now no luck, what am i doing wrong?
SELECT
b.Id, b.Location,
(SELECT FirstName, LastName, FROM b.Companies.Contacts
//i've tried combinations of __r and __c
WHERE City == 'New York')
FROM Branche__c b
my WSDL for this part is built up like this:
<pre>
<complexType name="Branche__c">
..
<element name="Companies__r" nillable="true" minOccurs="0" type="ens:Account"/>
..
</complexType>
..
<complexType name="Account">
..
<element name="Contacts" nillable="true" minOccurs="0" type="tns:QueryResult"/>
..
</complexType></pre> | 0 |
11,651,127 | 07/25/2012 13:42:45 | 1,312,478 | 04/04/2012 09:40:22 | 140 | 10 | Alexa Sites Linking In | I read on internet that alexa updates its "Sites Linking In" only once in a month ( though ranking is updated daily as I monitor it daily ). Is that true ? Are there any webmasters here who track "sites linking in" and can they tell me when did they updated "sites linking in" ? | alexa | null | null | null | null | 07/25/2012 14:00:13 | off topic | Alexa Sites Linking In
===
I read on internet that alexa updates its "Sites Linking In" only once in a month ( though ranking is updated daily as I monitor it daily ). Is that true ? Are there any webmasters here who track "sites linking in" and can they tell me when did they updated "sites linking in" ? | 2 |
11,651,129 | 07/25/2012 13:42:48 | 1,551,688 | 07/25/2012 12:59:10 | 1 | 0 | Django travel up or down relationships in a generic way | I am trying to rewrite my Django code to make it as generic as possible on all levels. Say I have the following models:
class Tvshow(models.Model):
pass
class Season(models.Model):
tvshow = models.ForeignKey(Tvshow)
class Episode(models.Model):
season = models.ForeignKey(Season)
A tvshow has seasons, and a season has episodes. I left all other info out for simplicity.
My detail view for any of these objects can now handle any model by using DetailView. But I would also like to display the relations for an object, either parents or children. Let's say you are viewing a tvshow. I can't call on tvshow.season_set.all() to display this information because my template doesn't know it's dealing with a tvshow (nor that tvshows have seasons). Instead, I would like to be able to do this:
object.children_set.all().
That way I can feed my view any of these 3 models, and it will work. Is this possible?
p.s. I know the object. part works, but will the children part work also? There is one ugly hack I was able to come up with: use the relation_name property to name all relations children. I suppose it would work but it is not a direction I want to take.
views.py:
from django.views.generic.detail import DetailView
class ObjectDetailView(DetailView):
template_name = "detail.html"
urls.py
from tvshows.views import ObjectDetailView
from tvshows.models import Tvshow
urlpatterns = patterns('tvshows.views',
url(r'^(?P<pk>\d+)/$', ObjectDetailView.as_view(model = Tvshow), name='detail'),
) | django | generics | views | relationships | django-generic-views | null | open | Django travel up or down relationships in a generic way
===
I am trying to rewrite my Django code to make it as generic as possible on all levels. Say I have the following models:
class Tvshow(models.Model):
pass
class Season(models.Model):
tvshow = models.ForeignKey(Tvshow)
class Episode(models.Model):
season = models.ForeignKey(Season)
A tvshow has seasons, and a season has episodes. I left all other info out for simplicity.
My detail view for any of these objects can now handle any model by using DetailView. But I would also like to display the relations for an object, either parents or children. Let's say you are viewing a tvshow. I can't call on tvshow.season_set.all() to display this information because my template doesn't know it's dealing with a tvshow (nor that tvshows have seasons). Instead, I would like to be able to do this:
object.children_set.all().
That way I can feed my view any of these 3 models, and it will work. Is this possible?
p.s. I know the object. part works, but will the children part work also? There is one ugly hack I was able to come up with: use the relation_name property to name all relations children. I suppose it would work but it is not a direction I want to take.
views.py:
from django.views.generic.detail import DetailView
class ObjectDetailView(DetailView):
template_name = "detail.html"
urls.py
from tvshows.views import ObjectDetailView
from tvshows.models import Tvshow
urlpatterns = patterns('tvshows.views',
url(r'^(?P<pk>\d+)/$', ObjectDetailView.as_view(model = Tvshow), name='detail'),
) | 0 |
11,651,131 | 07/25/2012 13:42:55 | 547,557 | 12/19/2010 08:31:04 | 26 | 0 | monitor folder and execute command | I'm looking for a solution for monitoring a folder for new file creation and then execute shell command upon the created file. The scenario is I have a host machine that runs a virtual machine and they share a folder. What I want is when I create or copy a new file to that shared folder on my host machine, on the VM, the system should be able to detect those changes. I have tried incron and inotify but they only work when I do the copy, create as a user in the VM. Thanks | shell | automation | null | null | null | null | open | monitor folder and execute command
===
I'm looking for a solution for monitoring a folder for new file creation and then execute shell command upon the created file. The scenario is I have a host machine that runs a virtual machine and they share a folder. What I want is when I create or copy a new file to that shared folder on my host machine, on the VM, the system should be able to detect those changes. I have tried incron and inotify but they only work when I do the copy, create as a user in the VM. Thanks | 0 |
11,651,132 | 07/25/2012 13:43:02 | 1,296,437 | 03/27/2012 19:28:58 | 893 | 62 | jQuery smooth scroll on mousedown | Is there any way to emulate a scroll type option using jquery animate? Right now it simply scrolls equivalent to the value you give it (like below). I cannot do a custom scroll bar on this div because its mainly geared towards making it easy to scroll on mobile devices. So the example below will scroll buy it goes -100px from the top, but then stops, and repeats. Is there any easy way to make this a transition that it will just continue.
jQuery(".down-arrow").mousedown(function(){
var height = jQuery("#technology_list").height();
//if($('#technology_list').offset().top
scrolling = true;
startScrolling(jQuery("#technology_list"), "-=100px");
//jQuery("#technology_list").animate({top: '-=25'});
}).mouseup(function(){
scrolling = false;
});
function startScrolling(obj, param)
{
obj.animate({"top": param}, "fast", function(){
if (scrolling)
{
startScrolling(obj, param);
}
}); | javascript | jquery | animate | null | null | null | open | jQuery smooth scroll on mousedown
===
Is there any way to emulate a scroll type option using jquery animate? Right now it simply scrolls equivalent to the value you give it (like below). I cannot do a custom scroll bar on this div because its mainly geared towards making it easy to scroll on mobile devices. So the example below will scroll buy it goes -100px from the top, but then stops, and repeats. Is there any easy way to make this a transition that it will just continue.
jQuery(".down-arrow").mousedown(function(){
var height = jQuery("#technology_list").height();
//if($('#technology_list').offset().top
scrolling = true;
startScrolling(jQuery("#technology_list"), "-=100px");
//jQuery("#technology_list").animate({top: '-=25'});
}).mouseup(function(){
scrolling = false;
});
function startScrolling(obj, param)
{
obj.animate({"top": param}, "fast", function(){
if (scrolling)
{
startScrolling(obj, param);
}
}); | 0 |
11,628,502 | 07/24/2012 10:02:47 | 1,199,657 | 02/09/2012 12:38:11 | 223 | 8 | Junk removal in java | In text field if i copy from word , junk character get inserted. I have use the following code to eliminate junk before insertion. I am using mysql database.
String outputEncoding = "UTF-8";
String inputDecoder="Windows-1252";
Charset charsetOutput = Charset.forName(outputEncoding);
CharsetEncoder encoder = charsetOutput.newEncoder();
byte[] bufferToConvert = userText.getBytes();
CharsetDecoder decoder = (CharsetDecoder) charsetOutput.newDecoder();
try {
CharBuffer cbuf = decoder.decode(ByteBuffer.wrap(bufferToConvert));
ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(cbuf));
userText = decoder.decode(bbuf).toString();
} catch (CharacterCodingException e) {
e.printStackTrace();
}
but I am still getting junk character for single quote('') and double quotes(""). I need the string in UTF-8. Can anyone suggest where i may be wrong? | java | mysql | null | null | null | null | open | Junk removal in java
===
In text field if i copy from word , junk character get inserted. I have use the following code to eliminate junk before insertion. I am using mysql database.
String outputEncoding = "UTF-8";
String inputDecoder="Windows-1252";
Charset charsetOutput = Charset.forName(outputEncoding);
CharsetEncoder encoder = charsetOutput.newEncoder();
byte[] bufferToConvert = userText.getBytes();
CharsetDecoder decoder = (CharsetDecoder) charsetOutput.newDecoder();
try {
CharBuffer cbuf = decoder.decode(ByteBuffer.wrap(bufferToConvert));
ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(cbuf));
userText = decoder.decode(bbuf).toString();
} catch (CharacterCodingException e) {
e.printStackTrace();
}
but I am still getting junk character for single quote('') and double quotes(""). I need the string in UTF-8. Can anyone suggest where i may be wrong? | 0 |
11,628,506 | 07/24/2012 10:03:02 | 1,077,366 | 12/02/2011 12:13:59 | 9 | 0 | Magento website IE issue | I got an IE compatibility issue in my magento website. When i look deeper,I found that it is because of default quirks mode. I can able to get the original website when i change the quirks mode to IE standard mode. But by default quirks mode is coming.
I can able to fix this issue in html website when i define <i>DOCTYPE</i> of the page. But i am a newbie in magento. I don't know how can i define <i>DOCTYPE</i> in Magento website. I tried in some php files. But failed. Anyone help me to resolve this issue?
Is there any other solutions for that? | magento | ie-compatibility-mode | null | null | null | null | open | Magento website IE issue
===
I got an IE compatibility issue in my magento website. When i look deeper,I found that it is because of default quirks mode. I can able to get the original website when i change the quirks mode to IE standard mode. But by default quirks mode is coming.
I can able to fix this issue in html website when i define <i>DOCTYPE</i> of the page. But i am a newbie in magento. I don't know how can i define <i>DOCTYPE</i> in Magento website. I tried in some php files. But failed. Anyone help me to resolve this issue?
Is there any other solutions for that? | 0 |
11,627,905 | 07/24/2012 09:26:47 | 375,958 | 06/25/2010 06:23:20 | 1,176 | 32 | How prevent RegisterViewWithRegion adds new TabItems in PRISM? | OK
In my PRISM app I have 3 modules that each one have 3~6 views. in each module when `Initialize` method runs, after each `RegisterViewWithRegion` for each one of views, new `TabItem` appears in `Shell`'s `TabControl`. But i want to just add one `TabItem` at startup and each time user execute a `Command` and `Navigation` occurs, new `TabItem` appears.
Also user should be able to add or remove `TabItem`s.
What should i do? Implement a new `RegionAdapter` or what?
Here is my Shell `TabControl`:
<TabControl TabStripPlacement="Left" Grid.Column="2" Margin="6" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
prism:RegionManager.RegionName="{x:Static infrastructure:RegionNames.MainRagionName}">
<TabItem />
</TabControl>
and This is RegisterViewWithRegion:
var codingMainTreeView = _container.Resolve<Views.CodingMainTreeView>();
_regionManager.RegisterViewWithRegion(RegionNames.MainRagionName, () => codingMainTreeView);
var vouchersMainView = _container.Resolve<Views.VouchersMainView>();
_regionManager.RegisterViewWithRegion(RegionNames.MainRagionName, () => vouchersMainView); | c# | wpf | prism | tabcontrol | region | null | open | How prevent RegisterViewWithRegion adds new TabItems in PRISM?
===
OK
In my PRISM app I have 3 modules that each one have 3~6 views. in each module when `Initialize` method runs, after each `RegisterViewWithRegion` for each one of views, new `TabItem` appears in `Shell`'s `TabControl`. But i want to just add one `TabItem` at startup and each time user execute a `Command` and `Navigation` occurs, new `TabItem` appears.
Also user should be able to add or remove `TabItem`s.
What should i do? Implement a new `RegionAdapter` or what?
Here is my Shell `TabControl`:
<TabControl TabStripPlacement="Left" Grid.Column="2" Margin="6" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
prism:RegionManager.RegionName="{x:Static infrastructure:RegionNames.MainRagionName}">
<TabItem />
</TabControl>
and This is RegisterViewWithRegion:
var codingMainTreeView = _container.Resolve<Views.CodingMainTreeView>();
_regionManager.RegisterViewWithRegion(RegionNames.MainRagionName, () => codingMainTreeView);
var vouchersMainView = _container.Resolve<Views.VouchersMainView>();
_regionManager.RegisterViewWithRegion(RegionNames.MainRagionName, () => vouchersMainView); | 0 |
11,628,507 | 07/24/2012 10:03:02 | 1,009,774 | 10/23/2011 17:36:56 | 21 | 3 | XSD code generator empty nodes | I have been provided an XSD file that I have generated code from using XSD.exe but it is not functioning in the way that I'm expecting.
<xsd:element name="Claims">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Claim" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ClaimDate" type="xsd:dateTime" />
<xsd:element name="ClaimDesc" type="xsd:string" />
....
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
The expectation is that if there are no claims, then an empty <Claims/> node is sent through but the generated code comes out as
[System.Xml.Serialization.XmlArrayItemAttribute("Claim", IsNullable=false)]
public QuoteRequestClaim[] Claims {
get {
return this.claimsField;
}
set {
this.claimsField = value;
}
}
meaning that I cannot pass this empty node through. Is this a quirk in XSD.exe or does the XSD need to be modified to make this work?
| c# | xml | xsd | xsd.exe | null | null | open | XSD code generator empty nodes
===
I have been provided an XSD file that I have generated code from using XSD.exe but it is not functioning in the way that I'm expecting.
<xsd:element name="Claims">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Claim" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ClaimDate" type="xsd:dateTime" />
<xsd:element name="ClaimDesc" type="xsd:string" />
....
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
The expectation is that if there are no claims, then an empty <Claims/> node is sent through but the generated code comes out as
[System.Xml.Serialization.XmlArrayItemAttribute("Claim", IsNullable=false)]
public QuoteRequestClaim[] Claims {
get {
return this.claimsField;
}
set {
this.claimsField = value;
}
}
meaning that I cannot pass this empty node through. Is this a quirk in XSD.exe or does the XSD need to be modified to make this work?
| 0 |
11,627,909 | 07/24/2012 09:26:59 | 301,032 | 03/24/2010 17:01:40 | 1,376 | 13 | c# copy console output to second location | Using c#, is there anyway to copy console output to a second location (aswell as the original console). I know i can call SetOut to override the default output location of the console, but what i want to do, is keep writing to the original console implementation, but also write to a second location. Any ideas? | c# | console | null | null | null | null | open | c# copy console output to second location
===
Using c#, is there anyway to copy console output to a second location (aswell as the original console). I know i can call SetOut to override the default output location of the console, but what i want to do, is keep writing to the original console implementation, but also write to a second location. Any ideas? | 0 |
11,628,515 | 07/24/2012 10:03:35 | 1,354,176 | 04/24/2012 15:51:11 | 15 | 0 | error in compiling a C code for householder reduction algorithm | I wrote a C code for householder reduction (convert a matrix to a tridiagonal matrix), but for compiling it gives the following error:
First-chance exception at 0x0139399d in eig3.exe: 0xC0000005: Access violation reading location 0x001ac240.
Unhandled exception at 0x0139399d in eig3.exe: 0xC0000005: Access violation reading location 0x001ac240.
I don't know what the cause of this error is and how to handle it.
Thanks for any help.
#include <stdio.h>
#include <math.h>
void tred2(float a [25][25], int n, float d[25], float e[25]);
int main(void)
{
float p [25][25] = {
{2555.00000000000 ,922.005311398953 ,637.379419667162 ,620.854753485905 ,911.254051182594 ,1014.66270354426 ,812.462795013727 ,1072.60166757533 ,1096.81527844247 ,804.789434963328 ,787.686049787311 ,149.217640419107 ,1566.64395026266 ,1588.48393430107 ,1492.94885424606 ,991.938328585146 ,976.827808746522 ,532.528819818273 ,722.768915905778 ,763.614122733850 ,1579.60048937499 ,1001.71798224119 ,1302.39870957033 ,1166.44619446079 ,1560.95252809953}
,{922.005311398953 ,2555.00000000000 ,948.729365770484 ,1252.25139249907 ,626.461731508273 ,1872.91731556186 ,970.579881474055 ,1404.21684991920 ,1697.79261702870 ,1660.75191655532 ,885.912360323321 ,-826.559236092200 ,1064.22706203730 ,1297.73910149212 ,1149.30978063813 ,1432.76348929109 ,1203.23027209744 ,898.925016935900 ,1731.53004042905 ,1501.47080150068 ,1293.89882724464 ,292.711988397453 ,1583.90052201935 ,742.612048219667 ,1412.09079625792}
,{637.379419667162 ,948.729365770484 ,2555.00000000000 ,1606.45631882269 ,1205.09485268865 ,1214.09523991542 ,1248.34335302171 ,1326.14561611573 ,1230.85115422645 ,1669.59745355344 ,1752.88432738528 ,494.100155408190 ,1080.00543503926 ,1067.78673262180 ,975.062883004617 ,1405.11899504866 ,1247.48007973090 ,1676.09723626932 ,1491.90674867064 ,1610.28518973263 ,1183.09375133136 ,1273.50753822421 ,1112.17881531081 ,933.065161216677 ,1327.24996811513}
,{620.854753485905 ,1252.25139249907 ,1606.45631882269 ,2555.00000000000 ,982.568289011985 ,1334.18632529062 ,1235.54945313756 ,1505.75951183069 ,1336.55410791772 ,1800.29366906675 ,1513.41736418093 ,-150.789903127066 ,1136.34003190369 ,1086.47082456098 ,856.748289849762 ,1527.62678599168 ,1367.39795727282 ,1457.68030807905 ,1843.09328177403 ,1888.54356980410 ,1152.61902697012 ,1148.79986990636 ,1319.86967136771 ,811.630450226485 ,1324.72067320582}
,{911.254051182594 ,626.461731508273 ,1205.09485268865 ,982.568289011985 ,2555.00000000000 ,1006.48667459184 ,1436.94802946664 ,1478.68843517829 ,1111.66962056243 ,974.358987124379 ,1682.91304943585 ,1383.69707742754 ,1429.43793210911 ,1086.57958876630 ,1228.44183248830 ,1348.82292814661 ,1325.04121890600 ,1406.19567045305 ,685.498133948134 ,961.858800804619 ,1140.83831352846 ,1741.89044735911 ,705.214461186938 ,1123.73455700641 ,1326.41608064405}
,{1014.66270354426 ,1872.91731556186 ,1214.09523991542 ,1334.18632529062 ,1006.48667459184 ,2555.00000000000 ,1102.75907250178 ,1532.03278329145 ,1898.33027069207 ,1743.73722868282 ,1242.26031630962 ,-374.581610868589 ,1288.97322442843 ,1522.17129337367 ,1161.22727923774 ,1473.15439922315 ,1242.38910855661 ,1044.03524006396 ,1737.82499851481 ,1562.82929669660 ,1431.63427086281 ,670.595041163938 ,1669.23104465845 ,856.549829330034 ,1592.91947720379}
,{812.462795013727 ,970.579881474055 ,1248.34335302171 ,1235.54945313756 ,1436.94802946664 ,1102.75907250178 ,2555.00000000000 ,1852.32912991805 ,1262.19132114632 ,1071.57700899904 ,1594.42318713543 ,976.023796565991 ,1451.14173122087 ,1011.97236259581 ,1315.19997091247 ,1936.85007229790 ,1970.04581376139 ,1558.86400917758 ,1034.22690523497 ,1174.78286756902 ,1208.69285767467 ,1255.06466912584 ,734.338320013703 ,889.143970486845 ,1232.98445944503}
,{1072.60166757533 ,1404.21684991920 ,1326.14561611573 ,1505.75951183069 ,1478.68843517829 ,1532.03278329145 ,1852.32912991805 ,2555.00000000000 ,1590.48563674342 ,1553.73027238155 ,1543.62072395496 ,346.707208870300 ,1671.67461719673 ,1315.57936035923 ,1368.83441512085 ,2016.29646183317 ,1974.85412946931 ,1293.01154780142 ,1487.73944205692 ,1608.85973274544 ,1474.18444486134 ,1128.61280903632 ,1178.35448619270 ,1048.09492091795 ,1524.37188755617}
,{1096.81527844247 ,1697.79261702870 ,1230.85115422645 ,1336.55410791772 ,1111.66962056243 ,1898.33027069207 ,1262.19132114632 ,1590.48563674342 ,2555.00000000000 ,1682.64294010254 ,1376.98769886015 ,-101.987854073015 ,1305.92004665249 ,1531.57844271590 ,1265.40439197583 ,1462.99255306792 ,1437.78441328442 ,1113.27311156055 ,1622.34725044000 ,1602.43604551484 ,1438.29417331368 ,783.469603812970 ,1472.34769797847 ,896.479716677738 ,1482.73306220344}
,{804.789434963328 ,1660.75191655532 ,1669.59745355344 ,1800.29366906675 ,974.358987124379 ,1743.73722868282 ,1071.57700899904 ,1553.73027238155 ,1682.64294010254 ,2555.00000000001 ,1626.25275793207 ,-420.709178738120 ,1158.29054706898 ,1305.03473704533 ,1006.33223409788 ,1528.75160521552 ,1224.36877733660 ,1490.98324372591 ,2080.17152629728 ,2030.17215288853 ,1380.88302431676 ,770.111243053728 ,1587.56786604855 ,958.393733612288 ,1533.86017999511}
,{787.686049787311 ,885.912360323321 ,1752.88432738528 ,1513.41736418093 ,1682.91304943585 ,1242.26031630962 ,1594.42318713543 ,1543.62072395496 ,1376.98769886015 ,1626.25275793207 ,2555.00000000000 ,1097.63026872654 ,1342.56626511327 ,1121.01344153946 ,1229.36072577169 ,1599.79042770094 ,1424.31811308624 ,1882.73938717439 ,1368.97989321395 ,1595.13452677113 ,1292.17310482938 ,1578.82248605974 ,1032.67146970819 ,968.266803228347 ,1413.73060072601}
,{149.217640419107 ,-826.559236092200 ,494.100155408190 ,-150.789903127066 ,1383.69707742754 ,-374.581610868589 ,976.023796565991 ,346.707208870300 ,-101.987854073015 ,-420.709178738120 ,1097.63026872654 ,2555.00000000001 ,454.968552737453 ,-15.1135182216903 ,506.850419956902 ,383.190817312292 ,564.386594524708 ,890.220013496502 ,-697.131970750369 ,-294.984935131726 ,79.3672216013743 ,1281.22039761639 ,-677.737670255204 ,194.388865612795 ,53.2942878203829}
,{1566.64395026266 ,1064.22706203730 ,1080.00543503926 ,1136.34003190369 ,1429.43793210911 ,1288.97322442843 ,1451.14173122087 ,1671.67461719673 ,1305.92004665249 ,1158.29054706898 ,1342.56626511327 ,454.968552737453 ,2555.00000000000 ,1645.43953157881 ,1551.51256668275 ,1656.32956655138 ,1449.67830906168 ,1035.28509796355 ,1059.71892915082 ,1142.41232626779 ,1717.55677745606 ,1489.41331600837 ,1568.01635257960 ,1322.25766815038 ,1960.69572270888}
,{1588.48393430107 ,1297.73910149212 ,1067.78673262180 ,1086.47082456098 ,1086.57958876630 ,1522.17129337367 ,1011.97236259581 ,1315.57936035923 ,1531.57844271590 ,1305.03473704533 ,1121.01344153946 ,-15.1135182216903 ,1645.43953157881 ,2555.00000000000 ,1633.85577074972 ,1309.83850890225 ,1116.37634369325 ,894.420409878297 ,1239.77893642942 ,1179.54818574932 ,1831.26976322878 ,1095.41625715418 ,1555.44977811449 ,1379.27681797320 ,1845.12969224029}
,{1492.94885424606 ,1149.30978063813 ,975.062883004617 ,856.748289849762 ,1228.44183248830 ,1161.22727923774 ,1315.19997091247 ,1368.83441512085 ,1265.40439197583 ,1006.33223409788 ,1229.36072577169 ,506.850419956902 ,1551.51256668275 ,1633.85577074972 ,2555.00000000000 ,1399.89569672702 ,1292.78494194694 ,1071.57348440573 ,919.438634412043 ,984.063775832769 ,1664.54317998763 ,1216.01431762331 ,1117.89982383136 ,1209.44972060098 ,1552.76541019022}
,{991.938328585146 ,1432.76348929109 ,1405.11899504866 ,1527.62678599168 ,1348.82292814661 ,1473.15439922315 ,1936.85007229790 ,2016.29646183317 ,1462.99255306792 ,1528.75160521552 ,1599.79042770094 ,383.190817312292 ,1656.32956655138 ,1309.83850890225 ,1399.89569672702 ,2555.00000000000 ,1907.39582900906 ,1533.90610292659 ,1529.08890780899 ,1528.36173717935 ,1451.45792249781 ,1185.87635311023 ,1245.92379463711 ,994.335556646288 ,1565.15016994369}
,{976.827808746522 ,1203.23027209744 ,1247.48007973090 ,1367.39795727282 ,1325.04121890600 ,1242.38910855661 ,1970.04581376139 ,1974.85412946931 ,1437.78441328442 ,1224.36877733660 ,1424.31811308624 ,564.386594524708 ,1449.67830906168 ,1116.37634369325 ,1292.78494194694 ,1907.39582900906 ,2555.00000000000 ,1308.07259306803 ,1290.86467986442 ,1440.81003563023 ,1356.20292784065 ,1138.03298890447 ,882.908847334965 ,880.320469711113 ,1293.91232138750}
,{532.528819818273 ,898.925016935900 ,1676.09723626932 ,1457.68030807905 ,1406.19567045305 ,1044.03524006396 ,1558.86400917758 ,1293.01154780142 ,1113.27311156055 ,1490.98324372591 ,1882.73938717439 ,890.220013496502 ,1035.28509796355 ,894.420409878297 ,1071.57348440573 ,1533.90610292659 ,1308.07259306803 ,2555.00000000001 ,1350.47553889761 ,1425.02183656120 ,1068.66070773005 ,1403.89403478196 ,995.052158755041 ,1033.42238484679 ,1256.14314008640}
,{722.768915905778 ,1731.53004042905 ,1491.90674867064 ,1843.09328177403 ,685.498133948134 ,1737.82499851481 ,1034.22690523497 ,1487.73944205692 ,1622.34725044000 ,2080.17152629728 ,1368.97989321395 ,-697.131970750369 ,1059.71892915082 ,1239.77893642942 ,919.438634412043 ,1529.08890780899 ,1290.86467986442 ,1350.47553889761 ,2555.00000000000 ,2004.23504874421 ,1315.13784792259 ,604.706253997176 ,1597.97962863405 ,817.161486914232 ,1437.88230857763}
,{763.614122733850 ,1501.47080150068 ,1610.28518973263 ,1888.54356980410 ,961.858800804619 ,1562.82929669660 ,1174.78286756902 ,1608.85973274544 ,1602.43604551484 ,2030.17215288853 ,1595.13452677113 ,-294.984935131726 ,1142.41232626779 ,1179.54818574932 ,984.063775832769 ,1528.36173717935 ,1440.81003563023 ,1425.02183656120 ,2004.23504874421 ,2555.00000000000 ,1293.05860991331 ,896.871006849127 ,1354.09744749331 ,820.004005040133 ,1350.99003077704}
,{1579.60048937499 ,1293.89882724464 ,1183.09375133136 ,1152.61902697012 ,1140.83831352846 ,1431.63427086281 ,1208.69285767467 ,1474.18444486134 ,1438.29417331368 ,1380.88302431676 ,1292.17310482938 ,79.3672216013743 ,1717.55677745606 ,1831.26976322878 ,1664.54317998763 ,1451.45792249781 ,1356.20292784065 ,1068.66070773005 ,1315.13784792259 ,1293.05860991331 ,2555.00000000000 ,1239.52387671990 ,1550.41892957873 ,1551.16127349026 ,1845.12091395182}
,{1001.71798224119 ,292.711988397453 ,1273.50753822421 ,1148.79986990636 ,1741.89044735911 ,670.595041163938 ,1255.06466912584 ,1128.61280903632 ,783.469603812970 ,770.111243053728 ,1578.82248605974 ,1281.22039761639 ,1489.41331600837 ,1095.41625715418 ,1216.01431762331 ,1185.87635311023 ,1138.03298890447 ,1403.89403478196 ,604.706253997176 ,896.871006849127 ,1239.52387671990 ,2555.00000000000 ,911.178694367549 ,1125.41110335920 ,1384.35828777648}
,{1302.39870957033 ,1583.90052201935 ,1112.17881531081 ,1319.86967136771 ,705.214461186938 ,1669.23104465845 ,734.338320013703 ,1178.35448619270 ,1472.34769797847 ,1587.56786604855 ,1032.67146970819 ,-677.737670255204 ,1568.01635257960 ,1555.44977811449 ,1117.89982383136 ,1245.92379463711 ,882.908847334965 ,995.052158755041 ,1597.97962863405 ,1354.09744749331 ,1550.41892957873 ,911.178694367549 ,2555.00000000000 ,1223.23805006692 ,1911.50640631402}
,{1166.44619446079 ,742.612048219667 ,933.065161216677 ,811.630450226485 ,1123.73455700641 ,856.549829330034 ,889.143970486845 ,1048.09492091795 ,896.479716677738 ,958.393733612288 ,968.266803228347 ,194.388865612795 ,1322.25766815038 ,1379.27681797320 ,1209.44972060098 ,994.335556646288 ,880.320469711113 ,1033.42238484679 ,817.161486914232 ,820.004005040133 ,1551.16127349026 ,1125.41110335920 ,1223.23805006692 ,2555.00000000000 ,1512.05329660110}
,{1560.95252809953 ,1412.09079625792 ,1327.24996811513 ,1324.72067320582 ,1326.41608064405 ,1592.91947720379 ,1232.98445944503 ,1524.37188755617 ,1482.73306220344 ,1533.86017999511 ,1413.73060072601 ,53.2942878203829 ,1960.69572270888 ,1845.12969224029 ,1552.76541019022 ,1565.15016994369 ,1293.91232138750 ,1256.14314008640 ,1437.88230857763 ,1350.99003077704 ,1845.12091395182 ,1384.35828777648 ,1911.50640631402 ,1512.05329660110 ,2555.00000000000}
};
int myLength = sizeof(p);
float dd [25] = { 0.0 };
float ee [25] = { 0.0 };
tred2(p,myLength,dd,ee);
}
void tred2(float a [25][25], int n,float d[25], float e[25])
{
int l,k,j,i;
float scale,hh,h,g,f;
for (i=n;i>=2;i--) {
l=i-1;
h=scale=0.0;
if (l > 1) {
for (k=1;k<=l;k++)
scale += fabs(a[i][k]);
if (scale == 0.0) /*Skip transformation.*/
e[i]=a[i][l];
else {
for (k=1;k<=l;k++) {
a[i][k] /= scale; /*Use scaled a’s for transformation.*/
h += a[i][k]*a[i][k]; /*Form ? in h.*/
}
f=a[i][l];
g=(f >= 0.0 ? -sqrt(h) : sqrt(h));
e[i]=scale*g;
h -= f*g;
a[i][l]=f-g; /*Store u in the ith row of a.*/
f=0.0;
for (j=1;j<=l;j++) {
/* Next statement can be omitted if eigenvectors not wanted */
a[j][i]=a[i][j]/h; /*Store u/H in ith column of a.*/
g=0.0; /*Form an element of A · u in g.*/
for (k=1;k<=j;k++)
g += a[j][k]*a[i][k];
for (k=j+1;k<=l;k++)
g += a[k][j]*a[i][k];
e[j]=g/h; /*Form element of p in temporarily unused element of e.*/
f += e[j]*a[i][j];
}
hh=f/(h+h); /*Form K*/
for (j=1;j<=l;j++) { /*Form q and store in e overwriting p.*/
f=a[i][j];
e[j]=g=e[j]-hh*f;
for (k=1;k<=j;k++) /*Reduce a*/
a[j][k] -= (f*e[k]+g*a[i][k]);
}
}
} else
e[i]=a[i][l];
d[i]=h;
}
/* Next statement can be omitted if eigenvectors not wanted */
d[1]=0.0;
e[1]=0.0;
/* Contents of this loop can be omitted if eigenvectors not wanted except for statement d[i]=a[i][i]; */
for (i=1;i<=n;i++) { /*Begin accumulation of transformation matrices.*/
l=i-1;
if (d[i]) { /*This block skipped when i=1.*/
for (j=1;j<=l;j++) {
g=0.0;
for (k=1;k<=l;k++) /*Use u and u/H stored in a to form P·Q.*/
g += a[i][k]*a[k][j];
for (k=1;k<=l;k++)
a[k][j] -= g*a[k][i];
}
}
d[i]=a[i][i]; /*This statement remains.*/
a[i][i]=1.0; /*Reset row and column of a to identity*/
for (j=1;j<=l;j++) a[j][i]=a[i][j]=0.0; /*matrix for next iteration.*/
}
}
| c | visual-studio | null | null | null | null | open | error in compiling a C code for householder reduction algorithm
===
I wrote a C code for householder reduction (convert a matrix to a tridiagonal matrix), but for compiling it gives the following error:
First-chance exception at 0x0139399d in eig3.exe: 0xC0000005: Access violation reading location 0x001ac240.
Unhandled exception at 0x0139399d in eig3.exe: 0xC0000005: Access violation reading location 0x001ac240.
I don't know what the cause of this error is and how to handle it.
Thanks for any help.
#include <stdio.h>
#include <math.h>
void tred2(float a [25][25], int n, float d[25], float e[25]);
int main(void)
{
float p [25][25] = {
{2555.00000000000 ,922.005311398953 ,637.379419667162 ,620.854753485905 ,911.254051182594 ,1014.66270354426 ,812.462795013727 ,1072.60166757533 ,1096.81527844247 ,804.789434963328 ,787.686049787311 ,149.217640419107 ,1566.64395026266 ,1588.48393430107 ,1492.94885424606 ,991.938328585146 ,976.827808746522 ,532.528819818273 ,722.768915905778 ,763.614122733850 ,1579.60048937499 ,1001.71798224119 ,1302.39870957033 ,1166.44619446079 ,1560.95252809953}
,{922.005311398953 ,2555.00000000000 ,948.729365770484 ,1252.25139249907 ,626.461731508273 ,1872.91731556186 ,970.579881474055 ,1404.21684991920 ,1697.79261702870 ,1660.75191655532 ,885.912360323321 ,-826.559236092200 ,1064.22706203730 ,1297.73910149212 ,1149.30978063813 ,1432.76348929109 ,1203.23027209744 ,898.925016935900 ,1731.53004042905 ,1501.47080150068 ,1293.89882724464 ,292.711988397453 ,1583.90052201935 ,742.612048219667 ,1412.09079625792}
,{637.379419667162 ,948.729365770484 ,2555.00000000000 ,1606.45631882269 ,1205.09485268865 ,1214.09523991542 ,1248.34335302171 ,1326.14561611573 ,1230.85115422645 ,1669.59745355344 ,1752.88432738528 ,494.100155408190 ,1080.00543503926 ,1067.78673262180 ,975.062883004617 ,1405.11899504866 ,1247.48007973090 ,1676.09723626932 ,1491.90674867064 ,1610.28518973263 ,1183.09375133136 ,1273.50753822421 ,1112.17881531081 ,933.065161216677 ,1327.24996811513}
,{620.854753485905 ,1252.25139249907 ,1606.45631882269 ,2555.00000000000 ,982.568289011985 ,1334.18632529062 ,1235.54945313756 ,1505.75951183069 ,1336.55410791772 ,1800.29366906675 ,1513.41736418093 ,-150.789903127066 ,1136.34003190369 ,1086.47082456098 ,856.748289849762 ,1527.62678599168 ,1367.39795727282 ,1457.68030807905 ,1843.09328177403 ,1888.54356980410 ,1152.61902697012 ,1148.79986990636 ,1319.86967136771 ,811.630450226485 ,1324.72067320582}
,{911.254051182594 ,626.461731508273 ,1205.09485268865 ,982.568289011985 ,2555.00000000000 ,1006.48667459184 ,1436.94802946664 ,1478.68843517829 ,1111.66962056243 ,974.358987124379 ,1682.91304943585 ,1383.69707742754 ,1429.43793210911 ,1086.57958876630 ,1228.44183248830 ,1348.82292814661 ,1325.04121890600 ,1406.19567045305 ,685.498133948134 ,961.858800804619 ,1140.83831352846 ,1741.89044735911 ,705.214461186938 ,1123.73455700641 ,1326.41608064405}
,{1014.66270354426 ,1872.91731556186 ,1214.09523991542 ,1334.18632529062 ,1006.48667459184 ,2555.00000000000 ,1102.75907250178 ,1532.03278329145 ,1898.33027069207 ,1743.73722868282 ,1242.26031630962 ,-374.581610868589 ,1288.97322442843 ,1522.17129337367 ,1161.22727923774 ,1473.15439922315 ,1242.38910855661 ,1044.03524006396 ,1737.82499851481 ,1562.82929669660 ,1431.63427086281 ,670.595041163938 ,1669.23104465845 ,856.549829330034 ,1592.91947720379}
,{812.462795013727 ,970.579881474055 ,1248.34335302171 ,1235.54945313756 ,1436.94802946664 ,1102.75907250178 ,2555.00000000000 ,1852.32912991805 ,1262.19132114632 ,1071.57700899904 ,1594.42318713543 ,976.023796565991 ,1451.14173122087 ,1011.97236259581 ,1315.19997091247 ,1936.85007229790 ,1970.04581376139 ,1558.86400917758 ,1034.22690523497 ,1174.78286756902 ,1208.69285767467 ,1255.06466912584 ,734.338320013703 ,889.143970486845 ,1232.98445944503}
,{1072.60166757533 ,1404.21684991920 ,1326.14561611573 ,1505.75951183069 ,1478.68843517829 ,1532.03278329145 ,1852.32912991805 ,2555.00000000000 ,1590.48563674342 ,1553.73027238155 ,1543.62072395496 ,346.707208870300 ,1671.67461719673 ,1315.57936035923 ,1368.83441512085 ,2016.29646183317 ,1974.85412946931 ,1293.01154780142 ,1487.73944205692 ,1608.85973274544 ,1474.18444486134 ,1128.61280903632 ,1178.35448619270 ,1048.09492091795 ,1524.37188755617}
,{1096.81527844247 ,1697.79261702870 ,1230.85115422645 ,1336.55410791772 ,1111.66962056243 ,1898.33027069207 ,1262.19132114632 ,1590.48563674342 ,2555.00000000000 ,1682.64294010254 ,1376.98769886015 ,-101.987854073015 ,1305.92004665249 ,1531.57844271590 ,1265.40439197583 ,1462.99255306792 ,1437.78441328442 ,1113.27311156055 ,1622.34725044000 ,1602.43604551484 ,1438.29417331368 ,783.469603812970 ,1472.34769797847 ,896.479716677738 ,1482.73306220344}
,{804.789434963328 ,1660.75191655532 ,1669.59745355344 ,1800.29366906675 ,974.358987124379 ,1743.73722868282 ,1071.57700899904 ,1553.73027238155 ,1682.64294010254 ,2555.00000000001 ,1626.25275793207 ,-420.709178738120 ,1158.29054706898 ,1305.03473704533 ,1006.33223409788 ,1528.75160521552 ,1224.36877733660 ,1490.98324372591 ,2080.17152629728 ,2030.17215288853 ,1380.88302431676 ,770.111243053728 ,1587.56786604855 ,958.393733612288 ,1533.86017999511}
,{787.686049787311 ,885.912360323321 ,1752.88432738528 ,1513.41736418093 ,1682.91304943585 ,1242.26031630962 ,1594.42318713543 ,1543.62072395496 ,1376.98769886015 ,1626.25275793207 ,2555.00000000000 ,1097.63026872654 ,1342.56626511327 ,1121.01344153946 ,1229.36072577169 ,1599.79042770094 ,1424.31811308624 ,1882.73938717439 ,1368.97989321395 ,1595.13452677113 ,1292.17310482938 ,1578.82248605974 ,1032.67146970819 ,968.266803228347 ,1413.73060072601}
,{149.217640419107 ,-826.559236092200 ,494.100155408190 ,-150.789903127066 ,1383.69707742754 ,-374.581610868589 ,976.023796565991 ,346.707208870300 ,-101.987854073015 ,-420.709178738120 ,1097.63026872654 ,2555.00000000001 ,454.968552737453 ,-15.1135182216903 ,506.850419956902 ,383.190817312292 ,564.386594524708 ,890.220013496502 ,-697.131970750369 ,-294.984935131726 ,79.3672216013743 ,1281.22039761639 ,-677.737670255204 ,194.388865612795 ,53.2942878203829}
,{1566.64395026266 ,1064.22706203730 ,1080.00543503926 ,1136.34003190369 ,1429.43793210911 ,1288.97322442843 ,1451.14173122087 ,1671.67461719673 ,1305.92004665249 ,1158.29054706898 ,1342.56626511327 ,454.968552737453 ,2555.00000000000 ,1645.43953157881 ,1551.51256668275 ,1656.32956655138 ,1449.67830906168 ,1035.28509796355 ,1059.71892915082 ,1142.41232626779 ,1717.55677745606 ,1489.41331600837 ,1568.01635257960 ,1322.25766815038 ,1960.69572270888}
,{1588.48393430107 ,1297.73910149212 ,1067.78673262180 ,1086.47082456098 ,1086.57958876630 ,1522.17129337367 ,1011.97236259581 ,1315.57936035923 ,1531.57844271590 ,1305.03473704533 ,1121.01344153946 ,-15.1135182216903 ,1645.43953157881 ,2555.00000000000 ,1633.85577074972 ,1309.83850890225 ,1116.37634369325 ,894.420409878297 ,1239.77893642942 ,1179.54818574932 ,1831.26976322878 ,1095.41625715418 ,1555.44977811449 ,1379.27681797320 ,1845.12969224029}
,{1492.94885424606 ,1149.30978063813 ,975.062883004617 ,856.748289849762 ,1228.44183248830 ,1161.22727923774 ,1315.19997091247 ,1368.83441512085 ,1265.40439197583 ,1006.33223409788 ,1229.36072577169 ,506.850419956902 ,1551.51256668275 ,1633.85577074972 ,2555.00000000000 ,1399.89569672702 ,1292.78494194694 ,1071.57348440573 ,919.438634412043 ,984.063775832769 ,1664.54317998763 ,1216.01431762331 ,1117.89982383136 ,1209.44972060098 ,1552.76541019022}
,{991.938328585146 ,1432.76348929109 ,1405.11899504866 ,1527.62678599168 ,1348.82292814661 ,1473.15439922315 ,1936.85007229790 ,2016.29646183317 ,1462.99255306792 ,1528.75160521552 ,1599.79042770094 ,383.190817312292 ,1656.32956655138 ,1309.83850890225 ,1399.89569672702 ,2555.00000000000 ,1907.39582900906 ,1533.90610292659 ,1529.08890780899 ,1528.36173717935 ,1451.45792249781 ,1185.87635311023 ,1245.92379463711 ,994.335556646288 ,1565.15016994369}
,{976.827808746522 ,1203.23027209744 ,1247.48007973090 ,1367.39795727282 ,1325.04121890600 ,1242.38910855661 ,1970.04581376139 ,1974.85412946931 ,1437.78441328442 ,1224.36877733660 ,1424.31811308624 ,564.386594524708 ,1449.67830906168 ,1116.37634369325 ,1292.78494194694 ,1907.39582900906 ,2555.00000000000 ,1308.07259306803 ,1290.86467986442 ,1440.81003563023 ,1356.20292784065 ,1138.03298890447 ,882.908847334965 ,880.320469711113 ,1293.91232138750}
,{532.528819818273 ,898.925016935900 ,1676.09723626932 ,1457.68030807905 ,1406.19567045305 ,1044.03524006396 ,1558.86400917758 ,1293.01154780142 ,1113.27311156055 ,1490.98324372591 ,1882.73938717439 ,890.220013496502 ,1035.28509796355 ,894.420409878297 ,1071.57348440573 ,1533.90610292659 ,1308.07259306803 ,2555.00000000001 ,1350.47553889761 ,1425.02183656120 ,1068.66070773005 ,1403.89403478196 ,995.052158755041 ,1033.42238484679 ,1256.14314008640}
,{722.768915905778 ,1731.53004042905 ,1491.90674867064 ,1843.09328177403 ,685.498133948134 ,1737.82499851481 ,1034.22690523497 ,1487.73944205692 ,1622.34725044000 ,2080.17152629728 ,1368.97989321395 ,-697.131970750369 ,1059.71892915082 ,1239.77893642942 ,919.438634412043 ,1529.08890780899 ,1290.86467986442 ,1350.47553889761 ,2555.00000000000 ,2004.23504874421 ,1315.13784792259 ,604.706253997176 ,1597.97962863405 ,817.161486914232 ,1437.88230857763}
,{763.614122733850 ,1501.47080150068 ,1610.28518973263 ,1888.54356980410 ,961.858800804619 ,1562.82929669660 ,1174.78286756902 ,1608.85973274544 ,1602.43604551484 ,2030.17215288853 ,1595.13452677113 ,-294.984935131726 ,1142.41232626779 ,1179.54818574932 ,984.063775832769 ,1528.36173717935 ,1440.81003563023 ,1425.02183656120 ,2004.23504874421 ,2555.00000000000 ,1293.05860991331 ,896.871006849127 ,1354.09744749331 ,820.004005040133 ,1350.99003077704}
,{1579.60048937499 ,1293.89882724464 ,1183.09375133136 ,1152.61902697012 ,1140.83831352846 ,1431.63427086281 ,1208.69285767467 ,1474.18444486134 ,1438.29417331368 ,1380.88302431676 ,1292.17310482938 ,79.3672216013743 ,1717.55677745606 ,1831.26976322878 ,1664.54317998763 ,1451.45792249781 ,1356.20292784065 ,1068.66070773005 ,1315.13784792259 ,1293.05860991331 ,2555.00000000000 ,1239.52387671990 ,1550.41892957873 ,1551.16127349026 ,1845.12091395182}
,{1001.71798224119 ,292.711988397453 ,1273.50753822421 ,1148.79986990636 ,1741.89044735911 ,670.595041163938 ,1255.06466912584 ,1128.61280903632 ,783.469603812970 ,770.111243053728 ,1578.82248605974 ,1281.22039761639 ,1489.41331600837 ,1095.41625715418 ,1216.01431762331 ,1185.87635311023 ,1138.03298890447 ,1403.89403478196 ,604.706253997176 ,896.871006849127 ,1239.52387671990 ,2555.00000000000 ,911.178694367549 ,1125.41110335920 ,1384.35828777648}
,{1302.39870957033 ,1583.90052201935 ,1112.17881531081 ,1319.86967136771 ,705.214461186938 ,1669.23104465845 ,734.338320013703 ,1178.35448619270 ,1472.34769797847 ,1587.56786604855 ,1032.67146970819 ,-677.737670255204 ,1568.01635257960 ,1555.44977811449 ,1117.89982383136 ,1245.92379463711 ,882.908847334965 ,995.052158755041 ,1597.97962863405 ,1354.09744749331 ,1550.41892957873 ,911.178694367549 ,2555.00000000000 ,1223.23805006692 ,1911.50640631402}
,{1166.44619446079 ,742.612048219667 ,933.065161216677 ,811.630450226485 ,1123.73455700641 ,856.549829330034 ,889.143970486845 ,1048.09492091795 ,896.479716677738 ,958.393733612288 ,968.266803228347 ,194.388865612795 ,1322.25766815038 ,1379.27681797320 ,1209.44972060098 ,994.335556646288 ,880.320469711113 ,1033.42238484679 ,817.161486914232 ,820.004005040133 ,1551.16127349026 ,1125.41110335920 ,1223.23805006692 ,2555.00000000000 ,1512.05329660110}
,{1560.95252809953 ,1412.09079625792 ,1327.24996811513 ,1324.72067320582 ,1326.41608064405 ,1592.91947720379 ,1232.98445944503 ,1524.37188755617 ,1482.73306220344 ,1533.86017999511 ,1413.73060072601 ,53.2942878203829 ,1960.69572270888 ,1845.12969224029 ,1552.76541019022 ,1565.15016994369 ,1293.91232138750 ,1256.14314008640 ,1437.88230857763 ,1350.99003077704 ,1845.12091395182 ,1384.35828777648 ,1911.50640631402 ,1512.05329660110 ,2555.00000000000}
};
int myLength = sizeof(p);
float dd [25] = { 0.0 };
float ee [25] = { 0.0 };
tred2(p,myLength,dd,ee);
}
void tred2(float a [25][25], int n,float d[25], float e[25])
{
int l,k,j,i;
float scale,hh,h,g,f;
for (i=n;i>=2;i--) {
l=i-1;
h=scale=0.0;
if (l > 1) {
for (k=1;k<=l;k++)
scale += fabs(a[i][k]);
if (scale == 0.0) /*Skip transformation.*/
e[i]=a[i][l];
else {
for (k=1;k<=l;k++) {
a[i][k] /= scale; /*Use scaled a’s for transformation.*/
h += a[i][k]*a[i][k]; /*Form ? in h.*/
}
f=a[i][l];
g=(f >= 0.0 ? -sqrt(h) : sqrt(h));
e[i]=scale*g;
h -= f*g;
a[i][l]=f-g; /*Store u in the ith row of a.*/
f=0.0;
for (j=1;j<=l;j++) {
/* Next statement can be omitted if eigenvectors not wanted */
a[j][i]=a[i][j]/h; /*Store u/H in ith column of a.*/
g=0.0; /*Form an element of A · u in g.*/
for (k=1;k<=j;k++)
g += a[j][k]*a[i][k];
for (k=j+1;k<=l;k++)
g += a[k][j]*a[i][k];
e[j]=g/h; /*Form element of p in temporarily unused element of e.*/
f += e[j]*a[i][j];
}
hh=f/(h+h); /*Form K*/
for (j=1;j<=l;j++) { /*Form q and store in e overwriting p.*/
f=a[i][j];
e[j]=g=e[j]-hh*f;
for (k=1;k<=j;k++) /*Reduce a*/
a[j][k] -= (f*e[k]+g*a[i][k]);
}
}
} else
e[i]=a[i][l];
d[i]=h;
}
/* Next statement can be omitted if eigenvectors not wanted */
d[1]=0.0;
e[1]=0.0;
/* Contents of this loop can be omitted if eigenvectors not wanted except for statement d[i]=a[i][i]; */
for (i=1;i<=n;i++) { /*Begin accumulation of transformation matrices.*/
l=i-1;
if (d[i]) { /*This block skipped when i=1.*/
for (j=1;j<=l;j++) {
g=0.0;
for (k=1;k<=l;k++) /*Use u and u/H stored in a to form P·Q.*/
g += a[i][k]*a[k][j];
for (k=1;k<=l;k++)
a[k][j] -= g*a[k][i];
}
}
d[i]=a[i][i]; /*This statement remains.*/
a[i][i]=1.0; /*Reset row and column of a to identity*/
for (j=1;j<=l;j++) a[j][i]=a[i][j]=0.0; /*matrix for next iteration.*/
}
}
| 0 |
11,628,519 | 07/24/2012 10:03:42 | 1,406,729 | 05/20/2012 20:31:52 | 12 | 0 | Resources for learning Rails 3 through a project | I recently finished my Rails app following `Michael Hartl's Rails Tutorial Book`. I have been toying around with the app by adding extra features such as Photo uploads, Twitter-user sign-in etc etc. I was wondering whether there are in another Rails resources out there that use Hartl's project-based approach towards learning.
I was directed towards `Rails for Zombies` and found it to be very limited and big step back after Hartl. I was suggested `Rails 3 in Action by Ryan Bigg and Yehuda Katz.`
Would be grateful if you any of you could provide me with some `project-based learning` resources for Rails.
Thank You! | ruby-on-rails | ruby-on-rails-3 | railstutorial.org | null | null | null | open | Resources for learning Rails 3 through a project
===
I recently finished my Rails app following `Michael Hartl's Rails Tutorial Book`. I have been toying around with the app by adding extra features such as Photo uploads, Twitter-user sign-in etc etc. I was wondering whether there are in another Rails resources out there that use Hartl's project-based approach towards learning.
I was directed towards `Rails for Zombies` and found it to be very limited and big step back after Hartl. I was suggested `Rails 3 in Action by Ryan Bigg and Yehuda Katz.`
Would be grateful if you any of you could provide me with some `project-based learning` resources for Rails.
Thank You! | 0 |
11,628,521 | 07/24/2012 10:03:52 | 969,113 | 09/28/2011 12:55:06 | 70 | 1 | Iterate over unique combination of groups in a data frame | I have 3 different groups summarised in a data frame. The data frame looks like:
d <- data.frame(v1 = c("A","A","A","B","B","B","C","C","C"),
v2 = c(1:9), stringsAsFactors = FALSE)
What I want is to compare the values of A against values of B. Also values of A against values of B and as a last comparison the values of B against the values of C
I constructed 2 for loops to iterate over v1 to extract the groups to compare. However, the for-loops give me all possible combinations like:
A vs. A
A vs. B
A vs. C
B vs. A
B vs. B
B vs. C
C vs. A and so on...
Here are my for-loops:
for(i in unique(d$v1)) {
for(j in unique(d$v1)) {
cat("i = ", i, "j = ", j, "\n")
group1 <- d[which(d$v1 == i), ]
group2 <- d[which(d$v1 == j), ]
print(group1)
print(group2)
cat("---------------------\n\n")
}
}
How can I manage to only iterate over data frame `d` so that in the first iteration group1 contains the values of A and group2 contains the values of B. In the second iteration group1 contains the values of A and group2 the values of C. And as a last comparisons group1 contains values of B and group2 contains values of C.
I am somehow totally stuck with that problem and hoping to find an answer here.
Cheers!
| r | iteration | unique | data.frame | combinations | null | open | Iterate over unique combination of groups in a data frame
===
I have 3 different groups summarised in a data frame. The data frame looks like:
d <- data.frame(v1 = c("A","A","A","B","B","B","C","C","C"),
v2 = c(1:9), stringsAsFactors = FALSE)
What I want is to compare the values of A against values of B. Also values of A against values of B and as a last comparison the values of B against the values of C
I constructed 2 for loops to iterate over v1 to extract the groups to compare. However, the for-loops give me all possible combinations like:
A vs. A
A vs. B
A vs. C
B vs. A
B vs. B
B vs. C
C vs. A and so on...
Here are my for-loops:
for(i in unique(d$v1)) {
for(j in unique(d$v1)) {
cat("i = ", i, "j = ", j, "\n")
group1 <- d[which(d$v1 == i), ]
group2 <- d[which(d$v1 == j), ]
print(group1)
print(group2)
cat("---------------------\n\n")
}
}
How can I manage to only iterate over data frame `d` so that in the first iteration group1 contains the values of A and group2 contains the values of B. In the second iteration group1 contains the values of A and group2 the values of C. And as a last comparisons group1 contains values of B and group2 contains values of C.
I am somehow totally stuck with that problem and hoping to find an answer here.
Cheers!
| 0 |
11,593,418 | 07/21/2012 15:24:27 | 1,080,431 | 12/04/2011 19:13:38 | 6 | 0 | PHP: Fetch file from https only server | I have small php scripts, that fetches some information from other website, which is HTTPS-only (plus, the certificate is invalid, but i know owners). I've used curl for this on localhost - and it worked, but when I uploaded it on free-hosting server, I found that my server does'nt support nor cURL module, neither `file_get_contents("https://other-server.com")` function. By the way, http://other-server.com isn't accesible.
Is there any method to fetch a file from this server using the HTTPS port, but with HTTP protocol? Or is there some method to use HTTPS, altough my server doesn't support it? (It isn't my server, I haven't access to its configuration) | php | https | null | null | null | null | open | PHP: Fetch file from https only server
===
I have small php scripts, that fetches some information from other website, which is HTTPS-only (plus, the certificate is invalid, but i know owners). I've used curl for this on localhost - and it worked, but when I uploaded it on free-hosting server, I found that my server does'nt support nor cURL module, neither `file_get_contents("https://other-server.com")` function. By the way, http://other-server.com isn't accesible.
Is there any method to fetch a file from this server using the HTTPS port, but with HTTP protocol? Or is there some method to use HTTPS, altough my server doesn't support it? (It isn't my server, I haven't access to its configuration) | 0 |
11,560,219 | 07/19/2012 11:48:36 | 562,478 | 01/04/2011 11:37:30 | 1,143 | 93 | controls don't reach right border when aligning right | The right-aligned label doesn't reach the right border:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<Label Content="Left Align" HorizontalAlignment="Left"/>
<Label Content="Right Align" HorizontalAlignment="Right" />
</StackPanel>
It seems that both labels don't take up full available width even though I've specified HorizontalAlignment="Stretch" . What is the cause of it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/i9fIv.png | wpf | horizontal-alignment | null | null | null | null | open | controls don't reach right border when aligning right
===
The right-aligned label doesn't reach the right border:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<Label Content="Left Align" HorizontalAlignment="Left"/>
<Label Content="Right Align" HorizontalAlignment="Right" />
</StackPanel>
It seems that both labels don't take up full available width even though I've specified HorizontalAlignment="Stretch" . What is the cause of it?
![enter image description here][1]
[1]: http://i.stack.imgur.com/i9fIv.png | 0 |
11,560,223 | 07/19/2012 11:48:43 | 1,474,682 | 06/22/2012 11:36:20 | 44 | 1 | Android Virtual Device issue with URLs and buttons | I'm fairly new to this android stuff but I'm building a small app that when you press a button you can go to a specific URL (goes to an optimized version of a website). I've encountered a problem however. The application complies and loads onto the AVD but the only button which provides any response is the first one and the response it produces is a pop-up error message saying (Unfortunately, MyApplication has stopped.) and closes the application. The other buttons do not respond to a click. See code below.
package wag.cymal.libraryportal.welshlibraries;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.graphics.*;
import android.graphics.drawable.Drawable;
/**
* Main Activity will deal with all possible functionality
* @author Daniel Drave
*
*/
@SuppressWarnings("unused")
public class MainActivity extends Activity implements OnClickListener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button libButton1 = (Button) findViewById(R.id.button1); //giving buttons onClickListener will track for user touches
libButton1.setOnClickListener(this);
Button libButton2 = (Button) findViewById(R.id.button2); // ""
libButton2.setOnClickListener(this);
Button libButton3 = (Button) findViewById(R.id.button3); // ""
libButton3.setOnClickListener(this);
Button libButton4 = (Button) findViewById(R.id.button4); // ""
libButton4.setOnClickListener(this);
Button libButton5 = (Button) findViewById(R.id.button5); // ""
libButton5.setOnClickListener(this);
}
/**
* onClick is a required method of OnClickListener and deals with the switch case statement governing what happens depending on
* what button you click.
*/
public void onClick(View v) {
switch (v.getId())
{
case R.id.button1: method1();
break;
case R.id.button2: method2();
break;
case R.id.button3: method3();
break;
case R.id.button4: method4();
break;
case R.id.button5: method5();
break;
default: break;
}
}
/**
*
*/
public void method1() {
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method2(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method3(){
Uri uri = Uri.parse("http://....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method4(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method5(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
So that's the MainActivity.java class and below is the activity_main XML file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/natlib"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="-8dp"
android:padding="@dimen/padding_medium"
android:text="@string/welsh_libs"
android:textColor="#79438F"
android:textSize="27dip"
android:textStyle="bold"
tools:context=".MainActivity" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@id/button1"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#A4C81C"
android:text="@string/ask_lib" />
<Button
android:id="@id/button2"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FF0066"
android:text="@string/find_book" />
<Button
android:id="@id/button3"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#3F83F1"
android:text="@string/find_lib" />
<Button
android:id="@id/button4"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FE0002"
android:text="@string/register" />
<Button
android:id="@id/button5"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#FBFC3F"
android:text="@string/login" />
</LinearLayout>
<ImageView
android:id="@id/image1"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="165dp"
android:layout_weight="0.34"
android:contentDescription="@string/desc"
android:src="@drawable/waglogo"
android:visibility="visible" />
</LinearLayout>
So that's the code and I'm just wondering why it produces that pop-up box. I can't see any logic errors in the code itself.
P.S. I have modified the URLs so you can't see where they actually go. Project is very hush hush ;)![The Pop Up Error message when I click a button][1]
[1]: http://i.stack.imgur.com/OdVxW.png | java | android | xml | avd | null | null | open | Android Virtual Device issue with URLs and buttons
===
I'm fairly new to this android stuff but I'm building a small app that when you press a button you can go to a specific URL (goes to an optimized version of a website). I've encountered a problem however. The application complies and loads onto the AVD but the only button which provides any response is the first one and the response it produces is a pop-up error message saying (Unfortunately, MyApplication has stopped.) and closes the application. The other buttons do not respond to a click. See code below.
package wag.cymal.libraryportal.welshlibraries;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.graphics.*;
import android.graphics.drawable.Drawable;
/**
* Main Activity will deal with all possible functionality
* @author Daniel Drave
*
*/
@SuppressWarnings("unused")
public class MainActivity extends Activity implements OnClickListener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button libButton1 = (Button) findViewById(R.id.button1); //giving buttons onClickListener will track for user touches
libButton1.setOnClickListener(this);
Button libButton2 = (Button) findViewById(R.id.button2); // ""
libButton2.setOnClickListener(this);
Button libButton3 = (Button) findViewById(R.id.button3); // ""
libButton3.setOnClickListener(this);
Button libButton4 = (Button) findViewById(R.id.button4); // ""
libButton4.setOnClickListener(this);
Button libButton5 = (Button) findViewById(R.id.button5); // ""
libButton5.setOnClickListener(this);
}
/**
* onClick is a required method of OnClickListener and deals with the switch case statement governing what happens depending on
* what button you click.
*/
public void onClick(View v) {
switch (v.getId())
{
case R.id.button1: method1();
break;
case R.id.button2: method2();
break;
case R.id.button3: method3();
break;
case R.id.button4: method4();
break;
case R.id.button5: method5();
break;
default: break;
}
}
/**
*
*/
public void method1() {
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method2(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method3(){
Uri uri = Uri.parse("http://....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method4(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
/**
*
*/
public void method5(){
Uri uri = Uri.parse("http://.....");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
So that's the MainActivity.java class and below is the activity_main XML file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/natlib"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="-8dp"
android:padding="@dimen/padding_medium"
android:text="@string/welsh_libs"
android:textColor="#79438F"
android:textSize="27dip"
android:textStyle="bold"
tools:context=".MainActivity" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@id/button1"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#A4C81C"
android:text="@string/ask_lib" />
<Button
android:id="@id/button2"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FF0066"
android:text="@string/find_book" />
<Button
android:id="@id/button3"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#3F83F1"
android:text="@string/find_lib" />
<Button
android:id="@id/button4"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:background="#FE0002"
android:text="@string/register" />
<Button
android:id="@id/button5"
android:layout_width="137dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#FBFC3F"
android:text="@string/login" />
</LinearLayout>
<ImageView
android:id="@id/image1"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="165dp"
android:layout_weight="0.34"
android:contentDescription="@string/desc"
android:src="@drawable/waglogo"
android:visibility="visible" />
</LinearLayout>
So that's the code and I'm just wondering why it produces that pop-up box. I can't see any logic errors in the code itself.
P.S. I have modified the URLs so you can't see where they actually go. Project is very hush hush ;)![The Pop Up Error message when I click a button][1]
[1]: http://i.stack.imgur.com/OdVxW.png | 0 |
11,594,582 | 07/21/2012 17:55:41 | 457,172 | 09/24/2010 10:44:36 | 1,809 | 1 | MVVMLight: Creating viewmodels for usercontrols, how to get access to "there data" from my main viewmodel | can anyone help?
I am using MVVMLight with a WP7 app. I have created a Main view connected to a viewmodel. This main view has a number of of custom controls that i created. Now from my understanding each usercontrol must have its own individual viewmodel.
SO i have my main view datacontext connected to its viewmodel and every usercontrol's datacontext pointing to its own viewmodel.
Problem is, how do i get access to my viewmodel data from my custom controls in my viewmodel for my main view.
I am a little confused.
I could use the messenger but this sounds way too much work just to get the viewmodels communication.
If anyone can lend a hand it would be really helpful or if anyone has any examples.
I don't see any documentation or recommendations on created usercontrols in mvvmlight. | silverlight | windows-phone-7 | mvvm | viewmodel | mvvm-light | null | open | MVVMLight: Creating viewmodels for usercontrols, how to get access to "there data" from my main viewmodel
===
can anyone help?
I am using MVVMLight with a WP7 app. I have created a Main view connected to a viewmodel. This main view has a number of of custom controls that i created. Now from my understanding each usercontrol must have its own individual viewmodel.
SO i have my main view datacontext connected to its viewmodel and every usercontrol's datacontext pointing to its own viewmodel.
Problem is, how do i get access to my viewmodel data from my custom controls in my viewmodel for my main view.
I am a little confused.
I could use the messenger but this sounds way too much work just to get the viewmodels communication.
If anyone can lend a hand it would be really helpful or if anyone has any examples.
I don't see any documentation or recommendations on created usercontrols in mvvmlight. | 0 |
11,594,584 | 07/21/2012 17:55:57 | 1,103,263 | 12/17/2011 08:57:32 | 147 | 4 | Displaying parameters of method in a textview or toast | Hey guys i cannot figure out the logic behind why my code is not working, apparently I am not allowed to print out these values in this way. I cannot display the values of v1,v2,v3 or v4 into a toast or a textfield, but i can display strings. Am i calling these values wrong?
If you need me to post more code let me know.
testWheelValue(R.id.passw_1, v1);
testWheelValue(R.id.passw_2, v2);
testWheelValue(R.id.passw_3, v3);
testWheelValue(R.id.passw_4, v4);
testpins = v1 + v2 + v3 + v4;
text.setText(testpins);
// Toast.makeText(getBaseContext(), testpins,
// Toast.LENGTH_SHORT).show();
private boolean testWheelValue(int id, int value) {
return getWheel(id).getCurrentItem() == value;
} | android | parameters | boolean | int | toast | null | open | Displaying parameters of method in a textview or toast
===
Hey guys i cannot figure out the logic behind why my code is not working, apparently I am not allowed to print out these values in this way. I cannot display the values of v1,v2,v3 or v4 into a toast or a textfield, but i can display strings. Am i calling these values wrong?
If you need me to post more code let me know.
testWheelValue(R.id.passw_1, v1);
testWheelValue(R.id.passw_2, v2);
testWheelValue(R.id.passw_3, v3);
testWheelValue(R.id.passw_4, v4);
testpins = v1 + v2 + v3 + v4;
text.setText(testpins);
// Toast.makeText(getBaseContext(), testpins,
// Toast.LENGTH_SHORT).show();
private boolean testWheelValue(int id, int value) {
return getWheel(id).getCurrentItem() == value;
} | 0 |
11,594,587 | 07/21/2012 17:56:11 | 1,203,556 | 02/11/2012 09:06:27 | 640 | 3 | Python - how to do <xor> in python e.g. enc_price = pad <xor> price | I am new to crypto and I am, trying to interpret the below. Namely, what does <xor> mean?
I have a secret_key secret key. I also have a unique_id. I create pad using the below.
pad = hmac.new(secret_key, msg=unique_id, digestmod=hashlib.sha1).digest()
Once the pad is created, I have a price e.g. 1000. I am trying to follow this instruction which is psuedocode:
enc_price = pad <xor> price
In python, what is the code to implement enc_price = pad <xor> price? What is the logic behind doing this?
Thanks
| python | null | null | null | null | null | open | Python - how to do <xor> in python e.g. enc_price = pad <xor> price
===
I am new to crypto and I am, trying to interpret the below. Namely, what does <xor> mean?
I have a secret_key secret key. I also have a unique_id. I create pad using the below.
pad = hmac.new(secret_key, msg=unique_id, digestmod=hashlib.sha1).digest()
Once the pad is created, I have a price e.g. 1000. I am trying to follow this instruction which is psuedocode:
enc_price = pad <xor> price
In python, what is the code to implement enc_price = pad <xor> price? What is the logic behind doing this?
Thanks
| 0 |
11,594,588 | 07/21/2012 17:56:23 | 1,543,019 | 07/21/2012 17:49:59 | 1 | 0 | how to include file in zend framework controller? | hello I am newbie in zend framework ..
I want to know how to includes files in zend framework Controller
I am using action in zend framework controller like that
public function anyAction()
{
require("../mailchimp/anyfile.php");
}
what i can do to include this files, means where is the right place to kept all this files
| php | zend-framework | null | null | null | null | open | how to include file in zend framework controller?
===
hello I am newbie in zend framework ..
I want to know how to includes files in zend framework Controller
I am using action in zend framework controller like that
public function anyAction()
{
require("../mailchimp/anyfile.php");
}
what i can do to include this files, means where is the right place to kept all this files
| 0 |
11,594,592 | 07/21/2012 17:57:17 | 1,510,255 | 07/08/2012 16:15:52 | 45 | 2 | Display ALT-219 █ in textview on Android - Extended ASCII | I want to display a block character "ALT-219" in a textview. It isn't easy to search Google or stackoverflow for this as block means so many other things but I tried. I experimented with saving the file as a UTC-8 and my entire project crashed in some unexplainable way, I went to backups, that crashed in even worse ways. I finally backed out of what I did and rebuilt so I am back to scratch but I am not inclined to experiment without asking for help.
What I am really trying to do is create a pseudo graphic meter so that I have different strings for different values like a gas gauge where there are different number of ALT-219 characters as the values change. This gives me a gauge 1/4 inch high on the screen that goes from one edge to the other and when the tank is empty, no ALT-219 and when full the entire line is full. Not really a gas gauge but I am just trying to explain it. | android | android-textview | null | null | null | null | open | Display ALT-219 █ in textview on Android - Extended ASCII
===
I want to display a block character "ALT-219" in a textview. It isn't easy to search Google or stackoverflow for this as block means so many other things but I tried. I experimented with saving the file as a UTC-8 and my entire project crashed in some unexplainable way, I went to backups, that crashed in even worse ways. I finally backed out of what I did and rebuilt so I am back to scratch but I am not inclined to experiment without asking for help.
What I am really trying to do is create a pseudo graphic meter so that I have different strings for different values like a gas gauge where there are different number of ALT-219 characters as the values change. This gives me a gauge 1/4 inch high on the screen that goes from one edge to the other and when the tank is empty, no ALT-219 and when full the entire line is full. Not really a gas gauge but I am just trying to explain it. | 0 |
11,594,523 | 07/21/2012 17:48:34 | 1,538,798 | 07/19/2012 18:30:44 | 1 | 0 | algorithm - warping image to another image and calculate similarity measure | Have a query on calculation of best matching point of one image to another image through intensity based registration. Would like to have some comments on my algorithm
1) Compute the warp matrix at this iteration
2) For every point of the image A,
2a) We warp the particular image A pixel coordinates with the warp matrix to image B
2b) Perform interpolation to get the corresponding intensity form image B if warped point coordinate is in image B.
2c) Calculate the similarity measure value between warped pixel A intensity and warped image B intensity
3) Cycle through every pixel in image A
4) Cycle through every possible rotation and translation
would this be okay? Any relevant opencv code we can reference?
thanks | algorithm | opencv | null | null | null | null | open | algorithm - warping image to another image and calculate similarity measure
===
Have a query on calculation of best matching point of one image to another image through intensity based registration. Would like to have some comments on my algorithm
1) Compute the warp matrix at this iteration
2) For every point of the image A,
2a) We warp the particular image A pixel coordinates with the warp matrix to image B
2b) Perform interpolation to get the corresponding intensity form image B if warped point coordinate is in image B.
2c) Calculate the similarity measure value between warped pixel A intensity and warped image B intensity
3) Cycle through every pixel in image A
4) Cycle through every possible rotation and translation
would this be okay? Any relevant opencv code we can reference?
thanks | 0 |
11,411,169 | 07/10/2012 10:16:51 | 250,578 | 01/14/2010 09:05:55 | 113 | 7 | Bump API Android crash | I have a huge problem with the bump API on Android. I setup everything like in the example, the first time I start my activity containing the bump code it works great, now if I go back and start it again it just crash due to a Fatal signal error... It happen right after I call the configure of the bump API.
May I need to not call it again ? But there is nothing to check if it already configured or not.
Anyone got the same problem ? | java | android | crash | bump | null | null | open | Bump API Android crash
===
I have a huge problem with the bump API on Android. I setup everything like in the example, the first time I start my activity containing the bump code it works great, now if I go back and start it again it just crash due to a Fatal signal error... It happen right after I call the configure of the bump API.
May I need to not call it again ? But there is nothing to check if it already configured or not.
Anyone got the same problem ? | 0 |
11,411,174 | 07/10/2012 10:17:07 | 1,033,177 | 11/07/2011 05:03:01 | 174 | 15 | Send sms without user Interaction iPhone | I have seen an application which name is "Glympse". In this application sms is sending without user interaction which is not not possible for iPhone.
In my application I also need that so how i implement that?
Thanks in advances. | iphone | mfmessagecomposeview | null | null | null | null | open | Send sms without user Interaction iPhone
===
I have seen an application which name is "Glympse". In this application sms is sending without user interaction which is not not possible for iPhone.
In my application I also need that so how i implement that?
Thanks in advances. | 0 |
11,411,175 | 07/10/2012 10:17:08 | 1,421,518 | 05/28/2012 10:43:26 | 1 | 4 | Do you know a simple php script to throw 403, after ip check? | I have a script where payment processors come with payment confirmations.
To make the page secure, as it can access order information and other user related stuff, I had to limit the acces by ip(/24) as it follows:
$ipAllowed = array(
'192.192.192',
'172.172.172'
);
$ipAllowed = str_replace(".", "\.", implode("|", $ipAllowed));
if(!preg_match("/^($ipAllowed)\.[0-9]{1,3}$/", $_SERVER['REMOTE_ADDR'])){
header('HTTP/1.0 403 Forbidden');
die('You are not allowed to access this file.');
}
*the ip's are just as an example
**Before i used:**
if(!in_array(@$_SERVER['REMOTE_ADDR'], array('ips here'))); //only works with full ip
The !in_array was much neater then the one I use now, but i need something that works with /24 ips, or even with both!
Do you know something that works better/faster, is reliable and much neater? | php | security | http-status-code-403 | in-array | null | null | open | Do you know a simple php script to throw 403, after ip check?
===
I have a script where payment processors come with payment confirmations.
To make the page secure, as it can access order information and other user related stuff, I had to limit the acces by ip(/24) as it follows:
$ipAllowed = array(
'192.192.192',
'172.172.172'
);
$ipAllowed = str_replace(".", "\.", implode("|", $ipAllowed));
if(!preg_match("/^($ipAllowed)\.[0-9]{1,3}$/", $_SERVER['REMOTE_ADDR'])){
header('HTTP/1.0 403 Forbidden');
die('You are not allowed to access this file.');
}
*the ip's are just as an example
**Before i used:**
if(!in_array(@$_SERVER['REMOTE_ADDR'], array('ips here'))); //only works with full ip
The !in_array was much neater then the one I use now, but i need something that works with /24 ips, or even with both!
Do you know something that works better/faster, is reliable and much neater? | 0 |
11,411,181 | 07/10/2012 10:17:17 | 1,514,411 | 07/10/2012 10:00:06 | 1 | 0 | SALESFORCE TO SALESFORCE INTEGRATION USING SOAP API | Iam trying to integrate the data from salesforce to salesforce using SOAP API. I generated apex class through wsdl file. now when iam executing the code in developer console the error is as follows
Web service callout failed: WebService returned a SOAP Fault: No service available for class 'web1' faultcode=soapenv:Client faultactor=
i had written the code @future(callout=true). Is there any requirement of session id or OAuth. | wsdl2java | null | null | null | null | null | open | SALESFORCE TO SALESFORCE INTEGRATION USING SOAP API
===
Iam trying to integrate the data from salesforce to salesforce using SOAP API. I generated apex class through wsdl file. now when iam executing the code in developer console the error is as follows
Web service callout failed: WebService returned a SOAP Fault: No service available for class 'web1' faultcode=soapenv:Client faultactor=
i had written the code @future(callout=true). Is there any requirement of session id or OAuth. | 0 |
11,411,182 | 07/10/2012 10:17:20 | 1,421,206 | 05/28/2012 07:41:47 | 1 | 0 | How to find x and y-offset for slider in python for a web-application | Can anyone please tell me how to find the x-offset and y-offset default value of a Slider in a webpage using python for selenium webdriver.
Thanks in Advance ! | python | webdriver | null | null | null | null | open | How to find x and y-offset for slider in python for a web-application
===
Can anyone please tell me how to find the x-offset and y-offset default value of a Slider in a webpage using python for selenium webdriver.
Thanks in Advance ! | 0 |
11,411,183 | 07/10/2012 10:17:29 | 220,180 | 11/27/2009 17:56:06 | 2,135 | 55 | Having a custom repository not associated to an entity in Symfony 2 / Doctrine 2? | Would be possible to have a custom repository not associated with an entity in Symfony 2 and Doctrine 2? I would like to put in it some native SQL that doesn't fit well in other repositories (it may refer to abstract or entity hierarchy).
How controller code `$this->getDoctrine()->getRepositoty(/* ??? */)` should be replaced? | symfony | symfony-2.0 | doctrine | doctrine2 | null | null | open | Having a custom repository not associated to an entity in Symfony 2 / Doctrine 2?
===
Would be possible to have a custom repository not associated with an entity in Symfony 2 and Doctrine 2? I would like to put in it some native SQL that doesn't fit well in other repositories (it may refer to abstract or entity hierarchy).
How controller code `$this->getDoctrine()->getRepositoty(/* ??? */)` should be replaced? | 0 |
11,411,199 | 07/10/2012 10:18:21 | 1,285,755 | 03/22/2012 11:15:39 | 181 | 3 | What is the difference between class alv and function alv | We are using class alv and function alv, what is the difference between those options? | sap | abap | null | null | null | null | open | What is the difference between class alv and function alv
===
We are using class alv and function alv, what is the difference between those options? | 0 |
11,411,201 | 07/10/2012 10:18:22 | 571,114 | 01/11/2011 10:25:57 | 115 | 6 | Magento 1.4 - PayPal Payments Standard sometimes won't charge shipping | I have a UK based website running Magento 1.4.0.1 and recently added PayPal Payments Standard as a payment option. It works as expected for the most part, but recently I've had 2 overseas orders come through that haven't been charged shipping (one to Germany and one to Sweden).
When viewing the orders in the backend, Magento seems to think that shipping was charged, but when PayPal is checked, it confirms that no shipping was charged. Obviously, the figure charged in PayPal is the Magento figure minus the shipping figure.
I have absolutely no idea why this is happening, but my client is worried about it understandably. This question has been [asked before][1] but there were no replies.
[1]: http://stackoverflow.com/questions/11176208/magento-paypal-payment-missing-shipping-fee-but-only-sometimes | magento | paypal | magento-1.4 | shipping | null | null | open | Magento 1.4 - PayPal Payments Standard sometimes won't charge shipping
===
I have a UK based website running Magento 1.4.0.1 and recently added PayPal Payments Standard as a payment option. It works as expected for the most part, but recently I've had 2 overseas orders come through that haven't been charged shipping (one to Germany and one to Sweden).
When viewing the orders in the backend, Magento seems to think that shipping was charged, but when PayPal is checked, it confirms that no shipping was charged. Obviously, the figure charged in PayPal is the Magento figure minus the shipping figure.
I have absolutely no idea why this is happening, but my client is worried about it understandably. This question has been [asked before][1] but there were no replies.
[1]: http://stackoverflow.com/questions/11176208/magento-paypal-payment-missing-shipping-fee-but-only-sometimes | 0 |
11,411,203 | 07/10/2012 10:18:24 | 1,514,428 | 07/10/2012 10:07:41 | 1 | 0 | Jgrapht multiple labels for a vertex | Iam using Jgraph for visualization of a graph using java. My graph is display perfectly and working good. Now i want to add more than one label to Vertex but i couldn't come up with a solution ?.. any idea ?.
graph.addvertex(label); is the only option it have how can i add one more label to the same vertex.
Thank you in advance..
| jgrapht | null | null | null | null | null | open | Jgrapht multiple labels for a vertex
===
Iam using Jgraph for visualization of a graph using java. My graph is display perfectly and working good. Now i want to add more than one label to Vertex but i couldn't come up with a solution ?.. any idea ?.
graph.addvertex(label); is the only option it have how can i add one more label to the same vertex.
Thank you in advance..
| 0 |
11,411,204 | 07/10/2012 10:18:26 | 868,731 | 07/29/2011 04:32:28 | 16 | 0 | UIMapView - How to create PDFView | How to create PDFView in UIMapView in iphone sdk? | iphone | objective-c | null | null | null | null | open | UIMapView - How to create PDFView
===
How to create PDFView in UIMapView in iphone sdk? | 0 |
11,472,681 | 07/13/2012 14:37:43 | 1,428,109 | 05/16/2012 12:26:22 | 104 | 6 | Can I call some function every month in exact day? | <p>I want to pay automatically every month from my application.
<p>Can I use something like
def pay
Time.now(:day => 2)
end
or something like this ?
<p>Should it be only by clicking some button ? | ruby-on-rails | time | null | null | null | null | open | Can I call some function every month in exact day?
===
<p>I want to pay automatically every month from my application.
<p>Can I use something like
def pay
Time.now(:day => 2)
end
or something like this ?
<p>Should it be only by clicking some button ? | 0 |
11,472,683 | 07/13/2012 14:37:45 | 1,442,489 | 06/07/2012 14:31:57 | 10 | 0 | Cocos2d iphone app runs oddly on actual iphone | I have a simple application using Cocos2d, and all the images show up fine when running on the simulator. However, when i run it on an iphone, all the images are scaled up and incredible amount, making the game unplayable.
Has anyone got any ideas as to why this is happening, and how to fix it? | iphone | xcode | cocos2d | scaling | null | null | open | Cocos2d iphone app runs oddly on actual iphone
===
I have a simple application using Cocos2d, and all the images show up fine when running on the simulator. However, when i run it on an iphone, all the images are scaled up and incredible amount, making the game unplayable.
Has anyone got any ideas as to why this is happening, and how to fix it? | 0 |
11,472,151 | 07/13/2012 14:09:21 | 402,664 | 07/26/2010 19:24:38 | 417 | 25 | PLSQL bulk collect into UDT with join of 1-N tables? | I'm trying to sort out some PL/SQL code, trying to test the performance. Being able to do this will allow us to make much fewer calls the the DB, but I'm not sure how to fill the returned type I've created. Here's a poorly designed table structure that demonstrates what I'm trying to accomplish.
create table emp_group (
gid number,
gname varchar2(10)
);
create table emp (
empID number,
gid number,
empname varchar2(10)
);
create or replace type t_emp as table of emp%rowtype;
create or replace type t_group_emp
(
gid emp_group.gid%type,
gname emp_group.gname%type,
g_emps t_emp
);
We have two tables, one a list of employees and one a list of employee groups. Ignore the fact that there should be a join table between emp_group and emp so that an employee can belong to more than one group... demo code. 8)
I would like to return all of the employees for a given group ID, along with the groups row, in a single returned type. The returned type is t_group_emp, which has a table of emp rows.
I do get a compilation warning on the creation of the t_emp type. I'll edit the code if I sort that out.
1) Is this possible?
2) How would I structure the select statement to fill the returned type? Is 'bulk collect' the correct method here? I found [this page][1] to be a good starting point.
3) How poorly will this perform? I can run my own numbers once I get the syntax sorted, but overall, is this a good approach to returning data from multiple tables with a 1-N relationship?
It will be easy to code the application to consume the returned type, so I'm not worried about that.
edit: we're using Oracle 10.3.something...
Thanks
[1]: http://www.adp-gmbh.ch/ora/plsql/bc/index.html | join | plsql | user-defined-functions | user-defined-types | null | null | open | PLSQL bulk collect into UDT with join of 1-N tables?
===
I'm trying to sort out some PL/SQL code, trying to test the performance. Being able to do this will allow us to make much fewer calls the the DB, but I'm not sure how to fill the returned type I've created. Here's a poorly designed table structure that demonstrates what I'm trying to accomplish.
create table emp_group (
gid number,
gname varchar2(10)
);
create table emp (
empID number,
gid number,
empname varchar2(10)
);
create or replace type t_emp as table of emp%rowtype;
create or replace type t_group_emp
(
gid emp_group.gid%type,
gname emp_group.gname%type,
g_emps t_emp
);
We have two tables, one a list of employees and one a list of employee groups. Ignore the fact that there should be a join table between emp_group and emp so that an employee can belong to more than one group... demo code. 8)
I would like to return all of the employees for a given group ID, along with the groups row, in a single returned type. The returned type is t_group_emp, which has a table of emp rows.
I do get a compilation warning on the creation of the t_emp type. I'll edit the code if I sort that out.
1) Is this possible?
2) How would I structure the select statement to fill the returned type? Is 'bulk collect' the correct method here? I found [this page][1] to be a good starting point.
3) How poorly will this perform? I can run my own numbers once I get the syntax sorted, but overall, is this a good approach to returning data from multiple tables with a 1-N relationship?
It will be easy to code the application to consume the returned type, so I'm not worried about that.
edit: we're using Oracle 10.3.something...
Thanks
[1]: http://www.adp-gmbh.ch/ora/plsql/bc/index.html | 0 |
11,472,276 | 07/13/2012 14:15:50 | 1,274,180 | 03/16/2012 13:57:55 | 1 | 0 | Is a java synchronized method entry point thread safe enough? | I have a Singleton class handling a kind of cache with different objects in a Hashmap.
(The format of a key is directly linded to the type of object stored in the map - hence the map is of <String, Object>)
Three different actions are possible on the map : add, get, remove.
I secured the access to the map by using a public entry point method (no intense access) :
public Object doAction(String actionType, String key, Object data){
Object myObj = null;
if (actionType.equalsIgnorecase("ADD"){
addDataToMyMap(key,data);
} else if (actionType.equalsIgnorecase("GET"){
myObj = getDataFromMyMap(key);
} else if (actionType.equalsIgnorecase("REM"){
removeDataFromMyMap(key);
}
return myObj;
}
Do you confirm it is thread safe for concurrent access to the map since there is no other way to use map but through that method ?
If it is safge for a Map, I guess this principle could be applied to any other kind of shared ressource.
Many thanks in advance for your answers.
David | java | concurrency | thread-safety | shared-resource | null | null | open | Is a java synchronized method entry point thread safe enough?
===
I have a Singleton class handling a kind of cache with different objects in a Hashmap.
(The format of a key is directly linded to the type of object stored in the map - hence the map is of <String, Object>)
Three different actions are possible on the map : add, get, remove.
I secured the access to the map by using a public entry point method (no intense access) :
public Object doAction(String actionType, String key, Object data){
Object myObj = null;
if (actionType.equalsIgnorecase("ADD"){
addDataToMyMap(key,data);
} else if (actionType.equalsIgnorecase("GET"){
myObj = getDataFromMyMap(key);
} else if (actionType.equalsIgnorecase("REM"){
removeDataFromMyMap(key);
}
return myObj;
}
Do you confirm it is thread safe for concurrent access to the map since there is no other way to use map but through that method ?
If it is safge for a Map, I guess this principle could be applied to any other kind of shared ressource.
Many thanks in advance for your answers.
David | 0 |
11,472,694 | 07/13/2012 14:38:16 | 1,334,095 | 04/15/2012 04:26:16 | 26 | 0 | zip code validation in jquery | $('#create_membership').click(function () {
var zip = $('#zip').val();
else if (zip == ''){
errorMessage = "*Zipcode required!";
}
else if ((zip.length)< 5 || (zip.length)>5 ){
errorMessage = "*zipcode should only be 5 digits";
}
else if ( zip =( "^[0-9]+$" )){
errorMessage = "*zipcode should be numbers only";
}
i am getting first and second i.e., empty and length validations for zip code.but for the 3rd case,number validation is not working.can any one help me for getting the number validation
thanks in advance | jquery | validation | null | null | null | null | open | zip code validation in jquery
===
$('#create_membership').click(function () {
var zip = $('#zip').val();
else if (zip == ''){
errorMessage = "*Zipcode required!";
}
else if ((zip.length)< 5 || (zip.length)>5 ){
errorMessage = "*zipcode should only be 5 digits";
}
else if ( zip =( "^[0-9]+$" )){
errorMessage = "*zipcode should be numbers only";
}
i am getting first and second i.e., empty and length validations for zip code.but for the 3rd case,number validation is not working.can any one help me for getting the number validation
thanks in advance | 0 |
11,472,696 | 07/13/2012 14:38:32 | 1,517,037 | 07/11/2012 07:44:56 | 43 | 2 | Issues when using f2py module in python code | I have a FORTRAN code that required the following compile command
gfortran -c interp.f -ffixed-format -ffix-line-length-none
I compiled the same using f2py module in python
from numpy import f2py
f2py.compile(open('interp.f').read(),modulename='interp',external_flags='-ffixed-format -ffix-line-length-none',verbose=0)
It is unable to compile the module. It gives an error saying invalid file format '' at '-ffized-format'
Please help
| python | compilation | fortran | compiler-flags | f2py | null | open | Issues when using f2py module in python code
===
I have a FORTRAN code that required the following compile command
gfortran -c interp.f -ffixed-format -ffix-line-length-none
I compiled the same using f2py module in python
from numpy import f2py
f2py.compile(open('interp.f').read(),modulename='interp',external_flags='-ffixed-format -ffix-line-length-none',verbose=0)
It is unable to compile the module. It gives an error saying invalid file format '' at '-ffized-format'
Please help
| 0 |
11,472,697 | 06/12/2012 20:37:45 | 1,446,973 | 06/10/2012 05:05:12 | 13 | 0 | How to populate a form list with buttons using javascript | I made a script that, when you press one button(`accessories`) the selection(`mylist`) populates with one array(`accessoryData`), and when you hit the other button(`weapons`) the other array(`weaponData`) populates the selection. However, in the current state of the code the second button press is not re-populating the selection. What is wrong here?
Also if there is a more efficient way to do this, that might be helpful.
[Full code][1]
function runList(form, test) {
var html = "";
var x;
dataType(test);
while (x < dataType.length) {
html += "<option>" + dataType[x];
x++;
}
document.getElementById("mylist").innerHTML = html;
}
[1]: http://jsfiddle.net/StealingMana/WKNYn/2/ | javascript | null | null | null | null | null | open | How to populate a form list with buttons using javascript
===
I made a script that, when you press one button(`accessories`) the selection(`mylist`) populates with one array(`accessoryData`), and when you hit the other button(`weapons`) the other array(`weaponData`) populates the selection. However, in the current state of the code the second button press is not re-populating the selection. What is wrong here?
Also if there is a more efficient way to do this, that might be helpful.
[Full code][1]
function runList(form, test) {
var html = "";
var x;
dataType(test);
while (x < dataType.length) {
html += "<option>" + dataType[x];
x++;
}
document.getElementById("mylist").innerHTML = html;
}
[1]: http://jsfiddle.net/StealingMana/WKNYn/2/ | 0 |
11,471,119 | 07/13/2012 13:05:39 | 934,597 | 09/08/2011 10:33:13 | 46 | 0 | NoSuchMethodException with getter and setter in play framework 1.2.5 | I am using play framework for my application. It gives me
Execution exception (In /app/helper/FinansHelper.java around line 189)
NoSuchMethodException occured : finansServis.helper.KayitliIslemDto.getIpcMemo()
How can I solve this problem? | playframework-1.x | nosuchmethoderror | null | null | null | null | open | NoSuchMethodException with getter and setter in play framework 1.2.5
===
I am using play framework for my application. It gives me
Execution exception (In /app/helper/FinansHelper.java around line 189)
NoSuchMethodException occured : finansServis.helper.KayitliIslemDto.getIpcMemo()
How can I solve this problem? | 0 |
11,373,507 | 07/07/2012 08:29:12 | 1,265,202 | 03/12/2012 21:56:56 | 5 | 0 | "String could not be parsed as XML" php error | i keep getting this error when i try to create a new instance of SimpleXMLElement.
i checked my xml syntax manually and with online tools, and even copy/pasted the example XML file from php.net, but i'm still getting the error.
<br>
my code:<br>
265: include 'example.php';
266: $namevalues= new SimpleXMLElement($xmlstr);
<br>the example.php:<br>
<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<great-lines>
<line>PHP solves all my web problems</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
XML;
?>
the error:
> Fatal error: Uncaught exception 'Exception' with message 'String could
> not be parsed as XML' in
> C:\AbyssRoot\htdocs\Forum\Sources\showhomework.php on line 266 | php | xml | fatal-error | simplexmlelement | null | null | open | "String could not be parsed as XML" php error
===
i keep getting this error when i try to create a new instance of SimpleXMLElement.
i checked my xml syntax manually and with online tools, and even copy/pasted the example XML file from php.net, but i'm still getting the error.
<br>
my code:<br>
265: include 'example.php';
266: $namevalues= new SimpleXMLElement($xmlstr);
<br>the example.php:<br>
<?php
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<great-lines>
<line>PHP solves all my web problems</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
</movies>
XML;
?>
the error:
> Fatal error: Uncaught exception 'Exception' with message 'String could
> not be parsed as XML' in
> C:\AbyssRoot\htdocs\Forum\Sources\showhomework.php on line 266 | 0 |
11,373,508 | 07/07/2012 08:29:13 | 867,487 | 07/28/2011 12:47:00 | 1 | 0 | JQuery Modal Dialog does not behave as in example | First of all, I am new to JQuery and Web technologies overall. I have been playing with node.js/expressjs/jade.js and JQuery few weeks so far.
For some reason I just cant get modal dialog work. Following code shows button and button click shows "dialog". This dialog is just div element below button, not over button. On the top of that you cannot move button and style is not same as shown in JQuery example.
http://jqueryui.com/demos/dialog/
Could someone be kind and point the problem or copy-paste working example. Thanks.
<html>
<head>
<title>Places Server</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all"/>
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
jQuery(document).ready( function(){
jQuery("#myButton").click( showDialog );
//variable to reference window
$myWindow = jQuery('#myDiv');
//instantiate the dialog
$myWindow.dialog({ height: 350,
width: 400,
modal: true,
position: 'center',
autoOpen:false,
title:'Hello World'
//overlay: { opacity: 0.5, background: 'black'}
});
}
);
//function to show dialog
var showDialog = function() {
//if the contents have been hidden with css, you need this
$myWindow.show();
//open the dialog
$myWindow.dialog("open");
}
//function to close dialog, probably called by a button in the dialog
var closeDialog = function() {
$myWindow.dialog("close");
}
</script>
</head>
<body>
<input id="myButton" name="myButton" value="Click Me" type="button"/>
<div id="myDiv" style="display:none" class="ui-dialog ui-widget ui-widget-content ui-corner-all undefined ui-draggable ui-resizable">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span id="ui-dialog-title-dialog" class="ui-dialog-title">Dialog title</span></div>
<div id="dialog" class="ui-dialog-content ui-widget-content">
<p>I am a modal dialog</p>
</div>
</div>
</body>
</html> | jquery | node.js | dialog | expressjs | null | null | open | JQuery Modal Dialog does not behave as in example
===
First of all, I am new to JQuery and Web technologies overall. I have been playing with node.js/expressjs/jade.js and JQuery few weeks so far.
For some reason I just cant get modal dialog work. Following code shows button and button click shows "dialog". This dialog is just div element below button, not over button. On the top of that you cannot move button and style is not same as shown in JQuery example.
http://jqueryui.com/demos/dialog/
Could someone be kind and point the problem or copy-paste working example. Thanks.
<html>
<head>
<title>Places Server</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all"/>
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
jQuery(document).ready( function(){
jQuery("#myButton").click( showDialog );
//variable to reference window
$myWindow = jQuery('#myDiv');
//instantiate the dialog
$myWindow.dialog({ height: 350,
width: 400,
modal: true,
position: 'center',
autoOpen:false,
title:'Hello World'
//overlay: { opacity: 0.5, background: 'black'}
});
}
);
//function to show dialog
var showDialog = function() {
//if the contents have been hidden with css, you need this
$myWindow.show();
//open the dialog
$myWindow.dialog("open");
}
//function to close dialog, probably called by a button in the dialog
var closeDialog = function() {
$myWindow.dialog("close");
}
</script>
</head>
<body>
<input id="myButton" name="myButton" value="Click Me" type="button"/>
<div id="myDiv" style="display:none" class="ui-dialog ui-widget ui-widget-content ui-corner-all undefined ui-draggable ui-resizable">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span id="ui-dialog-title-dialog" class="ui-dialog-title">Dialog title</span></div>
<div id="dialog" class="ui-dialog-content ui-widget-content">
<p>I am a modal dialog</p>
</div>
</div>
</body>
</html> | 0 |
11,373,511 | 07/07/2012 08:29:59 | 808,203 | 06/21/2011 10:08:03 | 333 | 11 | How execv gets the output from pipe? | referring to the old homework question : `/* implementing "/usr/bin/ps -ef | /usr/bin/more" */`
using pipes.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
int fds[2];
int child[2];
char *argv[3];
pipe(fds);
if (fork()== 0) {
close(fds[1]);
close(STDIN_FILENO); dup(fds[0]); /* redirect standard input to fds[1] */
argv[0] = "/bin/more";
argv[1] = NULL; /* check how the argv array is set */
execv(argv[0], argv);// here how execv reads from stdin ??
exit(0);
}
if (fork() == 0) {
close(fds[0]);
close(STDOUT_FILENO); dup(fds[1]); /* redirect standard output to fds[0] */
argv[0] = "/bin/ps";
argv[1] = "-e"; argv[2] = NULL;
execv(argv[0], argv);
exit(0);
}
close(fds[1]);
wait(&child[0]);
wait(&child[0]);
}
After redirecting the fd to standard output, how does execv reads from it. Is it inbuilt in execv that it reads from standard input before executing the command? I am unable to get this concept. | c | operating-system | execv | null | null | null | open | How execv gets the output from pipe?
===
referring to the old homework question : `/* implementing "/usr/bin/ps -ef | /usr/bin/more" */`
using pipes.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
int fds[2];
int child[2];
char *argv[3];
pipe(fds);
if (fork()== 0) {
close(fds[1]);
close(STDIN_FILENO); dup(fds[0]); /* redirect standard input to fds[1] */
argv[0] = "/bin/more";
argv[1] = NULL; /* check how the argv array is set */
execv(argv[0], argv);// here how execv reads from stdin ??
exit(0);
}
if (fork() == 0) {
close(fds[0]);
close(STDOUT_FILENO); dup(fds[1]); /* redirect standard output to fds[0] */
argv[0] = "/bin/ps";
argv[1] = "-e"; argv[2] = NULL;
execv(argv[0], argv);
exit(0);
}
close(fds[1]);
wait(&child[0]);
wait(&child[0]);
}
After redirecting the fd to standard output, how does execv reads from it. Is it inbuilt in execv that it reads from standard input before executing the command? I am unable to get this concept. | 0 |
11,373,512 | 07/07/2012 08:30:04 | 403,034 | 07/27/2010 06:43:39 | 39 | 4 | Setting Checbox values in checkboxselectionmodel | I want a grid with checkbox in all rows like the one in this link http://gwt-ext.com/demo/#checkboxSelectionGrid After saving selected records, i want to set the checbox selected earlier.
How this can be done? | extjs | extjs-mvc | extjs4.1 | null | null | null | open | Setting Checbox values in checkboxselectionmodel
===
I want a grid with checkbox in all rows like the one in this link http://gwt-ext.com/demo/#checkboxSelectionGrid After saving selected records, i want to set the checbox selected earlier.
How this can be done? | 0 |
11,373,515 | 07/07/2012 08:30:58 | 1,333,611 | 04/14/2012 18:33:51 | -2 | 0 | how to overcome this NullPointerException ? |
import java.sql.*;
import java.io.*;
import java.util.*;
public class A {
public static void main(String args[]){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con= DriverManager.getConnection("jdbc:odbc:debjeet", "system", "tiger");
PreparedStatement st=con.prepareStatement("insert into emp values('?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?')"); //there are 17 fields in the database
BufferedReader dis= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the desired username");
String us=dis.readLine();
st.setString(1,(String)us); //this was an attempt made by me to remove the exception ,otherwise all were below as from index 4.also the exception occurs here.
System.out.println("Enter the desired password");
String pw=dis.readLine();
st.setString(2,pw);
System.out.println("Enter your First Name");
String fn=dis.readLine();
st.setString(3, fn);
System.out.println("Enter your Middle Name");
String mn=dis.readLine();
System.out.println("Enter your Last Name");
String ln=dis.readLine();
System.out.println("Enter your Email");
String em=dis.readLine();
System.out.println("Enter your Date of Birth");
int dob= Integer.parseInt(dis.readLine());
System.out.println("Enter your Month of Birth");
String mob=dis.readLine();
System.out.println("Enter your Year of Birth");
int yob=Integer.parseInt(dis.readLine());
System.out.println("Enter your Gender(M/F)");
String gen=dis.readLine();
System.out.println("Enter your Institute");
String inst=dis.readLine();
System.out.println("Enter your Address");
String add=dis.readLine();
System.out.println("Enter your City");
String ct=dis.readLine();
System.out.println("Enter your State");
String state=dis.readLine();
System.out.println("Enter your Pincode");
int pin=Integer.parseInt(dis.readLine());
System.out.println("Enter your Country");
String cn=dis.readLine();
System.out.println("Enter your 10 digit mobile number");
String phnum=dis.readLine();
System.out.println("Thank you :D");
st.setString(4, mn);
st.setString(5, ln);
st.setString(6, em);
st.setString(7, gen);
st.setString(8, inst);
st.setString(9, add);
st.setString(10, ct);
st.setString(11, state);
st.setInt(12, pin);
st.setString(13, cn);
st.setString(14, phnum);
st.setInt(15,dob);
st.setString(16, mob);
st.setInt(17, yob);
int i=st.executeUpdate();
if(i>0)
System.out.println("SUCCESS");
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
OUTPUT:
Enter the desired username
grg
java.lang.NullPointerException
/*this code is showing a null pointer exception in a machine and an invalid column index message in other machine. dont know how to proceed.on the other hand the databse is working fine if am tryin to insert values using a statement object.i guess there is a problem in the prepared statement object but cannot resolve ienter code here`t.
*/
| java-ee | jdbc | nullpointerexception | prepared-statement | null | null | open | how to overcome this NullPointerException ?
===
import java.sql.*;
import java.io.*;
import java.util.*;
public class A {
public static void main(String args[]){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con= DriverManager.getConnection("jdbc:odbc:debjeet", "system", "tiger");
PreparedStatement st=con.prepareStatement("insert into emp values('?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?','?')"); //there are 17 fields in the database
BufferedReader dis= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the desired username");
String us=dis.readLine();
st.setString(1,(String)us); //this was an attempt made by me to remove the exception ,otherwise all were below as from index 4.also the exception occurs here.
System.out.println("Enter the desired password");
String pw=dis.readLine();
st.setString(2,pw);
System.out.println("Enter your First Name");
String fn=dis.readLine();
st.setString(3, fn);
System.out.println("Enter your Middle Name");
String mn=dis.readLine();
System.out.println("Enter your Last Name");
String ln=dis.readLine();
System.out.println("Enter your Email");
String em=dis.readLine();
System.out.println("Enter your Date of Birth");
int dob= Integer.parseInt(dis.readLine());
System.out.println("Enter your Month of Birth");
String mob=dis.readLine();
System.out.println("Enter your Year of Birth");
int yob=Integer.parseInt(dis.readLine());
System.out.println("Enter your Gender(M/F)");
String gen=dis.readLine();
System.out.println("Enter your Institute");
String inst=dis.readLine();
System.out.println("Enter your Address");
String add=dis.readLine();
System.out.println("Enter your City");
String ct=dis.readLine();
System.out.println("Enter your State");
String state=dis.readLine();
System.out.println("Enter your Pincode");
int pin=Integer.parseInt(dis.readLine());
System.out.println("Enter your Country");
String cn=dis.readLine();
System.out.println("Enter your 10 digit mobile number");
String phnum=dis.readLine();
System.out.println("Thank you :D");
st.setString(4, mn);
st.setString(5, ln);
st.setString(6, em);
st.setString(7, gen);
st.setString(8, inst);
st.setString(9, add);
st.setString(10, ct);
st.setString(11, state);
st.setInt(12, pin);
st.setString(13, cn);
st.setString(14, phnum);
st.setInt(15,dob);
st.setString(16, mob);
st.setInt(17, yob);
int i=st.executeUpdate();
if(i>0)
System.out.println("SUCCESS");
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
}
OUTPUT:
Enter the desired username
grg
java.lang.NullPointerException
/*this code is showing a null pointer exception in a machine and an invalid column index message in other machine. dont know how to proceed.on the other hand the databse is working fine if am tryin to insert values using a statement object.i guess there is a problem in the prepared statement object but cannot resolve ienter code here`t.
*/
| 0 |
11,373,525 | 07/07/2012 08:32:27 | 192,400 | 10/19/2009 12:01:57 | 174 | 11 | Debugging WPF DataGrid Virtualization Issue | I'm using a WPF datagrid (.Net or Toolkit), that is unacceptably slow when binding to an observable collection. It contains roughly 3500 rows and 10 columns and takes over a minute to display the contents. Everything points the the fact that it is not doing UI virtualization of the data. However, I can't figure out why that is the case.
I am not using grouping.
I have made sure the grid's height is contained by placing it in a panel with a fixed height.
I have set all the virtualization properties on the DataGrid.
I have checked in snoop and these properties are set. However, snoop also shows that after loading there are several thousand datagridrows in the visual tree. Whether this is something that is caused by using snoop I have no idea.
I have tried using AQTime to find out what is going on. The slowdown does not appear to be in our code but in system code. However, I can't find a way of easily seeing what WPF is up to.
I have stripped down the grid and have tried both the .Net 4 DataGrid and the toolkit DataGrid. Both are unacceptably slow to show the initial data.
I have tried fixing the row height and column widths. This also makes no difference.
How can I confirm that virtualisation is on and if is is off why it is off?
How can I debug what is happening outside of our code? Is there any way of seeing what WPF is up to? (I've tried using the WPF Performance suite, but for some reason it does not give any output for our application).
I'm running out of ideas. It should not be this slow, when only 10 rows are visible in the UI.
Can anyone help?
| wpf | performance | debugging | datagrid | null | null | open | Debugging WPF DataGrid Virtualization Issue
===
I'm using a WPF datagrid (.Net or Toolkit), that is unacceptably slow when binding to an observable collection. It contains roughly 3500 rows and 10 columns and takes over a minute to display the contents. Everything points the the fact that it is not doing UI virtualization of the data. However, I can't figure out why that is the case.
I am not using grouping.
I have made sure the grid's height is contained by placing it in a panel with a fixed height.
I have set all the virtualization properties on the DataGrid.
I have checked in snoop and these properties are set. However, snoop also shows that after loading there are several thousand datagridrows in the visual tree. Whether this is something that is caused by using snoop I have no idea.
I have tried using AQTime to find out what is going on. The slowdown does not appear to be in our code but in system code. However, I can't find a way of easily seeing what WPF is up to.
I have stripped down the grid and have tried both the .Net 4 DataGrid and the toolkit DataGrid. Both are unacceptably slow to show the initial data.
I have tried fixing the row height and column widths. This also makes no difference.
How can I confirm that virtualisation is on and if is is off why it is off?
How can I debug what is happening outside of our code? Is there any way of seeing what WPF is up to? (I've tried using the WPF Performance suite, but for some reason it does not give any output for our application).
I'm running out of ideas. It should not be this slow, when only 10 rows are visible in the UI.
Can anyone help?
| 0 |
11,373,526 | 07/07/2012 08:32:35 | 1,187,098 | 02/03/2012 08:54:37 | 78 | 1 | jquery 1.3.2 initial load fails on (document).ready in ie8, but works on refresh | using jquery 1.3.2.min, ui.1.7.3.min & main.js with the script functions. I have a strange behavior on ie8.
When I load the page initially the scripts all download fully, however the JQ does not fire
SCRIPT16389: Failed
jquery.132.min.js, line 19 character 5841
three conditions can change this behavior
1. refresh the page and it works fine
2. add an alert as the first line and it also works fine.
3. including the main.js in the page itself rather than an include
for example
$(document).ready(function(){
alert("now works!);
any theories or suggestions, as the code on the reload or alert works 100%
thx Art
| jquery | onload | null | null | null | null | open | jquery 1.3.2 initial load fails on (document).ready in ie8, but works on refresh
===
using jquery 1.3.2.min, ui.1.7.3.min & main.js with the script functions. I have a strange behavior on ie8.
When I load the page initially the scripts all download fully, however the JQ does not fire
SCRIPT16389: Failed
jquery.132.min.js, line 19 character 5841
three conditions can change this behavior
1. refresh the page and it works fine
2. add an alert as the first line and it also works fine.
3. including the main.js in the page itself rather than an include
for example
$(document).ready(function(){
alert("now works!);
any theories or suggestions, as the code on the reload or alert works 100%
thx Art
| 0 |
11,373,529 | 07/07/2012 08:33:01 | 561,309 | 01/03/2011 13:52:58 | 9,147 | 427 | Check if an image is loaded in jQuery (or plain JavaScript) | I know there's a `load()` event in jQuery which is triggered when the image has finished loading. But what if the event handler is attached *after* the image has finished loading?
Is there a property like `$('#myimage').isLoaded()` to check if the image is already loaded? | javascript | jquery | image | loaded | null | null | open | Check if an image is loaded in jQuery (or plain JavaScript)
===
I know there's a `load()` event in jQuery which is triggered when the image has finished loading. But what if the event handler is attached *after* the image has finished loading?
Is there a property like `$('#myimage').isLoaded()` to check if the image is already loaded? | 0 |
11,373,530 | 07/07/2012 08:33:25 | 1,430,163 | 06/01/2012 07:46:29 | 1 | 0 | How to use the specific font in jasper reports | I want to use my own specific font in my jasper reports.I am using the jasper reports-4.5.0.If i use the Helvetica as the font name in my jrxml file then i am getting the exception as Font not available to the JVM.How to resolve this problem. | jasper-reports | null | null | null | null | null | open | How to use the specific font in jasper reports
===
I want to use my own specific font in my jasper reports.I am using the jasper reports-4.5.0.If i use the Helvetica as the font name in my jrxml file then i am getting the exception as Font not available to the JVM.How to resolve this problem. | 0 |
11,351,012 | 07/05/2012 19:14:12 | 1,499,209 | 07/03/2012 15:10:58 | 11 | 0 | How to mySQL query two tables and compile results into one array in PHP? | I am using two queries to select the values from their respective tables, and I want to put them into one array. For example, using the code below, I want to have id, last, first, course1, course2, course3 from $startsem1 and $endsem1 in one array.
$startquery = "SELECT id,last,first,course1,course2,course3 FROM $startsem1"
$endquery = "SELECT id,last,first,course1,course2,course3 FROM $endsem1"
$startresult = mysql_query($startquery) or die(mysql_error());
$endresult = mysql_query($endquery) or die(mysql_error());
while (($startrow = mysql_fetch_array($startresult)) & (endrow = mysql_fetch_array($endresult))
{
foreach ($row as $key => $value)
{
$row[$key.".".$semester] = $value;
unset($row[$key]);
}
}
How can I do this? Do I need to use a join or a union instead of 2 separate queries? | php | mysql | query | datatable | null | null | open | How to mySQL query two tables and compile results into one array in PHP?
===
I am using two queries to select the values from their respective tables, and I want to put them into one array. For example, using the code below, I want to have id, last, first, course1, course2, course3 from $startsem1 and $endsem1 in one array.
$startquery = "SELECT id,last,first,course1,course2,course3 FROM $startsem1"
$endquery = "SELECT id,last,first,course1,course2,course3 FROM $endsem1"
$startresult = mysql_query($startquery) or die(mysql_error());
$endresult = mysql_query($endquery) or die(mysql_error());
while (($startrow = mysql_fetch_array($startresult)) & (endrow = mysql_fetch_array($endresult))
{
foreach ($row as $key => $value)
{
$row[$key.".".$semester] = $value;
unset($row[$key]);
}
}
How can I do this? Do I need to use a join or a union instead of 2 separate queries? | 0 |
11,351,013 | 07/05/2012 19:14:14 | 1,210,233 | 02/14/2012 23:47:59 | 6 | 1 | Android: accessing the images that make up a video | I'm making an app that takes a video and does some computation on the video. I need to carry out this computation on individual frames of the video. So, I have two questions:
1. Are videos in Android stored as a sequence of pictures? (I've seen a lot of Android devices that advertise having 25-30 fps cameras) If yes, can I, as a developer, get access to these frames that make up a video and how so?
2. If not, is there any way for me to generate at least 15-20 distinct frames per second from a video taken on an android device? (and of course, do the computation on those frames generated) | android | opencv | camera | android-camera | null | null | open | Android: accessing the images that make up a video
===
I'm making an app that takes a video and does some computation on the video. I need to carry out this computation on individual frames of the video. So, I have two questions:
1. Are videos in Android stored as a sequence of pictures? (I've seen a lot of Android devices that advertise having 25-30 fps cameras) If yes, can I, as a developer, get access to these frames that make up a video and how so?
2. If not, is there any way for me to generate at least 15-20 distinct frames per second from a video taken on an android device? (and of course, do the computation on those frames generated) | 0 |
11,351,015 | 07/05/2012 19:14:24 | 1,389,920 | 05/11/2012 16:38:22 | 3 | 0 | Multiple @PathVariable in Spring MVC | Couldn't find an answer to this unfortunately so hoping someone can help.
In Spring MVC 3.1.0 here is my method:
@RequestMapping(value = "/{app}/conf/{fnm}", method=RequestMethod.GET)
public ResponseEntity<?> getConf(@PathVariable String app, @PathVariable String fnm) {
log.debug("AppName:" + app);
log.debug("fName:" + fnm);
...
return ...
}
I've seen some examples online and it appears there is no problem having multiple @PathVariables in theory.
However when I do it, both "app" and "fnm" contain the same value (which is whatever value was assigned to "app").
Really appreciate any insight someone may have to where I'm going wrong?
Thanks! | java | spring | spring-mvc | annotations | path-variables | null | open | Multiple @PathVariable in Spring MVC
===
Couldn't find an answer to this unfortunately so hoping someone can help.
In Spring MVC 3.1.0 here is my method:
@RequestMapping(value = "/{app}/conf/{fnm}", method=RequestMethod.GET)
public ResponseEntity<?> getConf(@PathVariable String app, @PathVariable String fnm) {
log.debug("AppName:" + app);
log.debug("fName:" + fnm);
...
return ...
}
I've seen some examples online and it appears there is no problem having multiple @PathVariables in theory.
However when I do it, both "app" and "fnm" contain the same value (which is whatever value was assigned to "app").
Really appreciate any insight someone may have to where I'm going wrong?
Thanks! | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.