Saturday, 31 August 2013

How to load excel template and write to it in PHPExcel?

How to load excel template and write to it in PHPExcel?

How do I load an Excel Template with PHPExcel and write to its cells and
also insert images to cells dynamically?

GLSL Shader Ported From HLSL Is Not Working

GLSL Shader Ported From HLSL Is Not Working

I have this HLSL Shader for blur:
struct VS_INPUT
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
float4 Color : TEXCOORD1;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
};
float4x4 al_projview_matrix;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output;
Output.Position = mul(Input.Position, al_projview_matrix);
Output.Color = Input.Color;
Output.TexCoord = Input.TexCoord;
return Output;
}
Frag
texture al_tex;
sampler2D s = sampler_state {
texture = <al_tex>;
};
int tWidth;
int tHeight;
float blurSize = 5.0;
float4 ps_main(VS_OUTPUT Input) : COLOR0
{
float2 pxSz = float2(1.0 / tWidth,1.0 / tHeight);
float4 outC = 0;
float outA = 0;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-4.0 *
pxSz.y * blurSize)).a * 0.05;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-3.0 *
pxSz.y * blurSize)).a * 0.09;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,-2.0 *
pxSz.y * blurSize)).a * 0.12;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy +
float2(0,-pxSz.y * blurSize)).a * 0.15;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,0)).a
* 0.16;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,pxSz.y
* blurSize)).a * 0.15;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,2.0 *
pxSz.y * blurSize)).a * 0.12;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,3.0 *
pxSz.y * blurSize)).a * 0.09;
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(0,4.0 *
pxSz.y * blurSize)).a * 0.05;
outC.a = outA;
return outC;
}
There is a similar one for horizontal...
The idea is, I provide tWidth, tHeight for the texture with and height,
and use that to get the 'size' of a pixel relative to UV coords.
I then use this to do normal blur by taking a weighted average of neighbors.
I ported this to GLSL:
attribute vec4 al_pos;
attribute vec4 al_color;
attribute vec2 al_texcoord;
uniform mat4 al_projview_matrix;
varying vec4 varying_color;
varying vec2 varying_texcoord;
void main()
{
varying_color = al_color;
varying_texcoord = al_texcoord;
gl_Position = al_projview_matrix * al_pos;
}
Frag
uniform sampler2D al_tex;
varying float blurSize;
varying float tWidth;
varying float tHeight;
varying vec2 varying_texcoord;
varying vec4 varying_color;
void main()
{
vec4 sum = vec4(0.0);
vec2 pxSz = vec2(1.0 / tWidth,1.0 / tHeight);
// blur in x
// take nine samples, with the distance blurSize between them
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-4.0 * pxSz.y *
blurSize))* 0.05;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-3.0 * pxSz.y *
blurSize))* 0.09;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-2.0 * pxSz.y *
blurSize))* 0.12;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,-pxSz.y *
blurSize))* 0.15;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,0))* 0.16;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,pxSz.y *
blurSize))* 0.15;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,2.0 * pxSz.y *
blurSize))* 0.12;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,3.0 * pxSz.y *
blurSize))* 0.09;
sum += texture2D(al_tex, varying_texcoord.xy + vec2(0,4.0 * pxSz.y *
blurSize))* 0.05;
gl_FragColor = varying_color;
}
This is a little different, but it's the same logic. I convert pixel
coords to UV coords, and multiply by the blur factor, same as the hlsl
factor. Yet, the glsl one gives me an unblurred, slightly more transparent
version of the original.
What could cause this?
Thanks

Modify Youtube Video Description with API

Modify Youtube Video Description with API

I'm new to the Youtube API. I'm going through the API documentation and
I'm trying to find if and where it talks about modifying the video
description. I want an api that can change descriptions of specific
videos. Thanks

Python and gpu OpenCV functions

Python and gpu OpenCV functions

I want to know if it is possible to use opencv gpu functions like those
from here? Or I have to wrap it into python class.

Retrieve element from array in Coldfusion

Retrieve element from array in Coldfusion

I get the following struct return from disqus.com API and I just don't
know how to retrieve only the following value in red using Coldfusion.

This is the full array returned.
{
"cursor":{
"prev":null,
"hasNext":false,
"next":"1213061503000000:1:0",
"hasPrev":false,
"total":null,
"id":"1213061503000000:1:0",
"more":false
},
"code":0,
"response":[
{
"category":"1",
"reactions":0,
"identifiers":[],
"forum":"bobross",
"title":"Donkeys live a long time",
"dislikes":0,
"isDeleted":false,
"author":"1",
"userScore":0,
"id":"2",
"isClosed":false,
"posts":0,
"link":null,
"likes":0,
"message":"\"Donkeys live a long time. None of you have ever seen a
dead donkey.\"",
"ipAddress":"127.0.0.1",
"slug":"donkeys_live_a_long_time",
"createdAt":"2008-06-10T02:31:43"
},
{
"category":"1",
"reactions":0,
"identifiers":[
"my-identifier"
],
"forum":"bobross",
"title":"Happy Accidents",
"dislikes":0,
"isDeleted":false,
"author":"1",
"userScore":0,
"id":"1",
"isClosed":false,
"posts":76,
"link":null,
"likes":0,
"message":"\"If you've painted before you know that we don't make
mistakes -- we have happy accidents.\"",
"ipAddress":"127.0.0.1",
"slug":"happy_accidents",
"createdAt":"2008-06-10T01:31:43"
}
]
}

UniversalImageLoader Does not load images from ContentProvider

UniversalImageLoader Does not load images from ContentProvider

my problem is this: I have a ListView in which i want to show song data. I
actually get the data from MediaStore. In the ListView items, i have an
ImageView in which i want to set the album art. I tried to use
UniversalImageLoader :
https://github.com/nostra13/Android-Universal-Image-Loader But images are
not loaded, i see only the "show-on-fail" image. on UniversalImageLoader's
page there is a section where an image path like :
"content://media/external/audio/albumart/243" is allowed.
This is my list adapter java class:
public class SongsAdapter extends BaseAdapter implements Filterable
{
public Context _c;
public ArrayList<Song> _data;
public ArrayList<Song> _originalData;
public SongFilter songFilter;
public ImageLoader imageLoader;
ImageLoaderConfiguration config;
public DisplayImageOptions options;
public ImageLoadingListener animateFirstListener;
public SongsAdapter(ArrayList<Song> _data, Context _c)
{
this._c = _c;
this._data = _data;
this._originalData = _data;
config = new ImageLoaderConfiguration.Builder(this._c)
.imageDownloader(new BaseImageDownloader(this._c))
.imageDecoder(new BaseImageDecoder(true))
.build();
options = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.song_art_w)
.showImageOnFail(R.drawable.song_art)
.imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.ARGB_8888)
.build();
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
animateFirstListener = new AnimateFirstDisplayListener();
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if(convertView == null)
convertView =
((LayoutInflater)_c.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.list_item_song,
null);
Song s = _data.get(position);
ImageView songArt =
(ImageView)convertView.findViewById(R.id.song_art);
TextView songTitle =
(TextView)convertView.findViewById(R.id.song_title);
TextView songArtist =
(TextView)convertView.findViewById(R.id.song_artist);
TextView songAlbum =
(TextView)convertView.findViewById(R.id.song_album);
imageLoader.displayImage(BitmapUtils.getString(s.album_id),
songArt, options, animateFirstListener);
songTitle.setText(s.title.toUpperCase());
songTitle.setTypeface(Configuration.TEXT_BLACK);
songTitle.setSingleLine(true);
songArtist.setText(s.artist);
songArtist.setTypeface(Configuration.TEXT_REGULAR);
songArtist.setSingleLine(true);
songAlbum.setText(s.album);
songAlbum.setTypeface(Configuration.TEXT_REGULAR);
songAlbum.setSingleLine(true);
return convertView;
}
@Override
public int getCount()
{
return _data.size();
}
@Override
public Object getItem(int position)
{
return _data.get(position);
}
@Override
public long getItemId(int position)
{
return position;
}
@Override
public Filter getFilter()
{
if (songFilter == null)
songFilter = new SongFilter();
return songFilter;
}
private class SongFilter extends Filter
{
@Override
protected FilterResults performFiltering(CharSequence constraint)
{
String filterString = constraint.toString().toLowerCase();
FilterResults results = new FilterResults();
final ArrayList<Song> list = _originalData;
int count = list.size();
final ArrayList<Song> nlist = new ArrayList<Song>(count);
Song s;
for (int i = 0; i < count; i++)
{
s = list.get(i);
if(s.title.toLowerCase().contains(filterString))
{
nlist.add(s);
}
}
results.values = nlist;
results.count = nlist.size();
return results;
}
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint,
FilterResults results)
{
_data = (ArrayList<Song>)results.values;
notifyDataSetChanged();
}
}
private static class AnimateFirstDisplayListener extends
SimpleImageLoadingListener
{
static final List<String> displayedImages =
Collections.synchronizedList(new LinkedList<String>());
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap
loadedImage)
{
if (loadedImage != null)
{
ImageView imageView = (ImageView) view;
boolean firstDisplay = !displayedImages.contains(imageUri);
if(firstDisplay)
{
FadeInBitmapDisplayer.animate(imageView, 500);
displayedImages.add(imageUri);
}
}
}
}
}
Next, this is my xml layout for the single listView item:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@drawable/icon_selector_gray"
android:clickable="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/song_art"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:background="@android:color/transparent"
android:contentDescription="@string/app_name">
</ImageView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp">
<TextView
android:id="@+id/song_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="left|center_vertical"
android:background="@android:color/transparent"
android:padding="0dp"
android:textSize="16dp"
android:textColor="#ff2a2a2a">
</TextView>
<TextView
android:id="@+id/song_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="left|center_vertical"
android:background="@android:color/transparent"
android:padding="0dp"
android:textSize="12dp"
android:textColor="#ff2a2a2a">
</TextView>
<TextView
android:id="@+id/song_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="left|center_vertical"
android:background="@android:color/transparent"
android:padding="0dp"
android:textSize="12dp"
android:textColor="#ff2a2a2a">
</TextView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Finally, my app does not crash, but i got these exceptions (i would paste
one here, but for each song image art to load i got one exception same as
this)
No entry for content://media/external/audio/albumart/243
java.io.FileNotFoundException: No entry for
content://media/external/audio/albumart/243
at
android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:144)
at
android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:612)
at
android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:607)
at
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:536)
at android.content.ContentResolver.openInputStream(ContentResolver.java:371)
at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromContent(BaseImageDownloader.java:157)
at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:80)
at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:81)
at
com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:68)
at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:305)
at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:260)
at
com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:129)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
The strange thing is that 1 hour ago my imageLoader were working fine... i
think i have moved/removed some code, because i can't recognize the error
anymore. Did someone has implemented this, or know where the problem is?
thanks in advance.

