Monday, 30 September 2013

Extracting a zip file in my machne givs me CRC error?

Extracting a zip file in my machne givs me CRC error?

I have a large zip that contain hundreds of file. I've unzip'ed it in more
than one machine and didn't have any problem before. However, for this
particular machine (Ubuntu Server 12.04) I keep getting CRC error for some
of the files inside my zip. I've unzip'ed the same file it on anther
machine just to and its fine.
Any clue?

What kind of dock hardware will Ubuntu Touch use?

What kind of dock hardware will Ubuntu Touch use?

We've seen that Ubuntu Touch will be able to be used as a desktop when
docked with a keyboard and mouse. This is an extremely appealing future,
but what I'm wondering is where do you find that kind of hardware? Since
Ubuntu Touch is being designed for Android phones, it would make sense
that such a dock already exists for them, but I haven't seen any. Maybe I
haven't been looking hard enough. Will that be something that is released
after the official launch of Ubuntu Touch?

jQuery css transition toggle fix

jQuery css transition toggle fix

I have a little problem with jquery toggle function. Sometimes i can fix
it very fast but now im totally crazy about this. Im using jquery transit
plugin to animate a DIV
The code:
$(".grid-1").toggle( function() {
$(this).transition({ perspective: '170px', rotateY: '180deg' },
function() {
$(this).transition({ perspective: '170px', rotateY: '0deg' });
});
});
If i refresh the page this DIV (.grid-1) just disappear... where i make a
mistake ?
Thank you!

Google maps link is opening in webview

Google maps link is opening in webview

I have made an android app in WebView. When I open a Google maps link,
it's opening in WebView and not in the Google app. How can I fix this? I
have searched on Google and on Stack Overflow but can't find the any
solution.
Code:
public class FullscreenActivity extends Activity {
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new myWebClient());
webView.loadUrl("http://m.neshaniha.org/");
webView.setVerticalScrollBarEnabled(false);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
public class myWebClient extends WebViewClient
{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_DIAL,
Uri.parse(url));
startActivity(intent);
}else if(url.startsWith("http:") || url.startsWith("https:")) {
view.loadUrl(url);
}
return true;
}
}

Sunday, 29 September 2013

Confusion related to derivative of a vector

Confusion related to derivative of a vector

What is the derivative of
$\frac{d}{d \theta} \theta^T$
I am a bit confused what it will be. Is it $[ 1 1 1 1]^T$ if $\theta$ is a
vector with four elements

How to register a bulk device

How to register a bulk device

I'm very new to kernel programming. i created a simple USB driver by
reading greg's code
"http://www.cs.fsu.edu/~baker/devices/lxr/http/source/ldd-examples/usb/usb-skeleton.c"
My code is at http://kgcorner.som/code/simusb.c
As far as i thought, this code can read data and write data from and to
usb device. But when i attached my pendrive i saw dmesg trace i found
everything okay but unable to my my device in output of lsblk. As it's not
there i'm not able to mount it and hence unable to test my driver. Here's
dmesg trace ===========================================
[20073.437683] [SIMUSB]:Module Loaded
[20073.437730] [SIMUSB] USB Detected
[20073.437734] [SIMUSB] USB Vendor ID=1008 and Product ID=22023
[20073.437737] [SIMUSB] endpoint->bEndpointAddress=1
[20073.437740] [SIMUSB] Result of endpoint->bEndpointAddress & USB_DIR_OUT
is 0
[20073.437743] [SIMUSB] ENDPOINT WITH OUT DIRECTION FOUND
[20073.437746] [SIMUSB] Result of endpoint->bmAddress &
USB_ENDPOINT_XFERTYPE_MASK is 2
[20073.437749] [SIMUSB] OUT ENDPOINT adress set
[20073.437752] [SIMUSB] endpoint->bEndpointAddress=130
[20073.437755] [SIMUSB] Result of endpoint->bEndpointAddress & USB_DIR_IN
is 128
[20073.437757] [SIMUSB] ENDPOINT WITH IN DIRECTION FOUND
[20073.437760] [SIMUSB] Result of endpoint->bmAddress &
USB_ENDPOINT_XFERTYPE_MASK is 2
[20073.437763] [SIMUSB] IN ENDPOINT adress set
[20073.437910] [SIMUSB] status=0
[20073.437914] [SIMUSB] USB Registered Successfully
Please help. thanks in advance

How can I convert "Mon, 23 Sep 2013 07:00:00 GMT" as a string into "2013-09-23" using STR_TO_DATE in MySQL?

How can I convert "Mon, 23 Sep 2013 07:00:00 GMT" as a string into
"2013-09-23" using STR_TO_DATE in MySQL?

I've got a long query with comparisons between tables, and one table has
this format:
"Mon, 23 Sep 2013 07:00:00 GMT"
And another table has this format:
"2013-09-23"
How can I do a query where I can essentially do a
SELECT * from table1, table2
WHERE table1.date = table2.date

How to use KeyPressEvent in correct way

How to use KeyPressEvent in correct way

try to create HotKeys for my forms
code
private void FormMain_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
MessageBox.Show("e");
}
}
works for one key, but if I whant to use combination of keys like CTRL+N,
try to use if (e.KeyChar == (char)Keys.Enter && e.KeyChar == (char)Keys.N)
- but it's not working. I'm I right - using such code for keys
combination?

Saturday, 28 September 2013

c++: vector of vector issue

c++: vector of vector issue

pI wrote a c++ code where i'm testing the running time of vector
push_back. I have a vector of vector. I called my main vector, mainVec,
and embedded vector, subVec. So, I push backed 2^20 elements into subVec
and then push backed subVec 2^20 times into mainVec. However, in the loop
of subVec-push_back I have a cout command which doesn't get executed. I
was hoping you can point out my mistake. /p pHere is the code (There is no
error in the code, though):/p precodevectorlt;intgt; subVec; vectorlt;
vectorlt;intgt; gt; mainVec; //Fills the subvector with 2^20 elements for(
size_t i = 0; i lt; (pow(2,20)+1); ++i) subVec.push_back(i); //Filling of
the maiVec with 2^20 subVec for( size_t j = 10; j lt; 21; ++j) { cout
lt;lt; pow(2,j) lt;lt; endl; clock_t t1 = clock(); //2^j times subVec is
push_backed for j lt; 21 for( size_t k = 0; k lt; pow(2,j); ++k )
mainVec.push_back( subVec ); t1 = clock()-t1; //Outputting to file cout
lt;lt; \t lt;lt; (float(t1) / CLOCKS_PER_SEC) lt;lt; endl; //ofs lt;lt;
pow(2,j) lt;lt; \t\t lt;lt; (float(t1) / CLOCKS_PER_SEC) lt;lt; endl; }
/code/pre

Wrong scope for my nested classes?

Wrong scope for my nested classes?

I'm fairly new to C# and programming in general. At work I monitor a very
large list of servers and websites associated with the application running
on the servers. Generally each application has a cluster of servers behind
it and roughly 6-10 different web-pages. So what I did was I created a
Servers class that will take in a server's name(s) and control the urls
that are associated with it. Now here's the part I'm struggling with. Each
url is going to have two values associated with it: the physical url and
the status of the url (online/offline). I came up with two ways of
handling this: either I create a 2D array (or list) OR create a url
subclass. The subclass method seemed like it would be better since I
thought accessing all the methods of the subclass would be easy... Well
right now I can't call them at all outside of the Servers class. This
makes me think I have an issue with the scope of the classes/methods.
Here's my Servers.cs code... What am I doing wrong?
public class Server
{
public List<string> serverNames = new List<string>();
public List<object> urlList = new List<object>();
public string[][] urlArr = new string[1][];
public Server()
{
}
public Server(string nm)
{
serverNames.Add(nm);
}
public void setName(string newName)
{
serverNames.Add(newName);
}
public void addUrl(string newUrl)
{
Server.Url url = new Server.Url(newUrl);
urlList.Add(url);
url.SetStatus(false);
}
protected class Url
{
public string url;
public bool status;
public Url()
{
}
public Url(string URL)
{
url = URL;
}
public void SetStatus(bool stat)
{
status = stat;
}
public bool ReturnStatus()
{
return status;
}
}
}

javascrpit - show hide button

javascrpit - show hide button

