PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,041,727 | 06/14/2012 21:37:18 | 340,716 | 05/13/2010 21:28:01 | 118 | 1 | Partial File Commit in Team Foundation | Is it possible to perform a "partial" or "patch" commit in Team Foundation? I have a single file with two lines that have been modified, but I only want to commit one of those lines. Git has this functionality in the "git add -p" command. Does TFS have something similar?
My problem more specifically is: my .proj file has changes to the database connections settings that I don't want committed to TFS (since this is a connection to a development database on my own dev computer). However, I have deleted a file in the project, so I want to commit the removal of the reference from the .proj file. I'm using Team Foundation Server 11 and Visual Studio 2010. | visual-studio | version-control | tfs | null | null | null | open | Partial File Commit in Team Foundation
===
Is it possible to perform a "partial" or "patch" commit in Team Foundation? I have a single file with two lines that have been modified, but I only want to commit one of those lines. Git has this functionality in the "git add -p" command. Does TFS have something similar?
My problem more specifically is: my .proj file has changes to the database connections settings that I don't want committed to TFS (since this is a connection to a development database on my own dev computer). However, I have deleted a file in the project, so I want to commit the removal of the reference from the .proj file. I'm using Team Foundation Server 11 and Visual Studio 2010. | 0 |
6,868,846 | 07/29/2011 05:03:29 | 811,239 | 06/22/2011 21:57:36 | 13 | 0 | Perl Vs Python variable Scoping - gotchas to be aware of | While investigating **lexical and dynamic scoping in Perl and Python**, I came across a silent scoping related behavior of Perl that can cause bugs very difficult to trace. I have provided example code for both Perl and Python to illustrate how scoping works in both the languages
In Python if we run the code:
x = 30
def g():
s1 = x
print "Inside g(): Value of x is %d" % s1
def t(var):
x = var
print "Inside t(): Value of x is %d" % x
def tt():
s1 = x
print "Inside t()-tt(): Value of x is %d" % x
tt()
g()
t(200)
The resulting output is:
Inside t(): Value of x is 200
Inside t()-tt(): Value of x is 200
Inside g(): Value of x is 30
This is the usual lexical scoping behavior. The scope of the variable `x` in the function `g()` is determined by place in the program where it is defined, not where the function `g()` gets called. As a result of lexical scoping behavior in Python when the function `g()` is called within the function `t()` where another lexically scoped variable `x` is also defined and set to the value of 200, `g()` still displays the old value 30, as that is the value of the variable x in scope where `g()` was defined. The function `tt()` displays a value of 200 as the variable `x` that is in the the lexical scope of `tt()` has a value of 200. Python has only lexical scoping and that is the default behavior.
By contrast Perl provides the flexibility of using lexical scoping as well as dynamic scoping. Which can be a boon in some cases, but can also lead to hard to find bugs if the programmer is not careful and understands how scoping works in Perl.
To illustrate this subtle behavior, if we execute the following Perl code:
use strict;
my $x = 30;
sub g {
my $s = $x;
print "Inside g\(\)\: Value of x is ${s}\n";
}
sub t {
my $x = shift;
print "Inside t\(\)\: Value of x is ${x}\n";
sub tt {
my $p = $x;
print "Inside t\(\)-tt\(\)\: Value of x is ${p}\n";
}
tt($x);
g();
}
t(500);
the resulting output is:
Inside t(): Value of x is 500
Inside t()-tt(): Value of x is 500
Inside g(): Value of x is 30
Perl displays the lexical scoping behavior for the variable `$x` as in Python. However, if the programmer omits mentioning the `my` in line 8 of this code, Perl silently treats the variable `$x` as a dynamically scoped variable and provides a different result.
Thus if we execute this code where the only change is the removal of the `my` declarator in line 8
use strict;
my $x = 30;
sub g {
my $s = $x;
print "Inside g\(\)\: Value of x is ${s}\n";
}
sub t {
$x = shift;
print "Inside t\(\)\: Value of x is ${x}\n";
sub tt {
my $p = $x;
print "Inside t\(\)-tt\(\)\: Value of x is ${p}\n";
}
tt($x);
g();
}
t(500);
The resulting output is
Inside t(): Value of x is 500
Inside t()-tt(): Value of x is 500
Inside g(): Value of x is 500
i.e Perl treats the variable `$x` as a dynamically scoped variable. This is the same as variable being declared with the `local` keyword. This kind of error could get difficult to catch and debug in a large program of several hundreds or thousands of lines of code. The thing to remember is that without a `my` prefix, Perl treats variables as dynamically scoped. | python | perl | null | null | null | 07/29/2011 06:23:40 | not a real question | Perl Vs Python variable Scoping - gotchas to be aware of
===
While investigating **lexical and dynamic scoping in Perl and Python**, I came across a silent scoping related behavior of Perl that can cause bugs very difficult to trace. I have provided example code for both Perl and Python to illustrate how scoping works in both the languages
In Python if we run the code:
x = 30
def g():
s1 = x
print "Inside g(): Value of x is %d" % s1
def t(var):
x = var
print "Inside t(): Value of x is %d" % x
def tt():
s1 = x
print "Inside t()-tt(): Value of x is %d" % x
tt()
g()
t(200)
The resulting output is:
Inside t(): Value of x is 200
Inside t()-tt(): Value of x is 200
Inside g(): Value of x is 30
This is the usual lexical scoping behavior. The scope of the variable `x` in the function `g()` is determined by place in the program where it is defined, not where the function `g()` gets called. As a result of lexical scoping behavior in Python when the function `g()` is called within the function `t()` where another lexically scoped variable `x` is also defined and set to the value of 200, `g()` still displays the old value 30, as that is the value of the variable x in scope where `g()` was defined. The function `tt()` displays a value of 200 as the variable `x` that is in the the lexical scope of `tt()` has a value of 200. Python has only lexical scoping and that is the default behavior.
By contrast Perl provides the flexibility of using lexical scoping as well as dynamic scoping. Which can be a boon in some cases, but can also lead to hard to find bugs if the programmer is not careful and understands how scoping works in Perl.
To illustrate this subtle behavior, if we execute the following Perl code:
use strict;
my $x = 30;
sub g {
my $s = $x;
print "Inside g\(\)\: Value of x is ${s}\n";
}
sub t {
my $x = shift;
print "Inside t\(\)\: Value of x is ${x}\n";
sub tt {
my $p = $x;
print "Inside t\(\)-tt\(\)\: Value of x is ${p}\n";
}
tt($x);
g();
}
t(500);
the resulting output is:
Inside t(): Value of x is 500
Inside t()-tt(): Value of x is 500
Inside g(): Value of x is 30
Perl displays the lexical scoping behavior for the variable `$x` as in Python. However, if the programmer omits mentioning the `my` in line 8 of this code, Perl silently treats the variable `$x` as a dynamically scoped variable and provides a different result.
Thus if we execute this code where the only change is the removal of the `my` declarator in line 8
use strict;
my $x = 30;
sub g {
my $s = $x;
print "Inside g\(\)\: Value of x is ${s}\n";
}
sub t {
$x = shift;
print "Inside t\(\)\: Value of x is ${x}\n";
sub tt {
my $p = $x;
print "Inside t\(\)-tt\(\)\: Value of x is ${p}\n";
}
tt($x);
g();
}
t(500);
The resulting output is
Inside t(): Value of x is 500
Inside t()-tt(): Value of x is 500
Inside g(): Value of x is 500
i.e Perl treats the variable `$x` as a dynamically scoped variable. This is the same as variable being declared with the `local` keyword. This kind of error could get difficult to catch and debug in a large program of several hundreds or thousands of lines of code. The thing to remember is that without a `my` prefix, Perl treats variables as dynamically scoped. | 1 |
9,940,049 | 03/30/2012 09:09:11 | 1,302,838 | 03/30/2012 08:48:37 | 1 | 0 | Timezone conversion for a specific datetime in java | I will be giving input date time for a timezone and the timezone for the input date time and we want the relevant datetime in the expected timezone.
And here is my method.
convertToTimezone("03/08/2010 20:19:00 PM","Asia/Shanghai","US/Central");
The above time is the time in Asia/Shanghai.We would like to know what is the corresponding time in US/Central.
It's working fine but I am getting 1 hour difference from the actual time.
Can I know where I am going wrong ?
Here is the code.
enter code here
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class DateUtil
{
private static String format_date="MM/dd/yyyy HH:mm:ss a";
public static void main(String a[])
{
try
{
String sourceTimezone="Asia/Shanghai";
String destTimezone="US/Central";
String outputExpectedTimezone=convertToTimezone("03/08/2010 20:19:00 PM",sourceTimezone,destTimezone);
System.out.println("outputExpectedTimezone :"+outputExpectedTimezone);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public static String convertToTimezone(String inputDate,String inputDateTimezone,String destinationDateTimezone)throws Exception
{
String outputDate=null;
SimpleDateFormat format = new SimpleDateFormat(format_date);
format.setTimeZone(TimeZone.getTimeZone(inputDateTimezone));
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(inputDateTimezone));
calendar.setTime(format.parse(inputDate));
calendar.add(Calendar.MILLISECOND,-(calendar.getTimeZone().getRawOffset()));
calendar.add(Calendar.MILLISECOND, - calendar.getTimeZone().getDSTSavings());
calendar.add(Calendar.MILLISECOND, TimeZone.getTimeZone(destinationDateTimezone).getRawOffset());
outputDate=format.format(calendar.getTime());
return outputDate;
}
}
| java | timezone | null | null | null | null | open | Timezone conversion for a specific datetime in java
===
I will be giving input date time for a timezone and the timezone for the input date time and we want the relevant datetime in the expected timezone.
And here is my method.
convertToTimezone("03/08/2010 20:19:00 PM","Asia/Shanghai","US/Central");
The above time is the time in Asia/Shanghai.We would like to know what is the corresponding time in US/Central.
It's working fine but I am getting 1 hour difference from the actual time.
Can I know where I am going wrong ?
Here is the code.
enter code here
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class DateUtil
{
private static String format_date="MM/dd/yyyy HH:mm:ss a";
public static void main(String a[])
{
try
{
String sourceTimezone="Asia/Shanghai";
String destTimezone="US/Central";
String outputExpectedTimezone=convertToTimezone("03/08/2010 20:19:00 PM",sourceTimezone,destTimezone);
System.out.println("outputExpectedTimezone :"+outputExpectedTimezone);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
public static String convertToTimezone(String inputDate,String inputDateTimezone,String destinationDateTimezone)throws Exception
{
String outputDate=null;
SimpleDateFormat format = new SimpleDateFormat(format_date);
format.setTimeZone(TimeZone.getTimeZone(inputDateTimezone));
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(inputDateTimezone));
calendar.setTime(format.parse(inputDate));
calendar.add(Calendar.MILLISECOND,-(calendar.getTimeZone().getRawOffset()));
calendar.add(Calendar.MILLISECOND, - calendar.getTimeZone().getDSTSavings());
calendar.add(Calendar.MILLISECOND, TimeZone.getTimeZone(destinationDateTimezone).getRawOffset());
outputDate=format.format(calendar.getTime());
return outputDate;
}
}
| 0 |
10,787,149 | 05/28/2012 15:37:56 | 1,074,458 | 11/30/2011 23:39:18 | 86 | 1 | Tool to export outlook,thunderbird,mozilla contacts | Is there tool to export contacts from one or all of the above programs ? | windows | application | outlook | mozilla | thunderbird | 05/28/2012 18:12:06 | off topic | Tool to export outlook,thunderbird,mozilla contacts
===
Is there tool to export contacts from one or all of the above programs ? | 2 |
7,359,986 | 09/09/2011 10:02:33 | 936,505 | 09/09/2011 09:41:33 | 1 | 0 | Haskell complete guide | Does anyone know a complete guide to haskell that present the more advanced topic like GADTs and multi-parameter type classes? | haskell | books | reference | null | null | 10/03/2011 01:06:54 | not constructive | Haskell complete guide
===
Does anyone know a complete guide to haskell that present the more advanced topic like GADTs and multi-parameter type classes? | 4 |
11,687,585 | 07/27/2012 12:16:35 | 1,550,459 | 07/25/2012 04:12:33 | 26 | 1 | How to sort tabular view - IOS | I want to sort a tabular view in IOS apps (Ascending, Descending). For that do we need to write our own sorting logics or any predefined methods are available in IOS?
thanks in advance.
| iphone | objective-c | ios | xcode | null | null | open | How to sort tabular view - IOS
===
I want to sort a tabular view in IOS apps (Ascending, Descending). For that do we need to write our own sorting logics or any predefined methods are available in IOS?
thanks in advance.
| 0 |
11,387,118 | 07/08/2012 22:07:07 | 1,401,731 | 05/17/2012 18:36:51 | 29 | 0 | Android tablet for development | Can some one please suggest what kind of a tablet should I get for testing my apps ? I've just started learning Android development and mobile web app development. I was looking at the Ainol Elf 2, Ainol Aurora 2 and Nexus 7 but I'm not sure. | android | tablet | null | null | null | null | open | Android tablet for development
===
Can some one please suggest what kind of a tablet should I get for testing my apps ? I've just started learning Android development and mobile web app development. I was looking at the Ainol Elf 2, Ainol Aurora 2 and Nexus 7 but I'm not sure. | 0 |
7,802,147 | 10/18/2011 03:37:11 | 1,000,326 | 10/18/2011 03:24:40 | 1 | 0 | How to recover data from iphone backup files WITHOUT the info.plist, status.plist, manifest.plist, manifest.mbdb, and manifest.mbdx files? | I have iTunes 10.5 and Mac OS X version 10.6.8.
iTunes recognizes all my backups except this particular one that i need. I looked in the backup directory and it is there along with the other backups. It looks the same with the other backups except that it's missing info.plist, status.plist, manifest.plist, manifest.mbdb, and manifest.mbdx. Applications from the web like iPhone Backup Extractor works only if I have those five files. Is there a way to recover data without the five files? | iphone | backup | itunes | manifest | data-recovery | 07/07/2012 23:22:21 | off topic | How to recover data from iphone backup files WITHOUT the info.plist, status.plist, manifest.plist, manifest.mbdb, and manifest.mbdx files?
===
I have iTunes 10.5 and Mac OS X version 10.6.8.
iTunes recognizes all my backups except this particular one that i need. I looked in the backup directory and it is there along with the other backups. It looks the same with the other backups except that it's missing info.plist, status.plist, manifest.plist, manifest.mbdb, and manifest.mbdx. Applications from the web like iPhone Backup Extractor works only if I have those five files. Is there a way to recover data without the five files? | 2 |
4,278,372 | 11/25/2010 14:59:32 | 516,063 | 11/22/2010 12:41:52 | 1 | 0 | How to use the cache store configured in application controller @ workling? | I have a cache_store configure in Application controller through the following @ config/environments/*.rb:
config.action_controller.cache_store = :mem_cache_store, MEMCACHE_CONFIG['host'].to_s + ':' + MEMCACHE_CONFIG['port'].to_s
I am using the cache_store in application controller as below:
cache_store.write(key,checking)
But, I was not use same as above in Workling. Am is missing something here? | ruby-on-rails | memcachedb | null | null | null | null | open | How to use the cache store configured in application controller @ workling?
===
I have a cache_store configure in Application controller through the following @ config/environments/*.rb:
config.action_controller.cache_store = :mem_cache_store, MEMCACHE_CONFIG['host'].to_s + ':' + MEMCACHE_CONFIG['port'].to_s
I am using the cache_store in application controller as below:
cache_store.write(key,checking)
But, I was not use same as above in Workling. Am is missing something here? | 0 |
5,551,811 | 04/05/2011 12:30:24 | 77,673 | 03/13/2009 11:46:49 | 946 | 40 | What does the () at the end of dynamic array allocate mean? | I have see some example like below in a different question which I have not seen before.
new int[m_size]();
^^
I have seen and used the version `new int[m_size]` all the time but not one with the `()` at the end. | c++ | arrays | memory-management | memory-allocation | null | null | open | What does the () at the end of dynamic array allocate mean?
===
I have see some example like below in a different question which I have not seen before.
new int[m_size]();
^^
I have seen and used the version `new int[m_size]` all the time but not one with the `()` at the end. | 0 |
4,931,973 | 02/08/2011 10:35:41 | 83,475 | 03/27/2009 05:15:21 | 1,014 | 63 | How to cache a mysql_query using memcache | I would like to know if it's possible to store a "ressource" within memcache, I'm currently trying the following code but apparently it's not correct:
$result = mysql_query($sSQL);
$memcache->set($key, $result, 0, $ttl);
return $result;
Thanks | php | mysql | memcached | null | null | null | open | How to cache a mysql_query using memcache
===
I would like to know if it's possible to store a "ressource" within memcache, I'm currently trying the following code but apparently it's not correct:
$result = mysql_query($sSQL);
$memcache->set($key, $result, 0, $ttl);
return $result;
Thanks | 0 |
180,939 | 10/08/2008 00:22:22 | 9,922 | 09/15/2008 20:26:19 | 232 | 9 | .NET "must-have" development tools | James Avery wrote a classic article a while back entitled [Ten Must-Have Tools Every Developer Should Download Now](http://msdn.microsoft.com/en-us/magazine/cc300497.aspx) and Scott Hanselman has an excellent list on [his blog](http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx) but if you were on a desert island and were only allowed three .NET development tools which ones would you pick?
| .net | devtools | null | null | null | 10/05/2011 01:10:16 | not constructive | .NET "must-have" development tools
===
James Avery wrote a classic article a while back entitled [Ten Must-Have Tools Every Developer Should Download Now](http://msdn.microsoft.com/en-us/magazine/cc300497.aspx) and Scott Hanselman has an excellent list on [his blog](http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx) but if you were on a desert island and were only allowed three .NET development tools which ones would you pick?
| 4 |
8,491,591 | 12/13/2011 15:18:41 | 1,096,027 | 12/13/2011 15:11:36 | 1 | 0 | vbscript or Batch Script | I have a source directory and destination directory.
I am copying say 1000 files from Source to Destination. While copying some files are getting missed. I need a script to search which files are missed out and should save as missed.txt.
Get Input from missed.txt, copy the missed file to destination directory.
Ex: Source:
D:\Balaji\Test1\Test1\1.txt
D:\Balaji\Test1\Test1\2.txt
D:\Balaji\Test1\Test1\3.txt
D:\Balaji\Test1\Test1\4.txt
D:\Balaji\Test1\Test1\Test2\1.txt
D:\Balaji\Test1\Test1\Test2\2.txt
D:\Balaji\Test1\Test1\Test2\3.txt
Destination:
D:\Balaji\Test1\Test1\1.txt
D:\Balaji\Test1\Test1\3.txt
D:\Balaji\Test1\Test1\Test2\1.txt
D:\Balaji\Test1\Test1\Test2\3.txt
MissingFile.txt:
D:\Balaji\Test1\Test1\2.txt
D:\Balaji\Test1\Test1\4.txt
D:\Balaji\Test1\Test1\Test2\2.txt
Note: Sub-Folder also need to be created (if it doesnt exsist.)
Thanks in advance. | missing | null | null | null | null | 12/13/2011 18:03:22 | not a real question | vbscript or Batch Script
===
I have a source directory and destination directory.
I am copying say 1000 files from Source to Destination. While copying some files are getting missed. I need a script to search which files are missed out and should save as missed.txt.
Get Input from missed.txt, copy the missed file to destination directory.
Ex: Source:
D:\Balaji\Test1\Test1\1.txt
D:\Balaji\Test1\Test1\2.txt
D:\Balaji\Test1\Test1\3.txt
D:\Balaji\Test1\Test1\4.txt
D:\Balaji\Test1\Test1\Test2\1.txt
D:\Balaji\Test1\Test1\Test2\2.txt
D:\Balaji\Test1\Test1\Test2\3.txt
Destination:
D:\Balaji\Test1\Test1\1.txt
D:\Balaji\Test1\Test1\3.txt
D:\Balaji\Test1\Test1\Test2\1.txt
D:\Balaji\Test1\Test1\Test2\3.txt
MissingFile.txt:
D:\Balaji\Test1\Test1\2.txt
D:\Balaji\Test1\Test1\4.txt
D:\Balaji\Test1\Test1\Test2\2.txt
Note: Sub-Folder also need to be created (if it doesnt exsist.)
Thanks in advance. | 1 |
264,307 | 11/05/2008 03:53:37 | 12,948 | 09/16/2008 16:22:00 | 215 | 7 | Best Continuous Integration Setup for a solo developer (.NET) | I'm looking for a lightweight, easy to setup CI server that I can run on my laptop along with Visual Studio & Resharper. I'm obviously looking at all the big names like CruiseControl, TeamCity etc etc but the biggest consideration to me is ease of setup and to a lesser extent memory footprint.
| continuous-integration | .net | c# | asp.net | null | 05/16/2012 18:14:55 | not constructive | Best Continuous Integration Setup for a solo developer (.NET)
===
I'm looking for a lightweight, easy to setup CI server that I can run on my laptop along with Visual Studio & Resharper. I'm obviously looking at all the big names like CruiseControl, TeamCity etc etc but the biggest consideration to me is ease of setup and to a lesser extent memory footprint.
| 4 |
965,425 | 06/08/2009 15:22:03 | 72,958 | 03/02/2009 20:43:30 | 123 | 9 | Why don't popular programming languages use some other character to delimit strings? | Every programming language I know (Perl, Javascript, PHP, Python, ASP, ActionScript, Commodore Basic) **uses single and double quotes to delimit strings**.
This creates the ongoing situation of having to go to **great lengths** to treat quotes correctly, since the quote is extremely common in the contents of strings.
Why do programming languages not use **some other character to delimit strings**, one that is not used in normal conversation (**¤, |, § or µ** for example) so we can just get on with our lives?
Is this true, or am I overlooking something? Is there an easy way to stop using quotes for strings in a modern programming language?
print <<<END<br>
I know about **here document** syntax, but for small string manipulation it's painful and it messes up my whitespace.<br>
END; | string | delimiter | alternative | character | null | 06/09/2009 10:15:49 | not a real question | Why don't popular programming languages use some other character to delimit strings?
===
Every programming language I know (Perl, Javascript, PHP, Python, ASP, ActionScript, Commodore Basic) **uses single and double quotes to delimit strings**.
This creates the ongoing situation of having to go to **great lengths** to treat quotes correctly, since the quote is extremely common in the contents of strings.
Why do programming languages not use **some other character to delimit strings**, one that is not used in normal conversation (**¤, |, § or µ** for example) so we can just get on with our lives?
Is this true, or am I overlooking something? Is there an easy way to stop using quotes for strings in a modern programming language?
print <<<END<br>
I know about **here document** syntax, but for small string manipulation it's painful and it messes up my whitespace.<br>
END; | 1 |
1,849,840 | 12/04/2009 21:44:18 | 224,917 | 12/04/2009 16:45:45 | 6 | 1 | Best way to return search info from a database in php | So I have a form for people to fill out, which is below... Once they fill that form out, how can I query it and return the information from my database?
<form name="form" method="get" action="agents.php">
<table>
<tr>
<td width = "20%">Last Name: </td>
<td><input type="text" name="LASTNAME" size="20"/> </td>
</tr>
<tr>
<td width = "20%">City: </td>
<td><input type="text" name="CITY" size="20"/> </td>
</tr>
<tr>
<td>State: </td>
<td><select name="state" size="1">
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select><br><br></td>
</tr>
<tr>
<td>Zip: </td>
<td><input type="text" name="ZIP" size="30"/> </td>
</tr>
</table>
<br> <br>
<input type="submit" name="Submit" value="Submit">
</form> | php | mysql | search | return | null | 09/14/2011 18:12:14 | not a real question | Best way to return search info from a database in php
===
So I have a form for people to fill out, which is below... Once they fill that form out, how can I query it and return the information from my database?
<form name="form" method="get" action="agents.php">
<table>
<tr>
<td width = "20%">Last Name: </td>
<td><input type="text" name="LASTNAME" size="20"/> </td>
</tr>
<tr>
<td width = "20%">City: </td>
<td><input type="text" name="CITY" size="20"/> </td>
</tr>
<tr>
<td>State: </td>
<td><select name="state" size="1">
<option value="AK">AK</option>
<option value="AL">AL</option>
<option value="AR">AR</option>
<option value="AZ">AZ</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="IA">IA</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select><br><br></td>
</tr>
<tr>
<td>Zip: </td>
<td><input type="text" name="ZIP" size="30"/> </td>
</tr>
</table>
<br> <br>
<input type="submit" name="Submit" value="Submit">
</form> | 1 |
9,013,578 | 01/26/2012 03:23:39 | 131,456 | 07/01/2009 03:52:35 | 709 | 3 | Search engine string matching | What is the typical algorithm used by online search engines to make suggestions for misspelled words. I'm not necessarily talking about Google, but any site with a search feature, such as as Amazon.com for instance. Say I search for the work `"shoo"`; the site will come back and say `"did you mean: shoe"`.
Is this some variation of the [Levenshtein distance algorithm][1]? Perhaps if they are using some full text search framework (like lucene for instance) this is built in? Maybe fully custom?
I know the answer varies a lot, I'm just looking for an indication on how to get started with this (in an enterprise environment).
[1]: http://en.wikipedia.org/wiki/Levenshtein_distance | search | levenshtein-distance | edit-distance | null | null | null | open | Search engine string matching
===
What is the typical algorithm used by online search engines to make suggestions for misspelled words. I'm not necessarily talking about Google, but any site with a search feature, such as as Amazon.com for instance. Say I search for the work `"shoo"`; the site will come back and say `"did you mean: shoe"`.
Is this some variation of the [Levenshtein distance algorithm][1]? Perhaps if they are using some full text search framework (like lucene for instance) this is built in? Maybe fully custom?
I know the answer varies a lot, I'm just looking for an indication on how to get started with this (in an enterprise environment).
[1]: http://en.wikipedia.org/wiki/Levenshtein_distance | 0 |
8,205,999 | 11/21/2011 00:24:57 | 599,867 | 02/02/2011 10:59:13 | 1 | 0 | demonstrate a single sign-on system .log in 1 site and can have access to many site without typing username and password | i have some problems and really do not know how to solve.just need step by step help..
i have 1 site and user can register, after registration finish, he can add some sites account like "facebook ,googlemail,vkontakte.ru" there..i want to store username and password of these site..and when user next time log in using username and password of my site,the same time he can log in "facebook,googlemail,vkontakte.ru" without typing username and password of them..just he will log in my site and then he can have access to other sites which he added before..
how can i write php code for this process?
need help .. | php | null | null | null | null | null | open | demonstrate a single sign-on system .log in 1 site and can have access to many site without typing username and password
===
i have some problems and really do not know how to solve.just need step by step help..
i have 1 site and user can register, after registration finish, he can add some sites account like "facebook ,googlemail,vkontakte.ru" there..i want to store username and password of these site..and when user next time log in using username and password of my site,the same time he can log in "facebook,googlemail,vkontakte.ru" without typing username and password of them..just he will log in my site and then he can have access to other sites which he added before..
how can i write php code for this process?
need help .. | 0 |
8,264,868 | 11/25/2011 04:40:12 | 1,064,981 | 11/25/2011 04:36:46 | 1 | 0 | In need of receiving the news ticker feature | Currently all my facebook friends have the news ticker. What do I need to do to get this feature? | android | facebook | null | null | null | 11/25/2011 05:01:13 | not a real question | In need of receiving the news ticker feature
===
Currently all my facebook friends have the news ticker. What do I need to do to get this feature? | 1 |
9,544,253 | 03/03/2012 07:04:27 | 1,080,948 | 12/05/2011 05:29:38 | 107 | 1 | hide text box when combo box is reset | I am reseting a combo box based on another combo box. I have 2 combo boxes and when i am selecting `01` then `second combo` is enabled and when i am selecting an option from `2nd combo` then a `text box` appears, and when i am selecting 'please select' from `first combo` then `2nd combo` is auto reset(disabled), but why that text box is not disappearing?
when an option except first option is selected from second combo, i am populating a text box like :
$(function() {
//This hides all initial textboxes
$('label').hide();
$('#secondcombo').change(function() {
//This saves some time by caching the jquery value
var val = $(this).val();
//this hides any boxes that the previous selection might have left open
$('label').hide();
//This just opens the ones we want based off the selection
switch (val){
case 'option1':
case 'option4':
case 'other':
$('#label1').show();
break;
}
});
//I'm not really sure why these are here
$("input")
.focus(function () {
$(this).next("span").fadeIn(500);
})
.blur(function () {
$(this).next("span").fadeOut(1000);
});
});
html
<select id='firstcombo'>
<option value="">please select</option>
<option value="01">01</option>
<option value="02">02</option>
</select>
<select id='secondcombo' disabled="true">
<option value="">please select</option>
<option value="_">- select -</option>
<option value="option1">data</option>
<option value="option2">data</option>
</select>
<label id="label1" for="option1">
<input type="text" id="option1" />
</label>
| javascript | jquery | html | combo | null | null | open | hide text box when combo box is reset
===
I am reseting a combo box based on another combo box. I have 2 combo boxes and when i am selecting `01` then `second combo` is enabled and when i am selecting an option from `2nd combo` then a `text box` appears, and when i am selecting 'please select' from `first combo` then `2nd combo` is auto reset(disabled), but why that text box is not disappearing?
when an option except first option is selected from second combo, i am populating a text box like :
$(function() {
//This hides all initial textboxes
$('label').hide();
$('#secondcombo').change(function() {
//This saves some time by caching the jquery value
var val = $(this).val();
//this hides any boxes that the previous selection might have left open
$('label').hide();
//This just opens the ones we want based off the selection
switch (val){
case 'option1':
case 'option4':
case 'other':
$('#label1').show();
break;
}
});
//I'm not really sure why these are here
$("input")
.focus(function () {
$(this).next("span").fadeIn(500);
})
.blur(function () {
$(this).next("span").fadeOut(1000);
});
});
html
<select id='firstcombo'>
<option value="">please select</option>
<option value="01">01</option>
<option value="02">02</option>
</select>
<select id='secondcombo' disabled="true">
<option value="">please select</option>
<option value="_">- select -</option>
<option value="option1">data</option>
<option value="option2">data</option>
</select>
<label id="label1" for="option1">
<input type="text" id="option1" />
</label>
| 0 |
8,179,302 | 11/18/2011 07:51:49 | 1,053,340 | 11/18/2011 07:48:01 | 1 | 0 | IP Address Spoofing in HttpWebRequest | I am sending a HttpWebRequest to a url to post some data,I want to spoof my IP address.
i dont need the response back, i just want to post data,
How can i spoof my ip. i am using c# .net 4.0
(i do not want to use any proxy server) | c# | httpwebrequest | ip | spoofing | null | 11/19/2011 05:08:30 | not a real question | IP Address Spoofing in HttpWebRequest
===
I am sending a HttpWebRequest to a url to post some data,I want to spoof my IP address.
i dont need the response back, i just want to post data,
How can i spoof my ip. i am using c# .net 4.0
(i do not want to use any proxy server) | 1 |
924,121 | 05/29/2009 02:16:26 | 98,487 | 04/30/2009 11:55:49 | 304 | 44 | Is anyone using Kanban? | Is anyone using Kanban (or scrumban) for the agile management practices? What is your experience with Kanban? How does it work in large complex environments with dependencies on waterfall projects? | kanban | agile | lean | null | null | 03/07/2012 17:52:15 | not constructive | Is anyone using Kanban?
===
Is anyone using Kanban (or scrumban) for the agile management practices? What is your experience with Kanban? How does it work in large complex environments with dependencies on waterfall projects? | 4 |
7,694,213 | 10/08/2011 01:27:47 | 724,408 | 04/25/2011 21:30:51 | 162 | 2 | How to get the flv file from a youtube page | How would you get the flv file from A youtube page for example:www.youtube.com/watch?v=T8YCSJpF4g4... Any ideas? | python | youtube | null | null | null | 10/08/2011 13:26:25 | off topic | How to get the flv file from a youtube page
===
How would you get the flv file from A youtube page for example:www.youtube.com/watch?v=T8YCSJpF4g4... Any ideas? | 2 |
4,954,879 | 02/10/2011 08:33:02 | 456,778 | 09/24/2010 00:07:31 | 8 | 0 | Autoscroll problen...... | 1.Create a cocoa application (not document-based)
2.Create a new class "StretchView"(subclass NSView)
3.Open the Interface builder and drag a "Scroll view" to the main window
4.Choose the "Scroll view" and set the class "StretchView" (in class identity window)
The size of the contentview is 500*500 and the size of the strechview is also 500*500
(horizontal Scroll is enabled).
Then I start to draw some numbers(1,2,3,4......) horizontally one after the other.
When the number is out of ranger(the x pos is larger than 500) I increase the width
of the StretchView. (Everything works fine up till this point)
Then I tried to make the horizontal scroller to automatically scroll to the end so
that everytime I increase the width of the StretchView the last number coulde be
seen.
Here's the code:
//The timer is called every sec
-(void)myTimerAction:(NSTimer *) timer
{
NSLog(@"myTimerAction");
//......
int i = _myArray.count;
NSRect rect = [self frame];
int width = rect.size.width;
//The width between two number is 10
//When the x pos of current num is bigger then the scroll's width
if((i * 10) > width) {
//reset the width
width = i * 10;
[self setFrameSize:CGSizeMake(width, rect.size.height)];
//How to make it autoscroll???
//...............................
}
//......
[self setNeedsDisplay:YES];
}
| autoscroll | null | null | null | null | null | open | Autoscroll problen......
===
1.Create a cocoa application (not document-based)
2.Create a new class "StretchView"(subclass NSView)
3.Open the Interface builder and drag a "Scroll view" to the main window
4.Choose the "Scroll view" and set the class "StretchView" (in class identity window)
The size of the contentview is 500*500 and the size of the strechview is also 500*500
(horizontal Scroll is enabled).
Then I start to draw some numbers(1,2,3,4......) horizontally one after the other.
When the number is out of ranger(the x pos is larger than 500) I increase the width
of the StretchView. (Everything works fine up till this point)
Then I tried to make the horizontal scroller to automatically scroll to the end so
that everytime I increase the width of the StretchView the last number coulde be
seen.
Here's the code:
//The timer is called every sec
-(void)myTimerAction:(NSTimer *) timer
{
NSLog(@"myTimerAction");
//......
int i = _myArray.count;
NSRect rect = [self frame];
int width = rect.size.width;
//The width between two number is 10
//When the x pos of current num is bigger then the scroll's width
if((i * 10) > width) {
//reset the width
width = i * 10;
[self setFrameSize:CGSizeMake(width, rect.size.height)];
//How to make it autoscroll???
//...............................
}
//......
[self setNeedsDisplay:YES];
}
| 0 |
4,176,784 | 11/14/2010 08:43:43 | 196,760 | 10/26/2009 16:35:21 | 938 | 56 | Lost git history after reorganizing project folder | I made a commit about a month ago that involved me creating new folder and sub-folders and moving my source code files in between them. I just was looking through my history for the first time since then and realized git has 'lost' history since the original files were deleted and then re-added, I suppose.
After reading a few questions ( http://stackoverflow.com/questions/1430749/getting-git-to-acknowledge-previously-moved-files, http://stackoverflow.com/questions/433111/how-to-make-git-mark-a-deleted-and-a-new-file-as-a-file-move), I'm simply more lost than when I started. It sounds like from those answers that I won't be able to fix this at all? I'd really appreciate any help here. | git | version-control | null | null | null | null | open | Lost git history after reorganizing project folder
===
I made a commit about a month ago that involved me creating new folder and sub-folders and moving my source code files in between them. I just was looking through my history for the first time since then and realized git has 'lost' history since the original files were deleted and then re-added, I suppose.
After reading a few questions ( http://stackoverflow.com/questions/1430749/getting-git-to-acknowledge-previously-moved-files, http://stackoverflow.com/questions/433111/how-to-make-git-mark-a-deleted-and-a-new-file-as-a-file-move), I'm simply more lost than when I started. It sounds like from those answers that I won't be able to fix this at all? I'd really appreciate any help here. | 0 |
1,473,277 | 09/24/2009 18:10:55 | 178,620 | 09/24/2009 18:03:24 | 1 | 0 | Is there a library out there to analyze VB.Net code complexity from my C# code? | Given VB.Net code in a string, is there a library (or a command line tool) out there that could calculate Cyclomatic Complextiy and LOC?
This has to be done within my C# code.
Thanks. | code-metrics | vb.net | null | null | null | null | open | Is there a library out there to analyze VB.Net code complexity from my C# code?
===
Given VB.Net code in a string, is there a library (or a command line tool) out there that could calculate Cyclomatic Complextiy and LOC?
This has to be done within my C# code.
Thanks. | 0 |
9,438,354 | 02/24/2012 21:32:15 | 747,750 | 05/10/2011 23:00:00 | 78 | 0 | SSRS:How to create report loke pivot table in ssrs 2008 r2 | I need to create reoprt in ssrs like the pivot table in MS Excel.![enter image description here][1]
[1]: http://i.stack.imgur.com/RqUKx.png
Above the screen shot of my requirement,I am very much confused this time .
Please provide some guidlines ,resources and links where i find the needfull help. | sql-server-2008 | reporting-services | null | null | null | 02/26/2012 06:10:18 | not a real question | SSRS:How to create report loke pivot table in ssrs 2008 r2
===
I need to create reoprt in ssrs like the pivot table in MS Excel.![enter image description here][1]
[1]: http://i.stack.imgur.com/RqUKx.png
Above the screen shot of my requirement,I am very much confused this time .
Please provide some guidlines ,resources and links where i find the needfull help. | 1 |
8,276,463 | 11/26/2011 05:17:13 | 327,528 | 04/28/2010 06:13:59 | 963 | 6 | SQL Server Reporting Services with a single discrete application? | Is there any point in using SSRS to host your reports if you are only going to have one application using your SQL Server?
I would have thought SSRS makes sense only if you are going host reports that are going to be consumed by several separate applications. | sql-server | ssrs-reports | null | null | null | null | open | SQL Server Reporting Services with a single discrete application?
===
Is there any point in using SSRS to host your reports if you are only going to have one application using your SQL Server?
I would have thought SSRS makes sense only if you are going host reports that are going to be consumed by several separate applications. | 0 |
10,472,042 | 05/06/2012 16:10:18 | 1,008,185 | 10/22/2011 05:09:29 | 58 | 3 | Scan student ID card and use data obtained to pull up information for use. | So this is a project idea that I had to help the university i'm at. We do a freshman engineering event where 800 freshman have to check in in 30-60 min. It is highly chaotic and inefficiently done. If we can scan their ID and pull up the info we need to tell them then we can make this a lot easier.
So my idea was that we could have 2 -4 laptops set up and let them scan their ID. This ID number would be saved in an excel file. It would then also take the student ID and cross reference it with another excel file to let the student know who their peer mentor is and where they will be meeting them during the event. At the end of the event we would combine all the excel files of just the student ID's from the 2-4 laptops. We would use this file to go thru the list of student to see who gets credit for attendance.
So some initial steps I have taken: I signed up at Intuit and another company that offer a free credit card scanner that plugs into the audio port of a cell phone although I will be using it on a laptop. I have looked into capturing the sound from the microphone jack on most laptops and it seems that the best route is to go with a pre wrote package as doing my own would take more time. I also here that doing this in C/C++ would be better than java. I also see that there is a library for accessing MS doc to give correct formatting and such.
I was wondering what peoples general opinion on a project like this would be? What programming language would you use? What route might one want to take at different stages? What questions or issues do you see that I have not seen, mentioned or considered.
The main steps for the program as I see it would be:
-Access the microphone port and receive the sound/data from it.
-find/interpret the sound/data needed form this received stream.
-write data to excel file.... or just a file to be read in later.
-cross reference data with another excel file to bring in needed data to tell student.
-reset program to so this can be done repeatedly.
-set up way to manually input student ID for those who forget their card or card that
cannot be read.
Any ideas welcome.
| java | c++ | c | excel | credit-card | 05/06/2012 17:13:23 | too localized | Scan student ID card and use data obtained to pull up information for use.
===
So this is a project idea that I had to help the university i'm at. We do a freshman engineering event where 800 freshman have to check in in 30-60 min. It is highly chaotic and inefficiently done. If we can scan their ID and pull up the info we need to tell them then we can make this a lot easier.
So my idea was that we could have 2 -4 laptops set up and let them scan their ID. This ID number would be saved in an excel file. It would then also take the student ID and cross reference it with another excel file to let the student know who their peer mentor is and where they will be meeting them during the event. At the end of the event we would combine all the excel files of just the student ID's from the 2-4 laptops. We would use this file to go thru the list of student to see who gets credit for attendance.
So some initial steps I have taken: I signed up at Intuit and another company that offer a free credit card scanner that plugs into the audio port of a cell phone although I will be using it on a laptop. I have looked into capturing the sound from the microphone jack on most laptops and it seems that the best route is to go with a pre wrote package as doing my own would take more time. I also here that doing this in C/C++ would be better than java. I also see that there is a library for accessing MS doc to give correct formatting and such.
I was wondering what peoples general opinion on a project like this would be? What programming language would you use? What route might one want to take at different stages? What questions or issues do you see that I have not seen, mentioned or considered.
The main steps for the program as I see it would be:
-Access the microphone port and receive the sound/data from it.
-find/interpret the sound/data needed form this received stream.
-write data to excel file.... or just a file to be read in later.
-cross reference data with another excel file to bring in needed data to tell student.
-reset program to so this can be done repeatedly.
-set up way to manually input student ID for those who forget their card or card that
cannot be read.
Any ideas welcome.
| 3 |
9,319,696 | 02/16/2012 21:57:02 | 920,912 | 08/31/2011 03:57:05 | 61 | 5 | Server does not support secure connection | some days before this code perfectly works for me but now it shows Exception
MailMessage mail = new MailMessage();
mail.To.Add("pramuk97@gmail.com");
mail.From = new MailAddress("pramuk97@gmail.com");
mail.To.Add("pramuk97@hotmail.com");
mail.Subject = "from bhsbiet souvenir 2012";
mail.Body = TextBox5.Text;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential("pramuk97@gmail.com", "pwd");
smtp.EnableSsl = true;
smtp.Send(mail);
And the exception is
Server does not support secure connections.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Server does not support secure connections.
Source Error:
Line 78: smtp.Credentials = new System.Net.NetworkCredential("pramuk97@gmail.com", "mukund1375");Line 79: smtp.EnableSsl = true;Line 80: smtp.Send(mail); Line 81: TextBox5.Text = "message sent";Line 82: TextBox5.ReadOnly = true;
Source File: E:\bhsbiet\bhsbiet\home.aspx.cs Line: 80
Stack Trace:
[SmtpException: Server does not support secure connections.] System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +1223423 System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +222 System.Net.Mail.SmtpClient.GetConnection() +50 System.Net.Mail.SmtpClient.Send(MailMessage message) +1772 bhsbiet.home.buttonx_click(Object sender, EventArgs e) in E:\bhsbiet\bhsbiet\home.aspx.cs:80 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 | asp.net | webforms | gmail | null | null | null | open | Server does not support secure connection
===
some days before this code perfectly works for me but now it shows Exception
MailMessage mail = new MailMessage();
mail.To.Add("pramuk97@gmail.com");
mail.From = new MailAddress("pramuk97@gmail.com");
mail.To.Add("pramuk97@hotmail.com");
mail.Subject = "from bhsbiet souvenir 2012";
mail.Body = TextBox5.Text;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential("pramuk97@gmail.com", "pwd");
smtp.EnableSsl = true;
smtp.Send(mail);
And the exception is
Server does not support secure connections.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Server does not support secure connections.
Source Error:
Line 78: smtp.Credentials = new System.Net.NetworkCredential("pramuk97@gmail.com", "mukund1375");Line 79: smtp.EnableSsl = true;Line 80: smtp.Send(mail); Line 81: TextBox5.Text = "message sent";Line 82: TextBox5.ReadOnly = true;
Source File: E:\bhsbiet\bhsbiet\home.aspx.cs Line: 80
Stack Trace:
[SmtpException: Server does not support secure connections.] System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +1223423 System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +222 System.Net.Mail.SmtpClient.GetConnection() +50 System.Net.Mail.SmtpClient.Send(MailMessage message) +1772 bhsbiet.home.buttonx_click(Object sender, EventArgs e) in E:\bhsbiet\bhsbiet\home.aspx.cs:80 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 | 0 |
10,569,004 | 05/13/2012 03:01:28 | 1,389,667 | 05/11/2012 14:21:20 | 1 | 0 | jquery or javascript | i m using <div1>and <div2> onmouseover it is show and hide perfectly but <div2> disappear i want to do some task on <div2> that's why i need it to be appear before i input something on it. pl z reply as soon as i m new to j query.
enter code here <script>function hide(){
1. $("#div11")hide(0); $("#div22")hide(0); $("#div33")hide(0);
}
function show(num){
2. //var n=document.getElementById("div11");
//document.getElementByID(some ID)style.visibility = 'hidden';
if(num==1){ //$("#div11").attr("visibility", "visible");
$("#div11")show(1000);
//$(this)show(); //$('#my Div:visible')animate({left: '+=200px'}, 'slow');
//n.style.visibility="visible";
//n.style.visibility="visible";
} else if(num==2){ $("#div22")show(1000); } else
if(num==3){
$("#div33")show(1000);
} }
</script> | javascript | jquery | css | css3 | javascript-events | 05/13/2012 03:17:39 | not a real question | jquery or javascript
===
i m using <div1>and <div2> onmouseover it is show and hide perfectly but <div2> disappear i want to do some task on <div2> that's why i need it to be appear before i input something on it. pl z reply as soon as i m new to j query.
enter code here <script>function hide(){
1. $("#div11")hide(0); $("#div22")hide(0); $("#div33")hide(0);
}
function show(num){
2. //var n=document.getElementById("div11");
//document.getElementByID(some ID)style.visibility = 'hidden';
if(num==1){ //$("#div11").attr("visibility", "visible");
$("#div11")show(1000);
//$(this)show(); //$('#my Div:visible')animate({left: '+=200px'}, 'slow');
//n.style.visibility="visible";
//n.style.visibility="visible";
} else if(num==2){ $("#div22")show(1000); } else
if(num==3){
$("#div33")show(1000);
} }
</script> | 1 |
5,985,840 | 05/12/2011 23:49:16 | 744,467 | 05/09/2011 03:18:46 | 1 | 0 | document.write and PHP | This is what I am trying to achieve:
Basically let's say "example.com/test"
has document.write('hi123') - the text in the brackets keep changing.
So I wan't to display whatever is in the brackets on a php file for example "hi.php"
Help would be really appreciated. | php | document | write | null | null | 05/13/2011 07:03:05 | not a real question | document.write and PHP
===
This is what I am trying to achieve:
Basically let's say "example.com/test"
has document.write('hi123') - the text in the brackets keep changing.
So I wan't to display whatever is in the brackets on a php file for example "hi.php"
Help would be really appreciated. | 1 |
485,120 | 01/27/2009 20:38:55 | 40,516 | 11/25/2008 05:13:52 | 3,013 | 76 | Will emacs make me a better programmer? | Steve Yegge wrote [a comment on his blog][1]:
> All of the greatest engineers in the
> world use Emacs. The world-changer
> types. Not the great gal in the cube
> next to you. Not Fred, the amazing guy
> down the hall. I'm talking about the
> greatest software developers of our
> profession, the ones who changed the
> face of the industry. The James
> Goslings, the Donald Knuths, the Paul
> Grahams, the Jamie Zawinskis, the
> Eric Bensons. Real engineers use
> Emacs. You have to be way smart to use
> it well, and it makes you incredibly
> powerful if you can master it. Go look
> over Paul Nordstrom's shoulder while
> he works sometime, if you don't
> believe me. It's a real eye-opener for
> someone who's used Visual Blub
> .NET-like IDEs their whole career.
>
> Emacs is the 100-year editor.
The last time I used a text editor for writing code was back when I was still writing HTML in Notepad about 1000 years ago. Since then, I've been more or less IDE dependent, having used Visual Studio, NetBeans, IntelliJ, Borland/Codegear Studio, and Eclipse for my entire career.
For what its worth, I *have* tried emacs, and my experience was a frustrating one because of its complete lack of out-of-the-box discoverable features. (Apparently there's an emacs command for discovering other emacs commands, which I couldn't find by the way -- its like living your own cruel Zen-like joke.) I tried to make myself like the program for a good month, but eventually decided that I'd rather have drag-and-drop GUI designers, Intellisense, and interactive debugging instead.
Its hard to seperate fact from fanboyism, so I'm not willing to take Yegge's comments at face value just yet.
**Is there a measurable difference in skill, productivity, or programming enjoyment between people who depend on IDEs and those who don't, or is it all just fanboyism?**
[1]: http://steve.yegge.googlepages.com/tour-de-babel | emacs | vi | text-editor | null | null | 02/16/2012 03:17:52 | not constructive | Will emacs make me a better programmer?
===
Steve Yegge wrote [a comment on his blog][1]:
> All of the greatest engineers in the
> world use Emacs. The world-changer
> types. Not the great gal in the cube
> next to you. Not Fred, the amazing guy
> down the hall. I'm talking about the
> greatest software developers of our
> profession, the ones who changed the
> face of the industry. The James
> Goslings, the Donald Knuths, the Paul
> Grahams, the Jamie Zawinskis, the
> Eric Bensons. Real engineers use
> Emacs. You have to be way smart to use
> it well, and it makes you incredibly
> powerful if you can master it. Go look
> over Paul Nordstrom's shoulder while
> he works sometime, if you don't
> believe me. It's a real eye-opener for
> someone who's used Visual Blub
> .NET-like IDEs their whole career.
>
> Emacs is the 100-year editor.
The last time I used a text editor for writing code was back when I was still writing HTML in Notepad about 1000 years ago. Since then, I've been more or less IDE dependent, having used Visual Studio, NetBeans, IntelliJ, Borland/Codegear Studio, and Eclipse for my entire career.
For what its worth, I *have* tried emacs, and my experience was a frustrating one because of its complete lack of out-of-the-box discoverable features. (Apparently there's an emacs command for discovering other emacs commands, which I couldn't find by the way -- its like living your own cruel Zen-like joke.) I tried to make myself like the program for a good month, but eventually decided that I'd rather have drag-and-drop GUI designers, Intellisense, and interactive debugging instead.
Its hard to seperate fact from fanboyism, so I'm not willing to take Yegge's comments at face value just yet.
**Is there a measurable difference in skill, productivity, or programming enjoyment between people who depend on IDEs and those who don't, or is it all just fanboyism?**
[1]: http://steve.yegge.googlepages.com/tour-de-babel | 4 |
8,741,835 | 01/05/2012 11:36:36 | 1,131,341 | 01/05/2012 04:16:03 | 1 | 1 | Convert a program working on mobile phone to run on PC | How can a program running in mobile phone(written with Python) be converted to run on PC? | python | null | null | null | null | 01/06/2012 05:40:57 | not a real question | Convert a program working on mobile phone to run on PC
===
How can a program running in mobile phone(written with Python) be converted to run on PC? | 1 |
10,528,016 | 05/10/2012 05:30:55 | 562,422 | 01/04/2011 10:49:29 | 251 | 12 | Error in using group by in firebird 1 | I am trying to run the following query but it is not working!
select extract(month from flight_date_time) mnt from T_PEREXOD where extract( year from flight_date_time)='2012'
group by mnt
order by mnt
I tried also subquerying
select mnt from (select extract(month from flight_date_time) AS mnt from T_PEREXOD)
group by mnt
order by mnt
but it pops out an error
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 18.
select.
Is that a problem of Firebird version 1 ??
How about making groupping work without any views, procedures, computed fields and so on ? 'cause I don't like to alter that database !
| sql | firebird | null | null | null | null | open | Error in using group by in firebird 1
===
I am trying to run the following query but it is not working!
select extract(month from flight_date_time) mnt from T_PEREXOD where extract( year from flight_date_time)='2012'
group by mnt
order by mnt
I tried also subquerying
select mnt from (select extract(month from flight_date_time) AS mnt from T_PEREXOD)
group by mnt
order by mnt
but it pops out an error
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 18.
select.
Is that a problem of Firebird version 1 ??
How about making groupping work without any views, procedures, computed fields and so on ? 'cause I don't like to alter that database !
| 0 |
781,528 | 04/23/2009 12:47:42 | 77,409 | 03/12/2009 20:40:01 | 366 | 19 | How does Java's Dynamic Proxy actually work? | I understand how to use Dynamic Proxies in Java but what I don't understand is how the VM actually creates a dynamic proxy. Does it generate bytecode and load it? Or something else? Thanks. | java | null | null | null | null | null | open | How does Java's Dynamic Proxy actually work?
===
I understand how to use Dynamic Proxies in Java but what I don't understand is how the VM actually creates a dynamic proxy. Does it generate bytecode and load it? Or something else? Thanks. | 0 |
895,085 | 05/21/2009 20:51:59 | 55,860 | 01/16/2009 14:58:53 | 75 | 6 | how i can send complete request array in mail() with key and value | i have large form that i want to send in mail using php, although i can send it with request['name'] i have to write it more than 50 times in message variable, what i want to do how i can add the keys and values to message variable with some filteration that i want to omit submit request variable | php | null | null | null | null | null | open | how i can send complete request array in mail() with key and value
===
i have large form that i want to send in mail using php, although i can send it with request['name'] i have to write it more than 50 times in message variable, what i want to do how i can add the keys and values to message variable with some filteration that i want to omit submit request variable | 0 |
16,199 | 08/19/2008 13:57:33 | 1,491,425 | 08/13/2008 13:49:51 | 1 | 0 | Web App - Dashboard Type GUI - Interface | I'm looking to create a dashboard type gui for a web application. I'm looking for the user to be able to drag and drop different elements (probably either image buttons, anchor tags, or maybe just divs) to different (defined) places and be able to save their setup (in a cookie or on the server). I'm working with c# in the .Net 2.0 framework. I've tried using mootools but their recent update has left their drag/drop capabilities un-useful for me. I'm looking for a bit of direction because I know there is something out there that is just what I'm looking for so I wont have to build from scratch.
Thanks. | c# | asp.net | javascript | gui | null | 02/04/2012 14:53:57 | not constructive | Web App - Dashboard Type GUI - Interface
===
I'm looking to create a dashboard type gui for a web application. I'm looking for the user to be able to drag and drop different elements (probably either image buttons, anchor tags, or maybe just divs) to different (defined) places and be able to save their setup (in a cookie or on the server). I'm working with c# in the .Net 2.0 framework. I've tried using mootools but their recent update has left their drag/drop capabilities un-useful for me. I'm looking for a bit of direction because I know there is something out there that is just what I'm looking for so I wont have to build from scratch.
Thanks. | 4 |
5,351,715 | 03/18/2011 12:04:03 | 338,547 | 05/11/2010 17:30:35 | 1,169 | 107 | Compile DLL from python code | Hi does anyone know if you can compile Python code into a Windows DLL file? How would you go about doing this? | python | dll | compilation | null | null | null | open | Compile DLL from python code
===
Hi does anyone know if you can compile Python code into a Windows DLL file? How would you go about doing this? | 0 |
9,677,715 | 03/13/2012 02:45:19 | 1,265,455 | 03/13/2012 02:10:44 | 1 | 0 | how to get all individual http responses using cURL | I am attempting to use cURL to retrieve data published in a flash file, the flash file being embedded in a web page.
The post request for the data is made by the .swf file itself. I cannot replicate the post request using cURL because I would need to pass a key which is unavailable to me. (i.e. the flash file makes a post request to /data.php. I can't cURL example.com/data.php without a key which I don't have.) (PS: no the key is not hardcoded in .swf ;) )
I thought I could cURL the webpage and then access all the individual http responses used to build the webpage (including the http response of the post request), however it seems I can't.
Is there a curl_setopt parameter that I can use to catch all individual http responses, or is using cURL hopeless for what I want to achieve ?
Many thanks | php | curl | null | null | null | 03/14/2012 16:29:21 | off topic | how to get all individual http responses using cURL
===
I am attempting to use cURL to retrieve data published in a flash file, the flash file being embedded in a web page.
The post request for the data is made by the .swf file itself. I cannot replicate the post request using cURL because I would need to pass a key which is unavailable to me. (i.e. the flash file makes a post request to /data.php. I can't cURL example.com/data.php without a key which I don't have.) (PS: no the key is not hardcoded in .swf ;) )
I thought I could cURL the webpage and then access all the individual http responses used to build the webpage (including the http response of the post request), however it seems I can't.
Is there a curl_setopt parameter that I can use to catch all individual http responses, or is using cURL hopeless for what I want to achieve ?
Many thanks | 2 |
5,580,418 | 04/07/2011 11:38:16 | 49,739 | 12/29/2008 05:24:05 | 1,465 | 45 | Xcode4 source control problem | I have a project under SVN, which was last used with previous version of Xcode (Xcode 3.x). Now when i try to Open the same project with Xcode 4, it doesn't show the .xcdatamodeld file under source-control.
If i modify the .xcdatamodeld file (e.g. add a new model version), i don't get any source-control symbols (e.g. "A", "U"). After applying the changes, when i go to File > Source Control > Commit, i see the .xcdatamodeld file on the left pane, but the checkbox is disabled, and the file has a "?" and "A" next to it.
How can i fix this? | svn | core-data | repository | xcode4 | null | 11/09/2011 02:00:33 | too localized | Xcode4 source control problem
===
I have a project under SVN, which was last used with previous version of Xcode (Xcode 3.x). Now when i try to Open the same project with Xcode 4, it doesn't show the .xcdatamodeld file under source-control.
If i modify the .xcdatamodeld file (e.g. add a new model version), i don't get any source-control symbols (e.g. "A", "U"). After applying the changes, when i go to File > Source Control > Commit, i see the .xcdatamodeld file on the left pane, but the checkbox is disabled, and the file has a "?" and "A" next to it.
How can i fix this? | 3 |
8,646,279 | 12/27/2011 15:25:42 | 819,151 | 06/28/2011 12:32:36 | 949 | 84 | How to Customized Expandable List View? | I want to customize expandable list view such a way that when user clicks on any group view of that expandable list view then a dialog will be shown but list view will not expand.After selecting some thing from the dialog when user click on `ok` of the dialog the list view will expand and will show data on the base on what selected from dialog.
Can anybody give me any idea how can I implement it? | android | expandablelistview | null | null | null | null | open | How to Customized Expandable List View?
===
I want to customize expandable list view such a way that when user clicks on any group view of that expandable list view then a dialog will be shown but list view will not expand.After selecting some thing from the dialog when user click on `ok` of the dialog the list view will expand and will show data on the base on what selected from dialog.
Can anybody give me any idea how can I implement it? | 0 |
1,289,163 | 08/17/2009 16:58:39 | 90,332 | 04/13/2009 18:16:00 | 219 | 15 | Read in html table to java | I need to pull data from an html page using Java code. The java part is required.
The page i am trying to pull info from is http://www.weather.gov/data/obhistory/KMCI.html
.
I need to create a list of hashmaps...or some kind of data object that i can reference in later code.
This is all i have so far:
URL weatherDataKC = new URL("http://www.weather.gov/data/obhistory/KMCI.html");
InputStream is = weatherDataKC.openStream();
int cnt = 0;
StringBuffer buffer = new StringBuffer();
while ((cnt = is.read()) != -1){
buffer.append((char)cnt);
}
System.out.print(buffer.toString());
Any suggestions where to start?
| java | html | null | null | null | null | open | Read in html table to java
===
I need to pull data from an html page using Java code. The java part is required.
The page i am trying to pull info from is http://www.weather.gov/data/obhistory/KMCI.html
.
I need to create a list of hashmaps...or some kind of data object that i can reference in later code.
This is all i have so far:
URL weatherDataKC = new URL("http://www.weather.gov/data/obhistory/KMCI.html");
InputStream is = weatherDataKC.openStream();
int cnt = 0;
StringBuffer buffer = new StringBuffer();
while ((cnt = is.read()) != -1){
buffer.append((char)cnt);
}
System.out.print(buffer.toString());
Any suggestions where to start?
| 0 |
6,916,600 | 08/02/2011 18:13:47 | 873,664 | 08/02/2011 00:32:35 | 6 | 0 | Cakephp Xml to Array to Database | Hi folks this is the first time using cakephps XML functions.
I have set up this model:
<?php
class Importer extends AppModel {
var $name = 'Importer';
var $useTable = false;
function import_deals(){
// import XML class
App::import('Xml');
// your XML file's location
$file = "../webroot/files/datafeed_114532.xml";
// now parse it
$parsed_xml =& new XML($file);
$parsed_xml = Set::reverse($parsed_xml); // this is what i call magic
// see the returned array
debug($parsed_xml);
}
}
Controller:
class ImporterController extends AppController {
var $name = 'Importer';
var $uses = array('Importer', 'City', 'Deal', 'Partner');
function import_deals($parsed_xml) {
$this->loadModel('Importer');
$deals = $this->Importer->find('all');
$this->set('deals', $deals);
}
}
The view i am not sure about cause i basically want it to put the xml data into the database. The XML array looks like:
Array
(
[MerchantProductFeed] => Array
(
[Merchant] => Array
(
[0] => Array
(
[id] => 2891
[Prod] => Array
(
[0] => Array
(
[id] => 175029851
[web_offer] => yes
[Text] => Array
(
[name] => London South: 60% Off Takeaways From Just-Eat
[desc] => £6 for £15 Worth of Takeaways From Over 1000 London Eateries with Just-Eat
[promo] => 60 %
)
[Uri] => Array
(
[awTrack] => http://www.awin1.com/pclick.php?p=175029851&a=114532&m=2891
[mImage] => http://static.groupon.co.uk/44/30/1311759403044.jpg
)
[Price] => Array
(
[rrp] => 15.00
)
[Cat] => Array
(
[awCatId] => 100
[awCat] => Bodycare & Fitness
[mCat] => Deals
)
[brand] => Array
(
)
[valFrom] => 2011-07-29
[valTo] => 2011-10-29
)
[1] => Array
(
[id] => 175030161
[web_offer] => yes
[Text] => Array
(
[name] => Essex: Up to 70% Off Treatment and Cut and Blowdry OR Half Head Highlights or Colour
[desc] => Cut, Blow Dry and Paul Mitchell Treatment (£18) Or Add Half Head of Highlights or Colour (£34) at Cube (Up to 70% Saving)
[promo] => 70 %
)
[Uri] => Array
(
[awTrack] => http://www.awin1.com/pclick.php?p=175030161&a=114532&m=2891
[mImage] => http://static.groupon.co.uk/53/51/1311615285153.jpg
)
[Price] => Array
(
[rrp] => 60.00
)
[Cat] => Array
(
[awCatId] => 100
[awCat] => Bodycare & Fitness
[mCat] => Deals
)
[brand] => Array
(
)
[valFrom] => 2011-07-29
[valTo] => 2011-10-28
)
....
Any help would be appreciated, even if you can point me in right direction :) Thanks Guys
Dave
| xml | arrays | cakephp | multidimensional-array | cakephp-1.3 | null | open | Cakephp Xml to Array to Database
===
Hi folks this is the first time using cakephps XML functions.
I have set up this model:
<?php
class Importer extends AppModel {
var $name = 'Importer';
var $useTable = false;
function import_deals(){
// import XML class
App::import('Xml');
// your XML file's location
$file = "../webroot/files/datafeed_114532.xml";
// now parse it
$parsed_xml =& new XML($file);
$parsed_xml = Set::reverse($parsed_xml); // this is what i call magic
// see the returned array
debug($parsed_xml);
}
}
Controller:
class ImporterController extends AppController {
var $name = 'Importer';
var $uses = array('Importer', 'City', 'Deal', 'Partner');
function import_deals($parsed_xml) {
$this->loadModel('Importer');
$deals = $this->Importer->find('all');
$this->set('deals', $deals);
}
}
The view i am not sure about cause i basically want it to put the xml data into the database. The XML array looks like:
Array
(
[MerchantProductFeed] => Array
(
[Merchant] => Array
(
[0] => Array
(
[id] => 2891
[Prod] => Array
(
[0] => Array
(
[id] => 175029851
[web_offer] => yes
[Text] => Array
(
[name] => London South: 60% Off Takeaways From Just-Eat
[desc] => £6 for £15 Worth of Takeaways From Over 1000 London Eateries with Just-Eat
[promo] => 60 %
)
[Uri] => Array
(
[awTrack] => http://www.awin1.com/pclick.php?p=175029851&a=114532&m=2891
[mImage] => http://static.groupon.co.uk/44/30/1311759403044.jpg
)
[Price] => Array
(
[rrp] => 15.00
)
[Cat] => Array
(
[awCatId] => 100
[awCat] => Bodycare & Fitness
[mCat] => Deals
)
[brand] => Array
(
)
[valFrom] => 2011-07-29
[valTo] => 2011-10-29
)
[1] => Array
(
[id] => 175030161
[web_offer] => yes
[Text] => Array
(
[name] => Essex: Up to 70% Off Treatment and Cut and Blowdry OR Half Head Highlights or Colour
[desc] => Cut, Blow Dry and Paul Mitchell Treatment (£18) Or Add Half Head of Highlights or Colour (£34) at Cube (Up to 70% Saving)
[promo] => 70 %
)
[Uri] => Array
(
[awTrack] => http://www.awin1.com/pclick.php?p=175030161&a=114532&m=2891
[mImage] => http://static.groupon.co.uk/53/51/1311615285153.jpg
)
[Price] => Array
(
[rrp] => 60.00
)
[Cat] => Array
(
[awCatId] => 100
[awCat] => Bodycare & Fitness
[mCat] => Deals
)
[brand] => Array
(
)
[valFrom] => 2011-07-29
[valTo] => 2011-10-28
)
....
Any help would be appreciated, even if you can point me in right direction :) Thanks Guys
Dave
| 0 |
6,251,061 | 06/06/2011 11:02:34 | 426,002 | 08/20/2010 05:18:53 | 73 | 1 | Value range mapping | In my user interface I have a slider which gives values at range 0 .. 100.
I have variable foo, which I want to have values between 0.2 ... 5.0 so that when the slider value is 50, variable foo gets value 1.0 and when the slider value is 0 foo gets value 0.2 and when slider value is 100 foo gets value 5.0. And all the between numbers I want to work accordingly so that slider value 25 gives foo value 0.6 and slider value 75 gives foo value 2.5. etc.
I want it to work like this as I am using it as a factor. When the slider is 100, the factor is 5 and makes the target value 5 times higher the original value and when the slider is 0 the factor is 0.2 and thus makes the target value 5 times lower than the original value. And when the slider is 50, it just multiplies original value with 1.0 making no changes to the value.
I guess there's some simple mathematical way to do this? | value | range | null | null | null | 06/06/2011 12:53:11 | not a real question | Value range mapping
===
In my user interface I have a slider which gives values at range 0 .. 100.
I have variable foo, which I want to have values between 0.2 ... 5.0 so that when the slider value is 50, variable foo gets value 1.0 and when the slider value is 0 foo gets value 0.2 and when slider value is 100 foo gets value 5.0. And all the between numbers I want to work accordingly so that slider value 25 gives foo value 0.6 and slider value 75 gives foo value 2.5. etc.
I want it to work like this as I am using it as a factor. When the slider is 100, the factor is 5 and makes the target value 5 times higher the original value and when the slider is 0 the factor is 0.2 and thus makes the target value 5 times lower than the original value. And when the slider is 50, it just multiplies original value with 1.0 making no changes to the value.
I guess there's some simple mathematical way to do this? | 1 |
4,905,146 | 02/05/2011 04:27:18 | 538,778 | 12/11/2010 09:46:24 | 454 | 61 | Optimal login check php | Hi all i was just wondering that whether i could go for advices from the SO community about an optimal login php based solution.
Please share some tips which you believe can optimize code and prevent mysql injection like things, best password storing solutions etc .
please don't close this question in a hurry !
i want atleast some replies which can craft a good login system.
| php | mysql | optimization | login | query-optimization | 02/05/2011 05:14:14 | not a real question | Optimal login check php
===
Hi all i was just wondering that whether i could go for advices from the SO community about an optimal login php based solution.
Please share some tips which you believe can optimize code and prevent mysql injection like things, best password storing solutions etc .
please don't close this question in a hurry !
i want atleast some replies which can craft a good login system.
| 1 |
6,247,757 | 06/06/2011 04:29:01 | 214,419 | 11/19/2009 08:38:12 | 456 | 35 | sql stored procedure vs logic code (with ADO/Linq) | Back to the school day's. I learned how to use `function` for writing a program. also learn when we want to use sql (or better to say, writing **Business-App**), we must use `ADO` to connect to sql, and do specified operation.
So after long years `linq` released for whom use `Dotnet` and `VS`. Many said *`linq faster and quicker than ADO`*.
In Current Day's, Someone say :**`Sql-Stored procedure is faster and quicker than ADO, Even he sql-SP say faster than Linq-to-sql `** (he mean's, using SP to fetch data from sql is better than best function with best performance, which using loop, linq and etc)
**Question**
For example:
> If we want **fetch data from sql, and this data must be calculate from two or more tables**, which way is better?
1. Use *`Sql-SP`* to doing this.
2. Use *`Linq/ADO`* within function (`high performance function`).
>So **better** Refer to :
1. Program **Developing**
2. Program **Debugging**
3. **Fetch Speed** for data
>Additional info:
I don't want use **sql-SP** for simple insert or update even delete.
Any Advice?
Thanks | .net | sql | linq-to-sql | ado | discussion | 04/05/2012 15:43:46 | not constructive | sql stored procedure vs logic code (with ADO/Linq)
===
Back to the school day's. I learned how to use `function` for writing a program. also learn when we want to use sql (or better to say, writing **Business-App**), we must use `ADO` to connect to sql, and do specified operation.
So after long years `linq` released for whom use `Dotnet` and `VS`. Many said *`linq faster and quicker than ADO`*.
In Current Day's, Someone say :**`Sql-Stored procedure is faster and quicker than ADO, Even he sql-SP say faster than Linq-to-sql `** (he mean's, using SP to fetch data from sql is better than best function with best performance, which using loop, linq and etc)
**Question**
For example:
> If we want **fetch data from sql, and this data must be calculate from two or more tables**, which way is better?
1. Use *`Sql-SP`* to doing this.
2. Use *`Linq/ADO`* within function (`high performance function`).
>So **better** Refer to :
1. Program **Developing**
2. Program **Debugging**
3. **Fetch Speed** for data
>Additional info:
I don't want use **sql-SP** for simple insert or update even delete.
Any Advice?
Thanks | 4 |
3,374,876 | 07/30/2010 19:51:17 | 40,411 | 11/24/2008 21:45:13 | 2,734 | 149 | Robert Martin fans: Which book to read first, esp for C++ | My understanding of object-oriented design is very limited. My main CS teacher was an old-school C programmer with little/no C++ knowledge, so I only know the basics (polymorphism, inheritance, operator overloading, etc).
Since I've been working with a peer, I've come to discover there are some useful rules to learn, and most of the rules seem to be things Robert Martin talks about.
The difficulty is, **which book is the best I-don't-know-anything-coming-in introduction to Object Oriented Design that he has written, with an eye toward C++?**
I've found three books that seem to fit the bill.
- [Designing Object Oriented C++ Applications using the Booch Method][1]
- Pros: It seems to be aimed at precisely what I want to learn (the two below seem to be more broad). **I'm leaning toward this one.**
- Cons: It's 15 years old! Maybe too old. His ideas might have changed a lot since then.
- [Agile Software Development, Principles, Patterns, and Practices][2]
- Pros: It's newer, and it covers Agile topics (not opposed to that)
- Cons: It's 6 years old! His ideas might have changed a lot since then.
- [Agile Principles, Patterns, and Practices in C#][3]
- Pros: It's the newest.
- Cons: It seems to be a rehash of the above book, with a focus on C#. It would probably make more sense to buy the above book instead.
NB: I already own books on refactoring, design patterns. I'm looking mainly for sources on design from the ground-up.
[1]: http://www.amazon.com/exec/obidos/ASIN/0132038374/
[2]: http://www.amazon.com/ASIN/dp/0135974445/
[3]: http://www.amazon.com/Agile-Principles-Patterns-Practices-C/dp/0131857258/ | books | null | null | null | null | 08/02/2010 01:30:35 | not constructive | Robert Martin fans: Which book to read first, esp for C++
===
My understanding of object-oriented design is very limited. My main CS teacher was an old-school C programmer with little/no C++ knowledge, so I only know the basics (polymorphism, inheritance, operator overloading, etc).
Since I've been working with a peer, I've come to discover there are some useful rules to learn, and most of the rules seem to be things Robert Martin talks about.
The difficulty is, **which book is the best I-don't-know-anything-coming-in introduction to Object Oriented Design that he has written, with an eye toward C++?**
I've found three books that seem to fit the bill.
- [Designing Object Oriented C++ Applications using the Booch Method][1]
- Pros: It seems to be aimed at precisely what I want to learn (the two below seem to be more broad). **I'm leaning toward this one.**
- Cons: It's 15 years old! Maybe too old. His ideas might have changed a lot since then.
- [Agile Software Development, Principles, Patterns, and Practices][2]
- Pros: It's newer, and it covers Agile topics (not opposed to that)
- Cons: It's 6 years old! His ideas might have changed a lot since then.
- [Agile Principles, Patterns, and Practices in C#][3]
- Pros: It's the newest.
- Cons: It seems to be a rehash of the above book, with a focus on C#. It would probably make more sense to buy the above book instead.
NB: I already own books on refactoring, design patterns. I'm looking mainly for sources on design from the ground-up.
[1]: http://www.amazon.com/exec/obidos/ASIN/0132038374/
[2]: http://www.amazon.com/ASIN/dp/0135974445/
[3]: http://www.amazon.com/Agile-Principles-Patterns-Practices-C/dp/0131857258/ | 4 |
5,878,108 | 05/04/2011 03:18:34 | 569,292 | 01/10/2011 02:27:45 | 125 | 9 | Hidden features of PHP timeout? | What are some hidden tricks of PHP in putting timeout on the page and redirect it to another page? | php | timeout | null | null | null | 05/04/2011 03:34:00 | not a real question | Hidden features of PHP timeout?
===
What are some hidden tricks of PHP in putting timeout on the page and redirect it to another page? | 1 |
2,907,104 | 05/25/2010 17:49:54 | 350,166 | 05/25/2010 17:45:31 | 1 | 0 | Openx Ad Delivery Issues | **My System**
· Apache 2.2.9
· PHP 5.2.9
· MySQL client version: 5.1.28-rc
· Openx v2.8.5
I am using the javascript single page call to serve my ads. I am running an in house CMS where everything is processed through a template.php file.
**My Issue**
The success of an ad being served seems to be very hit and miss. The placement or type of the ad does not seem to matter. For some reason, the loading of the ads is very spotty. Each page serves an average of 3 ads. Sometimes none show up, sometimes 2, sometimes 1. There does not seem to be any consistency in the problem occurring. The problem seems to have worsened since I updated to the most recent version and started using Single Page Call.
I have checked the source. All javascript script is in place, but the ad content is not generated under the script where it should be. The space where the ad should be is just empty.
No javascript errors are generated.
Any help will be greatly appreciated.
| php | openx | banner | ad | delivery | null | open | Openx Ad Delivery Issues
===
**My System**
· Apache 2.2.9
· PHP 5.2.9
· MySQL client version: 5.1.28-rc
· Openx v2.8.5
I am using the javascript single page call to serve my ads. I am running an in house CMS where everything is processed through a template.php file.
**My Issue**
The success of an ad being served seems to be very hit and miss. The placement or type of the ad does not seem to matter. For some reason, the loading of the ads is very spotty. Each page serves an average of 3 ads. Sometimes none show up, sometimes 2, sometimes 1. There does not seem to be any consistency in the problem occurring. The problem seems to have worsened since I updated to the most recent version and started using Single Page Call.
I have checked the source. All javascript script is in place, but the ad content is not generated under the script where it should be. The space where the ad should be is just empty.
No javascript errors are generated.
Any help will be greatly appreciated.
| 0 |
9,187,359 | 02/08/2012 03:12:12 | 1,196,171 | 02/08/2012 02:38:04 | 1 | 0 | JAVA multithreading novice inquiry | Good day, i am a newbie with the multithreading arena and would like to ask for assistance regarding the scenario below:
<br><br>
1) Main java class would query from the db list of files (Collection 1) to be ftp'd to another server. <br><br>
2) Main class would call another class (Class 2) that would perform different processes depending on the returned data of (Collection 1). <br><br>
3) Class 2 should perform three process per record(item) of Collection 1 (Sub Class 2). (ftp put, ftp get(Return File), Update the db based on the data of Return File, and send an email to the recipient of the record(item)). <br><br>
4) End of Sub Class 2 process. <br><br>
5) End of Class 2 process. <br><br>
6) Main class still executes until new Collection is retrieved. <br><br>
<br><br>
Given the main scenario above, the maximum record(item) that can be processed is only 10, until all record(item) is processed.
<br><br>
Questions: <br><br>
a) Should the Main class be considered a thread or a runnable since it would only be executed once and let it running for a whole day?<br><br>
b) What would be the best multi-threading approach that can be done in item 2? (ExecutorService or Thread or Runnable) <br><br>
c) And of Sub Class 2, should the underlying classes (ftp, DB-Update and Email-sender) be defined as runnable? Where the DB-update process is dependent on the FTP get return file. <br><br>
d) For the sub class DB-Updater, can it also be implemented as a multi-threaded? (eg. if the records to be updated is around 2000). <br><br>
e) How can i make the process of sub class 2 become a single entity per item being processed?<br> And signal the calling class (Class 2) when the process is already finished. <br><br>
Hope somebody could point me to the right direction regarding my inquiry above.<br>
Thank you very much.
| java | multithreading | runnable | executorservice | null | 02/09/2012 17:08:10 | too localized | JAVA multithreading novice inquiry
===
Good day, i am a newbie with the multithreading arena and would like to ask for assistance regarding the scenario below:
<br><br>
1) Main java class would query from the db list of files (Collection 1) to be ftp'd to another server. <br><br>
2) Main class would call another class (Class 2) that would perform different processes depending on the returned data of (Collection 1). <br><br>
3) Class 2 should perform three process per record(item) of Collection 1 (Sub Class 2). (ftp put, ftp get(Return File), Update the db based on the data of Return File, and send an email to the recipient of the record(item)). <br><br>
4) End of Sub Class 2 process. <br><br>
5) End of Class 2 process. <br><br>
6) Main class still executes until new Collection is retrieved. <br><br>
<br><br>
Given the main scenario above, the maximum record(item) that can be processed is only 10, until all record(item) is processed.
<br><br>
Questions: <br><br>
a) Should the Main class be considered a thread or a runnable since it would only be executed once and let it running for a whole day?<br><br>
b) What would be the best multi-threading approach that can be done in item 2? (ExecutorService or Thread or Runnable) <br><br>
c) And of Sub Class 2, should the underlying classes (ftp, DB-Update and Email-sender) be defined as runnable? Where the DB-update process is dependent on the FTP get return file. <br><br>
d) For the sub class DB-Updater, can it also be implemented as a multi-threaded? (eg. if the records to be updated is around 2000). <br><br>
e) How can i make the process of sub class 2 become a single entity per item being processed?<br> And signal the calling class (Class 2) when the process is already finished. <br><br>
Hope somebody could point me to the right direction regarding my inquiry above.<br>
Thank you very much.
| 3 |
1,305,257 | 08/20/2009 10:31:58 | 131,201 | 06/30/2009 16:52:25 | 89 | 11 | Using AttachConsole, user must hit enter to get regular command line. | I have a progaram that can be ran both as a winform, or from command line. If it is invoked from a command line I call AttachConsole(-1) to attach to parent console.
However, after my program ends, the user must hit enter to get back the standard command line ("c:\>"). is there a way to avoid that need?
Thanks. | c# | console | null | null | null | null | open | Using AttachConsole, user must hit enter to get regular command line.
===
I have a progaram that can be ran both as a winform, or from command line. If it is invoked from a command line I call AttachConsole(-1) to attach to parent console.
However, after my program ends, the user must hit enter to get back the standard command line ("c:\>"). is there a way to avoid that need?
Thanks. | 0 |
476,099 | 01/24/2009 14:51:13 | 26,521 | 10/09/2008 14:54:41 | 129 | 6 | QueryObject Include Entity Framework | I have three tables: Scenarios, Components and Blocks. Blocks has a foreign key to ComponentId and Components has a foreign key to Scenarios.
Blocks also has a foreign key (TreeStructureId) to another table TreeStructures.
Now, why does this work:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("TreeStructures").Include("Components.Scenarios");
It loads the TreeStructures, Components and Scenarios.
This however doesn't work:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("Components.Scenarios").Include("TreeStructures");
This loads the Components and Scenarios but doesn't load the TreeStructures...
Seems very strange to me... Why is this?
thx, Lieven Cardoen
| entity | framework | objectquery | include | null | 09/15/2011 10:29:56 | too localized | QueryObject Include Entity Framework
===
I have three tables: Scenarios, Components and Blocks. Blocks has a foreign key to ComponentId and Components has a foreign key to Scenarios.
Blocks also has a foreign key (TreeStructureId) to another table TreeStructures.
Now, why does this work:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("TreeStructures").Include("Components.Scenarios");
It loads the TreeStructures, Components and Scenarios.
This however doesn't work:
ObjectQuery<Blocks> blocks = edumatic3Entities.Blocks.Include("Components.Scenarios").Include("TreeStructures");
This loads the Components and Scenarios but doesn't load the TreeStructures...
Seems very strange to me... Why is this?
thx, Lieven Cardoen
| 3 |
11,478,189 | 07/13/2012 20:52:45 | 763,585 | 05/21/2011 01:44:04 | 663 | 54 | Code in main isn't being executed unless the GUI is launched (dual purposing winform) | I have a winform application which we're trying to run within our automation system without the GUI being launched. Unfortunately, when I invoke it from the command line none of the logic is being executed. Below is the `Main()`
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
if (!ValidateCommandLineArgs())
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestResultForm());
}
else
{
HeadlessExecution();
return;
}
}
`ValidateCommandLineArgs` simply checks to see if `cmdline=true` is passed to the application, if not the GUI is launched normally. When I debug in VS2010 (setting the command line args in the projects properties file) everything works as I would expect it to. However, when I invoke it from the command line (outsite of VS with the same arg) `HeadlessExecution()` is ignored. It is certainly reading the arg in and going into the else statement (the GUI isn't launched and it is if you don't pass anything or pass `cmdline=false`), after that I don't know what happens but none of the core logic called by `HeadlessExecution()` is being executed. | c# | .net | winforms | null | null | 07/16/2012 17:49:46 | not a real question | Code in main isn't being executed unless the GUI is launched (dual purposing winform)
===
I have a winform application which we're trying to run within our automation system without the GUI being launched. Unfortunately, when I invoke it from the command line none of the logic is being executed. Below is the `Main()`
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
if (!ValidateCommandLineArgs())
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestResultForm());
}
else
{
HeadlessExecution();
return;
}
}
`ValidateCommandLineArgs` simply checks to see if `cmdline=true` is passed to the application, if not the GUI is launched normally. When I debug in VS2010 (setting the command line args in the projects properties file) everything works as I would expect it to. However, when I invoke it from the command line (outsite of VS with the same arg) `HeadlessExecution()` is ignored. It is certainly reading the arg in and going into the else statement (the GUI isn't launched and it is if you don't pass anything or pass `cmdline=false`), after that I don't know what happens but none of the core logic called by `HeadlessExecution()` is being executed. | 1 |
9,848,372 | 03/24/2012 01:29:58 | 1,289,403 | 03/24/2012 01:17:48 | 1 | 0 | Button, and A link both need to be clicked twice | Cheers in advance for looking!
i have a code that adds a pre-determined HTML snippet into a pre-determined <div> element already set out on my page.
The HTML creates specific links to fire a function - these created links fire the correct functions fine.
The button that creates the snippets works fine. The whole 2 functions are great for what they do.
HOWEVER
The first instance of firing either function will for example fire an alert() if i added one, but make no on screen changes. The next click is perfect.
If i switch from clicking the button, to clicking one of the links created, this again needs to be clicked twice for on-screen changes. Further calls of the function work perfectly.
If i click the button again, needs 2 clicks first time again...
???!
Regards,
Phil
function taddcolumn(){
if (tracker <= 25){
outel = "o" + tracker;
columnload = '<div><a href="javascript:choosedata(' + tracker + ')">Choose Data</a> <br><a href="javascript:remcol(' + tracker + ')">Remove</a>';
document.getElementById(outel).innerHTML = columnload;
tracker++;
}
else{
alert ('Maximum capacity 25 columns reached.');
}
}
function remcol(colin){
b=colin+1;
for (a = colin; a <= tracker; a++)
{
colwork = "o" + a;
colnxt = "o" + b;
columnload = '<div><a href="javascript:choosedata(' + a + ')">Choose Data</a><br><a href="javascript:remcol(' + a + ')">Remove</a>';
if (colin == 25){
document.getElementById(colwork).innerHTML=="";
}
if (colin <= 24){
document.getElementById(colwork).innerHTML=document.getElementById(colnxt).innerHTML;
}
if (document.getElementById(colwork).innerHTML= '<div><a href="javascript:choosedata(' + b + ')">Choose Data</a><br><a href="javascript:remcol(' + b + ')">Remove</a>'){
document.getElementById(colwork).innerHTML = columnload;
}
b++;
}
lstcol = "o" + tracker;
document.getElementById(lstcol).innerHTML="";
tracker--;
if (tracker == 0){
tracker=1;
}
}
| javascript-events | click | twice | null | null | 03/26/2012 13:23:43 | too localized | Button, and A link both need to be clicked twice
===
Cheers in advance for looking!
i have a code that adds a pre-determined HTML snippet into a pre-determined <div> element already set out on my page.
The HTML creates specific links to fire a function - these created links fire the correct functions fine.
The button that creates the snippets works fine. The whole 2 functions are great for what they do.
HOWEVER
The first instance of firing either function will for example fire an alert() if i added one, but make no on screen changes. The next click is perfect.
If i switch from clicking the button, to clicking one of the links created, this again needs to be clicked twice for on-screen changes. Further calls of the function work perfectly.
If i click the button again, needs 2 clicks first time again...
???!
Regards,
Phil
function taddcolumn(){
if (tracker <= 25){
outel = "o" + tracker;
columnload = '<div><a href="javascript:choosedata(' + tracker + ')">Choose Data</a> <br><a href="javascript:remcol(' + tracker + ')">Remove</a>';
document.getElementById(outel).innerHTML = columnload;
tracker++;
}
else{
alert ('Maximum capacity 25 columns reached.');
}
}
function remcol(colin){
b=colin+1;
for (a = colin; a <= tracker; a++)
{
colwork = "o" + a;
colnxt = "o" + b;
columnload = '<div><a href="javascript:choosedata(' + a + ')">Choose Data</a><br><a href="javascript:remcol(' + a + ')">Remove</a>';
if (colin == 25){
document.getElementById(colwork).innerHTML=="";
}
if (colin <= 24){
document.getElementById(colwork).innerHTML=document.getElementById(colnxt).innerHTML;
}
if (document.getElementById(colwork).innerHTML= '<div><a href="javascript:choosedata(' + b + ')">Choose Data</a><br><a href="javascript:remcol(' + b + ')">Remove</a>'){
document.getElementById(colwork).innerHTML = columnload;
}
b++;
}
lstcol = "o" + tracker;
document.getElementById(lstcol).innerHTML="";
tracker--;
if (tracker == 0){
tracker=1;
}
}
| 3 |
9,937,485 | 03/30/2012 05:35:04 | 878,334 | 08/04/2011 10:02:50 | 31 | 0 | log4j line number not showing? | I have discovered some issues in my program.<br/>
I was using log4j for logging,<br/>
however, inside the log file, all line number become "?".<br/>
The conversation pattern is as follow:<br/>
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} %5p %c: %L - %m%n
<br/>
Could anyone help me on this issue?
Thanks! | java | log4j | null | null | null | null | open | log4j line number not showing?
===
I have discovered some issues in my program.<br/>
I was using log4j for logging,<br/>
however, inside the log file, all line number become "?".<br/>
The conversation pattern is as follow:<br/>
log4j.appender.file.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} %5p %c: %L - %m%n
<br/>
Could anyone help me on this issue?
Thanks! | 0 |
6,329,114 | 06/13/2011 10:13:34 | 30,394 | 10/22/2008 14:48:19 | 846 | 26 | How to read a values from new section in web.config | I have got below sample code in web.config and I am using .NET 2.0.
<configuration>
<configSections>
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<secureAppSettings>
<add key="userName" value="s752549"/>
<add key="userPassword" value="Delhi@007"/>
</secureAppSettings>
</configuration>
My new section "secureAppSettings" is decrypted and is having two keys inside it.
Now in my C#2.0 code I want to access these key something like below:
string userName = System.Configuration.ConfigurationManager.secureAppSettings["userName"];
string userPassword = System.Configuration.ConfigurationManager.secureAppSettings["userPassword"];
But it is returning NULL for these fields.
Please suggest, How can I get the values.
| c# | .net | web-config | null | null | null | open | How to read a values from new section in web.config
===
I have got below sample code in web.config and I am using .NET 2.0.
<configuration>
<configSections>
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<secureAppSettings>
<add key="userName" value="s752549"/>
<add key="userPassword" value="Delhi@007"/>
</secureAppSettings>
</configuration>
My new section "secureAppSettings" is decrypted and is having two keys inside it.
Now in my C#2.0 code I want to access these key something like below:
string userName = System.Configuration.ConfigurationManager.secureAppSettings["userName"];
string userPassword = System.Configuration.ConfigurationManager.secureAppSettings["userPassword"];
But it is returning NULL for these fields.
Please suggest, How can I get the values.
| 0 |
7,225,248 | 08/29/2011 01:24:09 | 818,049 | 06/27/2011 20:00:30 | 32 | 0 | Rails 3 nested routes question | I need some help with routes. Here are my current routes.
resources :users, :only => [:index, :show, :create, :destroy] do
resources :links, :only => [:create, :destroy], :shallow => true, :on => :member
end
and when I run rake routes I get this
root /(.:format) {:controller=>"users", :action=>"index"}
user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"links"}
link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"links"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
but I am trying to get my routes be this, which is what I had but I can't remember how I got it to work. :(
root /(.:format) {:controller=>"users", :action=>"index"}
user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"users/links"}
link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"users/links"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
What am I doing wrong? What am I missing? | ruby-on-rails-3 | routes | null | null | null | null | open | Rails 3 nested routes question
===
I need some help with routes. Here are my current routes.
resources :users, :only => [:index, :show, :create, :destroy] do
resources :links, :only => [:create, :destroy], :shallow => true, :on => :member
end
and when I run rake routes I get this
root /(.:format) {:controller=>"users", :action=>"index"}
user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"links"}
link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"links"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
but I am trying to get my routes be this, which is what I had but I can't remember how I got it to work. :(
root /(.:format) {:controller=>"users", :action=>"index"}
user_links POST /users/:user_id/links(.:format) {:action=>"create", :controller=>"users/links"}
link DELETE /links/:id(.:format) {:action=>"destroy", :controller=>"users/links"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
What am I doing wrong? What am I missing? | 0 |
11,691,998 | 07/27/2012 16:34:59 | 1,071,500 | 11/29/2011 14:35:04 | 1 | 0 | static css not show in express jade | i have app.coffee :
pp.configure ->
publicDir = "#{__dirname}/public"
app.set "views", viewsDir
app.set "view engine", "jade"
app.use(stylus.middleware debug: true, src: viewsDir, dest: publicDir, compile: compileMethod)
compileMethod = (str, path) ->
stylus(str)
.set('filename', path)
.set('compress', true)
app.get "/pag",(req,res) ->
res.render "pag",
title: "test",
in /stylesheet/pag.jade:
...
link(rel='stylesheet', href='public/pag/css/bootstrap.min.css')
...
when im go to "myserver:9090/pag" the page not load the bootstrap.min.css.
i get the following error:
source :(my folder of proyects)/public/pag/css/bootstrap.min.styl
dest : (my folder of proyects)/public/pag/css/bootstrap.min.css
read : (my folder of proyects)/public/pag/css/bootstrap.min.styl
Error: ENOENT, open '(my folder)/public/pag/css/bootstrap.min.styl'
Where am i wrong? i am probably missing something.. any ideas?
| css | node.js | coffeescript | express | jade | null | open | static css not show in express jade
===
i have app.coffee :
pp.configure ->
publicDir = "#{__dirname}/public"
app.set "views", viewsDir
app.set "view engine", "jade"
app.use(stylus.middleware debug: true, src: viewsDir, dest: publicDir, compile: compileMethod)
compileMethod = (str, path) ->
stylus(str)
.set('filename', path)
.set('compress', true)
app.get "/pag",(req,res) ->
res.render "pag",
title: "test",
in /stylesheet/pag.jade:
...
link(rel='stylesheet', href='public/pag/css/bootstrap.min.css')
...
when im go to "myserver:9090/pag" the page not load the bootstrap.min.css.
i get the following error:
source :(my folder of proyects)/public/pag/css/bootstrap.min.styl
dest : (my folder of proyects)/public/pag/css/bootstrap.min.css
read : (my folder of proyects)/public/pag/css/bootstrap.min.styl
Error: ENOENT, open '(my folder)/public/pag/css/bootstrap.min.styl'
Where am i wrong? i am probably missing something.. any ideas?
| 0 |
3,313,447 | 07/22/2010 21:02:26 | 282,848 | 02/27/2010 21:42:36 | 3,592 | 125 | Delphi Assembly Function Returning a Long String | I am trying to learn inline assembly programming in Delphi, and to this end I have found <a href="http://www.delphi3000.com/articles/article_3766.asp">this article</a> highly helpful.
Now I wish to write an assembly function returning a long string, specifically an `AnsiString` (for simplicity). I have written
function myfunc: AnsiString;
asm
// eax = @result
mov edx, 3
mov ecx, 1252
call System.@LStrSetLength
mov [eax + 0], ord('A')
mov [eax + 1], ord('B')
mov [eax + 2], ord('C')
end;
Explanation:
A function returning a string has an invisible `var result: AnsiString` (in this case) parameter, so, at the beginning of the function, `eax` should hold the address of the resulting string. I then set `edx` and `ecx` to 3 and 1252, respectively, and then call `System._LStrSetLength`. In effect, I do
_LStrSetLength(@result, 3, 1252)
where 3 is the new length of the string (in characters = bytes) and 1252 is the standard <a href="http://msdn.microsoft.com/en-us/library/dd317756(VS.85).aspx">windows-1252</a> codepage.
Then, knowing that `eax` is <a href="http://docwiki.embarcadero.com/RADStudio/en/Internal_Data_Formats#Long_String_Types">the address of the first character of the string</a>, I simply set the string to "ABC". But it does not work - it gives me nonsense data or EAccessViolation. What is the problem? | delphi | function | assembly | string | null | null | open | Delphi Assembly Function Returning a Long String
===
I am trying to learn inline assembly programming in Delphi, and to this end I have found <a href="http://www.delphi3000.com/articles/article_3766.asp">this article</a> highly helpful.
Now I wish to write an assembly function returning a long string, specifically an `AnsiString` (for simplicity). I have written
function myfunc: AnsiString;
asm
// eax = @result
mov edx, 3
mov ecx, 1252
call System.@LStrSetLength
mov [eax + 0], ord('A')
mov [eax + 1], ord('B')
mov [eax + 2], ord('C')
end;
Explanation:
A function returning a string has an invisible `var result: AnsiString` (in this case) parameter, so, at the beginning of the function, `eax` should hold the address of the resulting string. I then set `edx` and `ecx` to 3 and 1252, respectively, and then call `System._LStrSetLength`. In effect, I do
_LStrSetLength(@result, 3, 1252)
where 3 is the new length of the string (in characters = bytes) and 1252 is the standard <a href="http://msdn.microsoft.com/en-us/library/dd317756(VS.85).aspx">windows-1252</a> codepage.
Then, knowing that `eax` is <a href="http://docwiki.embarcadero.com/RADStudio/en/Internal_Data_Formats#Long_String_Types">the address of the first character of the string</a>, I simply set the string to "ABC". But it does not work - it gives me nonsense data or EAccessViolation. What is the problem? | 0 |
5,013,018 | 02/16/2011 06:01:24 | 618,993 | 02/16/2011 03:48:07 | 1 | 0 | my pages cannot connect to database | what are the most suitable codes to connect pages to database? what are the codes to insert data to database? and what are the codes to publish data inserted in database? | php | mysql | null | null | null | 02/16/2011 12:29:38 | not a real question | my pages cannot connect to database
===
what are the most suitable codes to connect pages to database? what are the codes to insert data to database? and what are the codes to publish data inserted in database? | 1 |
11,728,970 | 07/30/2012 20:21:10 | 1,526,573 | 07/15/2012 06:55:10 | 56 | 0 | Web Semantic Differences | What is the difference between the following code examples? I'd appreciate a few examples of where and how to use them. I know there must be some difference...
`<b>` and `<strong>`
`<i>` and `<em>`
`<center>` + <b>/<strong> and `<h1>`-`<h6>`
I am also wondering if there is an "alternative" for `<u>`... | html | html5 | null | null | null | 07/30/2012 20:37:08 | off topic | Web Semantic Differences
===
What is the difference between the following code examples? I'd appreciate a few examples of where and how to use them. I know there must be some difference...
`<b>` and `<strong>`
`<i>` and `<em>`
`<center>` + <b>/<strong> and `<h1>`-`<h6>`
I am also wondering if there is an "alternative" for `<u>`... | 2 |
11,729,874 | 07/30/2012 21:26:32 | 1,406,177 | 05/20/2012 11:34:24 | 3 | 0 | Implement driver conecpt in Java | I am working on a project that connects to different devices of the same type. I have implemented a few classes for single devices, but now developed a generic interface that all "drivers" should implement.
My Problem is now: Later, the user should use my program via GUI and should be able to "load" the drivers offered from me. But how do these drivers look like? A .jar with a class that implements the driver interface? A xml file that describes roughly what to do? | java | driver | null | null | null | 07/31/2012 23:13:54 | not a real question | Implement driver conecpt in Java
===
I am working on a project that connects to different devices of the same type. I have implemented a few classes for single devices, but now developed a generic interface that all "drivers" should implement.
My Problem is now: Later, the user should use my program via GUI and should be able to "load" the drivers offered from me. But how do these drivers look like? A .jar with a class that implements the driver interface? A xml file that describes roughly what to do? | 1 |
4,715,031 | 01/17/2011 15:46:40 | 564,559 | 01/05/2011 20:52:27 | 1 | 1 | Creating cross browser drop downs from Uls instead of <select> | Hello I am looking for a tutorial on creating consistent cross browser drop downs, other form elements seem pretty easy to style. I am wondering if I can get away with somehow styling the select tag from css or do I have to rewrite all the selects to unordered lists | html | css | forms | browser | null | null | open | Creating cross browser drop downs from Uls instead of <select>
===
Hello I am looking for a tutorial on creating consistent cross browser drop downs, other form elements seem pretty easy to style. I am wondering if I can get away with somehow styling the select tag from css or do I have to rewrite all the selects to unordered lists | 0 |
5,325,316 | 03/16/2011 12:32:16 | 433,844 | 08/28/2010 18:04:04 | 3 | 0 | How to start programming? | I read a lot of books about C/C++ in Linux and write simple programs. Now I want to try myself with some project. What you can recommend to? (Sorry for my bad English) | c | linux | null | null | null | 03/16/2011 12:39:13 | not a real question | How to start programming?
===
I read a lot of books about C/C++ in Linux and write simple programs. Now I want to try myself with some project. What you can recommend to? (Sorry for my bad English) | 1 |
7,797,298 | 10/17/2011 17:27:09 | 999,651 | 10/17/2011 17:09:58 | 1 | 0 | receive wrong bytes values over socket stream in java | I try to read a file as a byte array and send it through network over socket connection,
I printed the values of the bytes after reading from file(before sending it) and printed the values of bytes after receiving it from socket ... and it was different! it is received in wrong values I don't know why
sample bytes before sending:
21,
0,
52,
0
sample bytes after receiving:
-8,
-1,
-4,
-1
I sent the bytes using write(byte[] b); of OutputStream class
and received bytes using read(byte[] b, int off, int len); of InputStream class.
can anyone help me?
| java | sockets | stream | bytearray | byte | 10/18/2011 08:51:10 | too localized | receive wrong bytes values over socket stream in java
===
I try to read a file as a byte array and send it through network over socket connection,
I printed the values of the bytes after reading from file(before sending it) and printed the values of bytes after receiving it from socket ... and it was different! it is received in wrong values I don't know why
sample bytes before sending:
21,
0,
52,
0
sample bytes after receiving:
-8,
-1,
-4,
-1
I sent the bytes using write(byte[] b); of OutputStream class
and received bytes using read(byte[] b, int off, int len); of InputStream class.
can anyone help me?
| 3 |
10,388,124 | 04/30/2012 17:46:13 | 1,024,914 | 11/02/2011 03:53:46 | 18 | 1 | How much is a good ammount of database use? (would this be too much?) | So I am planing on re-writing the template for my site and this this time, I want it to be much more then just a static page, with just a few dynamic areas. While doing that i have noticed that a lot of things I'm planning to do require the database to be read form/written to a lot. For example, I want to track my logged in users and want to display when they are active, inactive, and even what page they are viewing. Now my plan is to have the php set what page they are viewing into the database and to use js with a ajax call to update on their activity. I want to know if this is too much querying for the database and if there is a much better way of doing this. - I am questioning because this would run on every pageload and can probably be a massive load on the database. | php | database | load | null | null | 04/30/2012 17:58:19 | not constructive | How much is a good ammount of database use? (would this be too much?)
===
So I am planing on re-writing the template for my site and this this time, I want it to be much more then just a static page, with just a few dynamic areas. While doing that i have noticed that a lot of things I'm planning to do require the database to be read form/written to a lot. For example, I want to track my logged in users and want to display when they are active, inactive, and even what page they are viewing. Now my plan is to have the php set what page they are viewing into the database and to use js with a ajax call to update on their activity. I want to know if this is too much querying for the database and if there is a much better way of doing this. - I am questioning because this would run on every pageload and can probably be a massive load on the database. | 4 |
10,693,276 | 05/21/2012 22:02:44 | 1,223,845 | 02/21/2012 16:31:40 | 5 | 0 | Saving Latitude and Longitude values to a MySQL Database iOS | I've set my code up so that the user inputs all of the location details (address, city, county, country and postcode) and then on the click of a button the lat and lon values are fed into two text boxes... My problem now is that the code that was previously working to save the data to the database is not working.
Here's my code...
php
<?php
$username = "username";
$database = "database";
$password = "password";
mysql_connect(localhost, $username, $password);
@mysql_select_db($database) or die("unable to find database");
$name = $_GET["name"];
$address = $_GET["address"];
$city = $_GET["city"];
$county = $_GET["county"];
$country = $_GET["country"];
$postcode = $_GET["postcode"];
$date = $_GET["date"];
$time = $_GET["time"];
$latitude = $_GET["latitude"];
$longitude = $_GET["longitude"];
$query = "INSERT INTO map VALUES ('', '$name', '$address', '$city', '$county', '$country', '$postcode', '$date', '$time, '$latitude', '$longitude'')";
mysql_query($query) or die(mysql_error("error"));
mysql_close();
?>
AddSessionViewController.h
#import <UIKit/UIKit.h>
#define kpostURL @"http://myurl.com/map.php"
#define kname @"name"
#define kaddress @"address"
#define kcity @"city"
#define kcounty @"county"
#define kcountry @"country"
#define kpostcode @"postcode"
#define kdate @"date"
#define ktime @"time"
#define klatitude @"latitude"
#define klongitude @"longitude"
@interface addSessionViewController : UIViewController {
UIScrollView *scrollView_;
BOOL keyboardVisible_;
IBOutlet UITextField *nameText;
IBOutlet UITextField *addressText;
IBOutlet UITextField *cityText;
IBOutlet UITextField *countyText;
IBOutlet UITextField *countryText;
IBOutlet UITextField *postcodeText;
IBOutlet UITextField *dateText;
IBOutlet UITextField *timeText;
IBOutlet UITextField *latitudeText;
IBOutlet UITextField *longitudeText;
NSURLConnection *postConnection;
}
@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
-(IBAction)textFieldDoneEditing:(id) sender;
-(IBAction)post:(id)sender;
-(IBAction)getLatLon:(id)sender;
-(void) postMessage:(NSString*) postcode withName:(NSString *) name withAddress:(NSString *) address withCity:(NSString *) city withCounty:(NSString *) county withCountry:(NSString *) country withDate:(NSString *) date withTime:(NSString *) time withLatitude:(NSString *) latitude withLongitude:(NSString *) longitude;
- (void) keyboardDidShow:(NSNotification *)notif;
- (void) keyboardDidHide:(NSNotification *)notif;
@end
AddSessionViewController.m
#import "addSessionViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "SVGeocoder.h"
@implementation addSessionViewController
@synthesize scrollView;
- (IBAction)textFieldDoneEditing:(id)sender {
[sender resignFirstResponder];
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView.contentSize = self.view.frame.size;
UIColor *backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg-splash.png"]];
[self.view setBackgroundColor:backgroundColor];
UIView* gradientView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 4)];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = gradientView.bounds;
UIColor* lightColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
UIColor* darkColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
gradient.colors = [NSArray arrayWithObjects:(id)darkColor.CGColor, (id)lightColor.CGColor, nil];
[gradientView.layer insertSublayer:gradient atIndex:0];
[self.view addSubview:gradientView];
}
-(void) postMessage:(NSString*) postcode withName:(NSString *) name withAddress:(NSString *) address withCity:(NSString *) city withCounty:(NSString *) county withCountry:(NSString *) country withDate:(NSString *) date withTime:(NSString *) time withLatitude:(NSString *)latitude withLongitude:(NSString *)longitude; {
if (name != nil && address != nil && city != nil && county != nil && country != nil && postcode !=nil && date != nil && time != nil && latitude != nil && longitude != nil){
NSMutableString *postString = [NSMutableString stringWithString:kpostURL];
[postString appendString:[NSString stringWithFormat:@"?%@=%@", kname, name]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kaddress, address]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcity, city]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcounty, county]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcountry, country]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kpostcode, postcode]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kdate, date]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", ktime, time]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", klatitude, latitude]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", klongitude, longitude]];
[postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postString]];
[request setHTTPMethod:@"POST"];
postConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
}
}
-(IBAction)post:(id)sender{
[self postMessage:(NSString*) postcodeText.text withName:nameText.text withAddress:addressText.text withCity:cityText.text withCounty:countyText.text withCountry:countryText.text withDate:dateText.text withTime:timeText.text withLatitude:latitudeText.text withLongitude:longitudeText.text];
[postcodeText resignFirstResponder];
nameText.text = nil;
addressText.text = nil;
cityText.text = nil;
countyText.text = nil;
countryText.text = nil;
postcodeText.text = nil;
dateText.text = nil;
timeText.text = nil;
latitudeText.text = nil;
longitudeText.text = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:@"Test2" object:self];
}
-(IBAction)getLatLon:(id)sender{
NSString *eventName = [nameText text];
NSString *eventAddress = [addressText text];
NSString *eventCity = [cityText text];
NSString *eventCountry = [countryText text];
NSString *eventCounty = [countyText text];
NSString *eventDate = [dateText text];
NSString *eventPostCode = [postcodeText text];
NSString *eventTime = [timeText text];
// Use this to build the full event string
NSString *addressString = [NSString stringWithFormat:@"%@,%@,%@,%@,%@,%@,%@,%@", eventName, eventAddress, eventCity, eventCounty, eventCountry, eventPostCode, eventDate, eventTime];
// A search can't inlude the event and time and hour as it means nothing to MapKit
// The geocodeAddressString simply contains the address info
NSString *geocodeAddressString = [NSString stringWithFormat:@"%@,%@,%@,%@,%@", eventAddress, eventCity, eventCounty, eventCountry, eventPostCode];
//NSLog(@"Hello %@",addressString);
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:geocodeAddressString completionHandler:^(NSArray* placemarks, NSError* error){
// Check for returned placemarks
if (placemarks && placemarks.count > 0) {
CLPlacemark *topResult = [placemarks objectAtIndex:0];
//NSLog([topResult locality]);
//NSLog([topResult location]);
//MKCoordinateRegion region;
//double *value = topResult.region.center.latitude;
CLLocationDegrees latitude = topResult.region.center.latitude;
CLLocationDegrees longitude = topResult.location.coordinate.longitude;
NSString *latitudeString = [NSString stringWithFormat:@"%f",latitude];
NSString *longitudeString = [NSString stringWithFormat:@"%f",longitude];
latitudeText.text = latitudeString;
longitudeText.text = longitudeString;
NSLog(@"Lat: %f", latitude);
NSLog(@"Long: %f", longitude);
}
}];
}
- (void)viewDidUnload
{
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"%@", @"Registering for keyboard events...");
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
keyboardVisible_ = NO;
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"%@", @"Unregistering for keyboard events...");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
#pragma mark -
#pragma mark Keyboard handlers
- (void) keyboardDidShow:(NSNotification *)notif {
NSLog(@"%@", @"Received UIKeyboardDidShowNotification");
if (keyboardVisible_) {
NSLog(@"%@", @"Keyboard is already visible. Ignoring notifications.");
return;
}
// The keyboard wasn't visible before
NSLog(@"Resizing smaller for keyboard");
// Get the origin of the keyboard when it finishes animating
NSDictionary *info = [notif userInfo];
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
// Get the top of the keyboard in view's coordinate system.
// We need to set the bottom of the scrollview to line up with it
CGRect keyboardRect = [aValue CGRectValue];
keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
CGFloat keyboardTop = keyboardRect.origin.y;
// Resize the scroll view to make room for the keyboard
CGRect viewFrame = self.view.bounds;
viewFrame.size.height = keyboardTop - self.view.bounds.origin.y;
self.scrollView.frame = viewFrame;
keyboardVisible_ = YES;
}
- (void) keyboardDidHide:(NSNotification *)notif {
NSLog(@"%@", @"Received UIKeyboardDidHideNotification");
if (!keyboardVisible_) {
NSLog(@"%@", @"Keyboard already hidden. Ignoring notification.");
return;
}
// The keyboard was visible
NSLog(@"%@", @"Resizing bigger with no keyboard");
// Resize the scroll view back to the full size of our view
self.scrollView.frame = self.view.bounds;
keyboardVisible_ = NO;
}
@end
I know the code isn't the best as I'm new to Objective C and iOS development, but I'm really panicking as this is my final university assignment and it needs to be handed in at 10am tomorrow so ANY help would be appreciated!
| php | mysql | objective-c | xcode | clgeocoder | 05/22/2012 02:12:08 | too localized | Saving Latitude and Longitude values to a MySQL Database iOS
===
I've set my code up so that the user inputs all of the location details (address, city, county, country and postcode) and then on the click of a button the lat and lon values are fed into two text boxes... My problem now is that the code that was previously working to save the data to the database is not working.
Here's my code...
php
<?php
$username = "username";
$database = "database";
$password = "password";
mysql_connect(localhost, $username, $password);
@mysql_select_db($database) or die("unable to find database");
$name = $_GET["name"];
$address = $_GET["address"];
$city = $_GET["city"];
$county = $_GET["county"];
$country = $_GET["country"];
$postcode = $_GET["postcode"];
$date = $_GET["date"];
$time = $_GET["time"];
$latitude = $_GET["latitude"];
$longitude = $_GET["longitude"];
$query = "INSERT INTO map VALUES ('', '$name', '$address', '$city', '$county', '$country', '$postcode', '$date', '$time, '$latitude', '$longitude'')";
mysql_query($query) or die(mysql_error("error"));
mysql_close();
?>
AddSessionViewController.h
#import <UIKit/UIKit.h>
#define kpostURL @"http://myurl.com/map.php"
#define kname @"name"
#define kaddress @"address"
#define kcity @"city"
#define kcounty @"county"
#define kcountry @"country"
#define kpostcode @"postcode"
#define kdate @"date"
#define ktime @"time"
#define klatitude @"latitude"
#define klongitude @"longitude"
@interface addSessionViewController : UIViewController {
UIScrollView *scrollView_;
BOOL keyboardVisible_;
IBOutlet UITextField *nameText;
IBOutlet UITextField *addressText;
IBOutlet UITextField *cityText;
IBOutlet UITextField *countyText;
IBOutlet UITextField *countryText;
IBOutlet UITextField *postcodeText;
IBOutlet UITextField *dateText;
IBOutlet UITextField *timeText;
IBOutlet UITextField *latitudeText;
IBOutlet UITextField *longitudeText;
NSURLConnection *postConnection;
}
@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
-(IBAction)textFieldDoneEditing:(id) sender;
-(IBAction)post:(id)sender;
-(IBAction)getLatLon:(id)sender;
-(void) postMessage:(NSString*) postcode withName:(NSString *) name withAddress:(NSString *) address withCity:(NSString *) city withCounty:(NSString *) county withCountry:(NSString *) country withDate:(NSString *) date withTime:(NSString *) time withLatitude:(NSString *) latitude withLongitude:(NSString *) longitude;
- (void) keyboardDidShow:(NSNotification *)notif;
- (void) keyboardDidHide:(NSNotification *)notif;
@end
AddSessionViewController.m
#import "addSessionViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "SVGeocoder.h"
@implementation addSessionViewController
@synthesize scrollView;
- (IBAction)textFieldDoneEditing:(id)sender {
[sender resignFirstResponder];
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView.contentSize = self.view.frame.size;
UIColor *backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg-splash.png"]];
[self.view setBackgroundColor:backgroundColor];
UIView* gradientView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 4)];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = gradientView.bounds;
UIColor* lightColor = [[UIColor blackColor] colorWithAlphaComponent:0.0];
UIColor* darkColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
gradient.colors = [NSArray arrayWithObjects:(id)darkColor.CGColor, (id)lightColor.CGColor, nil];
[gradientView.layer insertSublayer:gradient atIndex:0];
[self.view addSubview:gradientView];
}
-(void) postMessage:(NSString*) postcode withName:(NSString *) name withAddress:(NSString *) address withCity:(NSString *) city withCounty:(NSString *) county withCountry:(NSString *) country withDate:(NSString *) date withTime:(NSString *) time withLatitude:(NSString *)latitude withLongitude:(NSString *)longitude; {
if (name != nil && address != nil && city != nil && county != nil && country != nil && postcode !=nil && date != nil && time != nil && latitude != nil && longitude != nil){
NSMutableString *postString = [NSMutableString stringWithString:kpostURL];
[postString appendString:[NSString stringWithFormat:@"?%@=%@", kname, name]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kaddress, address]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcity, city]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcounty, county]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kcountry, country]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kpostcode, postcode]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", kdate, date]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", ktime, time]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", klatitude, latitude]];
[postString appendString:[NSString stringWithFormat:@"&%@=%@", klongitude, longitude]];
[postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postString]];
[request setHTTPMethod:@"POST"];
postConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
}
}
-(IBAction)post:(id)sender{
[self postMessage:(NSString*) postcodeText.text withName:nameText.text withAddress:addressText.text withCity:cityText.text withCounty:countyText.text withCountry:countryText.text withDate:dateText.text withTime:timeText.text withLatitude:latitudeText.text withLongitude:longitudeText.text];
[postcodeText resignFirstResponder];
nameText.text = nil;
addressText.text = nil;
cityText.text = nil;
countyText.text = nil;
countryText.text = nil;
postcodeText.text = nil;
dateText.text = nil;
timeText.text = nil;
latitudeText.text = nil;
longitudeText.text = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:@"Test2" object:self];
}
-(IBAction)getLatLon:(id)sender{
NSString *eventName = [nameText text];
NSString *eventAddress = [addressText text];
NSString *eventCity = [cityText text];
NSString *eventCountry = [countryText text];
NSString *eventCounty = [countyText text];
NSString *eventDate = [dateText text];
NSString *eventPostCode = [postcodeText text];
NSString *eventTime = [timeText text];
// Use this to build the full event string
NSString *addressString = [NSString stringWithFormat:@"%@,%@,%@,%@,%@,%@,%@,%@", eventName, eventAddress, eventCity, eventCounty, eventCountry, eventPostCode, eventDate, eventTime];
// A search can't inlude the event and time and hour as it means nothing to MapKit
// The geocodeAddressString simply contains the address info
NSString *geocodeAddressString = [NSString stringWithFormat:@"%@,%@,%@,%@,%@", eventAddress, eventCity, eventCounty, eventCountry, eventPostCode];
//NSLog(@"Hello %@",addressString);
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:geocodeAddressString completionHandler:^(NSArray* placemarks, NSError* error){
// Check for returned placemarks
if (placemarks && placemarks.count > 0) {
CLPlacemark *topResult = [placemarks objectAtIndex:0];
//NSLog([topResult locality]);
//NSLog([topResult location]);
//MKCoordinateRegion region;
//double *value = topResult.region.center.latitude;
CLLocationDegrees latitude = topResult.region.center.latitude;
CLLocationDegrees longitude = topResult.location.coordinate.longitude;
NSString *latitudeString = [NSString stringWithFormat:@"%f",latitude];
NSString *longitudeString = [NSString stringWithFormat:@"%f",longitude];
latitudeText.text = latitudeString;
longitudeText.text = longitudeString;
NSLog(@"Lat: %f", latitude);
NSLog(@"Long: %f", longitude);
}
}];
}
- (void)viewDidUnload
{
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"%@", @"Registering for keyboard events...");
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
keyboardVisible_ = NO;
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"%@", @"Unregistering for keyboard events...");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
#pragma mark -
#pragma mark Keyboard handlers
- (void) keyboardDidShow:(NSNotification *)notif {
NSLog(@"%@", @"Received UIKeyboardDidShowNotification");
if (keyboardVisible_) {
NSLog(@"%@", @"Keyboard is already visible. Ignoring notifications.");
return;
}
// The keyboard wasn't visible before
NSLog(@"Resizing smaller for keyboard");
// Get the origin of the keyboard when it finishes animating
NSDictionary *info = [notif userInfo];
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
// Get the top of the keyboard in view's coordinate system.
// We need to set the bottom of the scrollview to line up with it
CGRect keyboardRect = [aValue CGRectValue];
keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
CGFloat keyboardTop = keyboardRect.origin.y;
// Resize the scroll view to make room for the keyboard
CGRect viewFrame = self.view.bounds;
viewFrame.size.height = keyboardTop - self.view.bounds.origin.y;
self.scrollView.frame = viewFrame;
keyboardVisible_ = YES;
}
- (void) keyboardDidHide:(NSNotification *)notif {
NSLog(@"%@", @"Received UIKeyboardDidHideNotification");
if (!keyboardVisible_) {
NSLog(@"%@", @"Keyboard already hidden. Ignoring notification.");
return;
}
// The keyboard was visible
NSLog(@"%@", @"Resizing bigger with no keyboard");
// Resize the scroll view back to the full size of our view
self.scrollView.frame = self.view.bounds;
keyboardVisible_ = NO;
}
@end
I know the code isn't the best as I'm new to Objective C and iOS development, but I'm really panicking as this is my final university assignment and it needs to be handed in at 10am tomorrow so ANY help would be appreciated!
| 3 |
11,736,439 | 07/31/2012 08:52:46 | 319,329 | 04/17/2010 17:22:08 | 26 | 3 | Open source for Agile and Scrum | What are the best free and open source web tools out there for Agile and Scrum? | open-source | free | agile | scrum | null | 07/31/2012 09:32:07 | not constructive | Open source for Agile and Scrum
===
What are the best free and open source web tools out there for Agile and Scrum? | 4 |
6,517,846 | 06/29/2011 08:39:53 | 799,173 | 06/15/2011 08:10:41 | 1 | 0 | Bulk posting in Craigslist PHP code | <?php
class cURL {
var $headers;
var $user_agent;
function cURL() {
$this->headers[] = 'Connection: Keep-Alive';
$this->headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$this->user_agent = 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
}
function post($url, $data) {
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
$return = curl_exec($process);
$info = curl_getinfo($process);
curl_close($process);
return $info;
}
}
$postdata = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns:cl=\"http://www.craigslist.org/about/cl-bulk-ns/1.0\">
<channel>
<items>
<rdf:li rdf:resource=\"NYCBrokerHousingSample1\"/>
<rdf:li rdf:resource=\"NYCBrokerHousingSample2\"/>
</items>
<cl:auth username=\"mymail@gmail.com\"
password=\"xxxxxx\"
</channel>
<item rdf:about=\"NYCBrokerHousingSample1\">
<cl:category>apa</cl:category>
<cl:area>chi</cl:area>
<cl:subarea>chc</cl:subarea>
<cl:neighborhood>Lakeview</cl:neighborhood>
<cl:housingInfo price=\"1450\"
bedrooms=\"0\"
sqft=\"600\"/>
<cl:replyEmail privacy=\"C\">mymail@gmail.com</cl:replyEmail>
<cl:brokerInfo companyName=\"Joe Sample and Associates\"
feeDisclosure=\"fee disclosure here\" />
<title>Spacious Sunny Studio in Upper West Side</title>
<description><![CDATA[
posting body here
]]></description>
</item>
</rdf:RDF>
";
$cc = new cURL();
$url = 'https://post.craigslist.org/bulk-rss/post';
$output = $cc->post($url, $postdata);
//echo $output;
print_r($output);
?>
Hello,
I read on webpages such as MODERATED please review the forum posting rules that there is an one-click posting option for craigslist.
As I researched further, I found this page:
http://www.craigslist.org/about/bulk...#sample_client
It seems like you can send a xml file with your listing information to their server via HTTPS Request.
Responses a Server Status = 100??! I'm not sure if you need a special account or kind of an agreement with craigslist to be allowed to use a bulk posting client.
If anybody has an idea how to get this to work, I really would appreciate it.
Thank.
HP | php | rss | bulk | posting | craigslist | 06/30/2011 06:42:03 | not constructive | Bulk posting in Craigslist PHP code
===
<?php
class cURL {
var $headers;
var $user_agent;
function cURL() {
$this->headers[] = 'Connection: Keep-Alive';
$this->headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$this->user_agent = 'Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
}
function post($url, $data) {
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
$return = curl_exec($process);
$info = curl_getinfo($process);
curl_close($process);
return $info;
}
}
$postdata = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\"
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns:cl=\"http://www.craigslist.org/about/cl-bulk-ns/1.0\">
<channel>
<items>
<rdf:li rdf:resource=\"NYCBrokerHousingSample1\"/>
<rdf:li rdf:resource=\"NYCBrokerHousingSample2\"/>
</items>
<cl:auth username=\"mymail@gmail.com\"
password=\"xxxxxx\"
</channel>
<item rdf:about=\"NYCBrokerHousingSample1\">
<cl:category>apa</cl:category>
<cl:area>chi</cl:area>
<cl:subarea>chc</cl:subarea>
<cl:neighborhood>Lakeview</cl:neighborhood>
<cl:housingInfo price=\"1450\"
bedrooms=\"0\"
sqft=\"600\"/>
<cl:replyEmail privacy=\"C\">mymail@gmail.com</cl:replyEmail>
<cl:brokerInfo companyName=\"Joe Sample and Associates\"
feeDisclosure=\"fee disclosure here\" />
<title>Spacious Sunny Studio in Upper West Side</title>
<description><![CDATA[
posting body here
]]></description>
</item>
</rdf:RDF>
";
$cc = new cURL();
$url = 'https://post.craigslist.org/bulk-rss/post';
$output = $cc->post($url, $postdata);
//echo $output;
print_r($output);
?>
Hello,
I read on webpages such as MODERATED please review the forum posting rules that there is an one-click posting option for craigslist.
As I researched further, I found this page:
http://www.craigslist.org/about/bulk...#sample_client
It seems like you can send a xml file with your listing information to their server via HTTPS Request.
Responses a Server Status = 100??! I'm not sure if you need a special account or kind of an agreement with craigslist to be allowed to use a bulk posting client.
If anybody has an idea how to get this to work, I really would appreciate it.
Thank.
HP | 4 |
617,733 | 03/06/2009 05:18:37 | 74,170 | 03/05/2009 10:13:47 | 6 | 0 | How do you create a frozen/non scrolling window region using javascript? | Am curious to know how you create a frozen/non-scrolling regions on a webpage using javascript! like the one used by Stackoverflow when they alert you of the badge you have earned with a "X" close button!
Gath | javascript | null | null | null | null | null | open | How do you create a frozen/non scrolling window region using javascript?
===
Am curious to know how you create a frozen/non-scrolling regions on a webpage using javascript! like the one used by Stackoverflow when they alert you of the badge you have earned with a "X" close button!
Gath | 0 |
7,689,618 | 10/07/2011 15:44:41 | 912,799 | 08/25/2011 18:43:36 | 3 | 0 | Setup.py for uninstalling via pip | According to [another question](http://stackoverflow.com/questions/1231688/how-do-i-remove-packages-installed-with-pythons-easy-install), pip offers a facility for uninstalling eggs, which it's help also indicates.
I have a project that, once installed, has a structure in my local site-packages folder that looks like this:
<pre>projecta/
projecta-1.0-py2.6.egg-info/</pre>
Using an up to date version, `pip uninstall projecta` asks me the following question:
<pre> /path/to/python2.6/site-packages/projecta-1.0-py2.6.egg-info
Proceed (y/n)?</pre>
Answering `y` will remove the `.egg-info` directory, but not the main `projecta` directory, without saying there was any sort of error. Why doesn't pip manage or know to remove this directory?
The project itself is installed via a `setup.py` file using distutils. Are there any special settings I could/should use in that file to help pip with the removal process?
| python | uninstall | pip | null | null | null | open | Setup.py for uninstalling via pip
===
According to [another question](http://stackoverflow.com/questions/1231688/how-do-i-remove-packages-installed-with-pythons-easy-install), pip offers a facility for uninstalling eggs, which it's help also indicates.
I have a project that, once installed, has a structure in my local site-packages folder that looks like this:
<pre>projecta/
projecta-1.0-py2.6.egg-info/</pre>
Using an up to date version, `pip uninstall projecta` asks me the following question:
<pre> /path/to/python2.6/site-packages/projecta-1.0-py2.6.egg-info
Proceed (y/n)?</pre>
Answering `y` will remove the `.egg-info` directory, but not the main `projecta` directory, without saying there was any sort of error. Why doesn't pip manage or know to remove this directory?
The project itself is installed via a `setup.py` file using distutils. Are there any special settings I could/should use in that file to help pip with the removal process?
| 0 |
10,922,363 | 06/06/2012 21:11:35 | 1,178,924 | 01/30/2012 20:26:46 | 298 | 19 | Converting a unix timestamp to NSdate using local timezone | Im getting some start_times and end_times in the form of NSDecimalNumbers back from an API request.
I have successfully been able to convert these NSDecimalNumbers into NSDates, but the code is not taking time zones into account.
I need for it to use the timezone that is default on the device.
Can anybody help me? Thank you for your time! | iphone | objective-c | ios | null | null | null | open | Converting a unix timestamp to NSdate using local timezone
===
Im getting some start_times and end_times in the form of NSDecimalNumbers back from an API request.
I have successfully been able to convert these NSDecimalNumbers into NSDates, but the code is not taking time zones into account.
I need for it to use the timezone that is default on the device.
Can anybody help me? Thank you for your time! | 0 |
6,063,061 | 05/19/2011 18:15:45 | 593,010 | 01/27/2011 22:47:36 | 232 | 17 | Is NetBeans Still a Good IDE to Start a JavaEE/JavaScript Project On? | I have used NetBeans many times in the past, but having just reviewed the Oracle version of the site and training videos I am worried that NetBeans post acquisition is not a good choice for a new project I am embarking upon. It's a sense I get from the videos and the oraclization of everything.
For instance support for the javascript debugger has been dropped which I find quite odd given only increasing importance of JavaScript in development projects. I just finished a project in Visual Studio 2010 and the javascript debugger made all the difference.
Does Eclipse have a good JavaScript debugger? FireBug really has its limitations.
(FYI - This is not an argumentative question. I really need some wisdom on this).
Thanks,
Guido | java | javascript | eclipse | netbeans | ide | 05/19/2011 18:42:54 | not constructive | Is NetBeans Still a Good IDE to Start a JavaEE/JavaScript Project On?
===
I have used NetBeans many times in the past, but having just reviewed the Oracle version of the site and training videos I am worried that NetBeans post acquisition is not a good choice for a new project I am embarking upon. It's a sense I get from the videos and the oraclization of everything.
For instance support for the javascript debugger has been dropped which I find quite odd given only increasing importance of JavaScript in development projects. I just finished a project in Visual Studio 2010 and the javascript debugger made all the difference.
Does Eclipse have a good JavaScript debugger? FireBug really has its limitations.
(FYI - This is not an argumentative question. I really need some wisdom on this).
Thanks,
Guido | 4 |
8,823,883 | 01/11/2012 17:33:59 | 48,067 | 12/20/2008 23:47:47 | 1,197 | 27 | backbone.js nested collection, add event fires, but returns parent model | I've been trying to nest a collection inside a model.
I've got a recipe, and a recipe has ingredientslist(collection) which has ingredient(model).
I first tried backbone relational-model, but then opted for the method provided here http://stackoverflow.com/questions/6353607/backbone-js-structuring-nested-views-and-models/#answer-6476507
When I add an ingredient to the collection, the add event is triggered.
<pre>
initialize: function(){
recipe = this.model;
console.log(recipe);
_.bindAll(this,"add","remove");
recipe.ingredientlist.each(this.add);
recipe.ingredientlist.bind('add', this.add);
recipe.ingredientlist.bind('remove', this.remove);
this.render();
},
add: function(ingredient){
console.log(ingredient);
}
</pre>
but in my console, where I am trying to output the ingredient which was added, I'm getting the recipe model returned.
My model looks like this
<pre>
MyApp.Models.Recipe = Backbone.Model.extend({
initialize: function(){
this.ingredientlist = new MyApp.Collections.IngredientList();
this.ingredientlist.parent = this;
});
</pre>
how do I get the bind to return the ingredient which was just added to the collection, rather than the entire recipe model? | backbone.js | backbone-events | null | null | null | 02/14/2012 20:51:09 | too localized | backbone.js nested collection, add event fires, but returns parent model
===
I've been trying to nest a collection inside a model.
I've got a recipe, and a recipe has ingredientslist(collection) which has ingredient(model).
I first tried backbone relational-model, but then opted for the method provided here http://stackoverflow.com/questions/6353607/backbone-js-structuring-nested-views-and-models/#answer-6476507
When I add an ingredient to the collection, the add event is triggered.
<pre>
initialize: function(){
recipe = this.model;
console.log(recipe);
_.bindAll(this,"add","remove");
recipe.ingredientlist.each(this.add);
recipe.ingredientlist.bind('add', this.add);
recipe.ingredientlist.bind('remove', this.remove);
this.render();
},
add: function(ingredient){
console.log(ingredient);
}
</pre>
but in my console, where I am trying to output the ingredient which was added, I'm getting the recipe model returned.
My model looks like this
<pre>
MyApp.Models.Recipe = Backbone.Model.extend({
initialize: function(){
this.ingredientlist = new MyApp.Collections.IngredientList();
this.ingredientlist.parent = this;
});
</pre>
how do I get the bind to return the ingredient which was just added to the collection, rather than the entire recipe model? | 3 |
8,309,974 | 11/29/2011 11:28:17 | 488,735 | 10/27/2010 11:15:57 | 742 | 0 | Django - Deployment for a newbie | I have finished my first Django/Python Project and now I need to put the things working in a real production webserver.
I have read some papers over the Internet and I'm inclined to choose Ngix, Gunicorn and Git but the documentation that I found is not very complete and I have many doubs if this is the best option.
What do you think about this subject? I need a simple way to put my Django Project on-line but the website is still very buggy, I will need to change the code many times in the production server in the times ahead.
Please give me some clues about what I should do. I'm kind of lost...
Best Regards, | django | deployment | null | null | null | 11/29/2011 13:32:51 | off topic | Django - Deployment for a newbie
===
I have finished my first Django/Python Project and now I need to put the things working in a real production webserver.
I have read some papers over the Internet and I'm inclined to choose Ngix, Gunicorn and Git but the documentation that I found is not very complete and I have many doubs if this is the best option.
What do you think about this subject? I need a simple way to put my Django Project on-line but the website is still very buggy, I will need to change the code many times in the production server in the times ahead.
Please give me some clues about what I should do. I'm kind of lost...
Best Regards, | 2 |
8,430,307 | 12/08/2011 11:29:37 | 688,912 | 04/02/2011 12:46:29 | 177 | 12 | C++, will this cause memory leak? | I know that I can't get a reference of a local var. such as:
int& func1()
{
int i;
i = 1;
return i;
}
And I know that this is correct, but I have to delete it after calling func2()
int* func2()
{
int* p;
p = new int;
*p = 1;
return p;
}
int main()
{
int *p = func2();
cout << *p << endl;
delete p;
return 0;
}
**If the function is like this:**
MyClass MyFunction()
{
return new MyClass;
}
Will this cause memory leak?
**PS: the code comes from the book "Ruminations on C++" Chapter 10.
the original code is:**
Picture frame(const Pictrue& pic)
{
// Picture has a constructor Picture(*P_Node)
// Frame_Pic derives from P_Node
// So the constructor Picture(*P_Node) will implicitly convert Frame_Pic to Picture.
return new Frame_Pic(pic);
} | c++ | local-variables | null | null | null | null | open | C++, will this cause memory leak?
===
I know that I can't get a reference of a local var. such as:
int& func1()
{
int i;
i = 1;
return i;
}
And I know that this is correct, but I have to delete it after calling func2()
int* func2()
{
int* p;
p = new int;
*p = 1;
return p;
}
int main()
{
int *p = func2();
cout << *p << endl;
delete p;
return 0;
}
**If the function is like this:**
MyClass MyFunction()
{
return new MyClass;
}
Will this cause memory leak?
**PS: the code comes from the book "Ruminations on C++" Chapter 10.
the original code is:**
Picture frame(const Pictrue& pic)
{
// Picture has a constructor Picture(*P_Node)
// Frame_Pic derives from P_Node
// So the constructor Picture(*P_Node) will implicitly convert Frame_Pic to Picture.
return new Frame_Pic(pic);
} | 0 |
656,548 | 03/18/2009 00:29:00 | 20,126 | 09/21/2008 23:21:25 | 189 | 12 | Whats the best JQuery book? | I am a good javascript/asp.net developer, but i am just starting to learn JQuery,
Whats the best book to learn JQuery?
Books i like their style:
Complete reference
How to program
| javascript | jquery | asp.net | null | null | 09/07/2011 22:34:34 | not constructive | Whats the best JQuery book?
===
I am a good javascript/asp.net developer, but i am just starting to learn JQuery,
Whats the best book to learn JQuery?
Books i like their style:
Complete reference
How to program
| 4 |
4,116,874 | 11/07/2010 07:46:17 | 451,192 | 09/18/2010 03:16:15 | 27 | 1 | floating issues | I am trying to make it such that the layout looks like the following (crude) model lol:
--div----------------<br />
| label TextBox |<br />
| label TextBox |<br />
| label TextBox |<br />
|------------------- |<br />
Here is what I have ...
.personalInfo_Form
{
width:600px;
margin: auto;
padding: 20px;
background-color: White;
}
.addressLabel
{
float: left;
width: 140px;
padding: 5px;
text-align: right;
}
.addressField
{
float: left;
padding: 5px;
}
the end result viewing in FireFox is that the rows are offset and not uniform. I have noticed that specifying a very specific width of the div can change the outcome of position which makes sense because it will enforce the floating rule that items cannot overlap by default, thus positioning them beneath one another... However, I would like to design it such that the width of the Div is not a factor in the positioning of the inner elements.
Cheers for the help! | css | null | null | null | null | null | open | floating issues
===
I am trying to make it such that the layout looks like the following (crude) model lol:
--div----------------<br />
| label TextBox |<br />
| label TextBox |<br />
| label TextBox |<br />
|------------------- |<br />
Here is what I have ...
.personalInfo_Form
{
width:600px;
margin: auto;
padding: 20px;
background-color: White;
}
.addressLabel
{
float: left;
width: 140px;
padding: 5px;
text-align: right;
}
.addressField
{
float: left;
padding: 5px;
}
the end result viewing in FireFox is that the rows are offset and not uniform. I have noticed that specifying a very specific width of the div can change the outcome of position which makes sense because it will enforce the floating rule that items cannot overlap by default, thus positioning them beneath one another... However, I would like to design it such that the width of the Div is not a factor in the positioning of the inner elements.
Cheers for the help! | 0 |
9,569,557 | 03/05/2012 15:45:56 | 1,009,377 | 10/23/2011 09:41:39 | 59 | 2 | Passing 0 to function with defaul value | Im currently testing a simple PHP function.
I want to to return the currenty value of a field if the function is called without any parameter passed or set a new value if a parameter is passed.
Strange thing is: if I pass 0 (var_dump is showing currect value int(1) 0), the function goes into the if branch like i called the function without any value and i just dont get why.
function:
`public function u_strasse($u_strasse = 'asdjfklhqwef'){
if($u_strasse == 'asdjfklhqwef'){
return $this->u_strasse;
}
else { // set new value here}`
either u_strasse() or u_strasse(0) gets me in the if branch.
| php | function | default-value | null | null | null | open | Passing 0 to function with defaul value
===
Im currently testing a simple PHP function.
I want to to return the currenty value of a field if the function is called without any parameter passed or set a new value if a parameter is passed.
Strange thing is: if I pass 0 (var_dump is showing currect value int(1) 0), the function goes into the if branch like i called the function without any value and i just dont get why.
function:
`public function u_strasse($u_strasse = 'asdjfklhqwef'){
if($u_strasse == 'asdjfklhqwef'){
return $this->u_strasse;
}
else { // set new value here}`
either u_strasse() or u_strasse(0) gets me in the if branch.
| 0 |
6,878,373 | 07/29/2011 19:58:09 | 869,983 | 07/29/2011 19:58:09 | 1 | 0 | HTML/CSS - 100% DIV not lining up a 30% and 70% Child | I'm trying to understand why this doesn't line up the two INPUT elements side by side.
Thanks for any help you can provide.
<STYLE>
html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
</STYLE>
<DIV STYLE='width:100%;'>
<INPUT TYPE=text size=10 maxlength=10
STYLE='width:70%;'>
<BUTTON STYLE='width:30%; float:right;'
>Button</BUTTON>
</DIV>
| html | css | null | null | null | null | open | HTML/CSS - 100% DIV not lining up a 30% and 70% Child
===
I'm trying to understand why this doesn't line up the two INPUT elements side by side.
Thanks for any help you can provide.
<STYLE>
html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
</STYLE>
<DIV STYLE='width:100%;'>
<INPUT TYPE=text size=10 maxlength=10
STYLE='width:70%;'>
<BUTTON STYLE='width:30%; float:right;'
>Button</BUTTON>
</DIV>
| 0 |
9,663,701 | 03/12/2012 08:21:20 | 331,214 | 05/03/2010 07:28:26 | 89 | 5 | Is it against FB policy to provide questionnaire hints in exchange for likes? | We're building a simple FB questionnaire that presents one question per day. One considered mechanic is that liking the day's question page gives you a small hint about the correct answer. Is this allowed by FB? There is a big, concrete price for the winner.
http://developers.facebook.com/policy/ says "You must not incentivize users to use (or gate content behind the use of) Facebook social channels, or imply that an incentive is directly tied to the use of our channels.", but then promotion guidelines don't deny this kind of behavior (http://www.facebook.com/promotions_guidelines.php) | facebook | facebook-like | policies | null | null | null | open | Is it against FB policy to provide questionnaire hints in exchange for likes?
===
We're building a simple FB questionnaire that presents one question per day. One considered mechanic is that liking the day's question page gives you a small hint about the correct answer. Is this allowed by FB? There is a big, concrete price for the winner.
http://developers.facebook.com/policy/ says "You must not incentivize users to use (or gate content behind the use of) Facebook social channels, or imply that an incentive is directly tied to the use of our channels.", but then promotion guidelines don't deny this kind of behavior (http://www.facebook.com/promotions_guidelines.php) | 0 |
5,941,514 | 05/09/2011 19:28:51 | 745,697 | 05/09/2011 19:16:21 | 1 | 0 | ASP.NET webpart page load firing for all webparts in DeclarativeCatalogPart | Greetings.
I have a bunch of ASP.NET webparts added to the WebPartsTemplate section of a DeclarativeCatalogPart. These webparts are classic ASP.NET User Controls (ascx) that implement System.Web.UI.WebControls.WebParts.IWebPart.
I discovered that the page load event is firing for all controls added to the DeclarativeCatalogPart REGARDLESS of whether or not the user has actually added the control to a visible WebPartZone.
Is there a way to only have Page Load fire in the ascx webparts when the webparts are added to a WebPartZone by a user? Converesely, how can I NOT have the Page Load event fire for all webparts declared in the DeclarativeCatalogPart? | asp.net | webparts | null | null | null | null | open | ASP.NET webpart page load firing for all webparts in DeclarativeCatalogPart
===
Greetings.
I have a bunch of ASP.NET webparts added to the WebPartsTemplate section of a DeclarativeCatalogPart. These webparts are classic ASP.NET User Controls (ascx) that implement System.Web.UI.WebControls.WebParts.IWebPart.
I discovered that the page load event is firing for all controls added to the DeclarativeCatalogPart REGARDLESS of whether or not the user has actually added the control to a visible WebPartZone.
Is there a way to only have Page Load fire in the ascx webparts when the webparts are added to a WebPartZone by a user? Converesely, how can I NOT have the Page Load event fire for all webparts declared in the DeclarativeCatalogPart? | 0 |
9,641,442 | 03/09/2012 21:47:40 | 424,747 | 08/19/2010 02:56:27 | 347 | 6 | sed: delete previous line | I need to remove a blank line prior to a match.
So given the file:
random text
more random text
#matchee
I need to match the pattern /#matchee/, then delete the blank line before it.
Here's what I've tried --- no success:
sed '/^[ \t]*$/{N;/#matchee.*$/{D;}}' file.txt
My logic:
* If blank line; append next line to pattern space yielding /<blank line>/n...etc/
* If pattern space contains /#matchee/, Delete up to newline yielding /#matchee/
Basically /matchee/ is a constant that must be maintained and I need to remove an extra
blank line from each record in a file of records delimited by /#matchee/.
This produces no effect whatever. I am RTFM-ing and `D` is supposed to delete pattern
space up to the newline. Since `N` appends a newline plus next line --- this should produce the desired results ....alas ....no and no again. Is this because the match contains essentially nothing ( blankline )? | regex | sed | null | null | null | null | open | sed: delete previous line
===
I need to remove a blank line prior to a match.
So given the file:
random text
more random text
#matchee
I need to match the pattern /#matchee/, then delete the blank line before it.
Here's what I've tried --- no success:
sed '/^[ \t]*$/{N;/#matchee.*$/{D;}}' file.txt
My logic:
* If blank line; append next line to pattern space yielding /<blank line>/n...etc/
* If pattern space contains /#matchee/, Delete up to newline yielding /#matchee/
Basically /matchee/ is a constant that must be maintained and I need to remove an extra
blank line from each record in a file of records delimited by /#matchee/.
This produces no effect whatever. I am RTFM-ing and `D` is supposed to delete pattern
space up to the newline. Since `N` appends a newline plus next line --- this should produce the desired results ....alas ....no and no again. Is this because the match contains essentially nothing ( blankline )? | 0 |
2,539,584 | 03/29/2010 16:29:58 | 15,937 | 09/17/2008 13:36:55 | 443 | 20 | Asp.Net MVC style routing in Django | I've been programming in Asp.Net MVC for quite some time now and to expand a little bit beyond the .Net world I've recently began learning Python and Django. I am enjoying Django but one thing I am missing from Asp.Net MVC is the automatic routing from my urls to my controller actions.
In Asp.Net MVC I can build much of my application using this single default route:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
In Django I've found myself adding an entry to urls.py for each view that I want to expose which leads to a lot more url patterns than I've become used to in Asp.Net MVC.
Is there a way to create a single url pattern in Django that will handle "[Application]/view/[params]" in a way similar to Asp.Net MVC? Perhaps at the main web site level? | asp.net-mvc | django | null | null | null | null | open | Asp.Net MVC style routing in Django
===
I've been programming in Asp.Net MVC for quite some time now and to expand a little bit beyond the .Net world I've recently began learning Python and Django. I am enjoying Django but one thing I am missing from Asp.Net MVC is the automatic routing from my urls to my controller actions.
In Asp.Net MVC I can build much of my application using this single default route:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
In Django I've found myself adding an entry to urls.py for each view that I want to expose which leads to a lot more url patterns than I've become used to in Asp.Net MVC.
Is there a way to create a single url pattern in Django that will handle "[Application]/view/[params]" in a way similar to Asp.Net MVC? Perhaps at the main web site level? | 0 |
11,062,770 | 06/16/2012 10:52:20 | 1,460,449 | 06/16/2012 09:50:51 | 1 | 0 | How can i provide my custom web interface to MySQL using Python and Django? | I wand to provide my custom web interface for MySQL. What i want is that user can connect to the database from the webpage by clicking connect button and then can perform several different actions (defined against these button) from that web interface. How can i accomplish this task? Making front-end is no issue. What should i do at the back-end? I used subprocess but i guess that it will not work as its functions such as check_output just returns the output of a command and closes the sub-process. How can i do it? Kindly help. | python | mysql | django | null | null | 06/18/2012 04:43:06 | not a real question | How can i provide my custom web interface to MySQL using Python and Django?
===
I wand to provide my custom web interface for MySQL. What i want is that user can connect to the database from the webpage by clicking connect button and then can perform several different actions (defined against these button) from that web interface. How can i accomplish this task? Making front-end is no issue. What should i do at the back-end? I used subprocess but i guess that it will not work as its functions such as check_output just returns the output of a command and closes the sub-process. How can i do it? Kindly help. | 1 |
10,417,811 | 05/02/2012 16:24:49 | 1,370,519 | 05/02/2012 16:19:27 | 1 | 0 | Open Source (free) designing tool like photoshop | I am looking for an OpenSource designing software for iOS which i can use for commercial purpose.
Any good tool other then gimp.
thanks. | ios | open-source | null | null | null | 05/03/2012 08:04:46 | off topic | Open Source (free) designing tool like photoshop
===
I am looking for an OpenSource designing software for iOS which i can use for commercial purpose.
Any good tool other then gimp.
thanks. | 2 |
5,813,565 | 04/28/2011 04:15:07 | 687,564 | 04/01/2011 12:29:10 | 28 | 0 | Application Development in C/C++/Oracle/Unix? | I am learning C/C++/oracle/Unix?
I am thinking of developing some application on my own, but I have no Idea what else is required.
If you take an example of C++? I have very basic knowledge of it ?
I have just read one book in C++?
I dont know much about graphics in C++?
I went to codeplex.com(An open source website for programming and development) they had some project in C++ :
**Trinity
Project Description
2D-3D Space MMOG
Based on the Palestar Medusa Engine**
link -> http://www.codeplex.com/site/search/openings?query=&sortBy=OpeningPostedDate&tagName=%2cc%2b%2b%2c&licenses=|&refinedSearch=true
Now this looks way beyond my knowledge but I want to buld something if not I want learn more to do it but I have no clue where to begin now what material topics, books to read.
There so many things involved with an application .exe files,dll files and many more those
when you click on the exe file all different kinds of files are extracted and come into existence?
1:) Am I thinking in the right direction?
2:) Is it possible to do it alone or be a part of such big open source projects online?
what are the things that I need to collect online and study?
please Help?
if possible please provide the topics,books, websites that might help me to study and proceed to achieve my goal?
(PLEASE HELP TO MIGRATE THIS QUESTION IF THIS DOES NOT BELONG HERE) | c++ | c | oracle | unix | null | 04/28/2011 04:35:56 | not a real question | Application Development in C/C++/Oracle/Unix?
===
I am learning C/C++/oracle/Unix?
I am thinking of developing some application on my own, but I have no Idea what else is required.
If you take an example of C++? I have very basic knowledge of it ?
I have just read one book in C++?
I dont know much about graphics in C++?
I went to codeplex.com(An open source website for programming and development) they had some project in C++ :
**Trinity
Project Description
2D-3D Space MMOG
Based on the Palestar Medusa Engine**
link -> http://www.codeplex.com/site/search/openings?query=&sortBy=OpeningPostedDate&tagName=%2cc%2b%2b%2c&licenses=|&refinedSearch=true
Now this looks way beyond my knowledge but I want to buld something if not I want learn more to do it but I have no clue where to begin now what material topics, books to read.
There so many things involved with an application .exe files,dll files and many more those
when you click on the exe file all different kinds of files are extracted and come into existence?
1:) Am I thinking in the right direction?
2:) Is it possible to do it alone or be a part of such big open source projects online?
what are the things that I need to collect online and study?
please Help?
if possible please provide the topics,books, websites that might help me to study and proceed to achieve my goal?
(PLEASE HELP TO MIGRATE THIS QUESTION IF THIS DOES NOT BELONG HERE) | 1 |
6,674,948 | 07/13/2011 06:34:24 | 189,673 | 10/14/2009 08:11:49 | 564 | 23 | An example (or link to a piece of code) of good, solid Object-Oriented Javascript? | I've seen lot's of various approaches to OO JavaScrtipt, but I'm still not sure which one is best. Could you guys please share pieces of code and patterns that you find best? | javascript | oop | patterns | example | null | 11/11/2011 16:46:22 | not constructive | An example (or link to a piece of code) of good, solid Object-Oriented Javascript?
===
I've seen lot's of various approaches to OO JavaScrtipt, but I'm still not sure which one is best. Could you guys please share pieces of code and patterns that you find best? | 4 |
8,794,558 | 01/09/2012 20:13:17 | 1,139,506 | 01/09/2012 20:07:23 | 101 | 0 | Software to recheck a text against wikipedia (or even google results) | Both online and offline I find texts that I want to recheck against sources from the internet.
Mostly the texts draw sources from Wikipedia.
**Is there free software to do this?**
(it should run on MacOSX) | osx | data-mining | software-tools | wikipedia | text-mining | 01/09/2012 20:16:55 | off topic | Software to recheck a text against wikipedia (or even google results)
===
Both online and offline I find texts that I want to recheck against sources from the internet.
Mostly the texts draw sources from Wikipedia.
**Is there free software to do this?**
(it should run on MacOSX) | 2 |
3,958,208 | 10/18/2010 10:22:34 | 382,934 | 07/04/2010 03:52:09 | 24 | 4 | Calculating totals for complex models | All,
I'm developing an application using Zend Framework to manage tenders for construction work.
The tender will be a rather complex set of models with an architecture resembling the code snippet below.
My question is... should I store the total value of the tender as part of the tender model, or should I compute it each time it is required? The total value of the tender will be a sum of all the components (e.g. plant/labour/materials/overheads/etc).
object(Application_Model_Tender)#75 (4) {
["_id":protected] => int(1)
["_name":protected] => string(33) "Tender Name"
["_due":protected] => string(10) "2010-12-01"
["_labour":protected] => array(2) {
[0] => object(Application_Model_Gang)#81 (3) {
["_id":protected] => int(1)
["_name":protected] => string(25) "First Gang Name"
["_gangMembers":protected] => array(2) {
[0] => object(Application_Model_GangMember)#93 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(7) "Default"
["_cost":protected] => float(546)
["_qty":protected] => int(3)
}
[1] => object(Application_Model_GangMember)#91 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(8) "Custom 1"
["_cost":protected] => float(777)
["_qty":protected] => int(1)
}
}
}
[1] => object(Application_Model_Gang)#90 (3) {
["_id":protected] => int(2)
["_name":protected] => string(15) "Second Gang Name"
["_gangMembers":protected] => array(1) {
[0] => object(Application_Model_GangMember)#92 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(8) "Custom 1"
["_cost":protected] => float(777)
["_qty":protected] => int(2)
}
}
}
}
}
| oop | frameworks | zend | data-modeling | null | null | open | Calculating totals for complex models
===
All,
I'm developing an application using Zend Framework to manage tenders for construction work.
The tender will be a rather complex set of models with an architecture resembling the code snippet below.
My question is... should I store the total value of the tender as part of the tender model, or should I compute it each time it is required? The total value of the tender will be a sum of all the components (e.g. plant/labour/materials/overheads/etc).
object(Application_Model_Tender)#75 (4) {
["_id":protected] => int(1)
["_name":protected] => string(33) "Tender Name"
["_due":protected] => string(10) "2010-12-01"
["_labour":protected] => array(2) {
[0] => object(Application_Model_Gang)#81 (3) {
["_id":protected] => int(1)
["_name":protected] => string(25) "First Gang Name"
["_gangMembers":protected] => array(2) {
[0] => object(Application_Model_GangMember)#93 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(7) "Default"
["_cost":protected] => float(546)
["_qty":protected] => int(3)
}
[1] => object(Application_Model_GangMember)#91 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(8) "Custom 1"
["_cost":protected] => float(777)
["_qty":protected] => int(1)
}
}
}
[1] => object(Application_Model_Gang)#90 (3) {
["_id":protected] => int(2)
["_name":protected] => string(15) "Second Gang Name"
["_gangMembers":protected] => array(1) {
[0] => object(Application_Model_GangMember)#92 (5) {
["_id":protected] => NULL
["_name":protected] => string(11) "Labour Type"
["_workingPattern":protected] => string(8) "Custom 1"
["_cost":protected] => float(777)
["_qty":protected] => int(2)
}
}
}
}
}
| 0 |
11,305,182 | 07/03/2012 05:51:11 | 1,497,759 | 07/03/2012 05:07:54 | 1 | 0 | jquery_cookie plugin - not working on live site | I'm having a strange problem with jquery_cookie plugin when running it in my remote host server. This is the code.
<script src="/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="/jquery.cookie.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
$.cookie('test', 'hello');
var Cookie = $.cookie('test');
alert (Cookie);
});
</script>
This code works fine on local testing server, but when I upload it to the remote host server and run it there I get error: the $.cookie not a function in FF or the SCRIPT438: The object does not support the property or the method 'cookie' in ie9.
I just can't figure out where the problem is.
| javascript | jquery | cookies | null | null | 07/03/2012 14:01:16 | not a real question | jquery_cookie plugin - not working on live site
===
I'm having a strange problem with jquery_cookie plugin when running it in my remote host server. This is the code.
<script src="/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="/jquery.cookie.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
$.cookie('test', 'hello');
var Cookie = $.cookie('test');
alert (Cookie);
});
</script>
This code works fine on local testing server, but when I upload it to the remote host server and run it there I get error: the $.cookie not a function in FF or the SCRIPT438: The object does not support the property or the method 'cookie' in ie9.
I just can't figure out where the problem is.
| 1 |
5,294,191 | 03/14/2011 02:40:39 | 658,156 | 03/14/2011 02:40:39 | 1 | 0 | How to use webclient and debug and not get a targetinvocation exception? | I am debugging my silverlight app and have a webclient request that downloads a file say "www.blah.com/testfile.xml". I have the clientaccesspolicy.xml and crossdomain.xml files on the server so it works on the server just fine. When I debug the app on my local computer it generates a tagetinvocation exception. I put the clientaccesspolicy.xml and crossdomain.xml in my web project but this still generates this error when I am debugging. As a note when debugging I can see them on http://localhost/clientaccesspolicy.xml and http://localhost/crossdomain.xml, so I know they are in the right spot. Does anyone know how fix the exception? | silverlight | exception | target | invocation | null | null | open | How to use webclient and debug and not get a targetinvocation exception?
===
I am debugging my silverlight app and have a webclient request that downloads a file say "www.blah.com/testfile.xml". I have the clientaccesspolicy.xml and crossdomain.xml files on the server so it works on the server just fine. When I debug the app on my local computer it generates a tagetinvocation exception. I put the clientaccesspolicy.xml and crossdomain.xml in my web project but this still generates this error when I am debugging. As a note when debugging I can see them on http://localhost/clientaccesspolicy.xml and http://localhost/crossdomain.xml, so I know they are in the right spot. Does anyone know how fix the exception? | 0 |
9,452,117 | 02/26/2012 09:52:14 | 417,642 | 08/11/2010 19:12:00 | 50 | 7 | Where to purchase pre-built Linux laptops | I'm in the middle of purchasing a workstation for Linux development. I specifically want a pre-built linux machine rather than a laptop built for windows and then partitioned to have Linux installed on it.
I'm searching for a reliable merchant across the internet. I found linuxcertified.com. I have contacted them but haven't gotten a response. So I'm hoping to get help from SO should in case any one else is asking similar question or have a valid recommendation.
Thanks | linux | laptop | null | null | null | 02/26/2012 10:10:34 | off topic | Where to purchase pre-built Linux laptops
===
I'm in the middle of purchasing a workstation for Linux development. I specifically want a pre-built linux machine rather than a laptop built for windows and then partitioned to have Linux installed on it.
I'm searching for a reliable merchant across the internet. I found linuxcertified.com. I have contacted them but haven't gotten a response. So I'm hoping to get help from SO should in case any one else is asking similar question or have a valid recommendation.
Thanks | 2 |
2,781,993 | 05/06/2010 14:50:53 | 260,243 | 01/27/2010 16:10:45 | 13 | 0 | use admin functionality for a registered user to add products | I am developing a django project for auctions. I want to add the following functionality:
A registered and logged in user must add a product (I have accomplished registration and authentication). When this user clicks some /add/product/ or whatever link, I need to fetch the very admin-add-product template-interface (redirect maybe?), so that he adds a product as if he was admin.
How can I accomplish this?
I assume that a preliminary work/condition must be that when a user is registering, in some way he must automatically be granted the permission of adding products. So, how can this be done also? | django | null | null | null | null | 11/24/2011 00:23:45 | not a real question | use admin functionality for a registered user to add products
===
I am developing a django project for auctions. I want to add the following functionality:
A registered and logged in user must add a product (I have accomplished registration and authentication). When this user clicks some /add/product/ or whatever link, I need to fetch the very admin-add-product template-interface (redirect maybe?), so that he adds a product as if he was admin.
How can I accomplish this?
I assume that a preliminary work/condition must be that when a user is registering, in some way he must automatically be granted the permission of adding products. So, how can this be done also? | 1 |
8,530,772 | 12/16/2011 06:53:41 | 1,101,409 | 12/16/2011 06:50:49 | 1 | 0 | can open source CMS do this? | I would like to ask if there's an open source CMS out there that can do this...
Registered user can upload files (zip, rar, jpeg, png). Then at the frontend, it displays list of registered users with their uploaded files and has an option to download it?
if there is what CMS (if plugins needed) has this features?
thx. | wordpress | drupal | joomla | null | null | 05/22/2012 12:59:46 | off topic | can open source CMS do this?
===
I would like to ask if there's an open source CMS out there that can do this...
Registered user can upload files (zip, rar, jpeg, png). Then at the frontend, it displays list of registered users with their uploaded files and has an option to download it?
if there is what CMS (if plugins needed) has this features?
thx. | 2 |
11,185,228 | 06/25/2012 07:39:16 | 1,468,207 | 06/20/2012 05:42:52 | 1 | 0 | I am getting this error at runtime during run application | Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithUTF8String:]: NULL cString'
*** First throw call stack:
(0x15d9052 0x176ad0a 0x1581a78 0x15819e9 0x9ccd50 0x2e84 0x24d1 0x19964e 0xf9a73 0xf9ce2 0xf9ea8 0x100d9a 0x210e 0xd19d6 0xd28a6 0xe1743 0xe21f8 0xd5aa9 0x14c3fa9 0x15ad1c5 0x1512022 0x151090a 0x150fdb4 0x150fccb 0xd22a7 0xd3a9b 0x1e38 0x1d95)
terminate called throwing an exception(gdb) | iphone | iphone-sdk-4.0 | null | null | null | 06/25/2012 16:33:31 | not a real question | I am getting this error at runtime during run application
===
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithUTF8String:]: NULL cString'
*** First throw call stack:
(0x15d9052 0x176ad0a 0x1581a78 0x15819e9 0x9ccd50 0x2e84 0x24d1 0x19964e 0xf9a73 0xf9ce2 0xf9ea8 0x100d9a 0x210e 0xd19d6 0xd28a6 0xe1743 0xe21f8 0xd5aa9 0x14c3fa9 0x15ad1c5 0x1512022 0x151090a 0x150fdb4 0x150fccb 0xd22a7 0xd3a9b 0x1e38 0x1d95)
terminate called throwing an exception(gdb) | 1 |
11,232,205 | 06/27/2012 17:53:31 | 1,464,381 | 06/18/2012 17:32:22 | 11 | 1 | Regarding adding the statements at console | I have developed a Java Program that will count the number of files in the folder there may be java files of which it will count the number of lines of code and there may be text file of which also it will count the number of lines of code , the idea is to show at console the file name and followed by lines of code , which I have achieved..shown below
public class FileCountLine {
public static void main(String[] args) throws FileNotFoundException {
Map<String, Integer> result = new HashMap<String, Integer>();
File directory = new File("C:/Test/");
File[] files = directory.listFiles();
for (File file : files) {
if (file.isFile()) {
Scanner scanner = new Scanner(new FileReader(file));
int lineCount = 0;
try {
for (lineCount = 0; scanner.nextLine() != null; lineCount++);
} catch (NoSuchElementException e) {
result.put(file.getName(), lineCount);
}
}}
for( Map.Entry<String, Integer> entry:result.entrySet()){
System.out.println(entry.getKey()+" ==> "+entry.getValue());
}
}}
but rite now I have done the hard coding for the location of folder as shown
File directory = new File("C:/Test/");
Please advise I want this to be a Little bit interactive with the user that is it will prompt at the console to enter the location and when the location is entered by the user and press enter it will do the rest of the functionality as it is, please advise .
| java | null | null | null | null | 06/28/2012 00:26:48 | not a real question | Regarding adding the statements at console
===
I have developed a Java Program that will count the number of files in the folder there may be java files of which it will count the number of lines of code and there may be text file of which also it will count the number of lines of code , the idea is to show at console the file name and followed by lines of code , which I have achieved..shown below
public class FileCountLine {
public static void main(String[] args) throws FileNotFoundException {
Map<String, Integer> result = new HashMap<String, Integer>();
File directory = new File("C:/Test/");
File[] files = directory.listFiles();
for (File file : files) {
if (file.isFile()) {
Scanner scanner = new Scanner(new FileReader(file));
int lineCount = 0;
try {
for (lineCount = 0; scanner.nextLine() != null; lineCount++);
} catch (NoSuchElementException e) {
result.put(file.getName(), lineCount);
}
}}
for( Map.Entry<String, Integer> entry:result.entrySet()){
System.out.println(entry.getKey()+" ==> "+entry.getValue());
}
}}
but rite now I have done the hard coding for the location of folder as shown
File directory = new File("C:/Test/");
Please advise I want this to be a Little bit interactive with the user that is it will prompt at the console to enter the location and when the location is entered by the user and press enter it will do the rest of the functionality as it is, please advise .
| 1 |
6,111,587 | 05/24/2011 13:59:12 | 754,336 | 05/15/2011 09:03:59 | 108 | 1 | How to process a multiline string line at a time | I'd like to get a substring between two delimiters (regexes) from a string. I want to use this:
while (<>) {
if (/START/../END/) {
next if /START/ || /END/;
print;
}
}
But this works on lines of stdin. I'd like make it work on lines of a string. How? | perl | string | null | null | null | null | open | How to process a multiline string line at a time
===
I'd like to get a substring between two delimiters (regexes) from a string. I want to use this:
while (<>) {
if (/START/../END/) {
next if /START/ || /END/;
print;
}
}
But this works on lines of stdin. I'd like make it work on lines of a string. How? | 0 |
7,512,811 | 09/22/2011 09:49:27 | 192,023 | 10/18/2009 14:34:28 | 19 | 3 | Enterprise Web Applications: supported browsers | Would it be acceptable for a developer of an enterprise web application to only support certain versions of a web browser?
Because of the crappy nature of Internet Explorer and some extensive AJAX/javascript usage we would only like to support IE9. Behaviour between IE7, IE8 and IE9 is extremely inconsistent. We could make everything work in IE7 and ask this behaviour of IE8 and 9, but that would require tremendous changes to our code to support Firefox & Chrome.
Neither Firefox nor Chrome are this picky between versions.
Would this be something that is acceptable for clients? | enterprise | support | null | null | null | 09/22/2011 16:58:35 | not constructive | Enterprise Web Applications: supported browsers
===
Would it be acceptable for a developer of an enterprise web application to only support certain versions of a web browser?
Because of the crappy nature of Internet Explorer and some extensive AJAX/javascript usage we would only like to support IE9. Behaviour between IE7, IE8 and IE9 is extremely inconsistent. We could make everything work in IE7 and ask this behaviour of IE8 and 9, but that would require tremendous changes to our code to support Firefox & Chrome.
Neither Firefox nor Chrome are this picky between versions.
Would this be something that is acceptable for clients? | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.