Monday, 30 September 2013

WiFi on WPA2: Can't Access Internet, Can Access LAN

WiFi on WPA2: Can't Access Internet, Can Access LAN

The WiFi in my laptop seems to be having a problem with WPA2. I can
connect to my network without issue and everything works fine for up to 5
minutes, but then I can't access the Internet. The network configuration
still thinks all is well, but I can't reach any hosts. I can, however,
reach anything inside my LAN.
Switching to my open guest network allows me full access to the internet
with no interruptions indefinitely.
lspci reports the following about my wireless adapter:
Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron]
Network Connection (rev 61)
Any suggestions?

Why was this very low quality flag declined=?iso-8859-1?Q?=3F_=96_meta.stackoverflow.com?=

Why was this very low quality flag declined? – meta.stackoverflow.com

Question: Cyrus beck line algorithm program in c or c++. I know about the
specific meaning of VLQ flags, and I can't fathom why anyone would think
that question wouldn't be a candidate for removal. …

Ball Dropping Simulation Program, simulating a random direction bounce in C? [on hold]

Ball Dropping Simulation Program, simulating a random direction bounce in
C? [on hold]

This is in C only, not C++
The entire program is supposed to ask the user how many balls to drop,
make sure that number is at least one. And then simulate dropping the
balls, and allowing them to "bounce" ten times each, and then keep track
in an array how many balls landed in each array. Each bounce allows the
ball to either go left once or right once. This is all I have so far, any
tips?
When I go to print out the final product it should look something like
this. With each 'o' representing one ball dropped in that place
-10:
-8:
-6: o
-4: ooooooooo
-2: oooooooooooooooooooooo
0: ooooooooooooooooooooooooo
2: oooooooooooooooooooooo
4: ooooooooooooo
6: ooooooo
8:
10: o
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int drop_balls(int); /* Prototype for drop_Balls, int parameter is number
of balls being dropped */
int get_num_balls(int); /* Gets the number of balls that need to be
dropped by the user */
int main()
{
get_num_balls();
drop_balls(num_balls);
}
int get_num_balls()
{
printf("How many balls should be dropped? ");
scanf("%d", num_balls);
while(num_balls <= 0)
{
printf("You have to drop at least one ball! \n ")
printf("How many balls should be dropped? ");
scanf("%d", num_balls);
}
return num_balls; /* Return the number of balls that will be dropped */
}
int drop_balls(num_balls)
{
int ball_count[21]; /* Keeps track of how many balls landed where */
int ball_num = 0; /* What number ball are we on */
srand(time(NULL)); /* Seed the generator */
for(ball_num; ball_num < num_balls; ball_num++ ) /* Do the correct #
of balls */
{
int starting_point = 10; /* Start at 10 since its the middle of 21 */
for(starting_point; starting_point >=0; starting_point--) /*
Bounce each ball 10 times */
{
int number;
number = rand() % 100;
if(number > 50)
{
starting_point++;
}
else
{
starting_point--;
}
}
ball_count[starting_point] += "o"
}
int j;
for(j = 0; j < 21; j++)
{
if(ball_count[j] != 'null')
{
printf("'%d :'", ball_count[j]);
}
}
}
}

getString() method for a class which extends from LinearLayout

getString() method for a class which extends from LinearLayout

I have a class which extends from LinearLayout. I want to use a string
from string.xml . Normally I use the following code:
this.getString(R.string.xxxx);
But since my class extends from LinearLayout I can't call getString()
method. How can i access those strings which are in my string.xml from my
class?

Sunday, 29 September 2013

How to copy a certain data from multiple excel file with diffrent name into one master excel file

How to copy a certain data from multiple excel file with diffrent name
into one master excel file

I need help to compile a certain data from multiple excel file with a
different name onto one sheets (excel file located at certain location
folder). The data from each file that i want to grap :
1) B69 until E69 & I69
2) B75 until E75 & I75
And compile it into below format (summary) file: each row differentiate by
diffetrent excels file name :
Title Title Title Title Title Title Title Title Title Title B69 C69 D69
E69 I69 B75 C75 D75 E75 I75 B69 C69 D69 E69 I69 B75 C75 D75 E75 I75 B69
C69 D69 E69 I69 B75 C75 D75 E75 I75 B69 C69 D69 E69 I69 B75 C75 D75 E75
I75 B69 C69 D69 E69 I69 B75 C75 D75 E75 I75
I do this by daily basis & the data that i need to compile 100+ excel file
a day. Really hoping if some one could provide me a script to run macro on
this precedure

If total is between two numbers echo statement, else if between different set of numbers echo a different statement, etc

If total is between two numbers echo statement, else if between different
set of numbers echo a different statement, etc

I am terrible with figuring out if/else statements. I have looked at
multiple tutorials and just can't get what I'm trying to do work. I need
this: If total amount of points is less than # state that no title is
achieved If total amount is between # and # state what title that would be
If total amount is between higher # and # state what title that would be
etc.
The adding of total points works just fine but I can't figure out how to
get the correct title for the total points to show. I have included the
code for getting totalpoints as well in case it can be combined with what
I am trying to do. Any help greatly appreciated
This works just fine:
<?php
$query = "SELECT points, SUM(points) AS totalpoints FROM competition WHERE
id = $id";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<b>";
echo $row['totalpoints'];
echo "pts</b>";
}?>
This does not work:
<?php
$query = "SELECT points, SUM(points) AS totalpoints FROM competition WHERE
id = $id";
$result = mysql_query($query) or die(mysql_error());
while($titled = mysql_fetch_array($result)) {
if ($titled <= 999)
{echo ", not titled";}
elseif (($titled == 1000) && ($titled <= 1999))
{$titlename = ", Champion";}
elseif (($titled >= 2000) && ($titled <= 2999))
{$titlename = ", Grand Champion";}
elseif (($titled >= 3000) && ($titled <= 3999))
{$titlename = ", Honor Champion";}
elseif (($titled >= 4000) && ($titled <= 5999))
{$titlename = ", Regional Champion";}
elseif (($titled >= 6000) && ($titled <= 7999))
{$titlename = ", State Champion";}
elseif (($titled >= 8000) && ($titled <= 9999))
{$titlename = ", National Champion";}
elseif (($titled >= 10000) && ($titled <= 19999))
{$titlename = ", World Champion";}
elseif ($titled >= 20000)
{$titlename = ", Hall of Fame";}
}?>

Is it good programming pracitce to assign Singleton to variables across multiple classes

Is it good programming pracitce to assign Singleton to variables across
multiple classes

In my app I'm using singleton class (as sharedInstance). Of course I need
to use data that is stored in that singleton in multiple classes (view
controllers). Because writing
[[[SingletonClass sharedInstance] arrayWithData] count] or
[[[SingletonClass sharedIntanse] arrayWithData] objectAtIndex:index] or
some other methods that you use on array is not comfortable I thought to,
in the begining of lifecycle of non-singleton class, assign property
(strong, nonatomic) of that non-singleton class to have the same address
as SingletonClass.
self.arrayPropertyOfOtherClassOne = [[SingletonClass sharedInstance]
arrayWithData] and in some other class
self.arrayPropertyOfOtherClassTwo = [[SingletonClass sharedInstance]
arrayWithData]
Is it good programming practice?
In my opinion there is nothing bad with it. Properties will point to the
same address as property in Singleton and after non-singleton class will
be destroyed also properties that where pointing to singleton so Reference
Count = Refrence count - 1.
Am I correct?

Saturday, 28 September 2013

Osascript keycodes for arrow keys

Osascript keycodes for arrow keys

I'm trying to call osascript in Python to simulate key presses with
something like this:
cmd = """
osascript -e 'tell application "System Events" to keystroke "e"'
"""
os.system(cmd)
How can I send key presses for the up/down/left/right arrow keys?

Turning SQL Distinct data into readable list in php

Turning SQL Distinct data into readable list in php