i have a problem in code JavaScript/jquery .. i am aclick in button and
content hide faster
<div class='show_hide' id='slidingDiv'>
<br/>
<input class='show_hide' href='javascript:void(0);' type='button'
value='show post'/>
</div>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js'
type='text/javascript'/>
<script
type='text/javascript'>$(document).ready(function(){$(&quot;.slidingDiv&quot;).hide();$(&quot;.show_hide&quot;).show();$(&#39;.show_hide&#39;).click(function(){$(&quot;.slidingDiv&quot;).slideToggle();});});</script>

how to create exception for char when the input should be int

how to create exception for char when the input should be int

try
{
int selection;
if(selection > 4 || selection < 1)
throw selection;
}
catch(int selection)
{
cout << "Menu selection out of range." << endl;
}
The above code works fine for int values that are out of range, but I
cannot get it to work if a char value is entered at (cin >> selection).
I have tried to post a catch block with an ellipsis [catch(...)] to
account for char entries but that does not work.
I have also tried a catch block with [catch(char selection)] but that does
not work either.
I would like to use an exception to handle this error as it would help in
my overall project in other menu type areas.

Friday, 27 September 2013

Entering numbers from form input into an array PHP

Entering numbers from form input into an array PHP

<form method="post" action = "handler.php" >
<input type="text" name="number1" />
<input type="text" name="number2" />
<input type="text" name="number3" />
<input type="text" name="number4" />
<input type="text" name="number5" />
etc..
I have a form set up like this to take in 10 different numbers. I want to
add each of these numbers to an array so that I can sort the numbers.
$numArr = ();
I have tried everything from array_push to call the $_POST['number1']
directly in the array itself. Every time I do echo $numArr all i get is an
empty array as an output.

calculate percentages at the different grouping levels without creating separate percentage formulas for each group level

calculate percentages at the different grouping levels without creating
separate percentage formulas for each group level

In Crystal Report,I am looking for a way to calculate percentages at the
different grouping levels without creating separate percentage formulas
for each group level. can someone please tell me is there a way to do that
or I have to create separate percentage formulas for each group level?
Thank you.

Java: Calling non-static method with this. from static method

Java: Calling non-static method with this. from static method

I was wondering if I could use this. to call a non-static method from
within a static method. I know I would need an object in general to
reference to a non-static method from within a static method. Thanks

How can i use User and Password by $_session[] to search?

How can i use User and Password by $_session[] to search?

I create images slider. It's must use user & password to run. Here is.
<?
include 'connect.php';
$_session[user_login] = "zyxel";
$_session[pass_login] = "12345";
?>
<html>
<head>
<link rel="stylesheet" href="themes/default/default.css"
type="text/css" media="screen" />
<link rel="stylesheet" href="themes/light/light.css"
type="text/css" media="screen" />
<link rel="stylesheet" href="themes/dark/dark.css" type="text/css"
media="screen" />
<link rel="stylesheet" href="lib/nivo-slider.css" type="text/css"
media="screen" />
<link rel="stylesheet" href="lib/style.css" type="text/css"
media="screen" />
</head>
<body>
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<?php
$sql1 = "SELECT gload1,gload2,gload3,gload4,gload5
FROM member WHERE $_session[user_login] AND
$_session[pass_login]";
$result1 = mysql_query($sql1);
$arry1 = mysql_fetch_array($result1);
$a = 0;
$b = 1;
$c = 2;
$d = 3;
$e = 4;
$f = 5;
$g = 6;
$h = 7;
$i = 8;
$j = 9;
if(empty($arry1)){
exit();
}
else {
$index = array_search(max($arry1),$arry1);
if($index == $a){
echo "<img src=images/01/01.jpg>";
echo "<img src=images/01/02.jpg>";
echo "<img src=images/01/03.jpg>";
echo "<img src=images/01/04.jpg>";
}else if($index == $b){
echo "<img src=images/02/01.jpg>";
echo "<img src=images/02/02.jpg>";
echo "<img src=images/03/03.jpg>";
echo "<img src=images/04/04.jpg>";
}else if($index == $c){
echo "<img src=images/03/01.jpg>";
echo "<img src=images/03/02.jpg>";
echo "<img src=images/03/03.jpg>";
echo "<img src=images/03/04.jpg>";
}else if($index == $d){
echo "<img src=images/04/01.jpg>";
echo "<img src=images/04/02.jpg>";
echo "<img src=images/04/03.jpg>";
echo "<img src=images/04/04.jpg>";
}else {exit();
}
?>
</body>
</html>
and error is : Warning: mysql_fetch_array(): supplied argument is not a
valid MySQL result resource in line 21 [ $arry1 =
mysql_fetch_array($result1);]
I known problem is in SQL !! Before this, i use [SELECT .... FROM member
WHERE mid = '001';] and ,it's just show up. How can i fix that.
Thank for any answer.

between extends Activity and extends AndroidApplication

between extends Activity and extends AndroidApplication

I want to call
public class main3D extends AndroidApplication {
public void onCreate (android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initialize(new genarate3D(), false);
}
}
by this class
public class mainPage extends Activity
{
private ImageView mHome;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main_page);
mHome = (ImageView) findViewById(R.id.imgVtownHome);
mHome.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(mainPage.this, main3D.class);
startActivity(i);
}
});
}
but there is error because extends between Activity and AndroidApplication
how could I fix this? thank you.

HTML, javascript - Displaying input value to a label

HTML, javascript - Displaying input value to a label

I want to display the value of an <input> to a label or something like
that, by using onkeyup so it's real time. But can only do it by using a
second input instead of the label but I just want to display the value.
This is my Javascript function:
function copyTo(obj) {
document.getElementById("utmatning").value = obj.value
}
And the HTML:
<label>E-post:</label>
<input id="inmatning" type="text" onkeyup="copyTo(this)"
placeholder="Skriv in e-post…">
<span>Vår återkoppling kommer att skickas till:</span>
<br>
<label id="utmatning"></label>

line break in textarea without displaying HTML tags

line break in textarea without displaying HTML tags

I am using this HTML/PHP Code
<textarea name="ticket_update" id="ticket_update" cols="70" rows="2"><?php
echo 'Ticket '.$ticket["ticketnumber"].'\n'.$result["notes"];
?></textarea>
I have tried using \n \n\r and <br /> but it is displaying the HTML tags
in the textarea.
how can i stop them displaying?

Thursday, 26 September 2013

Can somebody clear these questions about infopath with sharepoint?

Can somebody clear these questions about infopath with sharepoint?

I faced few more questions while interview. it was totally new for me. can
you please help me out to clear more idea :
- What is infopath ( I can use MSDN)
- Can i Design InfoPath form in Sharepoint Designer 2010
- How to deploy Infopath form in Sharepoint site. (I can follow MSDN here)
- What authority needs to deploy Infopath in sp?
- What is Group and fields in infopath?
- Can I write custom event in InfoPath? What is VSTA?
- How add rule in Infopath form
- How to validate Infopath fields?
- Can I show InfoPath in Webpart ?
- Where infopath will deploy?
- Can I show Infopath fields in List?
- Can I configure workflow with Infopath in SP?
- What are advantages and disadvantages of using Infopath? ( I can google it)
- How IIS works against the Infopath request ?
- How Sharepoint request handle by IIS?

Wednesday, 25 September 2013

How does Bootstrap 3 performance compare to Ratchet and Topcoat?

How does Bootstrap 3 performance compare to Ratchet and Topcoat?

I have been developing the prototype of an Android Tablet App using
Cordova(former Phonegap), Angularjs and Twitter Bootstrap 2. It turns out
that the performance of Bootstrap 2 is well known to be poor in embedded
devices. In addition, I noticed that Ratchet and Topcoat are the popular
alternatives, as they take care of the performance themes.
However, I know bootstrap 3 came out with focus on mobile first.
So, how does it compare in terms of performance?

Thursday, 19 September 2013

anonymous functions in vb

anonymous functions in vb

How do you rewrite the following to work in older vb.net environments?
This is not working with build machine?
Just create a function that takes in two AuctionInfos returns an integer?
Then do the addressof thang?
tempItems.Sort(
Function(aInfo1 As AuctionInfo, aInfo2 As AuctionInfo)
Return aInfo1.StartTime.CompareTo(aInfo2.StartTime)
End Function)
attempting the following
tempItems.Sort(AddressOf AuctionSorter)
Public Shared Function AuctionSorter(aInfo1 As AuctionInfo, aInfo2 As
AuctionInfo) As Integer
Return aInfo1.StartTime.CompareTo(aInfo2.StartTime)
End Function

How to retrieve the job and customer suffix field using the quickbooks API

How to retrieve the job and customer suffix field using the quickbooks API

We are building an application that gets data from a QuickBooks online
account using the QuickBooks Online API V2. According to the API
documentation, we can see that the "Suffix" field is supported for both
customer and job tables. However we have noticed this field is not being
returned in the API response. Below is a sample response for a job which
should have a suffix (the suffix is present in the quickbooks UI). Is this
a problem with the API, the API documentation, or our API request?
200 14 2013-05-08T10:57:55-07:00 2013-09-17T09:23:39-07:00 Bridget
O'Brien276 5165 easy Line 2 Line 3 Line 4 Line 5 Portland United States OR
12620 INVALID Billing Primary 555-5837 Fax 555-5838 Mobile 555-556-9176
http://www.customersruscorp.com QBOrocksTest@yahoo.com Bridget Elizabeth
O'Brien276 CustomersRus LLC This is a note. Bill With Parent true
Preferred Delivery Method PRINT Bridget O'Brien276 2 1 IS_TAXABLE 2 12 3
Bridget O'Brien

Access IBOutlet from another ViewController

Access IBOutlet from another ViewController