Customized navigation controller toolbar is one pixel upper than the bottom of iPhone

Customized navigation controller toolbar is one pixel upper than the
bottom of iPhone

I had to customize UIViewController and Used following codes to customize
the UIViewController toolbar at the bottom
[self.navigationController.toolbar setBackgroundImage:[UIImage
imageWithCGImage:[UIImage imageNamed:@"List/footer.png"].CGImage scale:2
orientation:UIImageOrientationDown]
forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
[self.navigationController.toolbar setShadowImage:[UIImage
imageNamed:@"transparent.png"]
forToolbarPosition:UIToolbarPositionAny];
[self.navigationController.toolbar setBackgroundColor:[UIColor
clearColor]];

As it is obvious in screenshot picture there is one white pixel under the
customized toolbar. How can I remove the pixel?

Friday, 30 August 2013

PHP mail function requirements

PHP mail function requirements

I am reading this from the PHP documentation:
Requirements For the Mail functions to be available, PHP must have access
to the sendmail binary on your system during compile time. If you use
another mail program, such as qmail or postfix, be sure to use the
appropriate sendmail wrappers that come with them. PHP will first look for
sendmail in your PATH, and then in the following:
/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly
recommended to have sendmail available from your PATH. Also, the user that
compiled PHP must have permission to access the sendmail binary.
My question is what is this sendmail wrapper for POSTFIX that they are
talking about? Usually when I install POSTFIX with yum install the mail
function just starts sending mail? Is there something more to it than
that?
Thank in advance...

Thursday, 29 August 2013

Slickgrid force columns to fit viewport size when enablecolumnorder equals false and resizable equals false?

Slickgrid force columns to fit viewport size when enablecolumnorder equals
false and resizable equals false?

I have created numerous slickgrids, but this is the first one that I am
creating that I need to have the columns not be resizable and reorderable
(draggable). What I really need is for my columns to fit my viewport at
all times but not be resizable/reorderable, and not extend horizontally
during a screen resize (increase or decrease).
I have found that if I put this into the column options. :'
resizable: false
This will stop them from being resized but upon doing this it resizes my
columns on page load to width I specified per column. Which is normally
what I would want, but I have a specific width of 1300px for my viewport.
So, if I set my pixels just right the grid will behave nicely in the
viewport and look great. However, this application that I am working on
requires the ability to minimize or maximize the screen, upon doing so my
columns which are now set to a specific width remain that width and a
horizontal scrollbar appears pushing my columns past the 1300px range.
If I remove forcefitcolumns and the widths then my columns are really tiny
and it just looks terrible.
Example of one of my columns. :
{ id: "Mode", name: "Mode", field: "Mode", width: 125, sortable: true,
formatter: TaskNameFormatter, editor: Slick.Editors.Text, resizable: false
},
Example of my grid options. :
var GridOptions = {
showHeaderRow: true,
showHeaderRow: true,
headerRowHeight: 30,
explicitInitialization: true,
enableCellNavigation: true,
enableTextSelectionOnCells: true,
forceFitColumns: true,
multiColumnSort: true,
topPanelHeight: 25,
autoHeight: true,
enableColumnReorder: false
};
Example of my grid div. :
<div id="slickGrid" class="grid-body" style="min-width: 800px; max-width:
1300px; height: auto;"></div>
And obviously I have the grid resize. :
$(window).resize(function () {
Grid.resizeCanvas();
});
I am just wondering how you handle this situation, basically I need my
columns to fill the viewport horizontally and maintain that size even
during a window resize. Thoughts? Has anyone defeated this issue before?
If I could just figure out how to dynamically keep my columns the
appropriate size for the viewport I could call that again during a window
resize.

Wednesday, 28 August 2013

Sending Selected Field Data using PHP and API's.

Sending Selected Field Data using PHP and API's.

I am using an API to submit form data to a third party CRM database.
Here is the html of the form...
<div class="column last">
<label for="role">What is your role?</label>
<select name="role" id="role">
<option value="noresponse">Please select one</option>
<option value="reseller">Reseller</option>
<option value="researcher">Researcher</option>
<option value="end-user">End-user</option>
<option value="other">Other</option>
</select>
</div>
And here is the php that sends the selected field data using an API.
$hubspotutk, 'ipAddress' => $ip_addr, 'pageUrl' =>
'http://www.suntechmed.com/index.php?option=com_chronoforms&chronoform=test_form',
'pageName' => 'Test Form' );
$hs_context_json = json_encode($hs_context);
//Need to populate these varilables with values from the form.
$str_post = "firstname=" . urlencode($_POST["firstname"])
. "&lastname=" . urlencode($_POST["lastname"])
. "&company=" . urlencode($_POST["company"])
. "&role=" . urlencode($POST["role"])
. "&address=" . urlencode($_POST["address"])
. "&city=" . urlencode($_POST["city"])
. "&state=" . urlencode($_POST["state"])
. "&zip=" . urlencode($_POST["zip"])
. "&email=" . urlencode($_POST["email"])
. "&hs_context=" . urlencode($hs_context_json);
//Leave this one be :)'
//replace the values in this URL with your portal ID and your form GUID
$endpoint =
'https://forms.hubspot.com/uploads/form/v2/myHubspotID/b9752739-c9a3-4dc3-bf34-cb23679a41d4';
$ch = @curl_init();
@curl_setopt($ch, CURLOPT_POST, true);
@curl_setopt($ch, CURLOPT_POSTFIELDS, $str_post);
@curl_setopt($ch, CURLOPT_URL, $endpoint);
@curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:
application/x-www-form-urlencoded'));
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = @curl_exec($ch); //Log the response from HubSpot as needed.
@curl_close($ch);
echo $response;
?>
The fields that are simple text fields make the transition just fine.
The problem I am having is that the fields that have select options (like
"role") are not making it to the database.
In fact, it doesn't even show role as an empty field.
If anybody has any suggestions, that would be grand!

c# first windows service, startup issue (maybe issue's)

c# first windows service, startup issue (maybe issue's)