I have some custom tables in Wordpress that store information about
people, linked to a post, and I want to be able to generate a summary of
the data, specifically, a sentence along the lines of:
"This post mentions 4 surnames: Brown, Jones, Robinson and Smith"
I currently pull out the data as follows:
$surnames = $wpdb->get_results("
SELECT distinct lastname
FROM ".$wpdb->prefix."people
WHERE post_id='$post_id'
ORDER BY lastname asc");
Which returns an array of objects as follows:
Array (
[0] => stdClass Object ([lastname] => Brown )
[1] => stdClass Object ( [lastname] => Jones )
[2] => stdClass Object ( [lastname] => Robinson )
[3] => stdClass Object ( [lastname] => Smith )
)
So at the moment, I just do this:
foreach ($surnames as $surname) {$summary .= $surname->lastname.', ';}
which returns:
Brown, Jones, Robinson, Smith,
Clearly not acceptable.
Is there any standard php function that can do this, AND that will work on
an array of objects? I'd imagine this is a common problem, and I'm trying
to avoid reinventing the wheel if possible.

How to parse XML data into below code instead of JSON

How to parse XML data into below code instead of JSON

I am new to Android and Java. Below code parses JSON data from URL and
populates into ListView. But I have URL that sends XML data, so I want to
Parse XML instead of JSON and populate same in ListView. What changes do i
require into this code. Let me know if you require other classes code.
public class RemoteFetchService extends Service {
private int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
private AQuery aquery;
private String remoteJsonUrl =
"http://laaptu.files.wordpress.com/2013/07/widgetlist.key";
public static ArrayList<ListItem> listItemList;
private int count = 0;
@Override
public IBinder onBind(Intent arg0) {
return null;
}
/*
* Retrieve appwidget id from intent it is needed to update widget later
* initialize our AQuery class
*/
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID))
appWidgetId = intent.getIntExtra(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
aquery = new AQuery(getBaseContext());
fetchDataFromWeb();
return super.onStartCommand(intent, flags, startId);
}
/**
* method which fetches data(json) from web aquery takes params
* remoteJsonUrl = from where data to be fetched String.class = return
* format of data once fetched i.e. in which format the fetched data be
* returned AjaxCallback = class to notify with data once it is fetched
*/
private void fetchDataFromWeb() {
aquery.ajax(remoteJsonUrl, String.class, new AjaxCallback<String>() {
@Override
public void callback(String url, String result, AjaxStatus
status) {
processResult(result);
super.callback(url, result, status);
}
});
}
/**
* Json parsing of result and populating ArrayList<ListItem> as per json
* data retrieved from the string
*/
private void processResult(String result) {
Log.i("Resutl", result);
listItemList = new ArrayList<ListItem>();
try {
JSONArray jsonArray = new JSONArray(result);
int length = jsonArray.length();
for (int i = 0; i < length; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
ListItem listItem = new ListItem();
listItem.heading = jsonObject.getString("title");
listItem.content = jsonObject.getString("description");
listItem.imageUrl = jsonObject.getString("imageUrl");
listItemList.add(listItem);
}
storeListItem();
} catch (JSONException e) {
e.printStackTrace();
}
}
/**
* Instead of using static ArrayList as we have used before,no we rely
upon
* data stored on database so saving the fetched json file content into
* database and at same time downloading the image from web as well
*/
private void storeListItem() {
DatabaseManager dbManager = DatabaseManager.INSTANCE;
dbManager.init(getBaseContext());
dbManager.storeListItems(appWidgetId, listItemList);
int length = listItemList.size();
for (int i = 0; i < length; i++) {
ListItem listItem = listItemList.get(i);
final int index = i;
aquery.ajax(listItem.imageUrl, Bitmap.class,
new AjaxCallback<Bitmap>() {
@Override
public void callback(String url, Bitmap bitmap,
AjaxStatus status) {
super.callback(url, bitmap, status);
storeBitmap(index, bitmap);
};
});
}
}
/**
* Saving the downloaded images into file and after all the download of
* images be complete begin to populate widget as done previously
*/
private void storeBitmap(int index, Bitmap bitmap) {
FileManager.INSTANCE.storeBitmap(appWidgetId, bitmap,
listItemList.get(index).heading, getBaseContext());
count++;
Log.i("count",
String.valueOf(count) + "::"
+ Integer.toString(listItemList.size()));
if (count == listItemList.size()) {
count = 0;
populateWidget();
}
}
/**
* Method which sends broadcast to WidgetProvider so that widget is
notified
* to do necessary action and here action == WidgetProvider.DATA_FETCHED
*/
private void populateWidget() {
Intent widgetUpdateIntent = new Intent();
widgetUpdateIntent.setAction(WidgetProvider.DATA_FETCHED);
widgetUpdateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);
sendBroadcast(widgetUpdateIntent);
this.stopSelf();
}
}

why coinbase callback url not working?

why coinbase callback url not working?

i have the below code for button creation. public function
createButton($name, $price, $currency, $custom=null,
$options=array(),$callback) { //
$callback=$this->generateReceiveAddress("http://www.tgigo.com");
// print_r($callback);exit;
$params = array(
"name" => $name,
"price_string" => $price,
"price_currency_iso" => $currency,
"callback_url"=>"http://www.tgigo.com"
);
if($custom !== null) {
$params['custom'] = $custom;
}
foreach($options as $option => $value) {
$params[$option] = $value;
}
return $this->createButtonWithOptions($params);
}
public function createButtonWithOptions($options=array())
{
$response = $this->post("buttons", array( "button" => $options ));
if(!$response->success) {
return $response;
}
$returnValue = new stdClass();
$returnValue->button = $response->button;
$returnValue->embedHtml = "<div class=\"coinbase-button\"
data-code=\"" . $response->button->code . "\"></div><script
src=\"https://coinbase.com/assets/button.js\"
type=\"text/javascript\"></script>";
$returnValue->success = true;
return $returnValue;
}
and i have the below response for above code.
{"success":true,"button":{"code":"675cda22e31b314db557f0538f8ad27e","type":"buy_now","style":"buy_now_large","text":"Pay
With Bitcoin","name":"Your Order #1234","description":"1 widget at
$100","custom":"my custom tracking code for this
order","callback_url":"http://www.tgigo.com","price":{"cents":100000,"currency_iso":"BTC"}}}
using this code payment process completed,but not redirected to the call
back url. any one please help me.
Thanks in advance :)

Friday, 27 September 2013

How do I allow a user to input strings into an array until they hit enter with no text input?

How do I allow a user to input strings into an array until they hit enter
with no text input?

I'm really hoping someone can help me out here. I'm still fairly new to
Java and I have spent hours trying to figure out how to do this. I have a
loop to prompt the user to input text (string) into an arraylist however,
I cannot figure out how to end the loop and display their input (I want
this to happen when they press 'enter' with a blank text field. Here is
what I have - Thank you in advance!!
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Ex01 {
public static void main(String[] args) throws IOException {
BufferedReader userInput = new BufferedReader(new InputStreamReader(
System.in));
ArrayList<String> myArr = new ArrayList<String>();
myArr.add("Zero");
myArr.add("One");
myArr.add("Two");
myArr.add("Three");
do {
System.out.println("Enter a line of text to add to the array: ");
String textLine = userInput.readLine();
myArr.add(textLine);
} while (userInput!=null);
for (int x = 0; x < myArr.size(); ++x)
System.out.println("position " + x + " contains the text: "
+ myArr.get(x));
}
}

How do I restore the state of the In-app billing IabHelper?

How do I restore the state of the In-app billing IabHelper?

I have an issue with the IabHelper when I rotate my device.
If I call launchPurchaseFlow with a requestCode of 6, the in-app billing
dialog opens.
If I rotate the device, the dialog stays open, but when I close it,
onActivityResult gets called, and the IabHelper's handleActivityResult
method is called, but the initial check for the matching requestCode fails
because the IabHelper was nulled from the Activity's onDestroy method.
This failure makes it so my onPurchasedFinishedListener does not get
called.
I need help because it is very important that the listener is called. I'm
surprised this hasn't been reported, since the docs recommend you destroy
the IabHelper in onDestroy.. Am I missing something?

phpmyadmin warning, "The additional features for working with linked tables have been deactivated"

phpmyadmin warning, "The additional features for working with linked
tables have been deactivated"

In the footer of the phpmyadmin homepage is a warning that reads, "The
additional features for working with linked tables have been deactivated.
To find out why click here."

WPF TreeViewItem Deselect Not Changing Underlying Data

WPF TreeViewItem Deselect Not Changing Underlying Data

I have a TreeView that's databound to a class with various properties, one
of which is an "IsChecked" boolean that is supposed to represent whether
the item in the tree is checked or not. Deselecting the item seems to
work, the code runs through the "Set" of the property and looks to alter
it, however when the property is referenced later, I see that the value
has not changed.
I need for the underlying class property's value to change when the tree
view item it's bound to is selected/deselected.
This is the property.
Public Property IsChecked() As System.Nullable(Of Boolean)
Get
Return isCheckedLocal
End Get
Set(value As System.Nullable(Of Boolean))
If isCheckedLocal = value Then
Return
Else
isCheckedLocal = value
RaiseEvent selectionChanged(BusGrp, Name, value)
End If
End Set
End Property
Here is the TreeView XAML:
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=BusGrps}">
<CheckBox Content="{Binding Path=Name}" IsEnabled="{Binding
Path=Enabled}" IsChecked="{Binding Path=IsChecked,
Mode=TwoWay}"></CheckBox>
<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Programs}">
<CheckBox Content="{Binding Path=Name}" IsEnabled="{Binding
Path=Enabled}" IsChecked="{Binding Path=IsChecked,
Mode=TwoWay}"></CheckBox>
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Path=Name}"
IsEnabled="{Binding Path=Enabled}" IsChecked="{Binding
Path=IsChecked, Mode=TwoWay}"></CheckBox>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>

How to Join to tables for each row of the other table?

How to Join to tables for each row of the other table?