After read a lot of stuff about delegate concept, and a painfully session
of tests in the last four hours - I began use extern DataModel... to
change data between views in my app.
But for now I really need to access a UIImageView in a ViewController
without NavigationViewController.
As start point I had this question as example:
How do I set up a simple delegate to communicate between two view
controllers?
But I think his content is outdated since the quoted url as example in
wikipedia:
http://en.wikipedia.org/wiki/Delegation_pattern#Objective-C_example have
been excluded.
I'm using Storyboards and I've tried access the IBOutlet with restoration
id, tag id, extern... But with no luck :(
If I have FirstViewController and in SecondViewController I need to access
the UIImageView in the first one, how can I do this?

Exiting an Android app on back button press LibGDX

Exiting an Android app on back button press LibGDX

I have catched my back key and gave Gdx.app.exit();, then the app exits.
Till here its working fine. But, when i happen to a go to a different
screen and get back to my original screen and again press back button, the
app doesn't exit. I would like my app to exit always when I press back
button from a particular screen.
Thanks.

Updating row mapping after external sorting

Updating row mapping after external sorting

I've been using ng-grid (2.0.7) in an AngularJS (1.2.0-rc2) project with
an external search function. My external sort function is working so far,
even the grid data gets updated.
Unfortunately, the rows are keeping their previous order. How can I tell
the grid to update the row order? I don't want to mess around with ng-grid
internals like rowMap and rowCache ...
Thank you in advance for your help!

Open a webpage in Android from a URL while keeping the URL hidden

Open a webpage in Android from a URL while keeping the URL hidden

I found this way of displaying a URL in Android but this will show the URL
to the user.
How can I hide URL from the user while still visiting that page? Or at
least how can I display a webpage in full screen without showing the
address bar?

How to run script file.exp on php with date-picker parameters?

How to run script file.exp on php with date-picker parameters?

I have made &#8203;&#8203;a part of the script but I'm stuck: This code
runs when i select the date from date-picker. I need to run file.exp with
date parameters from date-picker mm dd yyyy. I have a file report.php and
there:
<?
if (isset($_GET['debug'])) { define('DEBUG', true); }
if (isset($_GET['debug_url'])) { define('DEBUG_URL', true); }
if (defined('DEBUG')) header("Content-type: text/plain");
include "lib.php";
$date_to = $date_from = 0;
if (isset($_GET['date-from'])) { $date_from = $_GET['date-from']; }
if (isset($_POST['date-from'])) { $date_from = $_POST['date-from']; }
$date = make_date($date_from) ;
echo "$date_from";
if (preg_match('#^(\d{2})/(\d{2})/(\d{4})$#', $date_from, $matches)) {
$month = $matches[1];
$day = $matches[2];
$year = $matches[3];
} else {
echo 'invalid format';
}
echo "new day: $day";
It works ok i get new day ... but it not work with this command.
$s_command = '/full_path/file.exp
--day'.$day.'--month'.$month.'--year'.$year.'$
echo "$s_command \n";
exec($s_command, $output);
?>
In file.exp i have:
#!/usr/bin/expect -f
foreach {option value} $argv {
switch -glob -- $option {
--day {set day $value}
--month {set month $value}
--year {set year $value}
default { error "Unknown option $option!"
exit 0 }
}
}
Here is the rest of the code and we come to the command:
expect "week ending" { send "$month-$day-$year\r" }
I have to mention that using this file.exp i try to send date mm dd yyyy
to interface on telnet or tty. And also if i put date on static in this
file.exp and run it from command line it works.maybe the problem is this
global-variables(I do not understand them). Please help me :-)

How does this color matrix make image black and white?

How does this color matrix make image black and white?

I am learning about image processing and saw an implementation for how to
turn an image into black and white by changing the color matrix. Below is
the implementation of such a function from Craigs Utility Library:
ColorMatrix TempMatrix = new ColorMatrix();
TempMatrix.Matrix = new float[][]{
new float[] {.3f, .3f, .3f, 0, 0},
new float[] {.59f, .59f, .59f, 0, 0},
new float[] {.11f, .11f, .11f, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0, 0, 0, 0, 1}
};
Bitmap NewBitmap = TempMatrix.Apply(Image);
I know from this article that the matrix represents RGBAW (red green blue
amber and white). So, from my understanding, the colormatrix is
multiplying each of the RGB colors with the array {.3f, .59f, .11f}.
However I believe I am missing the last step.
Where do the constants .3f, .59f, and .11f come from that make an image
black and white? How does this matrix multiplication make the image black
and white?

Wednesday, 18 September 2013

How to invoke actionListener as soon as program starts

How to invoke actionListener as soon as program starts

Is there any way to get actionListener invoked in java as soon as the
program starts. I dont want to use any component basically to use
actionListener.

MVC 4 Code First ForeignKeyAttribute on property ... on type ... is not valid

MVC 4 Code First ForeignKeyAttribute on property ... on type ... is not valid

I keep getting this error and I do not know why.
The ForeignKeyAttribute on property 'Ward' on type
'BioSheet.Models.BioSheetModel' is not valid. The foreign key name
'WardId' was not found on the dependent type
'BioSheet.Models.BioSheetModel'. The Name value should be a comma
separated list of foreign key property names.
public class Ward
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("AddressId")]
[Required]
public virtual Address WardAddress { get; set; }
[ForeignKey("BioSheetId")]
public virtual List<BioSheetModel> BioSheets { get; set; }
[Required]
public String Code { get; set; }
}
public class BioSheetModel
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public String FirstName { get; set; }
[Required]
public String LastName { get; set; }
public String Email { get; set; }
[ForeignKey("WardId")]
[Required]
public Ward Ward { get; set; }
public String CellPhoneNumber { get; set; }
public String HouseNumber { get; set; }
[Required]
public String DoB { get; set; }
[Required]
public Address Address { get; set; }
public String OtherInformation { get; set; }
public String PreviousCallings { get; set; }
[ForeignKey("TimePeriodId")]
public virtual TimePeriod TimePeriods { get; set; }
public String HomeWard { get; set; }
public Boolean OkToText { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Required]
public DateTime TodaysDate { get; set; }
[ForeignKey("EMPId")]
public virtual EDUEMP EduEmp { get; set; }
[ForeignKey("SingId")]
public virtual Sing Singing { get; set; }
[ForeignKey("MissionId")]
public virtual Mission MissionIn { get; set; }
}
Can anyone help me resolve this?

accessing global frames in a user defined function

accessing global frames in a user defined function

a = 4
def foo(x):
a = 10
foo(2)
print(a)
#prints 4
The code above doesn't change a
a = 4
def foo(x):
return a + x
result = foo(10)
print(result)
#prints out 14
I don't quite understand how these two act differently. The second one,
the global variable obviously affects the local variable in foo. But if I
change a in the first one inside the foo, nothing happens to a in the
global frame. What is happening?

How do I detect hardware keyboard presence with javascript?

How do I detect hardware keyboard presence with javascript?

What is the best cross-browser and cross-platform way to detect hardware
keyboard presence with javascript?

Unsupported major.minor version 51.0 Error With Eclipse When Trying to Reference Jar File

Unsupported major.minor version 51.0 Error With Eclipse When Trying to
Reference Jar File

I have a simple java sandbox project which I reference the code for
Xerces-For-Android. If I put the source code directly into the project,
I'm able to compile and run my test program successfully. However if I
make a jar file, then add that into my build path I get the Unsupported
major.minor version 51.0.
Reading several posts, the Unsupported major.minor version 51.0 seems like
it is an issue based on compilation of different java versions. The
version 51.0 looks to be java 7. To simply my testing, I uninstalled all
Java 7 installs from my machine, ensured that my eclipse projects point to
the same Java 6 JRE, and that my JAVA_HOME is set to Java 6u45. I also
restart eclipse to make sure my changes were in place.
I'm using Ant to create the jar file. The code is very simple and I even
specify the javac target to be 1.6.
<project name="XercesForAndroid" default="dist" basedir=".">
<description>
Builds jar for Xerces-For-Android
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac target="1.6" srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the .jar file -->
<jar jarfile="${dist}/lib/Xerces-For-Android.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
After I run the ant script, I inspect the jar with 7-zip and find the
manifest shows 6u45 was used to make it.
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_45-b06 (Sun Microsystems Inc.)
Any ideas on what I could be missing? I don't see how Java 7 could be
referenced any more, but its seems like it is based on the 51.0
reference...
A couple other side notes:
I manually deleted the .jar file and did a clean on the Xerces-For-Android
project to ensure no old binaries were laying around.
I also did a clean on my sandbox project for testing the use of the jar
file. Same issue.

How do I color labels for my pie chart in D3?

How do I color labels for my pie chart in D3?

I started out with the following example:
http://jsfiddle.net/nrabinowitz/GQDUS/
I am trying to get the labels for each arc to be the color of the arc.
I have gotten it to where it colors all the labels the same color. But I
do now know how to access each individual label and change the color.
In my code I have done the following for the last line:
arcs.append("svg:text").attr("transform", function (d){var c =
arc.centroid(d); x = c[0]; y = c[1]; h = Math.sqrt(x*x + y*y);
return "translate(" + (x/h * 100) + ',' + (y/h * 90) +
")";}).text(function(d){return
Math.round((d.data/total)*100)+"%";}).attr("text-anchor","middle").attr("fill","color_data.pop()");
This makes all the labels the first color in my array. However I need each
label to be a different color in the array. I am just not sure how to
access the labels so I can loop through and change the color.

