what field in the django models class should be used if the type of data (text/images/html) is unknown? i'm looking for a field that can handle copy and pasted html code, images, text, etc.
I currently have a working, simple language implemented in Java using ANTLR. What I want to do is embed it in plaintext, in a similar fashion to PHP.
For example:
Lorem ipsum dolor sit amet
<% print('consectetur adipiscing elit'); %>
Phasellus volutpat dignissim sapien.
I anticipate that the resulting token stream would look something like:
CDATA OPEN PRINT OPAREN APOS STRINGAPOS CPARENT SEMI CLOSE CDATA
How can I achieve this, or is there a better way?
By security I mean that encoded string is indistinguishable from random noise and is different on every encryption of the same text so it is impossible to make a guess on encryption algorithm used or do any dictionary attack on the encoded text.
Second: output string length does not correspond to the input string length in easy way, so it is not possible of make guessing on that account.
Third: it is possible to verify that the provided password is incorrect so the decoding function could return false instead of supposedly decoded random string.
Hello All,
Iam trying to saving an UIImage in PDF file.
How can i do this? How i would save and image into pdf file and then export that pdf file?
Please suggest the solution for the issue i faced.
Thank You.
Do you know a framework for making presentations using only HTML5 and javascript technologies?
I'm not talking about "export" features of various presentation software (powerpoint or OOo presentation).
Some requirements for the presentations made with this "framework":
take advantage of the latest HTML5 features (audio, video, canvas?)
same with CSS3 (font support, gradient, shadows, transitions and transformations)
If there's no such thing, example of good presentations or pointers on the subject would be appreciated.
I have a POCO (Plain Old CLR Object)
public Foo
{
public virtual int Id { get; set; }
public virtual Dictionary<string, string> Stuff { get; set; }
public virtual string More { get; set; }
}
Using the model first approach (i.e. I don't have a data model yet), how would I handle persisting Stuff (Dictionary)?
Is there a good way to display the contents of a file as binary?
I am creating a program that needs to save and load a 2D arrays from a files.
When loading a saved file the result appears different.
I need to be able to view the contents of the saved file in plain binary to tell if my problem in in my save or load function.
Is there a program like octal dump but is binary dump?
Thanks.
When running the commandsvn ci you get a text editor that allows you to place a comment, below that is there is the text "--This line, and those below, will be ignored--", then the files modified, added, or deleted.
If I were to delete a line such as:
M folderA/fileA
Would it remove that file from the check in, or is that just an SVN comment that has no other effect?
I would like to use jquery to remove some tags inside mainclass, so that this -
<div class='mainclass'>
<div class='inclass'>
<a href='#'>Some text</a>
</div>
</div>
Becomes this -
<div class='mainclass'>
Some text
</div>
Thanks in advance.
I just started learning knockout this week and everything has gone well except for this one issue.
I have a list of items that I sort multiple ways but one of the ways I want to sort needs to have a different display than the standard list. As an example lets say I have this code
var BetterListModel = function () {
var self = this;
food = [
{
"name":"Apple",
"quantity":"3",
"category":"Fruit",
"cost":"$1",
},{
"name":"Ice Cream",
"quantity":"1",
"category":"Dairy",
"cost":"$6",
},{
"name":"Pear",
"quantity":"2",
"category":"Fruit",
"cost":"$2",
},{
"name":"Beef",
"quantity":"1",
"category":"Meat",
"cost":"$3",
},{
"name":"Milk",
"quantity":"5",
"category":"Dairy",
"cost":"$4",
}];
self.allItems = ko.observableArray(food); // Initial items
// Initial sort
self.sortMe = ko.observable("name");
ko.utils.compareItems = function (l, r) {
if (self.sortMe() =="cost"){
return l.cost > r.cost ? 1 : -1
} else if (self.sortMe() =="category"){
return l.category > r.category ? 1 : -1
} else if (self.sortMe() =="quantity"){
return l.quantity > r.quantity ? 1 : -1
}else {
return l.name > r.name ? 1 : -1
}
};
};
ko.applyBindings(new BetterListModel());
and the HTML
<p>Your values:</p>
<ul class="deckContents" data-bind="foreach:allItems().sort(ko.utils.compareItems)">
<li><div style="width:100%"><div class="left" style="width:30px" data-bind="text:quantity"></div><div class="left fixedWidth" data-bind="text:name"></div> <div class="left fixedWidth" data-bind="text:cost"></div> <div class="left fixedWidth" data-bind="text:category"></div><div style="clear:both"></div></div></li>
</ul>
<select data-bind="value:sortMe">
<option selected="selected" value="name">Name</option>
<option value="cost">Cost</option>
<option value="category">Category</option>
<option value="quantity">Quantity</option>
</select>
</div>
So I can sort these just fine by any field I might sort them by name and it will display something like this
3 Apple $1 Fruit
1 Beef $3 Meat
1 Ice Cream $6 Dairy
5 Milk $4 Dairy
2 Pear $2 Fruit
Here is a fiddle of what I have so far http://jsfiddle.net/Darksbane/X7KvB/
This display is fine for all the sorts except the category sort. What I want is when I sort them by category to display it like this
Fruit
3 Apple $1 Fruit
2 Pear $2 Fruit
Meat
1 Beef $3 Meat
Dairy
1 Ice Cream $6 Dairy
5 Milk $4 Dairy
Does anyone have any idea how I might be able to display this so differently for that one sort?
like
img { background-color:color: color matched to the theme}
or
img { background-image:url (a very very tiny gif image with the text "image loading") }
I'm thinking in the benefit of this when user access site on slow connection then background color will give clue about something is there which is diffrent than text content..
The following code prints nothing
CHECK_INCLUDE_FILE_CXX(glog/logging.h GLOG_INCLUDE)
IF(GLOG_INCLUDE)
MESSAGE("YY")
ENDIF(GLOG_INCLUDE)
But I have the following environment variable set:
export CPLUS_INCLUDE_PATH=/usr/local/include
And, "ls /usr/local/include/glog/logging.h" returns the file.
I tried using
include_directories( "/usr/local/include" )
but it doesn't work either.
I create a WordTemplate with some placeholders for field,in code I insert value in this placeholders and show it to user.
protected void Button1_Click(object sender, EventArgs e)
{
string DocFilePath = "";
//string FilePath = System.Windows.Forms.Application.StartupPath;
object fileName = @"[...]\asset\word templates\FormatPeygiri1.dot";
DocFilePath = fileName.ToString();
FileInfo fi = new FileInfo(DocFilePath);
if (fi.Exists)
{
object readOnly = false;
object isVisible = true;
object PaperNO = "PaperNO";
object PaperDate = "PaperDate";
object Peyvast = "Peyvast";
object To = "To";
object ShoName = "ShoName";
object DateName = "DateName";
Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
ref isVisible, ref isVisible, ref missing, ref missing, ref missing);
WordApp.ActiveDocument.FormFields.get_Item(ref PaperNO).Result = TextBox_PaperNO.Text;
string strPaperDate = string.Format("{0}/{1}/{2}", PersianDateTimeHelper.GetPersainDay(DateTimePicker_PaperDate.SelectedDate),
PersianDateTimeHelper.GetPersainMonth(DateTimePicker_PaperDate.SelectedDate),
PersianDateTimeHelper.GetPersainYear(DateTimePicker_PaperDate.SelectedDate));
WordApp.ActiveDocument.FormFields.get_Item(ref PaperDate).Result = strPaperDate;
WordApp.ActiveDocument.FormFields.get_Item(ref Peyvast).Result = TextBox_Peyvast.Text;
WordApp.ActiveDocument.FormFields.get_Item(ref To).Result = TextBox_To.Text; ;
WordApp.ActiveDocument.FormFields.get_Item(ref ShoName).Result = TextBox_ShoName.Text;
string strDateName = string.Format("{0}/{1}/{2}", PersianDateTimeHelper.GetPersainDay(DateTimePicker_DateName.SelectedDate),
PersianDateTimeHelper.GetPersainMonth(DateTimePicker_DateName.SelectedDate),
PersianDateTimeHelper.GetPersainYear(DateTimePicker_DateName.SelectedDate));
WordApp.ActiveDocument.FormFields.get_Item(ref DateName).Result = strDateName;
aDoc.Activate();
WordApp.Visible = true;
aDoc = null;
WordApp = null;
}
else
{
MessageBox1.Show("File Not Exist!");
}
it work good and successfully!
but when a user close the Word,her Process not closed and exists in Task Manager Process list.
this process name is WINWORD.exe
I know that I can close process whit code [process.Kill()] but I don't know which process that I should to kill.
if I want to kill all process with name [WINWORD.exe] all Word window closed.but I want to close specific Word window and kill process that I opened.
How to do it?
I have create a report in Microsoft Reporting Service that is presented in a browser. I would like to create button that opens a textbox where the user can fill in text. This text should be saved in column in the underlying database.
We had a a clob column in DB. Now when we extract this clob and try to display it (plain text not html), it prints junk some characters on html screen. The character when directly streamed to a file looks like ” (not the usual double quote on regular keyboard)
One more observation:
System.out.println("”".getBytes()[0]);
prints -108.
Why a character byte should be in negative range ? Is there any way to display it correctly on a html screen ?
I'm using the post-receive-email script included with git. (Source is here.) It works just fine, but I want each email to be sent from the author of the commits pushed. How do I do it?
My post-receive file currently looks like this, and I want to customize the from-email-address.
#!/bin/sh
export[email protected]
$(dirname $0)/post-receive-email
I'm trying to capture a block of text into a variable, with newlines maintained, then echo it.
However, the newlines don't seemed to be maintained when I am either capturing the text or displaying it.
Any ideas regarding how I can accomplish this?
Example:
#!/bin/bash
read -d '' my_var <<"BLOCK"
this
is
a
test
BLOCK
echo $my_var
Output:
this is a test
Desired output:
this
is
a
test
Hello!
Is there any good plain C (or at least C++) library for parsing URL's that also supports IDN, so that it can easily parse url like http://?????????.??/
I created a mail merge using InDesign, and it looked like it went through all of the records but (1) I can't find the option toexportto pdf and (2) I can't find the merged file anywhere on my system at all. Where is it?
Exception handling aside, I'm using the following to input a line of text in Java:
BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
String txt = null;
txt = strin.readLine();
However, I want to be able to edit an existing string, so that if txt were initialized to "hello" instead of null, then the readLine() would have the "hello" text in the buffer for me to edit.
I can't see how to do this. Any help would be appreciated.
I need to strip out all font tags from a document. When attempting to do so with the following Ruby code, other elements and text within the font tags are lost. I've also attempted to iterate through all children elements and make them siblings of the font tag before unlinking the font tag--which also results in lost HTML. What is a good method for removing tags which can contain other elements and/or text?
doc.css('font').each do |element|
element.unlink
end
with "file upload" HTML like this:
<input name="input_name" type="file" size="40" />
...there is no way for users to directly enter text into input area for security reasons, correct? file selection window pops up instead.
In Watin automation project, we are wanting to bypass the file selection window and place filename directly in text entry area - but we are not finding a way to do this.
How can this be accomplished? ...or perhaps it cannot be done?
when i put ajax on my code I send a group of variable via post but when i received the data it is in a obj.responseText ie TEXT format.
say i have two files "form.php" and "index.php"
ajax is implemented in form.php while index.php returns the text.
but my problem is index.php also generates a variable named "tarriff_count"
i want to catch systematically and separately this variable,
Is there any systematic way to catch variable.also keep in mind "obj.responseText" is very complicated to get a variable from "preg_match" ?
I have some data like this:
ID Value
1 AAA
1 ABC
2 dasd
2 dsfdsf
2 dsfsd
3 df
3 dwqef
they are objects(not plain text).
and i want to get all objects with the ID = 2.
I can do a binary binary search and get the index 3,but how can i get (2 and 4) is there any efficient algorithm?
the real problem has lists with about one Million items.
any language except bf and lisp can help.
So I've spent a lot of time making an iPhone game and have recently realized that I don't have to limit myself to just Apple - I know there are app stores for Palm and Android, but does anybody know of a good "app store" for the plain old PC? I would like to have one where individual developers can publish an app and not have to worry about all the billing and piracy issues!