I am converting some old code to get it more optimize so i stuck here i
can do it as old way by firing 2 stored procedures but i was thinking if
it is possible with the join i tried but couldn't get it right so any help
would be great
My old code and queries
dataset = Select data1,data2,data3 from table where column1='somevalue'
//now consider dataset have the records of the above query then
foreach (row in dataset)
{
Select top 1 tab2data,tab2data from table2 with (nolock) where
LtrFileName = row.data1
//Do some more functionality i can handle this part
}
so i was trying to combine these two queries by join i got it right with
left join but i can't figure out about the top 1 it gives wrong output if
apply it with the join .so basically i am asking is there a way to get
these two queries into one stored procedure and avoid all the foreach
coding part .

Windows 8 64 bit ruby-debug-ide install of linecache19 failing due to gcc -m64 flag error: sorry, unimplemented: 64-bit mode not compiled...

Windows 8 64 bit ruby-debug-ide install of linecache19 failing due to gcc
-m64 flag error: sorry, unimplemented: 64-bit mode not compiled...

I am going through the install for windows per Is ruby-debug-ide available
to be installed on windows with ruby1.9.3? downloaded the gems and begin
to install them. But get this 64 bit error. Is there a 32 bit version of
linecache19. Do I need a different gcc compiler?
C:\JRuby\lib\ruby\gems\shared>gem install linecache19-0.5.13.gem
Building native extensions. This could take a while...
ERROR: Error installing linecache19-0.5.13.gem:
ERROR: Failed to build gem native extension.
C:/JRuby/bin/jruby.exe extconf.rb
C:/JRuby/lib/ruby/shared/mkmf.rb:14: Use RbConfig instead of obsolete and
deprecated Config.
checking for vm_core.h... no
checking for vm_core.h... yes
checking for version.h... yes
creating Makefile
make
gcc -I. -IC:/JRuby/lib/native/include -IC:/JRuby/lib/native/include/ruby
-I. -DHAVE_VM_CORE_H -DHAVE_VERSION_H -IC:/JRuby/lib/native/include
/ruby-1.9.3-p392 -fno-omit-frame-pointer -fno-strict-aliasing
-fexceptions -m64 -march=native -mtune=native -c trace_nums.c
trace_nums.c:1:0: sorry, unimplemented: 64-bit mode not compiled in

Thursday, 26 September 2013

Unique URL for Images on the same page

Unique URL for Images on the same page