Make hyperlink in webmail back to mvc4 project

Make hyperlink in webmail back to mvc4 project

I have a webmail and i want the user to press on a picture in the webmail
and then be linked back to my mvc project view. I don't have a real domain
yet so i can't type www.mysite.com. I want to be able to link to the view
without depending on which domain the site is currently running on.
in my webmail i have the body that looks like this:
string Body = "<b>Välj ett alternativ!</b><br><br><a
href='cid:path4'/><img src='cid:Happy'/ alt='HTML tutorial' width='120'
height='120'></a><input type='image' src='cid:Orange'/ name='image'
width='120' height='120'><input type='image' src='cid:Mad'/ name='image'
width='120' height='120'>";
where the cid:path4 is i want the url och what ever so that i linkes me
back to my project.

how to add ngx_http_mp4_module to a heroku app?

how to add ngx_http_mp4_module to a heroku app?

I need to add the following module to my app. ngx_http_mp4_module This is
in order to pseudo-stream flash videos with mediaelement.
I am not sure how to proceed with this. Any guidance would be great.

Tuesday, 17 September 2013

Validate user input for file_get_contents PHP

Validate user input for file_get_contents PHP

In my php file I use a $_GET parameter to open a file on my server, like so:
$filename = $_GET["filename"];
$content = file_get_contents("/path_to_files/".$filename);
My question is, how do I make this more secure so the user cannot access
files in parent folders on the server? Is this something I need to do on
the server such as permissions and/or configurations? Or should $filename
be validated in my php file? Thanks in advance!

Submitting a form with ajax after jQuery validation is successfull

Submitting a form with ajax after jQuery validation is successfull

Ok so I have a form that I am validating with jQuery Validation and I am
trying to now submit it with AJAX. With the code below, once the form is
valid and you click on submit the page reloads and the inputs are placed
in the url address bar (i.e. method="get")
In the ajax method I have that set to POST but it doesn't appear to be
using the ajax call.
What did I do wrong?
$().ready(function() {
var $form = $(this);
//validate the inquiry form on keyup and submit
$("#inquiryForm").validate({
showErrors: function(errorMap, errorList)
{
for (var error in errorMap)
{
$.growl.error({ message: errorMap[error] });
}
},
onkeyup: false,
rules: {
fullName: {
required: true
},
email: {
required: true,
email: true
},
inquiry: {
required: true,
minlength: 5,
maxlength: 500
}
},
messages: {
fullName: "Your name is required",
email: "A valid email address is required",
inquiry: "Your inquiry is required and must have
between 5-500 characters"
},
submitHandler: function(form) {
$.ajax({
url: form_submit/inquiry_form/inquiry_form.php,
type: "POST",
data: $(form).serialize(),
success: function(response) {
$('#inquiryFormHolder').html("Your form was
submitted!");
}
});
return false;
}
});
});

implementing push_back on dynamically allocated memory for an array gives MEMORY LEAK

implementing push_back on dynamically allocated memory for an array gives
MEMORY LEAK

Trying to dynamically implement an array in C++ with the following function.
I am not sure if the newArray needs to be deleted but right now it gives a
memleak.
void DynamicArray::push_back(Element e)
{
if (arraySize == arrayCapacity) // Resizing is necessary
{
if (arrayCapacity == 0)
{
arrayCapacity += 2;
}
else
{
arrayCapacity *= 2;
}
Element* newArray = new Element[arrayCapacity*2]; // Make a
new array
for (int i = 0; i < arraySize; i++)
{
newArray[i] = dynamicArray[i]; // Copy over old data
}
// Update private variables
delete [] dynamicArray; // Remove the old array (prevent
memory leak)
dynamicArray = newArray;
//newArray = nullptr;
//delete [] newArray;
}
seems to give a memory leak

select-all checkbox in a jquery data table with column filter

select-all checkbox in a jquery data table with column filter

Does anyone know how to add a checkbox in the column-filter plugin header
of a jquery datatable? and when I check the checkbox, to trigger a
callback (where I will 'check' all the checkboxes in the table or
'uncheck', if case)?
And no, I am not talking about this:
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/checkbox.html.
I just need a plain old simple checkbox, not that rich-checkboxed
dropdown. Something like on yahoo-mail - if you want an example.
In case it matters: + jquery-version: 1.8.3 + jquery.dataTables version:
1.9.4 + jquery.dataTables.columnFilter: 1.4.5

how to read value from a session object

how to read value from a session object

Using sql server stored procedure in Linq I m storing a list of questions
in a session object as below.
DataClassesDataContext myContext = new DataClassesDataContext();
var QuestionList = myContext.sp_GetAllQuestions().ToList();
Session["QuestionsList"] = QuestionList;
How can I read or cast the value from this session object like
var QuestionList= Session["QuestionsList"]
Thanks

Avoiding SingleOrDefault null reference exception

Avoiding SingleOrDefault null reference exception

I'm adding parameters to insert information into a database and ran into a
a potential null reference exception. By using the SingleOrDefault LINQ
expression, I thought if an instance had no Tag called "Name" the Tag
would default to a null value. This is true as long as the instance has
some sort of Tag. If the instance has no tags at all, a null reference
exception occurs. It's a rare occurrence, but I still need a better way to
handle it. Is there a better way to solve this than catching the
exception?
cmd.Parameters.AddWithValue("@Name", runningInstance.Tag.SingleOrDefault(t
=> t.Key == "Name").Value);

How to accelarate insert into database in java?

How to accelarate insert into database in java?

I need insert many rows from many files like:
Identifier NumberValue
For each row I am looing if already exists in database row with
Identifier, if exists I will take its NumberValue and add NumberValue from
arriving row and update database. I have found that lookup in database for
each row (few millions of records total) takes many time. Does it make
sense create map and look before inserting in database in this map?
Thanks.

Sunday, 15 September 2013

Arithmetic operators in Java

Arithmetic operators in Java

I'm wondering why this code is legal and produces the output of 1
int i = (byte) + (char) - (int) + (long) - 1;
System.out.println(i);

Visual C++.NET Download

Visual C++.NET Download

I started an online course recently for game development, and for the
programming section of the course, it asks to use Vicual C++ .Net
compiler, but any time I try to search for the download I get the wrong
links. What am I doing wrong? Can anyone please help?

How to disable UserProfile table access with ASP.NET MVC4 custom membership

How to disable UserProfile table access with ASP.NET MVC4 custom membership

I am trying to use ASP.NET MVC4, while keeping the user data in NoSQL data
store.
I am implementing my own membership class, supporting both OAuth and forms
authentication, inherited from ExtendedMembershipProvider.
At some point, I noticed that the local data store 'UserProfile' table is
being filled out with OAuth users. Seems like the default generated code
in AccountController::ExternalLoginConfirmation is manipulating that table
directly.
I found an article on implementing a custom Profile Provider.
Yet this seems a huge overkill to my needs, since I can manage user
profile in the application.
Is there a clean way to disable to "Profile" feature? Is it legitimate to
edit the controller code, or it is rather hiding the real problem? If I
must have the "ProfileProvider" on my own, what is the mininal set of
methods I can implement to get it "happy"?
Thanks a lot.

No Database Selected JPA Persistence

No Database Selected JPA Persistence

I have connections to my database running. I can execute the following
with no issue:
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/people",
"root", "r00t");
PreparedStatement statement = (PreparedStatement)
conn.prepareStatement("select * from users");
ResultSet result = statement.executeQuery();
However, after setting up JPA and a persistant class, I always get a "No
Database Selected" error. It doesn't seem like I need to adjust my
database config (MySQL connected to Glassfish 3.1) otherwise the above
code wouldn't work.
The call being made:
SELECT USERNAME, FIRSTNAME, LASTNAME, PASSWORD, PERMISSION FROM users
I have tried this call directly and it doesnt work.
This one does work:
SELECT USERNAME, FIRSTNAME, LASTNAME, PASSWORD, PERMISSION FROM people.users
I have been playing round and cant seem to add the database name anywhere
("people"). Here is what I have so far:
Using EclipseLink 2.0.x
JPA implimentation: Disable Library Configuration
Connection: Local MySQL (I have my database successfully connected)
Schema: people
From my servlet:
package com.lowe.samples;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mysql.jdbc.PreparedStatement;
@WebServlet("/TestServlet")
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@PersistenceContext
private EntityManager em;
public TestServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<h1>DataBase Test:<h1>");
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/people",
"root", "r00t");
PreparedStatement statement = (PreparedStatement)
conn.prepareStatement("select * from users");
ResultSet result = statement.executeQuery();
// prep the table
out.print("<table border=\"5\">");
out.print("<tr>");
out.print("<td>UserName</td>");
out.print("<td>FirstName</td>");
out.print("<td>LastName</td>");
out.print("<td>Password</td>");
out.print("<td>Permission</td>");
out.print("</tr>");
while(result.next()) {
out.print("<tr>");
out.print("<td>" + result.getString(1) + "</td>");
out.print("<td>" + result.getString(2) + "</td>");
out.print("<td>" + result.getString(3) + "</td>");
out.print("<td>" + result.getString(4) + "</td>");
out.print("<td>" + result.getString(5) + "</td>");
out.print("</tr>");
}
out.print("</table>");
User u =
(User)this.em.createNamedQuery("User.findAll").getResultList();
out.print("User Name: " + u.getFirstName());
} catch (ClassNotFoundException e) {
out.print("<h4>" + e.getMessage() + "</h4>");
e.printStackTrace();
} catch (SQLException e) {
out.print("<h4>" + e.getMessage() + "</h4>");
e.printStackTrace();
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
}
}
My persistance class:
package com.lowe.samples;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the users database table.
*/
@Entity
@Table(name="users")
@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String userName;
private String firstName;
private String permission;
private String lastName;
private String password;
public User() {
}
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getPermission() {
return this.permission;
}
public void setPermission(String permission) {
this.permission = permission;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
}
the persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="MyFriends">
<jta-data-source>jdbc/MySQLDataSource</jta-data-source>
<class>com.lowe.samples.User</class>
</persistence-unit>
</persistence>