This is my first service it was origionally a form application but i
decided to make it a service for practice. it is a filesystemwatcher that
watches specific directory for changes and copy's the files that change or
are created to a second directory.
The thing is i know how to install the service and it works but it does
nothing(btw it worked in the form). And i dont know why it doesnt do
anything if you can help it is much appreciated
protected override void OnStart(string[] args)
{
base.OnStart(args);
this.fileSystemWatcher1 = new System.IO.FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).BeginInit();
fileSystemWatcher1.Path = source;
this.fileSystemWatcher1.EnableRaisingEvents = true;
((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).EndInit();
LogMessageToFile("ChaloSync Test Started");
}
protected override void OnStop()
{
base.OnStop();
fileSystemWatcher1.Dispose();
//TODO: clean up any variables and stop any threads
}
public static void Copy(string sourceDirectory, string targetDirectory)
{
DirectoryInfo diSource = new DirectoryInfo(sourceDirectory);
DirectoryInfo diTarget = new DirectoryInfo(targetDirectory);
CopyAll(diSource, diTarget);
}
public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
{
// Check if the target directory exists, if not, create it.
if (Directory.Exists(target.FullName) == false)
{
Directory.CreateDirectory(target.FullName);
}
// Copy each file into it's new directory.
foreach (FileInfo fi in source.GetFiles())
{
fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true);
}
// Copy each subdirectory using recursion.
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir =
target.CreateSubdirectory(diSourceSubDir.Name);
CopyAll(diSourceSubDir, nextTargetSubDir);
}
}
public static void copyfolder()
{
String source = ConfigurationManager.AppSettings[@"Directory1"];
String target = ConfigurationManager.AppSettings[@"Directory2"];
Copy(@source, @target);
}
try
{
NpgsqlConnection objConn = new NpgsqlConnection(conn);
objConn.Open();
NpgsqlCommand cmd1 = new NpgsqlCommand(strSelectCmd, objConn);
cmd1.ExecuteNonQuery();
objConn.Close();
}
catch (Exception )
{
//postgres error
}
/*create table files (name varchar(50),size
int,last_edit timestamp,extension varchar(5));*/
}
static void config()
{
foreach (string key in ConfigurationManager.AppSettings)
{
string value = ConfigurationManager.AppSettings[key];
}
}
private void fileSystemWatcher1_Changed(object sender,
System.IO.FileSystemEventArgs e)
{
LogMessageToFile("File changed> " + e.FullPath + " -Date:" +
DateTime.Now);
filepath = Path.Combine(source, e.Name);
name = Path.GetFileNameWithoutExtension(filepath);
extension = Path.GetExtension(e.FullPath);
size = e.Name.Length;
query = "update files set size=" + size + ", last_edit=now(),
extension='" + extension + "' where name='" + name + "'";
strSelectCmd = "update files set size=" + size + ", last_edit=now(),
extension='" + extension + "' where name='" + name + "'";
querry();
}
private void fileSystemWatcher1_Created(object sender,
System.IO.FileSystemEventArgs e)
{
LogMessageToFile("File created> " + e.FullPath + " -Date:" +
DateTime.Now);
filepath = Path.Combine(source, e.Name);
name = Path.GetFileNameWithoutExtension(filepath);
extension = Path.GetExtension(e.FullPath);
size = e.Name.Length;
query = "INSERT INTO files (name,size,last_edit,extension) VALUES('" +
name + "','" + size + "',now(),'" + extension + "')";
strSelectCmd = "INSERT INTO files (name,size,last_edit,extension)
VALUES('" + name + "','" + size + "',now(),'" + extension + "')";
querry();
}
private void fileSystemWatcher1_Deleted(object sender,
System.IO.FileSystemEventArgs e)
{
filepath = Path.Combine(source, e.Name);
LogMessageToFile("File deleted> " + e.FullPath + " -Date:" +
DateTime.Now);
name = Path.GetFileNameWithoutExtension(filepath);
File.Delete(target + e.Name);
query = "delete from files where name='" + name + "'";
strSelectCmd = "delete from files where name='" + name + "'";
querry();
}
private void fileSystemWatcher1_Renamed(object sender,
System.IO.RenamedEventArgs e)
{
filepath = Path.Combine(source, e.Name);
String oldfilepath = Path.Combine(source, e.OldName);
LogMessageToFile("File renamed> " + e.FullPath + " -Date:" +
DateTime.Now);
Console.WriteLine(e.OldName + "=>" + e.Name);
extension = Path.GetExtension(e.FullPath);
size = e.Name.Length;
name = Path.GetFileNameWithoutExtension(filepath);
String oldfilename = Path.GetFileNameWithoutExtension(oldfilepath);
query = "update files set name='" + name + "' where name='" +
oldfilename + "'";
strSelectCmd = "update files set name='" + name + "' where name='" +
oldfilename + "'";
querry();
}
} }

How to give the And condition in Generics in java

How to give the And condition in Generics in java

This question was asked to me in an interview.
We have a class strcture like A<-B<-C<-D<-E<-F(B extends A, C extends B
and so on).
So i need to create a method acceptList(List<> list) in such a way that it
can accept the List of Class A,C,E and do not accept List of B,D,F.
Kindly help

Oracle Function to hardCode Column Name as Parameter

Oracle Function to hardCode Column Name as Parameter

i have 2 tables with Same set Column Name (52+ coulmns) . I need to write
a Oracle Functiona to compare whether any records get changed between
these columns. EMP ID is the Primary Key
im trying to use the below Function. but it is giving me incorrect result,
and im calling the funcaiton like this:- get_data_change (emp_id,
'DEPT_NAME'); get_data_change (emp_id, 'PHONE_NUMBER');
Function i have created.`
CREATE OR REPLACE function get_data_change ( in_emp_id varchar2,
in_Column_Value varchar2 )
return char is
v_data_changed char;
begin
select eid in_Column_Value
into v_table1_eid, v_table1_dept_name
from table 1
where ename=in_emp_id;
Select eid, in_Column_value
into v_table2_eid, v_table2_dept_name
from table 2
where ename = in_emp_id;
if ( v_table2_dept_name != v_table1_dept_name) then
v_data_changed := 'Y'
Else v_data_changed :='N'
endif
return v_data_changed
end
end get_data_change;`

Tuesday, 27 August 2013

How can I get the output of Cloudfoudry CLI vmc/cf by "grep"

How can I get the output of Cloudfoudry CLI vmc/cf by "grep"

I have used the following command
vmc info |grep target
I can get the target info exactly. But when I type:
vmc apps |grep running
There is no output. If I try to redirect the stdout to file like:
vmc apps &> tmplog
I was confused to see that only the first column of the output (appname)
was written into the file. Any suggestions?

Visual Studio 2012 Python main() behaviour

Visual Studio 2012 Python main() behaviour

I am using Python Tools for Visual Studio
def testFunc():
print('Called from test func')
import msvcrt as m
testFunc()
m.getch()
will wait for command line input. But,
import msvcrt as m
def wait():
m.getch()
def main():
testFunc()
wait()
won't wait till command line input from user. Setting break point isn't
working either.
Am I doing something wrong here ?

Deploying Custom Nvidia Program Settings

Deploying Custom Nvidia Program Settings

I would like to mass deploy Program Settings from the Nvidia Control
Panel. Our environment only has 1 type of video card. We are also running
windows 7 SP1 64bit
For Example.
Go to the Nvidia Control Panel > Manage 3D Settings > Program Settings
I would like to give a specific .exe AA options and distribute that
setting to my user environment. I do not want to use a Global Preset
because this change should only be made for the specific Application.
Any insight would be much appreciated
Thanks, Paul

Shadowbox / Lightbox not working on Android Phone

Shadowbox / Lightbox not working on Android Phone

I am really baffled and would greatly appreciate some help. I have the
Shadowbox js working great on desktops/laptops, and also in IPhones to
popup up a lightbox with navigation controls. But for some reason on my
Samsung Galaxy Note II the links for "Schedule", <, >, X do not work at
all. I am using a Chrome browser on the Samsung Galaxy.
The site is http:// setup (.) certifiedtransmission.com

Issue Loading HTML into UIWebView

Issue Loading HTML into UIWebView

I have the following code which loads a local HTML file into a UIWebView :
- (void)loadWebPage {
NSString* htmlPath = [[NSBundle mainBundle] pathForResource:@"index"
ofType:@"html"];
NSLog(@"HTML Path%@", htmlPath);
NSString* appHtml = [NSString stringWithContentsOfFile:htmlPath
encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:appHtml baseURL:nil];
}
I am having problems however loading this particular HTML file - the
screen is just blank :
<!DOCTYPE html>
<html>
<head>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="page">
<div id="nonbindingwrapper">
</div>
<div class="content">
<table class="w100">
<tr>
<td class="w33">
<img src="hat.png" id="hatlogo">
</td>
<td class="w33">
<div id="nonbindingbox">
Text
</div>
</td>
<td class="w33">
<h1>
USA 2014
</h1>
<h2>
Text
<br />
Text
</h2>
</td>
</tr>
<table>
<p class="center">
<span class="bold">
<br />
</span>
<br />ON-SITE RATEEFFECTIVE THROUGH AUGUST 1, 2013
<br /><a href='http://www.url.com'>www.url.com</a>
<br />
<span class="tinytext">
Text
</span>
</p>
<hr />
<table class="w50 float padright">
<tr><td colspan=2><h3>Client Information</h3></td></tr>
<tr>
<td>
Company Name
</td>
<td>
[name]
</td>
</tr>
<tr>
<td>
Company Address
</td>
<td>
[Address]
<br />[Address]
<br />[Address]
<br />[Address]
</td>
</tr>
<tr>
<td>
Company URL:
</td>
<td>
[url]
</td>
</tr>
<tr>
<td class="bold">
<h4>Purchase Order</h4>
</td>
<td>
[data]
</td>
</tr>
</table>
<table class="w50 float padleft">
<tr><td colspan=2><h3>Primary Contact</h3></td></tr>
<tr>
<td>
Name & Tel:
</td>
<td>
[data]
</td>
</tr>
<tr>
<td colspan=2 class="bold">
Billin Address (if different from company)
</td>
</tr>
<tr>
<td>
Billing Address:
</td>
<td>
[data]
</td>
</tr>
</table>
<hr>
<h3>
Sponsorship Packages
</h3>
<table class="w100">
<tr>
<td>
Booth
</td>
<td>
837
</td>
<td>
50.00 USD
</td>
<td>
10 x 10
</td>
<td>
</td>
<td class="alignright">
6750.00
</td>
</tr>
<tr>
<td>
Text
</td>
<td>
837
</td>
<td>
50.00 USD
</td>
<td>
10 x 10
</td>
<td>
</td>
<td class="alignright">
6750.00
</td>
</tr>
<tr>
<td>
Text
</td>
<td>
837
</td>
<td>
50.00 USD
</td>
<td>
Space 10 x 10
</td>
<td>
</td>
<td class="alignright">
6750.00
</td>
</tr>
<tr>
<td colspan=4></td>
<td class="bold">
TOTAL FEE:
</td>
<td class="bold alignright">
51500.00
</td>
</tr>
</table>
Text
<hr>
<div class="w50 float">
<h3>
Payment Terms
</h3>
Text
<br />
<div class="w50 bold float">Account Manager:</div>
<div class="w50 float">[data]</div>
</div>
<div class="w50 float">
<span class="bold">
<br />Text
</span>
<br /><br />
Signed:<br /><br /><br /><br />
<span class="w50 float">Name:</span>
<span class="w50 float">[data]</span>
<span class="w50 float">Title:</span>
<span class="w50 float">[data]:</span>
<span class="w50 float">Date:</span>
<span class="w50 float">[data]:</span>
</div>
</div>
<div class="footer">
<br />Copyright
<br />tech
<img id="text" src="logo.png"/>
</div>
</div>
</body>

