How can I validate a form using regex in codeiginiter. I'd like to check the input against:
^([0-1][0-9]|[2][0-3]):([0-5][0-9])$
I'm assuming the best way is in some sort of callback. I tried a bunch of ideas on the web but I can't seem to get any working.
How would you save this data on a database: An user can make phone calls (id, date, hour, duration, outcome).
The "outcome" can be, for example, to recall the client on another day (so I have to save the date, the hour, etc of this "future" call).
How would you manage this data on a db?
At the moment i have only a "Call" table.
Is there a "best practice" for placing Javascript code when you have many partial views and JS code that's specific to them?
I feel like I'm creating a maintenance nightmare by having many partial views and then a bunch of independent Javascript files for them which need to be synced up when there is a partial view change. It appears, for maintenance purposes, better to me to put the JS code with the partial view. But then I'm violating generally accepted practices that all JS code should be at the bottom of the page and not mixed in, and also I'd end up with multiple references to the same JS file (as I'd include a reference in each ASCX for intellisense purposes).
Does anyone have a better idea? Thank you!
I am writing an embedded application in which I need to display a digit on LCD.
There must be some pre-existing libraries available doing the same. Or is there some reference code in C-language that could be referred?
Microcontroller is ARM based LPC2378.
Hi all,
I have a fairly simple question: In Javascript how can I return the boolean (if its found in the JSON) rather than the actual value?
Example:
var myJSON = {
"foo" : "bar",
"bar" : "foo"
};
var keyToLookFor = "foo";
var found = myJSON[keyToLookFor];
if (found) {
// I know I can test if the string exists in the if
}
// but is there a way I could just return something like:
return found;
// instead of testing found in the if statement and then returning true?
Hi guys, basically I want my JFrame to become a completely new JFrame object when an event is triggered. I have some code that basically calls [CODE]GUI gui = new GUI(x, y)[/CODE]
the only problem I'm having is that as well as creating the new GUI object, it is not deleting the old window. Can anyone tell me how to get rid of the old window.
Thanks.
I have a code:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Alt|Keys.D1:
if (this._condition1)
{
return true;
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
break;
case Keys.Control |Keys.U:
if (this._condition2)
{
return true;
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}
return true;
It gives me "unreachable code detected" warning on breaks.
Is it good practice not to use break operator here ? I don't want to turn off "unreachable code detected" warning.
PS: There are many case in my ProcessCmdKey method.
Using WATIR and Excel, I'd like to take the first row of a table in Excel, visit the URL, then set the 12th link on the page as a variable in the cell next to the cell with the URL, then go to the next line and repeat.
I'm stuck on getting the URL of the 12th link on the page to set as a variable that I can feed into the next cell in Excel. Here's what I have and it's not working.
worksheet = workbook.WorkSheets(1) # get first workbook
#declare test site
test_site = worksheet.Range("a2").text
#open ie
ie = Watir::IE.new
#go to test_site
ie.goto test_site
#find primlink
ie.link(:index, 12).text = "primlink"
puts primlink
Any ideas?
I have a large table (300 million lines) that I would like to dump to a csv - I need to do some processing that cannot be done with SQL. Right now I am using Squirrel as a client, and it does not apparently deal very well with large datasets - at least as far as I can tell from my own (limited) experience. If I run the query on the actual host, will it use less memory? Thanks for any help.
Hello all,
IE is giving me a permission denied error when I use window.open to open a window from a browser button. I do not get the error in Firefox or Chrome. What do I do?
The code:
<button type="button" onClick="window.open('https://www.example.com','newWindow');">
My button
</button>
I am not usually a Smarty guy, so I'm a bit stuck.
I want to echo the index of an array, but I want to increment it each time I echo it.
This is what I have...
<ul>
{foreach from=$gallery key=index item=image}
<li>
<img src="{$image}" alt="" id="panel-{$index++}" />
</li>
{/foreach}
</ul>
It doesn't work.
Is the best way to do this to pre-process the array before handing it to Smarty?
Is there a way I can do this using Smarty?
I am writing a java servlet (struts/JSP etc). I am trying to style a progress bar using CSS in a JSP page but get this error when using chrome's developer tools:
Resource interpreted as image but transferred with MIME type text/plain.
<%@ include file="../include/css/default.css" %
And in the CSS file:
background:url(../images/bg_bar.gif) no-repeat 0 0;
Could anyone explain why this is and show how I can use this CSS in my page?
Right now, the text seems not to be exactly vertical centered.
It seems that there is more top-padding than bottom-padding.
Although of course, there is no padding in the CSS. How do I make this completely vertical aligned?
I have a web application made for several groups of people not connected with each other. Instead of using one database for all of them, I'm thinking about making separate databases.
This will improve the speed of the queries and make me free from checking to what group the user belongs.
But since I'm working with LINQ to SQL, my classes are explicitly connected with the databases, so I will have to make separate DataContexts for all of the databases.
So how can I solve this problem? Or should I just not bother and use one database only?
Hi Guys: This one is driving me crazy. When I run my App and open the Debug Console there is nothing there! Nope, not even the output from my NSLog statements. Before I would see a bunch of debug information starting with [Session Started ...] and ending with 'Terminating in response to SpringBoard's termination'. The Status Bar at the bottom of the Console says my App was successfully launched. Even Errors and Warnings from my code no longer appear. How do I get this to show up again? Any help would be greatly appreciated.
Hi.
I want to have a LinkButton that adds 'span' tag around the text.
protected override void Render(HtmlTextWriter writer)
{
Text = String.Concat("<span>", Text, "</span>");
base.Render(writer);
}
It's works perfectly, but only if I add text like this:
<cc:TestLinkButton ID="TestLinkButton" runat="server" Text="SomeText">
</cc:TestLinkButton>
If I want to add some image I will write something like this:
<cc:TestLinkButton ID="LinkButton1" runat="server">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/icon_holiday.png" BorderWidth="0" />
SomeText
</cc:TestLinkButton>
In this case Text property will be empty, because actualy "SomeText" is child control property.
So question is is how to add tag around child controls.
Hey guys,
If I have an array structured like this:
$array[index]['first_name']
$array[index]['last_name']
Is there an easy way to implode it into something like first_name last_name,first_name last_name, etc. for all the indices?
Implode didn't seem to do what I wanted for something like this. Currently I'm just looping over the whole thing, but it's a SIGNIFICANT bottleneck.
I'm using sqlite for the persistent store, so could I just upload the .sqlite file to, for example, Amazon S3 as a way of providing users with the ability to backup their app data?
Then for restoring just download it back and replace the existing .sqlite file in the app's folder.
Does anybody see any issues with that? Has anyone done it? Any other suggestions on how to implement data backup feature?
In a Windows forms application, within a DataGridView, I have 4 different DataGridCombobox controlshow can I set up the handler SelectedIndexChanged handler for the first combobox via the EditingControlShowing event. I added code for a second combobox but the SelectedIndexChanged didn't get wired up.
Here's my code. Any advice would be appreciated.
private ComboBox countryCombo;
private EventHandler countryHandler;
private ComboBox partCombo;
private EventHandler partHandler;
private void dataGridView2_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
countryCombo = e.Control as ComboBox;
if (countryCombo != null)
{
//remove any existing handler if there is one
countryCombo.SelectedIndexChanged -= countryHandler;
//add the new handler
countryCombo.SelectedIndexChanged += new EventHandler(countryCombo_SelectedIndexChanged);
}
if (partCombo != null)
{
partCombo.SelectedIndexChanged -= partHandler;
partCombo.SelectedIndexChanged += new EventHandler(partCombo_SelectedIndexChanged);
}
}
private void countryCombo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox box = (ComboBox) sender;
//MessageBox.Show(box.Items.Count.ToString());
int rowNum = dataGridView2.CurrentCell.RowIndex;
dataGridView2.BeginEdit(false);
dataGridView2.Rows[0].Cells[2].Value = "abcdef";
dataGridView2.EndEdit();
}
private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
int cellColumn = e.ColumnIndex;
//MessageBox.Show("Column is: " + cellColumn.ToString());
}
private void partCombo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox box = (ComboBox)sender;
string partNumber = box.SelectedValue as string;
// ToDo: now we need to get the HTSUS from the database so we can
//populate the field
int rowNum = dataGridView2.CurrentCell.RowIndex;
dataGridView2.BeginEdit(false);
dataGridView2.Rows[0].Cells[2].Value = "abcdef";
dataGridView2.EndEdit();
}
}
Al D.
I played with HttpRequest and realized that the memory is not cleaned up after any request.
After some time the running tab within Chrome will crash.
Here is some testing code. Put a large sized file into the 'www' directory and set the URL in the code accordingly.
import 'dart:async';
import 'dart:html';
void main() {
const PATH = "http://127.0.0.1:3030/PATH_TO_FILE";
new Timer.periodic(new Duration(seconds:10), (Timer it)=>getString(PATH));
}
void getString( String url){
HttpRequest.getString(url).then((String data){
});
}
Is this really a bug or did I something wrong?
I'm trying to do something like this:
private class aClass
{
private ArrayList<String> idProd;
aClass(ArrayList<String> prd)
{
this.idProd=new ArrayList<String>(prd);
}
public ArrayList<String> getIdProd()
{
return this.idProd;
}
}
So if I have multiple instances of ArrayLIst<String> (st1 ,st2 ,st3) and I want to make new objects of aClass:
{
aClass obj1,obj2,obj3;
obj1=new aClass(st1);
obj2=new aClass(st2);
obj3=new aClass(st3);
}
Will all of the aClass objects return st3 if I access the method getIdProd() for each of them(obj1..obj3)? Is an ArrayList as an instance variable automatically declared static?