Drawing a complex printable table in qt and QSqlQueryModel/QSqlTableModel

Drawing a complex printable table in qt and QSqlQueryModel/QSqlTableModel

How can i draw table using tableView and QSqlQueryModel or QSqlTableModel
like http://jsbin.com/uzOtiw/1 . I don't get any idea for this.
Easy to understand Example code will be helpful.

CSS Responsive Desgn Footer taking whole space when screen size goes below 1180 px

CSS Responsive Desgn Footer taking whole space when screen size goes below
1180 px

As soon as I am reducing screen size to below 1180 px width, strange issue
is occurring and right after header, thick black footer line(As seen in
inspect element) is appearing just above slideshow. When I am looking at
inspect element, header and other body element is showing height of "0".
Can any one please guide me what is messed up here. Everything is fine
when screen size is more than 1180 px
here is the site where i am getting these issue: http://goo.gl/8c1gW2

how to wrap a web page to fit any screen device

how to wrap a web page to fit any screen device

I have heard alot of my friends talk about using wrappers css to make the
size of a page fits any device.
what is the best way to do it? How do you do it?
Thanks

Saturday, 14 September 2013

Status net, urllib.error.HTTPError: HTTP Error 401: Unauthorized

Status net, urllib.error.HTTPError: HTTP Error 401: Unauthorized

This is my code :
#!/usr/bin/python3
import urllib.request
import urllib.parse
def send_to_statusnet():
msg = ":)"
password_manager = urllib.request.HTTPPasswordMgr()
password_manager.add_password("T2S",
"http://quitter.se/api/", "USER", "PASS")
http_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
page_opener = urllib.request.build_opener(http_handler)
urllib.request.install_opener(page_opener)
params = urllib.parse.urlencode( {'status': msg} )
params = params.encode('utf-8')
resp =
urllib.request.urlopen("http://quitter.se/api/statuses/update.json",
params)
resp.read()
send_to_statusnet()
When I execute this code, I get an error:
File "/usr/lib64/python3.3/urllib/request.py", line 595, in
http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized
What maybe wrong with my code?

Access Salesforce data using python

Access Salesforce data using python

Whats the most simple way to access SF data using python?
I need it for read only purposes.
I have tried using BeatBox but it seems to be not compatible with 3.3.

How do I echo last input?

How do I echo last input?

I have connected database to my site.
I have this code:
<form action="insert.php" method="post">
<label for="ime">Ime:</label> <input type="text" name="ime">
<label for="priimek">Priimek:</label> <input type="text" name="priimek">
<input type="submit">
</form>
which import data to database. How do I now echo this input? I want url to
be like /?id=434412
now I have just this code:
$result = mysqli_query($con,"SELECT * FROM person");
while($row = mysqli_fetch_array($result))
{
echo $row['ime'] . " " . $row['priimek'];
echo "<br>";
}

ArgumentException when adding UserControl to StackPanel

ArgumentException when adding UserControl to StackPanel