Find PHP process that logs to file

Find PHP process that logs to file

I have started a PHP script via browser and due to a loop error the script
continues to be executed even after closing the browser. I am noticing it
since the script is logging error messages to my logfile (path known).
We have a Apache server where many developers work together and the user
is nmdev. So how can I find out what process it the one running and
logging to my logfile?
ps -afe | grep php53 gives me many processes of today like:
nmdev 26518 24151 0 11:51 ? 00:00:00 /opt/xxx/yyy/apache-php5/bin/httpd -k
start

Upgrade my ubuntu to 13 and it is crashed

Upgrade my ubuntu to 13 and it is crashed

I have upgraded my ubuntu from 12.0.4 to 13 and it was crashed .....any
help or documentation of up gradation will be helpful..
thanks

Monday, 26 August 2013

New domain not working on computer that purchased it

New domain not working on computer that purchased it

I recently purchased a domain name from Hover.com for my website.
My nameservers have updated and everyone can access the site... except me.
Friends from across the US, local friends, other computers on same
internet connection, phones, tablets on the same internet connection, etc
all can access the site fine. The only exception seems to be my primary
desktop which I purchased the domain name on. I am constantly redirected
to Hover.com. If I use the command prompt to ping my domain I get a
different IP than when others ping it.
The problem is consistent on chrome, internet explorer, and firefox.
Things I have tried:
Restarting modem and router. Restarting computer. Clearing all data,
cache, history etc from my internet browser (chrome). Flushing the DNS
cache via command prompt with the "ipconfig /flushdns" command. I have
checked my hosts file for any irregularities.
I can view the site using a proxy and the domain name.
I am running windows 7. It has been over 24 hours since I've purchased and
set up the host.

Convert large text block to json block

Convert large text block to json block

I have a BASH script that attempts to capture the output of
build/deployment logs and insert them into a Jira ticket using Jira's REST
API and CURL:
curl -v -X POST \
-H "Content-Type: application/json" \
--data "@header.json" \
--data "@log.txt" \
--data "@footer.json" \
-H "Authorization:Basic ABC123!@#" \
https://companyname.jira.com/rest/api/latest/issue/FOO-1234/comment
My problem is that the logs contain all manner of JSON tokens, which
causes the insert to fail. Is there a way from BASH to clean up the text
blob before posting to escape out all the illegal characters? Or a way to
say "don't parse anything in this block" or similar? Worst case, I'll
write some really scary AWK.

How to execute a function in a function

How to execute a function in a function

I have this jQuery Plugin that looks like this:
(function($){
$.fn.s3Slider = function(vars) {
// (...)
timeOutFn = setTimeout(makeSlider, thisTimeOut);
// (...)
var makeSlider = function() {
// next Image
}
makeSlider();
};
})(jQuery);
I can start it with
jQuery(document).ready(function() {
jQuery('#s3slider').s3Slider({
timeOut: 4000
});
});
Now my question, how can I execute the makeSlider() function from outside?
It's an Image Slider and I want to add a Next Button function.
I want something like this, but it's wrong
jQuery.s3Slider.makeSlider();

IS NULL or NOT IN to consider null values in the count

IS NULL or NOT IN to consider null values in the count

When the run the below query with t.status is NULL it gives me different
count (which i think is incorrect).
How do I get the count by NOT IN ('Cancelled', 'Duplicate') but include
NULL value rows in the count
For the below query i get a count of 423
select count(*) from QC10.DEFECTS d
inner join QC10.DEFECTS_TRAN t on D.RECORD_ID=T.DEFECT_ID_FK_DT
where
T.LATEST_RECORD='Y'
and
(t.status NOT IN ('Cancelled', 'Duplicate'))
But when I run the below query i get 8530 as the count
select count(*) from QC10.DEFECTS d
inner join QC10.DEFECTS_TRAN t on D.RECORD_ID=T.DEFECT_ID_FK_DT
where
T.LATEST_RECORD='Y'
and
(t.status NOT IN ('Cancelled', 'Duplicate'))
or (t.status IS NULL)

Deserialize a class within a class from a JSON query in PHP

Deserialize a class within a class from a JSON query in PHP

