I would like to wrap the text 5 characters before the end of window (without breacking the line).
I don't know how to do this without putting an EOL character in the text (wrapmargin/textwidth).
I have the following formula in LaTeX, based on Fisher's Exact Test. (NOTE: requires the use of the amsmath package for \binom.)
\begin{equation}
P(i,j) = \sum_{x=|N(V_i) \cap V_j|}^{\min\{|V_j|, |N(V_i)|}
\frac{ \binom{|V_j|}{x} \binom{|V - V_j|}{|N(V_i)| - x}}
{\binom{|V|}{|N(V_i)|}}
\end{equation}
This renders the fraction portion with very small, difficult to read text:
I would like my text more readable, as in the following example:
What trickery can I use to get LaTeX to render my equation similarly?
Hey folks,
OK - I'll admit, I'm quite a beginner in this jQuery-department. I've probably made some amateur mistake, but hey, you gotta learn somewhere! :)
So I'm using jScrollPane: http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html
I want to use it style the scrollable area in my second column. Specifically, I would like to apply and format the scrollbars on the div #ajaxresults
My page is... rather jQuery heavy. I don't know if any variables are conflicting or something... in fact I really have no idea at all why this isn't working.
Take a look at my problematic page: http://furnace.howcode.com
In the header, I've set this to go:
<!-- Includes for jScrollPane -->
<script type="text/javascript" src="http://localhost:8888/js/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="http://localhost:8888/js/jScrollPane.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="http://localhost:8888/stylesheets/jScrollPane.css" />
<script type="text/javascript">
$(function() {
$('#ajaxresults').jScrollPane();
});
</script>
(I've changed localhost on the server copy though)
Nothing ever seems to work with the #ajaxresults div. I've set, as the jScrollPane docs say, overflow:auto on it but still no luck. I find that when jScrollPane DOES seem to 'run' it just moves the div down about 100 pixels. Try it for yourself.
Perhaps someone could help? There's quite a few jQuery plugins there so I don't know if something's colliding/crashing etc...
Please note the site is still in development between myself and a friend, which explains the personal messages we submit to each other ('Hi Donnie!' etc. :D ). Also, when you view the page nothing may appear in the second column for a few seconds - it's just fetching the data via Ajax. So give it a little time.
Thanks very much!
Jack
Hi,
I have a website that changes his inputs ids, and I'm trying to make a semi auto-login, filling automatically the email and the password part...
I'm doing this with greasemonkey and jQuery...
I'm trying something like this
$("input[@type=text]").setValue("[email protected]");
but had no success...
The Page has only the login part, two text type inputs...
What am I missing here?
I do the following when drawing:
Matrix m = new Matrix()
m.Scale(_zoom, _zoom)
e.Graphics.Transform = m
e.Graphics.DrawLine(...) ' line representation
e.Graphics.DrawString(...) ' line text
Now, the text became also scaled. Is it possible to avoid it?
Hello all,
i'm trying to HyperLink images in richtextbox. all i want to know is how to get the index of the selected image or text to be able to insert the hidden text after the selected image as richtextbox.Insert() method requires the index to start inserting from.
thanks
In Java you can write an if statement like this:
if(object1.equals(object2)){
// Do something....
}
How can I code the same logic in Objective-C?
I basically want to compare 2 of any one type of objects, such as 'Text Fields', 'Text Views', etc.
Thank you.
Shakeel
Hi,
I have translated a document from English to Norwegian in the LaTeX format, and while using norwegian special characters, I get an error using
\usepackage[utf8x]{inputenc}
to try and display the norwegian (scandinavian) special characters in PostScript/PDF/DVI format, saying
Package utf8x Error: MalformedUTF-8sequence.
So while that didn't work, I tried out another possible solution:
\usepackage{ucs}
\usepackage[norsk]babel
And when I tried to save that in Emacs I get this message:
These default coding systems were tried to encode text
in the buffer `lol.tex':
(utf-8-unix (905 . 4194277) (916 . 4194245) (945 . 4194278) (950
. 4194277) (954 . 4194296) (990 . 4194277) (1010 . 4194277) (1013
. 4194278) (1051 . 4194277) (1078 . 4194296) (1105 . 4194296))
However, each of them encountered characters it couldn't encode:
utf-8-unix cannot encode these: \345 \305 \346 \345 \370 \345 \345 \346 \345 \370 ...
Thanks to Emacs I have the possibility to check out the properties of those characters and the first one tells me:
character: \345 (4194277, #o17777745, #x3fffe5)
preferred charset: eight-bit (Raw bytes 128-255)
code point: 0xE5
syntax: w which means: word
buffer code: #xE5
file code: not encodable by coding system utf-8-unix
display: not encodable for terminal
Which doesn't tell me much. When I try to build this with texi2dvi --dvipdf filename.text I get a perfectly fine PDF, all without the special norwegian characters.
When I am about to save Emacs also ask me:
"Select coding system (default raw-text):"
And I type in utf-8 to choose its coding system. I have also tried to choose default raw-text to see if I get some different result. But nothing.
At last I tried
\lstset{inputencoding=utf8x, extendedchars=\true}
... a code I came over while trying to google the solution to this problem. Which gives me this error:
Undefined control sequence.
So basically, I have tried every encoding option I have been able to find and nothing works. I am desperately trying to make this work since the norwegian translation must be published before the deadline.
As an additional information I may add that I found out later on that I only had the en_US.UTF-8 in my locale, so I added nb_NO.UTF-8 and nb_NO.ISO-8859-15 and ran locale-gen + reboot without any changes.
I hope I provided enough information to get some assistance, the characters in question is æ ø å.
CREATE FUNCTION foo() RETURNS text
LANGUAGE plperl
AS $$
return 'foo';
$$;
CREATE FUNCTION foobar() RETURNS text
LANGUAGE plperl
AS $$
return foo() . 'bar';
$$;
I'm trying to compose results using multiple functions, but when I call foobar() I get an empty result.
Hi,
I have a Python script that takes the directory path of a text file and converts it into an excel file. Currently I have it running as a console application (compiled with py2exe) and prompts the user for the directory path through raw_input().
How do i make it such that I can drag & drop my text file directly into the .exe of the python script?
Thanks,
I have a colon-delimited text file containing grouped, related data. The People group contains people's names followed by their ages, separated by colons. How can I parse the text and group people according to their ages?
The structure is as follows:
Group.txt
Age:10:20:30:40:
Group:G1:10:G2:30:G3:20:G4:40:
People:Jack:10:Tom:30:Dick:20:Harry:10:Paul:10:Peter:20:
People:Mary:20:Lance:10:
And I want to display something like this:
G1 Jack Harry Paul Lance
G2 Dick Peter Marry
G3 Tom
G4
I have an indexed model called Article and I don't want solr to index unpublished articles.
class Article < ActiveRecord::Base
searchable do
text :title
text :body
end
end
How can I specify that article that is not #published? should not be indexed?
I have some problems inserting a const "1" into a textbox which is gridviw.
the gridview code:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" EnableViewState="False">
<Columns>
<asp:BoundField DataField="Price" HeaderText="Price" ItemStyle-CssClass="price" >
<ItemStyle CssClass="price"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="ProductID">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ProductName">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Summary">
<ItemTemplate>
<asp:Label ID="lblSum" runat="server" Text='<%# Eval("Summary") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="picPath">
<ItemTemplate>
<asp:Label ID="lblPic" runat="server" Text='<%# Eval("picPath") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText = "quantity">
<ItemTemplate>
<asp:TextBox ID="lblquantity" runat="server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText = "Total">
<ItemTemplate>
<asp:Label ID="lblTotal" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
All the information is populated from the session of the privious page, beside this textbox which doesnt comes from anywhere, its a quantity textbox which the user should enter. and i want it to have a defalt value of "1".
I dont actually know how to insert into a textbox which is in the gridview.
please help me.
thanx
In a normal aspx page I've set up a jquery tab system. When a particular tab shows up I wire up an ajax call to get another html page with the following content. It is simply a form with some javascript inside of it.
<!-- demo.htm -->
<form method="post" action="post.aspx">
<div id="fields">
Class: <input id="txtclass" name="txtclass" type="text"/>
Grade: <input id="txtgrade" name="txtgrade" type="text"/>
<input id="btnupdate" value="Update"/>
</div>
<div id="update">
Reason:<br/>
<input id="txtreason" name="txtreason" type="text"/>
<br/>
Comments:<br/>
<textarea id="txtcomments" name="txtcomments"></textarea>
<br/>
<input type="button" id="btnsave" value="Save"/>
</div>
<script type="text/javascript">
$(function(){
//all textboxes should be disabled
$('#fields input').each(function(i,j){
if(! $(this).is(':button') )
$(this).attr('disabled', 'disabled')
});
//update div should be hidden
$('#update).hide();
//click event of btnupdate should
// be set to show the update div contents
// and enable input fields
$('#btnupdate').click(function(){
//enable all textboxes
$('#fields input').each(function(i,j){
$(this).attr('disabled', '');
});
//hide btnupdate
$('#btnupdate').hide();
//show div update
$('#update').show();
});
});
</script>
</form>
The script executes normally and the form is shown as intended. The btnupdate is supposed to show the contents in the update div and load the form for accepting user input. Whenever I hit btnupdate button I get an object not found exception on IE 8. IE 8 asks if it should start up its in-built debuggger. But, even in this debugger I cannot see what the problem is...However on clicking "No" in that dialog the button click function executes properly, and the form is displayed as intended. Is there a better way to resolve the problem?
I'm trying to learn Haskell and after an article in reddit about Markov text chains, I decided to implement Markov text generation first in Python and now in Haskell. However I noticed that my python implementation is way faster than the Haskell version, even Haskell is compiled to native code. I am wondering what I should do to make the Haskell code run faster and for now I believe it's so much slower because of using Data.Map instead of hashmaps, but I'm not sure
I'll post the Python code and Haskell as well. With the same data, Python takes around 3 seconds and Haskell is closer to 16 seconds.
It comes without saying that I'll take any constructive criticism :).
import random
import re
import cPickle
class Markov:
def __init__(self, filenames):
self.filenames = filenames
self.cache = self.train(self.readfiles())
picklefd = open("dump", "w")
cPickle.dump(self.cache, picklefd)
picklefd.close()
def train(self, text):
splitted = re.findall(r"(\w+|[.!?',])", text)
print "Total of %d splitted words" % (len(splitted))
cache = {}
for i in xrange(len(splitted)-2):
pair = (splitted[i], splitted[i+1])
followup = splitted[i+2]
if pair in cache:
if followup not in cache[pair]:
cache[pair][followup] = 1
else:
cache[pair][followup] += 1
else:
cache[pair] = {followup: 1}
return cache
def readfiles(self):
data = ""
for filename in self.filenames:
fd = open(filename)
data += fd.read()
fd.close()
return data
def concat(self, words):
sentence = ""
for word in words:
if word in "'\",?!:;.":
sentence = sentence[0:-1] + word + " "
else:
sentence += word + " "
return sentence
def pickword(self, words):
temp = [(k, words[k]) for k in words]
results = []
for (word, n) in temp:
results.append(word)
if n > 1:
for i in xrange(n-1):
results.append(word)
return random.choice(results)
def gentext(self, words):
allwords = [k for k in self.cache]
(first, second) = random.choice(filter(lambda (a,b): a.istitle(), [k for k in self.cache]))
sentence = [first, second]
while len(sentence) < words or sentence[-1] is not ".":
current = (sentence[-2], sentence[-1])
if current in self.cache:
followup = self.pickword(self.cache[current])
sentence.append(followup)
else:
print "Wasn't able to. Breaking"
break
print self.concat(sentence)
Markov(["76.txt"])
--
module Markov
( train
, fox
) where
import Debug.Trace
import qualified Data.Map as M
import qualified System.Random as R
import qualified Data.ByteString.Char8 as B
type Database = M.Map (B.ByteString, B.ByteString) (M.Map B.ByteString Int)
train :: [B.ByteString] -> Database
train (x:y:[]) = M.empty
train (x:y:z:xs) =
let l = train (y:z:xs)
in M.insertWith' (\new old -> M.insertWith' (+) z 1 old) (x, y) (M.singleton z 1) `seq` l
main = do
contents <- B.readFile "76.txt"
print $ train $ B.words contents
fox="The quick brown fox jumps over the brown fox who is slow jumps over the brown fox who is dead."
Hi there,
i'm using the Jquery validate() plugin for some forms and it goes great. The only thing is that i have an input field that requires a special validation process. Here is how it goes:
The Jquery validate plugin is called in the domready for all the required fields.
Here is an exemple for an input:
<li>
<label for="nome">Nome completo*</label>
<input name="nome" type="text" id="nome" class="required"/>
</li>
And here is how i call my special function:
<li>
<span id="sprytextfield1">
<label for="cpf">CPF* (xxxxxxxxxxx)</label>
<input name="cpf" type="text" id="cpf" maxlength="15" class="required" />
<span class="textfieldInvalidFormatMsg">CPF Inválido.</span>
</span>
</li>
And at the bottom of the file i call the Spry function:
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1","cpf");
//-->
</script>
Of course i call the Spry css and js files in the head section as well as my special-validate.js.
When i just use the Jquery validate() plugin and click on the send button, the page goes automatically back to the first mistaken input field and shows the error type (not a number, not a valid email etc.).
But with this new function, this "going-back-to-the-first-mistake" feature doesnt work, of course, because the validate() function sees it all good.
I already added a rule for another form (about pictures upload) and it goes like this:
$("#commentForm").validate({
rules: {
foto34: {
required: true,
accept: "jpg|png|gif"
}
}
});
Now my question is, how can i add the special validation function as a rule of the whole validation process ?
Here is the page to understand it better: link text and the special field is the first one: CPF.
Hope i was clear explaining my problem.
Thanks in advance.
kevin
Is there a way to handle the dynamic change of a dropdown for a single row in a grid-based datawindow?
Example:
NAME LIKABILITY PURCHASED IN COLOUR
(Text) (DropDown*) (Text) (Text)
Bananas [Good] Hands Yellow
[Bad]
[Bananas are good]
Apples [Good] Bags Red
[Bad]
Given the above is a grid-based datawindow, where the fields 'NAME','PURCHASED IN' and 'COLOUR' are text fields, where as the 'LIKABILITY' field is a dropdown*.
I say dropdown* because the same visual representation can be created by using a DropDownList (hardcoded within the datawindow element at design time), or a DropDownDW (or DDDW, a select statement that can be based on other elements in the datawindow).
However, there is no way I can get 'Bananas' having it's 3 dropdowns, while Apples has only 2.
If I enter multiple rows of 'Bananas', then all rows have 3 dropdowns, but as soon as I add an Apples row, all dropdowns revert to 2 selections.
To attempt to achieve this functionality, I have tried the following options:
--
1) dw_1.Object.likability.values("Good~tG/Bad~tB/Bananas are good~tDRWHO")
on ue_itemchange when editing NAME.
FAILS: edits all instances of LIKABILITY instead of the current row.
--
2) Duplicate Dropdowns, having one filtered, one unfiltered selection list per row, visible based on NAME selection.
FAILS: can't set visibility/overlapping columns on grid-based datawindow. (Source)
--
3) Hard-code display value as Database value, or Vice Versa. Have 'GOOD','BAD','BANANASAREGOOD' as the display and database values, and change handling of options from G, B, DRWHO to these new values.
FAILS: 3rd option appears for all rows, still selectable on Apple rows, which is wrong.
--
4) DDDW retrieve list of options for dropdown. Create a DDDW that uses the value of NAME to determine what selections it should have for the dropdown.
FAILS: edits all instances of the dropdown, not just the current row.
--
5) DDDW retrieve counter of options available (if B then 3 else 2), then have duplicate dropdown columns that protect/unprotect based on DDDW counter.
FAILS: Can't autoselect dddw value to populate column to cause protect on other two columns, ugly solution in any case.
--
There is now a bounty on this question for anyone who can give me a solution that will enable me to edit a dropdown column for a single row on a grid-based datawindow in PB 10.5
Hi!
I've got a lot of xml files, and embedded in some elements there are json serialized objects. They are quite difficult to read and modify. So question is:
Are there any Visual Studio addins availible that can take selected json-text in the editor, and visualize it (and maybe even allow for editing)?
if not, if I must build it - are there any good starting points or samples availible?
(making a right-click command availible when text is selected, and them showing a popup)
Regards
Larsi
Provided a url, within a string of text (tweet) such as
"Check out my twitpic http://twitpic.com/1876544594 its awesome"
I need a Rails regex that will return 18744594, the id of this particular twitpic...
This question has been asked here but was for PHP, and I need it for Rails.
I would also be able to pull the name of the site, so the text between http:// and .com "twitpic"
I would make to make a small WYSIWYG editor similar to the one used by StackOverflow. Basically, it would have buttons like [quote], and when that button is clicked, [quote] [/quote] should be inserted in the textarea where the cursor is or at the end of all other text. If the [quote][/quote] could be highlighted in some way that would be even more excellent, but its not required.
Is there any WYSIWYG editor already available where you can add custom buttons, with custom text being added to the textbox as a result?
...at least to me. This code used to work fine. I'm pretty sure nothing has changed, but now all of the sudden it behaves oddly. Basically I'm trying to create inline editing functionality. When the user clicks on the link, it dynamically generates a textbox and a confirm and cancel link. I'm having problems with the cancel link not removing everything in the cell.
HTML:
...
<td class="bid">
<a href="javascript:" class="102093" title="Click to modify bid">$0.45</a>
</td>
...
Binding jQuery (in $(function())):
$('.bid a').live('click', renderBidChange);
....
$('.report_table .cancel').live('click', cancelUpdate);
renderBidChange (this function creates the dynamic elements):
function renderBidChange(){
var cpc = $(this);
var value = cpc.text().replace('$', '');
var cell = cpc.parent('.bid');
cpc.hide();
var input = document.createElement('input');
$(input).attr({type:'text',class:'dynamic cpc-input'}).val(value);
cell.append(input);
var accept = document.createElement('a');
$(accept).addClass('accept').attr({'href':'javascript:',
'title':'Accept Changes'}).text('Accept Changes');
cell.append(accept);
var cancel = document.createElement('a');
$(cancel).addClass('cancel').attr({'href':'javascript:',
'title':'Cancel Changes'}).text('Cancel Changes');
cell.append(cancel);
$(input).focus();
input.select();
}
cancelUpdate this function just removes everything visible (all the dynamic junk in this case) in the cell and shows what used to be there.
function cancelUpdate(){
var cell = $(this).parent();
cell.find(':visible').remove();
cell.find(':hidden').show();
}
However, for some reason, the cancel link remains after it is clicked! Everything else is removed except that. W T F
Thanks for any insight you're able to provide! I'm sure it's just some stupid little detail I'm over[caffeinatedly]looking...
UPDATE Immediately after posting this I epiphanied that it may be a CSS issue, but after double checking my code, it is not.
I am looking for some good examples of Speech Recognition using VB. I am looking for recent examples, everything I have found is several years old. I am running Visual Studio 2010 with the most recent SDK. I was able to figure out text to speech but I am chasing my tail on speech to text.
The line
<input type="text" name="passwordLogin" value="Password" onfocus="if(this.value=='Password'){this.value=''; this.type='password'};" onblur="if(this.value==''){this.value='Password'; this.type='text'};" size="25" />
works in all web browsers except IE... how can I fix it for IE?
On the iPhone, if an option is too long for the area, instead of wrappeing you get a "..." at the end of the "drop down" and the user will know there is more text than is shown.
I want to recreate this with android but am new to it so cant see how.
I want the heights of "rows" in my layout to be uniform hence not able to wrap the text.
Thanks in advance.