when a program is trying to add WordBlock (which is my class extending
UserControl) to StackPanel's content in DoSend method, it sometimes
(actually quite often, especially when query returns more than one result)
throws an ArgumentException, it surely has something to do with Threading
(SearchThreadEngine is a method running in in second thread), but I am
weak in the topic, and don't know why it is happenig. So, I will gladly
accept any help. Here's a stack trace:
{System.ArgumentException: Value does not fall within the expected range.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at
MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1
collection, CValue value)
at
MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1
collection, DependencyObject value)
at
System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject
value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(T value)
at Dictionary.MainPage.DoSend(IQueryable`1 words, WordContext context)}
System.Exception {System.ArgumentException}
public void DoSend(IQueryable<Word> words, WordContext context)
{
Result.Children.Clear();
using (context)
{
foreach (Word word in words)
{
Result.Children.Add(new WordBlock(word));
}
waitHandle.Set();
}
}
public void SearchThreadEngine()
{
while (!abort)
{
if (ToSearch != "")
{
string toSearch = ToSearch;
Thread.Sleep(200);
if (toSearch != ToSearch)
continue;
WordContext wc = new WordContext(WordContext.connectionString);
ToSearch = "";
IQueryable<Word> result = (from w in wc.Words where
w.Foreign.Equals(toSearch) || w.Foreign.StartsWith(toSearch+"
") select w);
if(result.Count() == 0)
result = (from w in wc.Words where w.Foreign.Equals("to
"+toSearch) || w.Foreign.StartsWith("to "+toSearch + " ")
select w);
if (result.Count() != 0)
{
Result.Dispatcher.BeginInvoke(new SendResult(DoSend), new
Object[] { result, wc });
waitHandle.WaitOne();
}
}
}
abort = false;
}

Partial call back from Ajax Extender Calender date changes

Partial call back from Ajax Extender Calender date changes

I am using the ajaxToolkit:CalendarExtender control. I want to call a
server method after the date has changed. I am currently using:
OnClientDateSelectionChanged="function
ddd(){__doPostBack('DateTextBox','') ;}"
This will do a partial post back in IE but in Chrome it will do a full
post back. I have thought of calling a jquery method for the
OnClientDateSelectionChanged event. I have failed on an .Ajax call but on
a Post back call it does a partial callback. But, i do not get a chance to
select a date. Using this jquery bypasses the chance to select a date. Any
advice would be great.
thanks

How to display components at defined position in JPanel?

How to display components at defined position in JPanel?

I need to display components at specific location. I'm trying to display
JLabel like,
label1:
label2:
The code below however, displays them like,
label1 : label2:



JFrame myFrame = new JFrame("My Frame");
Container container = myFrame.getContentPane();
JPanel jPanel=new JPanel(new FlowLayout(FlowLayout.LEFT));
//jPanel.setLayout(null);
JLabel jLabel1=new JLabel("Label 1 : ");
JLabel jLabel2=new JLabel("Label 2 : ");
jLabel1.setLocation(10, 50);
jLabel2.setLocation(10, 80);
jPanel.add(jLabel1);
jPanel.add(jLabel2);
myFrame.setVisible(true);
myFrame.setResizable(false);
container.add(jPanel);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.pack();
If the jPanel.setLayout(null); method is called then, it displays nothing
on the JFrame.
How to display components at a given location in JPanel?

UISearchDisplayController in DetailView only displays results once

UISearchDisplayController in DetailView only displays results once

I implemented a UISearchDisplayController on both sides of a
MasterViewController. In the Detail view, it works fine with the first
item selected from the MasterView.
However, if I choose another Detail item, the search will not display any
object even though NSLog tells me it found all of the expected cells:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *feedTableIdentifier = @"unread";
Post *thepost=nil;
if (tableView ==
self.searchDisplayController.searchResultsTableView) {
NSLog(@"in a search");
thepost = [self.filteredFeedArray objectAtIndex:indexPath.row];
} else {
NSLog(@"NOT in a search");
thepost = [self.fetchedResultsController
objectAtIndexPath:indexPath];
}
NSDate *tmpDate=[NSDate date];
if (thepost.read) {
tmpDate=thepost.read;
feedTableIdentifier = @"read";
} else if (thepost.date) {
tmpDate=thepost.date;
feedTableIdentifier = @"unread";
}
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:feedTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:feedTableIdentifier];
}
((UILabel *)[cell viewWithTag:1]).text = thepost.title;
NSDateFormatter *df=[[NSDateFormatter alloc] init];
df.dateFormat = @"EEEE, MMMM d, YYYY";
((UILabel *)[cell viewWithTag:2]).text = [df stringFromDate:tmpDate];
((UILabel *)[cell viewWithTag:3]).text = [self
flattenHTML:thepost.excerpt];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
if (tableView ==
self.searchDisplayController.searchResultsTableView) {
NSLog(@"in a search: %d", [_filteredFeedArray count]);
return [_filteredFeedArray count];
} else {
NSLog(@"NOT in a search: %d", [[[_fetchedResultsController
sections] objectAtIndex:section] numberOfObjects]);
return [[[_fetchedResultsController sections]
objectAtIndex:section] numberOfObjects];
}
}
Both detail and searchresult Table view have samely named Prototype cells.
Can someone tell me what I am doing wrong here and how I could properly
reset my UISearchViewController whenever switching Detail items?

Crontab Python Script Execution (Can't find settings config file)

Crontab Python Script Execution (Can't find settings config file)

My Crontab -l
# m h dom mon dow command
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
00 8,20 * * * python /home/tomi/amaer/controller.py >>/tmp/out.txt 2>&1
My controller.py has config file settings.cfg also it uses other script in
the folder it's located (I chmoded only controller.py)
The error
1;31mIOError^[[0m: [Errno 2] No such file or directory: 'settings.cfg'
I have no idea how to fix this?

Friday, 13 September 2013

how to add button for dynamic form creation and then save to database?

how to add button for dynamic form creation and then save to database?

i make a form of sections i want to add a button on form when i click
button the complete form build again and then we add values to store
database,i add more then 4 forms through submit button how i do this?
here is my form:
{% extends '::base.html.twig' %}
{% block body -%}
<title>{% block title %}Proposals>Create Sections{% endblock %}</title>
{% block stylesheets %}
<link href="{{ asset('styles/bootstrap1.css') }}" rel="stylesheet" />
{% endblock %}
<div id="fuelux-wizard" class="wizard row">
<ul class="wizard-steps">
<li data-target="#step1">
<span class="step">1</span>
<span class="title">Create <br> Proposals</span>
</li>
<li data-target="#step2" class="active">
<span class="step">2</span>
<span class="title">Sections</span>
</li>
<li data-target="#step3">
<span class="step">3</span>
<span class="title">Proposal <br> Fees</span>
</li>
</ul>
</div>
<h3>Sections</h3>
<form action="{{ path('sections_create') }}" method="post" {{
form_enctype(form) }}>
{{ form_widget(form) }}
<p>
<button id="edit" type="button" class="btn btn-primary"><i
class="icon-chevron-left"></i>Previous</button>
<button type="submit" class="btn btn-success"> Next <i
class="icon-chevron-right"></i></button>
</p>
</form>
<div id="result"></div>
<ul class="record_actions">
<li>
<a href="{{ path('sections') }}">
Back to the list
</a>
</li>
</ul>
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/jquery-1.10.2.js') }}"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("form").submit(function(e) {
e.preventDefault();
var url = $(this).attr('action');
var data = $(this).serialize();
$.ajax({
type: "POST",
url: url,
data: data,
}).done(function( result ) {
if(result.success) {
$('#result').css({'color':'black','background-color':'#8F8','display':'Block','width':'200px'});
$('#result').html('Sections Record Inserted');
setTimeout(function(){
$('#result').hide();
},3000);
window.location.href = "{{ path('propsalfees_new') }}";
}
});
this.reset();
});
$("#edit").click(function(){
window.location.href= "{{ path('proposals_edit', {'id':
proposalid }) }}";
});
});
</script>
{% endblock %}
and here is my controller to save data:
<?php
namespace Proposals\ProposalsBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Proposals\ProposalsBundle\Entity\Proposals;
use Proposals\ProposalsBundle\Form\ProposalsType;
use \DateTime;
/**
* Proposals controller.
*
*/
class ProposalsController extends Controller
{
/**
* Lists all Proposals entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities =
$em->getRepository('ProposalsProposalsBundle:Proposals')->findAll();
return
$this->render('ProposalsProposalsBundle:Proposals:index.html.twig',
array(
'entities' => $entities,
));
}
/**
* Creates a new Proposals entity.
*
*/
public function createAction(Request $request)
{
$user = $this->get('security.context')->getToken()->getUser();
$userId = $user->getId();
$entity = new Proposals();
$form = $this->createForm(new ProposalsType(), $entity);
$form->bind($request);
$postData =
$request->request->get('proposals_proposalsbundle_proposalstype');
$name_value = $postData['firstname'];
$entity->setClientID($name_value);
$entity->setCreatedBy($userId);
$entity->setUpdatedBy($userId);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$date=date('Y-m-d H:i:s');
$_SESSION['id'] =$entity->getId();
if($request->isXmlHttpRequest()) {
$response = new Response();
$output = array('success' => true, 'description' =>
$entity->getdescription(), 'id' => $entity->getId(),
'proposalname' => $entity->getproposalname(), 'templateid' =>
$entity->gettemplateid(), 'clientid' => $entity->getClientID(),
'status' => $entity->getstatus(), 'createdby'
=>$entity->getCreatedBy(), 'updatedby' =>
$entity->getUpdatedBy(), 'createddatetime' => $date,
'updateddatetime' => $date);
$response->headers->set('Content-Type', 'application/json');
$response->setContent(json_encode($output));
return $response;
}
return $this->redirect($this->generateUrl('proposals_show',
array('id' => $entity->getId())));
}
return
$this->render('ProposalsProposalsBundle:Proposals:new.html.twig',
array(
'entity' => $entity,
'form' => $form->createView(),
));
}

Need help adding number to dim's in my loop sequence? vb.net

Need help adding number to dim's in my loop sequence? vb.net

Here's basically what I have:
'P1 Progress bar updater
checkprogresstime_p1 = (time_total.Text - time_p1_hour.Value)
If checkprogresstime_p1 >= 60 Then
checkprogresstime_p1 = 60
time_p1_progress.ForeColor = Color.LimeGreen
ElseIf checkprogresstime_p1 <= 0 Then
checkprogresstime_p1 = 1
End If
If time_p1_progress.Value < 60 Then
time_p1_progress.ForeColor = Color.Red
End If
time_p1_progress.Value = checkprogresstime_p1
Here's basically what I need:
Dim cnt As Integer = 1
Do
'P1 Progress bar updater
checkprogresstime_p(cnt) = (time_total.Text - time_p(cnt)_hour.Value)
If checkprogresstime_p(cnt) >= 60 Then
checkprogresstime_p(cnt) = 60
time_p(cnt)_progress.ForeColor = Color.LimeGreen
ElseIf checkprogresstime_p(cnt) <= 0 Then
checkprogresstime_p(cnt) = 1
End If
If time_p(cnt)_progress.Value < 60 Then
time_p(cnt)_progress.ForeColor = Color.Red
End If
time_p(cnt)_progress.Value = checkprogresstime_p(cnt)
Loop While cnt <= 25
Accept I have no idea how to do it... I need it to loop and add +1, 25
times. I basically have it written out 25 times at the moment...

How to draw image on the right side of the UITableView cell on iOS 7?

How to draw image on the right side of the UITableView cell on iOS 7?

How to draw image on the right side of the UITableView cell on iOS 7?

table.contentInset = UIEdgeInsetsZero; doesn't help.

How do you program time?

How do you program time?

This might sound like a weird question, but how can you program time
without using the API of a programming language? Time is such an abstract
concept, how can you write a program without using the predefined function
for time.
I was thinking it would have to be calculated by a count of processor
computations, but if every computer has a different speed performance how
would you write code to iterate time.
Assuming the language the program is written in doesn't matter, how would
you do this?

Python socket not sending host name

Python socket not sending host name

I am using an asyncore.dispatcher client on python to connect to a server
developed in C running on a PC. Here's the code snippet on the client that
connects to the server:
class DETClient(asyncore.dispatcher):
def __init__(self, host, port):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect((self.host,self.port))
On the server side, my C code is looking for two parameters, TCPPeerName
and TCPPeerAddr.
It seems that the python code is not passing the hostname at all, because
my server gets a NULL for PeerName.
Do I have to do anything to specifically make the asyncore client to send
the PeerName when establishing a connection?

Strange JavaScript collapse behaviour in VS2012

Strange JavaScript collapse behaviour in VS2012

Visual Studio 2012 offers me the possibility to collapse this function
(see the little "-" icon on the left).

Sometimes he arbitrarely decide I can't do that.

Can someone explain why and how to fix it? I want to collapse every
function in my code: can I do this? How?
It looks like placing $.get, $('selector') or $.each calls in my code is
causing the issue but, since it mostly looks like a random behaviour, I
can't tell for sure.
Here's some random piece of code which is causing the issue:
function ComputeHigherZIndex() {
var highest = null;
$('#@(mdi.ContainerDivId)').find('.dynawindow').each(function () {
var current = $(this).css("z-index");
if (highest == null || highest < current) {
highest = current;
}
});
return highest;
}

Thursday, 12 September 2013

Issue with # in URL with a Wordpress theme?

Issue with # in URL with a Wordpress theme?

I am having a severe problem and have no clue about what is going on... I
will specify the general issue which is causing multiple issues on this
Wordpress powered portal.
Steps to reproduce:
Visit the URL: http://gamersgeographic.com/en/ (or any post on this site)
Append #abc or #anything to the URL
The URL tries to resolve for a second and magically deletes the "#" and
instead changes to /abc or /anything , which of course does not exist and
gives a 404 page not found.
Even if the local anchor with #abc exists, behaviour is the same.
Now, consider the case below:
Visit http://gamersgeographic.com/monster-hunter-diary-1/
Comment link appends a #comments or #respond depending on whether a
comment is there or not.
Both the anchors exist on the single post page
Still it redirects after finding them, to /comments and gives 404
Direct URL with #comments works e.g.
http://gamersgeographic.com/monster-hunter-diary-1/#comments works but
when I change any base URL to #comments, it redirects to 404...
I have tried several combinations with Permalinks, so it is not a problem
with that. I even wrote my own Comment link generator in php with just a
plain href="#comments"
but still no luck...
If you need any further information about any function's code in
theloop.php or anything please let me know.
Thanks in advance ! Regards

Event Driven programming - non linear code

Event Driven programming - non linear code

I have the following code (logic) in PHP:
$fp = fopen('fp.txt', 'w');
if ($msg == 'say') {
fwrite($fp, 'Hello world!');
}
$msg = 'done';
To convert this into asynchronous event driven code, the author of node
for PHP developers suggests I refactor it like this.
$fp = fopen('fp.txt', 'w');
if ($msg == 'say') {
fwrite($fp, 'Hello world!');
$msg = 'done';
} else {
$msg = 'done';
}
And then,
fs.open('fp.txt', 'w', 0666, function(error, fp) {
if (msg == 'say') {
fs.write(fp, 'Hello world!', null, 'utf-8', function() {
msg = 'done';
});
} else {
msg = 'done';
}
});
You'd clearly see, there is code duplication. 'msg = "done"' is repeated.
Can this be avoided? Code duplication is bad practice right?
Is event driven programming always like this?

Putting Results of for loop into a data frame in R

Putting Results of for loop into a data frame in R

I have a function that will return a numeric class object, here is a
simplified version:
count.matches <- function(x) {
ifelse(!is.na(a[,x] & a[,2]),1,0)
}
it just produces an object of 0s and 1s. For example
count.matches(4)
[1] 0 0 0 0 1 1 0
I just want to do a simple for loop of this function and store the results
in a data frame, i.e. each time the function loops through create a
column, however I am having trouble.
p <- data.frame()
my.matches <- for(i in 2:100) {
p[i,] <- count.matches(i)
}
This produces nothing. Sorry if this is a really stupid question, but I
have tried a bunch of things and nothing seems to work. If you need any
more information, please let me know and I will provide it.

Comparison operators that I haven't seen before

Comparison operators that I haven't seen before

I am trying to decipher the following line of JavaScript code:
delay_start = (typeof delay_start_qs !== "undefined") ? !(delay_start_qs
=== "false") : true;
Specifically the ? followed by the !. Is that a comparison operator?

Extracting TTL value for an A record

Extracting TTL value for an A record

I am doing some dns stuff and I require to do an A record lookup for an
SRV and extract ttl and ip address from it:
I was able to extract ip using the following code, but how do I extract TTL?
l = res_query(argv[1], ns_c_any, ns_t_a, nsbuf, sizeof(nsbuf));
if (l < 0)
{
perror(argv[1]);
}
ns_initparse(nsbuf, l, &msg);
l = ns_msg_count(msg, ns_s_an);
for (i = 0; i < l; i++)
{
ns_parserr(&msg, ns_s_an, 0, &rr);
ns_sprintrr(&msg, &rr, NULL, NULL, dispbuf, sizeof(dispbuf));
printf("\t%s \n", dispbuf);
inet_ntop(AF_INET, ns_rr_rdata(rr), debuf, sizeof(debuf));
printf("\t%s \n", debuf);
}
Output:
./a.out sip-anycast-1.voice.google.com
sip-anycast-1.voice.google.com. 21h55m46s IN A 216.239.32.1
216.239.32.1

How do I perform this regex in order to extract the value of the variable

How do I perform this regex in order to extract the value of the variable

You can test everything out here:
I would like to extract the value of individual variables paying attention
to the different ways they have been defined. For example, for dtime we
want to extract 0.004. It also has to be able to interpret exponential
numbers, like for example for variable vis it should extract 10e-6.
The problem is that each variable has its own number of white spaces
between the variable name and the equal sign (i dont have control on how
they have been coded)
Text to test:
dtime = 0.004D0
case = 0
newrun = 1
periodic = 0
iscalar = 1
ieddy = 1
mg_level = 5
nstep = 20000
vis = 10e-6
ak = 10e-6
g = 9.81D0
To extract dtime's value this REGEX works:
(?<=dtime =\s)[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?
To extract dtime's value this REGEX works:
(?<=vis =\s)[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?
The problem is that I need to know the exact number of spaces between the
variable name and the equal sign. I tried using \s+ but it does not work,
why?
(?<=dtime\s+=\s)[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

How to debug selenium webdriver through eclipse using maven and junit

How to debug selenium webdriver through eclipse using maven and junit

I have a bunch of selenium webdriver tests in eclipse. How can I run them
in debug mode through eclipse so I can properly debug them instead of just
outputting stuff to the log?
When I run the tests I use the following command line: mvn -Dtest=testName
test -Dconf=MyPropertis.properties
but I don't know how to do this through eclipse.

iOS 7: Misplaced View Frame for "Label - Label" will be different at run time

iOS 7: Misplaced View Frame for "Label - Label" will be different at run time

I just finished an app on iOS 6 and bought a developer account a week ago
so haven't had much time playing with the iOS 7 SDK. Just downloaded the
Golden Master version and trying to upgrade my app to be compatible with
iOS 7.
I received a lot of warnings saying "Misplaced View Frame for "Label -
Label" will be different at run time." and i am unable to run the program.
The project contains tableview and its is parsing and displaying xml feed
from an rss.
Anyone knows how to fix this issue? Thanks a lot in advance!

Wednesday, 11 September 2013

How do I center a container in my HTML/CSS?

How do I center a container in my HTML/CSS?

I have developed a website as part of my assignment. As I am new to
html/css I could not figure some problems out of my code. The assignment
specifications says that the screen size should be in certain size so that
majority browsers can open it and the user should not experience any
scroll activties. So I have used div to divide the whole page to fit the
size. However, the container(In my code named as 'box') is set to the left
side of the brower body and I have to set it centred, but I do not know
how to fix it. Can anyone give me some help, please and thank you.
My HTML:
<!DOCTYPE html>
<html>
<head>
<title>habibe Naby</title>
<link rel="stylesheet" href="Websystems.css">
</head>
<body>
<div id="box">
<div id="header">
<img id="image" src="spring.jpeg">
<p id="text">Welcome to My Homepage</p>
</div>
<div id="under">
<div id="upper">
<div id="leftbar">
<div class="list">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a
href="past.html">Past</a></li>
<li><a
href="future.html">Future</a></li>
<li><a
href="comments.html">Comments</a>
</li>
</ul>
</div>
</div>
<div id="rightbar">
<div id="title">Habibe Naby</div>
<p>this is my name and
I<spanclass="special">Danny</span>.Ihave a .. </p>
</div>
</div>
<div id="footer">copyrights&copy</div>
</div>
My CSS:
body
{
height: 750px;
margin: 2px;
padding: 2px;
width: 1000px;
}
#box
{
width: 1000px;
margin-left: auto;
margin-right: auto;
height:100%;
border:1px solid #8D8D8D;
}
#header
{
height: 150px;
width: 100%;
position: relative;
}
#image
{
height: 150px;
width: 1000px;
}
#text
{
z-index: 100;
position: absolute;
color: darkolivegreen;
font-style: italic;
font-size: 32px;
font-weight: bolder;
left: 300px;
top: 25px;
}
#leftbar
{
float: left;
width: 200px;
height: 560px;
margin: 0px;
padding: 0px;
background-color: azure;
}
.list
{
margin-top: 40px;
margin-left: auto;
text-decoration: underline;
color:blueviolet;
font-size: 20px;
}
.list ul
{
list-style: none;
}
#rightbar
{
float: right;
width: 800px;
height: 560px;
margin: 0px;
padding: 0px;
background: mintcream;
}
#title
{
margin-left: 80px;
margin-top: 30px;
font-size: 28px;
font-weight: normal;
font-style: italic;
color: blueviolet;
}
#footer
{
clear: both;
height: 40px;
text-align: center;
background-color: oliveDrab;
margin 0px;
padding: 0px;
color: white;
}
.special
{
font-size: 20px;
font-weight: bold;
font-family: "New Century Schoolbook", Times, sans-serif;
color: dodgerblue;
}
p, pre
{
padding: 10px 20px;
margin-left: 50px;
margin-right: 50px;
color: darkslateblue;
}

Embeded strings in .text assembly section

Embeded strings in .text assembly section

Is there a way to have strings in the .text section instead of .data
section of nasm like this MASM code?
From
http://forum.tuts4you.com/topic/19678-how-to-define-local-string-in-masm/
invoke lstrcpy, addr szTemp, "Hello World!"

Regular expression validation in javascript failing in IE8

Regular expression validation in javascript failing in IE8

trying to use this
(^AD\\[a-zA-Z]+$)|(^ad\\[a-zA-Z]+$)|(^Ad\\[a-zA-Z]+$)
or
^(AD|ad\Ad)\\([a-zA-Z]+$)
in an attempt to validate for strings like AD\loginid or ad\loginid or
Ad\loginid
above regex works fine on the regex testers online.. like
http://regexpal.com/ or
http://www.regular-expressions.info/javascriptexample.html
but when I incorporate it in the script validations it fails for the below
code...
var lanidRegex = new
RegExp("(^AD\\[a-zA-Z]+$)|(^ad\\[a-zA-Z]+$)|(^Ad\\[a-zA-Z]+$)");
alert(lanidRegex.test("AD\loginid"));
I have rewritten the regex differently multiple times but to no luck..

Switch statement inside a foreach loop - not getting expected results

Switch statement inside a foreach loop - not getting expected results

So I am trying to loop though items that are in a listbox in my
application. The list box will allow you to select multiple items to which
I have a method tied to each item in the listbox. I have a counter
variable incremented each time the loop works.When I use the foreach loop
with the switch statement below, it does the first item correct, but then
loops through the same item again. I know I am missing something as it is
supposed to go to the next item in the listbox and not the same item.
string reportname = lstbxReports.SelectedValue.ToString();
int i = 0;
foreach (var report in reportname)
{
switch (reportname)
{
case "Overview":
{
if (i < 1)
{
PrintOverview(filename);
}
else if (i >= 1)
{
PrintOverviewAppend(filename);
}
break;
}
case "Sources":
{
if (i < 1)
{
PrintSource(filename);
}
else if (i >= 1)
{
PrintSourceAppend(filename);
}
break;
}
}
i++
Any thoughts or suggestions on how I can get the foreach loop to go to the
next item in the selected listbox?
Also, this is just a snippet as I have about 11 case items to loop through.

Lua Serial Communication

Lua Serial Communication

In Lock On: Modern Air Combat game there is export.lua script that allows
you to export data from game. I have mannaged to export data to .txt file
so far.
My question is
Is it possible and how to send data over serial to my Arduino device?
Thank You in Advance.

HTML table with single cell at bottom

HTML table with single cell at bottom

I got a html table which looks basically like this
(http://jsfiddle.net/LMaQq/):
<table>
<thead>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
</tr>
</thead>
<tbody>
<tr>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td><input type="checkbox"></td>
</tr>
<tr>
<td>Content</td>
<td>Content</td>
<td>Content</td>
<td><input type="checkbox"></td>
</tr>
</tbody>
</table>
What I want to do now is to add a new table cell only under Col 4. Under
Col 1 to Col 3 there shouldn't be anything. So it should look like this:
http://pl.vc/4fg4v (Sorry, I can't upload the image directly here, because
10 reputation is needed for this)
The background for this is, that I want another checkbox under the
existing ones, which allows me to select/deselect all of them at the same
time. How can I achieve this?

Pythonic isinstance on floats and ints

Pythonic isinstance on floats and ints

Say you have a function:
def divide(a, b):
return a / b
This will obviously give a different result if a and b are float, int, or
a combination. If you only care about the situation when a and b are
floats, what is the best way to deal with this?
i)
def divide(a, b):
if not isinstance(a, float):
raise TypeError('a must be a float')
if not isinstance(b, float):
raise TypeError('b must be a float')
return a / b
ii)
def divide(a, b):
return float(a) / float(b)
iii) something else?
My preference is for ii), but a colleague argues that if you are using a
and b elsewhere, then i) is more likely to prevent bugs.
This is obviously a somewhat trivial example, but my colleague has much
more experience with C and I am struggling to explain why using isinstance
doesn't really fit with duck-typing and that having it permeate through in
our python code is not great.

Resizing a single subplot in matplotlib

Resizing a single subplot in matplotlib

I'm having trouble trying to resize one of my subplots in matplotlib.
Basically I have four plots and I would like the to be about 1.5 the size
of the others.
I'm also having trouble trying to gives a legend for the top subplot. I
would like it to specify each colour as 1, 2, 3, 4, or 5 (Please see
image).
This is my code for the plotting function
def plot_data(avg_rel_track, sd_rel_track_sum, sd_index, sd_grad):
fig, (ax0, ax1, ax2, ax3) = plt.subplots(nrows=4, figsize=(15,10))
fig.subplots_adjust(top=0.85)
ax0.plot(avg_rel_track_nan)
if len(sd_index)!=0:
if len(sd_index)>1:
for i in range(1, len(sd_index)):
if sd_grad[i]==1:
ax0.axvspan(sd_index[i-1],sd_index[i],
edgecolor='#FFCC66', facecolor='#FFCC66', alpha=1)
#The following plot has 5 plots within it.
ax0.set_title('Averaged Relative Track',fontsize=11)
ax0.set_ylim(auto=True)
ax1.plot(sd_rel_track_sum)
ax1.set_title('RT Standard Deviation',fontsize=11)
ax1.set_ylim([0,250])
ax2.plot(splitpre)
ax2.set_title('Track Split',fontsize=11)
ax3.plot(ts_sd)
ax3.set_title('Track Split Standard Dev',fontsize=11)
ax3.set_ylim([0,100])
fig.tight_layout()
plt.show()
I am struggling to find a way to resize without changing the whole way the
function is written. I can't seem to find the documentation for
'subplots'.
Also to my understanding you must add a 'label' to your plot in order to
create a legend. However, all the data to the top subplot is plotted at
the same time?

Tuesday, 10 September 2013

How can i play music in webview?

How can i play music in webview?

the code is this:
<audio id="audio" src="test.mp3" autoplay="autoplay">the browser can't
play</audio>
the audio is html5 tag and only support ogg mp3 and wvm but my file is amr
or other format. who can ask me pls?
and the code running in pad or phone. not in pc Can i use tag appoint
classid play it?

Bing/Google Maps API - How to disable parts of the map

Bing/Google Maps API - How to disable parts of the map

I am doing some research for what map to use for a coming project.
The main requirement is to be able to lock a map, and the ability to
disable parts of the map.
Think about a special purpose map for Europe. Then I would like to bring
in Bing or Google Maps, and disable and gray out the non-european
countries. A click on those grayed out areas should do nothing, for all of
the world.
I also want to disable the possibility to zoom, and move the map around
once a zoom level has been applied.
So, is it possible to disable large portions of the map? Is it possible to
add layers for the borders for each country, that is clickable?
Bing or Google Maps? More developer featured one? Bing looks so much nicer
with the birds eye, much easier to read out the map really.
Thanks!

RewriteRule with two parameters in reverse order

RewriteRule with two parameters in reverse order

I've got this rule
RewriteRule ^(english|hebrew|russian)/(.*).php $2.php?lang=$1 [L,QSA]But
for the URI
http://www.google.com/hebrew/volume.php?ss=1it gives me
http://www.google.com/hebrew.php?lang=volume&ss=1Which is somewhat
correct, but parameters switched. What I want to get is:
http://www.google.com/volume.php?lang=hebrew&ss=1How do I preserve
language, skip folder and see all the parameters preserved?

Free Video Player (need work in ie8)

Free Video Player (need work in ie8)

Anyone know a video player (like video.js) that work in ie8 ?
I did a search, however all I have analyzed do not work in IE8 or need
many things to shoot a video.
Sorry for bad english...

Align underline under the texts in a horizontal div

Align underline under the texts in a horizontal div

In this Question, I followed w3d user answer but didn't get divs under the
top divs.
CSS
div.demo {
display:table;
width:100%;
}
div.demo span {
display:table-cell;
text-align:center;
}
#under {
width:100px;
height:2px;
background-color:blue;
}
HTML
<div class="demo">
<span>Span 1</span>
<span>Span 2</span>
<span>Span 3</span>
</div>
<div class="demo">
<span><div id='under'></div></span>
<span><div id='under'></div></span>
<span><div id='under'></div></span>
</div>
JSFiddle

CSS file not working in asp.net

CSS file not working in asp.net

guys i have a css file "menu.css" i called it in the head of my master
page but it does not seem to work.
<link href="CSS/menu.css" rel="stylesheet" type="text/css" />
i tried many alternatives such as
<link id="Link1" href='<%= ResolveUrl("~/CSS/menu.css") %>'
rel="stylesheet" media="screen" type="text/css"/>
But all to no avail. However when i paste the content of the css in the
master page head there by eliminating the css file, it then works. I
really don't understand what the error is. All seem ok but it is not doing
as expecteed. Below is my Master page. Any help would be appreciated.
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Debt.master.cs" Inherits="Debt.Debt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link id="Link2" href='<%= ResolveUrl("~/CSS/menu.css") %>'
rel="stylesheet" media="screen" type="text/css"/>
<title>Members Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
* { margin:0;
padding:0;
}
body { background:#555 url(images/back.jpg); }
#menu { top:30px; }
#copyright {
margin:100px auto;
width:80%;
font:12px 'Trebuchet MS';
color:#bbb;
text-indent:20px;
padding:40px 0 0 0;
}
#copyright a { color:#bbb; }
#copyright a:hover { color:#fff; }
.style1
{
}
.ModalBackground
{
background-color:Gray;
filter: alpha(opacity=60);
opacity: 0.6;
z-index: 10000;
}
.ModalPopup
{
background-color:White;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:5px;
width: 350px;
height:210px;
}
</style>
<link id="Link1" href='<%= ResolveUrl("~/CSS/menu.css") %>'
rel="stylesheet" media="screen" type="text/css"/>
<link href="CSS/menu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/menu.js"></script>
</head>
<body runat="server">