CSS header with div to left which fills screen
Ok so I am trying to make a header div that is centered on the based that
the site
content div is 980px; width
But what I want is that if the screen is bigger on the left there is a Div
that is linked to the header that take the background color of the header
and pulls it to the left side of the users screen while keeping the header
in the center of the page.
my code
html,body{
margin:0;
padding:0;
}
#content,.content{
margin:0 auto;
width: 980 !important;
}
#header-nav{
width:100% !important;
height:60px !important;
padding:0;
margin:20px 0;
}
.nav-left{
height: 55px;
position: absolute;
top: 30px;
z-index: 6;
margin: 0;
padding: 0;
right: 60%;
width: 5000px;
background: #cb0f32;
border: none;
-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
filter: none;
}
.content{
position:absolute;
top:30px;
left:25%;
z-index: 7;
margin:0 auto;
width:980px !important;
background:#000;
}
HTML Code
<body>
<div id="header-nav">
<div class="nav-left">
</div>
<div id="content" class="content">
<div id="nav-bar">
<p>My Site Title</p>
</div>
</div>
</div>
I know this should be easy but I can't get it to work could anyone please
point me in the right direction
demo of code http://russellharrower.com/home?preview=1
Saturday, 31 August 2013
Read from word document line by line
Read from word document line by line
I'm trying to read a word document using C#. I am able to get all text but
I want to be able to read line by line and s*tore in a list and bind to a
gridview*. Currently my code returns a list of one item only with all text
(not line by line as desired). I'm using the Microsoft.Office.Interop.Word
library to read the file. Below is my code till now:
Application word = new Application();
Document doc = new Document();
object fileName = path;
// Define an object to pass to the API for missing parameters
object missing = System.Type.Missing;
doc = word.Documents.Open(ref fileName,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
String read = string.Empty;
List<string> data = new List<string>();
foreach (Range tmpRange in doc.StoryRanges)
{
//read += tmpRange.Text + "<br>";
data.Add(tmpRange.Text);
}
((_Document)doc).Close();
((_Application)word).Quit();
GridView1.DataSource = data;
GridView1.DataBind();
Any help would be highly appreciated. Thanks.
I'm trying to read a word document using C#. I am able to get all text but
I want to be able to read line by line and s*tore in a list and bind to a
gridview*. Currently my code returns a list of one item only with all text
(not line by line as desired). I'm using the Microsoft.Office.Interop.Word
library to read the file. Below is my code till now:
Application word = new Application();
Document doc = new Document();
object fileName = path;
// Define an object to pass to the API for missing parameters
object missing = System.Type.Missing;
doc = word.Documents.Open(ref fileName,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);
String read = string.Empty;
List<string> data = new List<string>();
foreach (Range tmpRange in doc.StoryRanges)
{
//read += tmpRange.Text + "<br>";
data.Add(tmpRange.Text);
}
((_Document)doc).Close();
((_Application)word).Quit();
GridView1.DataSource = data;
GridView1.DataBind();
Any help would be highly appreciated. Thanks.
Ruby directory alias get original path
Ruby directory alias get original path
I'm working with a directory that's an alias with Ruby on Mac. This means
that this is a folder that just points to another folder. How can I
determine what the original directory that this alias points to?
So for example, in one of my Jenkins job, there is an alias called
lastStable, which points to the latest stable build folder.
path = /Users/steve/.Jenkins/jobs/MyApp/lastStable
lastStable actually points to a folder called 2013-08-06_10_50_49.
How can I get this info dynamically in Ruby?
I'm working with a directory that's an alias with Ruby on Mac. This means
that this is a folder that just points to another folder. How can I
determine what the original directory that this alias points to?
So for example, in one of my Jenkins job, there is an alias called
lastStable, which points to the latest stable build folder.
path = /Users/steve/.Jenkins/jobs/MyApp/lastStable
lastStable actually points to a folder called 2013-08-06_10_50_49.
How can I get this info dynamically in Ruby?
Can't Figure out the Null Reference
Can't Figure out the Null Reference
Here is my code (places the form on top of ALL aplications:
Imports System.Runtime.InteropServices _ Private Shared Function
SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal
X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As
Integer, ByVal uFlags As Integer) As Boolean End Function
Private Const SWP_NOSIZE As Integer = &H1
Private Const SWP_NOMOVE As Integer = &H2
Private Shared ReadOnly HWND_TOPMOST As New IntPtr(-1)
Private Shared ReadOnly HWND_NOTOPMOST As New IntPtr(-2)
Public Function MakeTopMost()
If SetWindowPos(Me.Handle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE).Equals(True) Then
SetWindowPos(Me.Handle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE)
End If
End Function
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
MakeTopMost()
End Sub
VS 2010 says "Function... doesn't return a value on all code paths. A null
reference exception could occur at run time when the result is used.
I have been at this for hours but annot figgure it out. Does anyone know?
Here is my code (places the form on top of ALL aplications:
Imports System.Runtime.InteropServices _ Private Shared Function
SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal
X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As
Integer, ByVal uFlags As Integer) As Boolean End Function
Private Const SWP_NOSIZE As Integer = &H1
Private Const SWP_NOMOVE As Integer = &H2
Private Shared ReadOnly HWND_TOPMOST As New IntPtr(-1)
Private Shared ReadOnly HWND_NOTOPMOST As New IntPtr(-2)
Public Function MakeTopMost()
If SetWindowPos(Me.Handle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE).Equals(True) Then
SetWindowPos(Me.Handle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE)
End If
End Function
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
MakeTopMost()
End Sub
VS 2010 says "Function... doesn't return a value on all code paths. A null
reference exception could occur at run time when the result is used.
I have been at this for hours but annot figgure it out. Does anyone know?
Replacing different String literals with empty Strings using regex in java
Replacing different String literals with empty Strings using regex in java
Please let me know if there is any regex that can convert the following
input into the following output:
Input line (Single line)
System.out.println("Random\"String 1");System.out.println("Another Random
String");String x = "Random String once again";
Output line
System.out.println("");System.out.println("");String x = "";
Is this possible using regex?
I will be highly greatful if you can help me find such a regular
expression. Or please let me know whether this can be achieved using regex
or not.
My question is precise and has sufficient details, and I know this can be
solved using some java parser easily. But I have to use regular
expressions only. So please don't ask for any further details or suggest
alternate ways other than regex. Thank you for your understanding :)
About the Input line: multiple string literals on the same line. the
string literals can contain quote character also (following an escape
character, as in Random\"String1).
Please let me know if there is any regex that can convert the following
input into the following output:
Input line (Single line)
System.out.println("Random\"String 1");System.out.println("Another Random
String");String x = "Random String once again";
Output line
System.out.println("");System.out.println("");String x = "";
Is this possible using regex?
I will be highly greatful if you can help me find such a regular
expression. Or please let me know whether this can be achieved using regex
or not.
My question is precise and has sufficient details, and I know this can be
solved using some java parser easily. But I have to use regular
expressions only. So please don't ask for any further details or suggest
alternate ways other than regex. Thank you for your understanding :)
About the Input line: multiple string literals on the same line. the
string literals can contain quote character also (following an escape
character, as in Random\"String1).
what is posix compliance for filesystem?
what is posix compliance for filesystem?
Posix compliance is a standard that is been followed by many a companies.
I have few question around this area, 1. does all the file systems need to
be posix compliant? 2. are applications also required to be posix
compliant? 3. are there any non posix filesystems?
Posix compliance is a standard that is been followed by many a companies.
I have few question around this area, 1. does all the file systems need to
be posix compliant? 2. are applications also required to be posix
compliant? 3. are there any non posix filesystems?
Parsing a Zipped JSON file in PHP without Extracting
Parsing a Zipped JSON file in PHP without Extracting
With help from the guys on Stackoverflow I can now Parse JSON code from a
file and save a 'Value' into a database
However the real file I intend to read from is actually a massive 2GB
file. My web server will not hold this file. However it will hold a ZIPPED
version of it - ie 80MB.
I believe there is a way to PARSE JSON from a ZIPPED file without actually
having to save the 2GB version of the file on my web server only having to
save the ZIPPED 80MB version instead............Can anybody help?
I have found the below function which I believe will do this (I think) but
I don't know how to link it to my code
private function uncompressFile($srcName, $dstName) {
$sfp = gzopen($srcName, "rb");
$fp = fopen($dstName, "w");
while ($string = gzread($sfp, 4096)) {
fwrite($fp, $string, strlen($string));
}
gzclose($sfp);
fclose($fp);
}
My current PHP code is below and works. It reads a basic small file, JSON
decodes it (The JSON is in a series of separate lines hence the need for
FILE_IGNORE_NEW_LINES) and then takes a value and saves to MySQL database.
However I believe I need to somehow combine these two bits of code so I
can read a ZIPPED file without exceeding my 100MB storage on my webserver
$file="CIF_ALL_UPDATE_DAILY_toc-update-sun";
$trains = file($json_filename, FILE_IGNORE_NEW_LINES |
FILE_SKIP_EMPTY_LINES);
foreach ($trains as $train) {
$json=json_decode($train,true);
foreach ($json as $key => $value) {
$input=$value['main_train_uid'];
$q="INSERT INTO railstptest (main_train_uid) VALUES ('$input')";
$r=mysqli_query($mysql_link,$q);
}
}
}
if (is_null($json)) {
die("Json decoding failed with error: ". json_last_error());
}
mysqli_close($mysql_link);
Many Thanks
With help from the guys on Stackoverflow I can now Parse JSON code from a
file and save a 'Value' into a database
However the real file I intend to read from is actually a massive 2GB
file. My web server will not hold this file. However it will hold a ZIPPED
version of it - ie 80MB.
I believe there is a way to PARSE JSON from a ZIPPED file without actually
having to save the 2GB version of the file on my web server only having to
save the ZIPPED 80MB version instead............Can anybody help?
I have found the below function which I believe will do this (I think) but
I don't know how to link it to my code
private function uncompressFile($srcName, $dstName) {
$sfp = gzopen($srcName, "rb");
$fp = fopen($dstName, "w");
while ($string = gzread($sfp, 4096)) {
fwrite($fp, $string, strlen($string));
}
gzclose($sfp);
fclose($fp);
}
My current PHP code is below and works. It reads a basic small file, JSON
decodes it (The JSON is in a series of separate lines hence the need for
FILE_IGNORE_NEW_LINES) and then takes a value and saves to MySQL database.
However I believe I need to somehow combine these two bits of code so I
can read a ZIPPED file without exceeding my 100MB storage on my webserver
$file="CIF_ALL_UPDATE_DAILY_toc-update-sun";
$trains = file($json_filename, FILE_IGNORE_NEW_LINES |
FILE_SKIP_EMPTY_LINES);
foreach ($trains as $train) {
$json=json_decode($train,true);
foreach ($json as $key => $value) {
$input=$value['main_train_uid'];
$q="INSERT INTO railstptest (main_train_uid) VALUES ('$input')";
$r=mysqli_query($mysql_link,$q);
}
}
}
if (is_null($json)) {
die("Json decoding failed with error: ". json_last_error());
}
mysqli_close($mysql_link);
Many Thanks
.htaccess 403 redirects not working
.htaccess 403 redirects not working
I have this code in my .htaccess file:
Options All -Indexes
order deny,allow
deny from all
ErrorDocument 403 /www/landing.html
<Files landing.html>
allow from all
</Files>
<Files styles.css>
allow from all
</Files>
<Files prefixfree.min.js>
allow from all
</Files>
which is located on my server at /www. There is an index.html,
loading.html, and a .htaccess in this folder, then the css and js files
are in their respective subfolders. The site is hosted on Hostgator.
When I load up my site, I get this error:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an
ErrorDocument to handle the request.
So it's not finding the document. If I change my code to ErrorDocument 403
/loading.html then my site goes down entirely and the loading icon just
spins without loading anything. downforeveryoneorjustme.com also reports
that it is down. Is there something I'm doing wrong?
I have this code in my .htaccess file:
Options All -Indexes
order deny,allow
deny from all
ErrorDocument 403 /www/landing.html
<Files landing.html>
allow from all
</Files>
<Files styles.css>
allow from all
</Files>
<Files prefixfree.min.js>
allow from all
</Files>
which is located on my server at /www. There is an index.html,
loading.html, and a .htaccess in this folder, then the css and js files
are in their respective subfolders. The site is hosted on Hostgator.
When I load up my site, I get this error:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an
ErrorDocument to handle the request.
So it's not finding the document. If I change my code to ErrorDocument 403
/loading.html then my site goes down entirely and the loading icon just
spins without loading anything. downforeveryoneorjustme.com also reports
that it is down. Is there something I'm doing wrong?
Friday, 30 August 2013
ViewPager retaing old Fragments on screen rotation
ViewPager retaing old Fragments on screen rotation
I am using ViewPager and FragmentStatePagerAdapter to show fragment.
Initially there are 2 fragments added Fragment1 and Fragment2 and 3rd
fragment Fragment3 is added at 2nd position after recieiving response from
server. So after all pages are added this should be sequence of Fragments
in ViewPager --> Fragment1, Fragment3, Fragment2.
The Problem is after Fragment1 and Fragment3 are added and app is making
server call before adding 3rd Fragment at 2nd position if I do screen
rotation multiple time then after 3rd fragment is added it still shows old
copy of Fragment2 which was at 2nd position initially at 2nd position and
3rd position have new copy of Fragment2. So Fragment3 doest shows up in
ViewPager. Sequence after adding 3rd Fragment -- > Fragment1, old copy of
Fragment2, New Fragment2.
I am overriding onSaveInstanceState and calling super.onSaveInstanceState
in my Activity.
Also I have tried returning POSITION_NONE from getItemPosition. I read
somewhere that ViewPager save copies of fragment. Also through debugging I
checked that ViewPager contained 2 copies of Fragment2 when issue was
reproduced even though getItem of FragmentStatePagerAdapter returned
different Fragments for each position but still at 2nd position it was
showing old fragment. For testing purpose in getItem I returned Fragment1
for all positions so that all 3 pages should be same but even after that
in 2nd position it was showing old copy of Fragment2 when I reproduced
issue with steps mentioned above.
So how to clear ViewPager so that it does not save old fragments. How to
refresh ViewPager so that it does not retain old copy with fragments. I
think problem is with onSaveInstanceState but I need it. How can I exclude
ViewPager when views are saved in onSaveInstanceState. I have tried
mViewPager.setSaveEnabled(false) but it takes too much memory.
I am using ViewPager and FragmentStatePagerAdapter to show fragment.
Initially there are 2 fragments added Fragment1 and Fragment2 and 3rd
fragment Fragment3 is added at 2nd position after recieiving response from
server. So after all pages are added this should be sequence of Fragments
in ViewPager --> Fragment1, Fragment3, Fragment2.
The Problem is after Fragment1 and Fragment3 are added and app is making
server call before adding 3rd Fragment at 2nd position if I do screen
rotation multiple time then after 3rd fragment is added it still shows old
copy of Fragment2 which was at 2nd position initially at 2nd position and
3rd position have new copy of Fragment2. So Fragment3 doest shows up in
ViewPager. Sequence after adding 3rd Fragment -- > Fragment1, old copy of
Fragment2, New Fragment2.
I am overriding onSaveInstanceState and calling super.onSaveInstanceState
in my Activity.
Also I have tried returning POSITION_NONE from getItemPosition. I read
somewhere that ViewPager save copies of fragment. Also through debugging I
checked that ViewPager contained 2 copies of Fragment2 when issue was
reproduced even though getItem of FragmentStatePagerAdapter returned
different Fragments for each position but still at 2nd position it was
showing old fragment. For testing purpose in getItem I returned Fragment1
for all positions so that all 3 pages should be same but even after that
in 2nd position it was showing old copy of Fragment2 when I reproduced
issue with steps mentioned above.
So how to clear ViewPager so that it does not save old fragments. How to
refresh ViewPager so that it does not retain old copy with fragments. I
think problem is with onSaveInstanceState but I need it. How can I exclude
ViewPager when views are saved in onSaveInstanceState. I have tried
mViewPager.setSaveEnabled(false) but it takes too much memory.
Thursday, 29 August 2013
android, php, parsing JSON in php file sent from android
android, php, parsing JSON in php file sent from android
i have this JSON
{
"count":"3",
"num":"1",
"array":[
{
"id":"a_a",
"amount":56,
"duration":"0:12",
"time":1234566,
"type":0
},
{
"id":"a_a",
"amount":56,
"duration":"0:12",
"time":1234566,
"type":1
}
]
}
created it in android and send it by **HttpPost**
, i've tried a lot of ways to get the data in the php, my php file is this:
<?php
$response = array();
//$json_data = json_encode(stripslashes($_POST['jsonarray']))
$josn = file_get_contents("php://input");
$json_data = json_decode($josn,true);
$count = $json_data->{'count'};
$num = $json_data["num"];
$response["data"]=$count;
$response["data2"]=$num;
// echoing JSON response
echo json_encode($response);
?>
but $count and $num always returns null, any help please, and thanks.
i have this JSON
{
"count":"3",
"num":"1",
"array":[
{
"id":"a_a",
"amount":56,
"duration":"0:12",
"time":1234566,
"type":0
},
{
"id":"a_a",
"amount":56,
"duration":"0:12",
"time":1234566,
"type":1
}
]
}
created it in android and send it by **HttpPost**
, i've tried a lot of ways to get the data in the php, my php file is this:
<?php
$response = array();
//$json_data = json_encode(stripslashes($_POST['jsonarray']))
$josn = file_get_contents("php://input");
$json_data = json_decode($josn,true);
$count = $json_data->{'count'};
$num = $json_data["num"];
$response["data"]=$count;
$response["data2"]=$num;
// echoing JSON response
echo json_encode($response);
?>
but $count and $num always returns null, any help please, and thanks.
Wednesday, 28 August 2013
PHP delete from database with codeigniter
PHP delete from database with codeigniter
I want to delete an entry in one table of my database. The table name is
book. But in table title use foreign key book.
book: id, name
title: id, book_id, title
Now I want to delete an entry in book. So, I have to delete related
entries in title table. My code is :
$this->db->where(book_id,$deleteid);
$this->db->delete(title);
$this->db->where(id,$deleteid);
$this->db->delete(book);
My question is whether the first where clause will affect my second delete
clause? If it affects the second one, what should I do to avoid this?
Thanks. I am a beginner of PHP.
I want to delete an entry in one table of my database. The table name is
book. But in table title use foreign key book.
book: id, name
title: id, book_id, title
Now I want to delete an entry in book. So, I have to delete related
entries in title table. My code is :
$this->db->where(book_id,$deleteid);
$this->db->delete(title);
$this->db->where(id,$deleteid);
$this->db->delete(book);
My question is whether the first where clause will affect my second delete
clause? If it affects the second one, what should I do to avoid this?
Thanks. I am a beginner of PHP.
Why is 'name' nil for getinfo(1)
Why is 'name' nil for getinfo(1)
I'm trying to put together a lua testing framework that lets you know the
function that had the problem, but when I switched from loadstring to _G,
(I switched so my test harness could see the results of the function call)
my functions started using 'nil' for the function name
Why can _G not detect the name of the current function in the following code?
function blah()
print(debug.getinfo(1).name)
end
local name = 'blah'
local status, result = pcall(_G[name]) -- Outputs 'nil'
local status, result = pcall(loadstring(name..'()')) -- Outputs 'blah'
I'm trying to put together a lua testing framework that lets you know the
function that had the problem, but when I switched from loadstring to _G,
(I switched so my test harness could see the results of the function call)
my functions started using 'nil' for the function name
Why can _G not detect the name of the current function in the following code?
function blah()
print(debug.getinfo(1).name)
end
local name = 'blah'
local status, result = pcall(_G[name]) -- Outputs 'nil'
local status, result = pcall(loadstring(name..'()')) -- Outputs 'blah'
Apache2 RewriteRule syntax for ActiveSync redirect in reverse proxy
Apache2 RewriteRule syntax for ActiveSync redirect in reverse proxy
Okay, I think this is a fairly simple task, but I'm having a little
trouble testing reliably and working out what I've done wrong. I tried to
follow the Apache mod_rewrite documentation, but it doesn't appear to be
working the way I expected.
I have an Apache server running as a reverse proxy in front of an Exchange
CAS for public OWA access, and we want to intercept ActiveSync traffic
(simple pattern match) and redirect it to an AirWatch Secure Email Gateway
(SEG) URL. All other (i.e. web browser OWA) traffic should be sent along
to the CAS as usual.
So what we started with is something like this, and this works perfectly
for OWA access, but doesn't do the ActiveSync-to-SEG redirect:
<VirtualHost *:443>
ServerName webmail.company.com:443
RewriteEngine on
RewriteRule ^/$ https://webmail.company.com/exchange [R,L]
<Location />
Order allow,deny
Allow from all
# This is the CAS's internal IP
ProxyPass https://10.100.10.209/
ProxyPassReverse https://10.100.10.209/
</Location>
</VirtualHost>
So I added this line (the one in the middle) in an attempt to rewrite URLs
that begin with "/Microsoft-Server-Activesync/[whatever]" into
"https://seg.company.com/Microsoft-Server-Activesync/[whatever]":
<VirtualHost *:443>
...
RewriteEngine on
RewriteRule ^/Microsoft-Server-Activesync?(.+)$
https://seg.company.com/Microsoft-Server-Activesync?$1 [R]
RewriteRule ^/$ https://webmail.company.com/exchange [R,L]
...
</VirtualHost>
When I made this change (in test, of course), the traffic I'm sending to
it from a mobile device does not appear to be getting redirected. Instead
the ActiveSync traffic just flows along to the Exchange CAS as usual like
the rule is not being triggered.
So, two questions:
Am I doing something obvious wrong with the RewriteRule I added?, and
How can I troubleshoot this a little more intelligently than, "Hit
ActiveSync URL in a browser, check web server logs to find out where it
went"?
Thanks in advance!
Regards, Jon Heese
Okay, I think this is a fairly simple task, but I'm having a little
trouble testing reliably and working out what I've done wrong. I tried to
follow the Apache mod_rewrite documentation, but it doesn't appear to be
working the way I expected.
I have an Apache server running as a reverse proxy in front of an Exchange
CAS for public OWA access, and we want to intercept ActiveSync traffic
(simple pattern match) and redirect it to an AirWatch Secure Email Gateway
(SEG) URL. All other (i.e. web browser OWA) traffic should be sent along
to the CAS as usual.
So what we started with is something like this, and this works perfectly
for OWA access, but doesn't do the ActiveSync-to-SEG redirect:
<VirtualHost *:443>
ServerName webmail.company.com:443
RewriteEngine on
RewriteRule ^/$ https://webmail.company.com/exchange [R,L]
<Location />
Order allow,deny
Allow from all
# This is the CAS's internal IP
ProxyPass https://10.100.10.209/
ProxyPassReverse https://10.100.10.209/
</Location>
</VirtualHost>
So I added this line (the one in the middle) in an attempt to rewrite URLs
that begin with "/Microsoft-Server-Activesync/[whatever]" into
"https://seg.company.com/Microsoft-Server-Activesync/[whatever]":
<VirtualHost *:443>
...
RewriteEngine on
RewriteRule ^/Microsoft-Server-Activesync?(.+)$
https://seg.company.com/Microsoft-Server-Activesync?$1 [R]
RewriteRule ^/$ https://webmail.company.com/exchange [R,L]
...
</VirtualHost>
When I made this change (in test, of course), the traffic I'm sending to
it from a mobile device does not appear to be getting redirected. Instead
the ActiveSync traffic just flows along to the Exchange CAS as usual like
the rule is not being triggered.
So, two questions:
Am I doing something obvious wrong with the RewriteRule I added?, and
How can I troubleshoot this a little more intelligently than, "Hit
ActiveSync URL in a browser, check web server logs to find out where it
went"?
Thanks in advance!
Regards, Jon Heese
Making an HTML list look like succesive boxes
Making an HTML list look like succesive boxes
I am trying to style a ul element to look like the 'social network'
section on this site http://fancy.com/invite
you see the 4 boxes with images of facebook, twitter, etc.
how can I achieve this with CSS?
I am trying to style a ul element to look like the 'social network'
section on this site http://fancy.com/invite
you see the 4 boxes with images of facebook, twitter, etc.
how can I achieve this with CSS?
Joining table data
Joining table data
I have a table of:
id title type expl bubble_content onfocus req dorder
label mirror
1 Fullname 1 1 Your fullname Yes 0 0 0
NULL
Then another table of:
id fieldid relid dorder
4 1 2 0
5 1 1 0
How would I join the two tables so that the result would be something like:
0 => array(
'id' => 1,
'title' => 'Fullname',
.... etc ....
'relid' => 2,
'relid' => 1),
1 => array(
.... etc ....
))
I've tried using INNER JOIN / LEFT JOIN but this produces two rows/arrays
for each relid, I would really like all the data for the particular
fieldid to exist within the same array, as illustrated above.
I have a table of:
id title type expl bubble_content onfocus req dorder
label mirror
1 Fullname 1 1 Your fullname Yes 0 0 0
NULL
Then another table of:
id fieldid relid dorder
4 1 2 0
5 1 1 0
How would I join the two tables so that the result would be something like:
0 => array(
'id' => 1,
'title' => 'Fullname',
.... etc ....
'relid' => 2,
'relid' => 1),
1 => array(
.... etc ....
))
I've tried using INNER JOIN / LEFT JOIN but this produces two rows/arrays
for each relid, I would really like all the data for the particular
fieldid to exist within the same array, as illustrated above.
Get MenuItem in lower Android versions
Get MenuItem in lower Android versions
I would like to get the MenuItem in lower Android versions. This code
works fine in Android 4.0.3:
_menu.findItem(R.id.menu_item).setVisible(true);
But the app crashes in Android 2.3.6. It throws a NullPointerException.
How can I get it work in lower Android versions?
I would like to get the MenuItem in lower Android versions. This code
works fine in Android 4.0.3:
_menu.findItem(R.id.menu_item).setVisible(true);
But the app crashes in Android 2.3.6. It throws a NullPointerException.
How can I get it work in lower Android versions?
Tuesday, 27 August 2013
How to detect user agent of iphone or ipad?
How to detect user agent of iphone or ipad?
I am using the following code to parse a remote XML :
NSString *urldata=[[NSString
alloc]initWithFormat:@"http://url.com/test/a.php"];
NSString *encode=[urldata
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@" urldata %@",urldata);
TBXML *tbxml =[TBXML tbxmlWithURL:[NSURL URLWithString:encode]];
And my php script has $useragent= $_SERVER['HTTP_USER_AGENT'] ; . I am
unable to determine the user agent. However if call the url from safari
ipad or iphone I have the user agent correctly.
I am using the following code to parse a remote XML :
NSString *urldata=[[NSString
alloc]initWithFormat:@"http://url.com/test/a.php"];
NSString *encode=[urldata
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@" urldata %@",urldata);
TBXML *tbxml =[TBXML tbxmlWithURL:[NSURL URLWithString:encode]];
And my php script has $useragent= $_SERVER['HTTP_USER_AGENT'] ; . I am
unable to determine the user agent. However if call the url from safari
ipad or iphone I have the user agent correctly.
R programming - creating a graph, with variable colors
R programming - creating a graph, with variable colors
I do not have much experience in R, and I wonder if they can help me in
this situation.
I have the following matrix:
mat <-
matrix(c(0,0.5,0.2,0.23,0.6,0,0,0.4,0.56,0.37,0,0.32,0.4,0.99,0.54,0.6,0,0.39),
ncol=6, nrow=3)
dimnames(mat) = list( c("y1","y2","y3"),
c("day1","day2","day3","day4","day5","day6"))
> mat
day1 day2 day3 day4 day5 day6
y1 0.0 0.23 0.00 0.37 0.40 0.60
y2 0.5 0.60 0.40 0.00 0.99 0.00
y3 0.2 0.00 0.56 0.32 0.54 0.39
>
I want to know how can I get a graph where points would be marked based on
the matrix.
The values ​​are arbitrary in the interval [0,1]. It is
possible to change the color of the generated points as a set of
constraints?
Example:
[0,0.2] - Red
[0.2,0.4] - Green
[0.5,0.6] - Yellow
[0.6,0.9] - Blue
[0.9,1] - Black
I apologize if I have not explained myself well.
Thank you!
I do not have much experience in R, and I wonder if they can help me in
this situation.
I have the following matrix:
mat <-
matrix(c(0,0.5,0.2,0.23,0.6,0,0,0.4,0.56,0.37,0,0.32,0.4,0.99,0.54,0.6,0,0.39),
ncol=6, nrow=3)
dimnames(mat) = list( c("y1","y2","y3"),
c("day1","day2","day3","day4","day5","day6"))
> mat
day1 day2 day3 day4 day5 day6
y1 0.0 0.23 0.00 0.37 0.40 0.60
y2 0.5 0.60 0.40 0.00 0.99 0.00
y3 0.2 0.00 0.56 0.32 0.54 0.39
>
I want to know how can I get a graph where points would be marked based on
the matrix.
The values ​​are arbitrary in the interval [0,1]. It is
possible to change the color of the generated points as a set of
constraints?
Example:
[0,0.2] - Red
[0.2,0.4] - Green
[0.5,0.6] - Yellow
[0.6,0.9] - Blue
[0.9,1] - Black
I apologize if I have not explained myself well.
Thank you!
PHP Header File isn't Working in a Subfolder
PHP Header File isn't Working in a Subfolder
I have a reviews page on my website, and I wanted my website to be
extremely user friendly, so I made it a sub-index. I have my index.php
under a folder named reviews (found here) so the domain is just /reviews.
When I try to include a PHP or CSS it abandons them and excludes them.
The code I am using to include my CSS (which is working on every other
page) is:
<link rel="stylesheet" type="text/css" href="/stylesheets/index.css">
The PHP include() that I'm using is:
<?php
include('header.php');
?>
This PHP works on all pages that do not use a parent folder, ex. index.php
(for my homepage).
The HTML in the PHP document is:
<html>
<center><nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="">Arcade</a>
<ul>
<li><a href="/arcade/action">Action</a></li>
<li><a href="/arcade/arcade">Arcade</a></li>
<li><a href="/arcade/puzzle">Puzzle</a></li>
<li><a href="/arcade/vehicle">Vehicle</a></li>
<li><a href="/arcade/violence">Violence</a></li>
<li><a href="/arcade/defense">Defense</a></li>
<li><a href="/arcade/rpg">RPG</a></li>
</ul>
</li>
<li><a href="">Watch</a>
<ul>
<li><a href="/watch/tv">TV Shows</a></li>
<li><a href="/watch/movies">Movies</a></li>
</ul>
</li>
<li><a href="">Extras</a>
<ul>
<li><a href="/news">Updates</a></li>
</ul>
</li>
<li><a href="/support">Support</a></li>
</ul>
</nav></center>
</html>
Anybody know any solutions to get my PHP and my CSS working in sub-folders?
My website is http://www.gameshank.com/
The homepage is using the header.php file!
I have a reviews page on my website, and I wanted my website to be
extremely user friendly, so I made it a sub-index. I have my index.php
under a folder named reviews (found here) so the domain is just /reviews.
When I try to include a PHP or CSS it abandons them and excludes them.
The code I am using to include my CSS (which is working on every other
page) is:
<link rel="stylesheet" type="text/css" href="/stylesheets/index.css">
The PHP include() that I'm using is:
<?php
include('header.php');
?>
This PHP works on all pages that do not use a parent folder, ex. index.php
(for my homepage).
The HTML in the PHP document is:
<html>
<center><nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="">Arcade</a>
<ul>
<li><a href="/arcade/action">Action</a></li>
<li><a href="/arcade/arcade">Arcade</a></li>
<li><a href="/arcade/puzzle">Puzzle</a></li>
<li><a href="/arcade/vehicle">Vehicle</a></li>
<li><a href="/arcade/violence">Violence</a></li>
<li><a href="/arcade/defense">Defense</a></li>
<li><a href="/arcade/rpg">RPG</a></li>
</ul>
</li>
<li><a href="">Watch</a>
<ul>
<li><a href="/watch/tv">TV Shows</a></li>
<li><a href="/watch/movies">Movies</a></li>
</ul>
</li>
<li><a href="">Extras</a>
<ul>
<li><a href="/news">Updates</a></li>
</ul>
</li>
<li><a href="/support">Support</a></li>
</ul>
</nav></center>
</html>
Anybody know any solutions to get my PHP and my CSS working in sub-folders?
My website is http://www.gameshank.com/
The homepage is using the header.php file!
Mixed inputs from different sources in SocketInputStream
Mixed inputs from different sources in SocketInputStream
When I add 2+ clients to my Server and write some input in each of the
clients, the server takes the data and gives it back to all clients where
it gets mixed.
So different sources write in the same output stream at the same time.
So my answer is: how can I write whole blocks of bytes without getting
them all mixed?
Or how can I achieve that they are written one after another and not at
the same time?
When I add 2+ clients to my Server and write some input in each of the
clients, the server takes the data and gives it back to all clients where
it gets mixed.
So different sources write in the same output stream at the same time.
So my answer is: how can I write whole blocks of bytes without getting
them all mixed?
Or how can I achieve that they are written one after another and not at
the same time?
Create generic groupBy method
Create generic groupBy method
I'm trying to create generic groupBy method from the list of objects that
I have so I though my method could have signature something like this :
private Map<String, List<T>> groupBy(List<T> list, String fieldName) {
But it's not compiling. Type T is missing, how can I fix it to compile? I
though of calling the field name(getter) via java reflection and grouping
it and returning a map.
I'm trying to create generic groupBy method from the list of objects that
I have so I though my method could have signature something like this :
private Map<String, List<T>> groupBy(List<T> list, String fieldName) {
But it's not compiling. Type T is missing, how can I fix it to compile? I
though of calling the field name(getter) via java reflection and grouping
it and returning a map.
BASH for loop echo leading zero
BASH for loop echo leading zero
I have a basic number for loop which increments the variable num by 1 over
each iteration...
for (( num=1; num<=5; num++ ))
do
echo $num
done
Which outputs:
1
2
3
4
5
I'm trying to make it produce the output (add leading zero before $num):
01
02
03
04
05
Without doing:
echo 0$num
I have a basic number for loop which increments the variable num by 1 over
each iteration...
for (( num=1; num<=5; num++ ))
do
echo $num
done
Which outputs:
1
2
3
4
5
I'm trying to make it produce the output (add leading zero before $num):
01
02
03
04
05
Without doing:
echo 0$num
Monday, 26 August 2013
ruby on rails, csv import, created_at attribute won't updates when i import csv file
ruby on rails, csv import, created_at attribute won't updates when i
import csv file
i tried to import a csv file to my database. I need the app takes the
exact created_at attribute from csv file, but it won't work. I see only
Time.now
What i'm doing wrong? Thanx.
The csv import code in the model
def self.import(file, current_user)
allowed_attributes = [ "id","created_at","updated_at"]
@current_user = current_user
CSV.foreach(file.path, headers: true) do |row|
energy = find_by_id(row["id"]) || new
h1 = { "user_id" => @current_user.id }
h2 = row.to_hash.slice(*accessible_attributes)
h3 = h1.merge(h2)
energy.attributes = h3
energy.save!
end
end
import csv file
i tried to import a csv file to my database. I need the app takes the
exact created_at attribute from csv file, but it won't work. I see only
Time.now
What i'm doing wrong? Thanx.
The csv import code in the model
def self.import(file, current_user)
allowed_attributes = [ "id","created_at","updated_at"]
@current_user = current_user
CSV.foreach(file.path, headers: true) do |row|
energy = find_by_id(row["id"]) || new
h1 = { "user_id" => @current_user.id }
h2 = row.to_hash.slice(*accessible_attributes)
h3 = h1.merge(h2)
energy.attributes = h3
energy.save!
end
end
How to perform vba task after media player finishes
How to perform vba task after media player finishes
I'm using Access 2010 and have tables setup to identify a particular video
file. I have a button on a form that will launch the video file with
WindowsMediaPlayer. The problem is that I want to update the table(s)
after the video has run. I've created this quick from a button on a form
(fTest1) but the next part I've been searching around for a while.
Private Sub Command1_Click()
Dim player As WindowsMediaPlayer
DoCmd.OpenForm "fTest2"
Set player = Forms!fTest2!WMP.Object
Forms!fTest2!WMP.URL = "S:\Training Videos\Wildlife.wmv"
' here is where I want to do something after the file has finished
'
I did a test with a msgbox but it shows up while the video is playing.
Looking for like a call or wait until or something.
Any help would be appreciated.
I'm using Access 2010 and have tables setup to identify a particular video
file. I have a button on a form that will launch the video file with
WindowsMediaPlayer. The problem is that I want to update the table(s)
after the video has run. I've created this quick from a button on a form
(fTest1) but the next part I've been searching around for a while.
Private Sub Command1_Click()
Dim player As WindowsMediaPlayer
DoCmd.OpenForm "fTest2"
Set player = Forms!fTest2!WMP.Object
Forms!fTest2!WMP.URL = "S:\Training Videos\Wildlife.wmv"
' here is where I want to do something after the file has finished
'
I did a test with a msgbox but it shows up while the video is playing.
Looking for like a call or wait until or something.
Any help would be appreciated.
Resolution problem of ContourPlot mathematica.stackexchange.com
Resolution problem of ContourPlot – mathematica.stackexchange.com
I met a tricky problem with ContourPlot, which is when I change the range
of my variable, I get a totally new figure. For example: ContourPlot[2.`
c^4 - 1.693 c^4 x - 0.861 x^2 + 0.0417 Log[10^(-6)] …
I met a tricky problem with ContourPlot, which is when I change the range
of my variable, I get a totally new figure. For example: ContourPlot[2.`
c^4 - 1.693 c^4 x - 0.861 x^2 + 0.0417 Log[10^(-6)] …
Make this part of PHP code faster
Make this part of PHP code faster
I have a portion of code that isn't so optimized.
Probably a LEFT JOIN will make it faster. But I have some troubles with
this kind of advanced queries.
I would like to use the LEFT JOIN with NULL value
(http://explainextended.com/2009/09/18/not-in-vs-not-exists-vs-left-join-is-null-mysql/)
for queries into the first cicle.
This is the portion of code:
$query = "SELECT * FROM SitiWeb_Categorie WHERE MaxArticoliConLinks > 0";
$result = mysql_query($query, $db);
while($row = mysql_fetch_array($result))
{
$Disponibile = 0;
//Trovo tutti gli articoli redatti ed assegnati a questa categoria
//Verifico inoltre che non è presente nella tabella delle pubblicazioni
$query2 = "SELECT Articolisti_Articoli.ID AS ArticoloID FROM
Articolisti_Articoli, Articolisti_Incarichi WHERE
Articolisti_Incarichi.CategoriaID = '$row[ID]' AND
Articolisti_Articoli.IncaricoID = Articolisti_Incarichi.ID ORDER BY
Articolisti_Articoli.ID DESC";
$result2 = mysql_query($query2, $db);
while($row2 = mysql_fetch_array($result2))
{
$query3 = "SELECT COUNT(ID) AS Tot FROM SitiWeb_Articoli WHERE
ArticoloID = $row2[ArticoloID]";
$result3 = mysql_query($query3, $db);
$row3 = mysql_fetch_array($result3);
if($row3[Tot]==0)
{
$Disponibile++;
}
if($Disponibile==10)
{
break;
}
}
if($Disponibile<10)
{
}
}
I have a portion of code that isn't so optimized.
Probably a LEFT JOIN will make it faster. But I have some troubles with
this kind of advanced queries.
I would like to use the LEFT JOIN with NULL value
(http://explainextended.com/2009/09/18/not-in-vs-not-exists-vs-left-join-is-null-mysql/)
for queries into the first cicle.
This is the portion of code:
$query = "SELECT * FROM SitiWeb_Categorie WHERE MaxArticoliConLinks > 0";
$result = mysql_query($query, $db);
while($row = mysql_fetch_array($result))
{
$Disponibile = 0;
//Trovo tutti gli articoli redatti ed assegnati a questa categoria
//Verifico inoltre che non è presente nella tabella delle pubblicazioni
$query2 = "SELECT Articolisti_Articoli.ID AS ArticoloID FROM
Articolisti_Articoli, Articolisti_Incarichi WHERE
Articolisti_Incarichi.CategoriaID = '$row[ID]' AND
Articolisti_Articoli.IncaricoID = Articolisti_Incarichi.ID ORDER BY
Articolisti_Articoli.ID DESC";
$result2 = mysql_query($query2, $db);
while($row2 = mysql_fetch_array($result2))
{
$query3 = "SELECT COUNT(ID) AS Tot FROM SitiWeb_Articoli WHERE
ArticoloID = $row2[ArticoloID]";
$result3 = mysql_query($query3, $db);
$row3 = mysql_fetch_array($result3);
if($row3[Tot]==0)
{
$Disponibile++;
}
if($Disponibile==10)
{
break;
}
}
if($Disponibile<10)
{
}
}
change cell properties from an excel file open with a wsf script
change cell properties from an excel file open with a wsf script
i have a wsf script, vritten in visual basic, that run a db2 query and
save the results in a file .csv .
Function CreaCSVdaSQL (SQL,fileCompletePath)
Dim Input , conn,rs,csvtext,fso,fs,line
set conn = CreateObject ("ADODB.Connection")
conn.open _
"Provider=SQLOLEDB.1;Initial Catalog=XXXX;Data Source=XXXXX;MARS
Connection=True;User Id=XXXX;password=XXXX"
set rs = conn.execute (SQL)
line = ""
Dim tmp
For Each tmp In rs.Fields
line=line & tmp.Name & ";"
Next
if (Not rs.EOF) then
csvText = line & vbcrlf & rs.getString (2,, ";", VBCrLf)
rs.close: set rs = nothing
conn.close: set conn = nothing
Dim l_sn
l_sn = Replace (Now, "-", "")
l_sn = Replace (l_sn, ":", "")
l_sn = Replace (l_sn, "", "")
set fso = CreateObject ("Scripting.FileSystemObject")
set fs = fso.CreateTextFile (fileCompletePath, true)
fs.writeline (csvText)
fs.close: set fs = nothing
set fso = nothing
end if
End Function
Everytime my collegue open the file csv with excel have to change the cell
in text format, i try to find a way to do it programmatically, without a
macro, because the file is deleted everytime the script run and cannot
store the macro.
Somebody can help me ? Thanks.
i have a wsf script, vritten in visual basic, that run a db2 query and
save the results in a file .csv .
Function CreaCSVdaSQL (SQL,fileCompletePath)
Dim Input , conn,rs,csvtext,fso,fs,line
set conn = CreateObject ("ADODB.Connection")
conn.open _
"Provider=SQLOLEDB.1;Initial Catalog=XXXX;Data Source=XXXXX;MARS
Connection=True;User Id=XXXX;password=XXXX"
set rs = conn.execute (SQL)
line = ""
Dim tmp
For Each tmp In rs.Fields
line=line & tmp.Name & ";"
Next
if (Not rs.EOF) then
csvText = line & vbcrlf & rs.getString (2,, ";", VBCrLf)
rs.close: set rs = nothing
conn.close: set conn = nothing
Dim l_sn
l_sn = Replace (Now, "-", "")
l_sn = Replace (l_sn, ":", "")
l_sn = Replace (l_sn, "", "")
set fso = CreateObject ("Scripting.FileSystemObject")
set fs = fso.CreateTextFile (fileCompletePath, true)
fs.writeline (csvText)
fs.close: set fs = nothing
set fso = nothing
end if
End Function
Everytime my collegue open the file csv with excel have to change the cell
in text format, i try to find a way to do it programmatically, without a
macro, because the file is deleted everytime the script run and cannot
store the macro.
Somebody can help me ? Thanks.
Limit the number of google recaptcha characters
Limit the number of google recaptcha characters
I'm currently using google recaptcha, and I feel that it can be a little
difficult. It is always two words the user has to type in, and some of the
words can be up to 7+ characters.
So is there any way to limit the numbers of google recaptcha characters ??
Thanks
I'm currently using google recaptcha, and I feel that it can be a little
difficult. It is always two words the user has to type in, and some of the
words can be up to 7+ characters.
So is there any way to limit the numbers of google recaptcha characters ??
Thanks
MySQL PDO login fails for second connection
MySQL PDO login fails for second connection
I have 2 linux VMs with below configuration:
VM 1:
OS: Redhat Enterprise Linux 5.4
Apache: 2.2.23
PHP: 5.5.3
MySQL: 5.5.28
PHP config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--prefix=/usr/local/apache2/php'
'--with-config-file-path=/usr/local/apache2/php' '--disable-cgi'
'--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3'
'--enable-sqlite-utf8' '--with-mysql=/usr/local/mysql/'
'--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--enable-calendar'
'--with-curl=/usr/lib' '--with-gd' '--with-jpeg-dir=/usr/lib/libjpeg.so'
'--with-png-dir=/usr/lib/libpng.so' '--enable-soap' '--enable-bcmath'
VM 2:
OS: Redhat Enterprise Linux 6.4
Apache: 2.4.6
PHP: 5.3.27
MySQL: 5.6.13
PHP config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--prefix=/usr/local/apache2/php'
'--with-config-file-path=/usr/local/apache2/php' '--disable-cgi'
'--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3'
'--enable-sqlite-utf8' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd'
'--enable-mbstring' '--enable-calendar' '--with-curl=/usr/lib' '--with-gd'
'--with-jpeg-dir=/usr/lib/libjpeg.so' '--with-png-dir=/usr/lib/libpng.so'
'--enable-soap' '--enable-bcmath' '--with-mysqli=mysqlnd'
'--with-pdo-sqlite' '--with-pear' '--enable-ftp' '--with-openssl'
I have a php class which connects to a MySQL database using PDO using the
following code:
try {
$this->maindb = new PDO(PDO_MYSQL_HOST_DBNAME, PDO_MYSQL_USER,
PDO_MYSQL_PASSWORD, array(PDO::ATTR_PERSISTENT => true));
$this->maindb->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die('Error connecting database: ' . $e->getMessage());
}
This part works fine, and data gets inserted to the database as expected.
Strangely towards the end of the class, when I create an object of another
class and pass $this->maindb object to on of its functions to write some
more data, It fails with 'SQLSTATE[28000]: Invalid authorization
specification: 1045 Access denied for user 'team'@'localhost' (using
password: YES)' error.
My problem is, the same code works fine on VM1, and fails on VM2 as
described. I have tried these options:
With both persistent and non-persistent connections.
Used MySql root user privileges.
I have no idea what might be causing this problem. Please help me sort
this out.
NOTE: I prefer any solution which doesn't involve downgrading packages.
I have 2 linux VMs with below configuration:
VM 1:
OS: Redhat Enterprise Linux 5.4
Apache: 2.2.23
PHP: 5.5.3
MySQL: 5.5.28
PHP config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--prefix=/usr/local/apache2/php'
'--with-config-file-path=/usr/local/apache2/php' '--disable-cgi'
'--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3'
'--enable-sqlite-utf8' '--with-mysql=/usr/local/mysql/'
'--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--enable-calendar'
'--with-curl=/usr/lib' '--with-gd' '--with-jpeg-dir=/usr/lib/libjpeg.so'
'--with-png-dir=/usr/lib/libpng.so' '--enable-soap' '--enable-bcmath'
VM 2:
OS: Redhat Enterprise Linux 6.4
Apache: 2.4.6
PHP: 5.3.27
MySQL: 5.6.13
PHP config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--prefix=/usr/local/apache2/php'
'--with-config-file-path=/usr/local/apache2/php' '--disable-cgi'
'--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3'
'--enable-sqlite-utf8' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd'
'--enable-mbstring' '--enable-calendar' '--with-curl=/usr/lib' '--with-gd'
'--with-jpeg-dir=/usr/lib/libjpeg.so' '--with-png-dir=/usr/lib/libpng.so'
'--enable-soap' '--enable-bcmath' '--with-mysqli=mysqlnd'
'--with-pdo-sqlite' '--with-pear' '--enable-ftp' '--with-openssl'
I have a php class which connects to a MySQL database using PDO using the
following code:
try {
$this->maindb = new PDO(PDO_MYSQL_HOST_DBNAME, PDO_MYSQL_USER,
PDO_MYSQL_PASSWORD, array(PDO::ATTR_PERSISTENT => true));
$this->maindb->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die('Error connecting database: ' . $e->getMessage());
}
This part works fine, and data gets inserted to the database as expected.
Strangely towards the end of the class, when I create an object of another
class and pass $this->maindb object to on of its functions to write some
more data, It fails with 'SQLSTATE[28000]: Invalid authorization
specification: 1045 Access denied for user 'team'@'localhost' (using
password: YES)' error.
My problem is, the same code works fine on VM1, and fails on VM2 as
described. I have tried these options:
With both persistent and non-persistent connections.
Used MySql root user privileges.
I have no idea what might be causing this problem. Please help me sort
this out.
NOTE: I prefer any solution which doesn't involve downgrading packages.
JQuery Remove all links inside a that have a particular class except for the one that's clicked
JQuery Remove all links inside a that have a particular class except for
the one that's clicked
In jQuery, how can I remove/disable or change the class of all links
inside a <div> that have a particular class except for the one that was
clicked? The clicked one's class needs to be changed.
<div class="test">
<div class="link" data-id="1">Link 1</div>
<div class="link" data-id="2">Link 2</div>
<div class="link" data-id="3">Link 3</div>
</div>
In this case, if I clicked Link 1, I'm trying to make Link 2 and Link 3
disappear or change their class, and change the class of Link 1 to noLink.
How can this be done. I'm familiar with add class, remove class, but I'm
stuck with getting all others to be removed or changed and change the
clicked one to another class.
the one that's clicked
In jQuery, how can I remove/disable or change the class of all links
inside a <div> that have a particular class except for the one that was
clicked? The clicked one's class needs to be changed.
<div class="test">
<div class="link" data-id="1">Link 1</div>
<div class="link" data-id="2">Link 2</div>
<div class="link" data-id="3">Link 3</div>
</div>
In this case, if I clicked Link 1, I'm trying to make Link 2 and Link 3
disappear or change their class, and change the class of Link 1 to noLink.
How can this be done. I'm familiar with add class, remove class, but I'm
stuck with getting all others to be removed or changed and change the
clicked one to another class.
Sunday, 25 August 2013
SIGSEGV and mono crash issue while running .NET binary using mono
SIGSEGV and mono crash issue while running .NET binary using mono
I have ubuntu 12.04 Linux on my PC and mono-complete package "Mono JIT
compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)".
I am going to run one .NET binary using mono and got SIGSEGV signal after
running that binary and mono is going to be crashed after that.
I have also got some gdb debug messages on command prompt whihc i have
mentioned below.
Thread 2 (Thread 0xb28ffb40 (LWP 20460)) :
#0 0xb7796424 in __kernel_vsyscall ()
#1 0xb77329db in read () from /lib/i386-linux-gnu/libpthread.so.0
#2 0x080e18e7 in read (__nbytes=1024, __buf=0xb2e0867c, __fd=<optimized
out>) at /usr/include/i386-linux-gnu/bits/unistd.h:45
#3 mono_handle_native_sigsegv (signal=11, ctx=0xb2e08bcc) at
mini-exceptions.c:2208
#4 0x081209fc in mono_arch_handle_altstack_exception (sigctx=0xb2e08bcc,
fault_addr=0x0, stack_ovf=0) at exceptions-x86.c:1223
#5 0x0806094d in mono_sigsegv_signal_handler (_dummy=11,
info=0xb2e08b4c, context=0xb2e08bcc) at mini.c:5909
#6 <signal handler called>
#7 0xb48881dc in ?? ()
#8 0xb2bcba6b in bulk_interrupt_read_thread (arguments=0xb4888108) at
testusb.c:1596
#9 0xb772bd4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#10 0xb766adde in clone () from /lib/i386-linux-gnu/libc.so.6
Thread 1 (Thread 0xb757a700 (LWP 20449)) :
#0 0xb7796424 in __kernel_vsyscall ()
#1 0xb765c690 in poll () from /lib/i386-linux-gnu/libc.so.6
#2 0xb2c2c984 in ?? ()
#3 0xb2c2bdb0 in ?? ()
#4 0xb2c2e2d4 in ?? ()
#5 0xb2c4e770 in ?? ()
#6 0xb2c4b86c in ?? ()
#7 0xb2c4b527 in ?? ()
#8 0xb2e14518 in ?? ()
#9 0xb2e139a8 in ?? ()
#10 0xb2e13648 in ?? ()
#11 0xb58e3f84 in ?? ()
#12 0xb58e403e in ?? ()
#13 0x08064c2c in mono_jit_runtime_invoke
(method="GTechUtility.Program:Main ()", obj=0x0, params=0xbfab491c,
exc=0x0) at mini.c:5791
#14 0x081a422f in mono_runtime_invoke (method="GTechUtility.Program:Main
()", obj=0x0, params=0xbfab491c, exc=0x0) at object.c:2755
#15 0x081a7025 in mono_runtime_exec_main
(method="GTechUtility.Program:Main ()", args=0x3be00, exc=0x0) at
object.c:3938
#16 0x080bb80b in main_thread_handler (user_data=<synthetic pointer>) at
driver.c:1003
#17 mono_main (argc=2, argv=0xbfab4ae4) at driver.c:1855
#18 0x0805998f in mono_main_with_options (argv=0xbfab4ae4, argc=2) at
main.c:66
#19 main (argc=2, argv=0xbfab4ae4) at main.c:97
=================================================================
Got a SIGSEGV while executing native code.
This usually indicates a fatal error in the mono runtime or one of the
native libraries used by your application.
=================================================================
Aborted (core dumped)
Please let me know if any one have idea about this issue.
I have ubuntu 12.04 Linux on my PC and mono-complete package "Mono JIT
compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)".
I am going to run one .NET binary using mono and got SIGSEGV signal after
running that binary and mono is going to be crashed after that.
I have also got some gdb debug messages on command prompt whihc i have
mentioned below.
Thread 2 (Thread 0xb28ffb40 (LWP 20460)) :
#0 0xb7796424 in __kernel_vsyscall ()
#1 0xb77329db in read () from /lib/i386-linux-gnu/libpthread.so.0
#2 0x080e18e7 in read (__nbytes=1024, __buf=0xb2e0867c, __fd=<optimized
out>) at /usr/include/i386-linux-gnu/bits/unistd.h:45
#3 mono_handle_native_sigsegv (signal=11, ctx=0xb2e08bcc) at
mini-exceptions.c:2208
#4 0x081209fc in mono_arch_handle_altstack_exception (sigctx=0xb2e08bcc,
fault_addr=0x0, stack_ovf=0) at exceptions-x86.c:1223
#5 0x0806094d in mono_sigsegv_signal_handler (_dummy=11,
info=0xb2e08b4c, context=0xb2e08bcc) at mini.c:5909
#6 <signal handler called>
#7 0xb48881dc in ?? ()
#8 0xb2bcba6b in bulk_interrupt_read_thread (arguments=0xb4888108) at
testusb.c:1596
#9 0xb772bd4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#10 0xb766adde in clone () from /lib/i386-linux-gnu/libc.so.6
Thread 1 (Thread 0xb757a700 (LWP 20449)) :
#0 0xb7796424 in __kernel_vsyscall ()
#1 0xb765c690 in poll () from /lib/i386-linux-gnu/libc.so.6
#2 0xb2c2c984 in ?? ()
#3 0xb2c2bdb0 in ?? ()
#4 0xb2c2e2d4 in ?? ()
#5 0xb2c4e770 in ?? ()
#6 0xb2c4b86c in ?? ()
#7 0xb2c4b527 in ?? ()
#8 0xb2e14518 in ?? ()
#9 0xb2e139a8 in ?? ()
#10 0xb2e13648 in ?? ()
#11 0xb58e3f84 in ?? ()
#12 0xb58e403e in ?? ()
#13 0x08064c2c in mono_jit_runtime_invoke
(method="GTechUtility.Program:Main ()", obj=0x0, params=0xbfab491c,
exc=0x0) at mini.c:5791
#14 0x081a422f in mono_runtime_invoke (method="GTechUtility.Program:Main
()", obj=0x0, params=0xbfab491c, exc=0x0) at object.c:2755
#15 0x081a7025 in mono_runtime_exec_main
(method="GTechUtility.Program:Main ()", args=0x3be00, exc=0x0) at
object.c:3938
#16 0x080bb80b in main_thread_handler (user_data=<synthetic pointer>) at
driver.c:1003
#17 mono_main (argc=2, argv=0xbfab4ae4) at driver.c:1855
#18 0x0805998f in mono_main_with_options (argv=0xbfab4ae4, argc=2) at
main.c:66
#19 main (argc=2, argv=0xbfab4ae4) at main.c:97
=================================================================
Got a SIGSEGV while executing native code.
This usually indicates a fatal error in the mono runtime or one of the
native libraries used by your application.
=================================================================
Aborted (core dumped)
Please let me know if any one have idea about this issue.
jquery post still goes through inspite of asp.net mvc 4 validation failure
jquery post still goes through inspite of asp.net mvc 4 validation failure
I want an asp.net mvc form to post to a controller and also show a message
on error or success, all of which using jquery. I want this jquery post to
happen only if the form validation is successful. The problem is that the
post happens even when the form validation has failed. I am using Data
annotations in the mvc framework to validate. Here is the code
View
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet"
type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")"
type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"
type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"
type="text/javascript"></script>
<div>
@using ( Html.BeginForm("jQueryPost", "Home",null, FormMethod.Post,
new { id="FormPost" }))
{
@Html.TextBoxFor(x => x.Name) @Html.ValidationMessageFor(x => x.Name)
<br />
@Html.TextBoxFor(x => x.LastName) @Html.ValidationMessageFor(x =>
x.LastName)
<br />
@Html.TextBoxFor(x => x.Age) @Html.ValidationMessageFor(x => x.Age)
<br />
<input type=submit value="submit" />
}
</div>
<script>
$(document).ready(function () {
$('#FormPost').submit(function (e) {
e.preventDefault(); //This line will prevent the form from
submitting
alert('ajax post here');
$.ajax({
type: 'POST',
url: $('#FormPost').attr('action'),
data: $('#FormPost').serialize(),
accept: 'application/json',
error: function (xhr, status, error) {
alert('error: ' + xhr.responseText + '-' + error);
},
success: function (response) {
alert('resp: ' + response);
}
});
});
});
</script>
The Controller
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult jQueryPost(IndexVM vm)
{
IndexVM _vm = vm;
try
{
//some code here
}
catch
{
Response.StatusCode = 406; // Or any other proper status code.
Response.Write("Custom error message");
return null;
}
return Json("name posted was: " + _vm.Name);
}
I want an asp.net mvc form to post to a controller and also show a message
on error or success, all of which using jquery. I want this jquery post to
happen only if the form validation is successful. The problem is that the
post happens even when the form validation has failed. I am using Data
annotations in the mvc framework to validate. Here is the code
View
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet"
type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")"
type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"
type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"
type="text/javascript"></script>
<div>
@using ( Html.BeginForm("jQueryPost", "Home",null, FormMethod.Post,
new { id="FormPost" }))
{
@Html.TextBoxFor(x => x.Name) @Html.ValidationMessageFor(x => x.Name)
<br />
@Html.TextBoxFor(x => x.LastName) @Html.ValidationMessageFor(x =>
x.LastName)
<br />
@Html.TextBoxFor(x => x.Age) @Html.ValidationMessageFor(x => x.Age)
<br />
<input type=submit value="submit" />
}
</div>
<script>
$(document).ready(function () {
$('#FormPost').submit(function (e) {
e.preventDefault(); //This line will prevent the form from
submitting
alert('ajax post here');
$.ajax({
type: 'POST',
url: $('#FormPost').attr('action'),
data: $('#FormPost').serialize(),
accept: 'application/json',
error: function (xhr, status, error) {
alert('error: ' + xhr.responseText + '-' + error);
},
success: function (response) {
alert('resp: ' + response);
}
});
});
});
</script>
The Controller
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult jQueryPost(IndexVM vm)
{
IndexVM _vm = vm;
try
{
//some code here
}
catch
{
Response.StatusCode = 406; // Or any other proper status code.
Response.Write("Custom error message");
return null;
}
return Json("name posted was: " + _vm.Name);
}
Unexpected bitwise operation result
Unexpected bitwise operation result
Consider:
php > $a = 12; // 1100
php > echo ~$a;
13
I would expect the inverse of 1100 to be either 0011 (direct) or 11110011
(an entire byte). That would give a result to either 3 or 243. Whence
cometh 13?
Again, for good measure, another unexpected result of the same type and
explanation:
php > $b = 6; // 0110
php > echo ~$b;
7
Why 7?
Consider:
php > $a = 12; // 1100
php > echo ~$a;
13
I would expect the inverse of 1100 to be either 0011 (direct) or 11110011
(an entire byte). That would give a result to either 3 or 243. Whence
cometh 13?
Again, for good measure, another unexpected result of the same type and
explanation:
php > $b = 6; // 0110
php > echo ~$b;
7
Why 7?
[ Other - Music ] Open Question : iTunes preferences: Counter till end of the song?
[ Other - Music ] Open Question : iTunes preferences: Counter till end of
the song?
Anyone who has itunes knows at the top of the screen it shows the song
playing. To the left of the song is a counter of how many seconds into the
song you are, and to the right of the song is how many seconds left till
the end of the song. Recently my itunes has changed so to the right of the
song it shows how long the song is in total instead of how many seconds
left. I don't know if this is a new update or if I am able to change it
back. Can anyone help me out?
the song?
Anyone who has itunes knows at the top of the screen it shows the song
playing. To the left of the song is a counter of how many seconds into the
song you are, and to the right of the song is how many seconds left till
the end of the song. Recently my itunes has changed so to the right of the
song it shows how long the song is in total instead of how many seconds
left. I don't know if this is a new update or if I am able to change it
back. Can anyone help me out?
how do change adress YiiFramework pagination
how do change adress YiiFramework pagination
**Hi default pagination in yii FrameWork :
www.example.com/articles/?article_page=2
how do change this Adress "?article_page=2" to only "2":
www.example.com/article/page2
**Hi default pagination in yii FrameWork :
www.example.com/articles/?article_page=2
how do change this Adress "?article_page=2" to only "2":
www.example.com/article/page2
Saturday, 24 August 2013
Glade 'Parentless' Widget
Glade 'Parentless' Widget
Is there a way to create 'parentless' widgets in Glade? What I mean is,
for example, a table with no associated parent, so that I can assign it as
a child of something else later.
What I'm trying to do is a GTK window with a 3 positions VBox, 2 of which
will be static and 1 which will be dynamic. In this dynamic position I
want to load a pre-defined table which will vary according to whatever I
did in the static parts, like pressing X or Y buttons.
Is this possible, or do I have to create the dynamic table by code?
I'm using Ruby 1.9.3, Gtk2, and Glade3. Thanks.
Is there a way to create 'parentless' widgets in Glade? What I mean is,
for example, a table with no associated parent, so that I can assign it as
a child of something else later.
What I'm trying to do is a GTK window with a 3 positions VBox, 2 of which
will be static and 1 which will be dynamic. In this dynamic position I
want to load a pre-defined table which will vary according to whatever I
did in the static parts, like pressing X or Y buttons.
Is this possible, or do I have to create the dynamic table by code?
I'm using Ruby 1.9.3, Gtk2, and Glade3. Thanks.
Emulating a live signature/autograph on top of photo
Emulating a live signature/autograph on top of photo
I am creating a website for a model and after seeing her unique signature
I thought it would be cool to add an effect on one of her photos displayed
on the homepage. My idea is to make it appear that she is signing the
photo in real time, I already have a vector image of her signature. I
would ideally like to use just HTML5 and JavaScript for this. My
understanding of HTML5 is very basic I also know very little JavaScript
most of my knowledge is in PHP/MySQL.
Is this possible with HTML5 and JavaScript? Maybe there is a better method
to accomplishing this? I would like it to be available across all
platforms/browsers. I want to stay away from Flash. I was also thinking
this might be possible by creating an animated GIF, I have yet to play
around with this idea. I am hoping someone here has done this before or
can give me some pointers on the best practice for achieving this. Thanks!
I am creating a website for a model and after seeing her unique signature
I thought it would be cool to add an effect on one of her photos displayed
on the homepage. My idea is to make it appear that she is signing the
photo in real time, I already have a vector image of her signature. I
would ideally like to use just HTML5 and JavaScript for this. My
understanding of HTML5 is very basic I also know very little JavaScript
most of my knowledge is in PHP/MySQL.
Is this possible with HTML5 and JavaScript? Maybe there is a better method
to accomplishing this? I would like it to be available across all
platforms/browsers. I want to stay away from Flash. I was also thinking
this might be possible by creating an animated GIF, I have yet to play
around with this idea. I am hoping someone here has done this before or
can give me some pointers on the best practice for achieving this. Thanks!
What's a quick and dirty way to get "lapsed" members in WordPress configured with s2Member?
What's a quick and dirty way to get "lapsed" members in WordPress
configured with s2Member?
I have a default installation of WordPress configured with the membership
management plugin known as s2Member. What is a quick and dirty way to
return an array of "lapsed" members?
I assume this information is hidden somewhere in the user's metadata.
configured with s2Member?
I have a default installation of WordPress configured with the membership
management plugin known as s2Member. What is a quick and dirty way to
return an array of "lapsed" members?
I assume this information is hidden somewhere in the user's metadata.
Mathematical Analysis problem
Mathematical Analysis problem
Suppose $f(0) =0 $ and $0<f''(x)<\infty (\forall$ $x>0)$, then
$\frac{f(x)}{x}$ strictly increases as $x$ increases.
I have shown that $f'(x)-\frac{f(x)}{x} = \frac{1}{2}xf''(c)$, for some
$c\in (0,x)$. How do I proceed from here?
Suppose $f(0) =0 $ and $0<f''(x)<\infty (\forall$ $x>0)$, then
$\frac{f(x)}{x}$ strictly increases as $x$ increases.
I have shown that $f'(x)-\frac{f(x)}{x} = \frac{1}{2}xf''(c)$, for some
$c\in (0,x)$. How do I proceed from here?
writing crontab from cron script returns 127 error
writing crontab from cron script returns 127 error
I'm working with some scripts which must be executed from crontab. Some of
them rewrite crontab.
in.php defines if read.php should be run by crontab. Then read.php is
executed by crontab. This works fine.
When read.php is executed, it might detect that it should be not running,
if this happens, it rewrites crontab to avoid its own execution, until
in.php rewrites crontab again). The problem is that this second step is
not working.
I have been looking for the error and I have found that my cron.txt is
correctly written. However, crontab command fails and returns 127 error.
But when I execute read.php manually all works fine.
Both scripts use the same functions to rewrite crontab. But this is
happening just in read.php, not in in.php.
Is there a time to rewrite crontab since it executes a task? It may
explain my problem, because in.php takes longer time to be executed than
read.php.
Thank you!
I'm working with some scripts which must be executed from crontab. Some of
them rewrite crontab.
in.php defines if read.php should be run by crontab. Then read.php is
executed by crontab. This works fine.
When read.php is executed, it might detect that it should be not running,
if this happens, it rewrites crontab to avoid its own execution, until
in.php rewrites crontab again). The problem is that this second step is
not working.
I have been looking for the error and I have found that my cron.txt is
correctly written. However, crontab command fails and returns 127 error.
But when I execute read.php manually all works fine.
Both scripts use the same functions to rewrite crontab. But this is
happening just in read.php, not in in.php.
Is there a time to rewrite crontab since it executes a task? It may
explain my problem, because in.php takes longer time to be executed than
read.php.
Thank you!
Parsing XML and showing Parent-Child Data in Storyboard
Parsing XML and showing Parent-Child Data in Storyboard
Im currently making a project which parsed the XML below and show the
data, Im showing the data in a story board where the first TableView will
only show the main categories, in the case here its Main Name1 and Main
Name2, but what Im really trying to do is when i click on any main
category name it will navigate me to its own sub-category and not to any
other sub-category or to all, coz i tried doing it and its only showing me
all the rest of the sub-category.
<categories>
<category>
<name>Main Name1</name>
<description>given description</description>
<image> Link Here </image>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
</category>
<category>
<name>Main Name2</name>
<description>given description</description>
<image> Link Here </image>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
</category>
</categories>
My parsing code is like this
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
if([elementName isEqualToString:@"category"] || [elementName
isEqualToString:@"sub_cat"]){
dataCurrent = [dataFileHolder alloc];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if([elementName isEqualToString:@"name"]){
dataCurrent.nameLabel = currentList;
}
if ([elementName isEqualToString:@"description"]){
dataCurrent.descLabel = currentList;
}
if ([elementName isEqualToString:@"image"]) {
dataCurrent.imageLinkLabel = currentList;
}
if ([elementName isEqualToString:@"sub_name"]) {
dataCurrent.childNameLabel = currentList;
}
if ([elementName isEqualToString:@"sub_desc"]) {
dataCurrent.childDetailLabel = currentList;
}
if ([elementName isEqualToString:@"sub_image"]) {
dataCurrent.childImageLink = currentList;
}
if ([elementName isEqualToString:@"category"]) {
[_listPopulated addObject:dataCurrent];
dataCurrent = nil;
currentList = nil;
}
}
Im currently making a project which parsed the XML below and show the
data, Im showing the data in a story board where the first TableView will
only show the main categories, in the case here its Main Name1 and Main
Name2, but what Im really trying to do is when i click on any main
category name it will navigate me to its own sub-category and not to any
other sub-category or to all, coz i tried doing it and its only showing me
all the rest of the sub-category.
<categories>
<category>
<name>Main Name1</name>
<description>given description</description>
<image> Link Here </image>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
</category>
<category>
<name>Main Name2</name>
<description>given description</description>
<image> Link Here </image>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
<sub_cat>
<sub_name>Sub name</sub_name>
<sub_desc>sub cat description</sub_desc>
<sub_image> Link </sub_image>
</sub_cat>
</category>
</categories>
My parsing code is like this
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
if([elementName isEqualToString:@"category"] || [elementName
isEqualToString:@"sub_cat"]){
dataCurrent = [dataFileHolder alloc];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if([elementName isEqualToString:@"name"]){
dataCurrent.nameLabel = currentList;
}
if ([elementName isEqualToString:@"description"]){
dataCurrent.descLabel = currentList;
}
if ([elementName isEqualToString:@"image"]) {
dataCurrent.imageLinkLabel = currentList;
}
if ([elementName isEqualToString:@"sub_name"]) {
dataCurrent.childNameLabel = currentList;
}
if ([elementName isEqualToString:@"sub_desc"]) {
dataCurrent.childDetailLabel = currentList;
}
if ([elementName isEqualToString:@"sub_image"]) {
dataCurrent.childImageLink = currentList;
}
if ([elementName isEqualToString:@"category"]) {
[_listPopulated addObject:dataCurrent];
dataCurrent = nil;
currentList = nil;
}
}
Command tab completion of arguments from folder
Command tab completion of arguments from folder
Is it possible to create a list of completions for a command based on some
folder's files?
Say I want to run Sublime Text 2 on one of my projects, which are saved as
~/sublime_projects/*.sublime-project. Desired behaviour:
subl<tab><tab>
foo bar project2
in case there are foo.sublime-project, bar.sublime-project,
project2.sublime-project files in ~/sublime_projects.
Is it possible to create a list of completions for a command based on some
folder's files?
Say I want to run Sublime Text 2 on one of my projects, which are saved as
~/sublime_projects/*.sublime-project. Desired behaviour:
subl<tab><tab>
foo bar project2
in case there are foo.sublime-project, bar.sublime-project,
project2.sublime-project files in ~/sublime_projects.
Friday, 23 August 2013
sql adjacency list children for node
sql adjacency list children for node
given context: How to copy a node's children in an adjacent list
In an adjacency list, how do you pick any node and get all children?
For example, see highlighted nodes below.
given context: How to copy a node's children in an adjacent list
In an adjacency list, how do you pick any node and get all children?
For example, see highlighted nodes below.
Wordpress custom titles
Wordpress custom titles
I am trying to add custom titles to my wordpress theme and I am having a
bit of trouble.
I know I can use AIOSeo but it adds so many functions that I wont use, so
I am trying to make this on my own.
I have added a few inputs in my theme settings page (one for home, one for
categories and so on) and I would like to be able to store my title
structure in those fields.
I have managed the storing part, but I cant make the proper output.
For instance, if for the index title I store "get_bloginfo('name')", when
I echo it, it says "get_bloginfo('name')" and not "My blog name"
How can I achieve that?
BTW, I am trying this
if ( is_page() ) {
echo $pagetitle;
Best regards!
I am trying to add custom titles to my wordpress theme and I am having a
bit of trouble.
I know I can use AIOSeo but it adds so many functions that I wont use, so
I am trying to make this on my own.
I have added a few inputs in my theme settings page (one for home, one for
categories and so on) and I would like to be able to store my title
structure in those fields.
I have managed the storing part, but I cant make the proper output.
For instance, if for the index title I store "get_bloginfo('name')", when
I echo it, it says "get_bloginfo('name')" and not "My blog name"
How can I achieve that?
BTW, I am trying this
if ( is_page() ) {
echo $pagetitle;
Best regards!
Perform function after Facebook share
Perform function after Facebook share
I was wonder if there was a way to confirm that a user has shared a post
from my website, I'm trying to have an email sent out to the user after
they share my post. The emails will all be collected from my site, not
from the facebook api. I just need to know if there is any way to call
back a confirmation on the sharing system.
<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
'facebook-share-dialog',
'width=626,height=436');
return false;">
Share on Facebook
</a>
I was wonder if there was a way to confirm that a user has shared a post
from my website, I'm trying to have an email sent out to the user after
they share my post. The emails will all be collected from my site, not
from the facebook api. I just need to know if there is any way to call
back a confirmation on the sharing system.
<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
'facebook-share-dialog',
'width=626,height=436');
return false;">
Share on Facebook
</a>
Internal server 500 error with 958 records (not maxRequestLength issue)
Internal server 500 error with 958 records (not maxRequestLength issue)
I have a System.Web.UI.WebControls.GridView control. This is running in an
ASP.Net SharePoint Web Part application using .Net 3.5.
On form submit, if this grid has 957 rows, it works fine. If it has 958
rows, it fails. I'm confident that this is not a maxRequestLength overflow
because I have changed that in web.config, and I've also loaded 957
records of large size, and then 958 records of a smaller size and the same
behavior occurs. It's not any one record either because I load more
records than that and then randomly eliminate them before returning the
view to the client (which is how I found the magic number of 958).
It's never random; 957 records will always submit no matter what the total
size and despite any delays while debugging (no timeout occurs). 958 will
always fail. The actual server error returned is:
Uncaught Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error
occurred while processing the request on the server. The status code
returned from the server was: 500
I am beyond stumped. Has anyone run into something like this before or
have any ideas?
I have a System.Web.UI.WebControls.GridView control. This is running in an
ASP.Net SharePoint Web Part application using .Net 3.5.
On form submit, if this grid has 957 rows, it works fine. If it has 958
rows, it fails. I'm confident that this is not a maxRequestLength overflow
because I have changed that in web.config, and I've also loaded 957
records of large size, and then 958 records of a smaller size and the same
behavior occurs. It's not any one record either because I load more
records than that and then randomly eliminate them before returning the
view to the client (which is how I found the magic number of 958).
It's never random; 957 records will always submit no matter what the total
size and despite any delays while debugging (no timeout occurs). 958 will
always fail. The actual server error returned is:
Uncaught Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error
occurred while processing the request on the server. The status code
returned from the server was: 500
I am beyond stumped. Has anyone run into something like this before or
have any ideas?
Events I add in Google Calendar are not appearing anywhere
Events I add in Google Calendar are not appearing anywhere
I've made a Google Calendar for my Google+ Group, and I'm simply trying to
add events to it.
I select a time, and edit the event, and save it, and when I return to the
main calendar interface, my event isn't there. I try looking at the day
view, week view, and month view, and my event doesn't show.
I've tried saving the event again, I've tried logging in and out, I've
tried hiding and unhiding the calendar... no matter what I do, the events
are not appearing.
Why are my events not showing up after being created, and how do I get
them to appear as they normally should?
I've made a Google Calendar for my Google+ Group, and I'm simply trying to
add events to it.
I select a time, and edit the event, and save it, and when I return to the
main calendar interface, my event isn't there. I try looking at the day
view, week view, and month view, and my event doesn't show.
I've tried saving the event again, I've tried logging in and out, I've
tried hiding and unhiding the calendar... no matter what I do, the events
are not appearing.
Why are my events not showing up after being created, and how do I get
them to appear as they normally should?
Python interval interesction
Python interval interesction
My problem is as follows:
having file with list of intervals:
1 5
2 8
9 12
20 30
And a range of
0 200
I would like to do such an intersection that will report the positions
[start end] between my intervals inside the given range.
Ex:
8 9
12 20
30 200
Beside any ideas how to bite this, would be also nice to read some
thoughts on optimization, since as always the input files are going to be
huge
Thanks, for the help o7
My problem is as follows:
having file with list of intervals:
1 5
2 8
9 12
20 30
And a range of
0 200
I would like to do such an intersection that will report the positions
[start end] between my intervals inside the given range.
Ex:
8 9
12 20
30 200
Beside any ideas how to bite this, would be also nice to read some
thoughts on optimization, since as always the input files are going to be
huge
Thanks, for the help o7
Thursday, 22 August 2013
Difference between == , = and eq
Difference between == , = and eq
I want to know the difference between these:
my $a = 1;
and
my $a == 1;
and
my $a eq 1;
I want to know the difference between these:
my $a = 1;
and
my $a == 1;
and
my $a eq 1;
Paid iPad version for iOS application
Paid iPad version for iOS application
I've been doing some research, but I couldn't find any useful information
for this question.
This is the thing:
I have a free app published on the iOS AppStore for seeing grades directly
from my University platform. I'm planning to enable in-app purchases for
downloading files from the platform and, also, for the iPad version (it's
only working on iPod Touch/iPhone for the moment).
Well, as I said, I want to charge a fee for enabling the iPad version. I
tried some things, including modifying the AppDelegate, with no success.
When I enable the MainStoryboard for iPad, iOS automatically takes it
instead of the iPhone one. I'd like the app to work with the iPhone
version of the Storyboard until the user pays for the iPad one.
Is this possible? How would you do it? Thank you.
I've been doing some research, but I couldn't find any useful information
for this question.
This is the thing:
I have a free app published on the iOS AppStore for seeing grades directly
from my University platform. I'm planning to enable in-app purchases for
downloading files from the platform and, also, for the iPad version (it's
only working on iPod Touch/iPhone for the moment).
Well, as I said, I want to charge a fee for enabling the iPad version. I
tried some things, including modifying the AppDelegate, with no success.
When I enable the MainStoryboard for iPad, iOS automatically takes it
instead of the iPhone one. I'd like the app to work with the iPhone
version of the Storyboard until the user pays for the iPad one.
Is this possible? How would you do it? Thank you.
How to change this in object?
How to change this in object?
How to create method twice? I can't understand how to change this in body
of function. Why it doesn't work?
function twice() {
var buf = [];<br/>
for ( var i = 0; i < this.length; i++ ) {
buf.push(this[i]);
}
for ( var i = 0; i < this.length; i++ ) {
buf.push(this[i]);
}
this = buf;
}
Array.prototype.twice = twice;
a = [1,2,3];
a.twice();
a; // [1,2,3,1,2,3]
How to create method twice? I can't understand how to change this in body
of function. Why it doesn't work?
function twice() {
var buf = [];<br/>
for ( var i = 0; i < this.length; i++ ) {
buf.push(this[i]);
}
for ( var i = 0; i < this.length; i++ ) {
buf.push(this[i]);
}
this = buf;
}
Array.prototype.twice = twice;
a = [1,2,3];
a.twice();
a; // [1,2,3,1,2,3]
Revisit the ordering in factor
Revisit the ordering in factor
I have read the SO thread: Reorder levels of a data frame without changing
order of values, which works fine. However, on the particular use case, I
am puzzled on the output:
> df$mode
[1] write read write_with_journal write
read write_with_journal
[7] write read write_with_journal
Levels: read write write_with_journal
Now, I am changing the factor order from "read write write_with_journal"
to "write read write_with_journal":
> factor(df$mode, levels = c('write', 'read', 'write_with_journal'))
[1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
Levels: write read write_with_journal
Notice all the previous category values "write", "read" etc. are replaced
with NA. I am not sure why this is happening. If I manually create the
data frame (instead of reading from a file), then everything is fine.
> p = factor(rep(c("write", "read", "write_with_journal"),3))
> factor(p, levels = c('write', 'read', 'write_with_journal'))
Then everything is fine. Why?
I have read the SO thread: Reorder levels of a data frame without changing
order of values, which works fine. However, on the particular use case, I
am puzzled on the output:
> df$mode
[1] write read write_with_journal write
read write_with_journal
[7] write read write_with_journal
Levels: read write write_with_journal
Now, I am changing the factor order from "read write write_with_journal"
to "write read write_with_journal":
> factor(df$mode, levels = c('write', 'read', 'write_with_journal'))
[1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
Levels: write read write_with_journal
Notice all the previous category values "write", "read" etc. are replaced
with NA. I am not sure why this is happening. If I manually create the
data frame (instead of reading from a file), then everything is fine.
> p = factor(rep(c("write", "read", "write_with_journal"),3))
> factor(p, levels = c('write', 'read', 'write_with_journal'))
Then everything is fine. Why?
Grid and Block dimension in (py)CUDA
Grid and Block dimension in (py)CUDA
I got a question regarding the dimensions of the blocks and grids in
(py)CUDA. I know that there are limits in the total size of the blocks,
but not of the grids
And that the actual blocksize influences the runtime. But what I'm
wondering about is: Does it make a difference if I have a block of 256
threads, to start it like (256,1) or to start it like (128,2), like (64,4)
etc.
If it makes a difference: which is the fastest?
Cheers, Andi
I got a question regarding the dimensions of the blocks and grids in
(py)CUDA. I know that there are limits in the total size of the blocks,
but not of the grids
And that the actual blocksize influences the runtime. But what I'm
wondering about is: Does it make a difference if I have a block of 256
threads, to start it like (256,1) or to start it like (128,2), like (64,4)
etc.
If it makes a difference: which is the fastest?
Cheers, Andi
PHP and mysql charset issue
PHP and mysql charset issue
Ok, hang on with me. I am really bad at this. I have received little help
from friend who knows some coding but is not available atm.
I have mysql database which contains data stored in UTF8_general_ci
Then in wordpress I have page which calls file number 1, haku.php.
Contents below:
<?php
$result = mysql_query("SELECT DISTINCT jalleenmyyja_postitp FROM
jalleenmyyjat order by jalleenmyyja_postitp");
while($r = mysql_fetch_array($result)){
if ($r["jalleenmyyja_postitp"] != "")echo '<option
value="'.$r["jalleenmyyja_postitp"] .'">'. $r["jalleenmyyja_postitp"]
.'</option>';
}
?>
Those are then put inside dropdown menu. So far so good. Then when some
selection is done in dropdown, it should return results below which it
does by file number 2 which is JS below:
function haeyritys(x){
jQuery.ajax({
type: "POST",
url: "/yrityshaku.php",
data: "kaupunki=" + x,
success: function(data){
document.getElementById('selResult').innerHTML=data;
}
});
}
Then after this the file number 3. returns the data from database.
if($_REQUEST["kaupunki"] !=""){
$con = mysql_connect($host, $user, $pass);
mysql_select_db($db_name);
$result = mysql_query("select * from jalleenmyyjat where
jalleenmyyja_postitp = '" . utf8_decode($_REQUEST["kaupunki"]) ."'
order by jalleenmyyja_nimi");
if (mysql_num_rows($result) == 0){
echo '<div style="border-bottom:1px solid
#ccc;padding:5px;"><b>Ei tuloksia...</b>';
}else{
while($r = mysql_fetch_array($result)){
if ($r["google"] != ""){echo '<a
onclick="location.href=\'#top\'" href="'. $r["google"] .'"
target="map">';}else{echo '<a onclick="location.href=\'#top\'"
href="/eikarttaa.html" target="map">';}
echo '<div style="border-bottom:1px solid
#ccc;padding:5px;"><b>' . $r["jalleenmyyja_nimi"] . '</b>';
if ($r["jalleenmyyja_osoite"] != "")echo '<br>' .
$r["jalleenmyyja_osoite"];
if ($r["jalleenmyyja_postino"] !="" ||
$r["jalleenmyyja_postitp"] !="")echo "<br/>" .
$r["jalleenmyyja_postino"] . " ". $r["jalleenmyyja_postitp"];
if ($r["jalleenmyyja_puh"] != "") echo "<br/>Puh: ".
$r["jalleenmyyja_puh"];
if ($r["www"] != "")echo '<br/><a target="_blank"
href="'.$r["www"].'">Verkkosivuille »</a>';
echo '</div>';
echo '</a>';
}
}
mysql_close($con);
}
?>
However, the foreign characters are question marks. If I add
mysql_set_charset('utf8'); to file number 3 which opens the database
connection, the results show symbols correctly but the data in dropdown
which could have the symbol, does not return results! so it's one way or
the other.
Ok, hang on with me. I am really bad at this. I have received little help
from friend who knows some coding but is not available atm.
I have mysql database which contains data stored in UTF8_general_ci
Then in wordpress I have page which calls file number 1, haku.php.
Contents below:
<?php
$result = mysql_query("SELECT DISTINCT jalleenmyyja_postitp FROM
jalleenmyyjat order by jalleenmyyja_postitp");
while($r = mysql_fetch_array($result)){
if ($r["jalleenmyyja_postitp"] != "")echo '<option
value="'.$r["jalleenmyyja_postitp"] .'">'. $r["jalleenmyyja_postitp"]
.'</option>';
}
?>
Those are then put inside dropdown menu. So far so good. Then when some
selection is done in dropdown, it should return results below which it
does by file number 2 which is JS below:
function haeyritys(x){
jQuery.ajax({
type: "POST",
url: "/yrityshaku.php",
data: "kaupunki=" + x,
success: function(data){
document.getElementById('selResult').innerHTML=data;
}
});
}
Then after this the file number 3. returns the data from database.
if($_REQUEST["kaupunki"] !=""){
$con = mysql_connect($host, $user, $pass);
mysql_select_db($db_name);
$result = mysql_query("select * from jalleenmyyjat where
jalleenmyyja_postitp = '" . utf8_decode($_REQUEST["kaupunki"]) ."'
order by jalleenmyyja_nimi");
if (mysql_num_rows($result) == 0){
echo '<div style="border-bottom:1px solid
#ccc;padding:5px;"><b>Ei tuloksia...</b>';
}else{
while($r = mysql_fetch_array($result)){
if ($r["google"] != ""){echo '<a
onclick="location.href=\'#top\'" href="'. $r["google"] .'"
target="map">';}else{echo '<a onclick="location.href=\'#top\'"
href="/eikarttaa.html" target="map">';}
echo '<div style="border-bottom:1px solid
#ccc;padding:5px;"><b>' . $r["jalleenmyyja_nimi"] . '</b>';
if ($r["jalleenmyyja_osoite"] != "")echo '<br>' .
$r["jalleenmyyja_osoite"];
if ($r["jalleenmyyja_postino"] !="" ||
$r["jalleenmyyja_postitp"] !="")echo "<br/>" .
$r["jalleenmyyja_postino"] . " ". $r["jalleenmyyja_postitp"];
if ($r["jalleenmyyja_puh"] != "") echo "<br/>Puh: ".
$r["jalleenmyyja_puh"];
if ($r["www"] != "")echo '<br/><a target="_blank"
href="'.$r["www"].'">Verkkosivuille »</a>';
echo '</div>';
echo '</a>';
}
}
mysql_close($con);
}
?>
However, the foreign characters are question marks. If I add
mysql_set_charset('utf8'); to file number 3 which opens the database
connection, the results show symbols correctly but the data in dropdown
which could have the symbol, does not return results! so it's one way or
the other.
Form submission in ie
Form submission in ie
I used e.preventDefault(); to stop form submission, but it is not working
in IE.
$(document).ready(function () {
$("form").submit(function (e) {
e.preventDefault();
$.ajax({
..........
});
});
});
I used e.preventDefault(); to stop form submission, but it is not working
in IE.
$(document).ready(function () {
$("form").submit(function (e) {
e.preventDefault();
$.ajax({
..........
});
});
});
Wednesday, 21 August 2013
Android Drag Sort ListView with SharedPreference
Android Drag Sort ListView with SharedPreference
So I'm using this library Drag-Sort Listview in my program
My problem now is that this program never save the instance so I'm
planning to use Sharedpreference to save the list and load them when the
program start but my problem is I dont know how to implement it I hope you
can help me guys. :)
This is my Code
MainActivity.java
private SimpleDragSortCursorAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] cols = {"name"};
int[] ids = {R.id.text};
adapter = new MAdapter(this,
R.layout.list_item_click_remove, null, cols, ids, 0);
DragSortListView dslv = (DragSortListView)
findViewById(android.R.id.list);
dslv.setAdapter(adapter);
// build a cursor from the String array
MatrixCursor cursor = new MatrixCursor(new String[] {"_id", "name"});
String[] artistNames =
getResources().getStringArray(R.array.jazz_artist_names);
for (int i = 0; i < artistNames.length; i++) {
cursor.newRow()
.add(i)
.add(artistNames[i]);
}
adapter.changeCursor(cursor);
}
private class MAdapter extends SimpleDragSortCursorAdapter {
private Context mContext;
public MAdapter(Context ctxt, int rmid, Cursor c, String[] cols, int[]
ids, int something) {
super(ctxt, rmid, c, cols, ids, something);
mContext = ctxt;
}
@Override
public View getView(final int position, final View convertView,
ViewGroup parent) {
View v = super.getView(position, convertView, parent);
final View tv = v.findViewById(R.id.text);
final String s =(String) ((TextView)
v.findViewById(R.id.text)).getText();
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(mContext,""+s, Toast.LENGTH_SHORT).show();
}
});
return v;
}
}
So I'm using this library Drag-Sort Listview in my program
My problem now is that this program never save the instance so I'm
planning to use Sharedpreference to save the list and load them when the
program start but my problem is I dont know how to implement it I hope you
can help me guys. :)
This is my Code
MainActivity.java
private SimpleDragSortCursorAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] cols = {"name"};
int[] ids = {R.id.text};
adapter = new MAdapter(this,
R.layout.list_item_click_remove, null, cols, ids, 0);
DragSortListView dslv = (DragSortListView)
findViewById(android.R.id.list);
dslv.setAdapter(adapter);
// build a cursor from the String array
MatrixCursor cursor = new MatrixCursor(new String[] {"_id", "name"});
String[] artistNames =
getResources().getStringArray(R.array.jazz_artist_names);
for (int i = 0; i < artistNames.length; i++) {
cursor.newRow()
.add(i)
.add(artistNames[i]);
}
adapter.changeCursor(cursor);
}
private class MAdapter extends SimpleDragSortCursorAdapter {
private Context mContext;
public MAdapter(Context ctxt, int rmid, Cursor c, String[] cols, int[]
ids, int something) {
super(ctxt, rmid, c, cols, ids, something);
mContext = ctxt;
}
@Override
public View getView(final int position, final View convertView,
ViewGroup parent) {
View v = super.getView(position, convertView, parent);
final View tv = v.findViewById(R.id.text);
final String s =(String) ((TextView)
v.findViewById(R.id.text)).getText();
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(mContext,""+s, Toast.LENGTH_SHORT).show();
}
});
return v;
}
}
How to execute methods after an exception is thrown
How to execute methods after an exception is thrown
How to execute the add() method in the program below
class ExceptionHandlingImpl
{
static void divide()
{
try
{
double a= 1/0;
}
catch(Exception e)
{
throw e;
}
}
static void add()
{
int a=20,b=30,c;
c=ab+b;
System.out.println(c);
}
public static void main(String args[])
{
divide();
add();
}
}
Why does the method add() doesn't execute when I give throw statement in
the divide() method. The add() method execute fine when throw is
commented.Is there anyway such that the exception is also thrown using
throw and the method succeeding it also gets executed.
How to execute the add() method in the program below
class ExceptionHandlingImpl
{
static void divide()
{
try
{
double a= 1/0;
}
catch(Exception e)
{
throw e;
}
}
static void add()
{
int a=20,b=30,c;
c=ab+b;
System.out.println(c);
}
public static void main(String args[])
{
divide();
add();
}
}
Why does the method add() doesn't execute when I give throw statement in
the divide() method. The add() method execute fine when throw is
commented.Is there anyway such that the exception is also thrown using
throw and the method succeeding it also gets executed.
Bootstrap 3 Glyphicons not working
Bootstrap 3 Glyphicons not working
I downloaded the FINAL bootstrap 3.0 and can't get the glyphicons to work.
I get somekind of E003 error. Any ideas why this is happening? I tried
both locally and online and I still get the same problem..
I downloaded the FINAL bootstrap 3.0 and can't get the glyphicons to work.
I get somekind of E003 error. Any ideas why this is happening? I tried
both locally and online and I still get the same problem..
Can I make this work? Instantiating new arrays with class calls
Can I make this work? Instantiating new arrays with class calls
I am trying to make my own class where one of the parameters is an array.
public class Node {
int i;
String title;
int[] links;
Node(int i, String title, int[] links){
this.i = i;
this.title = title;
this.links = links;
}
}
Can I make this work? I want to call it by doing something like Node(4,
"Title", [1,2,3])
I am trying to make my own class where one of the parameters is an array.
public class Node {
int i;
String title;
int[] links;
Node(int i, String title, int[] links){
this.i = i;
this.title = title;
this.links = links;
}
}
Can I make this work? I want to call it by doing something like Node(4,
"Title", [1,2,3])
Inserting data using Linq C# with MVC 3 Architecture in asp.net
Inserting data using Linq C# with MVC 3 Architecture in asp.net
I m inserting data using controller,
SignUpcontroller.cs
[HttpPost]
public ActionResult Index(SignUpModel sm)
{
using(DataClassesDataContext dc= new DataClassesDataContext())
{
Dummytable dm= new Dummytable();
{
dm.Name=sm.password;
}
//then conncetion string and submit
}
}
and redirection
My question is, is it correct to write this code in the controller module
or do i need to write it in models module, if i need to write it in models
module then how to define the setter help me out
I m inserting data using controller,
SignUpcontroller.cs
[HttpPost]
public ActionResult Index(SignUpModel sm)
{
using(DataClassesDataContext dc= new DataClassesDataContext())
{
Dummytable dm= new Dummytable();
{
dm.Name=sm.password;
}
//then conncetion string and submit
}
}
and redirection
My question is, is it correct to write this code in the controller module
or do i need to write it in models module, if i need to write it in models
module then how to define the setter help me out
Save data on click of PRINT and Print it later
Save data on click of PRINT and Print it later
I am developing window form application in c#. In that app, I have 20 i/p
and 20 o/p forms. So in each 20 o/p form, i have print button. Right Now,
when i click on print it will print document. But I don't want to do that.
I need some functionality so that when i click on print button on each n
every page, it will store data in some memory. And then i will put button
as 'PRINT ALL'. So it will print all form's output.
Don't have any idea how to achieve this functionality.? Please help me.
Thanks, Prashant
I am developing window form application in c#. In that app, I have 20 i/p
and 20 o/p forms. So in each 20 o/p form, i have print button. Right Now,
when i click on print it will print document. But I don't want to do that.
I need some functionality so that when i click on print button on each n
every page, it will store data in some memory. And then i will put button
as 'PRINT ALL'. So it will print all form's output.
Don't have any idea how to achieve this functionality.? Please help me.
Thanks, Prashant
dateFrom String returns incorrect date
dateFrom String returns incorrect date
I have been struggling to figure out why dateFromString method returns
wrong date. Here is the code.
NSDate *secondDate = [df dateFromString:@"12.31.9999"];
and the out put for it is as below.
1999-12-31 07:00:00 +0000
Please need help. Is it the problem with the method?? The same works fine
in iOS5. The issues is only in iOS6.
Thanks
I have been struggling to figure out why dateFromString method returns
wrong date. Here is the code.
NSDate *secondDate = [df dateFromString:@"12.31.9999"];
and the out put for it is as below.
1999-12-31 07:00:00 +0000
Please need help. Is it the problem with the method?? The same works fine
in iOS5. The issues is only in iOS6.
Thanks
Tuesday, 20 August 2013
Table with different amount of rows(diff. width) and columns(Qt5, QGridLayout)
Table with different amount of rows(diff. width) and columns(Qt5,
QGridLayout)
I want create a Table based on QGridLayout that consist my custom widgets
with different amount of columns in each row, for example:
http://urls.by/tbl
How i can do it?
When i change widgets width in first row, another rows also change width.
QGridLayout)
I want create a Table based on QGridLayout that consist my custom widgets
with different amount of columns in each row, for example:
http://urls.by/tbl
How i can do it?
When i change widgets width in first row, another rows also change width.
get webpages from command line
get webpages from command line
How can I get the contents of a webpage from the command line? On my mac I
use the curl command, but there is no such command for the android command
line. what command do I use?
How can I get the contents of a webpage from the command line? On my mac I
use the curl command, but there is no such command for the android command
line. what command do I use?
Why do most U.S. students drop out? Because of math. [on hold]
Why do most U.S. students drop out? Because of math. [on hold]
Math is not a uniform system capable of making sense to everyone,
therefore, you must be barred from society if you fail it.
Math, to say the least, is the reason for thousands of deaths daily.
Math is not a uniform system capable of making sense to everyone,
therefore, you must be barred from society if you fail it.
Math, to say the least, is the reason for thousands of deaths daily.
Load Data on listview-scroll
Load Data on listview-scroll
relating (or lets say due to) to the following topic i am able to handle
the scrolling-event in my ListView: how to make scroll event for listview
In my case i will need this to display about 60k rows on a single page
without using pagination to reduce performance impacts.
My question now is: What would be the best way to handle this / to load my
data dynamically once the scroll event triggers...?
At the moment i am loading about 100 rows on programm-start and add one
row on each scroll-trigger. In the background i am using a simple
LIMIT-SQL stagement.
To be honest this doesn't look very well (you actual can see something is
beeing loaded so it's not smooth) and sometimes it seems to cause some
access validation errors.
So what would be the generel idea to do such things? I might need some
shove in the right direction :-)
Thanks for your assistance.
Best regards Teyhouse
relating (or lets say due to) to the following topic i am able to handle
the scrolling-event in my ListView: how to make scroll event for listview
In my case i will need this to display about 60k rows on a single page
without using pagination to reduce performance impacts.
My question now is: What would be the best way to handle this / to load my
data dynamically once the scroll event triggers...?
At the moment i am loading about 100 rows on programm-start and add one
row on each scroll-trigger. In the background i am using a simple
LIMIT-SQL stagement.
To be honest this doesn't look very well (you actual can see something is
beeing loaded so it's not smooth) and sometimes it seems to cause some
access validation errors.
So what would be the generel idea to do such things? I might need some
shove in the right direction :-)
Thanks for your assistance.
Best regards Teyhouse
java string format method
java string format method
What I want to do is getting the first 2 digits of a number. If number
hasn't digits more than 1 then It will add leading zeros.
s variable equals to "122" but I want to get first 2 digits which are
"12". I think there is a problem with my format.
int totalNumberOfCars = 122; String s = String.format("%02d",
(totalNumberOfCars + 1)
What I want to do is getting the first 2 digits of a number. If number
hasn't digits more than 1 then It will add leading zeros.
s variable equals to "122" but I want to get first 2 digits which are
"12". I think there is a problem with my format.
int totalNumberOfCars = 122; String s = String.format("%02d",
(totalNumberOfCars + 1)
FireFox Image Printing Issue
FireFox Image Printing Issue
I have the following code which prints any HTML loaded in to popup window.
I am printing multiple invoices at once using the following code. As you
could see in the code, when the window is opened the print window is also
opened. The HTML is the 'content' parameter.
function( content ){
var invoice_window = window.open( '', 'print',
'width=500,height=400,fullscreen=0,location=0,menubar=1,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0'
);
invoice_window.document.body.innerHTML = content;
invoice_window.print();
invoice_window.close();
}
The HTML content included some images (not background images) as well.
This is working as expected in IE, but not in FireFox. The problem in FF
is the images are not printing, just the 'alt' attribute value is printing
in the image area.
Things I have tested so far;
I commented out invoice_window.close();Then, I can print the page (the
window opened with the HTML content) using the browser's (FireFox) print
option. Then, the images are printing in FF.
Any help would be much appreciated. I thank you in advance.
I have the following code which prints any HTML loaded in to popup window.
I am printing multiple invoices at once using the following code. As you
could see in the code, when the window is opened the print window is also
opened. The HTML is the 'content' parameter.
function( content ){
var invoice_window = window.open( '', 'print',
'width=500,height=400,fullscreen=0,location=0,menubar=1,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0'
);
invoice_window.document.body.innerHTML = content;
invoice_window.print();
invoice_window.close();
}
The HTML content included some images (not background images) as well.
This is working as expected in IE, but not in FireFox. The problem in FF
is the images are not printing, just the 'alt' attribute value is printing
in the image area.
Things I have tested so far;
I commented out invoice_window.close();Then, I can print the page (the
window opened with the HTML content) using the browser's (FireFox) print
option. Then, the images are printing in FF.
Any help would be much appreciated. I thank you in advance.
Monday, 19 August 2013
Ubuntu not booting on a new machine
Ubuntu not booting on a new machine
Hi I have just installed ubuntu 12.04 to a new machine with dos. After
complete installation my system is not booting and is showing a completely
blank screen and a blinking cursor
The spec of the machine is ASUS X55C with intel pentium 2020M, 2.4 ghz,
2GB ram, 500gb hdd and Free DOS OS.
Hi I have just installed ubuntu 12.04 to a new machine with dos. After
complete installation my system is not booting and is showing a completely
blank screen and a blinking cursor
The spec of the machine is ASUS X55C with intel pentium 2020M, 2.4 ghz,
2GB ram, 500gb hdd and Free DOS OS.
Open Street Map Address Decode
Open Street Map Address Decode
I am using Nominatim reverse geocoding service to get address from
latitude and longitude. Then, store the result in Mysql Database. The
coding is as fiddle below:
http://jsfiddle.net/GWL7A/171/
The address returned is in the local language such as in the example is in
Chinese. And the data stored is not readable as:
"éº'麟山新æ', æƒ æ¥å¿, 广东, ä¸å人æ°'å…±å'Œå›½/China"
Is that possible to make the address returned in English.
If that's not possible, how to store the data into database so that when
retrieve it and show in web UI, it returned to Chinese words? It must not
be limit to only Chinese word since it might be Afghanistan, Thailand,
Vietnam or some other country's addresses.
Thank you.
I am using Nominatim reverse geocoding service to get address from
latitude and longitude. Then, store the result in Mysql Database. The
coding is as fiddle below:
http://jsfiddle.net/GWL7A/171/
The address returned is in the local language such as in the example is in
Chinese. And the data stored is not readable as:
"éº'麟山新æ', æƒ æ¥å¿, 广东, ä¸å人æ°'å…±å'Œå›½/China"
Is that possible to make the address returned in English.
If that's not possible, how to store the data into database so that when
retrieve it and show in web UI, it returned to Chinese words? It must not
be limit to only Chinese word since it might be Afghanistan, Thailand,
Vietnam or some other country's addresses.
Thank you.
Encryption of .csv files
Encryption of .csv files
I'm working for a client who is collecting sensitive data from clients via
Wufoo forms embedded on their website. They have dozens of unique forms
and for simplicity, I have written a script with the API to grab all the
data simultaneously and output it as .csv files on their server.
A concern has been raised about the security of this information. Wufoo
encrypts all of their data with 128 bit SSL, but once the data leaves
Wufoo's servers, the responsibility is on me to make sure it's still
secure.
I've never worked with any kind of secure information and really have no
idea where to start in this process. I'm looking for any kind of advice,
or to be pointed in the direction of further information on this topic.
Ideally, the process of collecting and outputting data would function the
same, just in a more secure way, but maybe this requires an entire
reworking of the system? Again, any advice is appreciated.
I'm working for a client who is collecting sensitive data from clients via
Wufoo forms embedded on their website. They have dozens of unique forms
and for simplicity, I have written a script with the API to grab all the
data simultaneously and output it as .csv files on their server.
A concern has been raised about the security of this information. Wufoo
encrypts all of their data with 128 bit SSL, but once the data leaves
Wufoo's servers, the responsibility is on me to make sure it's still
secure.
I've never worked with any kind of secure information and really have no
idea where to start in this process. I'm looking for any kind of advice,
or to be pointed in the direction of further information on this topic.
Ideally, the process of collecting and outputting data would function the
same, just in a more secure way, but maybe this requires an entire
reworking of the system? Again, any advice is appreciated.
Impossible to install Ubuntu 13.04
Impossible to install Ubuntu 13.04
I know there are many questions like this but didn't found any answer.
I'm trying to install Ubuntu 13.04 on my Toshiba c855-233 alongside
Windows 8.
It has UEFI and SecureBoot (the latter can be disabled but it ends with
the same result).
I tried with two different USB flash drives and the result is the same.
I set up the bios to boot from USB and I directly get to the grub menu, it
never shows options about UEFI
For example something like this is never shown:
That as mentioned here (Installing Ubuntu on a Pre-Installed Windows 8
(64-bit) System (UEFI Supported)) should be shwon on boot.
Instead I get directly to the Grub options, and whatever I select I get
something similar to that (with the screen flashing): .
I think, but I have no clue, that t may be a graphic problem since in the
flashing screen a really small strip in the top of the screen seems to be
"working" (not flashing).
The graphic card is an AMD Radeon™ HD 7610M Graphics (1GB dedicated memory).
I know there are many questions like this but didn't found any answer.
I'm trying to install Ubuntu 13.04 on my Toshiba c855-233 alongside
Windows 8.
It has UEFI and SecureBoot (the latter can be disabled but it ends with
the same result).
I tried with two different USB flash drives and the result is the same.
I set up the bios to boot from USB and I directly get to the grub menu, it
never shows options about UEFI
For example something like this is never shown:
That as mentioned here (Installing Ubuntu on a Pre-Installed Windows 8
(64-bit) System (UEFI Supported)) should be shwon on boot.
Instead I get directly to the Grub options, and whatever I select I get
something similar to that (with the screen flashing): .
I think, but I have no clue, that t may be a graphic problem since in the
flashing screen a really small strip in the top of the screen seems to be
"working" (not flashing).
The graphic card is an AMD Radeon™ HD 7610M Graphics (1GB dedicated memory).
Sunday, 18 August 2013
How to show facebook login screen in my app?
How to show facebook login screen in my app?
In my app i gave options to user to login by using facebook application.
I am using graphic api for this it is working fine,
My problem is ,when user click facebook login icon,the login screen is
opened like a dialog.
But i want to open like full login screen,like a facebook app login screen.
Through that i want get facebook login user details.
in myapp login screen is look like
But i want to login screen should be like this
If any one know the solution,please help me.
Thanks in advance.
In my app i gave options to user to login by using facebook application.
I am using graphic api for this it is working fine,
My problem is ,when user click facebook login icon,the login screen is
opened like a dialog.
But i want to open like full login screen,like a facebook app login screen.
Through that i want get facebook login user details.
in myapp login screen is look like
But i want to login screen should be like this
If any one know the solution,please help me.
Thanks in advance.
Open external links in new tab using query
Open external links in new tab using query
how can one write a Javascript script to open all external links in a new
tab/window?
local links and relevant once should still use the default behavior and
open in same tab?
how can one write a Javascript script to open all external links in a new
tab/window?
local links and relevant once should still use the default behavior and
open in same tab?
Generate download links for all text files in folder on the server with PHP
Generate download links for all text files in folder on the server with PHP
I have like 30 to 40 text files in a folder on a server. Now I want PHP
generate a list with download links of the files in a HTML website. So if
there is another textfile uploaded on the server it automatically adds a
download link at the top of the list.
I have like 30 to 40 text files in a folder on a server. Now I want PHP
generate a list with download links of the files in a HTML website. So if
there is another textfile uploaded on the server it automatically adds a
download link at the top of the list.
What's the proper lib variable for a makefile?
What's the proper lib variable for a makefile?
Running into trouble with libraries in makefiles again. Every time I try
to get back into C make gives me a pain with libs.
make -pf /dev/null says the correct vars should be LDLIBS and LOADLIBES
but the following doesn't alter the run command at all:
LOADLIBES=testing
LDFLAGS=testing
LDLIBS=testing
Anyone know what's going on?
Full makefile below (Derivitave of Z Shaw's makefile)
OPTLIBS=$(xml2-config --libs)
OPTFLAGS=$(xml2-config --cflags)
STD=c99
CFLAGS=-std=$(STD) -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
LDLIBS=-ldl $(OPTLIBS)
PREFIX?=/usr/local
SOURCES=$(wildcard src/**/*.c src/*.c)
OBJECTS=$(patsubst %.c,%.o,$(SOURCES))
TEST_SRC=$(wildcard tests/*_tests.c)
TESTS=$(patsubst %.c,%,$(TEST_SRC))
TARGET=build/lib.a
SO_TARGET=$(patsubst %.a,%.so,$(TARGET))
# The Target Build
all: cls $(TARGET) $(SO_TARGET) tests
dev: CFLAGS=-std=$(STD) -g -Wall -Isrc -Wall -Wextra $(OPTFLAGS)
dev: all
$(TARGET): CFLAGS += -fPIC
$(TARGET): build $(OBJECTS)
ar rcs $@ $(OBJECTS)
ranlib $@
$(SO_TARGET): $(TARGET) $(OBJECTS)
$(CC) -shared -o $@ $(OBJECTS)
build:
@mkdir -p build
@mkdir -p bin
# The Unit Tests
$(TESTS): $(TARGET)
.PHONY: tests
tests: LDLIBS += $(TARGET)
tests: $(TESTS)
sh ./tests/runtests.sh
valgrind:
VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE)
# The Cleaner
clean: cls
rm -rf build $(OBJECTS) $(TESTS)
rm -f tests/tests.log
find . -name "*.gc*" -exec rm {} \;
rm -rf `find . -name "*.dSYM" -print`
# The Install
install: all
install -d $(DESTDIR)/$(PREFIX)/lib/
install $(TARGET) $(DESTDIR)/$(PREFIX)/lib/
# The Checker
BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)'
check:
@echo Files with potentially dangerous functions.
@egrep $(BADFUNCS) $(SOURCES) || true
# Clear screen for unspammy terminals
cls:
ifdef TERM
clear
endif
Running into trouble with libraries in makefiles again. Every time I try
to get back into C make gives me a pain with libs.
make -pf /dev/null says the correct vars should be LDLIBS and LOADLIBES
but the following doesn't alter the run command at all:
LOADLIBES=testing
LDFLAGS=testing
LDLIBS=testing
Anyone know what's going on?
Full makefile below (Derivitave of Z Shaw's makefile)
OPTLIBS=$(xml2-config --libs)
OPTFLAGS=$(xml2-config --cflags)
STD=c99
CFLAGS=-std=$(STD) -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
LDLIBS=-ldl $(OPTLIBS)
PREFIX?=/usr/local
SOURCES=$(wildcard src/**/*.c src/*.c)
OBJECTS=$(patsubst %.c,%.o,$(SOURCES))
TEST_SRC=$(wildcard tests/*_tests.c)
TESTS=$(patsubst %.c,%,$(TEST_SRC))
TARGET=build/lib.a
SO_TARGET=$(patsubst %.a,%.so,$(TARGET))
# The Target Build
all: cls $(TARGET) $(SO_TARGET) tests
dev: CFLAGS=-std=$(STD) -g -Wall -Isrc -Wall -Wextra $(OPTFLAGS)
dev: all
$(TARGET): CFLAGS += -fPIC
$(TARGET): build $(OBJECTS)
ar rcs $@ $(OBJECTS)
ranlib $@
$(SO_TARGET): $(TARGET) $(OBJECTS)
$(CC) -shared -o $@ $(OBJECTS)
build:
@mkdir -p build
@mkdir -p bin
# The Unit Tests
$(TESTS): $(TARGET)
.PHONY: tests
tests: LDLIBS += $(TARGET)
tests: $(TESTS)
sh ./tests/runtests.sh
valgrind:
VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE)
# The Cleaner
clean: cls
rm -rf build $(OBJECTS) $(TESTS)
rm -f tests/tests.log
find . -name "*.gc*" -exec rm {} \;
rm -rf `find . -name "*.dSYM" -print`
# The Install
install: all
install -d $(DESTDIR)/$(PREFIX)/lib/
install $(TARGET) $(DESTDIR)/$(PREFIX)/lib/
# The Checker
BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)'
check:
@echo Files with potentially dangerous functions.
@egrep $(BADFUNCS) $(SOURCES) || true
# Clear screen for unspammy terminals
cls:
ifdef TERM
clear
endif
Why simply use PHP variables for dynamic stylesheets?
Why simply use PHP variables for dynamic stylesheets?
I've been reading about dynamic stylesheets and have stumbled across
several options, including sass, and less. But my question is why not just
turn my stylesheet.css into stylesheet.css.php and simply use php
variables. Then, I avoid all the dependency issues associated with all
these other approaches.
Am I overlooking some serious problems by doing it this way?
I've been reading about dynamic stylesheets and have stumbled across
several options, including sass, and less. But my question is why not just
turn my stylesheet.css into stylesheet.css.php and simply use php
variables. Then, I avoid all the dependency issues associated with all
these other approaches.
Am I overlooking some serious problems by doing it this way?
Edit text gains null value on focus
Edit text gains null value on focus
I have certain edit text fields. My problem is when a certain edit text is
focused it gains a null value ie:-0,0.0 even before I enter values. I want
it to be blank. I have tried setting them as Et.setText("") but nothing
seems to work. I have tried hint too but that just remains when the
activity comes in focus, once i tap the edit field the same problem
occurs. Iam trying to crack this since long.
Kindly help, Thank you
I have certain edit text fields. My problem is when a certain edit text is
focused it gains a null value ie:-0,0.0 even before I enter values. I want
it to be blank. I have tried setting them as Et.setText("") but nothing
seems to work. I have tried hint too but that just remains when the
activity comes in focus, once i tap the edit field the same problem
occurs. Iam trying to crack this since long.
Kindly help, Thank you
Broadcast receiver for GPS provider disabled only
Broadcast receiver for GPS provider disabled only
am currently using bestprovider() where android itself chooses best
provider based on my criteria, every thing is fine but this location
update is done using service so how can I notify user
when GPS is disabled show location settings to user to enable GPS
when internet is disabled show Mobile network settings to user to enable
internet.
I have done this when I was receiving location updates using activity, but
now am using service and if I use same method the app is crashing.
/*----------Method to create an AlertBox ------------- */
protected void alertbox(String title, String mymessage) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Your Device's GPS is Disabled")
.setCancelable(false)
.setTitle(" Gps Status")
.setPositiveButton("Gps On",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// finish the current activity
// AlertBoxAdvance.this.finish();
Intent myIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
dialog.cancel();
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// cancel the dialog box
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
calling the above as this when GPS is off alertbox("Gps Status!!", "Your
GPS is: OFF");
But this is giving me error when I call this from service? why? what I
should do to have alert from service or notify activity and then call this
method from activity?
am currently using bestprovider() where android itself chooses best
provider based on my criteria, every thing is fine but this location
update is done using service so how can I notify user
when GPS is disabled show location settings to user to enable GPS
when internet is disabled show Mobile network settings to user to enable
internet.
I have done this when I was receiving location updates using activity, but
now am using service and if I use same method the app is crashing.
/*----------Method to create an AlertBox ------------- */
protected void alertbox(String title, String mymessage) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Your Device's GPS is Disabled")
.setCancelable(false)
.setTitle(" Gps Status")
.setPositiveButton("Gps On",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// finish the current activity
// AlertBoxAdvance.this.finish();
Intent myIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
dialog.cancel();
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// cancel the dialog box
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
calling the above as this when GPS is off alertbox("Gps Status!!", "Your
GPS is: OFF");
But this is giving me error when I call this from service? why? what I
should do to have alert from service or notify activity and then call this
method from activity?
Saturday, 17 August 2013
DSL vs Cable internet?
DSL vs Cable internet?
So I am not quite sure of the differences. I have read that DSL is fed
into the home via the phone line, and cable is, of course, through the
cable jacks. I currently have a 30Mbps cable connection but am forced to
downgrade to a 6Mbps connection due to the service not being available
where I am moving.
What are the main differences? For example, as I said I have a 30Mbps
connection now that costs $30/mo, but the 6Mbps DSL service I am being
forced into is going to cost $35 (different location and different
company)! I figured the prices would be similar but was surprised that was
not the case. Are there some underlying differences between the two
services that may justify such a difference?
If I have a 6Mbps DSL line, will a 6Mbps cable line be the same speed? I
realize there are circumstances to consider when making this judgement
(i.e. whether you have a dedicated line to your home or a community line),
but assuming the situations are exactly the same are they similar?
Also, why have I seen some internet providers offer packages upwards of
105MBps, while a company like AT&T has 'Extreme' package (or whatever the
fastest may be called) only on the order of 18Mbps? Is cable capable of
speeds that much greater than DSL?
So I am not quite sure of the differences. I have read that DSL is fed
into the home via the phone line, and cable is, of course, through the
cable jacks. I currently have a 30Mbps cable connection but am forced to
downgrade to a 6Mbps connection due to the service not being available
where I am moving.
What are the main differences? For example, as I said I have a 30Mbps
connection now that costs $30/mo, but the 6Mbps DSL service I am being
forced into is going to cost $35 (different location and different
company)! I figured the prices would be similar but was surprised that was
not the case. Are there some underlying differences between the two
services that may justify such a difference?
If I have a 6Mbps DSL line, will a 6Mbps cable line be the same speed? I
realize there are circumstances to consider when making this judgement
(i.e. whether you have a dedicated line to your home or a community line),
but assuming the situations are exactly the same are they similar?
Also, why have I seen some internet providers offer packages upwards of
105MBps, while a company like AT&T has 'Extreme' package (or whatever the
fastest may be called) only on the order of 18Mbps? Is cable capable of
speeds that much greater than DSL?
How do you quit without saving when using vim -c flag
How do you quit without saving when using vim -c flag
I want to run something along the lines of
vim -r -c "w %.new | q!" ${filename}
However, the ! is parsed as the prefix for an external command. Similar
issues happen when using single quotes.
I could work around this with the following code, but it feels much less
clean or obvious than the previous code.
cp ${filename} ${filename}.new && mv ${filename}.swp ${filename}.new.swp;
vim -r -c "wq" ${filename}.new;
I want to run something along the lines of
vim -r -c "w %.new | q!" ${filename}
However, the ! is parsed as the prefix for an external command. Similar
issues happen when using single quotes.
I could work around this with the following code, but it feels much less
clean or obvious than the previous code.
cp ${filename} ${filename}.new && mv ${filename}.swp ${filename}.new.swp;
vim -r -c "wq" ${filename}.new;
Rails: "rake assets: clean" doesn't remove files
Rails: "rake assets: clean" doesn't remove files
I found out that I need to run the following to clean my public/assets
directory
rake assets:clean
but it doesn't really do anything! it delete 4 files out of almost a 100
and it stopped
I was also asked to post my production.rb file when posting the question.
Running Rails 4.0.0
# Settings specified here will take precedence over those in
config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your
application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy
like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do
this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your
assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security,
and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset
server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets
folder are already added.
config.assets.precompile += ["*admin*", %w(application_admin.css)]
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery
to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall
back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not
suppressed.
config.log_formatter = ::Logger::Formatter.new
Also bundle exec rake assets:precompile only updates my application.css
and not my custom application_admin.css
I found out that I need to run the following to clean my public/assets
directory
rake assets:clean
but it doesn't really do anything! it delete 4 files out of almost a 100
and it stopped
I was also asked to post my production.rb file when posting the question.
Running Rails 4.0.0
# Settings specified here will take precedence over those in
config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your
application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy
like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do
this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your
assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security,
and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset
server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets
folder are already added.
config.assets.precompile += ["*admin*", %w(application_admin.css)]
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery
to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall
back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not
suppressed.
config.log_formatter = ::Logger::Formatter.new
Also bundle exec rake assets:precompile only updates my application.css
and not my custom application_admin.css
Parallel of std::reference_wrapper for std::shared_ptrs
Parallel of std::reference_wrapper for std::shared_ptrs
If you want to bind a reference to a function f, you can use std::bind(f,
std::ref(x)). In this case f takes a reference or makes a copy.
Now I have a function void g(T & t). I would like to bind the input
argument to std::shared_ptr<T> mySharedPtr like this: std::bind(g,
mySharedPtr). This would guarantee that mySharedPtr's data would have a
lifetime at least as long as the bind. But since g takes a reference, this
does not type-check.
Is there something similar to std::ref that takes a std::shared_ptr and
dereferences it before passing it into g? If not, could I make one myself?
(If you give an answer using lambdas, please also include one without
lambdas since my compiler does not support them.)
If you want to bind a reference to a function f, you can use std::bind(f,
std::ref(x)). In this case f takes a reference or makes a copy.
Now I have a function void g(T & t). I would like to bind the input
argument to std::shared_ptr<T> mySharedPtr like this: std::bind(g,
mySharedPtr). This would guarantee that mySharedPtr's data would have a
lifetime at least as long as the bind. But since g takes a reference, this
does not type-check.
Is there something similar to std::ref that takes a std::shared_ptr and
dereferences it before passing it into g? If not, could I make one myself?
(If you give an answer using lambdas, please also include one without
lambdas since my compiler does not support them.)
Make isolated area programs runner
Make isolated area programs runner
I want to make a program similar to SandBoxie(in vb.net/c#), which it runs
programs in isolated area (where they can't communicate with each other).
I've searched for long time, but without success :(. I think it's possible
with Win API. Thanks in advance.
I want to make a program similar to SandBoxie(in vb.net/c#), which it runs
programs in isolated area (where they can't communicate with each other).
I've searched for long time, but without success :(. I think it's possible
with Win API. Thanks in advance.
Animated GIF while database connects in WPF
Animated GIF while database connects in WPF
I am working on an application that connects to Database as soon as it
opens. Sometimes, it takes about 10-15 seconds before the database file
gets connected and until then, no controls are loaded, it just loads a
blank window and the cursor shows working. I tried using this library to
use an animated GIF but it is not loading it before trying DB connection.
I am using SQL Server Express and connecting to an mdf file. I tried
placing code to display the before the SqlConnection and SqlDataAdapter
Objects but even that didn't help. Any suggestions would be appreciated.
Thanks in advance.
I am working on an application that connects to Database as soon as it
opens. Sometimes, it takes about 10-15 seconds before the database file
gets connected and until then, no controls are loaded, it just loads a
blank window and the cursor shows working. I tried using this library to
use an animated GIF but it is not loading it before trying DB connection.
I am using SQL Server Express and connecting to an mdf file. I tried
placing code to display the before the SqlConnection and SqlDataAdapter
Objects but even that didn't help. Any suggestions would be appreciated.
Thanks in advance.
Versioned articles database design
Versioned articles database design
I am writing web application with content like articles. I want to keep
history of changes of each editation. What will be the best database
design to store such data?
Why am I asking: I have seen some projects (like wordpress), witch stores
everything to single table with column marking last version. But, is this
good solution, if I want to use fulltext index (PostgreSQL 9.1)? Wont be
indexed all data, regardless of information, if row is active last edited
version? I think this solution wont be good in any way for index size, row
count (slowest searching) specially after some time.
What would be better database design?
I am writing web application with content like articles. I want to keep
history of changes of each editation. What will be the best database
design to store such data?
Why am I asking: I have seen some projects (like wordpress), witch stores
everything to single table with column marking last version. But, is this
good solution, if I want to use fulltext index (PostgreSQL 9.1)? Wont be
indexed all data, regardless of information, if row is active last edited
version? I think this solution wont be good in any way for index size, row
count (slowest searching) specially after some time.
What would be better database design?
Thursday, 8 August 2013
Pipeline each line of a file to a specific variable in a second command
Pipeline each line of a file to a specific variable in a second command
I want to execute the following instruction:
basex -bword=ENTRY consulta.xq
But for every line of a SampleText file (plain text mainly).
The SampleText contains the following lines:
hello
evening
courageous
...
happy
So more or less what I want to do is to execute a instruction in a one
liner recipe similar to this:
cat SampleText | basex -bword=EACHLINE searchquery.xq
Thanks in advanced.
I want to execute the following instruction:
basex -bword=ENTRY consulta.xq
But for every line of a SampleText file (plain text mainly).
The SampleText contains the following lines:
hello
evening
courageous
...
happy
So more or less what I want to do is to execute a instruction in a one
liner recipe similar to this:
cat SampleText | basex -bword=EACHLINE searchquery.xq
Thanks in advanced.
Excel 2010 Apply conditional formatting to another cell
Excel 2010 Apply conditional formatting to another cell
In Excel 2010, I have 3 columns in a sheet called FX as follows:
A B C
01-May 1.18910 6,569.78
05-May 1.18725 6,559.56
06-May 1.18853 6,566.63
08-May 1.18138 6,527.12
11-May 1.18303 6,536.24
22-May 1.17108 6,470.22
25-May 1.16952 6,461.60
Conditional formatting has been applied to column B using one of the color
scales rules.
On another sheet, I am getting the last value in the column and inserting
it into another cell. This effectively shows "the most up to date value".
=INDEX(FX!B:B, COUNTA(FX!B:B), 1)
What I want to do is to also copy the format of that cell - i.e. the
background color assigned to it by the color scale. How can I achieve
this?
In Excel 2010, I have 3 columns in a sheet called FX as follows:
A B C
01-May 1.18910 6,569.78
05-May 1.18725 6,559.56
06-May 1.18853 6,566.63
08-May 1.18138 6,527.12
11-May 1.18303 6,536.24
22-May 1.17108 6,470.22
25-May 1.16952 6,461.60
Conditional formatting has been applied to column B using one of the color
scales rules.
On another sheet, I am getting the last value in the column and inserting
it into another cell. This effectively shows "the most up to date value".
=INDEX(FX!B:B, COUNTA(FX!B:B), 1)
What I want to do is to also copy the format of that cell - i.e. the
background color assigned to it by the color scale. How can I achieve
this?
How to Bind Data to Dynamically Created Form
How to Bind Data to Dynamically Created Form
I'm trying to build a form which starts with a drop-down and depending
upon the option selected creates a second drop down. I can create the
second drop down using FormEvents just fine, but what I can't do is
pre-select an option in that second drop-down once it is created. Does
anyone know how to bind data to a form element created via FormEvents?
I'm trying to build a form which starts with a drop-down and depending
upon the option selected creates a second drop down. I can create the
second drop down using FormEvents just fine, but what I can't do is
pre-select an option in that second drop-down once it is created. Does
anyone know how to bind data to a form element created via FormEvents?
Composite Primary key too long?
Composite Primary key too long?
I am using mysql 5.5 on Ubuntu 13.04 to store similarity measures [-1,1]
between URIs. My table layout is very simple:
|--------------------------------------------------|
| uri1 | uri2 | value |
|--------------------------------------------------|
|http://foo.com/bar | http://bar.net/foo | 0.8 |
|http://foo.com/bar1 | http://bar.net/foo2 | 0.4 |
|--------------------------------------------------|
I want to make sure that for two specific uris, not more than one value is
stored. Therefore, I use the followin sql to create the table:
CREATE TABLE IF NOT EXISTS db.table(
uri1 VARCHAR(255) NOT NULL ,
uri2 VARCHAR(255) NOT NULL ,
value DOUBLE NULL ,
PRIMARY KEY (uri1, uri2),
INDEX (value) )
Unfortunately, when I am batch-inserting data (via Java JDBC), I get
Exceptions like the following:
java.sql.BatchUpdateException: Duplicate entry
'http://xmlns.com/foaf/0.1/Document-http://purl.org/linked-data/c'
for key 'PRIMARY'
It seems like the primary key is not long enough to store both URIs and I
therefore get duplicate entry exceptions when the prefix is the same
(which it is often in my data). I have checked and no "real" duplicates
are inserted. Is there a way to set the length of the primary key so that
it will always contain both URIs completely? Or is there generally a
better way to model the data?
I do not want to perform a check if a row with the supplied uri1 and uri2
already exists whenever I insert data, but rather handle the exception if
this may actually happen (which it shouldn't). Therefore, I think, it is
not feasible to just use an incrementing integer as primary key.
In my application, I will be creating several tables like this for
different measures and may later want to join them by uri1 and uri2, so
that I get a result that contains from different tables all the values for
a specific pair of uris.
Thank you very much for any suggestions!
I am using mysql 5.5 on Ubuntu 13.04 to store similarity measures [-1,1]
between URIs. My table layout is very simple:
|--------------------------------------------------|
| uri1 | uri2 | value |
|--------------------------------------------------|
|http://foo.com/bar | http://bar.net/foo | 0.8 |
|http://foo.com/bar1 | http://bar.net/foo2 | 0.4 |
|--------------------------------------------------|
I want to make sure that for two specific uris, not more than one value is
stored. Therefore, I use the followin sql to create the table:
CREATE TABLE IF NOT EXISTS db.table(
uri1 VARCHAR(255) NOT NULL ,
uri2 VARCHAR(255) NOT NULL ,
value DOUBLE NULL ,
PRIMARY KEY (uri1, uri2),
INDEX (value) )
Unfortunately, when I am batch-inserting data (via Java JDBC), I get
Exceptions like the following:
java.sql.BatchUpdateException: Duplicate entry
'http://xmlns.com/foaf/0.1/Document-http://purl.org/linked-data/c'
for key 'PRIMARY'
It seems like the primary key is not long enough to store both URIs and I
therefore get duplicate entry exceptions when the prefix is the same
(which it is often in my data). I have checked and no "real" duplicates
are inserted. Is there a way to set the length of the primary key so that
it will always contain both URIs completely? Or is there generally a
better way to model the data?
I do not want to perform a check if a row with the supplied uri1 and uri2
already exists whenever I insert data, but rather handle the exception if
this may actually happen (which it shouldn't). Therefore, I think, it is
not feasible to just use an incrementing integer as primary key.
In my application, I will be creating several tables like this for
different measures and may later want to join them by uri1 and uri2, so
that I get a result that contains from different tables all the values for
a specific pair of uris.
Thank you very much for any suggestions!
Optional exception catching
Optional exception catching
Is it possible to make an exception that is optional to be caught?
In other words, an exception that can either:
be caught in a try-catch block
or skipped if no try-catch block exists for it
To visualize, I have a ReportedException, which is just a plain subclass
of RuntimeException, and want to be able to catch it when it's needed:
try
{
hideWindow();
}
catch (ReportedException ex)
{
// Window could not be hidden.
// Exception has already been caught and logged by parseInput(),
// and now we're going to do something more.
if (!(ex.getCause() instanceof NullPointerException))
{
killWindow();
}
}
or skip catching if the result is irrelevant:
hideWindow(); // We don't care if it's been hidden or not.
openAnotherWindow();
I know I can leave the catch block empty and have the same thing as above,
but I use ReportedException very often and it would make my code highly
unreadable. I also want to be able to get the exception cause.
If it's impossible (I suspect it is), what alternative/walkaround would
you recommend?
P.S. The method names used in the examples are just foo's and bar's.
Is it possible to make an exception that is optional to be caught?
In other words, an exception that can either:
be caught in a try-catch block
or skipped if no try-catch block exists for it
To visualize, I have a ReportedException, which is just a plain subclass
of RuntimeException, and want to be able to catch it when it's needed:
try
{
hideWindow();
}
catch (ReportedException ex)
{
// Window could not be hidden.
// Exception has already been caught and logged by parseInput(),
// and now we're going to do something more.
if (!(ex.getCause() instanceof NullPointerException))
{
killWindow();
}
}
or skip catching if the result is irrelevant:
hideWindow(); // We don't care if it's been hidden or not.
openAnotherWindow();
I know I can leave the catch block empty and have the same thing as above,
but I use ReportedException very often and it would make my code highly
unreadable. I also want to be able to get the exception cause.
If it's impossible (I suspect it is), what alternative/walkaround would
you recommend?
P.S. The method names used in the examples are just foo's and bar's.
Local host cross authentication
Local host cross authentication
I have two environments namely TedDev and TedLive (but it is the same
project) in my IIS and both sites have their own database and also their
own WindowService. Now when I test both sites simultaneously I get cross
authentication. Both sites are locally and are in their own app pool in
the IIS.
I don't want to create sub domains for each site. They will be deployed on
1 server so the issue will remain the same.
What I want to know what will be the best way to handle this, create own
authentication cookie or to configure the web.config files for both sites?
Any help would be much appreciated
I have two environments namely TedDev and TedLive (but it is the same
project) in my IIS and both sites have their own database and also their
own WindowService. Now when I test both sites simultaneously I get cross
authentication. Both sites are locally and are in their own app pool in
the IIS.
I don't want to create sub domains for each site. They will be deployed on
1 server so the issue will remain the same.
What I want to know what will be the best way to handle this, create own
authentication cookie or to configure the web.config files for both sites?
Any help would be much appreciated
checkboxes inside my combo refuse to show
checkboxes inside my combo refuse to show
I follow this example located here (ExtJs 4 combobox with checkboxes) to
make a combo with checkboxes. Everything shows up fine, but the checkboxes
refuse to show even though the css in my firebug shows the righ path to
the checkbox. When I hover over the url on the css window (right bottom
corner of firebug), I even see the checkboxes popped up.
Here is my combo code:
getInstructorSubstituteUi: function() {
return {
xtype: 'combo',
store:
Ext.create('Iip.store.giips.schedule.Instructors').load({params:
{c: 'get_instructors'}}),
fieldLabel: 'Instructor Substitute',
queryMode: 'local',
displayField: 'instructorName',
valueField: 'userInfoId',
itemId: 'instructorSubstitute',
name: 'instructorSubstitute',
multiSelect: true,
forceSelection: true,
lastQuery: '',
margin: '10 0 0 25',
allowBlank: false ,
triggerAction: 'all',
listConfig: {
getInnerTpl: function(displayField) {
console.log(this.getNode());
console.log(displayField);
return '<div class="x-combo-list-item"><img src="' +
Ext.BLANK_IMAGE_URL + '" class="chkCombo-default-icon
chkCombo" />{instructorName}</div>';
}
}
};
},
Here is css in the head section of my index.html:
<style>
| ~
.x-boundlist-item img.chkCombo {
| ~
background: transparent
| ~
url(lib/extjs/resources/themes/images/default/menu/unchecked.gif);
| ~
}
| ~
.x-boundlist-selected img.chkCombo{
| ~
background: transparent
| ~
url(lib/extjs/resources/themes/images/default/menu/checked.gif);
| ~
}
| ~
</style>
However, when I replace Ext.BLANK_IMAGE_URL with the url to the unchecked
box, it shows up. Looks like the blank url cannot dynamically replaced.
Just my guess.
Please tell me what I did wrong?
I follow this example located here (ExtJs 4 combobox with checkboxes) to
make a combo with checkboxes. Everything shows up fine, but the checkboxes
refuse to show even though the css in my firebug shows the righ path to
the checkbox. When I hover over the url on the css window (right bottom
corner of firebug), I even see the checkboxes popped up.
Here is my combo code:
getInstructorSubstituteUi: function() {
return {
xtype: 'combo',
store:
Ext.create('Iip.store.giips.schedule.Instructors').load({params:
{c: 'get_instructors'}}),
fieldLabel: 'Instructor Substitute',
queryMode: 'local',
displayField: 'instructorName',
valueField: 'userInfoId',
itemId: 'instructorSubstitute',
name: 'instructorSubstitute',
multiSelect: true,
forceSelection: true,
lastQuery: '',
margin: '10 0 0 25',
allowBlank: false ,
triggerAction: 'all',
listConfig: {
getInnerTpl: function(displayField) {
console.log(this.getNode());
console.log(displayField);
return '<div class="x-combo-list-item"><img src="' +
Ext.BLANK_IMAGE_URL + '" class="chkCombo-default-icon
chkCombo" />{instructorName}</div>';
}
}
};
},
Here is css in the head section of my index.html:
<style>
| ~
.x-boundlist-item img.chkCombo {
| ~
background: transparent
| ~
url(lib/extjs/resources/themes/images/default/menu/unchecked.gif);
| ~
}
| ~
.x-boundlist-selected img.chkCombo{
| ~
background: transparent
| ~
url(lib/extjs/resources/themes/images/default/menu/checked.gif);
| ~
}
| ~
</style>
However, when I replace Ext.BLANK_IMAGE_URL with the url to the unchecked
box, it shows up. Looks like the blank url cannot dynamically replaced.
Just my guess.
Please tell me what I did wrong?
Subscribe to:
Comments (Atom)