i want to check select statement(string) is valid or not in c#.net, if select statement is right then retrieve data and fill dropdown list box else drop down should be empty
I want to build a regex that matches PHP-style error messages in HTML source code.
Does anybody know of one that exists or how I can create a list of possible PHP error outputs?
So guys, there's plenty of different ciphers available - but which one is the safest to use nowadays?
List: http://www.php.net/manual/en/mcrypt.ciphers.php
I am writing a driver to act as a wrapper around two separate MySQL connections (to distributed databases). Basically, the goal is to enable interaction with my driver for all applications instead of requiring the application to sort out which database holds the desired data.
Most of the code for this is in place, but I'm having a problem in that when I attempt to create connections via the MySQL Driver, the DriverManager is returning an instance of my driver instead of the MySQL Driver. I'd appreciate any tips on what could be causing this and what could be done to fix it!
Below is a few relevant snippets of code. I can provide more, but there's a lot, so I'd need to know what else you want to see.
First, from MyDriver.java:
public MyDriver() throws SQLException
{
DriverManager.registerDriver(this);
}
public Connection connect(String url, Properties info)
throws SQLException
{
try { return new MyConnection(info); }
catch (Exception e) { return null; }
}
public boolean acceptsURL(String url)
throws SQLException
{
if (url.contains("jdbc:jgb://"))
{ return true; }
return false;
}
It is my understanding that this acceptsURL function will dictate whether or not the DriverManager deems my driver a suitable fit for a given URL. Hence it should only be passing connections from my driver if the URL contains "jdbc:jgb://" right?
Here's code from MyConnection.java:
Connection c1 = null;
Connection c2 = null;
/**
*Constructors
*/
public DDBSConnection (Properties info)
throws SQLException, Exception
{
info.list(System.out); //included for testing
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url1 = "jdbc:mysql://server1.com/jgb";
String url2 = "jdbc:mysql://server2.com/jgb";
this.c1 = DriverManager.getConnection(
url1, info.getProperty("username"), info.getProperty("password"));
this.c2 = DriverManager.getConnection(
url2, info.getProperty("username"), info.getProperty("password"));
}
And this tells me two things. First, the info.list() call confirms that the correct user and password are being sent. Second, because we enter an infinite loop, we see that the DriverManager is providing new instances of my connection as matches for the mysql URLs instead of the desired mysql driver/connection.
FWIW, I have separately tested implementations that go straight to the mysql driver using this exact syntax (al beit only one at a time), and was able to successfully interact with each database individually from a test application outside of my driver.
I'm opening a 2005 SSIS pakage and also an old C# project..both are in this solution here. I'm missing namespaces and I can't find the assemblies to add back to my references folder for my C# Project
Microsoft.SqlServer.Dts.Pipeline
for example is not one I find in the list of references in the .NET references tab. So how the hell do I get these SQL Server assemblies? Do I have to install the SQL Server 2008 sdk?
Lost.
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext import db
from google.appengine.api import urlfetch
class TrakHtml(db.Model):
hawb = db.StringProperty(required=False)
htmlData = db.TextProperty()
class MainHandler(webapp.RequestHandler):
def get(self):
Traks = list()
Traks.append('93332134')
#Traks.append('91779831')
#Traks.append('92782244')
#Traks.append('38476214')
for st in Traks :
trak = TrakHtml()
trak.hawb = st
url = 'http://etracking.cevalogistics.com/eTrackResultsMulti.aspx?sv='+st
result = urlfetch.fetch(url)
self.response.out.write(result.read())
trak.htmlData = result.read()
trak.put()
result.read() is not giving whole file , it giving some portion. trak.htmlData is a textproparty() so it have to store whole file and i want that only
Hello, I have a listview with a custom BaseAdapter. Each row of the listview has a TextView and a CheckBox.
The problem is when I click (or touch) any row, the textview foreground becomes gray, instead of the default behavior (background - green, textview foreground - white).
Here is the code:
row.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/layout">
<TextView android:id="@+id/main_lv_item_textView"
style="@style/textViewBig"
android:layout_alignParentLeft="true"/>
<CheckBox android:id="@+id/main_lv_item_checkBox"
style="@style/checkBox"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"/>
</RelativeLayout>
Custom Adapter:
public class CustomAdapter extends BaseAdapter {
private List<Profile> profiles;
private LayoutInflater inflater;
private TextView tvName;
private CheckBox cbEnabled;
public CustomAdapter(List<Profile> profiles) {
this.profiles = profiles;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return profiles.size();
}
public Object getItem(int position) {
return profiles.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent) {
View row = inflater.inflate(R.layout.main_lv_item, null);
final Profile profile = profiles.get(position);
tvName = (TextView) row.findViewById(R.id.main_lv_item_textView);
registerForContextMenu(tvName);
cbEnabled = (CheckBox) row.findViewById(R.id.main_lv_item_checkBox);
tvName.setText(profile.getName());
if (profile.isEnabled()) {
cbEnabled.setChecked(true);
}
tvName.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString(PROFILE_NAME_KEY, profile.getName());
Intent intent = new Intent(context, GuiProfile.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
tvName.setOnLongClickListener(new OnLongClickListener() {
public boolean onLongClick(View v) {
selectedProfileName = ((TextView) v).getText().toString();
return false;
}
});
cbEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (!profile.isEnabled()) {
for (Profile profile : profiles) {
if (profile.isEnabled()) {
profile.setEnabled(false);
Database.getInstance().storeProfile(profile);
}
}
}
profile.setEnabled(isChecked);
Database.getInstance().storeProfile(profile);
updateListView();
}
});
return row;
}
}
Any help would be appreciated.
I have a panel which contains a TableLayoutPanel which itself contains a number of ListViews and Labels.
What I'd like is for each list view to resize to fit all of it's contents in vertically (i.e. so that every row is visible). The TableLayoutPanel should handle any vertical scrolling but I can't work out how to get the ListView to resize itself depending on the number of rows.
Do I need to handle OnResize and manually resize or is there already something to handle this?
I am developing the web site, It consists of device name list and related Build Button. When one click the Build button the one process will run in server. When more than ten user click the Build button more processes will create at that server will hang. How can send all request from client to single process in server.
The scenario is I want to get the users who has less than 2 photos.
There are two table:
[Users] (UserId, UserName)
[UserPhotos] (PhotoId, PhotoName, UserId)
UserId is a Foreign Key but I do not want to use association like user.Photos.
A user may have none photo in the [UserPhotos] table.
How to use Linq To Sql to get List<User> who has less than 2 photos?
Hello
I want to attach to a running process using 'ddd', what I manually do is:
# ps -ax | grep PROCESS_NAME
Then I get a list and the pid, then I type:
# ddd PROCESS_NAME THE_PID
Is there is a way to type just one command directly?
Remark: When I type ps -ax | grep PROCESS_NAME <- grep will match both the process and grep command line itself.
How can i return Last Insert Id on my store procedure using MySQL and use them with Nhibernate?
When i am inserting recording using Nhibernate + mysql store procedure then i am getting error that result not found
IQuery qry = session.CreateSQLQuery(string.Format("{0})", qryString)).AddScalar("ProductID", NHibernateUtil.Int32);
qry.List();
tx.Commit();
<select><option><input type="checkbox" />Headache</option></select>
By using the above code i did't get a check box inside a combo box list.Can you suggest me , how should i proceed.
I have two data grids. The first auto-loads a list of items (json data store). OnCellClick the first grid fires a dynamically parametrized url and loads data into the second grid. It works fine, but the pagination of the second grid does not focus the new context.
What shall I do to make the pagination work with the new url?
I just want to copy list of files displayed in eclipse search tab,
When i try using right click copy and paste into some folder it does not work.It actually copies the file location rather than the file itself
Hi All,
I have just taken over as manager at a company and at the moment they are very rigid in how they approach development. Everyone gets a list of what they are doing each week. My question is how does your company balance support with development and if an important support request comes in how is this processed without disturbing the flow of the developers?
Lastly, do you use an software log support requests and development tasks.
Thanks
Hi!
I have a static library static_library.a
How to list functions and methods realized there.
or at least how to look is there concrete function 'FUNCTION_NAME' realized?
In a single-module project, I don't see how to get a 'classified' artifact from the project itself into the descriptor and thus the assembly. Do I list it as a dependency?
I have a list of directories
/home
/dir1
/dir2
...
/dir100
Some of them have no files in it. How can I use Unix find to do it?
I tried
find . -name "*" -type d -size 0
Doesn't seem to work.
I've a hard time understanding signs I see in my text editor vim. I see signs like ^@ and ^A and ^M and ^F. What does this mean? Is there any structured list of these signs and their meaning?
Trying to Google it is a dead end since Google will not search for "^@".
Hey guys, there is a form where the user select some of his friends and I'm curious on how I can implement a list that searches simultaneously while the user is typing a friend's name and when he selects the name the name is written in the text box(jQuery). And if the user wants to select more than one friend, when I'm inserting the names in the database, how can I separate the names that are written in one input field?
Hello Folks,
I am trying to develop a application where
The user 'X' has logged into Facebook
app has a set of email addresses (possible friends of user 'X')
app gets the list of friends of user 'X' (uids)
Want to check if user with email address [email protected] is a valid facebook user by using email address and is user X's friend (basically a uid to email mapping)
Thanks!
I have the following model:
class Service(models.Model):
ratings = models.ManyToManyField(User)
Now if I wanna get all the service with ratings sorted in descending order I did something:
services_list = Service.objects.filter(ratings__gt=0).distinct()
services_list = list(services_list)
services_list.sort(key=lambda service: service.ratings.all().count(), reverse=True)
As you can see its a three step process and I don't feel right about this. Anybody who knows a better way to do this?
For a table in oracle, I can query "all_tab_columns" and get table column information, like the data type, precision, whether or not the column is nullable.
In SQL Developer or TOAD, you can click on a view in the GUI and it will spit out a list of the columns that the view returns and the same set of data (data type, precision, nullable, etc).
So my question is, is there a way to query this column definition for a view, the way you can for a table? How do the GUI tools do it?
I'm creating a digg-like site using Ruby on Rails that ranks the item (based on this algorithm). I'm using the will-paginate gem list the items in pages.
The problem is, will-paginate only allows me to insert ':order =' based on the table data. I would like to make will-paginate to sort by a number which is calculated using a function based on different fields on the table (e.g number of votes, age hours).
How can I do that?