I am trying to integrate the Facebook like button on my website for
individual images. The easiest way I thought to do this would be to give
each image a unique URL on a page for example:
http://photography.theamateurproject.com/aurora_borealis.php?id=1074
Here is my current link code: a class={$row['class']} img
src=theamateurproject.com/uploaded_files/{$row['image']}
onclick=ChangeImage{$row['id']}()
; /a";
And I am currently using this function to change the image on click:
echo <<< EOT function ChangeImage{$row['id']}(){
document.getElementById("$image1").innerHTML= "div h1 align='center'
{$row['title']} /h1" + "a class={$row['class2']} img
src=theamateurproject.com/uploaded_files/{$row['image']} style='float:
left;' /a" + "div span {$row['description']} /span /div /div" }
Unfortunately this does not change the URL only the content in the element
div.
I am trying to convert it to PHP so that the image will have a unique URL,
but I am not having any success.
When I try editing the link to equal the image ID number it doesn't load
the image or content that goes with the image.
Any suggestions on a different route I should take? Thank you!

Thursday, 19 September 2013

How to solve this with LINQ?

How to solve this with LINQ?

I have a list contain CategoryId and StatusId. If their is a specific
Status then I want to remove all the CategoryId from the list.

In this example I want to remove all the StatusId = 1 and remove that
CategoryId from the list as well. So, in this case Id 1, 3 and 4 will be
removed.
Dim list As New List(Of CatlogViewModel)
' CatlogViewModel has the property of Id, CategoryId, StatusId

sticky positioning in email for IOS 7

sticky positioning in email for IOS 7

For iOS email I'd like to have a fixed position banner.
I am using: { position: -webkit-sticky !important; top: 10px !important; }
But in the iOS 7 email app the fixed position function & Sticky function
are not working.
Is there any way to solve this?

Building a QGridLayout with images using QPixMap?

Building a QGridLayout with images using QPixMap?

I' making a program that reads in files from a directory and takes some
information from said files. I want to output this information to a
QGridLayout with the following format:

I was thinking of using a QLabel array and pixmaping the images to the
labels. That kind of works so far but I really don't know how to attach
the labels to the images. Can anyone explain how I could do that?

How to implement vakue annotation in a spring-batch

How to implement vakue annotation in a spring-batch

How do I implement @Value in a spring batch program.. any suggestions.. I
wanted to get values from a property file, values like web-services end
point, target then db details..

Failsafe for PHP Simple HTML DOM Parser

Failsafe for PHP Simple HTML DOM Parser

Using PHP Simple HTML DOM Parser (http://simplehtmldom.sourceforge.net), I
recently had a situation where the external webpage I routinely fetch was
not responding (their servers were down). Because of this the my own
website would not load (instead it showed errors after a lengthy wait
period).
What would be the best way to add a failsafe to this parser upon an
unsucessful fetch attempt?
I have tried to use the following below without success.
include('./inc/simple_html_dom.php');
$html = file_get_html('http://client0.example.com/dcnum.php?count=1');
$str = $html->find('body',0);
$num = $str->innertext;
if(!$html)
{
error('No response.')
}
$html->clear();
unset($html);
EDIT: I haven't had time to try this yet, but perhaps I could place my
'if' statement directly after the first line (before the
$html->find('body',0) part).

How to connect Java server(Glassfish) and Flash(games)

How to connect Java server(Glassfish) and Flash(games)

I would like to write game using Flash which will be communicate with my
Java server(Glassfish). My first thought was to use XMLSocket but write
the whole communication with this would be difdicult I have no experiance
with Flash so maybe better idea will be write all(comunication with
database ect.) inside Flash ? I read something about media server(red5,
Adobe Flash Media Server) but i have no idea how it would work and whether
it would be appropriate solution for me. Is there anyone who has some
experiance in connecting these two technology ?

How to solve undefined index error

How to solve undefined index error

if(isset($_SESSION['evt_year'])
|| isset($_SESSION['evt_title'])
|| isset($_SESSION['evt_sdate'])
|| isset($_SESSION['evt_place'])
|| isset($_SESSION['evt_stime'])
|| isset($_SESSION['evt_etime'])
|| isset($_SESSION['evt_desc'])) {
$output.=$_GET['title']; //the error is here
}
else {
$output.="";
}
Notice the error I got:
Undefined index: title in
C:\xampp\htdocs\ICT\abc\cal1\EventCalender\classes\EventRecordForm.php on
line 13

Wednesday, 18 September 2013

Cannot get spray-json dependency to work in play project

Cannot get spray-json dependency to work in play project

I have spent countless hours trying to get spray json to be included as a
dependency in my play project built on scala 2.10.
Can someone provide definitive explanation for the EXACT magical
incantions to use in the project files for this thing?!!!!
thanks, JR

Displaying Digits Beginning from 0.000000001 to 0.999999999 in C

Displaying Digits Beginning from 0.000000001 to 0.999999999 in C

I'm trying to print out the numbers mentioned in the title with a loop
with the following code:
#include <stdio.h>
int ceiling = 1;
float counter = 0;
int main()
{
while (counter < ceiling)
{
printf("%f\n", counter);
counter = counter + 0.000000001;
}
}
but it only gives me 7 digits of precision. Is there any way to get 10
digits of precision?

How to properly write the import statement

How to properly write the import statement

How do I properly write something like this:
from ../lib.model import mymodel
Here is the tree:
lib----->model---->mynodel.py
|
|----->myscript--->myscript.py

Links don't work on iPad for the dragend JS framework

Links don't work on iPad for the dragend JS framework

I know this is really stupid question, but have someone used dragend JS
for websites to be used in iPad?
I have worked on the site and now stuck on a problem that no link is
working in iPad on my site. On normal desktop computers, it works.
When I went to the official site, to my surprise, the links also don't
work there too ... You can test this site
http://stereobit.github.io/dragend/ on your iPad.
I'll be very thankful for any assistance as I've been literally using
different scenarios but to no avail.
Many Thanks

Hijri Date In ASP.NET MVC4

Hijri Date In ASP.NET MVC4

There is any Example Showing me how Using hijri date for Displaying it and
inserting it in >Data base using asp.net mvc4

Migrations were shown as down but already migrated?

Migrations were shown as down but already migrated?

I've rails app that has some migrations. When I hit rake db:migrate:status
to see what status is set, all except ********** NO FILE ********** were
down. But the migrations have already made, so there seems no problem
about model side. Here are files may help to explain:
Output of rake db:migrate:status:
up 20130727003912 ********** NO FILE **********
down 20130728000151 Devise create users
down 20130728000335 Create friends
down 20130728000346 Create addresses
down 20130728000356 Create authies
down 20130728000413 Add indexes
At this time, rake db:migrate output:
== DeviseCreateUsers: migrating
==============================================
-- create_table(:users)
NOTICE: CREATE TABLE will create implicit sequence "users_id_seq1" for
serial column "users.id"
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::DuplicateTable: ERROR: relation "users" already exists
: CREATE TABLE "users" ("id" serial primary key, "username" character
varying(255), "email" character varying(255) DEFAULT '' NOT NULL,
"encrypted_password" character varying(255) DEFAULT '' NOT NULL,
"reset_password_token" character varying(255), "reset_password_sent_at"
timestamp, "remember_created_at" timestamp, "sign_in_count" integer
DEFAULT 0, "current_sign_in_at" timestamp, "last_sign_in_at" timestamp,
"current_sign_in_ip" character varying(255), "last_sign_in_ip" character
varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT
NULL)
/home/ekrem/workspace/contactman/db/migrate/20130728000151_devise_create_users.rb:3:in
`change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
db/schema.rb:
ActiveRecord::Schema.define(:version => 20130727003912) do
create_table "addresses", :force => true do |t|
t.string "title"
t.text "address"
t.string "phone"
t.string "city"
t.integer "friend_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "slug"
t.string "country"
end
add_index "addresses", ["friend_id"], :name =>
"index_addresses_on_friend_id"
add_index "addresses", ["slug"], :name => "index_addresses_on_slug",
:unique => true
create_table "authies", :force => true do |t|
t.string "provider"
t.string "uid"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "authies", ["user_id"], :name => "index_authies_on_user_id"
create_table "friends", :force => true do |t|
t.string "name"
t.string "surname"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "slug"
t.string "imported_file_name"
t.string "imported_content_type"
t.integer "imported_file_size"
t.datetime "imported_updated_at"
end
add_index "friends", ["slug"], :name => "index_friends_on_slug", :unique
=> true
add_index "friends", ["user_id"], :name => "index_friends_on_user_id"
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "username"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique
=> true
add_index "users", ["reset_password_token"], :name =>
"index_users_on_reset_password_token", :unique => true
end
How can I fix this issue to make all migrations seem up?

Rerun cyclic job once on failure/delayed file to file watcher in Autosys

Rerun cyclic job once on failure/delayed file to file watcher in Autosys

We have one job which runs twice in a day at 09:00AM and at 09:00PM
(Cyclic job).
Now condition is, if job get fail at 09:00AM then it should rerun once
after failure/any other delay in receiving files to file watcher job, but
it also trigger again at 09:00PM.
So any idea's on how to configure this?
Thanks in advance....!!

Is it still possible to submit apps targeted for iOS5 or iOS6 to the App Store after the release of iOS7

Is it still possible to submit apps targeted for iOS5 or iOS6 to the App
Store after the release of iOS7

Like the question says, will I be able to submit iOS5/iOS6 apps to the App
Store given that iOS7 is rolled out now? Or do I have to target iOS7 for
my builds?
I understand that there is a great amount of UI changes, new features, not
looking good, etc involved but I just want to know if it is still possible
to submit old targets
Cheers

Warning message by using setMethod

Warning message by using setMethod

If I run the folowing code in the first time, I get a warning on setMethod:
Warning message: In getPackageName(environment(fdef)) : Create package
name, '2013-09-18 09:29:59', if nothing there
B.getFields<-function(keys){
vars<-mget(names(.refClassDef@fieldClasses), envir = attr(.self, ".xData"))
return(vars[keys])
}
B<-setRefClass(Class = "B"
,fields = list(var1 = "character")
,methods = list(getFields=B.getFields
,initialize=function(...) {
usingMethods("getFields")
callSuper(...)
}
)
)
setGeneric("getFields", function(object, ...) standardGeneric("getFields"))
setMethod(getFields, "list", function(object, ...)
lapply(object,getFields,...))

Tuesday, 17 September 2013

Using custom font in QTabWidget

Using custom font in QTabWidget

I want to use custom font for my App, so:
I have installed PT Sans on my Windows 7
Used that font in stylesheet (I do not work with fonts from code - only in
stylesheets)

QTabBar::tab{
min-width: 64px;
min-height: 21px;
border-image: url(:images/tab_unselected.png);
border-top: 3px;
border-bottom: 5px;
border-right: 4px;
border-left: 4px;
color: rgb(44, 44, 44);
font-size: 12px;
font-family: "PT Sans";
margin-top: 0px;
margin-bottom: 0px;
}
For some reason, the letter spacing is wrong. I tried different font-size
in stylesheets but the result is the same. Please see pictures attached.
'I mage' is in focus and has strange gap after "I"

'Audio' is in focus and there is no gap after "I"
Actually, there are a lot of such places over UI so I don't think this is
something specific to QTabWidget only.
I hope someone has already faced such issue and can give me a clue on what
the heck is going on here.
Thanks a lot!

How to get camera transform matrix from camera projection matrix?

How to get camera transform matrix from camera projection matrix?

Hi I have a camera projection matrix and I want to get the corresponding
camera transform matrix.
The projection matrix(P) is 3*4, which converts a 3D-point's homogeneous
coordinate into a planar homogeneous coordinate.
Now in my scenario, I can only specify the camera transform matrix, which
describes how the camera is positioned. So how can I get the matrix
transform matrix from camera projection matrix?

Dialog start only the first time on startup?

Dialog start only the first time on startup?

I tried to make a dialog on startup of my application like this:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Hi Stackoverflow!").create().show();
}
But I want to make it so that if I click a checkbox in the dialog "Don't
show again" then the second time I start the application the dialog
doesn't appear. How can I do it?

CSS DIV Margin-top

CSS DIV Margin-top

I have a question about margin in CSS. I have a DIV element, which has an
image for background. Inside that DIV I have another DIV. I want this DIV
inside to be 200px from the top. But, when I do that, the outside DIV also
moves down for 200px. Why is that and how to keep the outside DIV on top?

Sequelize use camel case in JS but underscores in table names

Sequelize use camel case in JS but underscores in table names

Is it possible to have column names be underscored (postgres) but have the
JavaScript getters be camelCase per language standards?

Renaming or creating a vector

Renaming or creating a vector

I want to create a number of data frames which take their name from a list.
eg.
mylist <- c("home", "work", "pub")
for (i in mylist) {
name <- i
Hourly <<- ddply(get(i), .(week = week(StartTime), Place = name) }
This produces 1 dataframe called Hourly with week and name variables.
What I want is 3 dataframes called home_hourly, work_hourly, pub_hourly
each containing their respective 2 variables. How do I produce 3
dataframes, prefixing each with name?
Cheers!

Sunday, 15 September 2013

How to add animated splash screen in my application in iphone

How to add animated splash screen in my application in iphone

I want to make a splash screen in iphone. My app concept is Appartment
community.My designer give the excellent Splash screen.But i have no idea
how to present splash screen.For example i want to make Book apps ,the
splash screen making like open book animation.Like the appartment
community how to make splash screen.please give me any idea.Thanks in
advance.

Persistable collection hash codes

Persistable collection hash codes

Please see the objects below. What I need to do is query the entity
framework for instances of MyObject that contain a specific collection of
Option. For instance, I want all MyObject where the Options collection
contains Option Id = 1 & Options Id = 5 and no other options.
public class MyObject
{
public int Id { get; set; }
//... More Properties
public IEnumerable<Option> Options { get; }
}
public class Option
{
public int Id { get; set; }
public string Name { get; set; }
}
I was thinking of trying to implement some sort of option hash and
persisting it. Then, my query would be "where MyObject.OptionHash ==
[HASH]". As far as I can tell, typical hash algorithms cannot generate a
guaranteed unique hash. Any input or suggestions would be appreciated.

CAAnimation stops when scrolled out of bounds

CAAnimation stops when scrolled out of bounds

I have a custom activity indicator in the form of an infinitely rotating
UIImageView. And this this amazing activity indicator is placed inside a
table cell.
The animation is achieved this way:
CABasicAnimation* animation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.z"];
animation.fromValue = [NSNumber numberWithFloat:0.0f];
animation.toValue = [NSNumber numberWithFloat: M_PI * 2.0];
animation.duration = 1.0f;
animation.repeatCount = INFINITY;
[self.layer addAnimation:animation forKey:@"SpinAnimation"];


At first, it work beautifully... But when the cell gets scrolled off the
bounds of the table, the animation stops, and I have no idea how to reset
it... /:
Please help...
Thanks so much in advance... :)

Vertically aligning text, non-standard situation

Vertically aligning text, non-standard situation

I'm using a CSS counter and pseudo-elements to customize unordered list
numbers - jsFiddle
What I'd like to achieve, is aligning a text vertically within a <li>
element whenever it's a single line, otherwise keep it aligned to top as
is.
Any solutions (even involving JS/jQuery) would be much appreciated.

How to Add media files to Processing sketches and run it on Windows Phone?

How to Add media files to Processing sketches and run it on Windows Phone?

I am new to processing.js I know the basic integration of processing.js
with .html and .pde files which enables the sketches to run on the web.
I am using ProcessingJS Reader (app available on the Windows store) I am
able to run basic apps with simple touch interaction. But I have another
processing sketch which loads some media files (.jpg and .wav) into the
sketch. I want to run this sketch on my windows phone. But I dont knw how
to do so.. How can I embed the media files onto the sketch so that it runs
on my device ?

employee abilities with CanCan

employee abilities with CanCan

I have a Ticket model, Employee model and User model.
Each Employee may have a ticket assigned for him by the admin or more than
one ticket.
When employee is created in employee model it will be created also in user
model using a callback. and employee.id not the same as employee.user_id.
ticket model has employee_id attribute which is refering to for whom this
ticket is assigned
I need to make each employee see the assigned tickets for him. but the
problem is cancan is initialized for user and ticket doesn't have user_id
, also employee.id not the same as employee.user_id , how can i make this
work ? any suggestions because i have searched for this but all i find is
about user.

Is QContactObserver available for S60?

Is QContactObserver available for S60?

I've installed Qt SDK, but the QContactObserver header is not anywhere
inside the S60 SDK directory - C:\QtSDK\Symbian\SDKs\Symbian1Qt473, while
it is inside the Symbian Anna directory.
Is it available at all for S60 or not?

Saturday, 14 September 2013

How can I align controls vertically in Windows Forms apps?

How can I align controls vertically in Windows Forms apps?

I have several paired label/textbox and label/combobox controls on a form.
Getting them aligned horizontally is not a problem, but it's kind of a
pain getting them vertically aligned with an even amount of vertical
spacing / Y axis.
In the olden days with Delphi this was a breeze - you highlight all the
controls, select an item from a menu, and voila!
Is there something similar in Visual Studio (2012 Ultimate)?

What's wrong with this htaccess file

What's wrong with this htaccess file

I'm trying to use this .htaccess file in an mvc project to redirect
everything to the index page/controller/method/params but when I go to the
root directory I get a 500 error. Is there something wrong with the code:
php_flag display_errors on
php_value error_reporting 9999
RewriteEngine On
RewriteBase /mvc/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

angular js - data not binding from controller to view

angular js - data not binding from controller to view

I'm learning to make my first angular js app, and am having trouble
getting the data to bind. The code is at
https://github.com/findjashua/angular
In views/index.jade, {{understand}} is not getting the value of
$scope.understand from public/javascripts/maincontroller.js
Any ideas what the problem is?

How to retrieve data from RefBase to my RubyonRails Web Applications

How to retrieve data from RefBase to my RubyonRails Web Applications

I developed application on Ruby on Rails, and need to retrieve data from
web reference database (Refbase)
http://www.refbase.net/index.php/Web_Reference_Database. How can retrieve
data and store to my application.

Is it possible to open html page in popup window?

Is it possible to open html page in popup window?

Is this possible? To load new html page in popup window?

after executing the mage bash file from the fedora command promt I am getting "unexpected end of file"

after executing the mage bash file from the fedora command promt I am
getting "unexpected end of file"

I am using default magento mage file on fedora command prompt through
following command:-
sh mage mage-setup
But I am getting following message over there:-
"unexpected end of file"
Can anyone help on this while I didn't make any change on this default
magento file.

Want to replace youtube iframe with its video thumbnail

Want to replace youtube iframe with its video thumbnail

This is the pen I'm working on. I've done I'll I want except the video
thumbnail.All I want is to replace the youtube iframe with the video
thumbnail.

Friday, 13 September 2013

How to place table layout below Linear layout programmatically in android

How to place table layout below Linear layout programmatically in android

Here is my code to display table layout below linear layout.here i am
setting scroll view as contentview.but only table layout displaying on
screen.here any problem in layout.please help me thanks.
ScrollView scrollView = new ScrollView(this);
LinearLayout ll = new LinearLayout(getApplicationContext());
ll.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
Button btn1 = new Button(this);
btn1.setText("Button1");
ll.addView(btn1);
btn1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
TableLayout resultLayout = new TableLayout(this);
resultLayout.setStretchAllColumns(true);
resultLayout.setShrinkAllColumns(true);

Spring 3.2.4, EclipseLink 2.5, Glassfish 3.1.2 and JPA 2.1

Spring 3.2.4, EclipseLink 2.5, Glassfish 3.1.2 and JPA 2.1

I'm very new in the world of Spring and Glassfish. I've been fighting with
the configuration of the one application using these topics, but I don't
get create the application. Anybody can help me please?
I want to create an application with one persistence.xml, jndi data
source, generic dao configuration.
Thanks for your help!
Here is my code, but I think that there are some conflicts with the
configuration.
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="spartanPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/__spartanDS</jta-data-source>
<class>com.spartan.model.entities.SourceEntity</class>
<properties>
<property name="eclipselink.logging.level.sql" value="FINE" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.logging.level" value="FINE" />
<property name="javax.persistence.jdbc.driver"
value="com.mysql.jdbc.Driver" />
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.jdbc.native-sql" value="true" />
<property name="eclipselink.jdbc.cache-statements" value="true" />
</properties>
</persistence-unit>
dao-bean.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
default-lazy-init="true" default-autowire="no">
<tx:annotation-driven />
<bean id="sourceDao" class="com.spartan.model.daos.SourceDao">
<property name="entityClass" >
<bean class="com.spartan.model.entities.SourceEntity" />
</property>
</bean>
application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
default-autowire="no">
<tx:annotation-driven transaction-manager="transactionManager" />
<context:annotation-config />
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/__spartanDS" />
<import resource="classpath:com/spartan/model/spring/dao-beans.xml" />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation"
value="classpath:META-INF/persistence.xml" />
<property name="dataSource" ref="dataSource" />
<property name="persistenceUnitName" value="spartanPU" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="false" />
<property name="databasePlatform"
value="org.hibernate.dialect.MySQLDialect" />
</bean>
</property>
<property name="jpaDialect">
<bean
class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect"/>
</property>
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>
<!-- Exception translation bean post processor -->
<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"
/>
<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
/>
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
BaseDao.java
import java.lang.reflect.ParameterizedType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
public abstract class BaseDao<PK, T> implements IBaseDao<PK, T> {
protected T entityClass;
@PersistenceContext
protected EntityManager entityManager;
@SuppressWarnings({ "unchecked" })
public BaseDao() {
ParameterizedType genericSuperclass = (ParameterizedType) getClass()
.getGenericSuperclass();
this.entityClass = ((T) genericSuperclass.getActualTypeArguments()[0]);
}
@Transactional
public T create(T entity) {
this.entityManager.persist(entity);
this.entityManager.flush();
return entity;
}
public T read(PK id) {
return null;
}
public T update(T entity) {
this.entityManager.merge(entity);
this.entityManager.flush();
return entity;
}
public void delete(T entity) {
this.entityManager.remove(entity);
}
public void setEntityClass(T entityClass) {
this.entityClass = entityClass;
}
}

random() not working in C

random() not working in C

I am currently learning C though "C all-in-one Desk Reference for Dummies"
and came to the point where it starts teaching how to get random numbers.
However, the sample code it gives doesn't work (the compiler comes up with
an error "undefined reference to 'random'"). My code is below, copied from
the book.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int hat;
hat = random();
printf("%d is a random number.\n",hat);
return(0);
}

Retrieving a number at a time from a string - PHP

Retrieving a number at a time from a string - PHP

I am working on a project of mine and came across an interesting problem.
Lets say you have a string that contains 5,5689, 1546,572 and with this
string, lets say I want to separate each of the numbers separated by a
comma and store them into a database individually.
For instance, it would take 5 and store that into the database. Than it
would take 5689 and store that into the database.
How would you ladies and gentlemen go about this?
David

Compile a dynamic directive with a fragment of the parent scope

Compile a dynamic directive with a fragment of the parent scope

I want to insert a dynamic directive and pass it through a mini-scope
taken from the parents larger model, ie $scope.model[i] where i is the
index of the list item you just clicked.
This is my insert code:
element.append($compile("<newdirective />")($scope));
I could pass it the entire model and the index through the attributes but
seems far than ideal.

Display rtsp stream in android app

Display rtsp stream in android app

I want to make an android app in which i want to display the rtsp live
stream from ip camera.I tried with Mediaplayer api but it is showing
errors. if anybody can help?

How to integrate GCC Compiler in Java written IDE?

How to integrate GCC Compiler in Java written IDE?

If I am making my own editor written in java then is it possible to run
programs written is C Programming Language? if yes then How?

Thursday, 12 September 2013

Decrypting a string using RSA

Decrypting a string using RSA

the scenario is as follows: I am asked to implement a decryption algorithm
in Javascript to decrypt a string that was encoded using RSA with the
following algorithm:
Convert the string to some list of integers (4 chars to 1 integer) we call
this list u[].
Apply this operation for all elements in u[]: e[n] = RSA((u[n]-e[n-1]) mod
n), e[-1] = 0
Then we get the encrypted list of integers e[].
A textual description of step 2: We encrypt the first element, subtract
the encrypted first element from the second element. Then we do (modulo n)
and then encrypt the result. And the process continues for the rest of the
numbers.
Now the problem is the decryption part. I have been stuck at this part for
hours!
I worked with the equation, with the goal of making u[n] the subject:
e[n] = RSA((u[n]-e[n-1]) mod n) -- (1)
We know:
RSA(x) = x^e mod n -- (2)
RSA'(x) = x^d mod n -- (3)
So, from (1) and (3)
RSA'(e[n]) = (u[n]-e[n-1]) mod n
RSA'(e[n]) + k*n + e[n-1] = u[n]
Then i am kind of stuck, because we do not know k.
So, i tried again:
RSA'(e[n]) = (u[n]-e[n-1]) mod n
(e[n])^d mod n = (u[n]-e[n-1]) mod n
That seems to go no where too...

How to convert this array in another array?

How to convert this array in another array?

I have this array:
array(
(int) 1 => 'igor.cesar@soreq.com.br',
(int) 5 => 'igorpol@gmail.com',
(int) 6 => 'kkk@asasa.com'
)
I want to convert to this:
array('igor.cesar@soreq.com.br','igorpol@gmail.com','kkk@asasa.com')
How can I do this?

Abstract class: output of this code

Abstract class: output of this code

Currently doing a practice test on abstract classes and interfaces and ran
into this problem:
public class Test {
public static void main(String[] args) {
new Circle9();
}
}
public abstract class GeometricObject {
protected GeometricObject() {
System.out.print("A");
}
protected GeometricObject(String color, boolean filled) {
System.out.print("B");
}
}
public class Circle9 extends GeometricObject {
/** Default constructor */
public Circle9() {
this(1.0);
System.out.print("C");
}
/** Construct circle with a specified radius */
public Circle9(double radius) {
this(radius, "white", false);
System.out.print("D");
}
/** Construct a circle with specified radius, filled, and color */
public Circle9(double radius, String color, boolean filled) {
super(color, filled);
System.out.print("E");
}
}
Why is the output BEDC? I thought new Circle9() would first invoke the
no-arg constructor of the Circle 9 class, printing A, and then the other
letters, but I'm having a hard time understanding the path of the code.

Float link over website

Float link over website

I would like for explanation to how to put float link/text over my
Wordpress site, designed with CSS. I believe it's involves the
functions.php and the CSS style file but I need the codes.

WCF Client calling method with polymorphic array fails

WCF Client calling method with polymorphic array fails

I have a WCF service with the following (example) interface:
[ServiceContract]
[ServiceKnownType(typeof(Foo))]
[ServiceKnownType(typeof(Bar))]
[ServiceKnownType(typeof(Baz))]
public interface IMyInterface
{
[OperationContract]
void ProcessMessage(Message message);
[OperationContract]
void ProcessMessages(IEnumerable<Message> messages);
}
Foo, Bar and Baz are all a type of Message.
I can call ProcessMessage() from a WCF client with either a Foo, Bar or
Baz object and everything works fine. I can't, however, call
ProcessMessages(...) with an array (or list or any other IEnumerable)
because this will fail:
There was an error while trying to serialize parameter
http://tempuri.org/:messages. The InnerException message was 'Type
'X.X.Foo' with data contract name
'Foo:http://schemas.datacontract.org/2004/07/X.X' is not expected.
Consider using a DataContractResolver or add any types not known
statically to the list of known types - for example, by using the
KnownTypeAttribute attribute or by adding them to the list of known types
passed to DataContractSerializer.'. Please see InnerException for more
details.
When I take a look at the generated client code, reference.cs, I see:
...
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IMyInterface/ProcessMessage",
ReplyAction="http://tempuri.org/IMyInterface/ProcessMessageResponse")]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(X.X.Foo))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(X.X.Bar))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(X.X.Baz))]
void ProcessMessage(X.X.Message message);
...
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IMyInterface/ProcessMessages",
ReplyAction="http://tempuri.org/IMyInterface/ProcessMessagesResponse")]
void ProcessMessages(X.X.Message[] messages);
I notice the ServiceKnownTypeAttributes are added to ProcessMessage but
not ProcessMessages. When I manually add the same set of
ServiceKnownTypeAttributes to the ProcessMessages method and I call it
from the client with an array containing a Foo, Bar and Baz it works fine.
How do I get Visual Studio to generate these attributes on the second
method too? Is my IMyInterface wrong? Did I add the
[ServiceKnownType(typeof(...))] in the wrong place? Where did I go wrong?

How to "propagate" the sorting of an `ArrayList` to another one?

How to "propagate" the sorting of an `ArrayList` to another one?

I have multiple ArrayList<String>s "linked" into a custom adapter I'm
using to build a list view. Now suppose they are just two in total, to
simplify. I want to sort one of them and then have this new order
reflected into the other one, in order to maintain the list consistent.
This is what I was thinking to do and doesn't work, ending with an
IndexOutOfBoundsException: Invalid index 0, size is 0 at the line signed
with *.
// declarations:
static List<String> filenameEntries = new ArrayList<String>();
static List<String> idEntries = new ArrayList<String>();
/* various operations that fill
the two ArrayList here... */
// sorting:
List<String> oldFilenameEntries = new ArrayList<String>();
List<String> oldIdEntries = new ArrayList<String>();
oldFilenameEntries = filenameEntries;
oldIdEntries = idEntries;
idEntries.clear();
Collections.sort(filenameEntries);
for (int i = 0; i < filenameEntries.size(); i++ ) {
for (int j = 0; j < oldFilenameEntries.size(); j++ ) {
if (oldFilenameEntries.get(j) == filenameEntries.get(i)) {
idEntries.add(oldIdEntries.get(j)); // exception
}
}
}
My idea was to search into the old ArrayList for every element from the
new one, and then use this "old" index to re-polulate the other ArrayList.
Any suggestion? Thanks.

Wordpress exclude terms from list and add post count

Wordpress exclude terms from list and add post count

I'm trying to list all Product Categories within WooCommerce and the
snippet below is working a treat but I'm wanting to exclude terms
(categories) from the list and add post count to each Category. If anyone
could help me out and point me into the right direction I'd truly
appreciate it.
<?php
$terms = get_terms('product_cat');
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>";
$terms = get_terms($term->name);
echo "<a href='".get_term_link($term)."'>";
echo $term->name;
echo "</a>";
echo "</li>";
}
echo "</ul>";
}
?>

Wednesday, 11 September 2013

How to select data and insert those data using single sql?

How to select data and insert those data using single sql?

pI want to select some data using simple sql and insert those data into
another table. Both table are same. Data types and column names all are
same. Simply those are temporary table of masters table. Using single sql
I want to insert those data into another table and in the where condition
I check E_ID=? checking part. My another problem is sometime there may be
any matching rows in the table. In that time is it may be out sql
exception? Another problem is it may be multiple matching rows. That means
one E_ID may have multiple rows. As a example in my attachment_master and
attachments_temp table has multiple rows for one single ID. How do I solve
those problems? I have another problem. My master table data can insert
temp table using following code. But I want to change only one column and
others are same data. Because I want to change temp table status column./p
precode insert into dates_temp_table SELECT * FROM master_dates_table
where e_id=?; /code/pre pIn here all data insert into my dates_temp_table.
But I want to add all column data and change only dates_temp_table status
column as Modified. How should I change this code?/p

Yahoo Pipes trying to make twitter favorite bot

Yahoo Pipes trying to make twitter favorite bot

, need to turn twitter.com/TWITTERUSER/status/377991264722894848 into
https://twitter.com/intent/favorite?tweet_id=377991264722894848 I
essentially want to know how to set it up to replace everything but the
tweet ID number at the end with this beginning
https://twitter.com/intent/favorite?tweet_id=

Copy Constructor and/or pop method in framework for a stack class C++

Copy Constructor and/or pop method in framework for a stack class C++

So I have a stack that is made up of randomly generated strings and then a
pointer to the next item in my .cpp code. I then go through and pop each
item off the stack and print them out. I get a seg fault at the end though
so I'm guessing I'm trying to pop an item one past the stack where I do
not own the memory.
I believe my copy constructor is incorrect - maybe it doesn't set the last
value to null in my stack but I can't figure out why it's not setting the
value to NULL when I put the line
newPrev->next = NULL;
here's my code (class only)
#include <string>
using namespace std;
class Stack
{
protected:
struct Node
{
string item;
Node* next;
}; // struct Node
public:
// constructor of an empty stack
Stack ()
{
head = NULL;
}
// copy constructor
Stack( const Stack & rhs )
{
if (rhs.head == NULL) {// check whether original is empty
head = NULL;
}else{
head = new Node;
head->item = rhs.head->item;
Node* newPrev = head;
// Now, loop through the rest of the stack
for(Node* cur = rhs.head->next; cur != NULL; cur = cur->next)
{
newPrev->next = new Node;
newPrev = newPrev->next;
newPrev->item = cur->item;
} // end for
newPrev->next = NULL;
} // end else
}
// destructor
~Stack ()
{
delete head;
}
// assignment
const Stack & operator=( const Stack & rhs )
{
return *this;
}
// query whether the stack is empty
bool empty () const
{
return false;
}
// add an item to the top of the stack
// this method is complete and correct
void push (const string & new_item)
{
Node* new_node = new Node;
new_node->item = new_item;
new_node->next = head;
head = new_node;
}
// remove the item on the top of the stack
void pop ()
{
if (head!=NULL){
Node *n = head;
head = head->next;
delete n;
}
}
// return the item on the top of the stack, without modifying the stack
string & top () const
{
return head->item;
}
private:
Node* head;
};

How to Re-Indent visually selected column in Vim

How to Re-Indent visually selected column in Vim

I have some text like,

I would like to move variable2,var3 and var4 so that all four variables
are aligned together. I am able to visually select the column, using
CTRL-V j j w. But after that how can I reindent or delete the extra spaces
in front of variable2, var3 and var4.
Please not that moving variable1 is not an option as there are multiple
lines that are aligned with variable1.
Thanks.

Unable to create the right query

Unable to create the right query

I need a little help. I am trying to fetch records from database on a
certain critera but unable to make the exact logic that will work out.
Like i have a table in which i am storing some ids like
1,14,23,45,17,8,9,11 etc
I receive an array like this
1,2,19,45,56,65
What I thought was to explode the array and match the individual indexes
to the column in database. But here is the problem..
If I use
Like %value% query, it returns non required results for example if we run
SELECT *
FROM `table`
WHERE `table_skills_id` LIKE '%2%'
LIMIT 0 , 30
You can see that 2 was not in the initial array or column that I wrote
above but because 23 was present there, it responded that there is one
result matching where as it should have said 0 rows matching
What I want is that it matches the whole number rather than matching them
seperately. I have tried "Like %2" as well as "Like 2%" but none of them
works properly.
Any quick help would be highly appreciated.
Thanks.

Logging in users over Http in Windows Forms app

Logging in users over Http in Windows Forms app

I have a WebPages based WebMatrix website with Login and Registration
enabled and I need to be able to Login using my Windows Forms application
aswell.
I'd prefer to not use a Web Browser control, and instead, just create a
Login Form control in my app with a Username and Password field, then
send/POST the form to the https login page, but what I don't know what to
do at this point is how to know if the user has successfully logged in?
How can I check on that from within a Windows Forms app?

DataGridView slow loading new data

DataGridView slow loading new data

I have following code now:
private void LoadNewRegistrations()
{
grdNewRegistrations.EditMode = DataGridViewEditMode.EditOnEnter;
grdNewRegistrations.EditingControlShowing +=
GrdNewRegistrations_EditingControlShowing;
const string cSql = @"SELECT
RegistrationId,RegistrationName,RegistrationStatusText
FROM Registration
LEFT JOIN RegistrationStatus
ON
Registration.RegistrationStatusID=RegistrationStatus.RegistrationStatusID
ORDER BY 1";
const string cSql2 = "SELECT VirtualCategoryName FROM
VirtualCategory ORDER BY 1";
SqlParameter[] oSqlParams = {};
var dgceb = new DataGridViewCheckBoxColumn {Name =
"cebColumn",HeaderText = @"Vybrat"};
var dgcob = new DataGridViewComboBoxColumn {Name =
"cobColumn",HeaderText = @"Virtuální kategorie"};
dgceb.HeaderCell.Style.Alignment =
DataGridViewContentAlignment.MiddleCenter;
DataView vCitems = DTO.Instance.GetDataView(cSql2);
foreach (DataRowView rowView in vCitems)
{
dgcob.Items.Add(rowView[0].ToString());
}
dgcob.Items.Add("-");
grdNewRegistrations.Columns.AddRange(
new DataGridViewColumn[]
{
dgceb,
new DataGridViewTextBoxColumn {Name = "idColumn",
HeaderText = @"ID"},
new DataGridViewTextBoxColumn {Name = "nameColumn",
HeaderText = @"Název"},
dgcob,
new DataGridViewTextBoxColumn {Name = "lastRegColumn",
HeaderText = @"Poslední registrace"},
new DataGridViewTextBoxColumn{Name = "statusColumn",
HeaderText = @"Status"}
});
DTO.Instance.ConnectionString = ConnStringWW;
DataView dvReg = DTO.Instance.GetDataView(cSql, oSqlParams);
grdNewRegistrations.Columns[0].AutoSizeMode =
DataGridViewAutoSizeColumnMode.None; //checkbox
grdNewRegistrations.Columns[0].ReadOnly = false;
grdNewRegistrations.Columns[1].AutoSizeMode =
DataGridViewAutoSizeColumnMode.AllCells; //id reg
grdNewRegistrations.Columns[1].ReadOnly = true;
grdNewRegistrations.Columns[2].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill; //name reg
grdNewRegistrations.Columns[2].ReadOnly = true;
grdNewRegistrations.Columns[3].AutoSizeMode =
DataGridViewAutoSizeColumnMode.None; //vc combo
grdNewRegistrations.Columns[3].Width = 150;
grdNewRegistrations.Columns[3].ReadOnly = false;
grdNewRegistrations.Columns[4].AutoSizeMode =
DataGridViewAutoSizeColumnMode.None; //date
grdNewRegistrations.Columns[4].Width = 150;
grdNewRegistrations.Columns[4].ReadOnly = true;
grdNewRegistrations.Columns[5].AutoSizeMode =
DataGridViewAutoSizeColumnMode.None; //status reg
grdNewRegistrations.Columns[5].ReadOnly = true;
foreach (DataRowView dataRowView in dvReg)
{
grdNewRegistrations.Rows.Add(false, dataRowView[0],
dataRowView[1], "-", " ", dataRowView[2]);
}
}
Data (about 5000 records) loads when application starts. It takes about
5sec to load. Now, when I need to load other records (same columns, just
another WHERE clause in sql select condition) when app running it takes
MUCH longer time. I´m using same data to just figure out why its so damn
slow.
private void cbChooseTodayReg_CheckedChanged(object sender, EventArgs e)
{
grdNewRegistrations.Rows.Clear();
LoadNewRegistrations();
}
Another option that I´ve heard is to use DataSource. But I can´t figure
out how to make it in this case (0COL - all checkboxes, 1,2,5COL - from db
on first load, 3COL - combobox with data from db, 4COL just to show info
on combobox value change)

How do I to populate one table with the results of a query from a different table?

How do I to populate one table with the results of a query from a
different table?

I have created a query which works and delivers what I want,however it
will not execute within a batch file.How can I populate another table with
the results of the successfully executed query?
Here is my query
select
isnull (start_charge.account,'No account at start') Start_charge_account
,Finish_charge.account start_charge_account
,case when start_charge.account is null then finish_charge.account else
start_charge.account end "account"
,isnull (start_charge.Branch,99999999999) Start_charge_Branch
,Finish_charge.Branch Finish_charge_Branch
,case when start_charge.branch is null then finish_charge.branch else
start_charge.branch end " branch"
,isnull (start_charge. site_number,99999999999) Start_charge_site_number
,Finish_charge. site_number Finish_charge_site_number
,case when start_charge.site_number is null then finish_charge.site_number
else start_charge.site_number end "site_number"
,isnull (start_charge. service_code, 'No account at start')
Start_charge_service_code
,Finish_charge. service_code finish_charge_service_code
,isnull (start_charge. item_code,'No account at start')
Start_charge_item_code
,Finish_charge. item_code finish_charge_item_code
,isnull (start_charge. why_code, 'No account at start') Start_charge_why_code
,Finish_charge. why_code finish_charge_why_code
,isnull (start_charge. why_type, 'No account at start') Start_charge_why_type
,Finish_charge. why_type finish_charge_why_type
,Start_charge.Start_charge
,isnull(Finish_charge.Finish_charge,0) Finish_charge
,isnull(Start_charge.Start_charge,0)-isnull(Finish_charge.Finish_charge,0)
Variance
from
(
select
account
,branch
,site_number
,service_code
,item_code
,why_code
,why_type
,sum(charge)
"Start_Charge"
from
cannon_commercial
where
1=1
and record_type = 'PS'
and period = ' 02/07/2013'
group by
account
,branch
,site_number
,service_code
,item_code
,why_code
,why_type
) start_charge
full outer join
( select
account
,branch
,site_number
,service_code
,item_code
,why_code
,why_type
,concat(account,site_number) "account - site"
,ISNULL(sum(charge),0) "Finish_Charge"
from
cannon_commercial
where
1=1
and record_type= 'PS'
and period = ' 04/06/2013'
group by
account
,branch
,site_number
,service_code
,item_code
,why_code
,why_type
)
Finish_charge
on Start_charge.Account = Finish_charge.Account
and Start_charge.Branch = Finish_charge.Branch
and Start_charge.site_number = Finish_charge.site_number
and Start_charge.item_code = Finish_charge.item_code
and Start_charge.service_code = Finish_charge.service_code
and Start_charge.why_code = Finish_charge.why_code
and Start_charge.why_type = Finish_charge.why_type

Tuesday, 10 September 2013

Sql query for two select statement

Sql query for two select statement

DateTime startDate = DateTime.ParseExact(txtstart.Text, "MM/dd/yyyy", null);
DateTime endDate = DateTime.ParseExact(txtend.Text, "MM/dd/yyyy", null);
string n1 = DropDownList2.SelectedItem.Text;
if (DropDownList1.SelectedItem.Text == "Membership")// here you can
add selectedindex as well
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ProjectConnectionString"].ToString());
con.Open();
SqlDataAdapter adapter = new SqlDataAdapter("select * from
Membership_det where updateDate between @Start and @End and FID
="+n1+"", con);
adapter.SelectCommand.Parameters.Add("@Start",
SqlDbType.Date).Value = startDate;
adapter.SelectCommand.Parameters.Add("@End",
SqlDbType.Date).Value = endDate;
}
…….. …….. Above is a part of a code to display the data in the grid view.I
am displaying * from Membership_det and also need to display faculty name
from other table…how to add the query with the above query..displaying *
from membership _det table and faculty name from other table

Making cross domain get request

Making cross domain get request

okay so I have this link
<a id="link" href="https://yahoo.com" target="blank">Link</a>
then i have this script:
var security = function(){
var link = $('#link').attr('href');
$.getJSON('http://myweb.com/func.php',function(result){
if (result % 5 === 0){
$('#link').attr("href", link);
alert('his link');
}else{
$('#link').attr('href','https://google.com');
alert('your link');
}
});
$("#link").click(function(){
$.getJSON('http://myweb.com/func2.php',function(results){
if (results === results){
location.reload();
}
});
});
};
func.php:
$results = mysqli_query($con,"SELECT * FROM `c_clicks`");
while ($row = mysqli_fetch_array($results)) {
$clicks = $row['id'];
echo $clicks;
}
func2.php:
$results = mysqli_query($con,"INSERT INTO `c_clicks`(`link`,`date`)
VALUES('claim',now())");
What I'm trying to accomplish is that for every 5 clicks the #link will
send the user to another domain. The thing is it works fine but if someone
rips my website and switches the #link href func.php and func2.php are no
longer accesible so they dont work. I tried fixing it with JSON but im
guessing its wrong. How could I still perform func and func2 through a
different server?

Converting a python script to a web application

Converting a python script to a web application

I have a python script written up and the output of this script is a list
. Right now I need to get it online and make it accesible to others. I
looked at Django , but then I realised that it may be kind of hard to
create the UI. Is there any simple way to create a UI in Django and map it
to an existing python script. Right now I am not using sql and things like
that. Or is there a simpler way by which I can proceed?

Eclipse java - how to add full line with double quotes

Eclipse java - how to add full line with double quotes

I'm programming in Eclipse and i have a SQL script that got multiple lines:
SELECT * FROM
.... (bla bla)
... (bla bla )..
... (bla bla bla bla)
I have to add the double quotes like this:
" SELECT * FROM "
+ ".... (bla bla) "
+ "... (bla bla ).."
+ "... (bla bla bla bla) "
Is there any SHORTCUT to do this in Eclipse?

How to export 0.5 million rows to excel/csv (performance issue)?

How to export 0.5 million rows to excel/csv (performance issue)?

Currently we are using NPOI for exporting some large data to
excel(environment--asp.net mvc-4.0 ). Its taking us around a minute to
export 30000 rows to excel. Now the requirement has changed and we want
500000 which is more then 10 times the current rows. NPOI serializer has
some limitations which is having drastic performance
issue..http://npoi.codeplex.com/discussions/443655 ...So after trying lot
of alternatives we decided that we will export this huge chunk of data to
csv file. Before starting with this code change I wanted to get an expert
opinion on how to handle this scenario where you have to deal with such a
massive number of rows export... Is exporting to CSV a better option???
Can any one point out a code sample or an article that has a solution to
data export to csv/excel for more the 0.5 million rows within a 1 min
timeframe..

Wordpress menu CSS Classes is not working

Wordpress menu CSS Classes is not working

I want to change the color of one of the tabs of the menu bar in Wordpress
using menu CSS Classes, I added the class name in my style file, but when
I add the class name in the CSS Classes in the Admin->Menu page it's not
working. that's the class name in the style file it's very simple.
.red{
color: #ff0000;
}

curve fitting using multiple starting points for every variable

curve fitting using multiple starting points for every variable

Given a random parametric function with n parameters used to fit
datapoints. You define you're parametric function by heigthmodel You're n
startingvalues are defined as initial values For the fitting you use
lsqcurvefit(heigthmodel,initialvalues,...
Is there a way you can give more then one startingvalue for every
parameter. So that you add another string of startingvalues and the model
will start from both startingvalues and will return the best result?
I've already setup something like this:
Heightmodel = ....
Startingvalues = a1 a2 a3 a4 a5
Startingvalues = b1 b2 b3 b4 b5
options=optimoptions(numberofvariables,2) % based on the TypicalX function.
lsqcurvefit(heightmodel,startingvalues,...,options)
It would be interesting to know if I could make this work and if so if I
could add more startingvalues. So I will have p strings of startingvalues
and numberofvariables,p
Also is there a way to present these startingvalues in a matrix form? So
that for the first variable the fitting can choose to start from both a1
or b1, for the second variable from both a2 or b2? ...
Greetings

Displaying value only once

Displaying value only once

I am new to jquery and js. I have this simple thing trying to achieve but
is not working.
Basically I am getting a collection of records and for age I want it to
display only once..
<tr>

<td>
</tr>
This works fine, but it displays value of age multiple times because of
#each. I tried to remove #each etc. nothing works. Please help. Thanks

Monday, 9 September 2013

Hide a folder from file sharing

Hide a folder from file sharing

I have an app that is link with pdf documents. If the user open a pdf
document in a browser, my app will be listed in the Open in... menu. This
file is downloaded automatically in a folder called Inbox, which I didn't
create, located in the Documents directory. However, I don't want this
folder to appear in iTunes when file sharing is enabled. I don't want to
allow the user to delete or modify neither the folder nor its contents.
Is there any way I can change the properties of this folder to hide it
from iTunes?

item cannot be resolved or is not a field--Android Phone App Developing

item cannot be resolved or is not a field--Android Phone App Developing

I am trying to follow a manual (which had some bugs and I fixed it)
however I am receiving this error btstart cannot be resolved or is not a
field and I don't know how to fix it. Here's the LINK to that manual (but
I have done changes in layout as well as string xml files) Here is the
MainActivity.java code :
package com.example.stopwatch;
import com.example.stopwatch.R;
import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer;
public class MainActivity extends Activity implements OnClickListener {
private Button start;
private Button stop;
private Button reset;
private Chronometer mydChronometer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
uI();
}
public void uI() {
start = (Button) findViewById(R.id.btstart);
start.setOnClickListener(this);
stop = (Button) findViewById(R.id.btstop);
stop.setOnClickListener(this);
reset = (Button) findViewById(R.id.btreset);
reset.setOnClickListener(this);
mydChronometer = (Chronometer) findViewById(R.id.chronometer1);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public void onClick(View v) {
if (v == start) {
mydChronometer.start();
} else if (v == stop) {
mydChronometer.stop();
} else if (v== reset) {
mydChronometer.setBase(SystemClock.elapsedRealtime());
}
}
}
Here comes my "activity_main.xml" :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/chronometer1"
android:layout_centerHorizontal="true"
android:layout_marginTop="67dp"
android:src="@drawable/myd" />
<Chronometer
android:id="@+id/chronometer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
android:gravity="center"
android:text="Chronometer"
android:textSize="35dp" />
<Button
android:id="@+id/btstart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_below="@+id/chronometer1"
android:layout_marginTop="18dp"
android:text="@string/start" />
<Button
android:id="@+id/btreset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btstop"
android:layout_alignBottom="@+id/btstop"
android:layout_toRightOf="@+id/btstop"
android:text="@string/reset" />
<Button
android:id="@+id/btstop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btstart"
android:layout_alignBottom="@+id/btstart"
android:layout_toRightOf="@+id/btstart"
android:text="@string/stop" />
</RelativeLayout>
And here's the "strings.xml" file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">stopwatch</string>
<string name="btn1">Start</string>
<string name="btn2">Stop</string>
<string name="btn3">Reset</string>
<string name="menu_settings">Settings</string>
<string name="start">Start</string>
<string name="reset">Reset</string>
<string name="reset">Stop</string>
</resources>
Could you please let me know what am I missing and what's the fix to this
error?
P.S.: I am receiving similar error for these lines: btstop cannot be
resolved or is not a field in stop = (Button) findViewById(R.id.btstop);,
and btreset cannot be resolved or is not a field in reset = (Button)
findViewById(R.id.btreset); , as well as chronometer1 cannot be resolved
or is not a field in mydChronometer = (Chronometer)
findViewById(R.id.chronometer1);. Thanks a ton.