question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,237,966
6,238,100
How to alternate table row background colors with JSTL?
How do i alternate table rows with 2 seperate colours but i nid the header row to be of another colour. Is it possible? i am required to use the looping technique. oh no i aint allowed to post pictures. but it looks something like a table with 5 rows and the header row is blue in colour while the other 4 rows are red>w...
Use with a varStatus and some lines of CSS. header1 header2 header3 ${item.property1} ${item.property2} ${item.property3} with CSS tr.even { background: red; } tr.odd { background: white; } In the above example, the header is just separated from the body. When the table row index in the body is a multiple of 2 (even), ...
How to alternate table row background colors with JSTL? How do i alternate table rows with 2 seperate colours but i nid the header row to be of another colour. Is it possible? i am required to use the looping technique. oh no i aint allowed to post pictures. but it looks something like a table with 5 rows and the heade...
TITLE: How to alternate table row background colors with JSTL? QUESTION: How do i alternate table rows with 2 seperate colours but i nid the header row to be of another colour. Is it possible? i am required to use the looping technique. oh no i aint allowed to post pictures. but it looks something like a table with 5 ...
[ "java", "html", "jstl" ]
5
11
8,430
1
0
2011-06-04T16:33:20.400000
2011-06-04T16:55:33.640000
6,237,968
6,238,119
How to extract the text between two patterns using REGEX perl
In the following lines how can I store the lines between " Description: " and " Tag: " in a variable using REGEX PERL and what would be a good datatype to use, string or list or something else? (I am trying to write a program in Perl to extract the information of a text file with Debian package information and convert ...
my $desc = "Description:"; my $tag = "Tag:"; $line =~ /$desc(.*?)$tag/; my $matched = $1; print $matched; or my $desc = "Description:"; my $tag = "Tag:"; my @matched = $line =~ /$desc(.*?)$tag/; print $matched[0]; or my $desc = "Description:"; my $tag = "Tag:"; (my $matched = $line) =~ s/$desc(.*?)$tag/$1/; print $m...
How to extract the text between two patterns using REGEX perl In the following lines how can I store the lines between " Description: " and " Tag: " in a variable using REGEX PERL and what would be a good datatype to use, string or list or something else? (I am trying to write a program in Perl to extract the informati...
TITLE: How to extract the text between two patterns using REGEX perl QUESTION: In the following lines how can I store the lines between " Description: " and " Tag: " in a variable using REGEX PERL and what would be a good datatype to use, string or list or something else? (I am trying to write a program in Perl to ext...
[ "regex", "perl" ]
6
18
34,918
3
0
2011-06-04T16:33:36.533000
2011-06-04T16:59:29.800000
6,237,975
6,238,027
Jquery remove select options based on text input
I'm trying to do the following: I have an input and a dropdown list red yellow blue I want to remove the select options that are in the text input. For example if text input value=red,blue the dropdown should have just option yellow. I was able to make arrays of the comma separated values in the text input and values i...
var selected_colors = $('#colors').val().split(","); //array of colors from text input jQuery.each(selected_colors, function() { $("#colors_dropdown option:[value='" + this + "']").remove(); //Or use text attribute: //$("#colors_dropdown option:[text='" + this + "']").remove(); }); Working Demo: http://jsfiddle.net/83V...
Jquery remove select options based on text input I'm trying to do the following: I have an input and a dropdown list red yellow blue I want to remove the select options that are in the text input. For example if text input value=red,blue the dropdown should have just option yellow. I was able to make arrays of the comm...
TITLE: Jquery remove select options based on text input QUESTION: I'm trying to do the following: I have an input and a dropdown list red yellow blue I want to remove the select options that are in the text input. For example if text input value=red,blue the dropdown should have just option yellow. I was able to make ...
[ "javascript", "jquery", "arrays", "forms" ]
4
6
5,689
2
0
2011-06-04T16:34:39.607000
2011-06-04T16:44:12.210000
6,237,978
6,238,017
Skipping to the beginning of a for loop in a Scala program
In a for loop in my Scala code, i want to skip to the beginning of the loop and not execute following statements if a particular condition is true. In Java i can use 'continue' for doing this. But 'continue' does not seem to work in Scala. So how can i skip to the beginning of my loop in a Scala program? Please Help Th...
If you're using Scala 2.7, from http://www.scala-lang.org/node/257 These keywords are not included in Scala 2.7, and must be implemented in a different way. For break, the simplest thing to do is to divide your code into smaller methods and use the return to exit early. For continue, a simple approach is to place the s...
Skipping to the beginning of a for loop in a Scala program In a for loop in my Scala code, i want to skip to the beginning of the loop and not execute following statements if a particular condition is true. In Java i can use 'continue' for doing this. But 'continue' does not seem to work in Scala. So how can i skip to ...
TITLE: Skipping to the beginning of a for loop in a Scala program QUESTION: In a for loop in my Scala code, i want to skip to the beginning of the loop and not execute following statements if a particular condition is true. In Java i can use 'continue' for doing this. But 'continue' does not seem to work in Scala. So ...
[ "java", "scala" ]
3
5
1,583
2
0
2011-06-04T16:35:13.723000
2011-06-04T16:42:27.093000
6,237,983
6,238,213
Find the currently active Finder window/folder
Is there any way to determine the currently active window, or a folder, in the Finder? I need this to determine, in some sense, an appropriate "default" location in which to do some particular things in my app. Actually, does this question even make sense? Does this concept of a "currently active Finder window/folder" ...
Yes, the concept of the currently active Finder window does exist, as well as the currently selected item. For example, the following AppleScript gets the selection which is the current selection in the frontmost window. Since this returns a list of files or folders even if there is a single item, the next line gets th...
Find the currently active Finder window/folder Is there any way to determine the currently active window, or a folder, in the Finder? I need this to determine, in some sense, an appropriate "default" location in which to do some particular things in my app. Actually, does this question even make sense? Does this concep...
TITLE: Find the currently active Finder window/folder QUESTION: Is there any way to determine the currently active window, or a folder, in the Finder? I need this to determine, in some sense, an appropriate "default" location in which to do some particular things in my app. Actually, does this question even make sense...
[ "objective-c", "cocoa" ]
4
6
2,550
2
0
2011-06-04T16:35:54.550000
2011-06-04T17:14:49.990000
6,237,991
6,238,056
How should changes to MVC objects be propagated?
This is a follow-up to a previous question: Should sub-objects be fetched in the Model or the Model Mapper? Let's say a User can have one or more PhoneNumber objects. According to the answer in the above question, these sub-objects will be fetched upon instantiation of the User. If I were to delete a PhoneNumber from t...
Let's see If I got it the right way. The user is logged and it's on his profile page. On this page the user clicks a link "delete this phone number". On the page where the action is performed it will executed DELETE FROM phones ETC. Now after this is performed when you will load the User, the constructor will load the ...
How should changes to MVC objects be propagated? This is a follow-up to a previous question: Should sub-objects be fetched in the Model or the Model Mapper? Let's say a User can have one or more PhoneNumber objects. According to the answer in the above question, these sub-objects will be fetched upon instantiation of t...
TITLE: How should changes to MVC objects be propagated? QUESTION: This is a follow-up to a previous question: Should sub-objects be fetched in the Model or the Model Mapper? Let's say a User can have one or more PhoneNumber objects. According to the answer in the above question, these sub-objects will be fetched upon ...
[ "php", "model-view-controller", "zend-framework" ]
1
1
66
1
0
2011-06-04T16:37:38.533000
2011-06-04T16:50:06.713000
6,237,993
6,238,319
How can I trim "/" using shell scripting?
I've been playing around with a little shell script to get some info out of a HTML page downloaded with lynx. My problem is that I get this string: MPPTN: 0.9384 I can trim the first part of that using: trimmed_info=`echo ${info/' '/}` And the string becomes: "MPPTN: 0.9384" But how can I trim the last part? Seem like ...
The behavior of ${VARIABLE/PATTERN/REPLACEMENT} depends on what shell you're using, and for bash what version. Under ksh, or under recent enough (I think ≥ 4.0) versions of bash, ${finalt/' '/} strips that substring as desired. Under older versions of bash, the quoting is rather quirky; you need to write ${finalt/<\/sp...
How can I trim "/" using shell scripting? I've been playing around with a little shell script to get some info out of a HTML page downloaded with lynx. My problem is that I get this string: MPPTN: 0.9384 I can trim the first part of that using: trimmed_info=`echo ${info/' '/}` And the string becomes: "MPPTN: 0.9384" Bu...
TITLE: How can I trim "/" using shell scripting? QUESTION: I've been playing around with a little shell script to get some info out of a HTML page downloaded with lynx. My problem is that I get this string: MPPTN: 0.9384 I can trim the first part of that using: trimmed_info=`echo ${info/' '/}` And the string becomes: ...
[ "html", "shell" ]
4
4
344
4
0
2011-06-04T16:37:51.493000
2011-06-04T17:32:03.893000
6,238,004
6,238,023
Tower of Hanoi problem - linear planning
I'm doing an assignment about planning for tower of Hanoi problem using linear planning and I'm not allowed to use any recursive functions. The matter is that my solution is not optimal like the one from recursive method. It produces redundant steps. For example: I have 3 rods named A, B, C respectively and there are 2...
the key is knowing how many disks need to be moved: it there are a even number of disks in the stack you start to the "spare" rod if there are an odd number of disks in the stack you start to the "destination" rod
Tower of Hanoi problem - linear planning I'm doing an assignment about planning for tower of Hanoi problem using linear planning and I'm not allowed to use any recursive functions. The matter is that my solution is not optimal like the one from recursive method. It produces redundant steps. For example: I have 3 rods n...
TITLE: Tower of Hanoi problem - linear planning QUESTION: I'm doing an assignment about planning for tower of Hanoi problem using linear planning and I'm not allowed to use any recursive functions. The matter is that my solution is not optimal like the one from recursive method. It produces redundant steps. For exampl...
[ "java" ]
5
4
3,550
2
0
2011-06-04T16:39:52.347000
2011-06-04T16:43:41.790000
6,238,006
6,238,268
Django page redirect with pre-processing
I'm trying to implement a generic view that performs some pre-processing and redirects to an external website. Essentially I want to query and update the database before performing the redirect each time the view is accessed. I spotted Python + Django page redirect but this only deals with simple redirects and not with...
If you just want to do some processing before performing a redirect, I'm not seeing how generic views come into play for you. You can customize generic views by wrapping them in another function, or in the case of class-based generic views, subclassing them. In your situation, I fail to see how they'd benefit you much,...
Django page redirect with pre-processing I'm trying to implement a generic view that performs some pre-processing and redirects to an external website. Essentially I want to query and update the database before performing the redirect each time the view is accessed. I spotted Python + Django page redirect but this only...
TITLE: Django page redirect with pre-processing QUESTION: I'm trying to implement a generic view that performs some pre-processing and redirects to an external website. Essentially I want to query and update the database before performing the redirect each time the view is accessed. I spotted Python + Django page redi...
[ "django", "redirect", "django-generic-views" ]
0
3
387
1
0
2011-06-04T16:40:02.117000
2011-06-04T17:23:34.367000
6,238,007
6,298,797
Can I represent a Red-black tree as binary leaf tree?
I've been playing around with RB tree implementation in Haskell but having difficulty changing it a bit so the data is only placed in the leaves, like in a binary leaf tree: /+\ / \ /+\ \ / \ c a b The internal nodes would hold other information e.g. size of tree, in addition to the color of the node (like in a normal ...
Assuming you meant insert:: a -> Tree a -> Tree a, then your error probably stems from having no clause for ins (Leaf a).
Can I represent a Red-black tree as binary leaf tree? I've been playing around with RB tree implementation in Haskell but having difficulty changing it a bit so the data is only placed in the leaves, like in a binary leaf tree: /+\ / \ /+\ \ / \ c a b The internal nodes would hold other information e.g. size of tree, i...
TITLE: Can I represent a Red-black tree as binary leaf tree? QUESTION: I've been playing around with RB tree implementation in Haskell but having difficulty changing it a bit so the data is only placed in the leaves, like in a binary leaf tree: /+\ / \ /+\ \ / \ c a b The internal nodes would hold other information e....
[ "algorithm", "haskell", "red-black-tree" ]
5
1
635
1
0
2011-06-04T16:40:15.840000
2011-06-09T20:23:47.903000
6,238,008
6,238,173
Extra Attributes of a php created file in OSX 10.6.7
I use a php script to generate a LaTeX file (report.tex) on my local OSX 10.6.7 with MAMP (tThe filesystem is HFS+). Then I use exec() to build the file using LaTex. The.tex is well created on the filesystem, but it is not recognized as a.tex file by the finder, nor by LaTex. I've checked that the problem is not in the...
The extended attributes are a red herring since files in a directory are not differentiated by their attributes, only their name. So you cannot have two files with the same name in the same directory. Almost certainly the problem is that one of the file names has an unprintable character in it, most likely a space. Her...
Extra Attributes of a php created file in OSX 10.6.7 I use a php script to generate a LaTeX file (report.tex) on my local OSX 10.6.7 with MAMP (tThe filesystem is HFS+). Then I use exec() to build the file using LaTex. The.tex is well created on the filesystem, but it is not recognized as a.tex file by the finder, nor ...
TITLE: Extra Attributes of a php created file in OSX 10.6.7 QUESTION: I use a php script to generate a LaTeX file (report.tex) on my local OSX 10.6.7 with MAMP (tThe filesystem is HFS+). Then I use exec() to build the file using LaTex. The.tex is well created on the filesystem, but it is not recognized as a.tex file b...
[ "php", "macos", "fwrite", "hfs+" ]
0
1
261
1
0
2011-06-04T16:40:26.800000
2011-06-04T17:08:22.180000
6,238,016
6,243,585
Conditionally display pure HTML elements
I would like to conditionally display the following elements: So my condition should determine if the tag and all it's children would be displayed or not. AFAIK, I can't use because of the UIComponent inside the tag ( ). Any ideas?
There's another reason to not use: it's deprecated in JSF 2.0. Use. It's semantically more correct than a (which by itself indeed renders nothing when no client side specific attributes are specified) and has also a bit less overhead.... (note: due to some bug, Netbeans seems to jerk that this attribute isn't supported...
Conditionally display pure HTML elements I would like to conditionally display the following elements: So my condition should determine if the tag and all it's children would be displayed or not. AFAIK, I can't use because of the UIComponent inside the tag ( ). Any ideas?
TITLE: Conditionally display pure HTML elements QUESTION: I would like to conditionally display the following elements: So my condition should determine if the tag and all it's children would be displayed or not. AFAIK, I can't use because of the UIComponent inside the tag ( ). Any ideas? ANSWER: There's another reas...
[ "html", "jsf-2", "conditional-statements" ]
13
26
9,268
2
0
2011-06-04T16:41:49.833000
2011-06-05T14:41:19.493000
6,238,028
6,238,053
how to Isolated $row element
how to echo all item in row (mysql) and Isolated "," // samle: $row_Recordset1['tags'] is "tag1,tag2,tag3" i want write For example: tag1 tag2 tag3
$tags = split(",",$row_Recordset1['tags']); foreach($tags as $tag) { echo " ". $tag. " "; }
how to Isolated $row element how to echo all item in row (mysql) and Isolated "," // samle: $row_Recordset1['tags'] is "tag1,tag2,tag3" i want write For example: tag1 tag2 tag3
TITLE: how to Isolated $row element QUESTION: how to echo all item in row (mysql) and Isolated "," // samle: $row_Recordset1['tags'] is "tag1,tag2,tag3" i want write For example: tag1 tag2 tag3 ANSWER: $tags = split(",",$row_Recordset1['tags']); foreach($tags as $tag) { echo " ". $tag. " "; }
[ "php" ]
0
0
36
2
0
2011-06-04T16:44:23.270000
2011-06-04T16:49:00.820000
6,238,037
6,238,908
How do i align this text correctly?
I wrote this polar clock today and i am almost finished exept i want to align my text inside the line similar to this. Does anyone know how to do this? Ive tried to use FontRenderContext and font metrics but i cant seem to get it to work. Here is the whole source code so you can compile it and see for yourselves. impor...
Here's a simple example of rotating text. Addendum: You'll want to adjust the the text's radial starting point by stringWidth(name[n]). Your program appears to be rotating individual characters in a effort to follow the arc, while the example appears to be drawing the text in a straight line tangent to the arc. The lat...
How do i align this text correctly? I wrote this polar clock today and i am almost finished exept i want to align my text inside the line similar to this. Does anyone know how to do this? Ive tried to use FontRenderContext and font metrics but i cant seem to get it to work. Here is the whole source code so you can comp...
TITLE: How do i align this text correctly? QUESTION: I wrote this polar clock today and i am almost finished exept i want to align my text inside the line similar to this. Does anyone know how to do this? Ive tried to use FontRenderContext and font metrics but i cant seem to get it to work. Here is the whole source co...
[ "java", "swing", "applet", "rotation", "java-2d" ]
3
9
3,238
2
0
2011-06-04T16:46:02.270000
2011-06-04T19:28:46.463000
6,238,038
6,238,367
Can one partially serialize an object using Protobuf-net?
I would like to be able to update objects by serializing/deserializing only the field that changed. I am using the nongeneric version of the serializer since I don't know the type at compile. At runtime, I do have the type though. Locally I want to do something like: var existingObject.SomeField = 10; // Say I only wa...
You have a couple of options there. If your type internally knows what has changed, you can use the same pattern as XmlSerializer (IIRC), I.e. [ProtoMember(12)] public string Foo {get;set;} public bool ShouldSerializeFoo() { return... true if Foo is dirty } Second option would be to create the model on the fly, and on...
Can one partially serialize an object using Protobuf-net? I would like to be able to update objects by serializing/deserializing only the field that changed. I am using the nongeneric version of the serializer since I don't know the type at compile. At runtime, I do have the type though. Locally I want to do something ...
TITLE: Can one partially serialize an object using Protobuf-net? QUESTION: I would like to be able to update objects by serializing/deserializing only the field that changed. I am using the nongeneric version of the serializer since I don't know the type at compile. At runtime, I do have the type though. Locally I wan...
[ "protobuf-net" ]
1
1
578
1
0
2011-06-04T16:46:20.333000
2011-06-04T17:39:40.693000
6,238,044
6,244,569
how to make a new circular bitmap from part of the original bitmap?
i have a bitmap captured from the camera. i can place a transparent circle on the bitmap. what i'd like to do is make the circle's pixels a new separate bitmap that is circular in shape. i have an algorithm in place that targets the circle's pixels but how can i copy these pixels into another bitmap that is circular in...
You cannot make circular bitmaps. The closest you can achieve is a square bitmap with a circular core of pixels with alpha=255 and an enclosing perimeter with alpha=0. That way, it will act as a circle when you composite it.
how to make a new circular bitmap from part of the original bitmap? i have a bitmap captured from the camera. i can place a transparent circle on the bitmap. what i'd like to do is make the circle's pixels a new separate bitmap that is circular in shape. i have an algorithm in place that targets the circle's pixels but...
TITLE: how to make a new circular bitmap from part of the original bitmap? QUESTION: i have a bitmap captured from the camera. i can place a transparent circle on the bitmap. what i'd like to do is make the circle's pixels a new separate bitmap that is circular in shape. i have an algorithm in place that targets the c...
[ "android", "image-processing", "bitmap", "shapes" ]
0
0
345
1
0
2011-06-04T16:47:19.713000
2011-06-05T17:27:35.983000
6,238,047
6,238,148
Problems with generics / system architecture using generics
Maybe I am having some problems understanding generics, but I can't do something that looks logical to me. Maybe you can clarify it for me. I am developing a Java Library and there is a function that will call a platform that will return information in the JSON format. I wanted to create a namespace responsible for ret...
You're using generics on a method which returns always the same type of Objects, and that type may vary depending on the implementation of the method. Then I guess you should move your generic declaration to the class. public abstract class Parser { public abstract T parse(JSONObject jsonObject); } And your implementat...
Problems with generics / system architecture using generics Maybe I am having some problems understanding generics, but I can't do something that looks logical to me. Maybe you can clarify it for me. I am developing a Java Library and there is a function that will call a platform that will return information in the JSO...
TITLE: Problems with generics / system architecture using generics QUESTION: Maybe I am having some problems understanding generics, but I can't do something that looks logical to me. Maybe you can clarify it for me. I am developing a Java Library and there is a function that will call a platform that will return info...
[ "java", "generics", "architecture" ]
1
3
118
2
0
2011-06-04T16:47:55.813000
2011-06-04T17:03:02.543000
6,238,050
6,238,219
loop problem with goto in php
I have programmed a script with the goto command but on the server where I want to execute the script there is a previous PHP version (<5.3), so I have to change the code. The structure of the code goes like that: for($i = 0; $i < 30; $i++) // print 30 articles { $x = 0; // choose a a feed from the db // parse it a: f...
Without knowing how the ->get_items() call behaves you could use this brute-force method in lieu of the goto-switch: for($i = 0; $i < 30; $i++) { $x = 0; $a = 1; while ($a--) foreach($feed->get_items($x, 1) as $item) { if($id == $dbid) { $x++; $a=1; break; } else { } } // end of foreach } // end of for The label get...
loop problem with goto in php I have programmed a script with the goto command but on the server where I want to execute the script there is a previous PHP version (<5.3), so I have to change the code. The structure of the code goes like that: for($i = 0; $i < 30; $i++) // print 30 articles { $x = 0; // choose a a feed...
TITLE: loop problem with goto in php QUESTION: I have programmed a script with the goto command but on the server where I want to execute the script there is a previous PHP version (<5.3), so I have to change the code. The structure of the code goes like that: for($i = 0; $i < 30; $i++) // print 30 articles { $x = 0; ...
[ "php", "loops", "goto" ]
1
1
1,644
5
0
2011-06-04T16:48:34.360000
2011-06-04T17:15:26.060000
6,238,051
6,240,824
T4MVC with ActionNames
I just included T4MVC in my project and ran into an issue. I'm passing data to my javascript via hidden text fields and I need to be able to pass the names of controllers and their actions. Here's what I have: I'd like to be able to do: For some reason this isn't working. I was thinking because LogJavascriptError doesn...
T4MVC only works with action methods that return an ActionResult. If your method doesn't need to return anything, then the recommended thing to do is to return an EmptyResult, e.g. public virtual ActionResult SomeAction() { // Do stuff return new EmptyResult(); }
T4MVC with ActionNames I just included T4MVC in my project and ran into an issue. I'm passing data to my javascript via hidden text fields and I need to be able to pass the names of controllers and their actions. Here's what I have: I'd like to be able to do: For some reason this isn't working. I was thinking because L...
TITLE: T4MVC with ActionNames QUESTION: I just included T4MVC in my project and ran into an issue. I'm passing data to my javascript via hidden text fields and I need to be able to pass the names of controllers and their actions. Here's what I have: I'd like to be able to do: For some reason this isn't working. I was ...
[ "c#", "javascript", "asp.net-mvc", "t4mvc" ]
1
1
217
1
0
2011-06-04T16:48:34.783000
2011-06-05T03:25:52.783000
6,238,058
6,238,247
Hiding an entry (or a "fin the registry
I'm trying to hide some values in the registry (such as serial numbers) with C++/windows so I've been looking at this article http://www.codeproject.com/KB/system/NtRegistry.aspx which says: How is this possible? The answer is that a name which is a counted as a Unicode string can explicitly include NULL characters (0)...
The problem is that you are using the Win32 API and not the NT Native API. There is a table about 1/2 way through the article that you referenced that contains the list of Native APIs. For example, you would use NtCreateKey or ZwCreateKey instead of RegCreateKeyExW. The Win32 API assumes that alls strings are terminate...
Hiding an entry (or a "fin the registry I'm trying to hide some values in the registry (such as serial numbers) with C++/windows so I've been looking at this article http://www.codeproject.com/KB/system/NtRegistry.aspx which says: How is this possible? The answer is that a name which is a counted as a Unicode string ca...
TITLE: Hiding an entry (or a "fin the registry QUESTION: I'm trying to hide some values in the registry (such as serial numbers) with C++/windows so I've been looking at this article http://www.codeproject.com/KB/system/NtRegistry.aspx which says: How is this possible? The answer is that a name which is a counted as a...
[ "winapi", "registry" ]
1
1
528
2
0
2011-06-04T16:50:30.427000
2011-06-04T17:21:00.017000
6,238,060
6,240,961
Two resource IDs for controls?
I have a strange case that (I think) I need two resource IDs for my controls. I have a static control that I subclassed to a bitmap button. I have three LEDs (also static controls with a bitmap) and when I press the button the next LED should light up. These three LEDs should be associated with the button in some way. ...
Nevermind, I have fixed this. I have drawn the bitmaps directly to screen. I didn't think of that at first...
Two resource IDs for controls? I have a strange case that (I think) I need two resource IDs for my controls. I have a static control that I subclassed to a bitmap button. I have three LEDs (also static controls with a bitmap) and when I press the button the next LED should light up. These three LEDs should be associate...
TITLE: Two resource IDs for controls? QUESTION: I have a strange case that (I think) I need two resource IDs for my controls. I have a static control that I subclassed to a bitmap button. I have three LEDs (also static controls with a bitmap) and when I press the button the next LED should light up. These three LEDs s...
[ "c", "winapi" ]
0
0
56
1
0
2011-06-04T16:50:49.797000
2011-06-05T04:13:13.190000
6,238,064
6,238,113
Windows Phone 7 Event Invoke?
I am trying to handle events with Visual Studio C# like I did with my Windows Form, so for example: On my Windows Phone 7 my code looks like this: //ASDF.CS CLASS public delegate void SignedOn(string Screenname); public event SignedOn SO; public void dataIncoming(string packet) { switch (packet) { case 0: if (SO!= n...
Try using: void m_OSC_LoggedIn(string Screenname, string FormattedSN, string Email) { Dispatcher.BeginInvoke(() => { MessageBox.Show("hello!"); }); }
Windows Phone 7 Event Invoke? I am trying to handle events with Visual Studio C# like I did with my Windows Form, so for example: On my Windows Phone 7 my code looks like this: //ASDF.CS CLASS public delegate void SignedOn(string Screenname); public event SignedOn SO; public void dataIncoming(string packet) { switch...
TITLE: Windows Phone 7 Event Invoke? QUESTION: I am trying to handle events with Visual Studio C# like I did with my Windows Form, so for example: On my Windows Phone 7 my code looks like this: //ASDF.CS CLASS public delegate void SignedOn(string Screenname); public event SignedOn SO; public void dataIncoming(strin...
[ "c#", "windows-phone-7" ]
1
5
1,715
1
0
2011-06-04T16:51:42.120000
2011-06-04T16:57:58.560000
6,238,068
6,239,204
Should I make my ASP.NET MVC controller actions virtual?
File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice?
T4MVC Does make action methods virtual. If you are using it, it should make action methods virtual, no other way it can work
Should I make my ASP.NET MVC controller actions virtual? File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice?
TITLE: Should I make my ASP.NET MVC controller actions virtual? QUESTION: File -> New Project for ASP.NET MVC projects used to generate controllers with virtual actions. I'm not sure if that stopped with MVC 2 or MVC 3, but is this no longer a best practice? ANSWER: T4MVC Does make action methods virtual. If you are ...
[ "asp.net-mvc", "asp.net-mvc-3", "virtual", "actionresult", "controller-actions" ]
8
8
4,518
3
0
2011-06-04T16:52:09.473000
2011-06-04T20:30:07.903000
6,238,074
6,238,365
How the right associative of null coalescing operator behaves?
null coalescing operator is right associative, which means an expression of the form first?? second??third is evaluated as first?? (second?? third) Based on the above rule, I think the following translation is not correct. From: Address contact = user.ContactAddress; if (contact == null) { contact = order.ShippingAddre...
The spec is actually self-contradictory on this one. Section 7.13 of the C# 4 spec states: The null coalescing operator is right-associative, meaning that operations are grouped from right to left. For example, an expression of the form a?? b?? c is evaluated as a?? (b?? c). On the other hand, as has been pointed out, ...
How the right associative of null coalescing operator behaves? null coalescing operator is right associative, which means an expression of the form first?? second??third is evaluated as first?? (second?? third) Based on the above rule, I think the following translation is not correct. From: Address contact = user.Conta...
TITLE: How the right associative of null coalescing operator behaves? QUESTION: null coalescing operator is right associative, which means an expression of the form first?? second??third is evaluated as first?? (second?? third) Based on the above rule, I think the following translation is not correct. From: Address co...
[ "c#" ]
33
38
3,324
4
0
2011-06-04T16:53:25.360000
2011-06-04T17:39:35.707000
6,238,091
6,239,051
android, how to plot some values on the screen
Actually I have no idea how to solve my problem. I captured some data into an array, so the values present there look like that: {-11, -53, -27, 50, 39,...,...}. I just want to know, how I can show these values on the screen, in a graph. I have not yet any implementation idea, otherwise I would give some code snippets....
If you don't need real-time updates, I suggest you to use one of the many chart libraries around. Check my answer here for a list: which is the best and easy way to display stock graph in android? If you do need real-time updating, you'll most probably have to implement a SurfaceView and do your drawing yourself. Check...
android, how to plot some values on the screen Actually I have no idea how to solve my problem. I captured some data into an array, so the values present there look like that: {-11, -53, -27, 50, 39,...,...}. I just want to know, how I can show these values on the screen, in a graph. I have not yet any implementation i...
TITLE: android, how to plot some values on the screen QUESTION: Actually I have no idea how to solve my problem. I captured some data into an array, so the values present there look like that: {-11, -53, -27, 50, 39,...,...}. I just want to know, how I can show these values on the screen, in a graph. I have not yet an...
[ "android", "layout", "graph" ]
0
1
463
1
0
2011-06-04T16:54:53.373000
2011-06-04T19:56:37.783000
6,238,099
6,238,114
Program Execution + Parameters from a form in C#
I am currently trying to execute a program with a parameter in a C# form. The code I have: private void button1_Click_1(object sender, EventArgs e) { Process.Start("nan.exe"); } Although I am trying to pass this parameter: "nan.exe C:\Windows\System32" How could this me done in my case?
Use: Process.Start("nan.exe", @"c:\windows\system32"); Using Environment.GetFolderPath() is recommended.
Program Execution + Parameters from a form in C# I am currently trying to execute a program with a parameter in a C# form. The code I have: private void button1_Click_1(object sender, EventArgs e) { Process.Start("nan.exe"); } Although I am trying to pass this parameter: "nan.exe C:\Windows\System32" How could this me...
TITLE: Program Execution + Parameters from a form in C# QUESTION: I am currently trying to execute a program with a parameter in a C# form. The code I have: private void button1_Click_1(object sender, EventArgs e) { Process.Start("nan.exe"); } Although I am trying to pass this parameter: "nan.exe C:\Windows\System32"...
[ "c#", ".net", "windows" ]
0
2
184
2
0
2011-06-04T16:55:30.890000
2011-06-04T16:58:20.187000
6,238,109
6,241,035
How put in LinearLayout class which extends GLSurfaceView?
my question is simple. I have class TouchSurfaceView which extends GLSurfaceView. I want create activity where will three TextViews and Button on bottom and TouchSurfaceView on top, but I don't know how read this in XML layout.
You just reference it usingthe full name (including the package) as if it were any other Vew: You need a constructor that takes AttributeSet as parameter (is used when inflating the xml): public TouchSurfaceView(Context context, AttributeSet attr) { super(context, attr); // the rest of your code }
How put in LinearLayout class which extends GLSurfaceView? my question is simple. I have class TouchSurfaceView which extends GLSurfaceView. I want create activity where will three TextViews and Button on bottom and TouchSurfaceView on top, but I don't know how read this in XML layout.
TITLE: How put in LinearLayout class which extends GLSurfaceView? QUESTION: my question is simple. I have class TouchSurfaceView which extends GLSurfaceView. I want create activity where will three TextViews and Button on bottom and TouchSurfaceView on top, but I don't know how read this in XML layout. ANSWER: You ju...
[ "android", "xml", "android-linearlayout", "glsurfaceview" ]
0
0
914
1
0
2011-06-04T16:57:09.910000
2011-06-05T04:38:44.587000
6,238,115
6,238,142
What does this error shows? Object of class Hide could not be converted to string
i have this code class Hide { private $myname; function getmyname() { $myname = __class__; return $myname; } } class damu { private static $name; public function name() { var_dump($this->name); if( $this->name == null ){ $this->name = new Hide(); } return $this->name; } } $run = new damu(); echo $run->name(); this ...
You should be returning return $this->name->getmyname(); or define a tostring for the Hide class public function __toString() { return "str"; }
What does this error shows? Object of class Hide could not be converted to string i have this code class Hide { private $myname; function getmyname() { $myname = __class__; return $myname; } } class damu { private static $name; public function name() { var_dump($this->name); if( $this->name == null ){ $this->name = ...
TITLE: What does this error shows? Object of class Hide could not be converted to string QUESTION: i have this code class Hide { private $myname; function getmyname() { $myname = __class__; return $myname; } } class damu { private static $name; public function name() { var_dump($this->name); if( $this->name == null...
[ "php" ]
4
2
494
5
0
2011-06-04T16:58:20.563000
2011-06-04T17:02:08.230000
6,238,116
6,238,504
Proper way to handle a list hierarchy
I want to ask a general question about the proper way to handle a list with a hierarchy. The way I am doing it now is by calling the same activity with a bundle to handle the next query so I can drill down into the list. I am wondering if there is a better way to deal with lists like mine. Should I use multiple activit...
One of the reasons why ExpandableListView supports only two levels of in depth, is because its very hard to make n-level tree to be user-friendly. Just imagine the mass on user's screen if he or she goes to 5th level. But, nevertheless, here is the approach I would take. I haven't implemented it yet, but this should be...
Proper way to handle a list hierarchy I want to ask a general question about the proper way to handle a list with a hierarchy. The way I am doing it now is by calling the same activity with a bundle to handle the next query so I can drill down into the list. I am wondering if there is a better way to deal with lists li...
TITLE: Proper way to handle a list hierarchy QUESTION: I want to ask a general question about the proper way to handle a list with a hierarchy. The way I am doing it now is by calling the same activity with a bundle to handle the next query so I can drill down into the list. I am wondering if there is a better way to ...
[ "android", "listview", "android-activity", "listactivity" ]
1
2
1,498
2
0
2011-06-04T16:58:23.920000
2011-06-04T18:05:41.773000
6,238,128
6,238,196
How to share resources between activities/services
I wanted to know what is the best approach for sharing singleton in my android app. I have a few activities that does not rely on each other, but I want them to have a singleton that they can all read/write. Where should I place it? Thanks
Your application should be a singleton. It avoids many other problem related to sharing datas or models. In your manifest.xml:..... all activities/services/receivers/etc... as usual And your android:name refers to this class: public class MyApp extends Application { //singleton, but use onCreate more than constructor t...
How to share resources between activities/services I wanted to know what is the best approach for sharing singleton in my android app. I have a few activities that does not rely on each other, but I want them to have a singleton that they can all read/write. Where should I place it? Thanks
TITLE: How to share resources between activities/services QUESTION: I wanted to know what is the best approach for sharing singleton in my android app. I have a few activities that does not rely on each other, but I want them to have a singleton that they can all read/write. Where should I place it? Thanks ANSWER: Yo...
[ "android" ]
2
8
2,319
1
0
2011-06-04T17:00:38.950000
2011-06-04T17:12:42.080000
6,238,139
6,238,188
iOS download and save image inside app
Is it possible for me to download an image from website and save it permanently inside my app? I really have no idea, but it would make a nice feature for my app.
Asynchronous downloaded images with caching Asynchronous downloaded images with caching Here is one more repos which can be used to download images in background
iOS download and save image inside app Is it possible for me to download an image from website and save it permanently inside my app? I really have no idea, but it would make a nice feature for my app.
TITLE: iOS download and save image inside app QUESTION: Is it possible for me to download an image from website and save it permanently inside my app? I really have no idea, but it would make a nice feature for my app. ANSWER: Asynchronous downloaded images with caching Asynchronous downloaded images with caching Her...
[ "iphone", "cocoa-touch", "ios", "ipad" ]
79
51
141,665
11
0
2011-06-04T17:01:58.067000
2011-06-04T17:11:58.967000
6,238,143
6,238,627
Change tracking with EF over time?
I'd like to know what is the best practice to track and/or persist changes over time if I use EF. I'd like to get started with EF for a new project. What I need is a kind of change history. That's how I did it before: If a record was created it was saved with an ID and with the same ID as InvariantID. If the record was...
No it is not build into EF and it will not work this way. I even don't think that it is a good approach on the database level because it makes referential integrity very complex. With EF this will work only if you use following approach: You will use conditional mapping for your entity - condition will be IsDeleted = 0...
Change tracking with EF over time? I'd like to know what is the best practice to track and/or persist changes over time if I use EF. I'd like to get started with EF for a new project. What I need is a kind of change history. That's how I did it before: If a record was created it was saved with an ID and with the same I...
TITLE: Change tracking with EF over time? QUESTION: I'd like to know what is the best practice to track and/or persist changes over time if I use EF. I'd like to get started with EF for a new project. What I need is a kind of change history. That's how I did it before: If a record was created it was saved with an ID a...
[ "entity-framework" ]
0
1
285
1
0
2011-06-04T17:02:35.440000
2011-06-04T18:34:03.500000
6,238,151
6,242,470
Character encoding Microsoft.XmlHttp in Vbscript
I'm writing a vbscript to pull some data from a webpage, strip out a few key pieces of information and write those to a file. At the moment my script to access the pages and save the file contents to a string is this: Set WshShell = WScript.CreateObject("WScript.Shell") Set http = CreateObject("Microsoft.XmlHttp") 'Lo...
You may need to set the correct header blocks before send eg the following is an example only. You will need to find out what this is exactly for your website http.open "GET", URL, FALSE http.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" http.SetRequestHeader "Accept", "text/xml,ap...
Character encoding Microsoft.XmlHttp in Vbscript I'm writing a vbscript to pull some data from a webpage, strip out a few key pieces of information and write those to a file. At the moment my script to access the pages and save the file contents to a string is this: Set WshShell = WScript.CreateObject("WScript.Shell") ...
TITLE: Character encoding Microsoft.XmlHttp in Vbscript QUESTION: I'm writing a vbscript to pull some data from a webpage, strip out a few key pieces of information and write those to a file. At the moment my script to access the pages and save the file contents to a string is this: Set WshShell = WScript.CreateObject...
[ "vbscript", "character-encoding" ]
2
2
8,619
1
0
2011-06-04T17:03:52.323000
2011-06-05T10:55:48.420000
6,238,153
6,243,282
Mixing new and existing children in a form
I am trying to build a form for my users where they can enter up to 3 addresses for themselves. After an address is created, it can be marked as inactive and won't count toward the 3. I am using accepts_nested_attributes_for:addresses in my User model and I've tried a few things in my form, but I can't get fields_for t...
From what I have found it isn't possible to explicitly change the scope and show fields for new records by changing the parameters passed to fields_for. But what ended up solving my problem is the fact that when passing a symbol to fields_for (for example: fields_for:addresses ) the default scope of the model is going ...
Mixing new and existing children in a form I am trying to build a form for my users where they can enter up to 3 addresses for themselves. After an address is created, it can be marked as inactive and won't count toward the 3. I am using accepts_nested_attributes_for:addresses in my User model and I've tried a few thin...
TITLE: Mixing new and existing children in a form QUESTION: I am trying to build a form for my users where they can enter up to 3 addresses for themselves. After an address is created, it can be marked as inactive and won't count toward the 3. I am using accepts_nested_attributes_for:addresses in my User model and I'v...
[ "ruby-on-rails", "forms", "scope" ]
0
0
134
1
0
2011-06-04T17:04:21.467000
2011-06-05T13:39:31.317000
6,238,154
6,238,447
ORDER BY issue in Postgres (Heroku)
The following code works for Postgres (Heroku): @messages = Message.select("DISTINCT ON (messages.conversation_id) *").where("messages.sender_id = (?) OR messages.recipient_id = (?)", current_user.id, current_user.id) However, when attempting to order the results by appending.order("messages.read_at DESC") I receive th...
Don't vote this, I only post because posting many lines in comments does not show very well. I would write a "query that returns messages grouped by their conversation_id, so that the last message in each conversation is shown" like this: SELECT m.* FROM messages m JOIN ( SELECT conversation_id, MAX(created_date) AS ma...
ORDER BY issue in Postgres (Heroku) The following code works for Postgres (Heroku): @messages = Message.select("DISTINCT ON (messages.conversation_id) *").where("messages.sender_id = (?) OR messages.recipient_id = (?)", current_user.id, current_user.id) However, when attempting to order the results by appending.order("...
TITLE: ORDER BY issue in Postgres (Heroku) QUESTION: The following code works for Postgres (Heroku): @messages = Message.select("DISTINCT ON (messages.conversation_id) *").where("messages.sender_id = (?) OR messages.recipient_id = (?)", current_user.id, current_user.id) However, when attempting to order the results by...
[ "sql", "ruby-on-rails", "ruby-on-rails-3", "postgresql", "heroku" ]
1
2
387
1
0
2011-06-04T17:04:23.580000
2011-06-04T17:54:23.747000
6,238,162
6,238,183
Placement of data files for java web service
I am writing a simple web service on java, that should read an xml file and generate a string for result. I am, however, at loss as to: a) where should xml file be placed in the file system for it to be accessible to web service? b) what would the relative way to the file from the service c) alternatelyt, how can i add...
Usually I provide a resource-bundle (.jar) in my web application. If the file should not be modified during runtime, this should be the best way to access it. This will be c) in your question. There you can access the file with: ClassLoader cl = this.getClass().getClassLoader(); InputStream is = cl.getResourceAsStream(...
Placement of data files for java web service I am writing a simple web service on java, that should read an xml file and generate a string for result. I am, however, at loss as to: a) where should xml file be placed in the file system for it to be accessible to web service? b) what would the relative way to the file fr...
TITLE: Placement of data files for java web service QUESTION: I am writing a simple web service on java, that should read an xml file and generate a string for result. I am, however, at loss as to: a) where should xml file be placed in the file system for it to be accessible to web service? b) what would the relative ...
[ "java", "netbeans", "maven" ]
1
1
986
2
0
2011-06-04T17:05:49.140000
2011-06-04T17:10:09.630000
6,238,178
6,238,227
jQuery Filter and Reverse Filter
I'm looking for a shorter way of writing: $('div').filter(function(value) { return runMyTestFunction(value); }).hide().end().filter(function(value) { return!runMyTestFunction(value); }).show(); Hopefully something along the lines of: $('div').filter(function(value) { return runMyTestFunction(value); }).hide().end().rem...
You could do: $('div').filter(runMyTestFunction);.hide().end().not(runMyTestFunction).show(); If you don't want to run the method twice: $('div').hide() // hide all.not(runMyTestFunction).show(); Or if you explicitly want to hide only certain elements: var elements = $('div'); var toRemove = elements.filter(runMyTestFu...
jQuery Filter and Reverse Filter I'm looking for a shorter way of writing: $('div').filter(function(value) { return runMyTestFunction(value); }).hide().end().filter(function(value) { return!runMyTestFunction(value); }).show(); Hopefully something along the lines of: $('div').filter(function(value) { return runMyTestFun...
TITLE: jQuery Filter and Reverse Filter QUESTION: I'm looking for a shorter way of writing: $('div').filter(function(value) { return runMyTestFunction(value); }).hide().end().filter(function(value) { return!runMyTestFunction(value); }).show(); Hopefully something along the lines of: $('div').filter(function(value) { r...
[ "jquery" ]
6
10
3,469
1
0
2011-06-04T17:09:05.937000
2011-06-04T17:17:04.067000
6,238,180
6,238,246
HTML5 Data URI fails when a base64 null is followed by an =?
I'm doing some pretty unholy things with JavaScript, and I've run into a weird problem. I am creating binary data that fills a buffer of a static size. If the content doesn't fill the buffer, the remainder is filled with null characters. The next step is to convert to base64. The size (bytes) isn't always a multiple of...
The padding character = is used to fill up to a multiple of four code characters. As every three bytes of input are mapped onto four bytes of output, a number of input bytes that is not a multiple of three requires padding (a remainder of one byte requires == and a remainder of two bytes requires = ). In you case AAAA ...
HTML5 Data URI fails when a base64 null is followed by an =? I'm doing some pretty unholy things with JavaScript, and I've run into a weird problem. I am creating binary data that fills a buffer of a static size. If the content doesn't fill the buffer, the remainder is filled with null characters. The next step is to c...
TITLE: HTML5 Data URI fails when a base64 null is followed by an =? QUESTION: I'm doing some pretty unholy things with JavaScript, and I've run into a weird problem. I am creating binary data that fills a buffer of a static size. If the content doesn't fill the buffer, the remainder is filled with null characters. The...
[ "javascript", "google-chrome", "base64", "firefox4", "data-uri" ]
2
5
3,432
3
0
2011-06-04T17:09:25.847000
2011-06-04T17:20:38.717000
6,238,182
6,238,238
In Core Foundation, do you have to access objects only using references?
I am trying to write a bit of Objective-C (which is new for me, my background is more C++), and wanted to create a CFString like this: CFString myString; When I try to build my project the following error: "'CFString' undeclared" (first use in this function) prevents from building. I thought I had just forgot to includ...
CFStringRef is part of the Core Foundation library which is not ObjC but plain C. Core Foundation uses a runtime to create instances, this runtime will call callbacks to initialize the structs content and manages the instances memory. This is why there is no CFString because you shouldn't create static instances on the...
In Core Foundation, do you have to access objects only using references? I am trying to write a bit of Objective-C (which is new for me, my background is more C++), and wanted to create a CFString like this: CFString myString; When I try to build my project the following error: "'CFString' undeclared" (first use in thi...
TITLE: In Core Foundation, do you have to access objects only using references? QUESTION: I am trying to write a bit of Objective-C (which is new for me, my background is more C++), and wanted to create a CFString like this: CFString myString; When I try to build my project the following error: "'CFString' undeclared"...
[ "core-foundation" ]
0
1
189
1
0
2011-06-04T17:10:07.143000
2011-06-04T17:19:27.667000
6,238,191
6,238,501
Debugging apps on a Galaxy Tab 10.1
I'm trying to work with a Galaxy Tab 10.1 on Windows 7 but I'm having some troubles. At the time to debug my apps on the tab, the eclipse not recognizing the debugging device and opens the emulator. Someone have any ideas about that? EDIT: I resolved the problem following this link: dkszone.net/setup-install-adb-androi...
Have you checked http://developer.android.com/guide/developing/device.html#setting-up also the Samsung USB Driver should be available here http://innovator.samsungmobile.com/down/cnts/toolSDK.detail.view.do?platformId=1&cntsId=9480 it's all part of Samsungs Mobile Developer Page
Debugging apps on a Galaxy Tab 10.1 I'm trying to work with a Galaxy Tab 10.1 on Windows 7 but I'm having some troubles. At the time to debug my apps on the tab, the eclipse not recognizing the debugging device and opens the emulator. Someone have any ideas about that? EDIT: I resolved the problem following this link: ...
TITLE: Debugging apps on a Galaxy Tab 10.1 QUESTION: I'm trying to work with a Galaxy Tab 10.1 on Windows 7 but I'm having some troubles. At the time to debug my apps on the tab, the eclipse not recognizing the debugging device and opens the emulator. Someone have any ideas about that? EDIT: I resolved the problem fol...
[ "android", "eclipse", "adb" ]
6
7
11,435
5
0
2011-06-04T17:12:11.863000
2011-06-04T18:04:43.357000
6,238,193
6,238,226
PyQt: new API with Python 2
PyQt has two different API's: the old and the new. By default you get the old API with Python 2 and the new API with Python 3. Is it possible to enable the new PyQt API with Python 2? How?
Perhaps you could try using sip.setapi. A simple example from the docs: import sip sip.setapi('QString', 2) And a list of the supported APIs: QDate v1, v2 QDateTime v1, v2 QString v1, v2 QTextStream v1, v2 QTime v1, v2 QUrl v1, v2 QVariant v1, v2
PyQt: new API with Python 2 PyQt has two different API's: the old and the new. By default you get the old API with Python 2 and the new API with Python 3. Is it possible to enable the new PyQt API with Python 2? How?
TITLE: PyQt: new API with Python 2 QUESTION: PyQt has two different API's: the old and the new. By default you get the old API with Python 2 and the new API with Python 3. Is it possible to enable the new PyQt API with Python 2? How? ANSWER: Perhaps you could try using sip.setapi. A simple example from the docs: impo...
[ "python", "pyqt" ]
6
9
5,346
3
0
2011-06-04T17:12:19.553000
2011-06-04T17:16:33.750000
6,238,194
6,238,223
Do I need to escape/sanitize the following? If so, what is the best method?
Do I need to escape/sanitize the following? $_SERVER['HTTP_USER_AGENT'] in a PHP script (not inserted into database or displayed to user), for example: if ($_SERVER['HTTP_USER_AGENT']==$xyz) { echo "Congrats, you are using XYZ browser"; } else { echo "You are not using XYZ browser."; } $_SERVER['HTTP_USER_AGENT'] when ...
No, there is no need for sanitation in any of the examples you show, with the following very rare exception for the mail body example: (Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double...
Do I need to escape/sanitize the following? If so, what is the best method? Do I need to escape/sanitize the following? $_SERVER['HTTP_USER_AGENT'] in a PHP script (not inserted into database or displayed to user), for example: if ($_SERVER['HTTP_USER_AGENT']==$xyz) { echo "Congrats, you are using XYZ browser"; } else ...
TITLE: Do I need to escape/sanitize the following? If so, what is the best method? QUESTION: Do I need to escape/sanitize the following? $_SERVER['HTTP_USER_AGENT'] in a PHP script (not inserted into database or displayed to user), for example: if ($_SERVER['HTTP_USER_AGENT']==$xyz) { echo "Congrats, you are using XYZ...
[ "php", "sanitize" ]
0
4
1,209
1
0
2011-06-04T17:12:30.850000
2011-06-04T17:15:48.920000
6,238,195
6,238,707
Hide right-sidebar on specific node/module
I am setting up my first drupal (6) site and so far I like the system. I've now run into a problem however: to give the content more space I want to hide the right-sidebar (with the navigation menu etc.) on every page from a specific module (or also fine: for a specific node/view from the module) The only way I've come...
Hmmm. Is this a custom module or something commonly available? Some modules allow you to create custom tpl.php files (see the theming guide ) for them. This might quickly solve your problem. If you are theming a node, then it is significantly easier. You can theme a specific type of node by naming convention (again via...
Hide right-sidebar on specific node/module I am setting up my first drupal (6) site and so far I like the system. I've now run into a problem however: to give the content more space I want to hide the right-sidebar (with the navigation menu etc.) on every page from a specific module (or also fine: for a specific node/v...
TITLE: Hide right-sidebar on specific node/module QUESTION: I am setting up my first drupal (6) site and so far I like the system. I've now run into a problem however: to give the content more space I want to hide the right-sidebar (with the navigation menu etc.) on every page from a specific module (or also fine: for...
[ "drupal", "drupal-6" ]
1
2
3,413
4
0
2011-06-04T17:12:33.480000
2011-06-04T18:49:47.243000
6,238,202
6,238,294
Webapp able to work offline !
I have to design an webapp that has the capability of working offline. So there are many working points that in normal mode work online, connected to a central server. Now there are moments when for different reasons, the central server might not be available. (no internet,server crash etc) so then is needed to enter i...
We wrote a desktop app for hundreds of employees to use on their laptops. It used database replication to merge the data from the laptop copy of the database to the server copy of the database. The amount of data contained in the database was significant -- product information, customer contact information, and so on. ...
Webapp able to work offline ! I have to design an webapp that has the capability of working offline. So there are many working points that in normal mode work online, connected to a central server. Now there are moments when for different reasons, the central server might not be available. (no internet,server crash etc...
TITLE: Webapp able to work offline ! QUESTION: I have to design an webapp that has the capability of working offline. So there are many working points that in normal mode work online, connected to a central server. Now there are moments when for different reasons, the central server might not be available. (no interne...
[ "javascript", "html", "web-storage" ]
1
2
1,055
3
0
2011-06-04T17:13:29.607000
2011-06-04T17:27:55.760000
6,238,203
6,238,229
PHP/MySQL - Ordering rows
I'm using a row to return all of the users for a particular project, which isn't a problem. However, how would I order it so that the first result is always the logged in user. I see two solutions, both of which I've tried with no success: Printing the user's name then using an if statement to only print the rest of th...
You first solution is perfect. If you want to use your second solution you should build your SQL query like this: (SELECT * FROM user WHERE id =:currentUserID) UNION (SELECT * FROM user) And you are good
PHP/MySQL - Ordering rows I'm using a row to return all of the users for a particular project, which isn't a problem. However, how would I order it so that the first result is always the logged in user. I see two solutions, both of which I've tried with no success: Printing the user's name then using an if statement to...
TITLE: PHP/MySQL - Ordering rows QUESTION: I'm using a row to return all of the users for a particular project, which isn't a problem. However, how would I order it so that the first result is always the logged in user. I see two solutions, both of which I've tried with no success: Printing the user's name then using ...
[ "php", "mysql" ]
1
2
143
4
0
2011-06-04T17:13:29.587000
2011-06-04T17:17:38.273000
6,238,206
6,238,302
Combining PDO and DAO pattern
How could PHP's PDO feature and the DAO pattern be mixed? Should I have an abstract class that initializes a connection to the database? Can PDO be considered as equivalent to Java's JDBC?
How could PHP's PDO feature and the DAO pattern be mixed? Just use pdo to make queries into your dao object. class PersonDAO { function get($id) { //> EXECUTE HERE PDO } } Also PDO already abstracts the connection, so you don't need an abstract class for connection.
Combining PDO and DAO pattern How could PHP's PDO feature and the DAO pattern be mixed? Should I have an abstract class that initializes a connection to the database? Can PDO be considered as equivalent to Java's JDBC?
TITLE: Combining PDO and DAO pattern QUESTION: How could PHP's PDO feature and the DAO pattern be mixed? Should I have an abstract class that initializes a connection to the database? Can PDO be considered as equivalent to Java's JDBC? ANSWER: How could PHP's PDO feature and the DAO pattern be mixed? Just use pdo to ...
[ "php", "pdo", "dao" ]
3
3
6,474
2
0
2011-06-04T17:13:59.147000
2011-06-04T17:29:43.247000
6,238,208
6,239,168
Why are foreign characters not read using inputStream?
I have a text file which contains data I need to preload into a SQLite database. I saved in in res/raw. I read the whole file using readTxtFromRaw(), then I use the StringTokenizer class to process the file line by line. However the String returned by readTxtFromRaw does not show foreign characters that are in the file...
Have you checked the several encodings? what's the encoding of your source file? what's the encoding of your output stream? the byteArrayOutputStream.toString() converts according to the platform's default character encoding. So I guess it will strip the foreign characters or convert them in a way that they are not dis...
Why are foreign characters not read using inputStream? I have a text file which contains data I need to preload into a SQLite database. I saved in in res/raw. I read the whole file using readTxtFromRaw(), then I use the StringTokenizer class to process the file line by line. However the String returned by readTxtFromRa...
TITLE: Why are foreign characters not read using inputStream? QUESTION: I have a text file which contains data I need to preload into a SQLite database. I saved in in res/raw. I read the whole file using readTxtFromRaw(), then I use the StringTokenizer class to process the file line by line. However the String returne...
[ "android", "resources", "inputstream", "stringtokenizer" ]
1
1
874
1
0
2011-06-04T17:14:18.370000
2011-06-04T20:22:33.880000
6,238,215
6,240,335
Executing VBScript file from Excel VBA macros
I need some excel vba examples, where with in the VBA code(Excel Macro) i could call a VBScript and will get some values like filename and directory information from the vbscript and assign it to the variables in VBA code. Thank you in advance Some thing like this VBA macro: Sub Foo2Script Dim x As Long x=2 'Call VBscr...
It can be done but I would have to agree with Tomalak and others that it's not the best way to go. However, saying that, VBScript can work wonders occasionally if you use it as a kind of fire and forget mechanism. It can be used quite effectively to simulate multi-threading in VBA whereby you breakdown the payload and ...
Executing VBScript file from Excel VBA macros I need some excel vba examples, where with in the VBA code(Excel Macro) i could call a VBScript and will get some values like filename and directory information from the vbscript and assign it to the variables in VBA code. Thank you in advance Some thing like this VBA macro...
TITLE: Executing VBScript file from Excel VBA macros QUESTION: I need some excel vba examples, where with in the VBA code(Excel Macro) i could call a VBScript and will get some values like filename and directory information from the vbscript and assign it to the variables in VBA code. Thank you in advance Some thing l...
[ "vbscript", "excel", "vba" ]
2
9
28,501
1
0
2011-06-04T17:15:03.490000
2011-06-05T00:56:56.023000
6,238,216
6,238,310
Store or reflect on the "reference level" of a variable
Is there a way in C++ to reflect on the "number of levels of pointer" of a variable, (for example, int* a is 1 level, int** b is 2 levels, and int c is 0 levels)..Other than using typeid and parsing the string that comes out of that? The reason I'm asking is I am using pointers to member functions, and I need to know w...
You could use std::is_pointer from the type_traits header in TR1 (which uses partial specialization to produce an answer), but it might be simpler to just use overload resolution. Here's an example, assuming void return, no arguments, and no need to handle more than one level of indirection: template inline void invoke...
Store or reflect on the "reference level" of a variable Is there a way in C++ to reflect on the "number of levels of pointer" of a variable, (for example, int* a is 1 level, int** b is 2 levels, and int c is 0 levels)..Other than using typeid and parsing the string that comes out of that? The reason I'm asking is I am ...
TITLE: Store or reflect on the "reference level" of a variable QUESTION: Is there a way in C++ to reflect on the "number of levels of pointer" of a variable, (for example, int* a is 1 level, int** b is 2 levels, and int c is 0 levels)..Other than using typeid and parsing the string that comes out of that? The reason I...
[ "c++", "variables" ]
2
3
143
7
0
2011-06-04T17:15:03.253000
2011-06-04T17:30:43.833000
6,238,228
6,238,426
Chess board interface. Cannot remove child. Any suggestions?
Hello I am in the process of creating a chess board where you can move the pieces. Currently i am working on the rook and the coding is below. I know it is not elegant and probably the most inefficient code out there, but this is day 2 of my actionscript 3.0 life and i am kinda a beginner. Anyway, so the thing is, when...
alxx's answer is correct, you wouldn't need to keep a special list for them. The other way you could do it, using an Array to save references, would look like this: var boxes:Array = new Array(); function startMove(evt:MouseEvent):void {... var box:Ball = new Ball(); addChild(box); boxes.push(box);... var box1:Ball = ...
Chess board interface. Cannot remove child. Any suggestions? Hello I am in the process of creating a chess board where you can move the pieces. Currently i am working on the rook and the coding is below. I know it is not elegant and probably the most inefficient code out there, but this is day 2 of my actionscript 3.0 ...
TITLE: Chess board interface. Cannot remove child. Any suggestions? QUESTION: Hello I am in the process of creating a chess board where you can move the pieces. Currently i am working on the rook and the coding is below. I know it is not elegant and probably the most inefficient code out there, but this is day 2 of my...
[ "actionscript-3", "flash-cs4", "removechild" ]
0
1
412
2
0
2011-06-04T17:17:28.117000
2011-06-04T17:49:46.103000
6,238,230
6,238,258
SQL integer query, find integer within +/- 1
If I want to run an SQL statement like "SELECT integername from tblintegerlist where integerlist..." I have a list of numbers like integername 1 2 3 4 5 so I want results for +/- 1 of the search, so for '4' I would get rows 3,4,5 as the results.
SELECT integername FROM tblintegerlist WHERE (integername- ) BETWEEN -1 AND 1
SQL integer query, find integer within +/- 1 If I want to run an SQL statement like "SELECT integername from tblintegerlist where integerlist..." I have a list of numbers like integername 1 2 3 4 5 so I want results for +/- 1 of the search, so for '4' I would get rows 3,4,5 as the results.
TITLE: SQL integer query, find integer within +/- 1 QUESTION: If I want to run an SQL statement like "SELECT integername from tblintegerlist where integerlist..." I have a list of numbers like integername 1 2 3 4 5 so I want results for +/- 1 of the search, so for '4' I would get rows 3,4,5 as the results. ANSWER: SE...
[ "mysql", "sql" ]
2
0
418
3
0
2011-06-04T17:17:55.097000
2011-06-04T17:22:36.830000
6,238,242
6,238,298
How many rows have been inserted to sqlite table?
I'm using this code in Python: for...: cursor.execute('INSERT OR IGNORE INTO foo (bar,baz) VALUES (?,?)',(1,3)) con.commit() Can I get the value of the number of rows that have been inserted without using if statement and testing if the value existed before insert?
To get number of rows inserted, cursor.rowcount should return the number of rows affected by the last execute ( in this case, number of inserts).
How many rows have been inserted to sqlite table? I'm using this code in Python: for...: cursor.execute('INSERT OR IGNORE INTO foo (bar,baz) VALUES (?,?)',(1,3)) con.commit() Can I get the value of the number of rows that have been inserted without using if statement and testing if the value existed before insert?
TITLE: How many rows have been inserted to sqlite table? QUESTION: I'm using this code in Python: for...: cursor.execute('INSERT OR IGNORE INTO foo (bar,baz) VALUES (?,?)',(1,3)) con.commit() Can I get the value of the number of rows that have been inserted without using if statement and testing if the value existed b...
[ "python", "sqlite" ]
1
2
253
1
0
2011-06-04T17:20:11.853000
2011-06-04T17:29:20.820000
6,238,244
6,241,718
How to convert openssl_pkey_get_public and openssl_verify to C# .NET
PHP code verifies iPizza signature from bank: $key = openssl_pkey_get_public (file_get_contents ($preferences['bank_certificate'])); if (!openssl_verify ($data, $signature, $key)) { trigger_error ("Invalid signature", E_USER_ERROR); } I tried to convert it to ASP.NET using SHA1CryptoServiceProvider sha1 = new SHA1Crypt...
Do you have Enhanced crypto provider installed? Actually, to not depend on crypto providers, you can use other libraries, which implements all the cryptography stuff in native code. I know about EldoS SecureBlackbox (which is commercial), and Bouncy Castle (free one), however there can be other libraries on market.
How to convert openssl_pkey_get_public and openssl_verify to C# .NET PHP code verifies iPizza signature from bank: $key = openssl_pkey_get_public (file_get_contents ($preferences['bank_certificate'])); if (!openssl_verify ($data, $signature, $key)) { trigger_error ("Invalid signature", E_USER_ERROR); } I tried to conve...
TITLE: How to convert openssl_pkey_get_public and openssl_verify to C# .NET QUESTION: PHP code verifies iPizza signature from bank: $key = openssl_pkey_get_public (file_get_contents ($preferences['bank_certificate'])); if (!openssl_verify ($data, $signature, $key)) { trigger_error ("Invalid signature", E_USER_ERROR); ...
[ "c#", "asp.net", "security", "cryptography", "openssl" ]
2
1
2,746
2
0
2011-06-04T17:20:31.727000
2011-06-05T08:16:05.690000
6,238,250
6,238,859
Multivariate spline interpolation in python/scipy?
Is there a library module or other straightforward way to implement multivariate spline interpolation in python? Specifically, I have a set of scalar data on a regularly-spaced three-dimensional grid which I need to interpolate at a small number of points scattered throughout the domain. For two dimensions, I have been...
If I'm understanding your question correctly, your input "observation" data is regularly gridded? If so, scipy.ndimage.map_coordinates does exactly what you want. It's a bit hard to understand at first pass, but essentially, you just feed it a sequence of coordinates that you want to interpolate the values of the grid ...
Multivariate spline interpolation in python/scipy? Is there a library module or other straightforward way to implement multivariate spline interpolation in python? Specifically, I have a set of scalar data on a regularly-spaced three-dimensional grid which I need to interpolate at a small number of points scattered thr...
TITLE: Multivariate spline interpolation in python/scipy? QUESTION: Is there a library module or other straightforward way to implement multivariate spline interpolation in python? Specifically, I have a set of scalar data on a regularly-spaced three-dimensional grid which I need to interpolate at a small number of po...
[ "python", "numpy", "scipy", "interpolation" ]
31
47
31,323
2
0
2011-06-04T17:21:27.403000
2011-06-04T19:17:12.717000
6,238,264
6,242,173
Change from one navigation controller to another
I have application with 2 tab bars. In second tab bar I have navigation controller. I want to change this navigation controller to another navigation controller when "Change" button is pressed. How can I do that? Please help me. Thanks
You'd have to replace the View Controller in the TabBar using the viewControllers property of UITabBarController or setViewControllers:animated: if you want to add some animation. But maybe you should think of having 2 views in a controller of yours and hide/show them when you click a button, maybe even pushing/popping...
Change from one navigation controller to another I have application with 2 tab bars. In second tab bar I have navigation controller. I want to change this navigation controller to another navigation controller when "Change" button is pressed. How can I do that? Please help me. Thanks
TITLE: Change from one navigation controller to another QUESTION: I have application with 2 tab bars. In second tab bar I have navigation controller. I want to change this navigation controller to another navigation controller when "Change" button is pressed. How can I do that? Please help me. Thanks ANSWER: You'd ha...
[ "ios", "ios4", "uinavigationcontroller" ]
0
2
2,692
1
0
2011-06-04T17:23:18.243000
2011-06-05T09:56:34.090000
6,238,274
6,238,305
Resize an image with height/width constraints and constant ratio
I want to insert an image in a webpage and I want it to fit in a 120*40 space. The problem is, original images can have about any size (400*40, 30*220, etc.) so if I set height attribute to 40, I might find myself with images larger than 120 width. The same goes if I set a 120px width. If I set both width to 120 and he...
css properties max-width and max-height are what you need. My guess is that it will resize itself if it reaches one of these. I have used this alot in previous web projects. But i havent used the combination of both yet. EDIT: I've sais this in a comment, but setting both those properties does work in my tests. It keep...
Resize an image with height/width constraints and constant ratio I want to insert an image in a webpage and I want it to fit in a 120*40 space. The problem is, original images can have about any size (400*40, 30*220, etc.) so if I set height attribute to 40, I might find myself with images larger than 120 width. The sa...
TITLE: Resize an image with height/width constraints and constant ratio QUESTION: I want to insert an image in a webpage and I want it to fit in a 120*40 space. The problem is, original images can have about any size (400*40, 30*220, etc.) so if I set height attribute to 40, I might find myself with images larger than...
[ "html", "image-processing" ]
1
4
7,487
3
0
2011-06-04T17:24:42.687000
2011-06-04T17:30:16.310000
6,238,276
6,238,325
Retrieving JSON response in jQuery
I'm trying to retrieve the response of this script: And get it back in javascript and store it in a variable, so when I do variable[i] in a loop I'll get the ith genre name.
$.getJSON('your_script.php', function(genres) { // here genres[i] is your i'th genre from the list });
Retrieving JSON response in jQuery I'm trying to retrieve the response of this script: And get it back in javascript and store it in a variable, so when I do variable[i] in a loop I'll get the ith genre name.
TITLE: Retrieving JSON response in jQuery QUESTION: I'm trying to retrieve the response of this script: And get it back in javascript and store it in a variable, so when I do variable[i] in a loop I'll get the ith genre name. ANSWER: $.getJSON('your_script.php', function(genres) { // here genres[i] is your i'th genre...
[ "php", "javascript", "jquery", "mysql", "json" ]
1
2
269
4
0
2011-06-04T17:25:17.680000
2011-06-04T17:33:02.757000
6,238,295
6,238,348
The type or namespace name 'ServiceController' could not be found
I am trying to check a service in C#, I have added the System.ServiceProcess.dll Although I get the error: Error 2 The type or namespace name 'ServiceController' could not be found (are you missing a using directive or an assembly reference?) D:\App\Form1.cs 247 13 App My code is as follows: private void button13_Click...
You need to add a reference to the System.ServiceProcess.dll After that, you will be able to see it in Visual Studio, as one of the using statements you can add to your project:
The type or namespace name 'ServiceController' could not be found I am trying to check a service in C#, I have added the System.ServiceProcess.dll Although I get the error: Error 2 The type or namespace name 'ServiceController' could not be found (are you missing a using directive or an assembly reference?) D:\App\Form...
TITLE: The type or namespace name 'ServiceController' could not be found QUESTION: I am trying to check a service in C#, I have added the System.ServiceProcess.dll Although I get the error: Error 2 The type or namespace name 'ServiceController' could not be found (are you missing a using directive or an assembly refer...
[ "c#", ".net", "windows" ]
12
16
22,073
4
0
2011-06-04T17:28:52.123000
2011-06-04T17:36:35.207000
6,238,309
6,238,344
swing flow layout break element
I have panel which is using flow layout. How can I make break in flow layout? Like in html. Some special break element or another trick to indicate that specified element and all subsequent have to go to the next line.
In a case like this, I'd put two containers with flowlayout one on top of each other inside a BoxLayout. Nesting layouts is fairly inexpensive.
swing flow layout break element I have panel which is using flow layout. How can I make break in flow layout? Like in html. Some special break element or another trick to indicate that specified element and all subsequent have to go to the next line.
TITLE: swing flow layout break element QUESTION: I have panel which is using flow layout. How can I make break in flow layout? Like in html. Some special break element or another trick to indicate that specified element and all subsequent have to go to the next line. ANSWER: In a case like this, I'd put two container...
[ "java", "swing" ]
14
14
30,478
5
0
2011-06-04T17:30:28.243000
2011-06-04T17:35:59.853000
6,238,312
6,238,324
Remove all if None English from a string
I have a string that contain None-English: អត���រាប���រូរប���រាក���ថ���ង���ទី 03-06-2011 ម������ង 07:30 នាទី រូបិយប���ឞ���ឞ​ អត���រា​ ទិញចូល លក���ច���ញ រូបិយប���ឞ���ឞ​ប���រទ�����​អា�����ីប���រាក���រ���ល (1usd)4,1004,107បាត ថ���ឡង��� (1usd)30.1530.23រុង Anybody could tell me how can I remove the non-english string
HM.... maybe you can write your allowed chars and use preg_replace like this: preg_replace('/[^a-z0-9#\(\),\. ]/i','',$string);
Remove all if None English from a string I have a string that contain None-English: អត���រាប���រូរប���រាក���ថ���ង���ទី 03-06-2011 ម������ង 07:30 នាទី រូបិយប���ឞ���ឞ​ អត���រា​ ទិញចូល លក���ច���ញ រូបិយប���ឞ���ឞ​ប���រទ�����​អា�����ីប���រាក���រ���ល (1usd)4,1004,107បាត ថ���ឡង��� (1usd)30.1530.23រុង Anybody could tell me how ...
TITLE: Remove all if None English from a string QUESTION: I have a string that contain None-English: អត���រាប���រូរប���រាក���ថ���ង���ទី 03-06-2011 ម������ង 07:30 នាទី រូបិយប���ឞ���ឞ​ អត���រា​ ទិញចូល លក���ច���ញ រូបិយប���ឞ���ឞ​ប���រទ�����​អា�����ីប���រាក���រ���ល (1usd)4,1004,107បាត ថ���ឡង��� (1usd)30.1530.23រុង Anybody ...
[ "php" ]
2
3
74
3
0
2011-06-04T17:30:47.307000
2011-06-04T17:32:53.963000
6,238,314
6,238,376
Any way to keep an html button pressed?
I have a button. Is there any way to keep it visually pressed and unpress it via javascript? Thanks
I would try CSS and use the border-style inset, personally. For a list of different styles, please see this jsFiddle.
Any way to keep an html button pressed? I have a button. Is there any way to keep it visually pressed and unpress it via javascript? Thanks
TITLE: Any way to keep an html button pressed? QUESTION: I have a button. Is there any way to keep it visually pressed and unpress it via javascript? Thanks ANSWER: I would try CSS and use the border-style inset, personally. For a list of different styles, please see this jsFiddle.
[ "javascript", "html" ]
26
24
51,480
7
0
2011-06-04T17:30:56.737000
2011-06-04T17:40:51.350000
6,238,316
6,238,350
Jquery click() function doesn't work in Internet Explorer
I have a script which removes items from an input with CSV. It works except in Explorer http://jsfiddle.net/BXWqK/21/ What could be the cause? I can't figure it out...!
I suppose you're talking about older versions of Internet Explorer (the newer version being 9, and your script works on it). Then it's probably because of Array.indexOf, Internet Explorer used to not have that function. See Array.indexOf in Internet Explorer. By the way, jQuery.inArray also returns the value's index wi...
Jquery click() function doesn't work in Internet Explorer I have a script which removes items from an input with CSV. It works except in Explorer http://jsfiddle.net/BXWqK/21/ What could be the cause? I can't figure it out...!
TITLE: Jquery click() function doesn't work in Internet Explorer QUESTION: I have a script which removes items from an input with CSV. It works except in Explorer http://jsfiddle.net/BXWqK/21/ What could be the cause? I can't figure it out...! ANSWER: I suppose you're talking about older versions of Internet Explorer...
[ "javascript", "jquery", "internet-explorer" ]
3
3
307
1
0
2011-06-04T17:30:58.883000
2011-06-04T17:36:45.550000
6,238,318
6,244,317
MySQL server doesnt creates a stored procedure via phpmyAdmin
delimiter // create procedure rankPagesLive() BEGIN SET @r=0; UPDATE pageslive SET Rank= @r:= (@r+1) ORDER BY fan_count DESC; END // delimeter; Error'#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimiter // create procedu...
The problem was with phpmyAdmin and not with SQL code, delimiter identifier isn't allowed via SQL query (probably on my server only), After I logged in to MySQL server by SSH - it works just fine. Thank you for contribution.
MySQL server doesnt creates a stored procedure via phpmyAdmin delimiter // create procedure rankPagesLive() BEGIN SET @r=0; UPDATE pageslive SET Rank= @r:= (@r+1) ORDER BY fan_count DESC; END // delimeter; Error'#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version...
TITLE: MySQL server doesnt creates a stored procedure via phpmyAdmin QUESTION: delimiter // create procedure rankPagesLive() BEGIN SET @r=0; UPDATE pageslive SET Rank= @r:= (@r+1) ORDER BY fan_count DESC; END // delimeter; Error'#1064 - You have an error in your SQL syntax; check the manual that corresponds to your My...
[ "mysql", "phpmyadmin", "mysql-error-1064" ]
1
0
1,034
3
0
2011-06-04T17:31:54.563000
2011-06-05T16:43:54.693000
6,238,322
6,238,356
Storing session variables
I have four session variables-- location = request.session['location'] computer = request.session['computer'] phone = request.session['phone'] hobby = request.session['hobby'] I have several view functions that need to use these variables. Is there a way I can store these variables in a separate function and call them ...
Not sure I understand? You can call session variables from wherever the request is available i.e. your views def some_view(request): var1 = request.session.get('location', False) if var1: # do something else: # do something else see more here: https://docs.djangoproject.com/en/dev/topics/http/sessions/#examples From yo...
Storing session variables I have four session variables-- location = request.session['location'] computer = request.session['computer'] phone = request.session['phone'] hobby = request.session['hobby'] I have several view functions that need to use these variables. Is there a way I can store these variables in a separa...
TITLE: Storing session variables QUESTION: I have four session variables-- location = request.session['location'] computer = request.session['computer'] phone = request.session['phone'] hobby = request.session['hobby'] I have several view functions that need to use these variables. Is there a way I can store these var...
[ "django", "session" ]
1
4
6,003
1
0
2011-06-04T17:32:25.583000
2011-06-04T17:37:44.810000
6,238,331
6,240,904
Emacs shell scripts - how to put initial options into the script?
Inspired by Stack Overflow question Idomatic batch processing of text in Emacs? I tried out an Emacs shell script with the following headline: #!/usr/bin/emacs --script I put some Emacs Lisp code in it, and saved it as textfile rcat. Since the --script option does not prevent the loading of the site-start file, I had a...
You could always change #!/usr/bin/emacs to something like #!/home/thorsten/bin/emacs-no-site-file, and set that up as: #!/bin/sh exec /usr/bin/emacs --no-site-file "$@" If this doesn't work for you, or if you wish your script to be portable, then see Gilles' answer below for a more robust (and slightly funky:) approac...
Emacs shell scripts - how to put initial options into the script? Inspired by Stack Overflow question Idomatic batch processing of text in Emacs? I tried out an Emacs shell script with the following headline: #!/usr/bin/emacs --script I put some Emacs Lisp code in it, and saved it as textfile rcat. Since the --script o...
TITLE: Emacs shell scripts - how to put initial options into the script? QUESTION: Inspired by Stack Overflow question Idomatic batch processing of text in Emacs? I tried out an Emacs shell script with the following headline: #!/usr/bin/emacs --script I put some Emacs Lisp code in it, and saved it as textfile rcat. Si...
[ "shell", "emacs", "command-line-arguments", "elisp" ]
21
13
4,068
3
0
2011-06-04T17:34:05.897000
2011-06-05T03:50:47.070000
6,238,343
6,238,361
PHP Session variables not registering
I've been searching all day and found several similar issues, but none have resolved my problem. As the title states I'm having trouble with session variables not being "saved" - i.e they work only like local variables. What I'm trying to accomplish: index page with function "ABC" not running by defualt - link to myscr...
Your problem might be here: if (!isset($_SESSION['showAll'])) { $_SESSION['showAll'] == TRUE; } The double equal sign ( == ) checks for equality, but does not set anything. Try replacing it with the single equal sign ( = ). Also, your logic can be condensed considerably: if (!isset($_SESSION['showAll'])) { $_SESSION['s...
PHP Session variables not registering I've been searching all day and found several similar issues, but none have resolved my problem. As the title states I'm having trouble with session variables not being "saved" - i.e they work only like local variables. What I'm trying to accomplish: index page with function "ABC" ...
TITLE: PHP Session variables not registering QUESTION: I've been searching all day and found several similar issues, but none have resolved my problem. As the title states I'm having trouble with session variables not being "saved" - i.e they work only like local variables. What I'm trying to accomplish: index page wi...
[ "php", "session-variables" ]
1
5
5,412
1
0
2011-06-04T17:35:58.733000
2011-06-04T17:39:02.427000
6,238,353
6,256,962
Scala int value of String characters
I just want to sum the digits of a BigInt. I can do scala> "1 2 3".split(" ").map(_.toInt).sum res23: Int = 6 So I tried scala> BigInt(123).toString().map(_.toInt).sum res24: Int = 150 This doesn't work because it maps the characters to their Unicode values. Both the following work, but is there a more elegant way than...
Wow... these answers are all over the place! Here, do this: BigInt(123).toString().map(_.asDigit).sum
Scala int value of String characters I just want to sum the digits of a BigInt. I can do scala> "1 2 3".split(" ").map(_.toInt).sum res23: Int = 6 So I tried scala> BigInt(123).toString().map(_.toInt).sum res24: Int = 150 This doesn't work because it maps the characters to their Unicode values. Both the following work,...
TITLE: Scala int value of String characters QUESTION: I just want to sum the digits of a BigInt. I can do scala> "1 2 3".split(" ").map(_.toInt).sum res23: Int = 6 So I tried scala> BigInt(123).toString().map(_.toInt).sum res24: Int = 150 This doesn't work because it maps the characters to their Unicode values. Both t...
[ "string", "scala", "char", "int" ]
3
7
4,480
6
0
2011-06-04T17:37:22.943000
2011-06-06T19:26:07.450000
6,238,359
6,243,197
PHP regular expression search for includes, then write the includes where it found them
I have this script (well commented!) that searches files in a folder using regular expressions, removes comments and HTML, but leaves the tag intact. I would want this script to do the same, but instead of leaving tag's intact, it need to print the include it finds to file. For example: So the goal is to print out the ...
The solution is to use preg_replace_callback And create a new function and use file_get_contents: function repl_str($matches) { // $matches[1] the match for the first subpattern return file_get_contents($matches[1]); } Here is a link to the: completed script snippet
PHP regular expression search for includes, then write the includes where it found them I have this script (well commented!) that searches files in a folder using regular expressions, removes comments and HTML, but leaves the tag intact. I would want this script to do the same, but instead of leaving tag's intact, it n...
TITLE: PHP regular expression search for includes, then write the includes where it found them QUESTION: I have this script (well commented!) that searches files in a folder using regular expressions, removes comments and HTML, but leaves the tag intact. I would want this script to do the same, but instead of leaving ...
[ "php", "regex", "templates", "include" ]
4
0
622
2
0
2011-06-04T17:38:36.633000
2011-06-05T13:25:58.783000
6,238,360
6,238,882
Custom View - How do I set their ID's so that they can be found via findViewById()?
So I have a custom view set up in code (no XML layout defined for it) and am wondering how to get the child Views ID's defined correctly. I DO have an xml file defining id's similar to this.. But how I understand it, at least, since I don't have an xml layout there's no AttribSet to pass.. so my constructors are all ju...
My guess is, that your TextView is not instantiated at this point. try to trigger your animation outside of the oncreate-method. Additionally, your MyView is extended from View and you´re creating a RelativeLayout inside. If you do this, you could also directly extend your class from RelativeLayout and then do somethin...
Custom View - How do I set their ID's so that they can be found via findViewById()? So I have a custom view set up in code (no XML layout defined for it) and am wondering how to get the child Views ID's defined correctly. I DO have an xml file defining id's similar to this.. But how I understand it, at least, since I d...
TITLE: Custom View - How do I set their ID's so that they can be found via findViewById()? QUESTION: So I have a custom view set up in code (no XML layout defined for it) and am wondering how to get the child Views ID's defined correctly. I DO have an xml file defining id's similar to this.. But how I understand it, a...
[ "android", "view", "null" ]
5
0
7,340
2
0
2011-06-04T17:38:53.910000
2011-06-04T19:21:52.867000
6,238,369
6,238,396
Assigning icon to Cocoa app -- possible to use SVG?
I was wondering how to use an image I created as an icon. I put the filename into my plist file, and named the icon "icon.png", and dragged it in, and it is still not working. Also, is there any way to use an SVG file as the icon for a Cocoa app?
You need to convert the png s (1024px, 512px, 256px, 128px, 32px and 16px) to an icns using Icon Composer which can be found in /Developer/Applications/Utilities/. It works using drag & drop. Then just import the icns into the app and add the name of it (without.icns ) into Info.plist.
Assigning icon to Cocoa app -- possible to use SVG? I was wondering how to use an image I created as an icon. I put the filename into my plist file, and named the icon "icon.png", and dragged it in, and it is still not working. Also, is there any way to use an SVG file as the icon for a Cocoa app?
TITLE: Assigning icon to Cocoa app -- possible to use SVG? QUESTION: I was wondering how to use an image I created as an icon. I put the filename into my plist file, and named the icon "icon.png", and dragged it in, and it is still not working. Also, is there any way to use an SVG file as the icon for a Cocoa app? AN...
[ "cocoa", "macos", "icons", "svg", "png" ]
5
6
2,552
1
0
2011-06-04T17:39:49.770000
2011-06-04T17:45:04.077000
6,238,372
6,238,397
How do I make an Arraylist accessible to many classes?
I'm making a vertical shooter game and I am having trouble with collision detection. Collisions are detected through the Rectangle method "intersect", but in order to keep track of everything that could collide, I need Arraylists to keep track of all the bullets and enemy ships. The Enemy and Player class both spawn Bu...
You can have a GameState class that has the arraylist of locations and pass the GameState instance as an argument to the constructor of the Location derived classes.
How do I make an Arraylist accessible to many classes? I'm making a vertical shooter game and I am having trouble with collision detection. Collisions are detected through the Rectangle method "intersect", but in order to keep track of everything that could collide, I need Arraylists to keep track of all the bullets an...
TITLE: How do I make an Arraylist accessible to many classes? QUESTION: I'm making a vertical shooter game and I am having trouble with collision detection. Collisions are detected through the Rectangle method "intersect", but in order to keep track of everything that could collide, I need Arraylists to keep track of ...
[ "java", "oop", "arraylist" ]
4
2
951
2
0
2011-06-04T17:40:33.023000
2011-06-04T17:45:05.230000
6,238,387
6,238,567
The member with identity 'component_type_name' does not exist in the metadata collection.\r\nParameter name: identity
In the database I have a table called SERVICE. For this table I have triggers after INSER/UPDATE/DELETE. When I try to insert a record into the database using EF I get the error "The member with identity 'component_type_name' does not exist in the metadata collection.\r\nParameter name: identity". The column 'component...
You cannot do this: Select * from COMPONENT_TYPES_IN_SERVICE cts where cts.id = @ComponentTypeID; It returns COMPONENT_TYPES_IN_SERVICE record back to your application and EF tries to copy returned values into SERVICE because it thinks that you are passing back some database generated values.
The member with identity 'component_type_name' does not exist in the metadata collection.\r\nParameter name: identity In the database I have a table called SERVICE. For this table I have triggers after INSER/UPDATE/DELETE. When I try to insert a record into the database using EF I get the error "The member with identit...
TITLE: The member with identity 'component_type_name' does not exist in the metadata collection.\r\nParameter name: identity QUESTION: In the database I have a table called SERVICE. For this table I have triggers after INSER/UPDATE/DELETE. When I try to insert a record into the database using EF I get the error "The m...
[ "sql-server", "entity-framework", "triggers" ]
3
5
2,064
3
0
2011-06-04T17:43:02.417000
2011-06-04T18:21:14.563000
6,238,389
6,238,406
How to set/find ftp username , password , connection type in linux
I have set up wordpress in my linux server and when i try to install addons to wordpress it requests ftp username, password, connection type and connection type FTP FTPS. I managed to install ftp in my linux server using apt-get install ftp. But how do i find the other information? Thanks in advance
your username and password will be the username and password you use to login to your linux mahine. You will probably be using FTP connection type, but should look at using FTPS as this is secure and doesn't send your username/password over the wire in clear text. With that you should look at using a user account witho...
How to set/find ftp username , password , connection type in linux I have set up wordpress in my linux server and when i try to install addons to wordpress it requests ftp username, password, connection type and connection type FTP FTPS. I managed to install ftp in my linux server using apt-get install ftp. But how do ...
TITLE: How to set/find ftp username , password , connection type in linux QUESTION: I have set up wordpress in my linux server and when i try to install addons to wordpress it requests ftp username, password, connection type and connection type FTP FTPS. I managed to install ftp in my linux server using apt-get instal...
[ "wordpress", "ftp" ]
0
1
11,805
2
0
2011-06-04T17:43:21.720000
2011-06-04T17:46:39.257000
6,238,391
6,238,430
Why is my browser echoing this text backwards?
I have this written in PHP: user_login;?> My Classes ¦ Logout '; } else {?> Login | Register '; }?> And my browser is showing this: Welcome: Admin | LogoutMy Classes Why is that?
By the look of it, you've got your tags floated to the right. That being the case, right floated elements will always stack right to left. What this means is that the first element that is floated to the right will sit on the far right edge, and the second element will float on the right, but sit on the left side of th...
Why is my browser echoing this text backwards? I have this written in PHP: user_login;?> My Classes ¦ Logout '; } else {?> Login | Register '; }?> And my browser is showing this: Welcome: Admin | LogoutMy Classes Why is that?
TITLE: Why is my browser echoing this text backwards? QUESTION: I have this written in PHP: user_login;?> My Classes ¦ Logout '; } else {?> Login | Register '; }?> And my browser is showing this: Welcome: Admin | LogoutMy Classes Why is that? ANSWER: By the look of it, you've got your tags floated to the right. That ...
[ "php" ]
4
6
149
1
0
2011-06-04T17:44:28.090000
2011-06-04T17:50:10.703000
6,238,398
6,238,483
UITableView strange behavior
I'm programming a preferences panel with a UITableView which looks like this: The first section consists in simple rows and the second section in rows with a UISwitch as a subview. When I change to landscape and start scrolling, the tableview behaves in a strange way: This is my code: - (UITableViewCell *)tableView:(UI...
It could be happen because you are using the same cell identifier to access the table cell. Try with NSString *CellIdentifier = [NSString stringWithFormat:@"Cell %d_%d",indexPath.section,indexPath.row]; instead of. static NSString *CellIdentifier = @"Cell";
UITableView strange behavior I'm programming a preferences panel with a UITableView which looks like this: The first section consists in simple rows and the second section in rows with a UISwitch as a subview. When I change to landscape and start scrolling, the tableview behaves in a strange way: This is my code: - (UI...
TITLE: UITableView strange behavior QUESTION: I'm programming a preferences panel with a UITableView which looks like this: The first section consists in simple rows and the second section in rows with a UISwitch as a subview. When I change to landscape and start scrolling, the tableview behaves in a strange way: This...
[ "iphone", "xcode", "ios", "uitableview", "landscape" ]
1
1
484
3
0
2011-06-04T17:45:34.563000
2011-06-04T18:01:05.380000
6,238,399
6,241,094
Phusion-passenger compiles extension for wrong ruby when using RVM
I have set up RVM system-wide with Ruby 1.9.2 and as far as I can tell, it works fine. But when I try to compile Passenger apache2 module via passenger-install-apache2-module It compiles it for system's 1.8.7 (the ext/ruby folder contains ruby-1.8.7-x86_64-linux ) and when I start apache, the Passenger complains: *** P...
Turns out that apparently while installing newer Rake gem, I had had the environment wrong and though the gem ended up in RVM under 1.9.2, it actually referenced system 1.8.7 binary and that Passenger install script ran this rake, which in turn built the module against wrong ruby. Helped to uninstall and reinstall Rake...
Phusion-passenger compiles extension for wrong ruby when using RVM I have set up RVM system-wide with Ruby 1.9.2 and as far as I can tell, it works fine. But when I try to compile Passenger apache2 module via passenger-install-apache2-module It compiles it for system's 1.8.7 (the ext/ruby folder contains ruby-1.8.7-x86...
TITLE: Phusion-passenger compiles extension for wrong ruby when using RVM QUESTION: I have set up RVM system-wide with Ruby 1.9.2 and as far as I can tell, it works fine. But when I try to compile Passenger apache2 module via passenger-install-apache2-module It compiles it for system's 1.8.7 (the ext/ruby folder conta...
[ "ruby", "rvm", "passenger" ]
2
0
9,105
7
0
2011-06-04T17:45:35.893000
2011-06-05T04:57:38.753000
6,238,402
6,241,858
How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django?
I'm in early (pre-coding) stages of developing a mobile web application using jQuery Mobile (we looked at Sencha Touch for a few weeks, but jQuery Mobile is a better fit for our team's competencies). I am wrapping the jQuery Mobile web application with PhoneGap to create an iPhone, iPod touch, and iPad native-ish appli...
I would advise against storing in HTML5 local/web storage. If you are targeting iOS PhoneGap, I would recommend using the Keychain Plugin: http://blogs.nitobi.com/shazron/2010/11/06/ios-keychain-plugin-for-phonegap/
How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django? I'm in early (pre-coding) stages of developing a mobile web application using jQuery Mobile (we looked at Sencha Touch for a few weeks, but jQuery Mobile is a better fit for our team's comp...
TITLE: How to implement a first-time-only login scheme for a mobile web application implemented with jQuery Mobile, PhoneGap, and Django? QUESTION: I'm in early (pre-coding) stages of developing a mobile web application using jQuery Mobile (we looked at Sencha Touch for a few weeks, but jQuery Mobile is a better fit f...
[ "django", "html", "mobile", "jquery-mobile", "cordova" ]
14
4
10,439
6
0
2011-06-04T17:45:55.350000
2011-06-05T08:47:49.350000
6,238,412
6,238,465
How to use !-1 in javascript switch-case function
I "want" to use switch, but i can't seem to get it to work when I use it in this fashion. Anyone know why? var mystring='my name is johnny'; switch (!-1) { case mystring.indexOf('hello'): alert('hello'); break; case mystring.indexOf('goodbye'): alert('goodbye'); break; case mystring.indexOf('johnny'): alert('johnny'); ...
Disclaimer: This switch is evil. Use if/else-if statements. but if you must use a switch it can be done as such: switch (true) { case /hello/.test(mystring): alert('hello'); break; case /goodbye/.test(mystring): alert('goodbye'); break; case /johnny/.test(mystring): alert('johnny'); break; default: alert('default'); } ...
How to use !-1 in javascript switch-case function I "want" to use switch, but i can't seem to get it to work when I use it in this fashion. Anyone know why? var mystring='my name is johnny'; switch (!-1) { case mystring.indexOf('hello'): alert('hello'); break; case mystring.indexOf('goodbye'): alert('goodbye'); break; ...
TITLE: How to use !-1 in javascript switch-case function QUESTION: I "want" to use switch, but i can't seem to get it to work when I use it in this fashion. Anyone know why? var mystring='my name is johnny'; switch (!-1) { case mystring.indexOf('hello'): alert('hello'); break; case mystring.indexOf('goodbye'): alert('...
[ "javascript" ]
4
8
4,337
7
0
2011-06-04T17:47:24.880000
2011-06-04T17:57:53.113000
6,238,414
6,238,443
What tool to use to retrieve data from database stored procedure?
I have a stored procedure which will be used to populate a report in ASP.NET. My application mainly contains SELECT queries and it has to be developed quickly and be changeable in the future. I'd need to decide which tool to use to work with this stored procedure. Factors: Speed of Development with above average perfor...
If you're simply calling a stored procedure and getting the results, I would stick with plain ADO.NET. There's no reason to go over the time limit (it really should only take an hour or so) and you won't have any ORM headaches to deal with.
What tool to use to retrieve data from database stored procedure? I have a stored procedure which will be used to populate a report in ASP.NET. My application mainly contains SELECT queries and it has to be developed quickly and be changeable in the future. I'd need to decide which tool to use to work with this stored ...
TITLE: What tool to use to retrieve data from database stored procedure? QUESTION: I have a stored procedure which will be used to populate a report in ASP.NET. My application mainly contains SELECT queries and it has to be developed quickly and be changeable in the future. I'd need to decide which tool to use to work...
[ "sql-server", "data-access-layer" ]
1
3
175
1
0
2011-06-04T17:48:04.067000
2011-06-04T17:52:27.243000
6,238,424
6,240,308
WPF OnApplyTemplate on derived class of ItemsControl isn't called
The title basically points it out. I've read other blogs and posts related to the same issue, but none of the provided solutions did work for me. Here's a simplification of my code: // CustomItemsControl.xaml.cs namespace myNamespace { public partial class CustomItemsControl: ItemsControl { public CustomItemsControl() ...
I haven't seen it done that way before, I define the template in Generic.xaml as that is what Visual Studio generates when you go Project->Add Custom Control (WPF). You can make the code you posted work by calling InitializeComponent(); in your constructor. Also the documentation says you should use Template.FindName("...
WPF OnApplyTemplate on derived class of ItemsControl isn't called The title basically points it out. I've read other blogs and posts related to the same issue, but none of the provided solutions did work for me. Here's a simplification of my code: // CustomItemsControl.xaml.cs namespace myNamespace { public partial cla...
TITLE: WPF OnApplyTemplate on derived class of ItemsControl isn't called QUESTION: The title basically points it out. I've read other blogs and posts related to the same issue, but none of the provided solutions did work for me. Here's a simplification of my code: // CustomItemsControl.xaml.cs namespace myNamespace { ...
[ "c#", "wpf", ".net-4.0", "itemscontrol" ]
1
1
2,453
2
0
2011-06-04T17:49:35.760000
2011-06-05T00:48:40.363000
6,238,425
6,238,784
Natural Math parser in opensource
I want to start a new Open source project regarding natural math and Matlab, I am looking for an existing opensource math parser and display project that I can leverage. Something with functionality like MathType Or Lyx that can render math expressions I am looking to kick start my project from a code-base of such soft...
The symbolic toolbox in MATLAB can output LaTeX code, which you can render by means of LaTeX itself or some alternatives such as MimeTeX. s = sym('s'); latex(sqrt(s^3)); % will output '\sqrt{s^3}' If you look around on the File Exchange, you can find lots of LaTeX-related MATLAB functions, e.g. TeX Editor On the other ...
Natural Math parser in opensource I want to start a new Open source project regarding natural math and Matlab, I am looking for an existing opensource math parser and display project that I can leverage. Something with functionality like MathType Or Lyx that can render math expressions I am looking to kick start my pro...
TITLE: Natural Math parser in opensource QUESTION: I want to start a new Open source project regarding natural math and Matlab, I am looking for an existing opensource math parser and display project that I can leverage. Something with functionality like MathType Or Lyx that can render math expressions I am looking to...
[ "math", "matlab", "open-source", "latex", "lyx" ]
1
2
318
1
0
2011-06-04T17:49:40.270000
2011-06-04T19:03:08.770000
6,238,428
6,238,568
Titanium Appcelerator table views getting stacked on top of eachother
I am working on an iPhone app for an event and I have to build a table of 'pavilions' occurring either on week 1 or week 2, or all (default). My problem is that when the tabbed bar to filter down to week 1 or week 2 is clicked, it draws the new table rows/list overtop of the existing table view. I'm sure this is an eas...
You are creating and adding the table inside the onload event of xhr. This means one new table for each call. Create an empty table first, add it to the window, then inside onload only use setData(rowData).
Titanium Appcelerator table views getting stacked on top of eachother I am working on an iPhone app for an event and I have to build a table of 'pavilions' occurring either on week 1 or week 2, or all (default). My problem is that when the tabbed bar to filter down to week 1 or week 2 is clicked, it draws the new table...
TITLE: Titanium Appcelerator table views getting stacked on top of eachother QUESTION: I am working on an iPhone app for an event and I have to build a table of 'pavilions' occurring either on week 1 or week 2, or all (default). My problem is that when the tabbed bar to filter down to week 1 or week 2 is clicked, it d...
[ "iphone", "view", "titanium" ]
0
0
2,146
1
0
2011-06-04T17:50:03.890000
2011-06-04T18:21:28.447000
6,238,432
6,238,453
javascript split string to get Date and Hours only
I have this date format, var dateobj = 'Apr 28, 2011 6:01:23 AM'; I need Apr 28 6 (That is only date and hours ) Please tell me I tried this way var amorpm = dateobj.split(' ').slice(0, 3).join(' '); but i am getting only date
The code is a bit more complex than that: var dateArr = dateobj.split(' '); var amorpm = [dateArr[0], dateArr[1].replace(',', ''), dateArr[3].split(':')[0]].join(' ');
javascript split string to get Date and Hours only I have this date format, var dateobj = 'Apr 28, 2011 6:01:23 AM'; I need Apr 28 6 (That is only date and hours ) Please tell me I tried this way var amorpm = dateobj.split(' ').slice(0, 3).join(' '); but i am getting only date
TITLE: javascript split string to get Date and Hours only QUESTION: I have this date format, var dateobj = 'Apr 28, 2011 6:01:23 AM'; I need Apr 28 6 (That is only date and hours ) Please tell me I tried this way var amorpm = dateobj.split(' ').slice(0, 3).join(' '); but i am getting only date ANSWER: The code is a b...
[ "javascript" ]
1
0
3,815
4
0
2011-06-04T17:50:34.740000
2011-06-04T17:55:28.137000
6,238,446
6,238,546
Execute method On-Load of an object on a form in C#
E.g. instead of having a button to initiate the method, the method automatically happens without any user interaction - automatically. private void button13_Click(object sender, EventArgs e) { try { ServiceController sc = new ServiceController(); sc.ServiceName = "Spooler"; if (sc.Status.ToString().ToLower() == "stopp...
... Do I get your question correctly? You want a piece of code to be executed when an object or the form is loaded? Well that's easy:p Click on your object (or form) in the designer, in the properties dock, click the lightning bolt icon, go to the Load or Show event, and double-click the box. A new piece of code should...
Execute method On-Load of an object on a form in C# E.g. instead of having a button to initiate the method, the method automatically happens without any user interaction - automatically. private void button13_Click(object sender, EventArgs e) { try { ServiceController sc = new ServiceController(); sc.ServiceName = "Spo...
TITLE: Execute method On-Load of an object on a form in C# QUESTION: E.g. instead of having a button to initiate the method, the method automatically happens without any user interaction - automatically. private void button13_Click(object sender, EventArgs e) { try { ServiceController sc = new ServiceController(); sc....
[ "c#", ".net", "windows", "winforms" ]
0
0
164
3
0
2011-06-04T17:53:22.157000
2011-06-04T18:16:55.827000
6,238,458
6,246,331
Is there any C-language (or even C++) OpenID library around somewhere?
One of the OpenID developers pages advertises one, but that turns out to be a typo. I find none on Google. Does anyone know of an OpenID interface library written in the C 1 language? Thanks! 1 Held by some to be archaic -- so '70s dontcha' know -- but there are those who love it.
After reading the comment from @DOK I dug a little deeper. Both the Google authentication service and the Yahoo! authentication service use the OAuth open protocol. Authentication -- the "API," as I called it -- looks to be implemented entirely as a series of HTTP-message interchanges with the service, so the appropria...
Is there any C-language (or even C++) OpenID library around somewhere? One of the OpenID developers pages advertises one, but that turns out to be a typo. I find none on Google. Does anyone know of an OpenID interface library written in the C 1 language? Thanks! 1 Held by some to be archaic -- so '70s dontcha' know -- ...
TITLE: Is there any C-language (or even C++) OpenID library around somewhere? QUESTION: One of the OpenID developers pages advertises one, but that turns out to be a typo. I find none on Google. Does anyone know of an OpenID interface library written in the C 1 language? Thanks! 1 Held by some to be archaic -- so '70s...
[ "c", "openid" ]
6
2
3,526
3
0
2011-06-04T17:55:43.720000
2011-06-05T22:27:52.857000
6,238,469
6,242,137
GWT CellTable Sort Column With Custom Header
I have a sortable column in a CellTable. The problem is that I have a custom Header, in the header there is a text box. When the user clicks the text box, the column is sorted and the text box looses focus. What I need is for the sort to happen if there is a click anywhere in the header except in the text box. I have t...
Cell widgets use event delegation: the event that triggers and gets passed to your Cell 's onBrowserEvent is the same, caught at the same place, as the one that triggers sorting, so stopPropagation won't be of any help. Also, have a look at the code for CellTable (or AbstractCellTable in trunk ): there's no way to prev...
GWT CellTable Sort Column With Custom Header I have a sortable column in a CellTable. The problem is that I have a custom Header, in the header there is a text box. When the user clicks the text box, the column is sorted and the text box looses focus. What I need is for the sort to happen if there is a click anywhere i...
TITLE: GWT CellTable Sort Column With Custom Header QUESTION: I have a sortable column in a CellTable. The problem is that I have a custom Header, in the header there is a text box. When the user clicks the text box, the column is sorted and the text box looses focus. What I need is for the sort to happen if there is ...
[ "gwt", "gwt2", "gwt-2.2-celltable", "gwt-2.2", "gwt-2.3" ]
2
2
1,063
1
0
2011-06-04T17:59:27.150000
2011-06-05T09:51:04
6,238,480
6,243,223
Can I register to the GAC with Pascal scripting (InnoSetup)?
I'm using InnoSetup to install an application I built. My client requests that it downloads the latest DLLs upon install using this InnoSetup addon: http://www.sherlocksoftware.org/page.php?id=50 Simple enough. I got it working how I want to, but without the [Files] section (because its downloading them rather than bui...
The [Files] Section, you can use the external flag to allow the files that you have downloaded to run through the standard [Files] section, where the gacinstall flag is available. [Files] Source:{tmp}\mylibrary1.dll; DestDir:{app}; StrongAssemblyName: "MyAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ab...
Can I register to the GAC with Pascal scripting (InnoSetup)? I'm using InnoSetup to install an application I built. My client requests that it downloads the latest DLLs upon install using this InnoSetup addon: http://www.sherlocksoftware.org/page.php?id=50 Simple enough. I got it working how I want to, but without the ...
TITLE: Can I register to the GAC with Pascal scripting (InnoSetup)? QUESTION: I'm using InnoSetup to install an application I built. My client requests that it downloads the latest DLLs upon install using this InnoSetup addon: http://www.sherlocksoftware.org/page.php?id=50 Simple enough. I got it working how I want to...
[ "gac", "inno-setup", "pascal", "global-assembly-cache", "pascalscript" ]
3
2
1,189
2
0
2011-06-04T18:00:41.963000
2011-06-05T13:29:47.997000
6,238,485
6,238,595
Create Generic Function For Database Selects
I'm developing an iPhone app. I've got a function that reads data from a sqlite database and puts the results into an array. Everything works fine. Here is part of the function that fills the array: while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *aVar1 = [NSString stringWithUTF8String(char*)sqlite3_col...
Couldn't you just do something like: int numCols = sqlite3_column_count(compiledStatement); NSMutableArray *result = [NSMutableArray array]; while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSMutableArray *array = [NSMutableArray array]; for (int i = 0; i < numCols; i++) { [array addObject: [NSString stringWithUT...
Create Generic Function For Database Selects I'm developing an iPhone app. I've got a function that reads data from a sqlite database and puts the results into an array. Everything works fine. Here is part of the function that fills the array: while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *aVar1 = [NS...
TITLE: Create Generic Function For Database Selects QUESTION: I'm developing an iPhone app. I've got a function that reads data from a sqlite database and puts the results into an array. Everything works fine. Here is part of the function that fills the array: while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSS...
[ "objective-c", "sqlite" ]
1
0
371
2
0
2011-06-04T18:01:24.790000
2011-06-04T18:25:56.100000
6,238,486
6,238,507
Qt: QObject::connect: Cannot connect (null)
I'm trying to connect a signal from a QProcess inside my mainwindow() object to another QObject based class inside my mainwindow() object but I get this error: QObject::connect: Cannot connect (null)::readyReadStandardOutput () to (null)::logReady() Heres the code, its not complete by any means but I don't know why it ...
You need to create the proc and procLog objects. You've only got pointers as class members, so you'll have to initialize those (with new ). connect only works on live objects.
Qt: QObject::connect: Cannot connect (null) I'm trying to connect a signal from a QProcess inside my mainwindow() object to another QObject based class inside my mainwindow() object but I get this error: QObject::connect: Cannot connect (null)::readyReadStandardOutput () to (null)::logReady() Heres the code, its not co...
TITLE: Qt: QObject::connect: Cannot connect (null) QUESTION: I'm trying to connect a signal from a QProcess inside my mainwindow() object to another QObject based class inside my mainwindow() object but I get this error: QObject::connect: Cannot connect (null)::readyReadStandardOutput () to (null)::logReady() Heres th...
[ "qt", "qt4", "qt-creator" ]
11
14
22,220
2
0
2011-06-04T18:01:25.643000
2011-06-04T18:06:38.250000
6,238,487
6,238,775
AS3 - Pausing on loss of focus
I'm working on a Flash mobile game. If the app loses focus (a call comes in for example) I need the game timer to stop until focus is restored. Here is my current code but I'm getting a "Argument count mismatch error" onDeactivate(). Expected 0, got 1. Here is the related code, I think: addEventListener(Event.ACTIVATE,...
onActivate and onDeactivate are event listeners. This means they will be called with event argument. Give them one like this: onDeactivate(event:Event):void.
AS3 - Pausing on loss of focus I'm working on a Flash mobile game. If the app loses focus (a call comes in for example) I need the game timer to stop until focus is restored. Here is my current code but I'm getting a "Argument count mismatch error" onDeactivate(). Expected 0, got 1. Here is the related code, I think: a...
TITLE: AS3 - Pausing on loss of focus QUESTION: I'm working on a Flash mobile game. If the app loses focus (a call comes in for example) I need the game timer to stop until focus is restored. Here is my current code but I'm getting a "Argument count mismatch error" onDeactivate(). Expected 0, got 1. Here is the relate...
[ "actionscript-3", "timer", "focus" ]
0
2
1,072
1
0
2011-06-04T18:01:42.887000
2011-06-04T19:01:27.230000
6,238,492
6,238,511
regex to find substring
Say I have a substring BB which may be alone or part of a longer string, e.g. BB or AA|BB|CC or BB|CC or AA|BB i.e. if it follows/is followed by another substring it MUST be separated by a |. What regex do i need to find BB in any of the above but not in say AABB?
I think this will do it: ^(.+[|])?BB([|].+)?$ And after testing here I'm going to say yes, this is it.
regex to find substring Say I have a substring BB which may be alone or part of a longer string, e.g. BB or AA|BB|CC or BB|CC or AA|BB i.e. if it follows/is followed by another substring it MUST be separated by a |. What regex do i need to find BB in any of the above but not in say AABB?
TITLE: regex to find substring QUESTION: Say I have a substring BB which may be alone or part of a longer string, e.g. BB or AA|BB|CC or BB|CC or AA|BB i.e. if it follows/is followed by another substring it MUST be separated by a |. What regex do i need to find BB in any of the above but not in say AABB? ANSWER: I th...
[ "java", "regex" ]
5
6
639
4
0
2011-06-04T18:02:44.633000
2011-06-04T18:07:41.487000
6,238,499
6,238,576
eclipse and subversion issues
I set up an svn repository, and got it all working. However, whenever I delete a file in eclipse, svn complains about it: Running svn st gives the line:! filename which seems to mean, as far as I can tell, that svn wants me to delete it with svn rm filename. However, I have no way to tell eclipse to do this. In additio...
Since you are working with Eclipse and Subversion, I recommend checking out some Eclipse plugins to make your life easier. I tend to use Subclipse, but you can also use Subversive. Having version control integrated into your development environment makes managing your workflow much easier, I think.
eclipse and subversion issues I set up an svn repository, and got it all working. However, whenever I delete a file in eclipse, svn complains about it: Running svn st gives the line:! filename which seems to mean, as far as I can tell, that svn wants me to delete it with svn rm filename. However, I have no way to tell ...
TITLE: eclipse and subversion issues QUESTION: I set up an svn repository, and got it all working. However, whenever I delete a file in eclipse, svn complains about it: Running svn st gives the line:! filename which seems to mean, as far as I can tell, that svn wants me to delete it with svn rm filename. However, I ha...
[ "eclipse", "svn" ]
0
2
125
1
0
2011-06-04T18:04:08.550000
2011-06-04T18:22:53.643000
6,238,502
6,238,554
Path type for PHP opendir()
Seems a little bit of an odd question to be asking. What path does opendir() expect? When I try: opendir('/home/myuser/public_html'); and get this [function.opendir]: failed to open dir: No such file or directory. If that path isn't correct, what should it be?
The syntax you use is fine. (see the PHP Manual on opendir) The path either doesn't exist, or the PHP user doesn't have the right to access it.
Path type for PHP opendir() Seems a little bit of an odd question to be asking. What path does opendir() expect? When I try: opendir('/home/myuser/public_html'); and get this [function.opendir]: failed to open dir: No such file or directory. If that path isn't correct, what should it be?
TITLE: Path type for PHP opendir() QUESTION: Seems a little bit of an odd question to be asking. What path does opendir() expect? When I try: opendir('/home/myuser/public_html'); and get this [function.opendir]: failed to open dir: No such file or directory. If that path isn't correct, what should it be? ANSWER: The ...
[ "php" ]
0
3
3,093
2
0
2011-06-04T18:05:00.340000
2011-06-04T18:18:16.323000
6,238,510
6,241,830
Using MonoDevelop Smart Menu
First off, apologies if this is a complete noob question which could easily be resolved by common sense, but I'm really not getting some things here. I've been searching all over to figure this out (even posting on Mono Forums without any luck), and haven't quite found a thing. So, does anyone know what version of.NET ...
Download the Mono vm, compilers, etc., from here: http://www.go-mono.com/mono-downloads/download.html
Using MonoDevelop Smart Menu First off, apologies if this is a complete noob question which could easily be resolved by common sense, but I'm really not getting some things here. I've been searching all over to figure this out (even posting on Mono Forums without any luck), and haven't quite found a thing. So, does any...
TITLE: Using MonoDevelop Smart Menu QUESTION: First off, apologies if this is a complete noob question which could easily be resolved by common sense, but I'm really not getting some things here. I've been searching all over to figure this out (even posting on Mono Forums without any luck), and haven't quite found a t...
[ "c#", ".net", "monodevelop" ]
0
1
285
1
0
2011-06-04T18:07:24.240000
2011-06-05T08:39:53.273000
6,238,524
6,238,572
How to show an image from an url in android
I have looked around the internet but haven't been able to find a working example on how to show an image from an url. The below code is crashing and I can't find out why.. Any help is greatly appreciated. Thanks. TesteImages.java: package pac.image3; import java.io.IOException; import java.io.InputStream; import java...
Just use the following method to draw image from url: Drawable drawable_from_url(String url, String src_name) throws java.net.MalformedURLException, java.io.IOException { return Drawable.createFromStream(((java.io.InputStream) new java.net.URL(url).awagetContent()), src_name); } Just pass the string url to the method(a...
How to show an image from an url in android I have looked around the internet but haven't been able to find a working example on how to show an image from an url. The below code is crashing and I can't find out why.. Any help is greatly appreciated. Thanks. TesteImages.java: package pac.image3; import java.io.IOExcept...
TITLE: How to show an image from an url in android QUESTION: I have looked around the internet but haven't been able to find a working example on how to show an image from an url. The below code is crashing and I can't find out why.. Any help is greatly appreciated. Thanks. TesteImages.java: package pac.image3; impor...
[ "android", "imageview" ]
3
7
19,364
2
0
2011-06-04T18:09:54.357000
2011-06-04T18:22:06
6,238,528
6,238,548
Cant access site using webclient method..?
I am making a desktop yellowpage application. I can access all countries yellowpage site but not australian site. I dont know why? Here is the code class Program { static void Main(string[] args) { WebClient wb = new WebClient(); wb.Headers.Add("user-agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)"); string ht...
It looks like that website will only send over gzip'ed data. Try switching to HttpWebRequest and using auto decompression: var request = (HttpWebRequest)WebRequest.Create("http://www.yellowpages.com.au"); request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;.NET CLR 1.0.3705;)"; request.Headers.Add(Ht...
Cant access site using webclient method..? I am making a desktop yellowpage application. I can access all countries yellowpage site but not australian site. I dont know why? Here is the code class Program { static void Main(string[] args) { WebClient wb = new WebClient(); wb.Headers.Add("user-agent", "Mozilla/5.0 (Wind...
TITLE: Cant access site using webclient method..? QUESTION: I am making a desktop yellowpage application. I can access all countries yellowpage site but not australian site. I dont know why? Here is the code class Program { static void Main(string[] args) { WebClient wb = new WebClient(); wb.Headers.Add("user-agent", ...
[ "c#" ]
0
3
519
3
0
2011-06-04T18:12:21.217000
2011-06-04T18:17:01.937000
6,238,533
6,238,550
Jquery scrollTo Plugin: Scroll to an anchor
I'm using the scrollTo plugin (http://flesler.blogspot.com/2007/10/jqueryscrollto.html) to scroll to a specific anchor in my page. Now I would like to be able to specify an anchor to scroll to, so I tried this: $('a[name="anchorname"]').scrollTo(); But that doesn't seem to work. Does anyone know how to do this?
I'm pretty sure you're looking for $.scrollTo('a[name="anchorname"]'); Demo: http://jsfiddle.net/mattball/davUw/
Jquery scrollTo Plugin: Scroll to an anchor I'm using the scrollTo plugin (http://flesler.blogspot.com/2007/10/jqueryscrollto.html) to scroll to a specific anchor in my page. Now I would like to be able to specify an anchor to scroll to, so I tried this: $('a[name="anchorname"]').scrollTo(); But that doesn't seem to wo...
TITLE: Jquery scrollTo Plugin: Scroll to an anchor QUESTION: I'm using the scrollTo plugin (http://flesler.blogspot.com/2007/10/jqueryscrollto.html) to scroll to a specific anchor in my page. Now I would like to be able to specify an anchor to scroll to, so I tried this: $('a[name="anchorname"]').scrollTo(); But that ...
[ "javascript", "jquery", "scroll" ]
2
2
1,281
1
0
2011-06-04T18:13:46.450000
2011-06-04T18:17:12.693000
6,238,542
6,243,848
FasterCSV tutorial to import data to database?
Is anyone aware of any tutorials that demonstrate how to import data in a Ruby app with FasterCSV and saving it to a SQLite or MySQL database? Here are the specific steps involved: Reading a file line by line (the.foreach method does this according to documentation) Mapping header names in file to database column names...
So it looks like FasterCSV is now part of the Ruby core as of Ruby 1.9, so this is what I ended up doing, to achieve the goals in my question above: @importedfile = Import.find(params[:id]) filename = @importedfile.csv.path CSV.foreach(filename, {:headers => true}) do |row| @post = Post.find_or_create_by_email(:content...
FasterCSV tutorial to import data to database? Is anyone aware of any tutorials that demonstrate how to import data in a Ruby app with FasterCSV and saving it to a SQLite or MySQL database? Here are the specific steps involved: Reading a file line by line (the.foreach method does this according to documentation) Mappin...
TITLE: FasterCSV tutorial to import data to database? QUESTION: Is anyone aware of any tutorials that demonstrate how to import data in a Ruby app with FasterCSV and saving it to a SQLite or MySQL database? Here are the specific steps involved: Reading a file line by line (the.foreach method does this according to doc...
[ "mysql", "ruby", "sqlite", "import", "fastercsv" ]
2
2
1,685
4
0
2011-06-04T18:15:25.983000
2011-06-05T15:29:58.503000
6,238,544
6,238,551
Implicit cast of class derived from template base class
I've got a problem with implicit casting, templates and inheritance from template classes. The following is what I extracted from my project, I have left out that some classes are even abstract, but it does not have to do with the case. class A {}; class B: public A {}; template class Base {}; class Derived: public Ba...
This is not possible. Base has no relation to Base, regardless of the relation between A and B.
Implicit cast of class derived from template base class I've got a problem with implicit casting, templates and inheritance from template classes. The following is what I extracted from my project, I have left out that some classes are even abstract, but it does not have to do with the case. class A {}; class B: public...
TITLE: Implicit cast of class derived from template base class QUESTION: I've got a problem with implicit casting, templates and inheritance from template classes. The following is what I extracted from my project, I have left out that some classes are even abstract, but it does not have to do with the case. class A {...
[ "c++", "templates", "inheritance", "casting", "implicit" ]
5
6
1,860
2
0
2011-06-04T18:16:08.427000
2011-06-04T18:17:35.417000
6,238,547
6,238,685
Reference level part 2
Expanding on this question, it looks like I did not provide enough detail. I have an object called CallbackObject that is designed to contain an object instance, and the information of what function to invoke, and the parameters to pass at invokation time. template struct CallbackObject1 { objectType obj; memberFunctio...
Here's an example helper function, assuming void return, one argument, and no need to handle more than one level of indirection: template inline void invoke(T& obj, F func, const A& arg) { (obj.*func)(arg); } template inline void invoke(T* obj, F func, const A& arg) { (obj->*func)(arg); } If you need to handle more th...
Reference level part 2 Expanding on this question, it looks like I did not provide enough detail. I have an object called CallbackObject that is designed to contain an object instance, and the information of what function to invoke, and the parameters to pass at invokation time. template struct CallbackObject1 { object...
TITLE: Reference level part 2 QUESTION: Expanding on this question, it looks like I did not provide enough detail. I have an object called CallbackObject that is designed to contain an object instance, and the information of what function to invoke, and the parameters to pass at invokation time. template struct Callba...
[ "c++", "templates", "function-pointers" ]
0
1
100
3
0
2011-06-04T18:16:57.163000
2011-06-04T18:46:28.960000