I am facing severe problem with JDBC ,converting string to integer.
String query = "Select F2, F3, F4 from myTable ORDER BY {fn CONVERT(INT,F4)}" ;
error: Syntax error in ORDER By clause;
I often program outside away from power, how can I extend the battery life in my laptop to let me program longer without having to "return to base"
Specifically for a MacBook Pro.
This is the new version being used by wordpress...
RewriteEngine On
RewriteBase BASE/
#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
What would it look like in Nginx?
Running XSD.exe on my xml to generate C# class. All works well except on this property
public DocumentATTRIBUTES[][] Document {
get {
return this.documentField;
}
set {
this.documentField = value;
}
}
I want to try and use CollectionBase, and this was my attempt
public DocumentATTRIBUTESCollection Document {
get {
return this.documentField;
}
set {
this.documentField = value;
}
}
/// <remarks/>
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class DocumentATTRIBUTES
{
private string _author;
private string _maxVersions;
private string _summary;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string author
{
get
{ return _author; }
set { _author = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string max_versions
{
get { return _maxVersions; }
set { _maxVersions = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string summary
{
get { return _summary; }
set { _summary = value; }
}
}
public class DocumentAttributeCollection : System.Collections.CollectionBase
{
public DocumentAttributeCollection() : base() { }
public DocumentATTRIBUTES this[int index]
{
get
{
return (DocumentATTRIBUTES)this.InnerList[index];
}
}
public void Insert(int index, DocumentATTRIBUTES value)
{
this.InnerList.Insert(index, value);
}
public int Add(DocumentATTRIBUTES value)
{
return (this.InnerList.Add(value));
}
}
However when I try to serialize my object using
XmlSerializer serializer = new XmlSerializer(typeof(DocumentMetaData));
I get the error:
{"Unable to generate a temporary class (result=1).\r\nerror CS0030:
Cannot convert type 'DocumentATTRIBUTES' to 'DocumentAttributeCollection'\r\nerror CS1502: The best overloaded method match for 'DocumentAttributeCollection.Add(DocumentATTRIBUTES)' has some invalid arguments\r\nerror CS1503: Argument '1': cannot convert from 'DocumentAttributeCollection' to 'DocumentATTRIBUTES'\r\n"}
the XSD pertaining to this property is
<xs:complexType>
<xs:sequence>
<xs:element name="ATTRIBUTES" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="author" type="xs:string" minOccurs="0" />
<xs:element name="max_versions" type="xs:string" minOccurs="0" />
<xs:element name="summary" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
I have an issue with the Windows Forms PropertyGrid control. I have customized the PropertyGrid control and override only OnPaint function.
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
In my application I have few more controls (treeview, custom control and few form controls). When I mouseclick on the PropertyGrid control, the paint function in all the controls in the screen are being called continuously and the treeview starts flickering. This happens only in mouseclick event.
Thank you in advance. I need to get data from the serial port of a linux system and convert it to TCP/IP to send to a server. Is this difficult to do? I have some basic programming experience but not much experience with Linux. Are there any open source applications that do this?
Again thank you for any help.
I'm trying to compare two booleans :
(if (equal? #f (string->number "123b"))
"not a number"
"indeed a number")
When I run this in the command line of DrRacket I get "not a number" , however , when I
put that piece of code in my larger code , the function doesn't return that string ("not a number") , here's the code :
(define (testing x y z)
(define badInput "ERROR")
(if (equal? #f (string->number "123b"))
"not a number"
"indeed a number")
(display x))
And from command line : (testing "123" 1 2)
displays : 123
Why ?
Furthermore , how can I return a value , whenever I choose ?
Here is my "real" problem :
I want to do some input check to the input of the user , but the thing is , that I want to
return the error message if I need , before the code is executed , because if won't - then I would run the algorithm of my code for some incorrect input :
(define (convert originalNumber s_oldBase s_newBase)
(define badInput "ERROR")
; Input check - if one of the inputs is not a number then return ERROR
(if (equal? #f (string->number originalNumber))
badInput)
(if (equal? #f (string->number s_oldBase))
badInput)
(if (equal? #f (string->number s_newBase))
badInput)
(define oldBase (string->number s_oldBase))
(define newBase (string->number s_newBase))
(define outDecimal (convertIntoDecimal originalNumber oldBase))
(define result "") ; holds the new number
(define remainder 0) ; remainder for each iteration
(define whole 0) ; the whole number after dividing
(define temp 0)
(do()
((= outDecimal 0)) ; stop when the decimal value reaches 0
(set! whole (quotient outDecimal newBase)) ; calc the whole number
(set! temp (* whole newBase))
(set! remainder (- outDecimal temp)) ; calc the remainder
(set! result (appending result remainder)) ; append the result
(set! outDecimal (+ whole 0)) ; set outDecimal = whole
) ; end of do
(if (> 1 0)
(string->number (list->string(reverse (string->list result)))))
) ;end of method
This code won't work since it uses another method that I didn't attach to the post (but it's irrelevant to the problem . Please take a look at those three IF-s ... I want to return "ERROR" if the user put some incorrect value , for example (convert "23asb4" "b5" "9")
Thanks
I'm new to rails and have some troubles with creating a nested form.
My models:
class User < ActiveRecord::Base
belongs_to :company
accepts_nested_attributes_for :company, :reject_if => :all_blank
end
class Company < ActiveRecord::Base
has_many :users
end
Now i would like to create a new company from the user sign_up page (i use Devise btw) by given only a company name. And have a relation between the new User and new Company.
In the console i can create a company for a existing User like this:
@company = User.first.build_company(:name => "name of company")
@company.save
That works, but i can't make this happen for a new user, in my new user sign_up form i tried this (i know its wrong by creating a new User fist but im trying to get something working here..):
<%= simple_form_for(resource, :as => resource_name, :html => { :class => 'form-horizontal' }, :url => registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="inputs">
<%
@user = User.new
company = @user.build_company()
%>
<% f.fields_for company do |builder| %>
<%= builder.input :name, :required => true, :autofocus => true %>
<% end %>
<%= f.input :email, :required => true, :autofocus => true %>
<%= f.input :password, :required => true %>
<%= f.input :password_confirmation, :required => true %>
</div>
<div class="form-actions">
<%= f.button :submit, :class => 'btn-primary', :value => 'Sign up' %>
</div>
I did my best to google for a solution/ example.. found some nested
form examples but it's just not clear to me how to do this.
Really hope somebody can help me with this. Any help on this would be appreciated.
Thanks in advance!
Greets, Daniel
Hi There I wish to convert my string in format dd/mm/yyyy hh:mm:ss to a DateTime of the same format.
Dim ukCulture As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-GB")
Dim myDateTime As DateTime
myDateTime = DateTime.ParseExact("18/05/2010 23:42:10, "dd/MM/yyyy HH:mm:ss", ukCulture)
When I step through this code the variable myDateTime is 05/18/2010 23:42:10 it appears that the dd/mm is the wrong way around and I cant work out how to correct this. Can ayone offer any guidance on how to correct this please?
Hi, i bought a web domain with some web space. They support only mySQL DB, how do i access the my SQL DB on my asp.net application? is there is way to access it through .net base classes without installing third party drivers?
I assume I would need a special centronics cable to do this, but is it possible to get the print data from the remote device and convert it to a image file in .Net?
thanks,
Jason
I'm trying to run through this msdn article:
http://msdn.microsoft.com/en-us/library/dd723645.aspx
One of the steps is:
In the class file for the page, change the base class from UserControl to EntityTemplateUserControl.
Nowhere is it made clear what page is being referenced. Can someone help me? I don't see any relevant class in the pages I have, so I assumed maybe they were talking about the ascx and didn't really mean page, but I'm not seeing an option there either.
Hi, this is my first time using stackoverflow. pretty thrilled. lol
anyway, there are hell of a lot books there to teach you C++. But i was wondering whats the best well-known book to pick?
I have pretty solid base in programming and I just wanna go over it fast.
so any recommendations?! sorry for the cheesy question!
I writting an application which is using WebClient class.
Adding something like that:
ExC.Headers.Add("Accept-Encoding: gzip, deflate");
where ExC is:
class ExWebClient1 : WebClient
{
protected override WebRequest GetWebRequest(Uri address)
{
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
return request;
}
}
It will be a diffrence in speed when i will be using encoded response?
How can I localize/internationalize attribute values in .NET?
My specific example is for ASP.NET web parts such as WebDisplayName, WebDescription, etc. where I inherit from the base class that uses these attributes.
Also, is there any difference to doing this with attributes declared in my own classes?
Thanks!
Hi All,
I found this implementation, and i am not sure whether we can use this implementation and apple will bye-pass extra check, this is a base-64 implementation.
The source code link is
http://blog.objectgraph.com/wp-content/uploads/2010/04/CryptTest.zip
The web page link is : http://blog.objectgraph.com/index.php/2010/04/20/encrypting-decrypting-base64-encode-decode-in-iphone-objective-c/
Kindly advice me friends.
I've been using Python for quite a while now, and I'm still unsure as to why you would subclass from object. What is the difference between this:
class MyClass():
pass
And this:
class MyClass(object):
pass
As far as I understand, object is the base class for all classes and the subclassing is implied. Do you get anything from explicitly subclassing from it? What is the most "Pythonic" thing to do?
I want to view events over specific time range for a specific calendar, but am having trouble using the API, It is a generic API, and it reminds me of using the DOM. The problem is that it seems difficult to work with because much of the information is in generic base classes.
How do I get the events for a calendar using Groovy or Java?
Does anybody have an example of passing credentials using curl?
Example code would be appreciated.
I am trying to make a program that can convert a series of manga scans into one pdf file, and I don't want to have to attempt to download the picture to determine if I have the right url. Is there a shell scripting command that I can use to just check if a web page exists?
hi!
Is there a way to insert only date in a datetime column in sql server without the time?
for example
date (datetime)
===============
12-01-2000
16-02-2000
or i should store this as a varchar and cast it when retriving so that i can convert to whatever form i need.
Im trying to display a loading gif before submitting a multipart-form (file upload), this is my code.. but the image is not displaying.. if i remove the submit() it displays, so.. is not a path or syntax problem.
$('#btnSubmit').click(function() {
document.getElementById('loader').innerHTML = "<img src='<?= url::base() ?>themes/img/loading.gif' border='0' />";
$('#uploadform').submit();
});
I have a list containing a tuples and long integers the list looks like this:
table = [(1L,), (1L,), (1L,), (2L,), (2L,), (2L,), (3L,), (3L,)]
How do i convert the table to look like a formal list?
so the output would be:
table = ['1','1','1','2','2','2','3','3']
For information purposes the data was obtained from a mysql database.