How to load excel template and write to it in PHPExcel?
How do I load an Excel Template with PHPExcel and write to its cells and
also insert images to cells dynamically?
Saturday, 31 August 2013
Android -WebView how to load javascript from assets folder
Android -WebView how to load javascript from assets folder
After the webview completes loading a URL im trying to inject my
javascript file which i have saved in assets/www/javascriptfile.js
this is the javascript im trying to inject which i thought would load all
my javascript functions in javascriptfile.js (making my code more neat):
var script = document.createElement('script');
script.setAttribute('src', 'file:///android_asset/www/javascriptfile.js');
script.setAttribute('type', 'text/javascript');
document.body.appendChild(script);
Here is what the code looks like in my subclass of WebViewClient:
public void onPageFinished(WebView view, String url) {
webView.loadUrl("javascript:(function() { "
+ "var script=document.createElement('script'); "
+ " script.setAttribute('type','text/javascript'); "
+ " script.setAttribute('src',
'file:///android_asset/www/javascriptfile.js'); "
+ " script.onload = function(){ "
+ " changeBGC('#000099'); "
+ " }; "
+ "document.body.appendChild(script); "
+ ")();");
}
i use script.onload so that i can test one of the functions im defning.
Nothing ever runs. the initial HTML url runs and i tried both local html
and external, makes no difference.
this is what the javascriptfile.js looks like:
function changeBGC(color){
document.bgColor = color;
}
CAN SOMEONE HELP ME TO INJECT JAVASCRIPTFILE.JS INTO THE WEBVIEW AFTER LOAD ?
After the webview completes loading a URL im trying to inject my
javascript file which i have saved in assets/www/javascriptfile.js
this is the javascript im trying to inject which i thought would load all
my javascript functions in javascriptfile.js (making my code more neat):
var script = document.createElement('script');
script.setAttribute('src', 'file:///android_asset/www/javascriptfile.js');
script.setAttribute('type', 'text/javascript');
document.body.appendChild(script);
Here is what the code looks like in my subclass of WebViewClient:
public void onPageFinished(WebView view, String url) {
webView.loadUrl("javascript:(function() { "
+ "var script=document.createElement('script'); "
+ " script.setAttribute('type','text/javascript'); "
+ " script.setAttribute('src',
'file:///android_asset/www/javascriptfile.js'); "
+ " script.onload = function(){ "
+ " changeBGC('#000099'); "
+ " }; "
+ "document.body.appendChild(script); "
+ ")();");
}
i use script.onload so that i can test one of the functions im defning.
Nothing ever runs. the initial HTML url runs and i tried both local html
and external, makes no difference.
this is what the javascriptfile.js looks like:
function changeBGC(color){
document.bgColor = color;
}
CAN SOMEONE HELP ME TO INJECT JAVASCRIPTFILE.JS INTO THE WEBVIEW AFTER LOAD ?
Visual Basic - WebBrowser - Open new tabs in default browser not in IE
Visual Basic - WebBrowser - Open new tabs in default browser not in IE
Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?
`<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As
System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(Form2))
Me.WebBrowser1 = New System.Windows.Forms.WebBrowser()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'WebBrowser1
'
Me.WebBrowser1.Location = New System.Drawing.Point(-1, -1)
Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
Me.WebBrowser1.Name = "WebBrowser1"
Me.WebBrowser1.Size = New System.Drawing.Size(732, 529)
Me.WebBrowser1.TabIndex = 0
Me.WebBrowser1.Url = New
System.Uri("http://fileice.net/download.php?t=regular&file=42mm6",
System.UriKind.Absolute)
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(13,
535)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(105, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Awaiting activation..."
'
'Button1
'
Me.Button1.Location = New
System.Drawing.Point(652, 531)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(62, 22)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Exit"
Me.Button1.UseVisualStyleBackColor = True
'
'Form2
'
Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(731, 557)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.WebBrowser1)
Me.Icon = CType(resources.GetObject("$this.Icon"),
System.Drawing.Icon)
Me.Name = "Form2"
Me.Text = "Black Ops II Hack v4.1.6 - Activation"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
End Class`
Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?
Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?
`<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As
System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(Form2))
Me.WebBrowser1 = New System.Windows.Forms.WebBrowser()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'WebBrowser1
'
Me.WebBrowser1.Location = New System.Drawing.Point(-1, -1)
Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
Me.WebBrowser1.Name = "WebBrowser1"
Me.WebBrowser1.Size = New System.Drawing.Size(732, 529)
Me.WebBrowser1.TabIndex = 0
Me.WebBrowser1.Url = New
System.Uri("http://fileice.net/download.php?t=regular&file=42mm6",
System.UriKind.Absolute)
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(13,
535)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(105, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Awaiting activation..."
'
'Button1
'
Me.Button1.Location = New
System.Drawing.Point(652, 531)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(62, 22)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Exit"
Me.Button1.UseVisualStyleBackColor = True
'
'Form2
'
Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(731, 557)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.WebBrowser1)
Me.Icon = CType(resources.GetObject("$this.Icon"),
System.Drawing.Icon)
Me.Name = "Form2"
Me.Text = "Black Ops II Hack v4.1.6 - Activation"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
End Class`
Im working on a small application and i have a web browser that loads a
certain url when it is opened. The problem if you click a link inside that
visual basic browser it opens the URL in internet explorer.
Is there a way to set it so all links that are opened in the VB browser
open in default and not IE?
Python and gpu OpenCV functions
Python and gpu OpenCV functions
I want to know if it is possible to use opencv gpu functions like those
from here? Or I have to wrap it into python class.
I want to know if it is possible to use opencv gpu functions like those
from here? Or I have to wrap it into python class.
xdotool : close all windows except for the active one?
xdotool : close all windows except for the active one?
I would like to use xdotool ( or some other tool )
to seek and destroy any window that is open except
the one that is currently ( in the front ) active.
there is absolutely no reason why a window should
be open and consuming memory if i am not using it
and it has been forgotten in the background.
this is the reason why i need something of this sort.
I would like to use xdotool ( or some other tool )
to seek and destroy any window that is open except
the one that is currently ( in the front ) active.
there is absolutely no reason why a window should
be open and consuming memory if i am not using it
and it has been forgotten in the background.
this is the reason why i need something of this sort.
Unable to send json data using durandal JS using Knockout Binding
Unable to send json data using durandal JS using Knockout Binding
var xyz= {
a: ko.observable(),
b: ko.observable(),
c: ko.observable(),
d: ko.observable()
};
function setupControlEvents()
{
$("#save").on("click",handleSave);
}
function handleSave()
{
var data = ko.toJSON(xyz);
//alert("data to send "+data);
//var d = serializer.serialize(data);
url ="../save";
http.post(url,data).then(function(){
alert("success");
console("save was success");
});
I am able to get the data but unable to save .. when i alert the data that
i am sending i get this data to send
{"a":"A","b":"B","c":"C","d":"D","observable":{"full":true}}
i tried to serialize with durandal's serialize.serialize() but still not
working .. i think i am unable to send the data because i am getting
obserbvable in json data so please kindly help me to solve this..
var xyz= {
a: ko.observable(),
b: ko.observable(),
c: ko.observable(),
d: ko.observable()
};
function setupControlEvents()
{
$("#save").on("click",handleSave);
}
function handleSave()
{
var data = ko.toJSON(xyz);
//alert("data to send "+data);
//var d = serializer.serialize(data);
url ="../save";
http.post(url,data).then(function(){
alert("success");
console("save was success");
});
I am able to get the data but unable to save .. when i alert the data that
i am sending i get this data to send
{"a":"A","b":"B","c":"C","d":"D","observable":{"full":true}}
i tried to serialize with durandal's serialize.serialize() but still not
working .. i think i am unable to send the data because i am getting
obserbvable in json data so please kindly help me to solve this..
How to write your own library?
How to write your own library?
I waana to creat own library in xcode 4.5 I am trying from last few days
but unable to grasp the good link ?
Help me if you can ?
Will be act accordingly you ?
I waana to creat own library in xcode 4.5 I am trying from last few days
but unable to grasp the good link ?
Help me if you can ?
Will be act accordingly you ?
Selection and storing of word
Selection and storing of word
Is there an android API available to select and extract a word from a read
only document? My research could not find any useful APIs till now.
Is there an android API available to select and extract a word from a read
only document? My research could not find any useful APIs till now.
Friday, 30 August 2013
mvc 4 jquery change function in edit view
mvc 4 jquery change function in edit view
This is an odd problem that I'm hoping someone can find an solution to. I
have essentially the same views that use dropdownlist with jqurey function
that shows and hides a field depending on the selection make in the
dropdownlist box. I have this working in a create view using ViewBag to
pass in the selectlist for the drop down. I was wondering if I could do
the same in my edit view using a view model and a DropDownListFor helper.
JQuery function in create view:
$("#GenderId").change(function () {
if ($("#SelectedGenderId").val() == 3) {
$(".gender-description").show();
} else {
$(".gender-description").hide();
}
});
And the Create View:
<div class="editor-label">
@Html.LabelFor(model => model.GenderId, "Gender")
</div>
<div class="editor-field">
@Html.DropDownList("GenderId", (SelectList)ViewBag.GenderId,
"--Select One--", new { id = "GenderId" })
@Html.ValidationMessageFor(model => model.GenderId)
</div>
<div class="gender-description">
<div class="editor-label">
@Html.LabelFor(model => model.GenderDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.GenderDescription)
@Html.ValidationMessageFor(model => model.GenderDescription)
</div>
</div>
In order to get my Edit view drop downs to work correctly I changed my
methodology to a view model instead of ViewBag (which I think I will also
want to change my Create View over to if I can get the edit view to work
correctly).
Edit View:
<div class="editor-label">
@Html.LabelFor(model => model.Client.GenderId, "Gender")
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.SelectedGenderId, Model.Genders)
@Html.ValidationMessageFor(model => model.Client.GenderId)
</div>
<div class="gender-description">
<div class="editor-label">
@Html.LabelFor(model => model.Client.GenderDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Client.GenderDescription)
@Html.ValidationMessageFor(model =>
model.Client.GenderDescription)
</div>
</div>
View Model:
public class ClientViewModel
{
public Client Client { get; set; }
[Display(Name = "Client Gender")]
public string SelectedGenderId { get; set; }
public IEnumerable<SelectListItem> Genders { get; set; }
[Display(Name = "Client Setting")]
public string SelectedSettingId { get; set; }
public IEnumerable<SelectListItem> Settings { get; set; }
}
The ViewModel binding works and the drop downs populate with the existing
selection which I could not get to work correctly using the ViewBag (which
is why I changed to a ViewModel instead of ViewBag in the first place).
I'm not sure what-so-ever on how I would change the jquery function to
bind it to the DropDownListFor to listen for changes. Any ideas would be
very much appreciated.
This is an odd problem that I'm hoping someone can find an solution to. I
have essentially the same views that use dropdownlist with jqurey function
that shows and hides a field depending on the selection make in the
dropdownlist box. I have this working in a create view using ViewBag to
pass in the selectlist for the drop down. I was wondering if I could do
the same in my edit view using a view model and a DropDownListFor helper.
JQuery function in create view:
$("#GenderId").change(function () {
if ($("#SelectedGenderId").val() == 3) {
$(".gender-description").show();
} else {
$(".gender-description").hide();
}
});
And the Create View:
<div class="editor-label">
@Html.LabelFor(model => model.GenderId, "Gender")
</div>
<div class="editor-field">
@Html.DropDownList("GenderId", (SelectList)ViewBag.GenderId,
"--Select One--", new { id = "GenderId" })
@Html.ValidationMessageFor(model => model.GenderId)
</div>
<div class="gender-description">
<div class="editor-label">
@Html.LabelFor(model => model.GenderDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.GenderDescription)
@Html.ValidationMessageFor(model => model.GenderDescription)
</div>
</div>
In order to get my Edit view drop downs to work correctly I changed my
methodology to a view model instead of ViewBag (which I think I will also
want to change my Create View over to if I can get the edit view to work
correctly).
Edit View:
<div class="editor-label">
@Html.LabelFor(model => model.Client.GenderId, "Gender")
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.SelectedGenderId, Model.Genders)
@Html.ValidationMessageFor(model => model.Client.GenderId)
</div>
<div class="gender-description">
<div class="editor-label">
@Html.LabelFor(model => model.Client.GenderDescription)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Client.GenderDescription)
@Html.ValidationMessageFor(model =>
model.Client.GenderDescription)
</div>
</div>
View Model:
public class ClientViewModel
{
public Client Client { get; set; }
[Display(Name = "Client Gender")]
public string SelectedGenderId { get; set; }
public IEnumerable<SelectListItem> Genders { get; set; }
[Display(Name = "Client Setting")]
public string SelectedSettingId { get; set; }
public IEnumerable<SelectListItem> Settings { get; set; }
}
The ViewModel binding works and the drop downs populate with the existing
selection which I could not get to work correctly using the ViewBag (which
is why I changed to a ViewModel instead of ViewBag in the first place).
I'm not sure what-so-ever on how I would change the jquery function to
bind it to the DropDownListFor to listen for changes. Any ideas would be
very much appreciated.
Check and see if a sound is playing, wait for it to finish and then play another [android]
Check and see if a sound is playing, wait for it to finish and then play
another [android]
What i am trying to acomplish is for me to click on a button and then play
a sound based on a substring.
This is my current code for pressing the button :
display.setText("start");
thefull = thef.getText().toString();
for(int a=0;a<thefull.length();a++)
{
letter=thefull.substring(a,a+1);
if(letter=="m")
{
oursong = MediaPlayer.create(MainActivity.this, R.raw.m);
oursong.start();
while(oursong.isPlaying())
{
display.setText("start");
}
oursong.release();
}
else if(letter=="a")
{
oursong = MediaPlayer.create(MainActivity.this, R.raw.a);
oursong.start();
while(oursong.isPlaying())
{
display.setText("start");
}
oursong.release();
}
display.setText("done");
but for some reason when i click my button no sound is played. I am also
new to android and java programming, so am i going right about doing this?
Because what i really want is for the program to keep checking if a sound
is playing(in this case "oursound) when the button is clicked and if the
sound is playing i want the program to wait for it to finish to start
another sound right after it. But for now my code doesn´t play any sounds
Thanks in advanced for the help
another [android]
What i am trying to acomplish is for me to click on a button and then play
a sound based on a substring.
This is my current code for pressing the button :
display.setText("start");
thefull = thef.getText().toString();
for(int a=0;a<thefull.length();a++)
{
letter=thefull.substring(a,a+1);
if(letter=="m")
{
oursong = MediaPlayer.create(MainActivity.this, R.raw.m);
oursong.start();
while(oursong.isPlaying())
{
display.setText("start");
}
oursong.release();
}
else if(letter=="a")
{
oursong = MediaPlayer.create(MainActivity.this, R.raw.a);
oursong.start();
while(oursong.isPlaying())
{
display.setText("start");
}
oursong.release();
}
display.setText("done");
but for some reason when i click my button no sound is played. I am also
new to android and java programming, so am i going right about doing this?
Because what i really want is for the program to keep checking if a sound
is playing(in this case "oursound) when the button is clicked and if the
sound is playing i want the program to wait for it to finish to start
another sound right after it. But for now my code doesn´t play any sounds
Thanks in advanced for the help
Thursday, 29 August 2013
Get Twitter followers count
Get Twitter followers count
I used Twitter Followers as:
<a href="https://twitter.com/tamilcselvan" class="twitter-follow-button"
data-dnt="true">Follow @tamilcselvan</a>
<script>!function(d,s,id){var
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I want the twitter count from this twitter frame.
so i used a code as
twttr.ready(function (twttr) {
var a = window.frames[0];
a.document.getElementById('count').innerHTML;
});
I used Twitter Followers as:
<a href="https://twitter.com/tamilcselvan" class="twitter-follow-button"
data-dnt="true">Follow @tamilcselvan</a>
<script>!function(d,s,id){var
js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I want the twitter count from this twitter frame.
so i used a code as
twttr.ready(function (twttr) {
var a = window.frames[0];
a.document.getElementById('count').innerHTML;
});
Wednesday, 28 August 2013
Close the child window before submit the form
Close the child window before submit the form
I have a table data in a form and there is dynamic link in each row which
opens an external link in a new window. These rows are in n numbers with
dynamic id.
What I need here is,when user try to submit the table details, they must
close all the child windows. If any child div is still opened and if he
tries to submit the form, it should given alert to close the child windows
Here is the sample DEMO of the form
<form>
<table border="1">
<tr>
<td><input type="text" /></td>
<td>SC1</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC2</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC3</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
</tr>
</table>
<input type="submit" value="submit" />
</form>
I have a table data in a form and there is dynamic link in each row which
opens an external link in a new window. These rows are in n numbers with
dynamic id.
What I need here is,when user try to submit the table details, they must
close all the child windows. If any child div is still opened and if he
tries to submit the form, it should given alert to close the child windows
Here is the sample DEMO of the form
<form>
<table border="1">
<tr>
<td><input type="text" /></td>
<td>SC1</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC2</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
<tr>
<td><input type="text" /></td>
<td>SC3</td>
<td><a href="http://www.google.com">this is an external
link</a></td>
</tr>
</table>
<input type="submit" value="submit" />
</form>
NSContraintLayout does not get removed
NSContraintLayout does not get removed
pI have four simple NSLayoutConstraints to programmatically modify a NIB
layout. Yet altough I am able to insert them so modifying the layout,
nothing happens when I remove them, while I would expect the original
format to emerge again. That is my simple piece of code:/p precode[UIView
animateWithDuration:.6 animations:^{ if (show){ [self.view
removeConstraint:topConstraint]; [self.view
removeConstraint:leftConstraint]; [self.view
removeConstraint:bottomConstraint]; [self.view
removeConstraint:rightConstraint]; } else { [self.view
addConstraint:topConstraint]; [self.view addConstraint:leftConstraint];
[self.view addConstraint:bottomConstraint]; [self.view
addConstraint:rightConstraint]; }[self.view layoutIfNeeded]; } completion
:^(BOOL finished){ for (ImageToDrag* cursor in appDelegate.favorites){
[cursor setFrame:CGRectMake(cursor.frame.origin.x, (show?[cursor
favoritePosition]-cursor.frame.size.height/2:self.view.bounds.origin.y-200),
cursor.frame.size.width, cursor.frame.size.height)]; } }]; /code/pre
pWhile the layout, created in the init of the class are:/p
precodetopConstraint = [NSLayoutConstraint constraintWithItem:appendino
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual
toItem:self.backStatus attribute:NSLayoutAttributeBottom multiplier:1.0
constant:0]; topConstraint.priority=1000; leftConstraint =
[NSLayoutConstraint constraintWithItem:left
attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0
constant:0]; leftConstraint.priority=1000; bottomConstraint =
[NSLayoutConstraint constraintWithItem:bottom
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:self.fondino attribute:NSLayoutAttributeTop multiplier:1.0
constant:0]; bottomConstraint.priority=1000; rightConstraint =
[NSLayoutConstraint constraintWithItem:right
attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0
constant:0]; rightConstraint.priority=1000; /code/pre pAnother constraint
on the same layout works seamlessly./p pI tried leaving just one
constraint as well as taking the code out of the animation to no avail.
Might it be that some constraint may not be reversible, for some funny
reason? Really a creepy thought, though./p
pI have four simple NSLayoutConstraints to programmatically modify a NIB
layout. Yet altough I am able to insert them so modifying the layout,
nothing happens when I remove them, while I would expect the original
format to emerge again. That is my simple piece of code:/p precode[UIView
animateWithDuration:.6 animations:^{ if (show){ [self.view
removeConstraint:topConstraint]; [self.view
removeConstraint:leftConstraint]; [self.view
removeConstraint:bottomConstraint]; [self.view
removeConstraint:rightConstraint]; } else { [self.view
addConstraint:topConstraint]; [self.view addConstraint:leftConstraint];
[self.view addConstraint:bottomConstraint]; [self.view
addConstraint:rightConstraint]; }[self.view layoutIfNeeded]; } completion
:^(BOOL finished){ for (ImageToDrag* cursor in appDelegate.favorites){
[cursor setFrame:CGRectMake(cursor.frame.origin.x, (show?[cursor
favoritePosition]-cursor.frame.size.height/2:self.view.bounds.origin.y-200),
cursor.frame.size.width, cursor.frame.size.height)]; } }]; /code/pre
pWhile the layout, created in the init of the class are:/p
precodetopConstraint = [NSLayoutConstraint constraintWithItem:appendino
attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual
toItem:self.backStatus attribute:NSLayoutAttributeBottom multiplier:1.0
constant:0]; topConstraint.priority=1000; leftConstraint =
[NSLayoutConstraint constraintWithItem:left
attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0
constant:0]; leftConstraint.priority=1000; bottomConstraint =
[NSLayoutConstraint constraintWithItem:bottom
attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual
toItem:self.fondino attribute:NSLayoutAttributeTop multiplier:1.0
constant:0]; bottomConstraint.priority=1000; rightConstraint =
[NSLayoutConstraint constraintWithItem:right
attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual
toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0
constant:0]; rightConstraint.priority=1000; /code/pre pAnother constraint
on the same layout works seamlessly./p pI tried leaving just one
constraint as well as taking the code out of the animation to no avail.
Might it be that some constraint may not be reversible, for some funny
reason? Really a creepy thought, though./p
Flash/AS3: error #1010
Flash/AS3: error #1010
59 for (i=0; i < count; i++) //count = number of children
60 {
61 if (localXML.children()[i].Name.toString != firstName ¬
&& localXML.children()[i].Surname.toString != surName ¬
&& localXML.children()[i].Company.toString != companyName)
62 {
63 tempXML.appendChild(localXML.children()[i]);
64 }
65 trace("tempXML: --> "+tempXML);
66 localXML = tempXML; <---- WRONG PLACE!!!
67 }
Hello all. I'm getting an error #1010 at line 61.
I did test each value individually and everyone is traced normally. The
errors are:
TypeError: Error #1010: at ... frame9:61
The script is allways appending localXML.children()[0] and none else.
I can't see any error there. Any idea?
Thanks in advance.
SOLVED:
59 for (i=0; i < count; i++) //count = number of children
60 {
61 if (localXML.children()[i].Name != firstName ¬
&& localXML.children()[i].Surname != surName ¬
&& localXML.children()[i].Company != companyName)
62 {
63 tempXML.appendChild(localXML.children()[i]);
64 }
65 }
66 trace("tempXML: --> "+tempXML);
67 localXML = tempXML; <---- MOVED HERE!!!
59 for (i=0; i < count; i++) //count = number of children
60 {
61 if (localXML.children()[i].Name.toString != firstName ¬
&& localXML.children()[i].Surname.toString != surName ¬
&& localXML.children()[i].Company.toString != companyName)
62 {
63 tempXML.appendChild(localXML.children()[i]);
64 }
65 trace("tempXML: --> "+tempXML);
66 localXML = tempXML; <---- WRONG PLACE!!!
67 }
Hello all. I'm getting an error #1010 at line 61.
I did test each value individually and everyone is traced normally. The
errors are:
TypeError: Error #1010: at ... frame9:61
The script is allways appending localXML.children()[0] and none else.
I can't see any error there. Any idea?
Thanks in advance.
SOLVED:
59 for (i=0; i < count; i++) //count = number of children
60 {
61 if (localXML.children()[i].Name != firstName ¬
&& localXML.children()[i].Surname != surName ¬
&& localXML.children()[i].Company != companyName)
62 {
63 tempXML.appendChild(localXML.children()[i]);
64 }
65 }
66 trace("tempXML: --> "+tempXML);
67 localXML = tempXML; <---- MOVED HERE!!!
iOS 6 app running on iOS 7 style adherence
iOS 6 app running on iOS 7 style adherence
I have a CRUD-style app targeted for iOS 6 and I want to know what will
happen when my app run under iOS 7. Will it's default controls (textareas,
labels, buttons, etc...) adhere the "flat-design" style?
Is there a way to mark like "I'm targeting you, my app, to iOS 6 and if
you're running on iOS 6 use 'old-style', but if you're running on iOS 7
use 'new-style'"???
I would like that my app to have the "look'n feel" of the iOS it's running
on...
I have a CRUD-style app targeted for iOS 6 and I want to know what will
happen when my app run under iOS 7. Will it's default controls (textareas,
labels, buttons, etc...) adhere the "flat-design" style?
Is there a way to mark like "I'm targeting you, my app, to iOS 6 and if
you're running on iOS 6 use 'old-style', but if you're running on iOS 7
use 'new-style'"???
I would like that my app to have the "look'n feel" of the iOS it's running
on...
MySQL CREATE FUNCTION result with multiple records gives error #1172
MySQL CREATE FUNCTION result with multiple records gives error #1172
I have the following 3 tables:
table "name"
---------------
id name
---------------
1 book
2 pen
table "color"
------------------
id color
------------------
1 red
2 yello
3 green
4 pink
table "both"
------------------------
id name color
----------------------
1 1 1
2 1 2
3 1 3
4 2 2
and I have the following function:
DELIMITER //
CREATE FUNCTION get_word(n VARCHAR(20))
RETURNS VARCHAR(10)
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE b VARCHAR(20);
SELECT `color`.`color` INTO b FROM `name`
LEFT JOIN `both`
ON `name`.`id`=`both`.`name`
LEFT JOIN `color`
ON `color`.`id`=`both`.`color`
WHERE `name`.`name`=n;
RETURN b;
END//
DELIMITER ;
now when I run SELECT get_word('pen') it returns yellow which is what is
expect.
but when I run the code SELECT get_word('book') it get error: #1172 -
Result consisted of more than one row
my Question: What to do so this function works with multiple records as
well as single record which it does when I search for "pen"? thanks
I have the following 3 tables:
table "name"
---------------
id name
---------------
1 book
2 pen
table "color"
------------------
id color
------------------
1 red
2 yello
3 green
4 pink
table "both"
------------------------
id name color
----------------------
1 1 1
2 1 2
3 1 3
4 2 2
and I have the following function:
DELIMITER //
CREATE FUNCTION get_word(n VARCHAR(20))
RETURNS VARCHAR(10)
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE b VARCHAR(20);
SELECT `color`.`color` INTO b FROM `name`
LEFT JOIN `both`
ON `name`.`id`=`both`.`name`
LEFT JOIN `color`
ON `color`.`id`=`both`.`color`
WHERE `name`.`name`=n;
RETURN b;
END//
DELIMITER ;
now when I run SELECT get_word('pen') it returns yellow which is what is
expect.
but when I run the code SELECT get_word('book') it get error: #1172 -
Result consisted of more than one row
my Question: What to do so this function works with multiple records as
well as single record which it does when I search for "pen"? thanks
Drools how to make theorem prover using RETE?
Drools how to make theorem prover using RETE?
we need a system to prove theorem's like :
(A+B).(C+D) + E + C.(E+D) = A.C + A.D + B.C + B.D + E + C.E + C.D
these may be more complex
how to make a program for this using Drools ...
Tried making search tree using update modify methods but it was not
working out somehow.
we need a system to prove theorem's like :
(A+B).(C+D) + E + C.(E+D) = A.C + A.D + B.C + B.D + E + C.E + C.D
these may be more complex
how to make a program for this using Drools ...
Tried making search tree using update modify methods but it was not
working out somehow.
How to find the nearest line from a point
How to find the nearest line from a point
This is my problem :
I add points with mouse's click. The problem is to create new triangle
when i add new point. When the fourth point is added, how can i know the
line of the triangle is the nearest from the point added ? Thanks.
This is my problem :
I add points with mouse's click. The problem is to create new triangle
when i add new point. When the fourth point is added, how can i know the
line of the triangle is the nearest from the point added ? Thanks.
Tuesday, 27 August 2013
NuiGetSensorCount Java JNA
NuiGetSensorCount Java JNA
I am just learning how to use Java JNA, and I am trying to call a simple
function from the Microsoft Kinect SDK. (NuiGetSensorCount) which just
returns the number of connected kinects.
Here is my attempt:
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
public class Driver {
public interface KinectLibrary extends Library {
KinectLibrary INSTANCE =
(KinectLibrary)Native.loadLibrary(("Microsoft.Kinect"),KinectLibrary.class);
//_Check_return_ HRESULT NUIAPI NuiGetSensorCount( _In_ int *
pCount );
NativeLong NuiGetSensorCount(Pointer pCount);
}
public static void main(String[] args) {
Pointer devCount = new Pointer(0);
KinectLibrary.INSTANCE.NuiGetSensorCount(devCount);
System.out.println("Devices:"+devCount.getInt(0));
}
}
But I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking
up function 'NuiGetSensorCount': The specified procedure could not be
found.
at com.sun.jna.Function.<init>(Function.java:208)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
at com.sun.jna.Library$Handler.invoke(Library.java:199)
at $Proxy0.NuiGetSensorCount(Unknown Source)
at Driver.main(Driver.java:30)
Can anybody provide help of how to change my code so it finds the correct
native function? And also provide some information/reference so that I
could try to debug this myself (some way to see what function Java JNA is
looking for, and compare it to what the .dll contains)
I am just learning how to use Java JNA, and I am trying to call a simple
function from the Microsoft Kinect SDK. (NuiGetSensorCount) which just
returns the number of connected kinects.
Here is my attempt:
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
public class Driver {
public interface KinectLibrary extends Library {
KinectLibrary INSTANCE =
(KinectLibrary)Native.loadLibrary(("Microsoft.Kinect"),KinectLibrary.class);
//_Check_return_ HRESULT NUIAPI NuiGetSensorCount( _In_ int *
pCount );
NativeLong NuiGetSensorCount(Pointer pCount);
}
public static void main(String[] args) {
Pointer devCount = new Pointer(0);
KinectLibrary.INSTANCE.NuiGetSensorCount(devCount);
System.out.println("Devices:"+devCount.getInt(0));
}
}
But I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking
up function 'NuiGetSensorCount': The specified procedure could not be
found.
at com.sun.jna.Function.<init>(Function.java:208)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:499)
at com.sun.jna.Library$Handler.invoke(Library.java:199)
at $Proxy0.NuiGetSensorCount(Unknown Source)
at Driver.main(Driver.java:30)
Can anybody provide help of how to change my code so it finds the correct
native function? And also provide some information/reference so that I
could try to debug this myself (some way to see what function Java JNA is
looking for, and compare it to what the .dll contains)
Creating a Multivalue Field while grouping
Creating a Multivalue Field while grouping
I am creating a report where the data i am querying contains account's
which could have many categories..
Through a convoluted method of LEFT OUTER joins and UNIONS i was able to
bring all the categories on to the one account row
This took about 6 hours to complete..
It would be nice to create a query/report that just groups by account and
any categories are just rolled up into the one column. This could be just
a text string if need be.
What are some ways of achieveing the result?
Thanks Craig
I am creating a report where the data i am querying contains account's
which could have many categories..
Through a convoluted method of LEFT OUTER joins and UNIONS i was able to
bring all the categories on to the one account row
This took about 6 hours to complete..
It would be nice to create a query/report that just groups by account and
any categories are just rolled up into the one column. This could be just
a text string if need be.
What are some ways of achieveing the result?
Thanks Craig
Backbone Views within Views within Views - why does this.$el.html('insert some content here') do nothing?
Backbone Views within Views within Views - why does this.$el.html('insert
some content here') do nothing?
This is going to be quite a complex one, so I'll keep adding to it as I go
along.
My app is structured out of two primary types of Views - a standard View
and a Region (a special type of View solely intended to contain other
views. My root app view is a region, consisting of various other regions
that I can then 'plug' views into as needed.
All of my views that sit in the main app regions (header, footer, modals
etc.) all work absolutely fine. Today I tried creating some sub regions,
within other views and I've hit a snag. For some bizare reason, when I
call this.$el.html() on the region to pass in the output of the region's
assigned view nothing happens. I can step through the code and the view is
rendering within itself nicely, and I can see the markup by looking at the
object model in the console. However it never actually joins up to the
page and all I see is the markup that represents the region wrapper.
Here's some code - hopefully it'll make some sense, this goes down quite a
few levels though...
Firstly my base classes for views and regions...
define(['backbone', 'helpers/cookie-manager'],
function (Backbone, CookieManager) {
var spinner = "<img src='/content/images/global/ajax-loader.png'
alt='loading...' />";
var ministryView = Backbone.View.extend({
name: 'Unnamed View',
sectionName: 'No section specified',
stateRequired: false,
template: undefined,
bindings: [],
initialize: function (options) {
this.options = options || {};
Backbone.View.prototype.initialize.call(this, options);
if (this.options.name) {
this.name = this.options.name;
}
if (this.options.sectionName) {
this.sectionName = this.options.sectionName;
}
if (this.options.template) {
this.template = this.options.template;
}
},
bindToModel: function (model, ev, callback, that) {
if (that === undefined || that === null) {
throw "The value of 'that' needs the context of the
extending class in order to operate correctly.";
}
model.bind(ev, callback, that);
this.bindings.push({ model: model, ev: ev, callback:
callback });
},
dispose: function () {
this.unbindFromAllModels(); // Will unbind all events
this view has bound to
this.stopListening();
this.unbind(); // This will unbind all
listeners to events from this view. This is probably not
necessary because this view will be garbage collected.
this.remove(); // Uses the default
Backbone.View.remove() method which removes this.el from
the DOM and removes DOM events.
this.undelegateEvents();
},
render: function () {
this.trigger('rendered');
return this;
},
resetStyleState: function(condition) {
},
trash: function () {
this.dispose();
},
unbindFromAllModels: function () {
_.each(this.bindings, function (binding) {
binding.model.unbind(binding.ev, binding.callback);
});
this.bindings = [];
}
});
var ministryRegion = ministryView.extend({
name: 'Unnamed Region',
currentView: undefined,
initialize: function (options) {
this.options = options || {};
ministryView.prototype.initialize.call(this, options);
if (this.options.currentView) {
this.currentView = this.options.currentView;
}
_.bindAll(this, 'placeRenderedView');
_.bindAll(this, 'showRendering');
},
placeRenderedView: function () {
this.$el.html(this.currentView.$el);
this.currentView.delegateEvents();
if (this.currentView.postRender !== undefined &&
this.currentView.postRender !== null) {
this.currentView.postRender();
}
},
renderView: function (view) {
if (view) {
if (this.currentView) {
this.currentView.trash();
}
this.currentView = view;
}
this.currentView.bind('rendering', this.showRendering);
this.currentView.bind('rendered', this.placeRenderedView);
this.currentView.render();
},
showRendering: function () {
this.$el.html(spinner);
},
trash: function(disposeRegion) {
this.currentView.trash();
if (disposeRegion !== undefined && disposeRegion !== null
&& disposeRegion !== false) {
this.dispose();
}
}
});
return {
View: ministryView,
Region: ministryRegion
};
});
Now the view that loads into the app, that contains the region that I want
to load the view into (mealPlansRegion)...
define(['ministry', 'jquery', 'views/v-header', 'models/m-ns',
'views/components/components', 'text!templates/hub/member-home.html'],
function (Ministry, $, Header, Models, Components, TemplateSource) {
var memberHomeMealPlansRegion = Ministry.Region.extend({
el: '.meal-plans-container'
});
var memberHomeView = Ministry.SecureView.extend({
name: 'Member Home',
sectionName: 'Hub',
mealPlansRegion: undefined,
template: Handlebars.compile(TemplateSource),
headerView: new Header({ text: 'Kitchen Hub', swatch: 'a' }),
initialize: function (options) {
Ministry.SecureView.prototype.initialize.call(this, options);
},
// Need to override the normal secured view implementation.
render: function () {
this.$el.html(this.template(this));
this.mealPlansRegion = new memberHomeMealPlansRegion();
this.mealPlansRegion.renderView(new
Components.MealPlansList({ collection: new
Models.MealPlan.OwnedCollection({ username:
SiansPlanApp.session.username() }) }));
this.trigger('rendered');
return this;
},
postRender: function () {
if (!this.isSecured()) {
SiansPlanApp.router.navigate('/');
SiansPlanApp.renderHome(false);
}
}
});
return memberHomeView;
});
... and it's template ...
<section class="meal-plans-container">
</section>
... just contains a placeholder at the moment for the region. Eventually,
the intention is to have several of these here with interchangeable
content. Finally, here's the view I'm trying to load in...
define(['ministry', 'jquery', 'models/m-meal-plan',
'text!templates/components/meal-plans-list.html'],
function(Ministry, $, MealPlan, TemplateSource) {
var mealPlansListView = Ministry.SecureView.extend({
name: 'Meal Plans List Component',
template: Handlebars.compile(TemplateSource),
render: function () {
var that = this;
if (this.isSecured()) {
this.collection.on('fetching', function () {
that.trigger('rendering');
});
this.collection.fetch({
success: function() {
that.bindData();
that.trigger('rendered');
},
error: function(model, xhr) {
that.$el.html('Unable to fetch meal plan data');
if (console !== undefined && console !== null) {
console.log('Fetch Meal Plan failed: ' +
xhr.responseText);
}
that.trigger('rendered');
}
});
} else {
this.applySecureLoginPrompt();
}
return this;
},
bindData: function () {
this.$el.html(this.template({ plans:
this.collection.toJSON() }));
}
});
return mealPlansListView;
});
and it's template...
<ul id="mealPlansList" class="swatch-listview-b">
<li class="listview-header">Meal Plans</li>
<li><span class="meal-plan-id-holder hidden">
</ul>
for this particular view, this part of the common region code fails...
placeRenderedView: function () {
this.$el.html(this.currentView.$el);
this.currentView.delegateEvents();
if (this.currentView.postRender !== undefined &&
this.currentView.postRender !== null) {
this.currentView.postRender();
}
},
... and the this.$el.html(this.currentView.$el); line doesn't do anything
at all.
If I can provide anything else to help, please let me know.
some content here') do nothing?
This is going to be quite a complex one, so I'll keep adding to it as I go
along.
My app is structured out of two primary types of Views - a standard View
and a Region (a special type of View solely intended to contain other
views. My root app view is a region, consisting of various other regions
that I can then 'plug' views into as needed.
All of my views that sit in the main app regions (header, footer, modals
etc.) all work absolutely fine. Today I tried creating some sub regions,
within other views and I've hit a snag. For some bizare reason, when I
call this.$el.html() on the region to pass in the output of the region's
assigned view nothing happens. I can step through the code and the view is
rendering within itself nicely, and I can see the markup by looking at the
object model in the console. However it never actually joins up to the
page and all I see is the markup that represents the region wrapper.
Here's some code - hopefully it'll make some sense, this goes down quite a
few levels though...
Firstly my base classes for views and regions...
define(['backbone', 'helpers/cookie-manager'],
function (Backbone, CookieManager) {
var spinner = "<img src='/content/images/global/ajax-loader.png'
alt='loading...' />";
var ministryView = Backbone.View.extend({
name: 'Unnamed View',
sectionName: 'No section specified',
stateRequired: false,
template: undefined,
bindings: [],
initialize: function (options) {
this.options = options || {};
Backbone.View.prototype.initialize.call(this, options);
if (this.options.name) {
this.name = this.options.name;
}
if (this.options.sectionName) {
this.sectionName = this.options.sectionName;
}
if (this.options.template) {
this.template = this.options.template;
}
},
bindToModel: function (model, ev, callback, that) {
if (that === undefined || that === null) {
throw "The value of 'that' needs the context of the
extending class in order to operate correctly.";
}
model.bind(ev, callback, that);
this.bindings.push({ model: model, ev: ev, callback:
callback });
},
dispose: function () {
this.unbindFromAllModels(); // Will unbind all events
this view has bound to
this.stopListening();
this.unbind(); // This will unbind all
listeners to events from this view. This is probably not
necessary because this view will be garbage collected.
this.remove(); // Uses the default
Backbone.View.remove() method which removes this.el from
the DOM and removes DOM events.
this.undelegateEvents();
},
render: function () {
this.trigger('rendered');
return this;
},
resetStyleState: function(condition) {
},
trash: function () {
this.dispose();
},
unbindFromAllModels: function () {
_.each(this.bindings, function (binding) {
binding.model.unbind(binding.ev, binding.callback);
});
this.bindings = [];
}
});
var ministryRegion = ministryView.extend({
name: 'Unnamed Region',
currentView: undefined,
initialize: function (options) {
this.options = options || {};
ministryView.prototype.initialize.call(this, options);
if (this.options.currentView) {
this.currentView = this.options.currentView;
}
_.bindAll(this, 'placeRenderedView');
_.bindAll(this, 'showRendering');
},
placeRenderedView: function () {
this.$el.html(this.currentView.$el);
this.currentView.delegateEvents();
if (this.currentView.postRender !== undefined &&
this.currentView.postRender !== null) {
this.currentView.postRender();
}
},
renderView: function (view) {
if (view) {
if (this.currentView) {
this.currentView.trash();
}
this.currentView = view;
}
this.currentView.bind('rendering', this.showRendering);
this.currentView.bind('rendered', this.placeRenderedView);
this.currentView.render();
},
showRendering: function () {
this.$el.html(spinner);
},
trash: function(disposeRegion) {
this.currentView.trash();
if (disposeRegion !== undefined && disposeRegion !== null
&& disposeRegion !== false) {
this.dispose();
}
}
});
return {
View: ministryView,
Region: ministryRegion
};
});
Now the view that loads into the app, that contains the region that I want
to load the view into (mealPlansRegion)...
define(['ministry', 'jquery', 'views/v-header', 'models/m-ns',
'views/components/components', 'text!templates/hub/member-home.html'],
function (Ministry, $, Header, Models, Components, TemplateSource) {
var memberHomeMealPlansRegion = Ministry.Region.extend({
el: '.meal-plans-container'
});
var memberHomeView = Ministry.SecureView.extend({
name: 'Member Home',
sectionName: 'Hub',
mealPlansRegion: undefined,
template: Handlebars.compile(TemplateSource),
headerView: new Header({ text: 'Kitchen Hub', swatch: 'a' }),
initialize: function (options) {
Ministry.SecureView.prototype.initialize.call(this, options);
},
// Need to override the normal secured view implementation.
render: function () {
this.$el.html(this.template(this));
this.mealPlansRegion = new memberHomeMealPlansRegion();
this.mealPlansRegion.renderView(new
Components.MealPlansList({ collection: new
Models.MealPlan.OwnedCollection({ username:
SiansPlanApp.session.username() }) }));
this.trigger('rendered');
return this;
},
postRender: function () {
if (!this.isSecured()) {
SiansPlanApp.router.navigate('/');
SiansPlanApp.renderHome(false);
}
}
});
return memberHomeView;
});
... and it's template ...
<section class="meal-plans-container">
</section>
... just contains a placeholder at the moment for the region. Eventually,
the intention is to have several of these here with interchangeable
content. Finally, here's the view I'm trying to load in...
define(['ministry', 'jquery', 'models/m-meal-plan',
'text!templates/components/meal-plans-list.html'],
function(Ministry, $, MealPlan, TemplateSource) {
var mealPlansListView = Ministry.SecureView.extend({
name: 'Meal Plans List Component',
template: Handlebars.compile(TemplateSource),
render: function () {
var that = this;
if (this.isSecured()) {
this.collection.on('fetching', function () {
that.trigger('rendering');
});
this.collection.fetch({
success: function() {
that.bindData();
that.trigger('rendered');
},
error: function(model, xhr) {
that.$el.html('Unable to fetch meal plan data');
if (console !== undefined && console !== null) {
console.log('Fetch Meal Plan failed: ' +
xhr.responseText);
}
that.trigger('rendered');
}
});
} else {
this.applySecureLoginPrompt();
}
return this;
},
bindData: function () {
this.$el.html(this.template({ plans:
this.collection.toJSON() }));
}
});
return mealPlansListView;
});
and it's template...
<ul id="mealPlansList" class="swatch-listview-b">
<li class="listview-header">Meal Plans</li>
<li><span class="meal-plan-id-holder hidden">
</ul>
for this particular view, this part of the common region code fails...
placeRenderedView: function () {
this.$el.html(this.currentView.$el);
this.currentView.delegateEvents();
if (this.currentView.postRender !== undefined &&
this.currentView.postRender !== null) {
this.currentView.postRender();
}
},
... and the this.$el.html(this.currentView.$el); line doesn't do anything
at all.
If I can provide anything else to help, please let me know.
Instrumentation run: java.lang.Error with Class init failed in Constructor eror
Instrumentation run: java.lang.Error with Class init failed in Constructor
eror
I wrote an instrumentation test: Exactly it shows an Verify error:
public WebViewActivityTest() { super(WebViewActivity.class); Constructor
used:
W/dalvikvm( 858): Class init failed in Constructor.constructNative
(Lcom/amazon/webviewapp/test/WebViewActivityTest;)
D/AndroidRuntime( 858): Shutting down VM
W/dalvikvm( 858): threadid=1: thread exiting with uncaught exception
(group=0x40a70930)
E/AndroidRuntime( 858): FATAL EXCEPTION: main
E/AndroidRuntime( 858): java.lang.VerifyError:
com/amazon/webviewapp/test/WebViewActivityTest
E/AndroidRuntime( 858): at
java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 858): at
java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.createTest(TestSuite.java:61)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.addTestMethod(TestSuite.java:294)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
E/AndroidRuntime( 858): at junit.framework.TestSuite.(TestSuite.java:129)
E/AndroidRuntime( 858): at
junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:118)
E/AndroidRuntime( 858): at
android.test.AndroidTestRunner.getTest(AndroidTestRunner.java:148)
E/AndroidRuntime( 858): at
android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:56)
E/AndroidRuntime( 858): at
android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:80)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:444)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:425)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:370)
E/AndroidRuntime( 858): at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4382)
E/AndroidRuntime( 858): at
android.app.ActivityThread.access$1300(ActivityThread.java:141)
E/AndroidRuntime( 858): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
E/AndroidRuntime( 858): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 858): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 858): at
android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime( 858): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 858): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 858): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 858): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 858): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 285): Error in app com.amazon.webviewapp running
instrumentation
ComponentInfo{com.amazon.webviewapp.test/android.test.InstrumentationTestRunner}:
W/ActivityManager( 285): java.lang.VerifyError
W/ActivityManager( 285): java.lang.VerifyError:
com/amazon/webviewapp/test/WebViewActivityTest
D/AndroidRuntime( 848): Shutting down VM
eror
I wrote an instrumentation test: Exactly it shows an Verify error:
public WebViewActivityTest() { super(WebViewActivity.class); Constructor
used:
W/dalvikvm( 858): Class init failed in Constructor.constructNative
(Lcom/amazon/webviewapp/test/WebViewActivityTest;)
D/AndroidRuntime( 858): Shutting down VM
W/dalvikvm( 858): threadid=1: thread exiting with uncaught exception
(group=0x40a70930)
E/AndroidRuntime( 858): FATAL EXCEPTION: main
E/AndroidRuntime( 858): java.lang.VerifyError:
com/amazon/webviewapp/test/WebViewActivityTest
E/AndroidRuntime( 858): at
java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 858): at
java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.createTest(TestSuite.java:61)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.addTestMethod(TestSuite.java:294)
E/AndroidRuntime( 858): at
junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150)
E/AndroidRuntime( 858): at junit.framework.TestSuite.(TestSuite.java:129)
E/AndroidRuntime( 858): at
junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:118)
E/AndroidRuntime( 858): at
android.test.AndroidTestRunner.getTest(AndroidTestRunner.java:148)
E/AndroidRuntime( 858): at
android.test.AndroidTestRunner.setTestClassName(AndroidTestRunner.java:56)
E/AndroidRuntime( 858): at
android.test.suitebuilder.TestSuiteBuilder.addTestClassByName(TestSuiteBuilder.java:80)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.parseTestClass(InstrumentationTestRunner.java:444)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.parseTestClasses(InstrumentationTestRunner.java:425)
E/AndroidRuntime( 858): at
android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:370)
E/AndroidRuntime( 858): at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4382)
E/AndroidRuntime( 858): at
android.app.ActivityThread.access$1300(ActivityThread.java:141)
E/AndroidRuntime( 858): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
E/AndroidRuntime( 858): at
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 858): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 858): at
android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime( 858): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 858): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 858): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 858): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 858): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 285): Error in app com.amazon.webviewapp running
instrumentation
ComponentInfo{com.amazon.webviewapp.test/android.test.InstrumentationTestRunner}:
W/ActivityManager( 285): java.lang.VerifyError
W/ActivityManager( 285): java.lang.VerifyError:
com/amazon/webviewapp/test/WebViewActivityTest
D/AndroidRuntime( 848): Shutting down VM
How to add call a callback in the Activity when there is a Fragment pushed from back stack
How to add call a callback in the Activity when there is a Fragment pushed
from back stack
please give me advice how to handle following situation.. I have a main
Activity with navigation drawer..When the user clicks on items in the
drawer, I change currently attached fragment with another one -
accordingly to the pressed drawer item. I also want to handle the
situation when the user clicks on the item related to at the same time
already attached fragmen and avoid fragment recreate..
So I came up with following solution. I have an property in which I hold
the TAG of my current fragment. When the user clicks on any item form the
drawer I check the if TAGs are matching and of not I do a switch..I works.
But I have an problem with back stack navigation. I dont know how to
change the TAG holding property when the user clicks on the back button.
The fragment changes properly, but the TAG property stays the same, so
that it all becames broken (when the user clicks on the item he was
before, he is not redirected and furthemore after click on the item
related to the fragment pushed from back stack it does the recreate:/)
Hope you guys got where is my problem..I dont give here any code. I just
think its not necessary, because my problem is not actually in an existing
part of my code, but in a hypothetical yet nonexisting one:) I just need
to handle the pushed-from-backstack situation..
Thanks in advance!
from back stack
please give me advice how to handle following situation.. I have a main
Activity with navigation drawer..When the user clicks on items in the
drawer, I change currently attached fragment with another one -
accordingly to the pressed drawer item. I also want to handle the
situation when the user clicks on the item related to at the same time
already attached fragmen and avoid fragment recreate..
So I came up with following solution. I have an property in which I hold
the TAG of my current fragment. When the user clicks on any item form the
drawer I check the if TAGs are matching and of not I do a switch..I works.
But I have an problem with back stack navigation. I dont know how to
change the TAG holding property when the user clicks on the back button.
The fragment changes properly, but the TAG property stays the same, so
that it all becames broken (when the user clicks on the item he was
before, he is not redirected and furthemore after click on the item
related to the fragment pushed from back stack it does the recreate:/)
Hope you guys got where is my problem..I dont give here any code. I just
think its not necessary, because my problem is not actually in an existing
part of my code, but in a hypothetical yet nonexisting one:) I just need
to handle the pushed-from-backstack situation..
Thanks in advance!
Adding Button and Separate Window to Python QProcess Example
Adding Button and Separate Window to Python QProcess Example
I'm trying to use QProcess and read the stdout to a QTextEdit initiated by
a button. How can I adapt this example to do so? Do I have to call a
separate class for the QProcess?
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
class MyQProcess(QProcess):
def __init__(self):
#Call base class method
QProcess.__init__(self)
#Create an instance variable here (of type QTextEdit)
self.edit = QTextEdit()
self.edit.setWindowTitle("QTextEdit Standard Output Redirection")
self.edit.show()
#Define Slot Here
@pyqtSlot()
def readStdOutput(self):
self.edit.append(QString(self.readAllStandardOutput()))
def main():
app = QApplication(sys.argv)
qProcess = MyQProcess()
qProcess.setProcessChannelMode(QProcess.MergedChannels);
qProcess.start("ldconfig -v")
QObject.connect(qProcess,SIGNAL("readyReadStandardOutput()"),qProcess,SLOT("readStdOutput()"));
return app.exec_()
if __name__ == '__main__':
main()
I'm trying to use QProcess and read the stdout to a QTextEdit initiated by
a button. How can I adapt this example to do so? Do I have to call a
separate class for the QProcess?
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
class MyQProcess(QProcess):
def __init__(self):
#Call base class method
QProcess.__init__(self)
#Create an instance variable here (of type QTextEdit)
self.edit = QTextEdit()
self.edit.setWindowTitle("QTextEdit Standard Output Redirection")
self.edit.show()
#Define Slot Here
@pyqtSlot()
def readStdOutput(self):
self.edit.append(QString(self.readAllStandardOutput()))
def main():
app = QApplication(sys.argv)
qProcess = MyQProcess()
qProcess.setProcessChannelMode(QProcess.MergedChannels);
qProcess.start("ldconfig -v")
QObject.connect(qProcess,SIGNAL("readyReadStandardOutput()"),qProcess,SLOT("readStdOutput()"));
return app.exec_()
if __name__ == '__main__':
main()
Monday, 26 August 2013
Notify android users of my website to install android app from website?
Notify android users of my website to install android app from website?
I have a blog and created an android app for that. I want my android
visitors to be notified about my app when they visit my website through an
android device.
A small ticker or pop up about the app would be great and clicking it
should lead to play store market place.
Is there a drag and drop javascript solution available to do that?
Please help. your input is appreciated.
Thanks !!
I have a blog and created an android app for that. I want my android
visitors to be notified about my app when they visit my website through an
android device.
A small ticker or pop up about the app would be great and clicking it
should lead to play store market place.
Is there a drag and drop javascript solution available to do that?
Please help. your input is appreciated.
Thanks !!
Lightweight memory leak debugging on linux
Lightweight memory leak debugging on linux
I looked for existing answers first and saw that Valgrind is everyone's
favorite tool for memory leak debugging on linux. Unfortunately Valgrind
does not seem to work for my purposes. I will try to explain why.
Constraints:
The leak reproduces only in customer's environment. Due to certain legal
restrictions we have to work with existing binary. No rebuilds.
In regular environment our application consumes ~10% CPU. Say, we can
tolerate up to 10x CPU usage increase. Valgrind with default memcheck
settings does much worse making our application unresponsive for long
periods of time.
What I need is an equivalent of Microsoft's UMDH: turn on stack tracing
for each heap allocation, then at certain point of time dump all
allocations grouped by stacks and ordered by allocation count in
descending order. Our app ships on both Windows and Linux platforms, so I
know that performance on Windows under UMDH is still tolerable.
Here are the tools/methods I considered
Valgrind's -memcheck and –massif tools They do much more than needed (like
scanning whole process memory for every allocation pointer), they are too
slow, and they still don't do exactly what I
need (dump callstacks sorted by counts), so I will have to write some
scripts parsing the output
dmalloc library (dmalloc.com) requires new binary
LeakTracer (http://www.andreasen.org/LeakTracer/) Works only with C++
new/delete (I need malloc/free as well), does not have group-by-stack and
sort functionality
Implementing the tool myself as .so library using LD_PRELOAD mechanism
(Overriding 'malloc' using the LD_PRELOAD mechanism) That will take at
least a week given my coding-for-Linux skills and it fills like inventing
a bicycle.
Did I miss anything? Are there any lightweight Valgrind options or
existing LD_PRELOAD tool?
I looked for existing answers first and saw that Valgrind is everyone's
favorite tool for memory leak debugging on linux. Unfortunately Valgrind
does not seem to work for my purposes. I will try to explain why.
Constraints:
The leak reproduces only in customer's environment. Due to certain legal
restrictions we have to work with existing binary. No rebuilds.
In regular environment our application consumes ~10% CPU. Say, we can
tolerate up to 10x CPU usage increase. Valgrind with default memcheck
settings does much worse making our application unresponsive for long
periods of time.
What I need is an equivalent of Microsoft's UMDH: turn on stack tracing
for each heap allocation, then at certain point of time dump all
allocations grouped by stacks and ordered by allocation count in
descending order. Our app ships on both Windows and Linux platforms, so I
know that performance on Windows under UMDH is still tolerable.
Here are the tools/methods I considered
Valgrind's -memcheck and –massif tools They do much more than needed (like
scanning whole process memory for every allocation pointer), they are too
slow, and they still don't do exactly what I
need (dump callstacks sorted by counts), so I will have to write some
scripts parsing the output
dmalloc library (dmalloc.com) requires new binary
LeakTracer (http://www.andreasen.org/LeakTracer/) Works only with C++
new/delete (I need malloc/free as well), does not have group-by-stack and
sort functionality
Implementing the tool myself as .so library using LD_PRELOAD mechanism
(Overriding 'malloc' using the LD_PRELOAD mechanism) That will take at
least a week given my coding-for-Linux skills and it fills like inventing
a bicycle.
Did I miss anything? Are there any lightweight Valgrind options or
existing LD_PRELOAD tool?
Angularjs controller communicate with another controller in a different file
Angularjs controller communicate with another controller in a different file
I have one controller in file a, and when it does something I want it to
call a function, or a controller in file b. Is that possible? I'm using
ng-grid, so my reasoning for this is when afterSelectionChange is called
in file a, I want my other grid to update, and I can't merge the files or
use a $watch function since that takes up too much time when loading a
page. I am ultimately trying to fix this problem too. They are the same:
Ng-Grid flickers grid when updating
and this is just another look at it. If someone could answer either that
would be great!
I have one controller in file a, and when it does something I want it to
call a function, or a controller in file b. Is that possible? I'm using
ng-grid, so my reasoning for this is when afterSelectionChange is called
in file a, I want my other grid to update, and I can't merge the files or
use a $watch function since that takes up too much time when loading a
page. I am ultimately trying to fix this problem too. They are the same:
Ng-Grid flickers grid when updating
and this is just another look at it. If someone could answer either that
would be great!
How does finder figure this directory is 6MB?
How does finder figure this directory is 6MB?
http://imgur.com/utTnUmM
See the image above, the directory says its 6MB, but theres about 10
160byte files.
http://imgur.com/utTnUmM
See the image above, the directory says its 6MB, but theres about 10
160byte files.
Adobe Reader XI automaticly save as itself
Adobe Reader XI automaticly save as itself
Is it possible to make my Adobe Reader XI overwrite it's own file when I
click SAVE, instead of acting like I've clicked Save As.. and ask me about
file name and all that nonsense. Preferably I should click SAVE after
making my edits, and that would be it. No more dialogs. - Thank you if you
are able to answer :)
Is it possible to make my Adobe Reader XI overwrite it's own file when I
click SAVE, instead of acting like I've clicked Save As.. and ask me about
file name and all that nonsense. Preferably I should click SAVE after
making my edits, and that would be it. No more dialogs. - Thank you if you
are able to answer :)
unable to access jquery data set within ajax success
unable to access jquery data set within ajax success
I have some thing like this:
$.ajax({
type: 'GET',
url: my_url,
success: function(data) {
$('#some_div').data('test', 'This is a test');
}
});
Then outside of the success callback, I tried to access my test variable like
console.debug($('#some_div').data('test'));
But this returns undefined
Any help please
Thank you
I have some thing like this:
$.ajax({
type: 'GET',
url: my_url,
success: function(data) {
$('#some_div').data('test', 'This is a test');
}
});
Then outside of the success callback, I tried to access my test variable like
console.debug($('#some_div').data('test'));
But this returns undefined
Any help please
Thank you
Need help to execute sql scripts within stored procedure
Need help to execute sql scripts within stored procedure
Need help as how I can trap any errors related to executing a sql script
in a stored procedure.
select sopScript from M_SopInsert where soptype = @soptype and sopnumbe =
@sopnumbe and lnitmseq = @lnitmseq
If result_count > 0 //if result from above sql query is >0
exec sopScript //loop through the record set and execute sopscript for
every record.
Note: sopscript here contains scripts like "update customerMaster set
custname='abc' where custid=100"
Please do not get upset with this question as I am new to sql stored
procedures.
Need help as how I can trap any errors related to executing a sql script
in a stored procedure.
select sopScript from M_SopInsert where soptype = @soptype and sopnumbe =
@sopnumbe and lnitmseq = @lnitmseq
If result_count > 0 //if result from above sql query is >0
exec sopScript //loop through the record set and execute sopscript for
every record.
Note: sopscript here contains scripts like "update customerMaster set
custname='abc' where custid=100"
Please do not get upset with this question as I am new to sql stored
procedures.
Loading images in a Listview properly
Loading images in a Listview properly
I'm using the Universal Image Loader library to load images in my
listview, it loads the images but I notice that if you scroll quickly the
first time you can see the wrong images being loaded first before the
correct image.
How can I stop this effect. Here is my entire class below.
public MyListAdapter(Context context, List<VenueDetails> m_venue_details) {
super(context, R.layout.venue_list_row, m_venue_details);
this.context = context;
this.venue_details = new ArrayList<VenueDetails>();
this.venue_details = m_venue_details;
df = new DecimalFormat("#.##");
}
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public View getView(int position, View v, ViewGroup parent) {
final ViewHolder holder;
final VenueDetails vD = venue_details.get(position);
if (inflater == null) {
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
if (v == null) {
v = inflater.inflate(R.layout.venue_list_row, parent,false);
holder = new ViewHolder();
holder.venue_name = (TextView) v.findViewById(R.id.venue_name);
holder.venue_dist = (TextView) v.findViewById(R.id.venue_dist);
holder.curr_loc = (TextView) v.findViewById(R.id.curr_loc);
holder.ll = (FrameLayout) v.findViewById(R.id.venue_frame);
holder.pett_btn = (Button) v.findViewById(R.id.venue_pett);
holder.img = (ImageView) v.findViewById(R.id.venue_logo);
v.setTag(holder);
}else{
holder = (ViewHolder) v.getTag();
}
holder.img.setTag(vD.logo);
if(vD.list_img == null){
myAppObj.getImageLoader().loadImage(holder.img.getTag().toString(),
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
holder.img.setBackgroundResource(R.drawable.placeholder_venue);
}
@Override
public void onLoadingFailed(String imageUri, View view,
FailReason failReason) {
holder.img.setBackgroundResource(R.drawable.placeholder_pin);
}
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
holder.img.setBackgroundDrawable(new
BitmapDrawable(loadedImage));
if(vD.list_img == null){
vD.list_img = new BitmapDrawable(loadedImage);
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
holder.img.setBackgroundResource(R.drawable.placeholder_venue);
}
});
}else{
holder.img.setBackgroundDrawable(vD.list_img);
}
if(vD != null){
holder.venue_name.setText(vD.venueName.toUpperCase());
venue_details.get(position).venue_distance =
Double.parseDouble(df.format(Utils.distance(myAppObj.getMyLatitude(),
myAppObj.getMyLongitude(), vD.latitude, vD.longitude, 'K') *
0.000621371192));
holder.venue_dist.setText(df.format(vD.venue_distance)+" Miles");
holder.venue_curr_loc.setText(my_address.toUpperCase());
if (vD.petted == 1) {
holder.pett_btn.setVisibility(View.VISIBLE);
holder.ll.setVisibility(View.VISIBLE);
holder.pett_btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(dialog_Callback!=null)
dialog_Callback.onDialogCalled(0, vD.id);
}
});
} else {
holder.pett_btn.setVisibility(View.GONE);
holder.ll.setVisibility(View.GONE);
}
}
return v;
}
@Override
public boolean isEnabled(int position) {
if (venue_details.get(position).petted == 1) {
return false;
} else {
return true;
}
}
static class ViewHolder{
TextView venue_name;
TextView venue_dist;
TextView venue_curr_loc;
FrameLayout ll;
Button pett_btn;
ImageView img;
}
I'm using the Universal Image Loader library to load images in my
listview, it loads the images but I notice that if you scroll quickly the
first time you can see the wrong images being loaded first before the
correct image.
How can I stop this effect. Here is my entire class below.
public MyListAdapter(Context context, List<VenueDetails> m_venue_details) {
super(context, R.layout.venue_list_row, m_venue_details);
this.context = context;
this.venue_details = new ArrayList<VenueDetails>();
this.venue_details = m_venue_details;
df = new DecimalFormat("#.##");
}
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public View getView(int position, View v, ViewGroup parent) {
final ViewHolder holder;
final VenueDetails vD = venue_details.get(position);
if (inflater == null) {
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
if (v == null) {
v = inflater.inflate(R.layout.venue_list_row, parent,false);
holder = new ViewHolder();
holder.venue_name = (TextView) v.findViewById(R.id.venue_name);
holder.venue_dist = (TextView) v.findViewById(R.id.venue_dist);
holder.curr_loc = (TextView) v.findViewById(R.id.curr_loc);
holder.ll = (FrameLayout) v.findViewById(R.id.venue_frame);
holder.pett_btn = (Button) v.findViewById(R.id.venue_pett);
holder.img = (ImageView) v.findViewById(R.id.venue_logo);
v.setTag(holder);
}else{
holder = (ViewHolder) v.getTag();
}
holder.img.setTag(vD.logo);
if(vD.list_img == null){
myAppObj.getImageLoader().loadImage(holder.img.getTag().toString(),
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
holder.img.setBackgroundResource(R.drawable.placeholder_venue);
}
@Override
public void onLoadingFailed(String imageUri, View view,
FailReason failReason) {
holder.img.setBackgroundResource(R.drawable.placeholder_pin);
}
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
holder.img.setBackgroundDrawable(new
BitmapDrawable(loadedImage));
if(vD.list_img == null){
vD.list_img = new BitmapDrawable(loadedImage);
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
holder.img.setBackgroundResource(R.drawable.placeholder_venue);
}
});
}else{
holder.img.setBackgroundDrawable(vD.list_img);
}
if(vD != null){
holder.venue_name.setText(vD.venueName.toUpperCase());
venue_details.get(position).venue_distance =
Double.parseDouble(df.format(Utils.distance(myAppObj.getMyLatitude(),
myAppObj.getMyLongitude(), vD.latitude, vD.longitude, 'K') *
0.000621371192));
holder.venue_dist.setText(df.format(vD.venue_distance)+" Miles");
holder.venue_curr_loc.setText(my_address.toUpperCase());
if (vD.petted == 1) {
holder.pett_btn.setVisibility(View.VISIBLE);
holder.ll.setVisibility(View.VISIBLE);
holder.pett_btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(dialog_Callback!=null)
dialog_Callback.onDialogCalled(0, vD.id);
}
});
} else {
holder.pett_btn.setVisibility(View.GONE);
holder.ll.setVisibility(View.GONE);
}
}
return v;
}
@Override
public boolean isEnabled(int position) {
if (venue_details.get(position).petted == 1) {
return false;
} else {
return true;
}
}
static class ViewHolder{
TextView venue_name;
TextView venue_dist;
TextView venue_curr_loc;
FrameLayout ll;
Button pett_btn;
ImageView img;
}
Sunday, 25 August 2013
C# Windows Application: Print Multiple forms to one PDF file
C# Windows Application: Print Multiple forms to one PDF file
I am working on one Windows Application(C#). and here requirement is, to
queue all the print commands in one PDF file and on Final Print, print
them all together. So that it can use Paging Space properly. They don't
want to waste paper, because there are few forms of very small size.
I checked below link for iTextSharp.
http://www.mikesdotnetting.com/Article/87/iTextSharp-Working-with-images
Below is the code to generate one pdf file using this code -
string pdfpath = Server.MapPath("PDFs");
string imagepath = Server.MapPath("Images");
Document doc = new Document();
try
{
PdfWriter.GetInstance(doc, new FileStream(pdfpath + "/Images.pdf",
FileMode.Create));
doc.Open();
doc.Add(new Paragraph("GIF"));
Image gif = Image.GetInstance(imagepath + "/mikesdotnetting.gif");
doc.Add(gif);
}
catch (Exception ex)
{
//Log error;
}
finally
{
doc.Close();
}
Question - how to merge all pdf files in one pdf file(with proper
pagination to save papers) and print them all together?
Is there any idea on this?
Thank you.
I am working on one Windows Application(C#). and here requirement is, to
queue all the print commands in one PDF file and on Final Print, print
them all together. So that it can use Paging Space properly. They don't
want to waste paper, because there are few forms of very small size.
I checked below link for iTextSharp.
http://www.mikesdotnetting.com/Article/87/iTextSharp-Working-with-images
Below is the code to generate one pdf file using this code -
string pdfpath = Server.MapPath("PDFs");
string imagepath = Server.MapPath("Images");
Document doc = new Document();
try
{
PdfWriter.GetInstance(doc, new FileStream(pdfpath + "/Images.pdf",
FileMode.Create));
doc.Open();
doc.Add(new Paragraph("GIF"));
Image gif = Image.GetInstance(imagepath + "/mikesdotnetting.gif");
doc.Add(gif);
}
catch (Exception ex)
{
//Log error;
}
finally
{
doc.Close();
}
Question - how to merge all pdf files in one pdf file(with proper
pagination to save papers) and print them all together?
Is there any idea on this?
Thank you.
winspool.dll missing error when trying to run a c++ builder application
winspool.dll missing error when trying to run a c++ builder application
This error only appears when I build my app as a self-contained app (no
additional dlls required). However, if I build the app with runtime
packages option enabled (checked), it works fine. I read somewhere that
some malware can disguise itself as winspool.dll but I'm not sure if this
is the case here. Any ideas?
This error only appears when I build my app as a self-contained app (no
additional dlls required). However, if I build the app with runtime
packages option enabled (checked), it works fine. I read somewhere that
some malware can disguise itself as winspool.dll but I'm not sure if this
is the case here. Any ideas?
Android: Getting no such column, new developer
Android: Getting no such column, new developer
I'm brand new to developing and I am getting the following error in android:
08-24 23:55:15.744: E/AndroidRuntime(29803): Caused by:
android.database.sqlite.SQLiteException: no such column: customerName
(code 1): , while compiling: INSERT INTO nncdjiftable (customerName,
timeShift, date01, vendorGameThemePT, managerSignature, managerDate,
jackpotAmount, lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid, slotSupervisorMODSignature,
customerSignature, date03) VALUES (customerName, timeShift, date01,
vendorGameThemePT, managerSignature, managerDate, jackpotAmount,
lessTaxesWithheld, cashierSignature, taxRate, slotAttendantSignature,
totalAmountPaid, slotSupervisorMODSignature, customerSignature, date03)
This is my code:
package com.mearle.nncdjif;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class NNCDJIF_DataEntry extends Activity {
String customerName, timeShift, date01, vendorGameThemePT,
managerSignature, managerDate, jackpotAmount, lessTaxesWithheld,
cashierSignature, taxRate, slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03;
SQLiteDatabase nncdjifdb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nncdjif__data_entry);
nncdjifdb = openOrCreateDatabase("nncdjifdb", MODE_PRIVATE, null);
nncdjifdb
.execSQL("CREATE TABLE IF NOT EXISTS nncdjiftable(customerName
VARCHAR,timeShift VARCHAR,date01 VARCHAR,vendorGameThemePT
VARCHAR,managerSignature VARCHAR,managerDate
VARCHAR,jackpotAmount VARCHAR,lessTaxesWithheld
VARCHAR,cashier VARCHAR,taxRate VARCHAR,slotAttendant
VARCHAR,totalAmountPaid VARCHAR,slotSupervisorMOD
VARCHAR,customerSignature VARCHAR,date03 VARCHAR);");
}
public void Adddata(View view) {
EditText edittextCustomerName = (EditText)
findViewById(R.id.etCustomerName);
EditText edittextTimeShift = (EditText) findViewById(R.id.etTimeShift);
EditText edittextDate01 = (EditText) findViewById(R.id.etDate01);
EditText edittextVendorGameThemePT = (EditText)
findViewById(R.id.etVendorGameThemePT);
EditText edittextManagerSignature = (EditText)
findViewById(R.id.etManagerSignature);
EditText edittextManagerDate = (EditText)
findViewById(R.id.etManagerDate);
EditText edittextJackpotAmount = (EditText)
findViewById(R.id.etJackpotAmount);
EditText edittextLessTaxesWithheld = (EditText)
findViewById(R.id.etLessTaxesWithheld);
EditText edittextCashier = (EditText) findViewById(R.id.etCashier);
EditText edittextTaxRate = (EditText) findViewById(R.id.etTaxRate);
EditText edittextSlotAttendant = (EditText)
findViewById(R.id.etSlotAttendant);
EditText edittextTotalAmountPaid = (EditText)
findViewById(R.id.etTotalAmountPaid);
EditText edittextSlotSupervisorMOD = (EditText)
findViewById(R.id.etSlotSupervisorMOD);
EditText edittextCustomerSignature = (EditText)
findViewById(R.id.etCustomerSignature);
EditText edittextDate03 = (EditText) findViewById(R.id.etDate03);
customerName = edittextCustomerName.getText().toString();
timeShift = edittextTimeShift.getText().toString();
date01 = edittextDate01.getText().toString();
vendorGameThemePT = edittextVendorGameThemePT.getText().toString();
managerSignature = edittextManagerSignature.getText().toString();
managerDate = edittextManagerDate.getText().toString();
jackpotAmount = edittextJackpotAmount.getText().toString();
lessTaxesWithheld = edittextLessTaxesWithheld.getText().toString();
cashierSignature = edittextCashier.getText().toString();
taxRate = edittextTaxRate.getText().toString();
slotAttendantSignature = edittextSlotAttendant.getText().toString();
totalAmountPaid = edittextTotalAmountPaid.getText().toString();
slotSupervisorMODSignature = edittextSlotSupervisorMOD.getText()
.toString();
customerSignature = edittextCustomerSignature.getText().toString();
date03 = edittextDate03.getText().toString();
nncdjifdb
.execSQL("INSERT INTO nncdjiftable (customerName, timeShift,
date01, vendorGameThemePT, managerSignature, managerDate,
jackpotAmount, lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03) VALUES
(customerName, timeShift, date01, vendorGameThemePT,
managerSignature, managerDate, jackpotAmount,
lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03)");
}
private void Showdata(View view) {
Cursor c = nncdjifdb.rawQuery("SELECT * FROM nncdjiftable", null);
int count = c.getCount();
c.moveToFirst();
TableLayout tableLayout = new TableLayout(getApplicationContext());
tableLayout.setVerticalScrollBarEnabled(true);
TableRow tableRow;
TextView textviewcustomerName, textviewtimeShift, textviewdate01,
textviewvendorGameThemePT, textviewmanagerSignature,
textviewmanagerDate, textviewjackpotAmount, textviewlessTaxesWithheld,
textviewcashierSignature, textviewtaxRate,
textviewslotAttendantSignature, textviewtotalAmountPaid,
textviewslotSupervisorMODSignature, textviewcustomerSignature,
textviewdate03, textviewDcustomerName, textviewDtimeShift,
textviewDdate01, textviewDvendorGameThemePT,
textviewDmanagerSignature, textviewDmanagerDate,
textviewDjackpotAmount, textviewDlessTaxesWithheld,
textviewDcashierSignature, textviewDtaxRate,
textviewDslotAttendantSignature, textviewDtotalAmountPaid,
textviewDslotSupervisorMODSignature, textviewDcustomerSignature,
textviewDdate03;
tableRow = new TableRow(getApplicationContext());
textviewcustomerName = new TextView(getApplicationContext());
textviewcustomerName.setText("Customer Name");
textviewcustomerName.setTextColor(Color.RED);
textviewcustomerName.setTypeface(null, Typeface.BOLD);
textviewcustomerName.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcustomerName);
textviewtimeShift = new TextView(getApplicationContext());
textviewtimeShift.setText("Time/Shift");
textviewtimeShift.setTextColor(Color.RED);
textviewtimeShift.setTypeface(null, Typeface.BOLD);
textviewtimeShift.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtimeShift);
textviewdate01 = new TextView(getApplicationContext());
textviewdate01.setText("Date");
textviewdate01.setTextColor(Color.RED);
textviewdate01.setTypeface(null, Typeface.BOLD);
textviewdate01.setPadding(20, 20, 20, 20);
tableRow.addView(textviewdate01);
textviewvendorGameThemePT = new TextView(getApplicationContext());
textviewvendorGameThemePT.setText("Vendor/Game Theme/PT#");
textviewvendorGameThemePT.setTextColor(Color.RED);
textviewvendorGameThemePT.setTypeface(null, Typeface.BOLD);
textviewvendorGameThemePT.setPadding(20, 20, 20, 20);
tableRow.addView(textviewvendorGameThemePT);
textviewmanagerSignature = new TextView(getApplicationContext());
textviewmanagerSignature.setText("Manager Signature");
textviewmanagerSignature.setTextColor(Color.RED);
textviewmanagerSignature.setTypeface(null, Typeface.BOLD);
textviewmanagerSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewmanagerSignature);
textviewmanagerDate = new TextView(getApplicationContext());
textviewmanagerDate.setText("Date");
textviewmanagerDate.setTextColor(Color.RED);
textviewmanagerDate.setTypeface(null, Typeface.BOLD);
textviewmanagerDate.setPadding(20, 20, 20, 20);
tableRow.addView(textviewmanagerDate);
textviewjackpotAmount = new TextView(getApplicationContext());
textviewjackpotAmount.setText("Jackpot Amount");
textviewjackpotAmount.setTextColor(Color.RED);
textviewjackpotAmount.setTypeface(null, Typeface.BOLD);
textviewjackpotAmount.setPadding(20, 20, 20, 20);
tableRow.addView(textviewjackpotAmount);
textviewlessTaxesWithheld = new TextView(getApplicationContext());
textviewlessTaxesWithheld.setText("Less Taxes Withheld");
textviewlessTaxesWithheld.setTextColor(Color.RED);
textviewlessTaxesWithheld.setTypeface(null, Typeface.BOLD);
textviewlessTaxesWithheld.setPadding(20, 20, 20, 20);
tableRow.addView(textviewlessTaxesWithheld);
textviewcashierSignature = new TextView(getApplicationContext());
textviewcashierSignature.setText("Cashier");
textviewcashierSignature.setTextColor(Color.RED);
textviewcashierSignature.setTypeface(null, Typeface.BOLD);
textviewcashierSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcashierSignature);
textviewtaxRate = new TextView(getApplicationContext());
textviewtaxRate.setText("Tax Rate");
textviewtaxRate.setTextColor(Color.RED);
textviewtaxRate.setTypeface(null, Typeface.BOLD);
textviewtaxRate.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtaxRate);
textviewslotAttendantSignature = new TextView(getApplicationContext());
textviewslotAttendantSignature.setText("Slot Attendant");
textviewslotAttendantSignature.setTextColor(Color.RED);
textviewslotAttendantSignature.setTypeface(null, Typeface.BOLD);
textviewslotAttendantSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewslotAttendantSignature);
textviewtotalAmountPaid = new TextView(getApplicationContext());
textviewtotalAmountPaid.setText("Total Amount Paid");
textviewtotalAmountPaid.setTextColor(Color.RED);
textviewtotalAmountPaid.setTypeface(null, Typeface.BOLD);
textviewtotalAmountPaid.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtotalAmountPaid);
textviewslotSupervisorMODSignature = new TextView(
getApplicationContext());
textviewslotSupervisorMODSignature.setText("Slot Supervisor/M.O.D.");
textviewslotSupervisorMODSignature.setTextColor(Color.RED);
textviewslotSupervisorMODSignature.setTypeface(null, Typeface.BOLD);
textviewslotSupervisorMODSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewslotSupervisorMODSignature);
textviewcustomerSignature = new TextView(getApplicationContext());
textviewcustomerSignature.setText("Customer Signature");
textviewcustomerSignature.setTextColor(Color.RED);
textviewcustomerSignature.setTypeface(null, Typeface.BOLD);
textviewcustomerSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcustomerSignature);
textviewdate03 = new TextView(getApplicationContext());
textviewdate03.setText("Date");
textviewdate03.setTextColor(Color.RED);
textviewdate03.setTypeface(null, Typeface.BOLD);
textviewdate03.setPadding(20, 20, 20, 20);
tableRow.addView(textviewdate03);
tableLayout.addView(tableRow);
for (Integer j = 0; j < count; j++) {
tableRow = new TableRow(getApplicationContext());
textviewDcustomerName = new TextView(getApplicationContext());
textviewDcustomerName.setText(c.getString(c
.getColumnIndex("customerName")));
textviewDtimeShift = new TextView(getApplicationContext());
textviewDtimeShift.setText(c.getString(c
.getColumnIndex("timeShift")));
textviewDdate01 = new TextView(getApplicationContext());
textviewDdate01.setText(c.getString(c.getColumnIndex("date01")));
textviewDvendorGameThemePT = new TextView(getApplicationContext());
textviewDvendorGameThemePT.setText(c.getString(c
.getColumnIndex("vendorGameThemePT")));
textviewDmanagerSignature = new TextView(getApplicationContext());
textviewDmanagerSignature.setText(c.getString(c
.getColumnIndex("managerSignature")));
textviewDmanagerDate = new TextView(getApplicationContext());
textviewDmanagerDate.setText(c.getString(c
.getColumnIndex("managerDate")));
textviewDjackpotAmount = new TextView(getApplicationContext());
textviewDjackpotAmount.setText(c.getString(c
.getColumnIndex("jackpotAmount")));
textviewDlessTaxesWithheld = new TextView(getApplicationContext());
textviewDlessTaxesWithheld.setText(c.getString(c
.getColumnIndex("lessTaxesWithheld")));
textviewDcashierSignature = new TextView(getApplicationContext());
textviewDcashierSignature.setText(c.getString(c
.getColumnIndex("cashierSignature")));
textviewDtaxRate = new TextView(getApplicationContext());
textviewDtaxRate.setText(c.getString(c.getColumnIndex("taxRate")));
textviewDslotAttendantSignature = new TextView(
getApplicationContext());
textviewDslotAttendantSignature.setText(c.getString(c
.getColumnIndex("slotAttendantSignature")));
textviewDtotalAmountPaid = new TextView(getApplicationContext());
textviewDtotalAmountPaid.setText(c.getString(c
.getColumnIndex("totalAmountPaid")));
textviewDslotSupervisorMODSignature = new TextView(
getApplicationContext());
textviewDslotSupervisorMODSignature.setText(c.getString(c
.getColumnIndex("slotSupervisorMODSignature")));
textviewDcustomerSignature = new TextView(getApplicationContext());
textviewDcustomerSignature.setText(c.getString(c
.getColumnIndex("customerSignature")));
textviewDdate03 = new TextView(getApplicationContext());
textviewDdate03.setText(c.getString(c.getColumnIndex("date03")));
textviewDcustomerName.setPadding(20, 20, 20, 20);
textviewDtimeShift.setPadding(20, 20, 20, 20);
textviewDdate01.setPadding(20, 20, 20, 20);
textviewDvendorGameThemePT.setPadding(20, 20, 20, 20);
textviewDmanagerSignature.setPadding(20, 20, 20, 20);
textviewDmanagerDate.setPadding(20, 20, 20, 20);
textviewDjackpotAmount.setPadding(20, 20, 20, 20);
textviewDlessTaxesWithheld.setPadding(20, 20, 20, 20);
textviewDcashierSignature.setPadding(20, 20, 20, 20);
textviewDtaxRate.setPadding(20, 20, 20, 20);
textviewDslotAttendantSignature.setPadding(20, 20, 20, 20);
textviewDtotalAmountPaid.setPadding(20, 20, 20, 20);
textviewDslotSupervisorMODSignature.setPadding(20, 20, 20, 20);
textviewDcustomerSignature.setPadding(20, 20, 20, 20);
textviewDdate03.setPadding(20, 20, 20, 20);
tableRow.addView(textviewDcustomerName);
tableRow.addView(textviewDtimeShift);
tableRow.addView(textviewDdate01);
tableRow.addView(textviewDvendorGameThemePT);
tableRow.addView(textviewDmanagerSignature);
tableRow.addView(textviewDmanagerDate);
tableRow.addView(textviewDjackpotAmount);
tableRow.addView(textviewDlessTaxesWithheld);
tableRow.addView(textviewDcashierSignature);
tableRow.addView(textviewDtaxRate);
tableRow.addView(textviewDslotAttendantSignature);
tableRow.addView(textviewDtotalAmountPaid);
tableRow.addView(textviewDslotSupervisorMODSignature);
tableRow.addView(textviewDcustomerSignature);
tableRow.addView(textviewDdate03);
tableLayout.addView(tableRow);
c.moveToNext();
}
setContentView(tableLayout);
nncdjifdb.close();
}
public void close(View view) {
System.exit(0);
}
}
I'm brand new to developing and I am getting the following error in android:
08-24 23:55:15.744: E/AndroidRuntime(29803): Caused by:
android.database.sqlite.SQLiteException: no such column: customerName
(code 1): , while compiling: INSERT INTO nncdjiftable (customerName,
timeShift, date01, vendorGameThemePT, managerSignature, managerDate,
jackpotAmount, lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid, slotSupervisorMODSignature,
customerSignature, date03) VALUES (customerName, timeShift, date01,
vendorGameThemePT, managerSignature, managerDate, jackpotAmount,
lessTaxesWithheld, cashierSignature, taxRate, slotAttendantSignature,
totalAmountPaid, slotSupervisorMODSignature, customerSignature, date03)
This is my code:
package com.mearle.nncdjif;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class NNCDJIF_DataEntry extends Activity {
String customerName, timeShift, date01, vendorGameThemePT,
managerSignature, managerDate, jackpotAmount, lessTaxesWithheld,
cashierSignature, taxRate, slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03;
SQLiteDatabase nncdjifdb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_nncdjif__data_entry);
nncdjifdb = openOrCreateDatabase("nncdjifdb", MODE_PRIVATE, null);
nncdjifdb
.execSQL("CREATE TABLE IF NOT EXISTS nncdjiftable(customerName
VARCHAR,timeShift VARCHAR,date01 VARCHAR,vendorGameThemePT
VARCHAR,managerSignature VARCHAR,managerDate
VARCHAR,jackpotAmount VARCHAR,lessTaxesWithheld
VARCHAR,cashier VARCHAR,taxRate VARCHAR,slotAttendant
VARCHAR,totalAmountPaid VARCHAR,slotSupervisorMOD
VARCHAR,customerSignature VARCHAR,date03 VARCHAR);");
}
public void Adddata(View view) {
EditText edittextCustomerName = (EditText)
findViewById(R.id.etCustomerName);
EditText edittextTimeShift = (EditText) findViewById(R.id.etTimeShift);
EditText edittextDate01 = (EditText) findViewById(R.id.etDate01);
EditText edittextVendorGameThemePT = (EditText)
findViewById(R.id.etVendorGameThemePT);
EditText edittextManagerSignature = (EditText)
findViewById(R.id.etManagerSignature);
EditText edittextManagerDate = (EditText)
findViewById(R.id.etManagerDate);
EditText edittextJackpotAmount = (EditText)
findViewById(R.id.etJackpotAmount);
EditText edittextLessTaxesWithheld = (EditText)
findViewById(R.id.etLessTaxesWithheld);
EditText edittextCashier = (EditText) findViewById(R.id.etCashier);
EditText edittextTaxRate = (EditText) findViewById(R.id.etTaxRate);
EditText edittextSlotAttendant = (EditText)
findViewById(R.id.etSlotAttendant);
EditText edittextTotalAmountPaid = (EditText)
findViewById(R.id.etTotalAmountPaid);
EditText edittextSlotSupervisorMOD = (EditText)
findViewById(R.id.etSlotSupervisorMOD);
EditText edittextCustomerSignature = (EditText)
findViewById(R.id.etCustomerSignature);
EditText edittextDate03 = (EditText) findViewById(R.id.etDate03);
customerName = edittextCustomerName.getText().toString();
timeShift = edittextTimeShift.getText().toString();
date01 = edittextDate01.getText().toString();
vendorGameThemePT = edittextVendorGameThemePT.getText().toString();
managerSignature = edittextManagerSignature.getText().toString();
managerDate = edittextManagerDate.getText().toString();
jackpotAmount = edittextJackpotAmount.getText().toString();
lessTaxesWithheld = edittextLessTaxesWithheld.getText().toString();
cashierSignature = edittextCashier.getText().toString();
taxRate = edittextTaxRate.getText().toString();
slotAttendantSignature = edittextSlotAttendant.getText().toString();
totalAmountPaid = edittextTotalAmountPaid.getText().toString();
slotSupervisorMODSignature = edittextSlotSupervisorMOD.getText()
.toString();
customerSignature = edittextCustomerSignature.getText().toString();
date03 = edittextDate03.getText().toString();
nncdjifdb
.execSQL("INSERT INTO nncdjiftable (customerName, timeShift,
date01, vendorGameThemePT, managerSignature, managerDate,
jackpotAmount, lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03) VALUES
(customerName, timeShift, date01, vendorGameThemePT,
managerSignature, managerDate, jackpotAmount,
lessTaxesWithheld, cashierSignature, taxRate,
slotAttendantSignature, totalAmountPaid,
slotSupervisorMODSignature, customerSignature, date03)");
}
private void Showdata(View view) {
Cursor c = nncdjifdb.rawQuery("SELECT * FROM nncdjiftable", null);
int count = c.getCount();
c.moveToFirst();
TableLayout tableLayout = new TableLayout(getApplicationContext());
tableLayout.setVerticalScrollBarEnabled(true);
TableRow tableRow;
TextView textviewcustomerName, textviewtimeShift, textviewdate01,
textviewvendorGameThemePT, textviewmanagerSignature,
textviewmanagerDate, textviewjackpotAmount, textviewlessTaxesWithheld,
textviewcashierSignature, textviewtaxRate,
textviewslotAttendantSignature, textviewtotalAmountPaid,
textviewslotSupervisorMODSignature, textviewcustomerSignature,
textviewdate03, textviewDcustomerName, textviewDtimeShift,
textviewDdate01, textviewDvendorGameThemePT,
textviewDmanagerSignature, textviewDmanagerDate,
textviewDjackpotAmount, textviewDlessTaxesWithheld,
textviewDcashierSignature, textviewDtaxRate,
textviewDslotAttendantSignature, textviewDtotalAmountPaid,
textviewDslotSupervisorMODSignature, textviewDcustomerSignature,
textviewDdate03;
tableRow = new TableRow(getApplicationContext());
textviewcustomerName = new TextView(getApplicationContext());
textviewcustomerName.setText("Customer Name");
textviewcustomerName.setTextColor(Color.RED);
textviewcustomerName.setTypeface(null, Typeface.BOLD);
textviewcustomerName.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcustomerName);
textviewtimeShift = new TextView(getApplicationContext());
textviewtimeShift.setText("Time/Shift");
textviewtimeShift.setTextColor(Color.RED);
textviewtimeShift.setTypeface(null, Typeface.BOLD);
textviewtimeShift.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtimeShift);
textviewdate01 = new TextView(getApplicationContext());
textviewdate01.setText("Date");
textviewdate01.setTextColor(Color.RED);
textviewdate01.setTypeface(null, Typeface.BOLD);
textviewdate01.setPadding(20, 20, 20, 20);
tableRow.addView(textviewdate01);
textviewvendorGameThemePT = new TextView(getApplicationContext());
textviewvendorGameThemePT.setText("Vendor/Game Theme/PT#");
textviewvendorGameThemePT.setTextColor(Color.RED);
textviewvendorGameThemePT.setTypeface(null, Typeface.BOLD);
textviewvendorGameThemePT.setPadding(20, 20, 20, 20);
tableRow.addView(textviewvendorGameThemePT);
textviewmanagerSignature = new TextView(getApplicationContext());
textviewmanagerSignature.setText("Manager Signature");
textviewmanagerSignature.setTextColor(Color.RED);
textviewmanagerSignature.setTypeface(null, Typeface.BOLD);
textviewmanagerSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewmanagerSignature);
textviewmanagerDate = new TextView(getApplicationContext());
textviewmanagerDate.setText("Date");
textviewmanagerDate.setTextColor(Color.RED);
textviewmanagerDate.setTypeface(null, Typeface.BOLD);
textviewmanagerDate.setPadding(20, 20, 20, 20);
tableRow.addView(textviewmanagerDate);
textviewjackpotAmount = new TextView(getApplicationContext());
textviewjackpotAmount.setText("Jackpot Amount");
textviewjackpotAmount.setTextColor(Color.RED);
textviewjackpotAmount.setTypeface(null, Typeface.BOLD);
textviewjackpotAmount.setPadding(20, 20, 20, 20);
tableRow.addView(textviewjackpotAmount);
textviewlessTaxesWithheld = new TextView(getApplicationContext());
textviewlessTaxesWithheld.setText("Less Taxes Withheld");
textviewlessTaxesWithheld.setTextColor(Color.RED);
textviewlessTaxesWithheld.setTypeface(null, Typeface.BOLD);
textviewlessTaxesWithheld.setPadding(20, 20, 20, 20);
tableRow.addView(textviewlessTaxesWithheld);
textviewcashierSignature = new TextView(getApplicationContext());
textviewcashierSignature.setText("Cashier");
textviewcashierSignature.setTextColor(Color.RED);
textviewcashierSignature.setTypeface(null, Typeface.BOLD);
textviewcashierSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcashierSignature);
textviewtaxRate = new TextView(getApplicationContext());
textviewtaxRate.setText("Tax Rate");
textviewtaxRate.setTextColor(Color.RED);
textviewtaxRate.setTypeface(null, Typeface.BOLD);
textviewtaxRate.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtaxRate);
textviewslotAttendantSignature = new TextView(getApplicationContext());
textviewslotAttendantSignature.setText("Slot Attendant");
textviewslotAttendantSignature.setTextColor(Color.RED);
textviewslotAttendantSignature.setTypeface(null, Typeface.BOLD);
textviewslotAttendantSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewslotAttendantSignature);
textviewtotalAmountPaid = new TextView(getApplicationContext());
textviewtotalAmountPaid.setText("Total Amount Paid");
textviewtotalAmountPaid.setTextColor(Color.RED);
textviewtotalAmountPaid.setTypeface(null, Typeface.BOLD);
textviewtotalAmountPaid.setPadding(20, 20, 20, 20);
tableRow.addView(textviewtotalAmountPaid);
textviewslotSupervisorMODSignature = new TextView(
getApplicationContext());
textviewslotSupervisorMODSignature.setText("Slot Supervisor/M.O.D.");
textviewslotSupervisorMODSignature.setTextColor(Color.RED);
textviewslotSupervisorMODSignature.setTypeface(null, Typeface.BOLD);
textviewslotSupervisorMODSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewslotSupervisorMODSignature);
textviewcustomerSignature = new TextView(getApplicationContext());
textviewcustomerSignature.setText("Customer Signature");
textviewcustomerSignature.setTextColor(Color.RED);
textviewcustomerSignature.setTypeface(null, Typeface.BOLD);
textviewcustomerSignature.setPadding(20, 20, 20, 20);
tableRow.addView(textviewcustomerSignature);
textviewdate03 = new TextView(getApplicationContext());
textviewdate03.setText("Date");
textviewdate03.setTextColor(Color.RED);
textviewdate03.setTypeface(null, Typeface.BOLD);
textviewdate03.setPadding(20, 20, 20, 20);
tableRow.addView(textviewdate03);
tableLayout.addView(tableRow);
for (Integer j = 0; j < count; j++) {
tableRow = new TableRow(getApplicationContext());
textviewDcustomerName = new TextView(getApplicationContext());
textviewDcustomerName.setText(c.getString(c
.getColumnIndex("customerName")));
textviewDtimeShift = new TextView(getApplicationContext());
textviewDtimeShift.setText(c.getString(c
.getColumnIndex("timeShift")));
textviewDdate01 = new TextView(getApplicationContext());
textviewDdate01.setText(c.getString(c.getColumnIndex("date01")));
textviewDvendorGameThemePT = new TextView(getApplicationContext());
textviewDvendorGameThemePT.setText(c.getString(c
.getColumnIndex("vendorGameThemePT")));
textviewDmanagerSignature = new TextView(getApplicationContext());
textviewDmanagerSignature.setText(c.getString(c
.getColumnIndex("managerSignature")));
textviewDmanagerDate = new TextView(getApplicationContext());
textviewDmanagerDate.setText(c.getString(c
.getColumnIndex("managerDate")));
textviewDjackpotAmount = new TextView(getApplicationContext());
textviewDjackpotAmount.setText(c.getString(c
.getColumnIndex("jackpotAmount")));
textviewDlessTaxesWithheld = new TextView(getApplicationContext());
textviewDlessTaxesWithheld.setText(c.getString(c
.getColumnIndex("lessTaxesWithheld")));
textviewDcashierSignature = new TextView(getApplicationContext());
textviewDcashierSignature.setText(c.getString(c
.getColumnIndex("cashierSignature")));
textviewDtaxRate = new TextView(getApplicationContext());
textviewDtaxRate.setText(c.getString(c.getColumnIndex("taxRate")));
textviewDslotAttendantSignature = new TextView(
getApplicationContext());
textviewDslotAttendantSignature.setText(c.getString(c
.getColumnIndex("slotAttendantSignature")));
textviewDtotalAmountPaid = new TextView(getApplicationContext());
textviewDtotalAmountPaid.setText(c.getString(c
.getColumnIndex("totalAmountPaid")));
textviewDslotSupervisorMODSignature = new TextView(
getApplicationContext());
textviewDslotSupervisorMODSignature.setText(c.getString(c
.getColumnIndex("slotSupervisorMODSignature")));
textviewDcustomerSignature = new TextView(getApplicationContext());
textviewDcustomerSignature.setText(c.getString(c
.getColumnIndex("customerSignature")));
textviewDdate03 = new TextView(getApplicationContext());
textviewDdate03.setText(c.getString(c.getColumnIndex("date03")));
textviewDcustomerName.setPadding(20, 20, 20, 20);
textviewDtimeShift.setPadding(20, 20, 20, 20);
textviewDdate01.setPadding(20, 20, 20, 20);
textviewDvendorGameThemePT.setPadding(20, 20, 20, 20);
textviewDmanagerSignature.setPadding(20, 20, 20, 20);
textviewDmanagerDate.setPadding(20, 20, 20, 20);
textviewDjackpotAmount.setPadding(20, 20, 20, 20);
textviewDlessTaxesWithheld.setPadding(20, 20, 20, 20);
textviewDcashierSignature.setPadding(20, 20, 20, 20);
textviewDtaxRate.setPadding(20, 20, 20, 20);
textviewDslotAttendantSignature.setPadding(20, 20, 20, 20);
textviewDtotalAmountPaid.setPadding(20, 20, 20, 20);
textviewDslotSupervisorMODSignature.setPadding(20, 20, 20, 20);
textviewDcustomerSignature.setPadding(20, 20, 20, 20);
textviewDdate03.setPadding(20, 20, 20, 20);
tableRow.addView(textviewDcustomerName);
tableRow.addView(textviewDtimeShift);
tableRow.addView(textviewDdate01);
tableRow.addView(textviewDvendorGameThemePT);
tableRow.addView(textviewDmanagerSignature);
tableRow.addView(textviewDmanagerDate);
tableRow.addView(textviewDjackpotAmount);
tableRow.addView(textviewDlessTaxesWithheld);
tableRow.addView(textviewDcashierSignature);
tableRow.addView(textviewDtaxRate);
tableRow.addView(textviewDslotAttendantSignature);
tableRow.addView(textviewDtotalAmountPaid);
tableRow.addView(textviewDslotSupervisorMODSignature);
tableRow.addView(textviewDcustomerSignature);
tableRow.addView(textviewDdate03);
tableLayout.addView(tableRow);
c.moveToNext();
}
setContentView(tableLayout);
nncdjifdb.close();
}
public void close(View view) {
System.exit(0);
}
}
Saturday, 24 August 2013
Analyse performance of android app using Android Development Studio
Analyse performance of android app using Android Development Studio
What would be the best way to analyse performance of my app while using
Android Development Studio?
What would be the best way to analyse performance of my app while using
Android Development Studio?
Facebook button login issue (after succesful login)
Facebook button login issue (after succesful login)
I am trying FB login for a site for first time. I am able to see the FB
button and the popup window shows with what appears to be correct FB login
with my app name, so i think that part is good. my issue is after clicking
login I enter the user/pass, then window closes and nothing else happens.
I know I am logged in because when i click the FB again it pops up and
closes, so i guess it knows I am logged in to FB. but i cant see any of my
calls to write to console, and I am not sure how to make it do something
else after the loging... Maybe I am not understanding what happens after
the login to FB is succesful, am i missing something? . here is what I
have tried so far.
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXX', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to
access the session
xfbml : true // parse XFBML
});
}
function doLogin() {
FB.login(function(response) {
if (response.authResponse) {
console.log('Hello! Getting account information.... ');
FB.api('/me', function(response) {
console.log('Hello, ' + response.name + '.');
});
} else {
console.log('User not fully authorize.');
}
});
}
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref =
d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function testFbLogin() {
console.info("Testing you are Logged in...");
}
I am trying FB login for a site for first time. I am able to see the FB
button and the popup window shows with what appears to be correct FB login
with my app name, so i think that part is good. my issue is after clicking
login I enter the user/pass, then window closes and nothing else happens.
I know I am logged in because when i click the FB again it pops up and
closes, so i guess it knows I am logged in to FB. but i cant see any of my
calls to write to console, and I am not sure how to make it do something
else after the loging... Maybe I am not understanding what happens after
the login to FB is succesful, am i missing something? . here is what I
have tried so far.
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXX', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to
access the session
xfbml : true // parse XFBML
});
}
function doLogin() {
FB.login(function(response) {
if (response.authResponse) {
console.log('Hello! Getting account information.... ');
FB.api('/me', function(response) {
console.log('Hello, ' + response.name + '.');
});
} else {
console.log('User not fully authorize.');
}
});
}
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref =
d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function testFbLogin() {
console.info("Testing you are Logged in...");
}
If the ring of integers corresponds to finite cyclic groups, what infinite rings do the other finite groups correspond to?
If the ring of integers corresponds to finite cyclic groups, what infinite
rings do the other finite groups correspond to?
Consider $\mathbb{Z}_n$, where $n$ is any positive integer. Then there is
a subgroup of $\mathbb{Z}_n$ for each divisor $d$ of $n$, so that the
number of subgroups equals the number of divisors of $n$. If
$|subg(\mathbb{Z}_n)| < |div(n)|$, then there's a non-trivial divisor that
doesn't generate a proper nontrivial subgroup, etc. So the subgroups of
$\mathbb{Z_n}$ correspond to divisors of $n$ in the ring $\mathbb{Z}$.
What about other finite groups, is there a ring such that divisors in the
ring of the finite group order $|G|$ correspond to subgroups of $G$?
Thanks.
rings do the other finite groups correspond to?
Consider $\mathbb{Z}_n$, where $n$ is any positive integer. Then there is
a subgroup of $\mathbb{Z}_n$ for each divisor $d$ of $n$, so that the
number of subgroups equals the number of divisors of $n$. If
$|subg(\mathbb{Z}_n)| < |div(n)|$, then there's a non-trivial divisor that
doesn't generate a proper nontrivial subgroup, etc. So the subgroups of
$\mathbb{Z_n}$ correspond to divisors of $n$ in the ring $\mathbb{Z}$.
What about other finite groups, is there a ring such that divisors in the
ring of the finite group order $|G|$ correspond to subgroups of $G$?
Thanks.
Convert to pixel coordinates in JOGL OpenGL
Convert to pixel coordinates in JOGL OpenGL
I've been working in openGL for all of a month now, and I've run into an
issue with the coordinate systems.
I've got a small class that creates a hexagon using this code:
for(int i = 0; i < 6; ++i) {
gl.glVertex2d(radius * Math.sin(i/6.0*2*Math.PI)-(radius*(x*1.75)),
radius * Math.cos(i/6.0*2*Math.PI)+(radius*(y*1.25)));
}
Note, all this is in java using the JOGL library.
When the Hexagons are created, they have the coordinate system with the
center of the screen as 0,0 and the top left set as -1,1
I want to convert these coordinate into screen coordinates, so the top
left is 0,0 and the center is windowX/2, -windowY/2. So, if the window is
500 pixels by 500 pixels, the center would be 250,-250.
Any help would be appreciated!
I've been working in openGL for all of a month now, and I've run into an
issue with the coordinate systems.
I've got a small class that creates a hexagon using this code:
for(int i = 0; i < 6; ++i) {
gl.glVertex2d(radius * Math.sin(i/6.0*2*Math.PI)-(radius*(x*1.75)),
radius * Math.cos(i/6.0*2*Math.PI)+(radius*(y*1.25)));
}
Note, all this is in java using the JOGL library.
When the Hexagons are created, they have the coordinate system with the
center of the screen as 0,0 and the top left set as -1,1
I want to convert these coordinate into screen coordinates, so the top
left is 0,0 and the center is windowX/2, -windowY/2. So, if the window is
500 pixels by 500 pixels, the center would be 250,-250.
Any help would be appreciated!
100% width for only 1 page, leave the rest as fluid
100% width for only 1 page, leave the rest as fluid
I'm making an ASP.NET MVC5 web app. The default template uses bootstrap,
which is fine for almost all of the pages. However I need one page to have
width: 100%.
The view I would like to use this is a partial view, so it will be
rendered in the .container (see code below), as well as the other partial
views.
<div class="container">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
All of them are find to be fluid, but I need this one to be 100% width.
What is an elegant way to do it?
I'm making an ASP.NET MVC5 web app. The default template uses bootstrap,
which is fine for almost all of the pages. However I need one page to have
width: 100%.
The view I would like to use this is a partial view, so it will be
rendered in the .container (see code below), as well as the other partial
views.
<div class="container">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
All of them are find to be fluid, but I need this one to be 100% width.
What is an elegant way to do it?
Lyon vs Reims Live Stream Online
Lyon vs Reims Live Stream Online
Watch Live Streaming Link
Lyon vs Reimsss Live Stream Watch Online French Ligue 1 8-24-2013.
Football Live Tv
We also have Streams in Justin, Sopcast, Ustream, Vshare, Livevdo,
Freedocast, Veemi, YYcast – all you need is Adobe Flashplayer. We Always
try our best to get you the best possible HD Streams to watch Live Sports
Online. You will never have to pay for any service just enjoy streaming
live Television, Videos and Sports.
Watch Live Streaming Link
Watch Live Streaming Link
Lyon vs Reimsss Live Stream Watch Online French Ligue 1 8-24-2013.
Football Live Tv
We also have Streams in Justin, Sopcast, Ustream, Vshare, Livevdo,
Freedocast, Veemi, YYcast – all you need is Adobe Flashplayer. We Always
try our best to get you the best possible HD Streams to watch Live Sports
Online. You will never have to pay for any service just enjoy streaming
live Television, Videos and Sports.
Watch Live Streaming Link
DirectShow .NET MediaControl.Stop() fails
DirectShow .NET MediaControl.Stop() fails
I'm using DirectShow .NET in my applicatiot, but I've got a problem
causing 2 problems: calling IMediaControl.Stop() doesn't stop my graph, it
keeps running. Therefore I can't neither restart the graph to change the
resolution, nor record video, because the headers are written when the
MediaControl is stopped. If I connect to the graph through GraphStudio and
stop it there, the .avi-File I'm recording is valid.
Here's my code building the graph:
public bool InitGraph(String sDevice,int iWidth,int iHeight,int fps,bool
useffd, Control hWindow) { try {
object o = null;
int hr = 0;
//fill up member vars
m_bUseFFDRaw = useffd;
m_Device = sDevice;
m_Control = hWindow;
m_filterGraph = (IGraphBuilder)new FilterGraph();
m_captureGraphBuilder = (ICaptureGraphBuilder2)new
CaptureGraphBuilder2();
m_mediaControl = (IMediaControl)m_filterGraph;
m_mediaEventEx = m_filterGraph as IMediaEventEx;
m_sampGrabber = (ISampleGrabber)new SampleGrabber();
if (m_sampGrabber == null)
{
MessageBox.Show("Error initializing grabber.\nErrorcode:
0x0003", "Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return false;
}
//Get the filter for the capture device
//and set up the needed filters
m_deviceFilter = CreateFilter(FilterCategory.VideoInputDevice,
sDevice);
if (m_deviceFilter == null)
{
MessageBox.Show("Error initializing filters.\nErrorcode:
0x0004", "Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return false;
}
m_sDeviceName = sDevice;
if (hWindow.Parent.Parent.Handle != null)
hr =
m_mediaEventEx.SetNotifyWindow(hWindow.Parent.Parent.Handle,
WM_GRAPHNOTIFY, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
ConfigureSampleGrabber(m_sampGrabber);
//get the interfaces
m_grabFilter = (IBaseFilter)m_sampGrabber;
m_SmartTee = (IBaseFilter)new SmartTee();
m_videoRenderer = new VideoMixingRenderer9();
m_videoRendererFilter = (IBaseFilter)new VideoMixingRenderer9();
m_videoRendererFilter = (IBaseFilter)m_videoRenderer;
if (m_bUseFFDRaw)
{
try
{
m_ffdraw =
CreateFilter(FilterCategory.LegacyAmFilterCategory,
"ffdshow raw video filter");
if (m_ffdraw == null)
{
MessageBox.Show("Cant find the ffdshow
filter-interface. Make sure ffdshow filters are
installed correctly.\nErrorcode: 0x0005", "Capture
Engine", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString() + "\nErrorcode: 0x0005",
"Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
m_filterGraph.AddFilter(m_deviceFilter, "Source");
m_filterGraph.AddFilter(m_grabFilter, "Grabber");
m_filterGraph.AddFilter(m_SmartTee, "Smart Tee");
if (m_bUseFFDRaw)
m_filterGraph.AddFilter(m_ffdraw, "FFDShow-Postprocessor");
m_filterGraph.AddFilter(m_videoRendererFilter, "VMR9");
String[] s;
this.GetAvailableVideoModes(out s);
//check if resolution is available
if (this.IsResolutionAvailable(iWidth, iHeight))
SetConfigParms(m_captureGraphBuilder, m_deviceFilter, fps,
iWidth, iHeight);
else MessageBox.Show("Your desired resolution is not available on
this device. Default parameters are set.\nPlease go to 'Settings'
and change the input resolution.", "Capture Engine",
MessageBoxButtons.OK, MessageBoxIcon.Information);
//get the pins
m_deviceOutCapture = DsFindPin.ByDirection(m_deviceFilter,
PinDirection.Output, 0);
m_deviceOutPreview = DsFindPin.ByDirection(m_deviceFilter,
PinDirection.Output, 1);
SmartIn = DsFindPin.ByDirection(m_SmartTee, PinDirection.Input, 0);
GrabberIn = DsFindPin.ByDirection(m_grabFilter,
PinDirection.Input, 0);
SmartOutCapt = DsFindPin.ByName(m_SmartTee, "Capture");
SmartOutPreview = DsFindPin.ByName(m_SmartTee, "Preview");
m_RendererIn = DsFindPin.ByName(m_videoRendererFilter, "VMR Input0");
if (m_bUseFFDRaw)
{
ffdrawIn = DsFindPin.ByDirection(m_ffdraw, PinDirection.Input,
0);
ffdrawOut = DsFindPin.ByDirection(m_ffdraw,
PinDirection.Output, 0);
}
hr = m_captureGraphBuilder.FindInterface(PinCategory.Capture,
MediaType.Video, m_deviceFilter, typeof(IAMStreamConfig).GUID, out
o);
if (hr >= 0)
{
m_stream = o as IAMStreamConfig;
o = null;
}
DsError.ThrowExceptionForHR(hr);
//connect the filters
hr = m_filterGraph.Connect(m_deviceOutCapture, SmartIn);
DsError.ThrowExceptionForHR(hr);
hr = m_filterGraph.Connect(SmartOutCapt, GrabberIn);
DsError.ThrowExceptionForHR(hr);
if (m_bUseFFDRaw)
{
if (SmartOutPreview != null && ffdrawIn != null)
{
hr = m_filterGraph.Connect(SmartOutPreview, ffdrawIn);
DsError.ThrowExceptionForHR(hr);
}
}
hr = m_captureGraphBuilder.SetFiltergraph(m_filterGraph);
DsError.ThrowExceptionForHR(hr);
//render all together
if (m_bUseFFDRaw)
{
hr = m_captureGraphBuilder.RenderStream(null, MediaType.Video,
m_ffdraw, null, m_videoRendererFilter);
//hr = m_filterGraph.Render(ffdrawOut);
DsError.ThrowExceptionForHR(hr);
}
else
{
hr = m_captureGraphBuilder.RenderStream(null, MediaType.Video,
m_SmartTee, null, m_videoRendererFilter);
//hr = m_filterGraph.Render(SmartOutPreview);
DsError.ThrowExceptionForHR(hr);
}
//get the interfaces
m_crossbarFilter = null;
hr = m_captureGraphBuilder.FindInterface(PinCategory.Capture,
MediaType.Video, m_deviceFilter, typeof(IAMCrossbar).GUID,
out o);
if (hr >= 0)
{
m_crossbarFilter = (IBaseFilter)o;
m_crossbarInterface = (IAMCrossbar)o;
o = null;
}
if (m_crossbarFilter == null || m_crossbarInterface == null)
m_console.Text += ("Capture Engine: Can't find a
crossbar-interface."
+ System.Environment.NewLine);
hr = m_captureGraphBuilder.FindInterface(null, null, m_deviceFilter,
typeof(IAMAnalogVideoDecoder).GUID, out o);
if (hr >= 0)
{
m_decoder = (IAMAnalogVideoDecoder)o;
m_decoderFilter = (IBaseFilter)o;
o = null;
}
if (m_decoder == null || m_decoderFilter == null)
m_console.Text += ("Capture Engine: Can't find a
decoder-interface." +
System.Environment.NewLine);
//get video properties
AMMediaType media;
VideoInfoHeader v;
hr = m_stream.GetFormat(out media);
DsError.ThrowExceptionForHR(hr);
try
{
v = new VideoInfoHeader();
Marshal.PtrToStructure(media.formatPtr, v);
m_iWidth = v.BmiHeader.Width;
m_iHeight = v.BmiHeader.Height;
m_iBitsPerPixel = v.BmiHeader.BitCount;
m_iFPS = 1000000 / (int)v.AvgTimePerFrame;
m_stride = m_iWidth * (v.BmiHeader.BitCount / 8);
}
finally
{
DsUtils.FreeAMMediaType(media);
media = null;
}
//set video window
m_videoWindow = null;
m_videoWindow = (IVideoWindow)m_filterGraph;
m_wndHandle = hWindow;
hr = m_videoWindow.put_Owner(hWindow.Handle);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_MessageDrain(hWindow.Parent.Handle);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_WindowStyle(WindowStyle.Child |
WindowStyle.ClipChildren | WindowStyle.ClipSiblings);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_Visible(OABool.True);
DsError.ThrowExceptionForHR(hr);
Rectangle rc = hWindow.ClientRectangle;
hr = m_videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
DsError.ThrowExceptionForHR(hr);
m_console.Text += "Capture Engine: Components initialized." +
System.Environment.NewLine + System.Environment.NewLine;
#if ROT
rot = new DsROTEntry(this.m_filterGraph);
I'm using DirectShow .NET in my applicatiot, but I've got a problem
causing 2 problems: calling IMediaControl.Stop() doesn't stop my graph, it
keeps running. Therefore I can't neither restart the graph to change the
resolution, nor record video, because the headers are written when the
MediaControl is stopped. If I connect to the graph through GraphStudio and
stop it there, the .avi-File I'm recording is valid.
Here's my code building the graph:
public bool InitGraph(String sDevice,int iWidth,int iHeight,int fps,bool
useffd, Control hWindow) { try {
object o = null;
int hr = 0;
//fill up member vars
m_bUseFFDRaw = useffd;
m_Device = sDevice;
m_Control = hWindow;
m_filterGraph = (IGraphBuilder)new FilterGraph();
m_captureGraphBuilder = (ICaptureGraphBuilder2)new
CaptureGraphBuilder2();
m_mediaControl = (IMediaControl)m_filterGraph;
m_mediaEventEx = m_filterGraph as IMediaEventEx;
m_sampGrabber = (ISampleGrabber)new SampleGrabber();
if (m_sampGrabber == null)
{
MessageBox.Show("Error initializing grabber.\nErrorcode:
0x0003", "Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return false;
}
//Get the filter for the capture device
//and set up the needed filters
m_deviceFilter = CreateFilter(FilterCategory.VideoInputDevice,
sDevice);
if (m_deviceFilter == null)
{
MessageBox.Show("Error initializing filters.\nErrorcode:
0x0004", "Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return false;
}
m_sDeviceName = sDevice;
if (hWindow.Parent.Parent.Handle != null)
hr =
m_mediaEventEx.SetNotifyWindow(hWindow.Parent.Parent.Handle,
WM_GRAPHNOTIFY, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
ConfigureSampleGrabber(m_sampGrabber);
//get the interfaces
m_grabFilter = (IBaseFilter)m_sampGrabber;
m_SmartTee = (IBaseFilter)new SmartTee();
m_videoRenderer = new VideoMixingRenderer9();
m_videoRendererFilter = (IBaseFilter)new VideoMixingRenderer9();
m_videoRendererFilter = (IBaseFilter)m_videoRenderer;
if (m_bUseFFDRaw)
{
try
{
m_ffdraw =
CreateFilter(FilterCategory.LegacyAmFilterCategory,
"ffdshow raw video filter");
if (m_ffdraw == null)
{
MessageBox.Show("Cant find the ffdshow
filter-interface. Make sure ffdshow filters are
installed correctly.\nErrorcode: 0x0005", "Capture
Engine", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString() + "\nErrorcode: 0x0005",
"Capture Engine", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
m_filterGraph.AddFilter(m_deviceFilter, "Source");
m_filterGraph.AddFilter(m_grabFilter, "Grabber");
m_filterGraph.AddFilter(m_SmartTee, "Smart Tee");
if (m_bUseFFDRaw)
m_filterGraph.AddFilter(m_ffdraw, "FFDShow-Postprocessor");
m_filterGraph.AddFilter(m_videoRendererFilter, "VMR9");
String[] s;
this.GetAvailableVideoModes(out s);
//check if resolution is available
if (this.IsResolutionAvailable(iWidth, iHeight))
SetConfigParms(m_captureGraphBuilder, m_deviceFilter, fps,
iWidth, iHeight);
else MessageBox.Show("Your desired resolution is not available on
this device. Default parameters are set.\nPlease go to 'Settings'
and change the input resolution.", "Capture Engine",
MessageBoxButtons.OK, MessageBoxIcon.Information);
//get the pins
m_deviceOutCapture = DsFindPin.ByDirection(m_deviceFilter,
PinDirection.Output, 0);
m_deviceOutPreview = DsFindPin.ByDirection(m_deviceFilter,
PinDirection.Output, 1);
SmartIn = DsFindPin.ByDirection(m_SmartTee, PinDirection.Input, 0);
GrabberIn = DsFindPin.ByDirection(m_grabFilter,
PinDirection.Input, 0);
SmartOutCapt = DsFindPin.ByName(m_SmartTee, "Capture");
SmartOutPreview = DsFindPin.ByName(m_SmartTee, "Preview");
m_RendererIn = DsFindPin.ByName(m_videoRendererFilter, "VMR Input0");
if (m_bUseFFDRaw)
{
ffdrawIn = DsFindPin.ByDirection(m_ffdraw, PinDirection.Input,
0);
ffdrawOut = DsFindPin.ByDirection(m_ffdraw,
PinDirection.Output, 0);
}
hr = m_captureGraphBuilder.FindInterface(PinCategory.Capture,
MediaType.Video, m_deviceFilter, typeof(IAMStreamConfig).GUID, out
o);
if (hr >= 0)
{
m_stream = o as IAMStreamConfig;
o = null;
}
DsError.ThrowExceptionForHR(hr);
//connect the filters
hr = m_filterGraph.Connect(m_deviceOutCapture, SmartIn);
DsError.ThrowExceptionForHR(hr);
hr = m_filterGraph.Connect(SmartOutCapt, GrabberIn);
DsError.ThrowExceptionForHR(hr);
if (m_bUseFFDRaw)
{
if (SmartOutPreview != null && ffdrawIn != null)
{
hr = m_filterGraph.Connect(SmartOutPreview, ffdrawIn);
DsError.ThrowExceptionForHR(hr);
}
}
hr = m_captureGraphBuilder.SetFiltergraph(m_filterGraph);
DsError.ThrowExceptionForHR(hr);
//render all together
if (m_bUseFFDRaw)
{
hr = m_captureGraphBuilder.RenderStream(null, MediaType.Video,
m_ffdraw, null, m_videoRendererFilter);
//hr = m_filterGraph.Render(ffdrawOut);
DsError.ThrowExceptionForHR(hr);
}
else
{
hr = m_captureGraphBuilder.RenderStream(null, MediaType.Video,
m_SmartTee, null, m_videoRendererFilter);
//hr = m_filterGraph.Render(SmartOutPreview);
DsError.ThrowExceptionForHR(hr);
}
//get the interfaces
m_crossbarFilter = null;
hr = m_captureGraphBuilder.FindInterface(PinCategory.Capture,
MediaType.Video, m_deviceFilter, typeof(IAMCrossbar).GUID,
out o);
if (hr >= 0)
{
m_crossbarFilter = (IBaseFilter)o;
m_crossbarInterface = (IAMCrossbar)o;
o = null;
}
if (m_crossbarFilter == null || m_crossbarInterface == null)
m_console.Text += ("Capture Engine: Can't find a
crossbar-interface."
+ System.Environment.NewLine);
hr = m_captureGraphBuilder.FindInterface(null, null, m_deviceFilter,
typeof(IAMAnalogVideoDecoder).GUID, out o);
if (hr >= 0)
{
m_decoder = (IAMAnalogVideoDecoder)o;
m_decoderFilter = (IBaseFilter)o;
o = null;
}
if (m_decoder == null || m_decoderFilter == null)
m_console.Text += ("Capture Engine: Can't find a
decoder-interface." +
System.Environment.NewLine);
//get video properties
AMMediaType media;
VideoInfoHeader v;
hr = m_stream.GetFormat(out media);
DsError.ThrowExceptionForHR(hr);
try
{
v = new VideoInfoHeader();
Marshal.PtrToStructure(media.formatPtr, v);
m_iWidth = v.BmiHeader.Width;
m_iHeight = v.BmiHeader.Height;
m_iBitsPerPixel = v.BmiHeader.BitCount;
m_iFPS = 1000000 / (int)v.AvgTimePerFrame;
m_stride = m_iWidth * (v.BmiHeader.BitCount / 8);
}
finally
{
DsUtils.FreeAMMediaType(media);
media = null;
}
//set video window
m_videoWindow = null;
m_videoWindow = (IVideoWindow)m_filterGraph;
m_wndHandle = hWindow;
hr = m_videoWindow.put_Owner(hWindow.Handle);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_MessageDrain(hWindow.Parent.Handle);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_WindowStyle(WindowStyle.Child |
WindowStyle.ClipChildren | WindowStyle.ClipSiblings);
DsError.ThrowExceptionForHR(hr);
hr = m_videoWindow.put_Visible(OABool.True);
DsError.ThrowExceptionForHR(hr);
Rectangle rc = hWindow.ClientRectangle;
hr = m_videoWindow.SetWindowPosition(0, 0, rc.Right, rc.Bottom);
DsError.ThrowExceptionForHR(hr);
m_console.Text += "Capture Engine: Components initialized." +
System.Environment.NewLine + System.Environment.NewLine;
#if ROT
rot = new DsROTEntry(this.m_filterGraph);
scapy ipv6 extension header packet being dropped
scapy ipv6 extension header packet being dropped
So i am using scapy with linux in order to send an IPv6 HTTP request to a
server after i successfully commence a 3 way TCP handshake.
The http request returns successfully if there are no extension headers (i
am doing it with ipv6), but if there are then i get no response back. I
doubt that the server drops the packet since i am sending it to the top
servers of the world (top 1000 ipv6 enabled servers) as a part of my
dissertation in order to see their compatibility. This is probably a
misconfiguration.
The format atm is:
I create an IPv6 packet/IPv6ExtHdrRouting().
long story short i use all 4 available extension headers and i get no
responses back, whearas if i use without i get full responses back. Why
are my packets getting dropped?
All the packets are sent without any parameters in them. If that is the
problem can you show me a sample initialization for each extension header
in order to get a response back?
EDIT:
my code is quite complex, after all procedures are run however i do
something like this:
site[:-1] is a website i.e. www.google.com
ip is an ipv6 address WITH extension headers.
The 3 way handshake is without extension headers as you can see, and when
i do the HTTP request i use the IP with extension headers.
An ip with extension header looks like this(without lower level details
such as TCP etc):
IPv6(dst=...)/IPv6ExtHdrHopByHop()
or
IPv6(dst=...)/IPv6ExtHdrHopByHop()/IPv6ExtHdrFragment()
destination=getIPv6Addr(site[:-1])
ip.dst=destination
syn =
IPv6(dst=getIPv6Addr(site[:-1]))/TCP(sport=12345,dport=80,
flags='S', seq=1000)#flag S is syn packet
syn_ack_rcv = sr1(syn,timeout=1)
my_ack = syn_ack_rcv.seq + 1
ack=IPv6(dst=getIPv6Addr(site[:-1]))/TCP(sport=12345,dport=80,
flags='A', seq=1001, ack=my_ack)#flag S is syn packet
send(ack)
httpRequest = 'GET / HTTP/1.1\r\nHost:' +site[:-1]
+"\r\n\r\n"
http=ip/TCP(sport=11235,dport=80,seq=1002,
ack=my_ack)/httpRequest
answers = sr1(http,timeout=1)
So i am using scapy with linux in order to send an IPv6 HTTP request to a
server after i successfully commence a 3 way TCP handshake.
The http request returns successfully if there are no extension headers (i
am doing it with ipv6), but if there are then i get no response back. I
doubt that the server drops the packet since i am sending it to the top
servers of the world (top 1000 ipv6 enabled servers) as a part of my
dissertation in order to see their compatibility. This is probably a
misconfiguration.
The format atm is:
I create an IPv6 packet/IPv6ExtHdrRouting().
long story short i use all 4 available extension headers and i get no
responses back, whearas if i use without i get full responses back. Why
are my packets getting dropped?
All the packets are sent without any parameters in them. If that is the
problem can you show me a sample initialization for each extension header
in order to get a response back?
EDIT:
my code is quite complex, after all procedures are run however i do
something like this:
site[:-1] is a website i.e. www.google.com
ip is an ipv6 address WITH extension headers.
The 3 way handshake is without extension headers as you can see, and when
i do the HTTP request i use the IP with extension headers.
An ip with extension header looks like this(without lower level details
such as TCP etc):
IPv6(dst=...)/IPv6ExtHdrHopByHop()
or
IPv6(dst=...)/IPv6ExtHdrHopByHop()/IPv6ExtHdrFragment()
destination=getIPv6Addr(site[:-1])
ip.dst=destination
syn =
IPv6(dst=getIPv6Addr(site[:-1]))/TCP(sport=12345,dport=80,
flags='S', seq=1000)#flag S is syn packet
syn_ack_rcv = sr1(syn,timeout=1)
my_ack = syn_ack_rcv.seq + 1
ack=IPv6(dst=getIPv6Addr(site[:-1]))/TCP(sport=12345,dport=80,
flags='A', seq=1001, ack=my_ack)#flag S is syn packet
send(ack)
httpRequest = 'GET / HTTP/1.1\r\nHost:' +site[:-1]
+"\r\n\r\n"
http=ip/TCP(sport=11235,dport=80,seq=1002,
ack=my_ack)/httpRequest
answers = sr1(http,timeout=1)
tomcat always starts in two attempts
tomcat always starts in two attempts
I have windows server with tomcat7 installed on it, it always take two
attempts to start, can any one give some idea why this happens , I tried
to google it but did'nt got any clue
I have windows server with tomcat7 installed on it, it always take two
attempts to start, can any one give some idea why this happens , I tried
to google it but did'nt got any clue
set up javafx scene with multiple nodes
set up javafx scene with multiple nodes
I am trying to set up my javafx scene, but i have failed miserable.
basically what i am trying to do is as per attached photo.
I have tried to set up a gridpane and then position another gridpane
withing it so that I can set up the boxes and labels however this is not
working properly.
I do not want to use JXML.
can you guys recommend how to go about this set up.
I am trying to set up my javafx scene, but i have failed miserable.
basically what i am trying to do is as per attached photo.
I have tried to set up a gridpane and then position another gridpane
withing it so that I can set up the boxes and labels however this is not
working properly.
I do not want to use JXML.
can you guys recommend how to go about this set up.
Friday, 23 August 2013
Datatables: single column filter for multiple table
Datatables: single column filter for multiple table
I have two tables oTable and aTable using Datatables. I want each table
can do single column filter.
oTable = $("#datalist").dataTable({....});
aTable = $("#tracedata").dataTable({....});
filter code
It just work for oTable only. How to make aTable could filtering it column
but with more efficient code?
I have two tables oTable and aTable using Datatables. I want each table
can do single column filter.
oTable = $("#datalist").dataTable({....});
aTable = $("#tracedata").dataTable({....});
filter code
It just work for oTable only. How to make aTable could filtering it column
but with more efficient code?
php : result of sum array values is wrong
php : result of sum array values is wrong
I have an array:
$test =array('49'=> '-0','51'=> '-0','50'=> '0','53'=> '-1.69','55'=>
'0','57'=> '-2','59'=> '-6','60'=> '-12','65'=> '0','66'=> '0','67'=>
'21.69','69'=> '0','70'=> '0','71'=> '0',);
echo "\n".'===== First Method ========';
echo "\n\n".print_r($test);
echo "\n array_sum: ".array_sum($test);
echo "\n\n".'===== Second Method ========';
$total = 0;foreach($test as $value) $total += $value;
echo "\n foreach:".$total."\n";
the result is
it is wrong, the result should be 0, not 3.5527136788E-15, how to fix it ?
I have an array:
$test =array('49'=> '-0','51'=> '-0','50'=> '0','53'=> '-1.69','55'=>
'0','57'=> '-2','59'=> '-6','60'=> '-12','65'=> '0','66'=> '0','67'=>
'21.69','69'=> '0','70'=> '0','71'=> '0',);
echo "\n".'===== First Method ========';
echo "\n\n".print_r($test);
echo "\n array_sum: ".array_sum($test);
echo "\n\n".'===== Second Method ========';
$total = 0;foreach($test as $value) $total += $value;
echo "\n foreach:".$total."\n";
the result is
it is wrong, the result should be 0, not 3.5527136788E-15, how to fix it ?
Excel Find column number of a column thru column name and access data of all rows
Excel Find column number of a column thru column name and access data of
all rows
I have created an Excel sheet (xls or xlsx) dynamically who has several
cols 50+. Most of the cols have a single row data. Some have multiple rows
data. Their are few same col names also. My concern is I want to access
cols of multiple rows whose col names are same. For eg : Placement Header
Val1 Val2 Vall3 Header Val1 Val2 Val3
TRUE FIP 1 2 3 SI A 4 5 6 Sheer 7 8 9 SI B 5 2 6 Cont 6 5 4 ----- 1 List
---------- ----------- 2 List -------
1 List & 2List data belongs to same class and is both are added with same
column names.
I am using OLEDB to read data. My class contains properties (Header, Val1,
Val2, Val3). To read data, I iterate thru each property of class and store
data. But with this case, I have multiple tables with same headers.
Is their a way, that I can find column number of col "Placement" and then
seek next 3 cols in and store all 3 rows data in a list.
Or any other alternative method to access the columns of this type and
store them in different Lists object.
Any help is highly appreciative. I am stuck here and am in hurry.
all rows
I have created an Excel sheet (xls or xlsx) dynamically who has several
cols 50+. Most of the cols have a single row data. Some have multiple rows
data. Their are few same col names also. My concern is I want to access
cols of multiple rows whose col names are same. For eg : Placement Header
Val1 Val2 Vall3 Header Val1 Val2 Val3
TRUE FIP 1 2 3 SI A 4 5 6 Sheer 7 8 9 SI B 5 2 6 Cont 6 5 4 ----- 1 List
---------- ----------- 2 List -------
1 List & 2List data belongs to same class and is both are added with same
column names.
I am using OLEDB to read data. My class contains properties (Header, Val1,
Val2, Val3). To read data, I iterate thru each property of class and store
data. But with this case, I have multiple tables with same headers.
Is their a way, that I can find column number of col "Placement" and then
seek next 3 cols in and store all 3 rows data in a list.
Or any other alternative method to access the columns of this type and
store them in different Lists object.
Any help is highly appreciative. I am stuck here and am in hurry.
Simple tutorial example (lambda expression) doesn't run
Simple tutorial example (lambda expression) doesn't run
Finally decided to start a bit of experimentation on the new features of
jdk8, namely the lambda expressions following the tutorial. For
convenience, I stripped-down the example, see SSCCE below.
Typing out the predicate just runs fine, refactoring it to a lambda
expression as suggested (and actually done) by Netbeans compiles (?)
without errors, but doesn't run. The laconic console printout is
Fehler: Hauptklasse simple.Simple konnte nicht gefunden oder geladen werden
("Error: main class couldn't be found or loaded")
Environment:
jdk: jdk-8-ea-bin-b102-windows-i586-08_aug_2013.exe
Netbeans 7.4 beta, bundle from 14.7.2013. Not sure if that's the latest,
couldn't download from the Netbeans site (got a "content encoding error"
when clicking on its download link)
BTW, thought of using Netbeans only because it already has support for
jdk8 (if not netbeans, who else ;-) - the eclipse beta preview from
efxclipse has a similar issue (compiling but not running the example). So
being definitely out off my comfort zone, possibly some very stupid
mistake on my part... ?
package simple;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
public class Simple {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
List<Member> members = createMembers();
printMembers(members);
// implement predicate directly, runs fine
// Predicate<Member> predicate = new Predicate<Member>() {
// public boolean test(Member member) {
// return member.getAge() >= 18;
// }
// };
// predicate converted to lambda, fails to run
// "class couldn't be found"
Predicate<Member> predicate = (Member member) -> member.getAge()
>= 18;
for (Member member : members) {
if (predicate.test(member)) {
member.printMember();;
}
}
}
public static class Member {
private String name;
private int age;
public Member(String name, int age) {
this.name = name;
this.age = age;
}
public int getAge() {
return age;
}
public void printMember() {
System.out.println(name + ", " + getAge());
}
}
private static List<Member> createMembers() {
List<Member> members = new ArrayList<>();
members.add(new Member("Mathilda", 45));
members.add(new Member("Clara", 15));
members.add(new Member("Gloria", 18));
return members;
}
}
Finally decided to start a bit of experimentation on the new features of
jdk8, namely the lambda expressions following the tutorial. For
convenience, I stripped-down the example, see SSCCE below.
Typing out the predicate just runs fine, refactoring it to a lambda
expression as suggested (and actually done) by Netbeans compiles (?)
without errors, but doesn't run. The laconic console printout is
Fehler: Hauptklasse simple.Simple konnte nicht gefunden oder geladen werden
("Error: main class couldn't be found or loaded")
Environment:
jdk: jdk-8-ea-bin-b102-windows-i586-08_aug_2013.exe
Netbeans 7.4 beta, bundle from 14.7.2013. Not sure if that's the latest,
couldn't download from the Netbeans site (got a "content encoding error"
when clicking on its download link)
BTW, thought of using Netbeans only because it already has support for
jdk8 (if not netbeans, who else ;-) - the eclipse beta preview from
efxclipse has a similar issue (compiling but not running the example). So
being definitely out off my comfort zone, possibly some very stupid
mistake on my part... ?
package simple;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
public class Simple {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
List<Member> members = createMembers();
printMembers(members);
// implement predicate directly, runs fine
// Predicate<Member> predicate = new Predicate<Member>() {
// public boolean test(Member member) {
// return member.getAge() >= 18;
// }
// };
// predicate converted to lambda, fails to run
// "class couldn't be found"
Predicate<Member> predicate = (Member member) -> member.getAge()
>= 18;
for (Member member : members) {
if (predicate.test(member)) {
member.printMember();;
}
}
}
public static class Member {
private String name;
private int age;
public Member(String name, int age) {
this.name = name;
this.age = age;
}
public int getAge() {
return age;
}
public void printMember() {
System.out.println(name + ", " + getAge());
}
}
private static List<Member> createMembers() {
List<Member> members = new ArrayList<>();
members.add(new Member("Mathilda", 45));
members.add(new Member("Clara", 15));
members.add(new Member("Gloria", 18));
return members;
}
}
how to plot graph using ggplot in R
how to plot graph using ggplot in R
i have data frame which contains Quarter and Unique Customer ID columns
what i want is plot a graph which will count the Unique customers by
Quarter.
what i tried is
uniquegraph<-data.frame(uniqueCustomerdf)
> uniqueCustomer<-c(uniquegraph$Customer.Id)
> Quarter<-c(uniquegraph$Quarter)
> uniquegraphplot<-data.frame(uniqueCustomer=uniqueCustomer,Quarter=Quarter)
> ggplot(mygraphdf,aes(x=myquarter,y=totalunitprice)) +
geom_bar(stat="identity")
and also i tried hist
hist(uniqueCustomer, plot=TRUE)
but here how to assign Quarter i am not getting
i have data frame which contains Quarter and Unique Customer ID columns
what i want is plot a graph which will count the Unique customers by
Quarter.
what i tried is
uniquegraph<-data.frame(uniqueCustomerdf)
> uniqueCustomer<-c(uniquegraph$Customer.Id)
> Quarter<-c(uniquegraph$Quarter)
> uniquegraphplot<-data.frame(uniqueCustomer=uniqueCustomer,Quarter=Quarter)
> ggplot(mygraphdf,aes(x=myquarter,y=totalunitprice)) +
geom_bar(stat="identity")
and also i tried hist
hist(uniqueCustomer, plot=TRUE)
but here how to assign Quarter i am not getting
Thursday, 22 August 2013
((((((((((((( __ READ __ BEFORE ___ DELETED ___ BY ___ MODS ___ ))))))))))))))
((((((((((((( __ READ __ BEFORE ___ DELETED ___ BY ___ MODS ___
))))))))))))))
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1 : you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
3: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a cvs file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a cvs file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest.
...........................................................................................................................................................
))))))))))))))
You are about to be provided with information to
start your own Google.
Some people posted comments and said this can not
be done because google has 1 million servers and we do not.
The truth is, google has those many servers for trolling
purposes (e.g. google +, google finance, youtube the bandwidth consuming
no-profit making web site, etc ).
all for trolling purposes.
if you wanted to start your own search engine...
you need to know few things.
1 : you need to know how beautiful mysql is.
2: you need to not listen to people that tell you to use a framework
with python, and simply use mod-wsgi.
3: you need to cache popular searches when your search engine is running.
3: you need to connect numbers to words. maybe even something like..
numbers to numbers to words.
in other words let's say in the past 24 hours people searched for
some phrases over and over again.. you cache those and assign numbers
to them, this way you are matching numbers with numbers in mysql.
not words with words.
in other words let's say google uses 1/2 their servers for trolling
and 1/2 for search engine.
we need technology and ideas so that you can run a search engine
on 1 or 2 dedicated servers that cost no more than $100/month each.
once you make money, you can begin buying more and more servers.
after you make lots of money.. you probably gonna turn into a troll
too like google inc.
because god is brutal.
god is void-state
it keeps singing you songs when you are sleeping and says
"nothing matters, there is simply no meaning"
but of course to start this search engine, you need a jump start.
if you notice google constantly links to other web sites with a
trackable way when people click on search results.
this means google knows which web sites are becoming popular
are popular, etc. they can see what is rising before it rises.
it's like being able to see the future.
the computer tells them " you better get in touch with this guy
before he becomes rich and becomes un-stopable "
sometimes they send cops onto people. etc.
AMAZON INC however..
will provide you with the top 1 million web sites in the world.
updated daily in a cvs file.
downloadable at alexa.com
simply click on 'top sites' and then you will see the downloadable
file on the right side.
everyday they update it. and it is being given away for free.
google would never do this.
amazon does this.
this list you can use to ensure you show the top sites first in your
search engine .
this makes your search engine look 'credible'
in other words as you start making money, you first display things
in a "Generic" way but at the same time not in a "questionable" way
by displaying them based on "rank"
of course amazon only gives you URLS of the web sites.
you need to grab the title and etc from the web sites.
the truth is, to get started you do not need everything from web sites.
a title and some tags is all you need.
simple.
basic.
functional
will get peoples attention.
i always ask questions on SO but most questions get deleted. here's
something that did not get deleted..
How do I ensure that re.findall() stops at the right place?
use python, skrew php, php is no good.
do not use python frameworks, it's all lies and b.s. use mod-wsgi
use memcache to cache the templates and thus no need for a template engine.
always look at russian dedicated servers, and so on.
do not put your trust in america.
it has all turned into a mafia.
google can file a report, fbi can send cops onto you, and next thing you know
they frame you as a criminal, thug, mentally ill, bipolar, peadophile, and
so on.
all you can do is bleed to death behind bars.
do not give into the lies of AMERICA.
find russian dedicated servers.
i tried signing up with pw-service.com but i couldn't do it due to
restrictions with their russian payment systems and so on..
again, amazon's web site alexa.com provides you with downloadable
top 1 mil web sites in the form of a cvs file.
use it.
again, do not give into python programmers suggesting frameworks for python.
it's all b.s. use mod_wsgi with memcache.
again, american corporations can ruin you with lies and all you can do is
bleed to death behind bars
again, a basic search engine needs : url, title, tags, and popular searches
can be "cached" and words can be connected to "numbers" within the mysql.
mysql has capabilities to cache things as well.
cache once, cache twice, and you will not need 1 million servers in order
to troll.
if you need some xdotool commands to deal with people calling you a troll
here it is;
xdotool key ctrl+c
xdotool key Tab Tab Tab Return
xdotool type '@'
xdotool key ctrl+v
xdotool type --clearmodifiers ', there can not be such thing as a `troll`
unless compared to a stationary point, if you are complaining, you are not
stationary. which means you are the one that is trolling.'
xdotool key Tab Return
create an application launcher on your gnome-panel, and then select the
username in the comments section that called you a 'troll' and click the
shortcut on the gnome-panel.
it will copy the selected username to the clipboard and then hit TAB TAB
TAB RETURN
which opens the comment typing box. and then it will type @ + username +
comma, and then the rest.
...........................................................................................................................................................
Subscribe to:
Posts (Atom)