for example. if i want to quickly wrap anything by this in once.
<div class="one">
<div class="two">
anything can be here - content, other html tag etc.
</div>
</div>
I am creating a report from Ruport and want to be able to take the grouping heading, in this case the ID for the class Email, and wrap a method around it and a link_to to link to the Email view based on the email_id:
@table = ContactEmail.report_table(:all,
:conditions => ['date_sent >= ? and date_sent <= ?', @monday, @friday])
@grouping = Grouping(@table, :by => "email_id")
How do I do that? It feels as if I have little control over the output.
In Vi / Vim you can move to a bracket and press % and the editor would move the cursor to the matching bracket. This saved large amounts of time when moving around the large files in the editor. Is there a Visual Studio equivalent?
print '<div id="wrap">';
print "<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
for($i=0; $i<count($news_comments); $i++)
{
print '
<tr>
<td width="30%"><strong>'.$news_comments[$i]['comment_by'].'</strong></td>
<td width="70%">'.$news_comments[$i]['comment_date'].'</td>
</tr>
<tr>
<td></td>
<td>'.$news_comments[$i]['comment'].'</td>
</tr>
';
}
print '</table></div>';
$news_comments is a 3 diemensional array from mysqli_fetch_assoc returned from a function elsewhere, for some reason my for loop returns the total of the array sets such as [0][2] etc until it reaches the max amount from the counted $news_comments var which is a return function of LIMIT 10. my problem is if I add any text/html/icons inside the for loop it prints it in this case 11 times even though only array sets 1 and 2 have data inside them. How do I get around this?
My function query is as follows:
function news_comments()
{
require_once '../data/queries.php';
// get newsID from the url
$urlID = $_GET['news_id'];
// run our query for newsID information
$news_comments = selectQuery('*', 'news_comments', 'WHERE news_id='.$urlID.'', 'ORDER BY comment_date', 'DESC', '10'); // requires 6 params
// check query for results
if(!$news_comments)
{
// loop error session and initiate var
foreach($_SESSION['errors'] as $error=>$err)
{
print htmlentities($err) . 'for News Comments, be the first to leave a comment!';
}
}
else
{
print '<div id="wrap">';
print "<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"3\">";
for($i=0; $i<count($news_comments); $i++)
{
print '
<tr>
<td width="30%"><strong>'.$news_comments[$i]['comment_by'].'</strong></td>
<td width="70%">'.$news_comments[$i]['comment_date'].'</td>
</tr>
<tr>
<td></td>
<td>'.$news_comments[$i]['comment'].'</td>
</tr>
';
}
print '</table></div>';
}
}// End function
Any help is greatly appreciated.
Trying to wrap my head around perl's Autovivification and based on what it sounds like, It seems to work similar to dynamics in C# as a dynamic object is not assigned a type until runtime or, am I totally off here. If so then is there a comparable idea that I can bridge off of in C# that makes sense?
Edit
Okay so I'm apparently way off. So as second part of the 2 part question, is there anything conceptually comparable in C#?
it's annoying how sqlite always returns a list of touples! i can see the why this is necessary, but when i am querying a single column, how do i get a plain list?
e.g cursor.fetchall() returns [(u'one',), (u'two',), (u'three',)]
from this, how do i get the simple list [u'one', u'two', u'three']?
how do i make the div refresh, say after 10 secs and execute the run_query() function without clicking on the button?
<script src="scripts/ajax.js" type="text/javascript"></script>
<div id="quote"><strong>Quote of the Day</strong></div>
<div><a style="cursor:pointer" onclick="run_query()">Next quote …</a></div>
in word document i want that if two lines are there with some space b/t them if i press enter then there space shld'nt get change?
for ex:
2 lines r as like:
Q1: what is ur name?
Q2: r u on time?
then space between Q1: and Q2: line shld'nt be change if some one press enter having cursor between the two of the lines.
what shld i do?
Hi guys,
I hope you can help me with this problem :). I'm looking for a script which allows me to display a dynamic bubble on a link hover by jQuery.
I would to to define a hidden div with the content and display it on a hover of certain link (always in the middle of that link and it should disappear when you leave the link OR the box with your cursor).
Something like this (sorry for such poor illustration :D):
Thanks a lot for your help!
I've used emacs for decades and always wondered, but kept on coding, if there was a way to type in something, them move the cursor and insert the same text, like the VI . command.
Instead what I do is to type the text, set the mark, backup, copy the region, go to the next spot (often just C-n, down one line) and then pre-arg yank, C-u C-y.
It's the overhead of set mark, backup and copy region that makes me just go ahead and retype the thing.
Recently I have been getting a lot of complaints about the HTC Desire series and it failing while invoking sql statements. I have received reports from users with log snapshots that contain the following.
I/Database( 2348): sqlite returned: error code = 8, msg = statement aborts at 1: [pragma journal_mode = WAL;]
E/Database( 2348): sqlite3_exec to set journal_mode of /data/data/my.app.package/files/localized_db_en_uk-1.sqlite to WAL failed
followed by my app basically burning in flames because the call to open the database results in a serious runtime error that manifests itself as the cursor being left open. There shouldn't be a cursor at this point as we are trying to open it.
This only occurs with the HTC Desire HD and Z. My code basically does the following (changed a little to isolate the problem area).
SQLiteDatabase db;
String dbName;
public SQLiteDatabase loadDb(Context context) throws IOException{
//Close any old db handle
if (db != null && db.isOpen()) {
db.close();
}
// The name of the database to use from the bundled assets.
String dbAsset = "/asset_dir/"+dbName+".sqlite";
InputStream myInput = context.getAssets().open(dbAsset, Context.MODE_PRIVATE);
// Create a file in the app's file directory since sqlite requires a path
// Not ideal but we will copy the file out of our bundled assets and open it
// it in another location.
FileOutputStream myOutput = context.openFileOutput(dbName, Context.MODE_PRIVATE);
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
// Close the streams
myOutput.flush();
// Guarantee Write!
myOutput.getFD().sync();
myOutput.close();
myInput.close();
// Not grab the newly written file
File fileObj = context.getFileStreamPath(dbName);
// and open the database
return db = SQLiteDatabase.openDatabase(fileObj.getAbsolutePath(), null, SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS);
}
Sadly this phone is only available in the UK and I don't have one in my inventory. I am only getting reports of this type from the HTC Desire series. I don't know what changed as this code has been working without any problem. Is there something I am missing?
This is more of a theoretical question than an actual problem I have.
If I understand correctly, the sequence number in the TCP header of a packet is the index of the first byte in the packet in the whole stream, correct? If that is the case, since the sequence number is an unsigned 32-bit integer, then what happens after more than FFFFFFFF = 4294967295 bytes are transferred? Will the sequence number wrap around, or will the sender send a SYN packet to restart at 0?
i always using the following format to use transactionscope.
using(TransactionScope scope = new TransactionScope()){
....
}
sometimes i want to wrap the transactionscope to a new class, for example DbContext class, i want to using the statement like
dbContext.Begin();
...
dbContext.Submit();
it seems the transactioncope class need use "using"statement to do dispose, i want to know if there is anyway not use "using".
HI, Any good resources to wrap my head around Aspect Oriented Programming?
PS:- I need to understand AO programming not the libraries or frameworks available for .NET or C# :)
I am trying to show a div when the cursor hovers over and image and hide the div when It is not hovered over the image how is this done?? So far I have a basic show:
<script type="text/javascript">
$(document).ready(function(){
$(".plans").hover(function()
{
$("#planssubnav").show("slow");
}
);
});
</script>
I'm using Java's DataInputStream with scala to parse some simple binary file (which is very bad exprerience due to the lack of unsigned types, even in scala, but that's a different story).
However I find myself forced to use mutable data structure, since Java's streams are inherently state preserving entities.
What's a good design to wrap Java's streams with nice functional data structure?
I have the following sequence of code calls:
SQLPrepare
SQLExecute(hstmt, SQL_CLOSE);
SQLFreeStmt
//It works till here
SQLExecute //Now it fails.
Why am I required to call SQLPrepare again, I just freed the cursor. I shouldn't prepare the SQL statement again.
So I have a form that user's use for data entry, and on one form there is a text box there that is basically used. To enter notes. However, if the user hits i need the cursor to stay in that text box, and start a new line (uh....like word would)....but currently it is jumping to the next control (text box).
So is there a simple property setting that would do the trick? Or a VBA method to accomplish?
Thanks
Justin
I know it's possible to repeat an entire texture by setting the wrap mode to GL_REPEAT, but is it somehow possible to repeat only a subregion of the texture? For example, when the texture is part of an atlas.
I'm targetting OpenGL ES 1.x, so shaders are out.
Is there a keyboard shortcut to start a new line on the currently selected line?
I.e. The current line goes down one line and the cursor is on a blank line.
There is Shift + Enter which starts a new line but on the next line. I want the current line.
When you create and use a Web Service proxy class in the ASP.Net framework, the class ultimately inherits from Component, which implements IDisposable.
I have never seen one example online where people dispose of a web proxy class, but was wondering if it really needs to be done. When I call only one method, I normally wrap it in a using statement, but if I have a need to call it several times throughout the page, I might end up using the same instance, and just wondered what the ramifications are of not disposing it.
Whenever I have an EditText field in my android application, it is highlighted with the blinking cursor for input as soon as the activity is started (though the keyboard doesn't pop up). How can I disable this?
I'm trying to bind a float to a postgresql double precision using psycopg2.
ele = 1.0/3.0
dic = {'name': 'test', 'ele': ele}
sql = '''insert into waypoints (name, elevation) values (%(name)s, %(ele)s)'''
cur = db.cursor()
cur.execute(sql, dic)
db.commit()
sql = """select elevation from waypoints where name = 'test'"""
cur.execute(sql_out)
ele_out = cur.fetchone()[0]
ele_out
0.33333333333300003
ele
0.33333333333333331
Obviously I don't need the precision, but I would like to be able to simply compare the values. I could use the struct module and save it as a string, but thought there should be a better way. Thanks
I have an app that uses UiWebViews, and I need to not show the keyboard for a text field within such a view. I provide my own buttons that insert the limited sorts of text the field allows, but I also need to allow pasting (I will filter what gets pasted) and adjusting the cursor position. Any way to do this?