I have two classes like this (as it is in C#)
public class inside
{
public string name {get;set;}
public int id {get;set;}
public string value {get;set;}
}
public class outside
{
public inside[] items {get;set;}
}
I then do a query to the server and deserialize the JSON values that come
back into the outside class.
I've been asked if I can port this over to PHP and I've come up with
class inside
{
public $name;
public $id;
public $value;
}
class outside
{
public array $item -> inside;
with pretty much everything else coming from Deserializing from JSON into
PHP, with casting?
for the outside class deserialization.
No real surprise in that it doesn't actually work for me (I stopped doing
PHP years ago as it annoyed the hell out of me that PHP was an all or
nothing language - if you don't see something, something is wrong)
The stumbler I think is how to I link the inside class to the outside
class in the same way as I would in C#?

Is it possible/how to embed and access HTML Files in a JAR?

Is it possible/how to embed and access HTML Files in a JAR?

i am somewhat blocked right now: i wrote a quite complex Java Desktop App
(no Applet/Web App!) which has it's own "user Manual". This manual
consists of some HTML and JPG files. This manual is displayed in the "Help
Menu" within my application using a JEditorPane.
So far so good. This works very well as long as i launch the Programm with
Eclipse. As soon as i create the deploy Version as a runable jar (which
gets wrapped into an .exe with launch4j) the HTML "Viewer" is unable to
display the user manual (the Images are missing).
I do understand why this is happening, but i have no idea on how to
fix/circumvent this.
My application loads its ressources (properties Files, Icons, etc.) via
getClass().getResource(). Examples:
this.setIconImage(new
ImageIcon(getClass().getResource("/images/dialog-question.png")).getImage());
stream = new
BufferedInputStream(MABIUpdater.class.getResourceAsStream("/settings.properties"));
Like i said before, this does work very well (launching the App from
within Eclipse OR as a wrapped executable or runnable-jar.
So i tried to access my HTML "Manuals" like this, too:
File manual = new File(getClass().getResource("/manual/help.html").toURI());
jEditorPane.setPage(manual.toURI().toURL());
This does NOT really work. Launching the programm through Eclipse i see
the Manual but with missing images. Launching it via jar/exe i get an
empty frame.
So is there any "trick" on how to achieve this? I guess one problem is the
HTML Page itself because it can't access the linked images within that
jar. Here is an really small example a HTML file that does not work
(missing image):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html lang="de">
<head>
<title>Manual</title>
</head>
<body>
<h1>Example: </h1>
<p>fubar</p>
<img style="display: block; text-align: center;"
src="../manual/img/Shot01.png" width="666" height="644" border="0"
alt="Bildtext">
<p><a href=\"http://www.google.com/\">blablubb</a></p>
</body>
</html>
I hope my problem is clear and someone has an idea ;).

Sunday, 25 August 2013

Proper way to use divs to align divisions of web page on left or right side

Proper way to use divs to align divisions of web page on left or right side

I am getting back into web development for a project and I am trying to
learn how to setup my divs so some elements are left aligned and others
are right aligned. Many moons ago before 's were around I would use a
table and set the alignment of the cells but I can't seem to find the
equivalent with div's.
In the below html code I am trying to make the text "My Brand" be on the
left and the "Link 1" and "Link 2" blocks of text to be on the right. All
3 blocks of text should be on the same line and be vertically aligned.
<html>
<head>
<title>Hi Mom</title>
<style>
.header
{
background-color:#BFEFFF;
height:50px;
}
.tagline
{
color: #00A5D8;
font-size: 20pt;
font-family: Helvetica Neue;
font-weight: bold;
vertical-align: middle;
text-indent: 20pt;
display: inline;
}
body
{
margin:0px;
}
</style>
</head>
<body >
<div class="header"><div class="tagline"><p>My Brand</p></div><div
class="tagline"><p>Link 1</p></div><div class="tagline"><p>Link
2</p></div></div>
<div><center>
blah blah
</center></div>
</body>
</html>
Thanks

Tabbed tables in Lotus Notes

Tabbed tables in Lotus Notes

m asked to develop an automated mail alert in lotus notes using JAVA. The
hard part is the mail content will be tables and each table will be placed
inside a tab. I used richtext programming to create tabs first and then
iterarted to each tabs inserted a table and then Data into the table. The
problem i face is when i try to format the tables inside the tabs. For
example i need to apply different colors to each column of the table which
i couldn't. Kindly please help me !!! let me know if there is any other to
generate the automated email. I use eclipse IDE and back end is Oracle
11g. Thanks in advance.. the following link is where i got the idea of how
to insert a table and tabbed table:
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_APPENDTABLE_METHOD_RTITEM_JAVA.html

designing application using polymorphism

designing application using polymorphism

I have created a polymorphic system, but I don't know whether this is the
correct way of doing it. Am I abusing Polymorphism here? Here is the code:
class WriteObj
{
public string Obj1 { get; set; }
public string Obj2 { get; set; }
public string Obj3 { get; set; }
}
The above code is a data object that I am passing around in the methods,
since I would be using a List of these objects.
abstract class BaseWriter
{
public abstract void Write(List<WriteObj> writeObjList);
}
class ConsoleWriter : BaseWriter
{
public override void Write(List<WriteObj> writeObjList)
{
for (int i = 0; i < writeObjList.Count; i++)
{
Console.Writeline("I am in Console Writer, parameter: " +
writeObjList[i].Obj1);
}
}
}
class FileWriter : BaseWriter
{
public override void Write(List<WriteObj> writeObjList)
{
for (int i = 0; i < writeObjList.Count; i++)
{
Console.Writeline("I write in file, parameter: " +
writeObjList[i].Obj1);
}
}
}
class DatabaseWriter : BaseWriter
{
public override void Write(List<WriteObj> writeObjList)
{
for (int i = 0; i < writeObjList.Count; i++)
{
Console.Writeline("I write in database, parameter: " +
writeObjList[i].Obj2);
}
}
}
In my main method I call them like:
static void main()
{
List<WriteObj> col = new List<WriteObj>();
col.AddRange(new WriteObj[2] { new WriteObj { Obj1 = "this is obj1
iteration 1", Obj2 = "This is obj2 iteration 1" },
new WriteObj { Obj1 = "this is obj1 iteration 2", Obj2 = "This
is obj2 iteration 2" } });
//some factory will generate these concrete types,
//but the sake of simplicity I am instantiating it like that.
BaseWriter a = new ConsoleWriter();
a.Write(col);
BaseWriter b = new FileWriter();
b.Write(col);
BaseWriter c = new DatabaseWriter();
c.Write(col);
}
Is it Ok to pass List of WriteObj in the Write method of the respective
concrete implementations?

Saturday, 24 August 2013

Display Dataset in gridview ( C# console application)

Display Dataset in gridview ( C# console application)

I have a DataSet in my .net client side which I want to display in
GridView. I know the syntax but I can not display it. Would you please let
me know my mistake?
System.Windows.Forms.DataGridView myGrid = new DataGridView();
myGrid.DataSource = xmlResponse.Tables[0];
I know that in this step I should bind my DataSet as:
myGrid.DataBind();
but I can not find this attribute in C# ! All I have is DataBindings and
DataBindingCompelete. Any help would be appreciated.

Place longer figures in appendix

Place longer figures in appendix

I am writing a technical document that includes many source code listings.
I have been asked to place longer listings in the appendix instead of
inline. Is there a way to do this automatically? It is also important that
references to figures in the appendix indicate where to find them.

Form data not being sent to POST

Form data not being sent to POST

This is ridiculous. My problem is as per the title. Trying to var_dump or
print_r the $_POST superglobal yields an empty array.
Take a look at my form:
<form method="post" action="" class="login">
<fieldset>
<dl>
<dt><label for="loginEmail">Email</label></dt>
<dd><input type="email" id="loginEmail" name="loginEmail"
maxLength="32" /></dd>
<dt><label for="loginPassword">Password</label></dt>
<dd><input type="password" id="loginPassword"
name="loginPassword" maxlength="64" /></dd>
<dt></dt>
<dd><input type="submit" value="submit" class="button" /></dd>
</dl>
</fieldset>
</form>
I don't see anything wrong with it. The name attribute is intact, and I'm
posting to the same page, yet POST continues to be empty. It's worth
noting I have another form on another page with similar syntax which
works.
Any ideas?

Customize marker and line style for a legend outside of an axis (pgfplots with TeXworks)

Customize marker and line style for a legend outside of an axis (pgfplots
with TeXworks)

Nice to finally post a question myself after finding solutions to my
problems on numerous occasions within these forums. I hope someone can be
of help (and that this hasn't been asked already).
The problem is as follows: I'm using pgfplots for the plots within my
document. I used the procedure described in section 4.8.7 (Legends outside
of an axis) within the pgfplots manual in order to create one legend for
several horizontally aligned plots. In general this works fine. My issue
is, that the marker style differs between the plot and the legend. I am
using the no markers option with \addplot. The legend shows the correct
line style but also markers. Is it possible to remove the markers? Did I
place the ref{} command to reference the legend in the wrong place? I
couldn't find any solution by browsing google or within the manual, hence
my question.
The code looks as follows (I can post a minimum working example if
necessary):
\begin{figure}[htb]
\centering
\begin{tikzpicture}[baseline]
\begin{axis}
[
legend columns=-1,
legend entries={$Pe_{ax} = 1$;,$Pe_{ax} = 10$;,$Pe_{ax} = 100$;,$Pe_{ax} =
1000$},
legend to name=named3,
width=6cm, height=6cm,
xmin={0},
xmax={2},
ymin={0},
ymax={2},
xtick={0,1,2},
ytick={0,2},
xlabel= {$\Theta [-]$},
ylabel={$E(\Theta) [-]$},
label style={font=\footnotesize},
tick label style={font=\footnotesize},
legend style={draw=none}
]
\addplot+[no markers,smooth, color=black, dashed] coordinates {(1,0) (1,2)};
\addplot+[no markers,smooth, color=black, dotted] table[x=X,y=Y1]
{Tabellen/Butt_1999_Bo1.txt};
\addplot+[no markers,smooth, color=black, dashdotdotted] table[x=X,y=Y1]
{Tabellen/Butt_1999_Bo10.txt};
\addplot+[no markers,smooth, color=black, dashdotted] table[x=X,y=Y1]
{Tabellen/Butt_1999_Bo100.txt};
\addplot+[no markers,smooth, color=black, solid] table[x=X,y=Y1]
{Tabellen/Butt_1999_Bo1000.txt};
\end{axis}
\end{tikzpicture}
\hspace{0cm}
\centering
\begin{tikzpicture}[baseline]
\begin{axis}
[
width=6cm, height=6cm,
xmin={0},
xmax={2},
ymin={0},
ymax={1},
xtick={0,1,2},
ytick={0,1},
xlabel= {$\Theta [-]$},
ylabel={$F(\Theta) [-]$},
label style={font=\footnotesize},
tick label style={font=\footnotesize}
]
\addplot+[no markers,smooth, color=black, dashed] coordinates {(1,0) (1,1)};
\addplot+[no markers,smooth, color=black, dotted] table[x=X,y=Y2]
{Tabellen/Butt_1999_Bo1.txt};
\addplot+[no markers,smooth, color=black, dashdotdotted] table[x=X,y=Y2]
{Tabellen/Butt_1999_Bo10.txt};
\addplot+[no markers,smooth, color=black, dashdotted] table[x=X,y=Y2]
{Tabellen/Butt_1999_Bo100.txt};
\addplot+[no markers,smooth, color=black, solid] table[x=X,y=Y2]
{Tabellen/Butt_1999_Bo1000.txt};
\end{axis}
\end{tikzpicture}
\ref{named3}
\caption{Text.}
\end{figure}
Hope this helps! Thanks in advance for any ideas, thoughts and the like!

content not staying in a circle div

content not staying in a circle div

I am unable to keep my content in my div that is a circle. Any ideas on
how to keep it in there? Here is a link to the page, you will need to
click "login" to get to the page I am talking about.
http://toothpickfactory.net/projects/homesteadmanagment/
Thank you in advance!
Love knowing I can come here and ask my 500 closest online friends for help.
<div class="wrapper">
<div class="logo">
<div style="padding-top: 3%;">
<p class="RST" data-height="50" style="line-height: 90%;">welcome</p>
<p class="RST" data-height="50" style="font-weight: bold;
line-height: 90%">manager</p>
</div>
</div>
<div class="square teal" style="width: 50%; height: 27.5%; float:left;">
<img src="img/dollar.png"/>
<p class="RST" data-height="20";>rent<br>managment</p>
</div>
<div class="square lightGreen" style="width: 50%; height: 27.5%;
float:right;">
<img src="img/tenant.png"/>
<p class="RST" data-height="20";>tenant<br>managment</p>
</div>
<div class="square lightGreen" style="width: 50%; height: 27.5%;
float:left;">
<img src="img/wrench.png"/>
<p class="RST" data-height="20";>manage<br>managment</p>
</div>
<div class="square teal" style="width: 50%; height: 27.5%; float:right;">
<img src="img/pages.png"/>
<p class="RST" data-height="20";>contract<br>managment</p>
</div>
<div class="circle">
<p>center<br>picture</p>
</div>
*{
margin: 0px;
padding: 0px;
}
#mainWrapper{
background-image: url('../img/wheat.jpg');
background-size: 100%;
background-repeat: no-repeat;
font-family: 'Didact Gothic', sans-serif;
letter-spacing: 2px;
width: 100%;
height: 100%;
}
.wrapper{
position: absolute;
left: 32%;
right: 32%;
top: 5%;
bottom: 10%;
text-align: center;
height: 466.2px;
}
.logo{
width: 100%;
height: 25%;
color: #4a9682;
}
.logo img{
height: 95%;
}
.logoP{
line-height: .8;
}
.generalBox{
width: 100%;
color: rgba(255,255,255,0.5);
outline: 0px solid transparent;
vertical-align:middle;
padding-top: 4%;
padding-bottom: 2%;
}
.generalBox img{
height: 75%;
opacity: 0.5;
}
.generalBox p{
display: inline;
position: relative;
bottom: 15%;
left: 1%;
}
.square{
color: rgba(255,255,255,0.5);
outline: 0px solid transparent;
vertical-align:middle;
padding-top: 4%;
padding-bottom: 2%;
}
.square img{
height: 60%;
opacity: 0.5;
}
.circle{
background-image: url('../img/nial.png');
width: 20%;
height: 22.5%;
border-radius: 100%;
position: relative;
top:23%;
left: 40%;
border-style: solid;
border-width: 5px;
border-color:rgba(255, 255, 255,0.9);
background-size: 100%;
background-repeat: no-repeat;
}
.circle p{
font-size: 10px;
display: inline-block;
}
/****************************************
Colors
*****************************************/
.teal{background-color:rgba(82,131,158,0.9);}
.purple{background-color:rgba(113,141,197,0.9);}
.lightBlue{background-color:rgba(140,220,239,0.9);}
.darkGreen{background-color:rgba(109,179,175,0.9);}
.lightGreen{background-color:rgba(76,201,182,0.9);}
..
.signUp{
width: 100%;
height: 10%;
}

Pressing more than one GUI element at a time in Unity

Pressing more than one GUI element at a time in Unity

I'm developing controls for a mobile platform; my GUI takes up the left,
center, and right thirds of the screen. When the player wants to jump,
they press the center button. My problem is that it seems that only one
GUI element is being allowed to be pressed at once (like the device has
only one mouse cursor that moves) rather than me being allowed to jump and
go right at the same time. My code:
// JavaScript
#pragma strict
static var guiLeft : int = 0;
static var guiRight : int = 0;
static var guiJump : int = 0;
function OnGUI () {
// leftarrow
if (GUI.RepeatButton (Rect (0,0,Screen.width/3,Screen.height), "",
GUIStyle.none)) {
guiLeft = 1;
}
else{
guiLeft = 0;
}
// right
if (GUI.RepeatButton (Rect
(Screen.width-Screen.width/3,0,Screen.width/3,Screen.height), "",
GUIStyle.none)) {
guiRight = 1;
}
else{
guiRight = 0;
}
// jump
if (GUI.RepeatButton (Rect
(Screen.width/3,0,(Screen.width/3)+2,Screen.height), "", GUIStyle.none)) {
guiJump = 1;
}
else{
guiJump = 0;
}
}

Error while creating a namespace for xml node

Error while creating a namespace for xml node

Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("GovTalkMessage");
rootElement.setAttributeNS("http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader",
"xmlns", "Test");
doc.appendChild(rootElement);
i get following error when i am trying to give namespace to existing xml
element
Exception in thread "main" org.w3c.dom.DOMException: NAMESPACE_ERR: An
attempt is made to create or change an object in a way which is incorrect
with regard to namespaces.
at
com.sun.org.apache.xerces.internal.dom.AttrNSImpl.setName(AttrNSImpl.java:109)
at
com.sun.org.apache.xerces.internal.dom.AttrNSImpl.<init>(AttrNSImpl.java:78)
at
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttributeNS(CoreDocumentImpl.java:2142)
at
com.sun.org.apache.xerces.internal.dom.ElementImpl.setAttributeNS(ElementImpl.java:659)
at try_code.main(try_code.java:26)
Java Result: 1

Poco library and mingw-w64 [on hold]

Poco library and mingw-w64 [on hold]

Does anyone have experience of compilation POCO library for the x86_64
architecture for OS Windows with compiler mingw-w64. Thank you in advance
for any help.
Detailed question:
I use mingw-w64 compiler http://mingw-w64.sourceforge.net/ personal build
rubenvb gcc 4.7.4 (link).
From Poco GitHub I download latest stable package poco-1.4.6p1.zip and
unpack package to c:/lib/poco-1.4.6p1.src directory.
Remove compiler flags -fno-cygwin from build/config/MinGW (link)
I start MSys and type:
$ cd /c/lib/poco-1.4.6p1
$ ./configure --prefix=/c/lib/poco-1.4.6p1
Configured for MinGW
$ make -s -j4
...
** Compiling src/NumberFormatter.cpp (debug, static)
src/NumberFormatter.cpp: In static member function 'static void
Poco::NumberFormatter::append(std::string&, const void*)':
src/NumberFormatter.cpp:402:42: error: cast from 'const void*' to
'Poco::UIntPtr {aka long unsigned int}' loses precision
n [-fpermissive]
make[1]: ***
[/c/lib/poco1.4.6p1.src/Foundation/obj/MinGW/ia32/debug_static/NumberFormatter.o]
Error 1
make[1]: *** Waiting for unfinished jobs....
** Compiling src/NumberParser.cpp (debug, static)
make: *** [Foundation-libexec] Error 2

Convert Image Stream (JFIF - JPEG) format to DataURI using Javascript

Convert Image Stream (JFIF - JPEG) format to DataURI using Javascript

I have tried to search an answer for this all over. It seems pretty
straightforward, but my lack of knowledge of Javascript (Been coding in
Java all along) combined with Image stream conversion on Javascript side
makes this hard.
I make a REST request url - https://<:port/getPicture and it produces a
image/jpeg streaming response.
Once I fire the url in Chrome browser - the image is rendered correctly.
It is also rendered in my angularJS app - via ng-src tag e.g.
However, when I try to set the raw data to ng-src tag, it does not seem to
work. On further reading I understood that ng-src does not accept raw
image data, but needs to be converted to a base64String to be used as a
DataURI. I tried to look up articles everywhere to convert raw image data
(JFIF format) to DataURI and was unsuccessful.
Shown below is response raw data looks (I open it in a browser, it renders
perfectly).
Questions - 1. What format is the raw data? Binary Stream or Byte Array?
Or what is it? 2. How do I convert this in to a DataURI in Javascript so
that it can be linked to my ng-src tag?
Request you to help me on this one. Seems so easy, but has taken me a week
now and driving me nuts!!
&#65533;&#65533;&#65533;&#65533;JFIF``&#65533;&#65533;C $.'
,#(7),01444'9=82lt;.342&#65533;&#65533;C /p
p2!!22222222222222222222222222222222222222222222222222&#65533;&#65533;&#65533;|&#65533;&#65533;
&#65533;&#65533;&#65533;}!1AQaq2&#65533;&#65533;&#65533;#B&#65533;&#65533;R&#65533;&#65533;$3br&#65533;br
%amp;'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;br
&#65533;&#65533;&#65533;w!1AQaq2&#65533;B&#65533;&#65533;&#65533;&#65533;
#3R&#65533;br&#65533;
$4&#65533;%&#65533;amp;'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;?&#65533;4&#65533;&#65533;&#65533;)&#65533;&#65533;&#65533;&#65533;4&#65533;&#12942;D,W&#65533;}jLsI&#1924;&#65533;Y~{&#38011;a&#65533;&#65533;6&#65533;&#1177;b&#65533;'&#65533;&#65533;I&#65533;Fj&#65533;+&#65533;&#65533;K&#65533;R
&#65533;dhr=&#65533;&#65533;&#65533;4&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;+R~S&#65533;&#65533;&#65533;Zq&#65533;&#65533;g
&#65533;5V&#1394;_&#65533;&#65533;[&#65533;y&#65533;&#65533;(,&#65533;&#65533;&#65533;&#65533;&#65533;&#1168;2&#65533;$?Z@(&#65533;&#65533;K&#65533;&#65533;I&#65533;|Ro&#65533;&#65533;G#&#1179;&#65533;&#65533;K&#65533;&#1168;&#65533;&#65533;pM7|7w&#65533;&#65533;I&#65533;&#65533;&#65533;Q@&#65533;&#65533;)&#65533;&#65533;J&#65533;&#65533;jIeo&#65533;&#65533;?&#65533;&#31733;Z&#65533;&#65533;&#65533;&#65533;&#65533;9&#65533;&#65533;8&#65533;a&#65533;&#65533;&#65533;&#65533;[W%&#65533;r&#65533;&#65533;F2E4Es&#65533;e&#65533;&#65533;/&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;]&#65533;&#65533;i&#65533;92&#65533;Pf&#65533;&#65533;&#65533;&#1859;yo&#65533;&#65533;O&#65533;&#65533;n&#65533;&#65533;&#65533;9f&#65533;]&#65533;;W&#65533;=zRt&#65533;&#65533;&#32131;&#1922;*}Z{&#1474;&#65533;P!&#65533;&#804;&#65533;YEt&#65533;s&#65533;!&#65533;&#65533;&#65533;s&#65533;&#65533;&#65533;zR&#65533;EQdP&#65533;]\&#65533;&#65533;b&#65533;@&#811;&#65533;&#65533;&#65533;&#65533;Q&#65533
;&#65533;&#65533;&#65533;&#65533;&#65533;d&#65533;&#65533;k&#65533;&#65533;t&#65533;amp;&#65533;Nk&#65533;L&#65533;&#65533;@f&#65533;amp;&#65533;Ê&#65533;u&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;code&#65533;&#65533;&#65533;-&#65533;s&#65533;/
&#65533;&#65533;&#65533;&#682;F&#65533;p)&#65533;f&#65533;c&#65533;(aLd?p&#65533;I&#65533;I&#65533;&#65533;7Rr=h&#65533;&#65533;i&#65533;&#65533;&#65533;&#65533;2=&#65533;2&#65533;4&#65533;&#65533;&#65533;P&#65533;&#65533;'&#65533;3&#25832;*&#65533;&#65533;&#65533;&#65533;%&#2006;&#65533;*]&#65533;&#65533;/codeQ&#65533;&#1676;&#65533;amp;G&#65533;+&#65533;&#65533;5&#16953;E&#65533;&#65533;Mu2F&#65533;&#65533;&#65533;&#65533;E&#65533;&#65533;&#65533;j&#980;p&#65533;&#65533;&#65533;&#65533;&#65533;_&#65533;qp&#65533;&#65533;&#65533;&#65533;^&#65533;V&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;^&#65533;&#720;&#65533;&#65533;&#65533;&#812;b&#65533;'l&#65533;E/&#65533;&#65533;'&#28443;&#65533;&#65533;/p

Friday, 23 August 2013

Parsing a string in clock format into int

Parsing a string in clock format into int

I'm new at learning Android, and working on a simple timer program. As of
now, I have the code set up to create the timer from a passed in int. The
design has a start button that will start the timer and refresh the
TextView every second with the new time.
Right now, I'm working on pausing and restarting the timer. My idea is
canceling the CountDownTimer when the user clicks pause and getting the
new value for a new CountDownTimer from the TextView that is displaying
the time when the user paused (Display as 00:00).
How do I parse the string from the TextView, getting the separate numbers
for minutes and seconds?

service reference wont update when I add a radtreeView?

service reference wont update when I add a radtreeView?

I have a web service project that is referenced by another project. In the
web service I have a function that I want to use to populate a telerik
radTreeView. The webService builds successfully but if I try to update/add
the web service to my main project I get this error:
Metadata contains a reference that cannot be resolved:
'http://localhost:49304/Service1.asmx'.
There was an error downloading
'http://localhost:49304/Service1.asmx/_vti_bin/ListData.svc/$metadata'.
The request failed with the error message:
Request format is unrecognized for URL unexpectedly ending in
'/_vti_bin/ListData.svc/$metadata'.
This is a simplified version of the web service class I'm writing:
namespace MCMwebservice
{`
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public bool getBool(RadTreeView TreeSites, string Demogs) { //dummy
method for now
return true;
}
}
If I remove the telerik radtreeview parameter then it will update, so I
know that's the issue. The main project has the telerik.web.ui and skins
dll. Is there a certain reference or tag I need to add to my main project
or in my web.config? Please Help!
thanks
Will

I'm having issues getting the qwt widget to work correctly with Qt-Creator

I'm having issues getting the qwt widget to work correctly with Qt-Creator

I'm having issues getting qwt 6.1.0 to work correctly with Qt-Creator
5.1.0. It works correctly when I launch the stand alone version of
Qt-Designer and everything compiles and runs correctly when I use
Qt-Creator. However the designer that is built into Qt-Creator does not
display the qwt widgets correctly on any forms nor give me the option to
add new qwt widgets.
I'm using Qt Creator 5.1.0 for Windows 64-bit (VS2012 with OpenGL). I've
also downloaded and compiled Qwt 6.1.0 with the aforementioned Qt-Creator,
by simply opening the qwt.pro file and compiling it. Once it was compiled
I used the 'nmake' and 'nmake install' commands from the visual studio
command prompt as directed in the Qwt instructions
(http://qwt.sourceforge.net/qwtinstall.html). I then copied the
qwt_designer_plugin.dll to the
C:\Qt\Qt5.1.0\Tools\QtCreator\bin\plugins\designer\ and
C:\Qt\Qt5.1.0\5.1.0\msvc2012_64_opengl\plugins\designer\ directories.
Does anyone have any suggestions? I can manually launch Qt-Designer and
just compile with Qt-Creator, but it is kind of annoying to have to
constantly switch back and forth and not be able to use the designer that
is bundled into Qt-Creator.

saving different dropdown in UI into one one column in database

saving different dropdown in UI into one one column in database

Name : ____txt Location : _____txt Job type : ______(dropdown
-office,mobile,home)
Post Details for Office ( this will appear when office selected in job type)
job tile office : ______(dropdown connected to server A)
Post details for Home ( appear when home selected in job type) Job tile
home: _____ (dropdown connected to server B)
Post details for mobile (appear when mobile selected in job type) job
title mobile: _____ (dropdown connected to server C)
this should be inserted in to a new table
insert into (name,location,job_type,job_title) values
(name,location,jobtype,jobtitle).
here in this insert command jobtitle is related to all three dropdown
home,office,mobile) at a time only one can selected. but I need to store
the job title into one column no matter which dropdown is selected.

Text to the right of piecewise equation

Text to the right of piecewise equation

I have the following piecewise functions:
\begin{align*}
K(u) &= \begin{cases}
\frac{1}{2} & -1 \leq u \leq 1 \\
0 & \text{sonst}
\end{cases} \\ \\
K(u) &= \begin{cases}
\frac{3}{4}(1-u^{2}) & -1 \leq u \leq 1 \\
0 & \text{sonst}
\end{cases} \\ \\
K(u) &= \frac{1}{\sqrt{2\pi}}\text{exp}\left(-\frac{1}{2}u^{2} \right) \\ \\
K(u)&= \begin{cases}
\frac{3}{8}(3-5t^{2}) & -1 \leq u \leq 1 \\
0 & \text{sonst}
\end{cases}
\end{align*}
I would like to label each of these functions by placing text to the right
of them, in between the two cases. However, so far I've only managed to
put text on the same line as the cases.
Thanks!

Thursday, 22 August 2013

Is there a way to programmatically detect if an iPhone is being used?

Is there a way to programmatically detect if an iPhone is being used?

Is there a way to programmatically detect if an iPhone is being used?
I looked at the UIScreen Class Reference. I didn't see any method or
property.

How to PROPERLY check android permission dynamically

How to PROPERLY check android permission dynamically

Multiple choice question:
which of the follow will correctly check whether or not an application has
a certain permission declared in their AndroidManifest.xml?
getContext().checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED
or
getContext().getPackageManager().checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
getContext().getPackageName()) == PackageManager.PERMISSION_GRANTED
Basically, i got scared from the android documentation of what
checkCallingOrSelfPermission claims -> it grants an IPC permissions if you
just check for it?? what does that even mean?
http://developer.android.com/reference/android/content/Context.html#checkCallingOrSelfPermission(java.lang.String)
So any explanation on the true differences would be awesome :D
*note: I am giving this code in a library, so i am only allowed to check
permissions at runtime, unless you know of a better way.

error C2512 no appropriate default constructor available

error C2512 no appropriate default constructor available

ok so im having this issue involving two classes.
Dice.h:
#pragma once
#include <random>
using std::random_device;
using std::uniform_int_distribution;
class Dice
{
public:
Dice(int Sides);
int roll(void);
protected:
int nSides;
random_device generator;
uniform_int_distribution<int> distribution;
};
Dice.cpp:
#include "Dice.h"
Dice::Dice(int Sides)
{
nSides=Sides;
}
int Dice::roll(void)
{
random_device generator;
uniform_int_distribution<int> distribution(1,nSides);
return distribution(generator);
}
DmgCalc.h:
#pragma once
#include "CharSheet.h"
#include "Dice.h"
class DmgCalc
{
public:
DmgCalc(CharSheet P1, CharSheet P2);
bool Dodge();
int Attack();
int Roll();
protected:
int nP1Con, nP1Str, nP1Dex;
int nP2Con, nP2Dex, nP2Hlth;
Dice d6;
};
DmgCalc.cpp:
#include "DmgCalc.h"
DmgCalc::DmgCalc(CharSheet P1, CharSheet P2)
{
nP1Str=P1.getStr();
nP1Dex=P1.getDex();
nP2Con=P2.getCon();
nP2Dex=P2.getDex();
nP2Hlth=P2.getHlth();
Dice d6(6);
}
bool DmgCalc::Dodge()
{
return ((nP1Dex + d6.roll())-(nP2Dex + d6.roll()) > 0);
}
int DmgCalc::Attack()
{
nP2Hlth-=((nP1Str + d6.roll())-(nP2Con));
return nP2Hlth;
}
int DmgCalc::Roll()
{
return d6.roll();
}
Whenever I try and compile I get this error:
Error 2 error C2512: 'Dice' : no appropriate default constructor
available
If I create another constructor for Dice with the format void Dice(void);
it works just fine.
Any help would be greatly appreciated

How do I make my Image go full screen width?

How do I make my Image go full screen width?

How do I make my Image go full screen width when viewing on a mobile,
noting that it's not meant to be fullwidth on a desktop. An example to
make it even more clear. Microsoft's home page has a slider that is not
fullwidth, but resize the browser and it goes fullwidth without any
padding. I can't figure out what I need to do in my css to make that
happen. I know I have to add something in media query, and I've tried, but
haven't succeeded. Link to my site.

Using OpenCL in linux and IDEs

Using OpenCL in linux and IDEs

For using OpenCL in linux should I have NVIDIA GPU? In my computer I have
an Intel GPU and i3 Intel CPU supported SSE3 and SSE4, I want program
whith OpenCL in windows can I use an other IDE than "Visual Studio" for
example "Code Blocks"? Thank you

ubuntu å vs osx å?

ubuntu å vs osx a&#778;?

Not sure if this is a ubuntu or osx question, but I'll start here. I'll
leave it to the mods to move the question to AskDifferent if more
apropriate.
I moved a file from ubuntu to osx using scp on the apple machine. I edited
the file on the apple machine. Then I moved the file back, again using scp
on the apple machine.
The filename of the source file was Documents/trettiårsfirarätare.
The filename I got back had the name
Documents/trettia&#778;rsfirara&#776;tare.
While these might look similar, the letters å and ä is actually different
between them. At no point did I change the name of the file.
This makes little technical difference to me, I just changed the name of
the file back to what ubuntu considers å and ä, but it tickled my
curiosity.
Can you explain to me why this happened?

Wednesday, 21 August 2013

Change Cell Accessory Type?

Change Cell Accessory Type?

I have a tableview called "AllOne.h" with cells that are all subtitle
style cells with a disclosure indicator. The subtitle text is generated
dynamically, so it's pretty likely each cell will have different subtitle
text. I have an if statement that says if the text = "hello, world", then
it changes accessory type to detaildisclosureindicator. When the
detaildisclosureindicator is pressed, it pushes a new controller, changes
the subtitle text, then pops that view controller and returns to
"allone.h". The problem is, it still shows the detaildisclosureindicator
even if the text != "hello, world". I tried changing the style in
viewWillAppear, but I don't have access to cell. Here is my code.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//populate cells with stuff
if(cell.detailTextLabel.text isEqualToString:@"hello, world"){
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}
So I guess my question is, how do I change the accessory type back once I
return to "allone.h" and the cell's text is no longer "hello, world"?

How to match a non string in gnu grep

How to match a non string in gnu grep

I'll use an example to illustrate my problem. Suppose we have the file
name 'file.txt' that contains the following string:
AooYoZooYZoAoooooYZ
I'd like to use grep to find all substrings that begin with 'A' and end
with 'YZ' but do not contain 'YZ' in between the 'A' and 'YZ'. The desired
output would be:
AooYoZooYZ
AoooooYZ
My best guess is to do the following:
$grep -E -o 'A[^(YZ)]*YZ' file.txt
But the output is only:
AoooooYZ
I'd like the parentheses to hold their meaning for the YZ but I read in
the GNU grep manual (http://www.gnu.org/software/grep/manual/grep.html)
that: "Most meta-characters lose their special meaning inside bracket
expressions." I've also tried:
$grep -E -o 'A.*YZ file.txt
But this outputs the entire line:
AooYoZooYZoAoooooYZ
Is there a way to override this or another way of solving my problem?

how to put specific strings in array with specific keys PHP

how to put specific strings in array with specific keys PHP

I have a string pulling from a socket:
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
X-CALENDARSERVER-ACCESS:PUBLIC
BEGIN:VTIMEZONE
TZID:Pacific Time
BEGIN:STANDARD
DTSTART:20081101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
....
I would like to have it so it is like this:
$data['PRODID'] = -//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
$data['VERSION'] = 2.0
.......
I did try parse_str but that didn't work. Is there a easy way?
Thanks

Android custom colored buttons, avoid redundant code

Android custom colored buttons, avoid redundant code

I created an Android app with a 4x6 grid of buttons. This buttons should
all have different background colors.
I could achieve this by creating 24 custom shapes like
drawable\red_botton.xml, drawable\green_botton.xml, ... and set them as
android:background property.
But this would produce tons of redundant xml code. Is there a better way?

How can I instantly display text from an Edittext in a TextView?

How can I instantly display text from an Edittext in a TextView?

I am basically trying to do this simple thing: I have got an Edittext and
a TextView. Now I would like to instantly (character by character) display
the text that is entered in the edittext in the textview. In addition,
when the backspace key is pressed and one charcter is deleted from the
editext, this should also happen in the textview.
In short: I want to display everything from the edittext immediately in
the textview. How can I do that?
Here is some code that I tried, but that didn't work for me. When I run it
on a emulator with Android 4.0 (and use the computer keyboard for input),
every character is displayed twice in the textview and there is no text in
the edittext. On the other hand, when I use an emulator with Android 2.3.3
(and use the emulator keyboard for input) there is no text in the
textview, however the edittext works fine.
In onCreate() I call my method setListener(). This looks like this:
private void setListener() {
mEdittext.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
String str = mTextview.getText().toString();
if(keyCode == KeyEvent.KEYCODE_DEL && str.length() > 0) {
str = str.substring(0, str.length()-1);
} else {
char newChar = (char)event.getUnicodeChar();
str = str.concat(Character.toString(newChar)) ;
}
mTextview.setText(str);
return true;
}
});
}
Any ideas to fix this?

Automatically turn ON usb debugging mode of Android device using java

Automatically turn ON usb debugging mode of Android device using java

Is there any technique in java through which we can get into android
device and turn on its USB debugging mode ON.

Set GridLayout row height in Vaadin

Set GridLayout row height in Vaadin

Very straight forward question, if you have a GridLayout defined in
Vaadin, how can you set the height of all / individual rows? E.g:
mainLayout = new GridLayout(2, 7);
mainLayout.setMargin(true);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
// Set row[s] height?
Thanks in advance!

Tuesday, 20 August 2013

PHP include file have extra characters

PHP include file have extra characters

I am using some php/html code to display a navigation bar with
highlighting currently active link.
This is my Code -
<?php
$path = $_SERVER['PHP_SELF'];
$page = basename($path);
$page = basename($path, '.php');
?>
<ul>
<li <?php if ( $page == 'index') echo 'class="current"'; ?>><a
href="index.php">Change Contact Details</a></li>
<li <?php if ( $page == 'change_password') echo 'class="current"';
?>><a href="change_password.php">Change Password</a></li>
<li><a href="change_username.html">Change Username</a></li>
<li><a href="create_blogs.html">Manage Blogs</a></li>
<li><a href="#">Manage Images</a></li>
<li><a href="#">About Your Business</a></li>
<li><a href="#">Be Social</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
When I use this code dirctly in each page its working properly. But when I
use this as include file and trying to import it to my pages. its display
some extra character very before the <ul> list.
Its characters are something like this - 
I checked my pages and I couldn't fine any typed word to like that.
Can anybody tell me what is the reason for this? Thank you.

jquery validation working in ie8 but not ie9

jquery validation working in ie8 but not ie9

I've used Jquery Validation in many projects without issue. For the first
time, I'm attempting to use Bootstrap along with the Jquery Validation
script and it works in every browser--except IE9! It works in IE8 for God
sake. I'm hoping it's something that I'm overlooking. Does anyone have any
idea why? This is my first post to the site, so I hope I have this setup
properly.
The majority of the code that is useful is below:
<form action="#" method="post" class="form-horizontal" role="form"
id="login_form" name="login_form">
<fieldset>
<div class="form-group">
<label for="email"
class="control-label">Email</label>
<div>
<input type="text" name="email"
id="email" class="form-control">
</div>
</div>
<div class="form-group">
<label for="password"
class="control-label">Password</label>
<div>
<input type="password"
name="password" id="password"
class="form-control">
</div>
</div>
<div class="form-group">
<input type="submit" class="btn
btn-primary btn-large"
value="Sign-in">
</div>
</fieldset>
</form>
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script
src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script
src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){
$("#login_form").validate({
rules: {
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 6
}
}
});
});
</script>
<script src="bootstrap/js/bootstrap.min.js"></script>