Saturday 31 August 2013

Should I make multiple SQLite databases for better concurrency?

Should I make multiple SQLite databases for better concurrency?

I'm very new to SQL and relational databases (just started learning last
week) and I'm in the process of upgrading my website and currently keep
all my data in XML files. It works, but the new site would be better
suited from what I hear a relational database can do, and it looks like
SQLite is best for me. One of my concerns is concurrency, even though 99%
of the data will be read-only (which I understand SQLite is pretty good
at) 99% of the time. Other things, like page view counters for certain
pages will constantly require small writes. I'm still learning database
design and want to do it right. Would it make sense to make separate
databases for things that get written to a lot, that way making the main
database far less susceptible to concurrency issues? Is it possible to do
a "foreign key" type reference (I still haven't used foreign keys yet, but
think I understand them) across databases? As each view count would point
to some primary key in the main database. Thanks for any help!

Bind multiple wx.EVT_MENU to a same method?

Bind multiple wx.EVT_MENU to a same method?

There're about 5-6 menu items in the right click popup, and binding them
to separate methods seems clumsy since there's a good chunk of codes can
be reused, is it possible to do things like this?
self.Bind(wx.EVT_MENU, self.MenuClicked, id=self.menu1)
self.Bind(wx.EVT_MENU, self.MenuClicked, id=self.menu2)
self.Bind(wx.EVT_MENU, self.MenuClicked, id=self.menu3)
self.Bind(wx.EVT_MENU, self.MenuClicked, id=self.menu4)
self.Bind(wx.EVT_MENU, self.MenuClicked, id=self.menu5)
def MenuClicked(self, event):
detect which menu being clicked
assign specific values to several variables regarding the menu being
clicked
rest of the codes.
I noticed there's no GetMenu() available for wx.EVT_MENU, so basically how
do you recognize which menu is being clicked?

How do you run DaoTest

How do you run DaoTest

I really don't know anything about JUnit, and I want a quick answer. I
built and ran DAOtest using eclipse, but where are the entry points. Or
where see the execution.

Local notification not firing from calendar components

Local notification not firing from calendar components

I made a local notification to launch at a specific time, but when I open
the app the notification already launches, I know this because of a NSLog.
This is my notification and calendar.
- (void)viewDidLoad
{
[super viewDidLoad];
NSCalendar *notificationCalender = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *notificationComponents = [notificationCalender
components: NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |
NSSecondCalendarUnit fromDate:[NSDate date]];
[notificationComponents setYear:2013];
[notificationComponents setMonth:8];
[notificationComponents setDay:31];
[notificationComponents setHour:4];
[notificationComponents setMinute:17];
UIDatePicker *notificationDatePicker = [[UIDatePicker alloc] init];
[notificationDatePicker setDate:[notificationCalender
dateFromComponents:notificationComponents]];
UIApplication *habitPal = [UIApplication sharedApplication];
UILocalNotification *postureNotification = [[UILocalNotification
alloc] init];
if (postureNotification) {
postureNotification.alertBody = @"Notification?";
postureNotification.timeZone = [NSTimeZone defaultTimeZone];
postureNotification.fireDate = notificationDatePicker.date;
[habitPal scheduleLocalNotification:postureNotification];
NSLog(@"Notification Launched");
}
}
And the it logs "Notification Launched" on the startup of the app. Just to
make sure, I set it so the fire date to
postureNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:3];
and it still logs "Notification Launched" on startup, so I think something
else is wrong. What am I doing wrong?



Edit
Ok, now I see you cant put this in the viewDidLoad, so I put it in the
appDelegate
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data,
invalidate timers, and store enough application state information to
restore your application to its current state in case it is terminated
later.
// If your application supports background execution, this method is
called instead of applicationWillTerminate: when the user quits.
NSCalendar *notificationCalender = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *notificationComponents = [notificationCalender
components: NSYearCalendarUnit | NSMonthCalendarUnit |
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |
NSSecondCalendarUnit fromDate:[NSDate date]];
[notificationComponents setYear:2013];
[notificationComponents setMonth:8];
[notificationComponents setDay:31];
[notificationComponents setHour:5];
[notificationComponents setMinute:5];
UIDatePicker *notificationDatePicker = [[UIDatePicker alloc] init];
[notificationDatePicker setDate:[notificationCalender
dateFromComponents:notificationComponents]];
UIApplication *habitPal = [UIApplication sharedApplication];
UILocalNotification *postureNotification = [[UILocalNotification
alloc] init];
if (postureNotification) {
postureNotification.alertAction = @"Answer";
postureNotification.alertBody = @"Do you have good posture?";
postureNotification.timeZone = [NSTimeZone defaultTimeZone];
postureNotification.fireDate = notificationDatePicker.date;
[habitPal scheduleLocalNotification:postureNotification];
NSLog(@"Notification Launched");
}
}
But the notification launches right away after closing the app

select everything from a table for a column

select everything from a table for a column

in my mysql database i have the following tables:
FACULTY (fid int, fname varchar(25), deptid int, primary key(fid))
CLASS (name varchar(4),meets_at varchar(9),room varchar(4), fid
int,primary key (name), foreign key (fid) references faculty (fid))
I want to select the names of faculties who go to all the rooms. I tried
using following :
SELECT DISTINCT F.FNAME
-> FROM FACULTY F
-> WHERE NOT EXISTS (( SELECT *
-> FROM CLASS C
-> EXCEPT
-> (SELECT C1.ROOM
-> FROM CLASS C1
-> WHERE C1.FID=F.FID)));
and got the following error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use
near 'EXCEPT
also tried with:
SELECT DISTINCT F.FNAME
FROM FACULTY F
LEFT JOIN CLASS C ON C.FID = F.FID
WHERE C.FID IS NULL

How to Revert Key and Values of a HashMap?

How to Revert Key and Values of a HashMap?

I have created a HashMap<String,List<Integer>>. Now I want to create a
reverse HashMap<Integer,List<String>> by replacing the Key and Values from
the first map.
For Example,
Original HashMap: { A=[2,1], B=[1,3,4], C=[5], D=[3], E=[2,4] }
Reverted HashMap: { 1=[A,B], 2=[A,E], 3=[B,D], 4=[B,E], 5=[C] }

Screen doesn't update until segmented control value chanee ends

Screen doesn't update until segmented control value chanee ends

My first program using map kit ios 6. I have 6000 annotations to add to a
map and it takes about 7 seconds to load. i want to put a window up to say
loading. works but the loading screen does not come until it
segmentedcontolvaluechange ends. not sure how to update my view when i
call the MBProgressHUD routine.
- (IBAction)myanscSegmentedControlValueChange:(id)sender {
int lvalue;
int hvalue;
switch (myanscSegmentedControl.selectedSegmentIndex) {
case 0:
lvalue=0;
hvalue=999999;
break;
case 1:
lvalue=1;
hvalue=999999;
break;
case 2:
lvalue=1;
hvalue=500;
break;
case 3:
lvalue=501;
hvalue=1000;
break;
case 4:
lvalue=1000;
hvalue=999999;
break;
default:
break;
}
[self.myMKMapView removeAnnotations:myMKMapView.annotations];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.labelText = @"Loading Data..";
for (Customer *row in self.importedRows) {
if ([row.anscvalue integerValue]>=lvalue & [row.anscvalue
integerValue]<=hvalue) {
CLLocationCoordinate2D annotationCoord;
annotationCoord.latitude = [row.lat doubleValue];
annotationCoord.longitude =[row.lon doubleValue];
MKPointAnnotation *annotationPoint = [[MKPointAnnotation
alloc] init];
annotationPoint.coordinate = annotationCoord;
annotationPoint.title = row.title ;
annotationPoint.subtitle = row.subtitle;
[myMKMapView addAnnotation:annotationPoint];
}
}
MBProgressHUD hideHUDForView:self.view animated:YES];
}

subversion commit adding more files than what is expected by "svn merge"

subversion commit adding more files than what is expected by "svn merge"

note: my steps are different than This Stack Overflow Question
1. svn merge -c 261588 https://svn.repo
2. svn commit -m 'message...' (Committed revision 261598.)
and notice that instead of the ONE file , 20 other files are also submitted
so i revert :
svn merge -c -261598 https://svn.repo
svn commit -m 'reverted 261598'
now if i try to commit on a fresh working copy of the repo, i STILL get
the SAME issue of submitting more files than what i expect. How can i
merge this ONE file and not all these others.

Friday 30 August 2013

How to find videos using the YouTube API based on a channel ID

How to find videos using the YouTube API based on a channel ID

So I am playing around with the YouTube API v3 for a web app I am
building. I've got the basics down, but I am searching through
documentation trying to find a way to filter a returned video list based
on a channelID. However this doesn't seem to be possible. Is there way to
write a request similar to this pseudocode below:
https://www.googleapis.com/youtube/v3/videos?part=snippet&
// and a second value that would imply with
channelID=UCn8zNIfYAQNdrFRrr8oibKw
This seems like a logical function to have in the API. However, I can't
seem to find any name/value pair in the documentation to support this
theory.
The closest I can seem to find is the onBehalfOfContentOwner name/value
pair for the video.list request (but it requires me to be the uploader of
the video?) as outlined here
Anyways if someone can answer definitively if this is possible (if yes a
link to docs or example I can use) as I've poured over docs looking for
this functionality with no luck. Any help would be much appreciated!

Thursday 29 August 2013

How to list and number text file contents in batch window and allow user selection?

How to list and number text file contents in batch window and allow user
selection?

I am working on an android BAT file that will perform various functions.
One is that it will examine a folder on the phone and export its contents
to a file local on my pc. From there i want to take the file names and
display them in the batch folder and numberthem so the user can select a
file name.
the following extracts the info and saves the files to my pc..
adb shell su -c "mount -o rw,remount /system"
adb shell su -c ls /system/app > apps.txt
adb shell su -c ls /system/framework > framework.txt
I can not figure out how to list these contents with numbers in the batch
window for the user to make a selection. The following will do what i want
for files in a folder, but i want to do this for file "names" on a text
document....
@ECHO OFF
SET index=1
SETLOCAL ENABLEDELAYEDEXPANSION
FOR %%f IN (*.*) DO (
SET file!index!=%%f
ECHO !index! - %%f
SET /A index=!index!+1
)
SETLOCAL DISABLEDELAYEDEXPANSION
SET /P selection="select file by number:"
SET file%selection% >nul 2>&1
IF ERRORLEVEL 1 (
ECHO invalid number selected
EXIT /B 1
)
CALL :RESOLVE %%file%selection%%%
ECHO selected file name: %file_name%
GOTO :EOF
:RESOLVE
SET file_name=%1
GOTO :EOF
How do i perform this function on a list of names in a text file rather
than a list of files in a folder?
Thanks, Jimmie

Search across multiple columns

Search across multiple columns

I'm using this Mysql query:
WHERE fname LIKE '%{$query}%' OR lname LIKE '%{$query}%' OR zipcode LIKE
'%{$query}%' OR city LIKE '%{$query}%'
Let's say I have the following info in my database:
First Name: Bill
Last Name: Gates
Zipcode: 12345 AA
City: New York
When I search for 'New York', I get the expected result (bill gates), But
when I search for "bill new york' I get no results.
What is the correct query to search across multiple columns?

Wednesday 28 August 2013

Concatenating EOT data onto string in PHP?

Concatenating EOT data onto string in PHP?

I'd like to concatenate some EOT data to a string, but it is giving me
errors, the code is this:
$htmlViewAppointments .= <<<EOT
<tr><td>$obj['Year']</td></tr>
EOT;

objective-c struct properties are released before usage

objective-c struct properties are released before usage

I have a struct in my Objective-C code like this >
typedef struct {
__unsafe_unretained NSString *string1;
__unsafe_unretained NSString *string2;
__unsafe_unretained NSString *string3;
__unsafe_unretained NSString *string4;
__unsafe_unretained NSString *string5;
..
..
..
__unsafe_unretained NSString *string10;
} MyStruct;
In my model class I store these structs in an array declared
@property (nonatomic, strong) NSMutableArray *myStructArray;
I construct this in my .m file during runtime like this
NSMutableArray *myTempArray = [NSMutableArray array];
for (NSDictionary *jsonDict in jsonArray)
{
MyStruct stringsStruct = parseWithDictionary(jsonDict);
[myTempArray addObject:[NSValue value:&stringsStruct
withObjCType:@encode(MyStruct)]];
}
myObject.myStructArray = myTempArray;
The problem is when I try to access this after parsing / constructing the
inside objects are already deallocated & I received the error
-[CFURL length]: message sent to deallocated instance
Here is how I access the properties later by the way,
MyStruct myStruct;
[[myObject.myStructArray objectAtIndex:someIndex] getValue:&myStruct];
NSLog(@"%@",myStruct.string1); // << bam! crash
How do I fix this ? Is there a way to make sure the objects objects remain
intact without deallocing until i'm done with it ? I'm using ARC & cannot
remove with __unsafe_unretained hence.

Does WebSocket support in nginx enable direct client-server communication?

Does WebSocket support in nginx enable direct client-server communication?

I am researching WebSockets and need something clarified: When using
WebSocket support in nginx, with the "Connection Upgrade" technique, which
of the following consequences is true?
A) nginx alleviates the need for a WebSocket "framework" (such as
socket.io, phpwebsockets, etc.), and enables the client to talk directly
to your server scripts without further intermediation.
B) All nginx does is forward the WebSocket traffic, but you still need a
framework (or write your own full native implementation). nginx by no
means "handles" WebSockets as such.

In Spring How to send email with attachments to multiple users

In Spring How to send email with attachments to multiple users

I am using spring & Java based application. I just need to send reports to
users periodically .I have done this by using JavaMailSender and velocity
and Jobscheduler.
But I need to send reports to multi recipients at onetime. Does any one
know that How to send email to multi recipients without showing other
recipients who has received the same email by using spring framework ?

Fit canvas to parent canvas

Fit canvas to parent canvas

I have an svg image that I converted to a xaml canvas file.
But when I add this canvas to my window, it's way too big. I want the
contentpresenter with staticresource LynxLogo to fit the parent canvas.
Xaml of main window:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Digicom.DESDigitelClientWPF"
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
x:Class="Digicom.DESDigitelClientWPF.FindServer2"
Title="MainWindow" Height="489" Width="715"
>
<Grid>
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1"
MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="#FFA9C825"/>
<GradientStop Color="#FF698700" Offset="1"/>
<GradientStop Color="#FFA9C825" Offset="0.539"/>
</LinearGradientBrush>
</Grid.Background>
<DataGrid ItemsSource="{Binding Servers, Mode=TwoWay}"
SelectedItem="{Binding SelectedServer, Mode=TwoWay}"
AutoGenerateColumns="false" GridLinesVisibility="None"
Margin="39.025,51.76,39.025,0" RowHeaderWidth="0" Foreground="Black"
CanUserResizeRows="False" CanUserAddRows="False" Height="132"
VerticalAlignment="Top" Background="#FFE2E2E2">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding HostName}"
Header="Server" Width="200" IsReadOnly="True"
SortMemberPath="Server"/>
<DataGridTextColumn Binding="{Binding Server}" Header="IP"
Width="200" IsReadOnly="True" SortMemberPath="IP" />
<DataGridTextColumn Binding="{Binding Version}"
Header="Version" Width="*" IsReadOnly="True"
Foreground="#FF0C0B0B" />
</DataGrid.Columns>
</DataGrid>
<Canvas HorizontalAlignment="Left" Height="57" Margin="22,0,0,18"
VerticalAlignment="Bottom" Width="112">
<ContentPresenter Content="{StaticResource LynxLogo}"
Width="{Binding Width}" Height="{Binding Height}"/> **// THIS
MUST FIT CANVAS**
</Canvas>
</Grid>
And this is my xaml canvas I got from the svg image and have put in my
application resources
<Application.Resources>
<Canvas x:Key="LynxLogo" Width="673.152" Height="408.613" Clip="F1 M 0,0L
673.152,0L 673.152,408.613L 0,408.613L 0,0">
<Canvas x:Name="Laag_1" Width="799.785" Height="599.567"
Canvas.Left="0" Canvas.Top="0">
<Path x:Name="Path" Width="20.38" Height="26.328"
Canvas.Left="260.39" Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FFAAC923" Fill="#FFAAC923" Data="F1 M 272.361,372.544L
268.799,372.544L 268.799,349.571L 260.785,349.571L
260.785,347.006L 280.375,347.006L 280.375,349.571L
272.361,349.571L 272.361,372.544 Z "/>
<Path x:Name="Path_0" Width="17.476" Height="26.3279"
Canvas.Left="279.517" Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FFAAC923" Fill="#FFAAC923" Data="F1 M 279.911,347.005L
296.598,347.005L 296.598,349.57L 283.473,349.57L 283.473,358.261L
295.243,358.261L 295.243,360.828L 283.473,360.828L
283.473,369.979L 296.598,369.979L 296.598,372.544L
279.911,372.544L 279.911,347.005 Z "/>
<Path x:Name="Path_1" Width="16.7787" Height="26.3279"
Canvas.Left="301.277" Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FFAAC923" Fill="#FFAAC923" Data="F1 M 301.671,347.005L
305.233,347.005L 305.233,369.979L 317.661,369.979L
317.661,372.544L 301.671,372.544L 301.671,347.005 Z "/>
<Path x:Name="Path_2" Width="17.476" Height="26.3279"
Canvas.Left="319.629" Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FFAAC923" Fill="#FFAAC923" Data="F1 M 320.024,347.005L
336.711,347.005L 336.711,349.57L 323.585,349.57L 323.585,358.261L
335.356,358.261L 335.356,360.828L 323.585,360.828L
323.585,369.979L 336.711,369.979L 336.711,372.544L
320.024,372.544L 320.024,347.005 Z "/>
<Viewbox x:Name="Group" Width="673.152" Height="408.613"
Canvas.Left="0" Canvas.Top="0">
<Canvas Width="673.152" Height="408.613">
<Canvas Width="799.785" Height="599.567" x:Name="Clip"
Clip="F1 M 0,0L 673.152,0L 673.152,408.613L 0,408.613L 0,0
Z ">
<Path x:Name="Path_3" Width="21.696" Height="27.1693"
Canvas.Left="340.034" Canvas.Top="346.19"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FFAAC923"
Fill="#FFAAC923" Data="F1 M 360.988,372.199C
358.974,372.621 356.768,372.965 354.29,372.965C
346.508,372.965 340.429,368.831 340.429,359.794C
340.429,351.869 345.733,346.585 354.29,346.585C
356.574,346.585 358.704,346.851 360.988,347.274L
361.297,350.222C 359.013,349.61 356.922,349.15
354.29,349.15C 347.902,349.15 343.99,353.246
343.99,359.794C 343.99,365.23 346.74,370.399
354.29,370.399C 356.922,370.399 359.245,369.941
361.336,369.251L 360.988,372.199 Z "/>
<Path x:Name="Path_4" Width="28.5107" Height="27.1693"
Canvas.Left="364.312" Canvas.Top="346.19"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FFAAC923"
Fill="#FFAAC923" Data="F1 M 368.268,359.794C
368.268,365.23 371.017,370.4 378.566,370.4C
386.116,370.4 388.865,365.23 388.865,359.794C
388.865,353.246 384.954,349.15 378.566,349.15C
372.178,349.15 368.268,353.246 368.268,359.794 Z M
392.428,359.794C 392.428,368.83 386.349,372.965
378.566,372.965C 370.785,372.965 364.706,368.83
364.706,359.794C 364.706,351.869 370.01,346.585
378.566,346.585C 387.122,346.585 392.428,351.869
392.428,359.794 Z "/>
<Path x:Name="Path_5" Width="27.2733" Height="26.328"
Canvas.Left="396.757" Canvas.Top="346.611"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FFAAC923"
Fill="#FFAAC923" Data="F1 M 400.056,372.544L
397.152,372.544L 397.152,347.006L 402.573,347.006L
410.393,368.6L 418.563,347.006L 423.636,347.006L
423.636,372.544L 420.344,372.544L 420.344,350.758L
420.267,350.758L 412.02,372.544L 408.496,372.544L
400.173,350.336L 400.056,350.336L 400.056,372.544 Z
"/>
<Path x:Name="Path_6" Width="16.1213" Height="27.1707"
Canvas.Left="439.194" Canvas.Top="346.19"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FF646363"
Fill="#FF646363" Data="F1 M 439.589,368.715C
441.602,369.634 443.963,370.4 446.171,370.4C
448.57,370.4 451.358,369.558 451.358,366.955C
451.358,361.823 439.938,359.143 439.938,352.404C
439.938,348.268 443.731,346.584 447.719,346.584C
449.539,346.584 451.358,346.852 453.139,347.159L
453.526,350.184C 451.783,349.571 450.042,349.15
448.223,349.15C 444.429,349.15 443.499,351.102
443.499,352.634C 443.499,357.612 454.921,360.368
454.921,366.878C 454.921,371.356 450.739,372.966
446.673,372.966C 444.39,372.966 442.182,372.467
439.975,371.894L 439.589,368.715 Z "/>
<Path x:Name="Path_7" Width="37.7253" Height="26.3279"
Canvas.Left="455.689" Canvas.Top="346.611"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FF646363"
Fill="#FF646363" Data="F1 M 456.083,347.005L
459.683,347.005L 467.466,369.405L 472.499,357.421L
468.589,347.005L 472.306,347.005L 474.319,353.247L
474.395,353.247L 476.797,347.005L 480.475,347.005L
475.945,357.381L 480.321,369.405L 489.379,347.005L
493.019,347.005L 482.101,372.544L 478.19,372.544L
474.165,361.517L 469.325,372.544L 465.375,372.544L
456.083,347.005 Z "/>
<Rectangle x:Name="Rectangle" Width="4.35064"
Height="26.328" Canvas.Left="495.143"
Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FF646363" Fill="#FF646363"/>
<Path x:Name="Path_8" Width="20.38" Height="26.328"
Canvas.Left="501.531" Canvas.Top="346.611"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FF646363"
Fill="#FF646363" Data="F1 M 513.501,372.544L
509.94,372.544L 509.94,349.571L 501.925,349.571L
501.925,347.006L 521.516,347.006L 521.516,349.571L
513.501,349.571L 513.501,372.544 Z "/>
<Path x:Name="Path_9" Width="21.696" Height="27.1693"
Canvas.Left="522.709" Canvas.Top="346.19"
Stretch="Fill" StrokeThickness="0.789334"
StrokeLineJoin="Round" Stroke="#FF646363"
Fill="#FF646363" Data="F1 M 543.663,372.199C
541.648,372.621 539.441,372.965 536.964,372.965C
529.183,372.965 523.104,368.831 523.104,359.794C
523.104,351.869 528.408,346.585 536.964,346.585C
539.248,346.585 541.378,346.851 543.663,347.274L
543.971,350.222C 541.688,349.61 539.596,349.15
536.964,349.15C 530.576,349.15 526.665,353.246
526.665,359.794C 526.665,365.23 529.413,370.399
536.964,370.399C 539.596,370.399 541.919,369.941
544.011,369.251L 543.663,372.199 Z "/>
<Path x:Name="Path_10" Width="23.0906"
Height="26.3279" Canvas.Left="548.341"
Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FF646363" Fill="#FF646363" Data="F1 M
552.298,347.005L 552.298,357.841L 567.475,357.841L
567.475,347.005L 571.037,347.005L 571.037,372.544L
567.475,372.544L 567.475,360.406L 552.298,360.406L
552.298,372.544L 548.735,372.544L 548.735,347.005L
552.298,347.005 Z "/>
<Rectangle x:Name="Rectangle_11" Width="4.35067"
Height="26.328" Canvas.Left="576.607"
Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FF646363" Fill="#FF646363"/>
<Path x:Name="Path_12" Width="23.8653"
Height="26.3279" Canvas.Left="586.13"
Canvas.Top="346.611" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FF646363" Fill="#FF646363" Data="F1 M
586.525,347.005L 590.978,347.005L 606.232,368.6L
606.31,368.677L 606.31,347.005L 609.601,347.005L
609.601,372.544L 605.07,372.544L 589.893,351.217L
589.817,351.141L 589.817,372.544L 586.525,372.544L
586.525,347.005 Z "/>
<Path x:Name="Path_13" Width="25.2186"
Height="27.1693" Canvas.Left="613.893"
Canvas.Top="346.191" Stretch="Fill"
StrokeThickness="0.789334" StrokeLineJoin="Round"
Stroke="#FF646363" Fill="#FF646363" Data="F1 M
638.717,358.224L 638.717,371.74C 635.504,372.391
632.251,372.965 628.147,372.965C 620.365,372.965
614.288,368.831 614.288,359.795C 614.288,352.94
619.204,346.585 628.651,346.585C 631.941,346.585
634.691,346.968 637.324,347.58L 637.672,350.604C
635,349.761 632.251,349.149 629.464,349.149C
620.521,349.149 617.849,355.468 617.849,359.795C
617.849,365.231 620.597,370.4 628.147,370.4C
631.013,370.439 633.22,370.056 635.309,369.443L
635.309,360.597L 629.503,360.597L 629.503,358.224L
638.717,358.224 Z "/>
<Path x:Name="Path_14" Width="124.139"
Height="207.715" Canvas.Left="123.058"
Canvas.Top="117.516" Stretch="Fill" Fill="#FF646363"
Data="F1 M 186.749,244.275L 186.749,320.136C
186.749,320.989 186.535,321.731 186.11,322.364C
185.686,323.005 184.951,323.509 183.894,323.873C
182.842,324.248 181.421,324.575 179.629,324.833C
177.833,325.092 175.673,325.231 173.145,325.231C
170.514,325.231 168.321,325.092 166.586,324.833C
164.845,324.575 163.421,324.248 162.311,323.873C
161.207,323.509 160.439,323.005 160.017,322.364C
159.598,321.731 159.389,320.989 159.389,320.136L
159.389,244.275L 125.311,170.393C 124.135,167.956
123.426,166.047 123.158,164.665C 122.891,163.303
123.158,162.228 123.954,161.491C 124.749,160.749
126.179,160.272 128.249,160.06C 130.314,159.851
133.095,159.744 136.595,159.744C 139.777,159.744
142.345,159.851 144.311,160.06C 146.274,160.272
147.833,160.563 148.999,160.928C 150.166,161.312
151.046,161.841 151.626,162.523C 152.205,163.212
152.765,164.091 153.301,165.147C 153.301,165.147
170.879,212.089 173.619,218.347L 173.933,218.347C
176.354,212.311 178.867,206.291 181.445,200.303C
184.026,194.315 186.642,188.4 189.289,182.565C
189.289,182.565 218.686,121.123 219.267,120.377C
219.851,119.64 220.642,119.084 221.658,118.709C
222.665,118.335 224.063,118.047 225.874,117.831C
227.675,117.623 229.947,117.516 232.707,117.516C
236.526,117.516 239.523,117.653 241.695,117.913C
243.861,118.179 245.377,118.685 246.229,119.424C
247.079,120.169 247.363,121.228 247.105,122.607C
246.835,123.981 246.123,125.844 244.957,128.172L
186.749,244.275 Z "/>
<Path x:Name="Path_15" Width="203.721"
Height="211.712" Canvas.Left="436.522"
Canvas.Top="116.029" Stretch="Fill"
StrokeThickness="9.708" StrokeMiterLimit="2.75"
Stroke="#FFA9C822" Data="F1 M 625.286,124.251C
627.466,122.434 629.201,121.347 630.486,120.997C
631.774,120.649 632.789,121.102 633.532,122.362C
634.274,123.621 634.769,125.689 635.017,128.555C
635.262,131.425 635.389,135.241 635.389,139.998C
635.389,144.478 635.314,147.975 635.165,150.495C
635.017,153.014 634.744,155.009 634.349,156.478C
633.954,157.947 633.482,159.07 632.937,159.837C
632.394,160.609 631.674,161.274 630.784,161.831L
554.277,222.297L 630.784,283.39C 631.674,284.093
632.418,284.861 633.012,285.701C 633.605,286.541
634.077,287.694 634.424,289.165C 634.769,290.634
635.017,292.629 635.165,295.147C 635.314,297.667
635.389,301.026 635.389,305.225C 635.389,309.843
635.262,313.486 635.017,316.142C 634.769,318.803
634.274,320.657 633.532,321.706C 632.789,322.755
631.774,323.107 630.486,322.755C 629.201,322.407
627.466,321.322 625.286,319.501L 536.897,245.39L
451.478,316.142C 449.301,317.822 447.541,318.907
446.204,319.397C 444.868,319.89 443.826,319.574
443.085,318.451C 442.341,317.334 441.872,315.375
441.673,312.573C 441.476,309.775 441.376,305.927
441.376,301.026C 441.376,296.827 441.45,293.399
441.598,290.738C 441.748,288.082 441.996,285.982
442.341,284.441C 442.69,282.902 443.184,281.783
443.826,281.081C 444.473,280.383 445.19,279.613
445.981,278.773L 517.881,220.406L 445.981,162.462C
445.19,161.763 444.473,161.063 443.826,160.362C
443.184,159.663 442.69,158.65 442.341,157.318C
441.996,155.989 441.748,154.135 441.598,151.754C
441.45,149.375 441.376,146.158 441.376,142.097C
441.376,137.759 441.501,134.223 441.748,131.494C
441.996,128.765 442.468,126.807 443.158,125.615C
443.853,124.429 444.868,123.973 446.204,124.251C
447.541,124.533 449.301,125.511 451.478,127.19L
536.302,197.733L 625.286,124.251 Z "/>
<Path x:Name="Path_16" Width="106.721"
Height="206.761" Canvas.Left="34.7103"
Canvas.Top="118.613" Stretch="Fill" Fill="#FF646363"
Data="F1 M 141.432,313.447C 141.432,315.569
141.324,317.344 141.113,318.775C 140.9,320.205
140.557,321.425 140.08,322.432C 139.602,323.441
139.018,324.183 138.33,324.659C 137.64,325.137
136.82,325.375 135.865,325.375L 44.8903,325.375C
42.4489,325.375 40.1436,324.555 37.9716,322.911C
35.7969,321.267 34.7103,318.376 34.7103,314.243L
34.7103,123.704C 34.7103,122.856 34.9223,122.113
35.3476,121.477C 35.7689,120.84 36.5129,120.339
37.5729,119.967C 38.6316,119.596 40.0636,119.277
41.8676,119.012C 43.6703,118.748 45.8449,118.613
48.3889,118.613C 51.0383,118.613 53.2396,118.748
54.9889,119.012C 56.7383,119.277 58.1436,119.596
59.2036,119.967C 60.2636,120.339 61.0063,120.84
61.4316,121.477C 61.8529,122.113 62.0676,122.856
62.0676,123.704L 62.0676,301.677L 135.865,301.677C
136.82,301.677 137.64,301.916 138.33,302.393C
139.018,302.869 139.602,303.561 140.08,304.461C
140.557,305.363 140.9,306.555 141.113,308.039C
141.324,309.525 141.432,311.327 141.432,313.447 Z "/>
<Path x:Name="Path_17" Width="155.547"
Height="207.239" Canvas.Left="260.853"
Canvas.Top="119.348" Stretch="Fill" Fill="#FF646363"
Data="F1 M 416.4,314.339C 416.4,316.461
416.042,318.263 415.332,319.748C 414.618,321.233
413.686,322.451 412.536,323.405C 411.384,324.36
410.094,325.049 408.67,325.473C 407.244,325.895
405.818,326.108 404.392,326.108L 395.348,326.108C
392.493,326.108 389.998,325.815 387.861,325.234C
385.722,324.652 383.694,323.591 381.774,322.053C
379.858,320.517 377.936,318.423 376.017,315.771C
374.1,313.121 372.061,309.727 369.91,305.591L
307.125,188.533C 303.842,182.489 300.536,176.154
297.2,169.526C 293.865,162.901 290.764,156.46
287.89,150.202L 287.573,150.202C 287.784,157.837
287.942,165.63 288.05,173.583C 288.154,181.534
288.209,189.435 288.209,197.281L 288.209,321.496C
288.209,322.24 287.985,322.954 287.538,323.644C
287.09,324.334 286.336,324.864 285.272,325.234C
284.208,325.607 282.812,325.922 281.077,326.189C
279.342,326.452 277.13,326.586 274.446,326.586C
271.76,326.586 269.55,326.452 267.816,326.189C
266.081,325.922 264.712,325.607 263.705,325.234C
262.697,324.864 261.972,324.334 261.524,323.644C
261.076,322.954 260.853,322.24 260.853,321.496L
260.853,131.595C 260.853,127.354 262.056,124.333
264.464,122.529C 266.872,120.728 269.498,119.825
272.344,119.825L 285.806,119.825C 288.977,119.825
291.63,120.09 293.765,120.62C 295.9,121.152
297.816,122.027 299.51,123.244C 301.205,124.465
302.849,126.163 304.437,128.335C 306.022,130.508
307.686,133.24 309.432,136.525L 357.697,226.864C
360.67,232.377 363.538,237.757 366.306,243.007C
369.072,248.255 371.736,253.424 374.298,258.515C
376.861,263.602 379.397,268.613 381.908,273.544C
384.418,278.474 386.902,283.432 389.364,288.414L
389.522,288.414C 389.309,280.04 389.176,271.316
389.124,262.252C 389.069,253.187 389.045,244.465
389.045,236.088L 389.045,124.437C 389.045,123.697
389.269,123.005 389.714,122.369C 390.162,121.733
390.916,121.177 391.981,120.7C 393.042,120.223
394.441,119.88 396.176,119.667C 397.91,119.454
400.176,119.348 402.973,119.348C 405.433,119.348
407.561,119.454 409.35,119.667C 411.14,119.88
412.538,120.223 413.548,120.7C 414.553,121.177
415.282,121.733 415.73,122.369C 416.176,123.005
416.4,123.697 416.4,124.437L 416.4,314.339 Z "/>
<Path x:Name="Path_18" Width="147.333"
Height="132.271" Canvas.Left="82.2323"
Canvas.Top="37.888" Stretch="Fill" Fill="#FF646363"
Data="F1 M 136.76,154.224C 134.533,155.585
132.348,156.081 129.798,156.736C 124.39,158.127
124.765,162.557 119.692,162.088C 111.589,161.332
112.453,149.339 110.476,157.269C 108.75,164.189
97.2237,168.549 97.2237,168.549L 88.6984,170.159L
82.5331,169.721C 82.5331,169.721 80.6917,167.737
86.1211,164.332C 90.8931,161.329 104.101,158.825
102.884,148.295C 102.352,143.713 105.917,138.209
103.109,129.123C 99.8797,118.68 100.38,93.6493
100.38,93.6493C 100.38,93.6493 110.43,113.664
112.23,109.152C 116.913,97.4146 126.677,102.949
129.786,99.4146C 145.58,81.4546 141.898,81.4146
151.901,71.568C 159.629,63.964 196.596,50.0999
198.374,49.8213C 204.52,48.8493 200.52,47.516
211.656,48.7747L 218.777,51.1667L 219.781,51.82L
216.268,48.5199L 217.796,47.1306L 211.89,45.908L
216.221,43.7573L 212.921,43.6239L 212.87,43.2773L
208.484,42.9027L 209.414,40.9226L 207.656,40.3906C
207.656,40.3906 233.152,29.0213 229.136,54.748C
225.884,75.6066 217.656,55.5573 222.964,65.8293C
236.986,92.94 212.658,111.539 212.658,111.539C
212.658,111.539 214.502,116.311 216.228,116.876C
217.964,117.437 220.464,121.385 217.442,124.492C
215.196,126.787 199.801,145.256 199.801,145.256C
199.801,145.256 195.34,152.027 194.364,153.279C
193.386,154.537 191.437,155.623 191.437,155.623L
187.874,154.973L 182.245,154.173C 182.496,150.647
207.84,124.429 202.114,125.057C 193.953,125.951
204.333,122.499 191.224,122.728C 179.789,122.936
165.012,155.239 161.788,161.313C 160.136,164.423
152.749,164.141 152.749,164.141C 152.749,164.141
145.761,162.376 149.348,156.804C 161.868,137.363
157.478,141.379 154.241,142.632C 145.252,146.116
150.984,135.163 144.98,144.919C 143.888,146.695
142.869,148.168 141.902,149.4C 141.902,149.4
143.368,151.152 143.869,154.661C 143.869,154.661
142.866,151.215 141.205,150.275L 140.484,151.027C
140.484,151.027 142.553,153.439 141.706,156.855C
141.706,156.855 141.488,152.907 139.638,151.747L
138.636,152.624C 138.636,152.624 141.268,155.601
139.92,158.892C 139.92,158.892 140.328,155.727
137.914,153.376L 136.76,154.224 Z "/>
<Path x:Name="Path_19" Width="8.16827" Height="10.698"
Canvas.Left="108.634" Canvas.Top="134.882"
Stretch="Fill" StrokeThickness="0.789334"
StrokeMiterLimit="2.75" Stroke="#FFAAC923"
Fill="#FFAAC923" Data="F1 M 109.066,135.652C
108.439,133.987 116.008,138.403 116.008,138.403C
116.008,138.403 116.851,143.84 116.088,145.186L
112.176,141.708C 112.176,141.708 110.878,140.476
109.066,135.652 Z "/>
<Path x:Name="Path_20" Width="12.496" Height="8.72668"
Canvas.Left="122.758" Canvas.Top="137.835"
Stretch="Fill" StrokeThickness="0.789334"
StrokeMiterLimit="2.75" Stroke="#FFAAC923"
Fill="#FFAAC923" Data="F1 M 124.165,139.807C
123.218,140.751 123.153,146.167 123.153,146.167C
123.153,146.167 128.193,144.434 129.551,143.662C
130.973,142.853 134.859,138.23 134.859,138.23L
129.895,138.802C 129.895,138.802 124.797,139.179
124.165,139.807 Z "/>
<Path x:Name="Path_21" Width="13.7543" Height="22.72"
Canvas.Left="142.932" Canvas.Top="102.056"
Stretch="Fill" Fill="#FF646363" Data="F1 M
142.968,116.868C 142.12,112.526 156.687,102.056
156.687,102.056C 156.687,102.056 155.845,117.55
149.448,124.777"/>
<Path x:Name="Path_22" Width="18.2373"
Height="28.3466" Canvas.Left="141.624"
Canvas.Top="95.803" Stretch="Fill" Fill="#73FFFFFF"
Data="F1 M 150.353,124.15L 149.524,122.99C
153.868,118.079 156.096,106.811 156.687,102.056C
150.871,106.566 143.532,114.368 143.887,116.194L
141.624,118.182C 144.217,112.298 153.905,103.523
157.489,100.944L 159.861,95.803L 157.868,101.83C
157.832,102.48 155.644,113.631 150.353,124.15 Z "/>
<Path x:Name="Path_23" Width="3.65601"
Height="11.9413" Canvas.Left="99.7975"
Canvas.Top="91.1354" Stretch="Fill" Fill="#FF646363"
Data="F1 M 99.7975,91.1354L 102.02,101.798L
103.453,103.077L 99.7975,91.1354 Z "/>
</Canvas>
</Canvas>
</Viewbox>
</Canvas>
</Canvas>
</Application.Resources>

Tuesday 27 August 2013

How to call codeigniter function through javascript function

How to call codeigniter function through javascript function

This is not working in my codeigniter function i have the id and cannot
get that id.Please help me. this is my view and i am trying to send my id
through the function.
<script type="text/javascript">
function makeajaxcall(id)
{
//alert(id);
var r=confirm("Do you want to Delete");
if (r==true)
{
window.location.href = "<?php echo
site_url('controller_d/login/admin_link_delete_user?id='.id);?>";
}
else
{
x="You pressed Cancel!";
alert(x);
}
}
</script>

returning a "variable string literal" from a function

returning a "variable string literal" from a function

I have some function that needs to return a const char* (so that a whole
host of other functions can end up using it).
I know that if I had something defined as follows:
const char* Foo(int n)
{
// Some code
.
.
.
return "string literal, say";
}
then there is no problem. However am I correct in saying that if Foo has
to return some string that can only be determined at runtime (depending on
the parameter n, (where each n taking any value in [0, 2^31-1] uniquely
determines a return string)) then I have to use the heap (or return
objects like std::string which use the heap internally)?
std::string seems too heavyweight for what I want to accomplish (at least
two functions will have to pass the parcel), and allocating memory inside
Foo to be freed by the caller doesn't strike me as a safe way of going
forward. I cannot (easily) pass in references to the objects that need
this function, and not that I believe it is possible anyway but macro
trickery is out of the question.
Is there something simple that I have not yet considered?

name not recognised as a list name

name not recognised as a list name

I have a list with a name:
list_123_456 = [1,2,3]
I then use some parts of a filename to recreate the name of this list:
name = 'list_{0}_{1}' .format(filename[0:3],filename[6:9])
This works to the extent that 'name' now equals 'list_123_456' as I wanted
it to. But the code is treating it as a string rather than as a list that
I defined at the beginning.
For example, if I try:
len(name)
I get the answer '12' (letters in the name) rather that '3' that I would
like.
Any help would be great, thank you.

How to create colored image mouseover on black/white images (in JQuery)

How to create colored image mouseover on black/white images (in JQuery)

I'm wondering if there are any good solutions available for turning a
color image into a black/white solid state and allowing it to transition
back into a colored image on mouse over using JQuery?
I tried a CSS method as described here: Image Greyscale with CSS &
re-color on mouse-over?, but I'm not having much luck with it.
Here is the current site: http://frixel.com/wp/ - I am trying to create
the effect on the gallery grid.
Thanks in advance.

DexClassLoader - adding functionality

DexClassLoader - adding functionality

I'm doing some testing with DexClassLoader, to see if it's possible to
"update" my app with new functionality. Currently I've got this method for
testing, which works with testClass and running the test() method.. What I
would like to know, is how could I "replace" or "update" and already
existing class.. ? Any ideas or other suggestions are welcome.
Method:
public static void loadExtLib(String pathDexFile, Context ctx) {
String temp = ctx.getDir("temp", 0).toString();
DexClassLoader classLoader = new DexClassLoader(pathDexFile,
temp, null, ctx.getClass().getClassLoader());
String testClass = "com.mystudio.myapp.TestClass";
Class<?> libProviderClass = null;
try {
libProviderClass = classLoader.loadClass(testClass);
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
try {
Method m = libProviderClass.getDeclaredMethod("test", null);
try {
m.invoke(libProviderClass, null);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (NoSuchMethodException e1) {
e1.printStackTrace();
}
Log.v("loadClass", "loaded: " + testClass);
}

Access QNX filesystem

Access QNX filesystem

Hi everyone, I am having one HDD, that had a QNX installation maybe QNX
4.6.1, after installing Ubuntu 13.04 on other partition, It QNX got listed
in grub apart from that, now i want to access that partition to take
backup but i am not able to open it neither, I searched a lot but no
success yet.
Can anyone please guide me a little??
thank you..

Good content slider with browser support

Good content slider with browser support

Can anyone suggest a good content slider that works in IE7 and upwards?
All it needs to show is content and slide back and forth. Also the ability
to have two sliders on one page.
Cheers!
:)

Monday 26 August 2013

NginX or rewrite the script with new programming language?

NginX or rewrite the script with new programming language?

Hi I have a website created using PHP, Apache, memcache. The traffic is
big and we have server high loads almost every night.
As the number of users grows, the traffic becomes bigger and bigger and we
would like to solve this issue.
we would like to hear the suggestions from the ppl who had experienced
this issue and how they were solved.
some introduced Nginx / Node.js and etc. If possible, we prefer a solution
that is faster to implement and good for the long run.
Thanks.

Can't find my AWS shared AMI when trying to share with specific account

Can't find my AWS shared AMI when trying to share with specific account

I followed the instructions to share my AMI with a specific account here:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharingamis-explicit.html
I made sure the account number is correct, and when I log into the target
account, I'm unable to find the shared AMI anywhere in my EC2 console (
Under Images -> AMIs ) no matter what I try to filter by.
How can I find the shared AMI?

FORTRAN 95: matrix line and column seems to be printed inverted

FORTRAN 95: matrix line and column seems to be printed inverted

I have a simple question about arrays of 2 dimensions in FORTRAN 95 (i.e.,
matrices). By what I know, mathematics define an element inside of a
matrix as Aij, where i represents its line and j its column. Well, if I
simply code write(*,*) Matrix, the result has lines and columns inverted!
Take the following example code:
program TEST
implicit none
integer :: P(3,3), i
P(1,1)=1
P(1,2)=2
P(1,3)=3
P(2,1)=4
P(2,2)=5
P(2,3)=6
P(3,1)=7
P(3,2)=8
P(3,3)=9
do i=1,3
write(*,"(3(I1,1X))") P(i,1:3)
enddo
write(*,*)
write(*,"(3(I1,1X))") P
end program TEST
By using the loop above (which fixes a line and then print each column
inside of it), I get the result I expected:
1 2 3
4 5 6
7 8 9
Now by using the last statement write(*,"(3(I1,1X))") P, I get:
1 4 7
2 5 8
3 6 9
Am I doing something wrong here?

Get dynamic mySQL table column with PHP

Get dynamic mySQL table column with PHP

Normaly all the basic PHP-MYSQL-SELECT tutorials are based on this code
$query = "SELECT * FROM table_name";
$result = mysql_query($query);
$num = mysql_num_rows($results);
if ($num > 0) {
while ($row = mysql_fetch_assoc($result)) {
// You have $row['ID'], $row['Category'], $row['Summary'],
$row['Text']
}
}
but for this I need to know the column name like 'ID', 'Category',
'Summary' or 'Text'. And if I add in phpmyadmin a new column like 'Email',
I also have to add $row['Email'] to the php script.
how can i make this step dynamic?
Thank you!

Dynamically Compiled ASP.NET Website

Dynamically Compiled ASP.NET Website

I want to dynamically compile an ASP.NET Web Site (NOT project that has
.csproj) depending on the configuration/symbols that I've setup. So under
the configuration manager, I have the following:
DEVELOPMENT
STAGING
PRODUCTION
and in Default.aspx.cs I have:
#if PRODUCTION
lblMessage.Text = "PRODUCTION";
#elif STAGING
lblMessage.Text = "STAGING";
#elif DEVELOPMENT
lblMessage.Text = "DEVELOPMENT";

How to avoid losing frames while chunking with AVCaptureFileOutput?

How to avoid losing frames while chunking with AVCaptureFileOutput?

I am setting a timer that call a delegate method of
AVCaptureFileOutputDelegate to get chunks of video/audio streams. The
problem is I have some dropping frames between chunks. How can I avoid
these ? Thanks

Logic F# and UI in C#

Logic F# and UI in C#

Give it possibilities in Visual Studio 2012 to make the Logic in F# and
the UI in C# with wpf?
I don't have any idea how I can make it.

MySQL filling out values from other tables

MySQL filling out values from other tables

I have a table called vacancy which looks like so

role company location each have a table of there own but I would like to
get a query together to pull the information from the other tables to fill
in vacancy
I tried
SELECT r.title, c.company, l.town, l.country, v.term
FROM role r, vacancy v, location l, company c
But this gives my 300 rows of the same title when i should in fact have 3
rows returning.
company
role
location

Sunday 25 August 2013

Output ffmpeg to certain format

Output ffmpeg to certain format

I have a media file with the following format according to ffprobe:
Metadata:
major_brand : M4A
minor_version : 0
compatible_brands: M4A mp42isom
creation_time : 2013-03-21 07:05:30
Duration: 00:00:00.42, start: 0.000000, bitrate: 118 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 100 kb/s (default)
Metadata:
creation_time : 2013-03-21 07:05:30
handler_name : Core Media Audio
Is it possible to have ffmpeg output to exactly this format?

Using anchor tags and buttons

Using anchor tags and buttons

When to use "a" tags and buttons. What is the difference? Is it always
appropriate to use an "a" tags as a button? Is it SEO friendly to use
buttons?

Robust Verilog Parser

Robust Verilog Parser

I have some verilog codes that I found on OpenCores but the source files
are written in RobustVerilog. The site recommended a RobustVerilog parser
which I have downloaded as well. However, when I tried to run the run
script, the following error occurred:
robust.exe - Unable To Locate Component This application has failed to
start because libstdc++-6.dll was not found. Re-installing the application
may fix this problem.
However, I was not able to find libstdc++-6.dll. Does anyone have
experience in the RobustVerilog parser ? I need to convert the source file
into regular verilog in order to integrate with my design.
Thanks in Advance !

Saturday 24 August 2013

Which SIP stack/library is best for iOS?

Which SIP stack/library is best for iOS?

I am writing a VoIP/SIP dialer client for iPhone. But i am very confused
about which SIP stack should i use. I have searched all over the internet
and found about 6-7 SIP library which can be used for iOS. I have got the
following...
(Most used. Open source C-based SIP stack. Could be good if we want to go
low-level) http://www.pjsip.org/
(Not bad, updating continuously) https://code.google.com/p/idoubs/ ||
https://code.google.com/p/idoubs/wiki/Building_iDoubs_v2_x
(Not bad but hasn't been updated for a long time. Seems to be the default
option. Objective-c codebase with existing UI, It uses PJSIP stack.)
https://code.google.com/p/siphon/
(appears less mature than Siphon.) https://github.com/pzion/miumiu
(Another Linux-oriented option. Rough UI but the audio engine seems good.)
https://www.linphone.org/eng/linphone/news/linphone-for-iphone.html
(Couldn't understand.) http://sofia-sip.sourceforge.net/ ||
http://sourceforge.net/projects/sofia-sip/
So can someone please suggest me about which SIP library would be best for
iOS ? I will use G729 codec.

ASP Plugins / Widgets like Wordpress

ASP Plugins / Widgets like Wordpress

I am building a website using asp.net mvc 4 and it needs to have a
consultation booking form that visitors select blocks of available time to
book their appointment. I know on the Wordpress side there are a ton of
plugins that can do this.
I looked the Telerik appointment calendar but it's a bit huge and overkill
for what I am looking for. I want a simply form with a calendar of
available timeslots and not show the visitor any details of other
appointments (privacy).
Being new to the asp world I am wondering how it works with a MVC project?
does asp.net have plugins, where can I find them... google search doesn't
lead me anywhere useful.

JQuery how to load next video automatically at the end of previous video?

JQuery how to load next video automatically at the end of previous video?

i have this list of videos
watch?v=IcrbM1l_BoI
watch?v=t2hlcavdwrQ
watch?v=lDK9QqIzhwk
and i want those videos to play on full screen and load automatically the
next one without exiting from full screen (like on 9gag.tv) any ideas? I
attached down my code
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$(document).ready(function(){
$('.buton_video').click( function(e){
e.preventDefault();
var URL = $(this).attr('href');
var htm = '<iframe width="738" height="450"
src="http://www.youtube.com/embed/' + URL +
'?wmode=transparent&rel=0&theme=light&color=white&autoplay=1"
frameborder="0" allowfullscreen ></iframe>';
$('#video_div').html(htm);
return false;
});
});
});//]]>
</script>
<a href="IcrbM1l_BoI" class="buton_video">Avicii - Wake me up</a><br/>
<a href="t2hlcavdwrQ" class="buton_video">Ahmed Chawki feat Pitbull -
HABIBI I Love You</a><br/>
<a href="lDK9QqIzhwk" class="buton_video">Bon Jovi - Livin' On A
Prayer</a><br/>
<div id="video_div">
<iframe width="738" height="450"
src="http://www.youtube.com/embed/IcrbM1l_BoI?wmode=transparent&rel=0&theme=light&color=white&autoplay=1"
frameborder="0" allowfullscreen ></iframe>
</div>
Any help? Thanks!

Customizing Select And Input tags, IE version looks awful

Customizing Select And Input tags, IE version looks awful

I'm trying to make a search bar, category select, and search query. I'm
trying to make them look both the same, same size font. But I don't want
the options to look the same size as the select tag
http://jsfiddle.net/gg8RD/
<table>
<tr>
<td>
<div class="searchInput" style="postion:relative">
<select onchange="document.getElementById('category').value =
this.options[this.selectedIndex].text">
<optgroup>
<option>Cat 1</option>
<option>Cat 2</option>
<option>Cat 3</option>
</optgroup>
</select>
<input id="category" style="postion:absolute width:300px"
placeholder="Choose A Cateogry" value="Choose A Category">
</div>
</td>
<td>
<div class="searchInput">
<input type="text" placeholder="Search Query">
</div>
</td>
</tr>
Is what I've come up with and it's around the style and size I want, But
it looks terrible in internet explorer.
Why is this? How can I get them to look the same, and if not: What's my
next path?

How do you style a custom element's tag from within the element?

How do you style a custom element's tag from within the element?

I'm trying to style a custom element tag, and can't seem to do it from
within the element's <style> tag, or at least I don't know what selector
to use. I've tried the custom element's tag name and template, but neither
work.
<polymer-element name="my-test" constructor="MyTest">
<template>
<style>
my-test {
border: solid 1px #888; /* doesn't work */
}
.title {
color: blue; /* works */
}
</style>
<div class="title">{{ title }}</div>
</template>
I'm using polymer.dart, so there may be some lag in its implementation,
but I'd like to know how it should work in polymer.js.

Excel: Need to look up a value in a list(Column) and return multiple non-corresponding values

Excel: Need to look up a value in a list(Column) and return multiple
non-corresponding values

I'm working on Excel 2007.I'm facing a problem: For Example:
It is looking up a value in a list and it return multiple corresponding
values
formula for that:
=IF(ISERROR(INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROW(1:1)),2)),"",INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROW(1:1)),2))
I don't want to take corresponding value instead of that I want to take
non-corresponding value. How I will do that(using same formula)?
Please guide me.Any build in formula?
Thank you.

struts 2 global-exception-mappings for HTTP error codes

struts 2 global-exception-mappings for HTTP error codes

Is it possible to handle the error pages which defined in web.xml, as the
global-exception-mappings in struts 2 actions. For example, instead of
<error-page>
<error-code>404</error-code>
<location>/common/jsp/FilkeNotFine.jsp</location>
</error-page>
Define something like below:
<global-exception-mppings>
<exception-mapping ErrorCode="404" result="internernal-error" />
</global-exception-mppings>
Are there any plugin or interceptor that can do that?

Is "what a pity" used as often as "what a shame"?

Is "what a pity" used as often as "what a shame"?

As an ESL speaker, I'm puzzled by these two phrases... Is "what a pity"
used as often as "what a shame" in an English-speaking country? Is there
any difference between them in meaning or usage?

Friday 23 August 2013

Use a module installed by another user

Use a module installed by another user

Ok so I'm running this python script on a remote machine and asks for
pyfits which is technically installed on the machine, but python doesn't
find it.
I've already tried adding the supposed directory it's installed in to my
paths(I have access to the folder too) by the sys.path.append('folder')
method. But it still doesn't find it.
here's some thought process to illustrate: the user who installed the
modules has all the source at /otheruser/code/pyfits so I've tried adding
that folder or any folder with 'pyfits' and an 'init' file (that I have
access to) in it, without success.
So my main questions are:
Should I be looking elsewhere for the module? Should I install the modules
again as --myuser? or should I mess with the site-packages? If so does one
add the module there?

'document.prodimage' is null or not an object

'document.prodimage' is null or not an object

I am getting Java script error while loading page in IE8 on Windows 7:
'document.prodimage' is null or not an object.
I removed my dynamic proprietary code that functions as API calls to grab
data, so areas that read: "" is where I dynamically grab stuff, like
images & links, based on what product someone is looking at. Anyways, not
the problem, here it is:
<a rel="position:'inside',showTitle:false,adjustX:-4,adjustY:-4" href="">
<img border="0" class="prodimage" id="prodimage" src="" width="200"
height="200" alt="" onMouseover="document.prodimage.src='';"
style="margin-right:auto;margin-left:auto;display:block;"/>
</a>

How do I maintain the correct Breadcrumb trail if the same mvcSiteMapNode appears in different places in mvc.SiteMap?

How do I maintain the correct Breadcrumb trail if the same mvcSiteMapNode
appears in different places in mvc.SiteMap?

I have a SiteMapNode hanging off the main Dashboard SiteMapNode:
<mvcSiteMapNode title="Dashboard" controller="DB" action="Index">
<mvcSiteMapNode title="Company Users" controller="SGAccount"
action="ListSOU" preservedRouteParameters="OrgId,caller"/>
The breadcrumb produced by the above is: "Dashboard > Company Users"
I want to also reference this, and get "Dashboard > Yours Sub > Company
Users"
<mvcSiteMapNode title="Dashboard" controller="DB" action="Index">
<mvcSiteMapNode title="Your Sub" controller="SOU" action="ListSub">
<mvcSiteMapNode title="Company Users" controller="SGAccount"
action="ListSOU" preservedRouteParameters="OrgId,caller"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
However I still get : "Dashboard > Company Users"
I suspect it is still pattern matching against the first SiteMapNode.
How can I ensure that the correct SiteMapNode is used, and thus produces
the correct BreadCrumb Trail. Incidentally the Controller and Action is
the same, so I am not sure how useful Action Attributes will be?
Many thanks.

WebRowSet and its SyncProvider

WebRowSet and its SyncProvider

They say from this API that:
A WebRowSet implementation is created with an RIXMLProvider by default.
WebRowSet wrs = new FooWebRowSetImpl();
The SyncFactory always provides an instance of RIOptimisticProvider when
no provider is specified, but the implementation of the default
constructor for WebRowSet sets the provider to be the RIXMLProvider
implementation. Therefore, the following line of code is executed behind
the scenes as part of the implementation of the default constructor.
wrs.setSyncProvider("com.sun.rowset.providers.RIXMLProvider");
I would say it's not true. I have checked it by doing the following:
WebRowSet webR = new WebRowSetImpl();
webR.setUsername("root");
webR.setPassword("RanchingAround");
webR.setUrl("jdbc:mysql://localhost:3306/test");
webR.setCommand("SELECT * FROM books");
webR.execute();
System.out.println(webR.getSyncProvider());
webR.absolute(1);
webR.updateString(2, "Indeed it is");
webR.updateRow();
System.out.println(webR.getSyncProvider());
FileOutputStream fo = new
FileOutputStream("/home/widelec/Desktop/File.xml");
webR.writeXml(fo);
The output of getSyncProvider both before and after accessing the database
is RIOptimisticProvider. It should have been RIXMLProvider...
Anybody knows why it happens like that? Again for an OCPJP7 question I
would not know what to choose if asked since the tutorial and API say a
thing and the reality is another.
What do you think.. is it a bug in my code? Could you please try it out to
see if you get the same result?
Thanks in advance.

Thursday 22 August 2013

Warning: File upload error - unable to create a temporary file in Unknown on line 0

Warning: File upload error - unable to create a temporary file in Unknown
on line 0

pAm getting the following error everytime I try to upload a file . /p
pWarning: File upload error - unable to create a temporary file in Unknown
on line 0/p pHere is my HTML form,/p precodelt;form
action=./inventory_list.php enctype=multipart/form-data name=myForm
id=myForm method=postgt; lt;table width=625 border=1 cellpadding=5gt;
lt;trgt; lt;td width=84gt;Product Namelt;/tdgt; lt;td width=399gt;lt;input
type=text name=product_name id=product_namegt;lt;/tdgt; lt;/trgt; lt;trgt;
lt;tdgt;Product Pricelt;/tdgt; lt;tdgt;lt;label
for=textfield2gt;Rs:lt;/labelgt; lt;input type=text name=price
id=pricegt;lt;/tdgt; lt;/trgt; lt;trgt; lt;tdgt;Categorylt;/tdgt;
lt;tdgt;lt;select name=category id=categorygt; lt;option value=
selected=selectedgt;lt;/optiongt; lt;option value=Bedroom gt;Bedroom
lt;/optiongt; lt;option value=Livinggt;Living roomlt;/optiongt; lt;option
value=Dininggt;Dininglt;/optiongt; lt;/selectgt;lt;/tdgt; lt;/trgt;
lt;trgt; lt;tdgt;Sub - Categorylt;/tdgt; lt;tdgt;lt;select
name=subcategory id=subcategorygt; lt;option value=
selected=selectedgt;lt;/optiongt; lt;option value=dinetgt;Dining
tableslt;/optiongt; lt;option value=shoegt;shoe rackslt;/optiongt;
lt;option value=wardrobegt;wardrobeslt;/optiongt; lt;option
value=sofagt;sofalt;/optiongt; lt;/selectgt;lt;/tdgt; lt;/trgt; lt;trgt;
lt;tdgt;Product Detailslt;/tdgt; lt;tdgt;lt;textarea name=details cols=50
rows=10 id=detailsgt;lt;/textareagt;lt;/tdgt; lt;/trgt; lt;trgt;
lt;tdgt;Product Imagelt;/tdgt; lt;tdgt;lt;labelgt; lt;input type=file
name=fileField id=fileField/gt; lt;/labelgt;lt;/tdgt; lt;/trgt; lt;trgt;
lt;tdgt;amp;nbsp;lt;/tdgt; lt;tdgt;lt;input type=submit name=button
id=button value=Add this Item nowgt;lt;/tdgt; lt;/trgt; lt;/tablegt;
lt;/brgt; lt;/formgt; /code/pre pHere is my PHP code ,/p precode
if(isset($_POST[product_name])) { $product_name =
mysql_real_escape_string($_POST[product_name]); $price=
mysql_real_escape_string($_POST[price]); $category=
mysql_real_escape_string($_POST[category]); $subcategory=
mysql_real_escape_string($_POST[subcategory]); $details=
mysql_real_escape_string($_POST[details]); //see if duplicate product
exists $sql = mysql_query(select id from products where
product_name='$product_name' limit 1); $product_match =
mysql_num_rows($sql);//count the output if($product_matchgt;0) { echo The
product name already exists; exit(); } $sql= mysql_query(INSERT INTO
`mystore`.`products` (`product_name`, `price`, `details`, `category`,
`subcategory`, `date_added`) VALUES ( '$product_name', '$price',
'$details', '$category', '$subcategory', now());)or die(mysql_error());
$pid = mysql_insert_id(); $newname = $pid.jpg;
move_uploaded_file($_FILES['fileField']['tmp_name'],'../inventory_images/$newname');
} /code/pre pAm trying to upload on localhost , Test Server:XAMPP , OS :
MAC 10.8/p pAm stuck on this from a long time , I tried a lot of things
but nothing is working . /p

HTML Table in VB.Net back end code

HTML Table in VB.Net back end code

I have a table that I have created in the VB.net code behind. I have a
connection to a database and it returns records to put into my html table.
What I'm having issues with is I want to have 5 cells per row and an
unlimited amount of rows. Everytime I try and do something that only has
the 5 cells per row it's returning something that I don't need. Please
help!! Here is the code that I'm using.
Protected Sub LoadProducts() Dim con5 As New SqlConnection Dim cmd5 As New
SqlCommand Dim index As Integer = 0
con5.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionString")
con5.Open()
cmd5.Connection = con5
cmd5.CommandType = CommandType.StoredProcedure
cmd5.CommandText = "ProductTypesSearch"
Dim dt1 As New DataSet
cmd5.Parameters.Add(New SqlParameter("ProductID",
SqlDbType.Int)).Value = 1
cmd5.Parameters.Add(New SqlParameter("CollectionID",
SqlDbType.Int)).Value = 2
Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd5)
da1.Fill(dt1)
Dim cell As HtmlTableCell
Dim row As HtmlTableRow
Dim table1 As New HtmlTable
row = New HtmlTableRow()
Dim numells As Integer = 6
dv = New DataView(dt1.Tables(0))
Dim tablestring = ""
If dv.Table.Rows.Count > 0 Then
For Each dr As DataRowView In dv
Dim crossover As String = dr("CrossoverID").ToString()
Dim picid As String = dr("Description").ToString()
Dim picdescrip As String = dr("DesignColor").ToString()
cell = New HtmlTableCell()
' cell.InnerHtml = "<table style='width:100%'><tr><td
colspan='4'><img src='/Images/splashpage.jpg' width='1000'
height='100'></td></tr>"
'For i As Integer = 1 To 1
For j As Integer = 0 To numells - 1
cell.InnerHtml = "<table width-'100%'>"
cell.InnerHtml += "<tr><td><div class='product'><td><a
href='ProductBreakdown2.aspx?p=" + crossover + "'</a>"
cell.InnerHtml += "<div class='product'><img
src='Images/WebsiteProductImages/" + picid + ".png'
width='100' height='100'>"
cell.InnerHtml += "<div class = 'test'>" + picdescrip
cell.InnerHtml += "</td></tr></div></div></table>"
' Add the cell to the current row.
row.Cells.Add(cell)
Next
' table1.Rows.Add(row)
Next
' Next
'' Add the row to the table.
'' Next
'' Add the table to the page.
Me.Controls.Add(table1)
End If
End Sub

Send mail via SMTP (ideally using OAuth 2.0) in a Google Marketplace App

Send mail via SMTP (ideally using OAuth 2.0) in a Google Marketplace App

Using the docs and python libraries google provided in the oauth2client.py
along with the oauth2.py library and docs I managed to successfully send
mail via a user's gmail account by authenticating them through OAuth2.0. I
created a project in google apis and was able to get the keys and other
params needed to correctly authenticate and send mail.
Now I am trying to achieve the same goal but with a Google Marketplace
App. The end-goal is that a domain administrator could add our app to
their Google Apps domain so that each user would not need to go through
the authentication process and our app would 'automatically' be authorized
to send mail on their behalf.
The first problem came in that when registering an App in the marketplace,
I was given the client key and secret, but no redirect_uri, like I was
given in the other project. This means I was unable to authenticate using
their OAuth2WebServerFlow class. This lead to some hours of searching and
conflicting answers and broken links within Google's documentation. This
doc leads me to believe that Marketplace Apps don't support OAuth 2.0 and
that I would need to go back to using a 2-legged OAuth 1.0 authentication.
But it was updated over a year ago and all the other Google docs tell me
strongly not to use OAuth 1.0 as it's been deprecated.
Is re-writing all new code (not being able to use the same libraries or
anything) to use OAuth 1.0 the only way to be able to do this with a
Marketplace App? Is there another way and if not, any advice on leveraging
the existing code or how best to do in in their current system?
A short snippet of how I'm doing it currently using OAuth 2.0:
flow = OAuth2WebServerFlow(
client_id="xxx",
client_secret="xxx",
scope="https://mail.google.com/",
user_agent="mytest/0.1",
redirect_uri="http://127.0.0.1:5000/oauth2callback"
)
authorize_url = flow.step1_get_authorize_url()
and on return
credentials = flow.step2_exchange(request.args['code'])
storage = Storage(request.user.email)
storage.put(credentials)
and to send the mail
conn = smtplib.SMTP('smtp.googlemail.com', 587)
conn.set_debuglevel(True)
conn.ehlo('test')
conn.starttls()
auth_string = 'user=%s\1auth=Bearer %s\1\1' % (user_address,
credentials.access_token)
conn.docmd('AUTH', 'XOAUTH2 ' + base64.b64encode(auth_string))
header = 'To:' + recipient_address + '\n'
header += 'From:' + user_address + '\n'
header += 'Subject: Oauth test Email \n'
header += 'Content-Type: text/html; charset=UTF-8\n'
msg = header + '\n ' + "Waka waka" + ' \n\n'
conn.sendmail(user_address, recipient_address, msg)

How to check if an array/hash key exists before calling it?

How to check if an array/hash key exists before calling it?

I want to print the value of an array/hash key without raising exception
when the index is not found. (note I'm not looking for rescue here)
<%= content.categories[0].name %>
In the above statement, if categories is an empty array, it will throw an
exception. Since I'm using this code in my views, I want a code that is
very brief and yet prints nothing if categories is empty.

Capture the value of multiple cell range in a custom formulaarray

Capture the value of multiple cell range in a custom formulaarray

I've written my own function in VBA to do some things. Parameters are
Variant.
Private Function ProcessedValuesEx(pValues As Variant)
The problem occurs when I select a multiple cell range as my function
parameter.
When it executes, the parameter has no value. I'm not able to see any
content. Even with the VBA inspector.
When selection only one cell there is no problem. The parameter gets the
content of the cell.

Is there any way to deploy EAR without bindings to Websphere 7

Is there any way to deploy EAR without bindings to Websphere 7

I'm using Maven to build EAR files. I need to deploy them to WAS 7 without
IBM RAD. It seems that there is no way to deploy using maven plugins like
Cargo. Because they don't support this version of WAS.
Also I tried to use Jython scripts, but I can't deploy EAR without
ibm-ejb-jar-bnd.xml. When I use WAS Console there is an option to merge
bindings during application update, but it seems that scripts don't
provide this option.
So, is what is the best option to deploy EAR pragmatically?

How to delete a installed application using AppId in inno setup?

How to delete a installed application using AppId in inno setup?

Currently i have used the following code to delete the old version
directory of my application, below code works fine by finding the
application with the app name. I want to find the application using it
UNIQUE APPID, Can someone please help me out regarding this issue.
procedure DeleteExistingVersion(); begin
MsgBox('Deletion Starts',mbInformation, MB_OK);
if (DirExists (ExpandConstant('{pf}\APPLICATION NAME'))) then
begin
DelTree(ExpandConstant('{pf}\APPLICATION NAME'), True, True, True);
MsgBox('Deletion Ends', mbInformation, MB_OK);
end;
end;

Wednesday 21 August 2013

Ruby: How do I access module local variables?

Ruby: How do I access module local variables?

I get this error: MyModule.rb:4:in getName': undefined local variable or
methods' for MyModule:Module (NameError)
file1
module MyModule
s = "some name"
def self.getName()
puts s
end
end
file2
require './MyModule.rb'
include MyModule
MyModule.getName()
This has something to do with scope, but I'm not comprehending why this is
happening if I declared it before the method. does include only mixin
methods and not variables? How do I change my module so that it can print
out variables I define within the module?

Does bit shift automatically promote chars to int?

Does bit shift automatically promote chars to int?

I read somewhere that bitwise shift automatically turns the operand into
an int. But I'm not sure if that statement should be qualified with "if
the operands are of unequal type."
char one = 1, bitsInType = 8;
one << (bitsInType - one);
Does the default result of the second line result in an int or char?

Fill and Mouse Hover Color in ImageMapster jQuery Plugin

Fill and Mouse Hover Color in ImageMapster jQuery Plugin

I am trying to set the color for click and hovering over an image using
the jquery plugin ImageMapster, and can't seem to change them to anything
besides black using the fillColor and other options.
Any thoughts?
<!DOCTYPE html>
<html>
<body>
<img
src="/Users/Gavin/Downloads/Chrome/econwillow/Centipede02/centipeder.jpg"
id="centipede" usemap="#image_map">
<map name="image_map" id="image_map">
<area shape="poly" color ="blue" coords=" 55,104, 62,106, 61,178,
77,183, 57,214, 36,181, 51,178, 53,105" href="#" alt="red
hotspot"/>
<area shape="poly" color="red" coords=" 82,84, 126,85, 128,96,
165,77, 130,60, 130,72, 84,77, 83,80" href="#" alt="purple
hotspot"/>
</map>
<script>
$('#centipede').mapster({
singleSelect: true,
mapKey: 'color',
fill: true,
fillColor: "#FF0000",
fillOpacity: 1,
});
</script>
</body>
</html>

How to mock with NSubstitute a method with an array parameter?

How to mock with NSubstitute a method with an array parameter?

I have the following interface:
interface IText
{
void CopyTo(char[] array, int index);
}
I would like to create a mock object implementing IText which
setsarray[index]='f', array[index+1]='o', array[index+2]='o' when CopyTo
is called.
Is this possible with NSubstitute? If so, how?

Classic method throwing AbstractMethodError VS abstract method

Classic method throwing AbstractMethodError VS abstract method

I just had a look on the TimeUnit enum source code (simplified herebelow):
public enum TimeUnit {
SECONDS {
public long toMillis(long d) { return d * 1000L; }
},
MINUTES {
public long toMillis(long d) { return d * 10000L; }
};
public long toMillis(long duration) {
throw new AbstractMethodError();
}
}
They could also have implemented it using an abstract method:
public enum TimeUnit {
SECONDS {...}, MINUTES {...};
public abstract long toMillis(long duration);
}
Since they chose the first implementation, I guess there must be a reason
why. Thus, my question is: why? Can the AbstractMethodError be ever
thrown? If yes, in which case(s)?

Improve the performance of uitableview creation with many sections from sqlite database

Improve the performance of uitableview creation with many sections from
sqlite database

This is my scenario:
Sqlite database with 30000 products with 800 different brands.
Table product is like this:
id | title | brand | other fields
Products example:
1221 | Product 1 | brand 1 | ...
1222 | Product 2 | brand 2 | ...
1223 | Product 3 | brand 2 | ...
1224 | Product 4 | brand 3 | ...
1225 | Product 5 | brand 3 | ...
1226 | Product 6 | brand 3 | ...
I need to create a uiviewtable with all products in different sections.
Sections are different brands of products.
I must implements this methods:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
My idea to solve this problem is as follows (written in pseudocode):
NSArray * productList = [databaseManager getProductList]; //array with
Product model objects
NSArray * brandsList = [databaseManager getBrandsList];
NSMutableDictionary * dictionaryProductBrands = [NSMutableDictionary
dictionaryWithCapacity:bramdsList.count];
for (NSString *brand in brandsList) {
NSMutableArray *arrayProductsPerBrands = [NSMutableArray array];
for (Product *p in productList) {
if ([p.brand isEqualToString:brand]) {
[arrayProductsPerBrands addObject:p];
}
}
[dictionaryProductBrands setValue:arrayProductsPerBrands forKey:brand];
}
This solution has a poor performance.
Can I improve the way to generate the tableview with sections with the
same database?

Proxy and Proxy in Web Services

Proxy and Proxy in Web Services

Could anyone please explain this from the point of view of a beginner
asp.net programmer?
What is a Proxy class? What are the main uses of it in asp.net?
What are the main uses of proxy when using web services?
From what I've read so far, I understand that web service proxy, we don't
have to reference the service through out the application. We can simply
set it in web.config and change it there whenever required.

Tuesday 20 August 2013

Picture swipe script not working

Picture swipe script not working

I'm trying to make some pictures on a website "swipable" on mobile devices.
I'm new to javascript and jquery so I could have made any number of
mistakes, though I'm not sure where.
(Note: this is similar to a question I posted yesterday, but I have
changed quite a few things to make the following more understandable).
I have the following declared in my header (of course these files exist in
their respective directories):
<link rel='stylesheet'
href='http://www.hidden.com/css/jquery.mobile-1.3.2.min.css'>
<script src='http://www.hidden.com/js/jquery.mobile-1.3.2.min.js'></script>
This is the way the images are linked right now:
<div class='main_image'>
<a
href='//www.hidden.com/projects/1_west-harbin-station-towers/9.html'
style='display:block'>
<img src='http://www.hidden.com/1250_Harbin/hidden_harbin
towers9.jpg
' alt='Interior Rendering from West Harbin Station
Towers [hidden]' style='max-width:832px; max-height:500px'
title='West Harbin Station Towers: Interior Rendering. click
for next slide (Rendering). '>
</a>
</div>
This is the script I wrote, which goes right after:
<script type='text/javascript'>
jQuery(function(){
jQuery('div.main_image').on('swipeleft', swipeleftHandler);
jQuery('div.main_image').on('swiperight', swiperightHandler);
function swipeleftHandler(event){
JQuery.mobile.changePage('//www.spatialpractice.com/projects/1_west-harbin-station-towers/9.html',
{transition: 'slideleft', changeHash: false});
}
function swiperightHandler(event){
JQuery.mobile.changePage('//www.spatialpractice.com/projects/1_west-harbin-station-towers/7.html',
{transition: 'slideright', changeHash: false});
}
});
</script>
Right now, clicking on the images work, but it does not detect swiping.
Any suggestions?

SQL to insert a row on the table should insert into another table

SQL to insert a row on the table should insert into another table

I have a insert query on table A, it should insert to another table B.
This insert should not happen to table A. Do we have any trigger to
transfer this insert query on other table B instead of table A?
Any suggestions?

Automatic keyboard display for EditText in AlertDialog.Builder

Automatic keyboard display for EditText in AlertDialog.Builder

Apologies for asking a question which seems to have been asked and
answered before but none of the solutions I've found seem to work for me.
I'm creating an AlertDialog with an EditText to obtain a string from the
user. When this dialog is shown, there is no soft keyboard visible and
only once the user taps on the EditText does the keyboard pop up. How can
I get the EditText to automatically have focus and the keyboard to
automatically show the moment the dialog is shown?
Here is my code for creating and showing the dialog. All of this is inside
an OnClickListener for a button on the main activity.
@Override
public void onClick(View v) {
final EditText textFileName = new EditText(MainActivity.this);
textFileName.setRawInputType(Configuration.KEYBOARD_QWERTY);
textFileName.setInputType(InputType.TYPE_CLASS_TEXT);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
.setTitle("Save Data")
.setMessage("Specify file name for saved data.")
.setView(textFileName)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Do the file saving bit here
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Do whatever you feel is important here
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
Now I did search around for the solution to this problem and found two
answers, this one here and another one here. Both of these seemed to have
satisfied the respective original posters but neither of them work for me
and I just can't figure out what it is that I'm doing wrong.
Here's my first attempt, based on the code above and the top voted answer
posted in the first link.
@Override
public void onClick(View v) {
final EditText textFileName = new EditText(MainActivity.this);
textFileName.setRawInputType(Configuration.KEYBOARD_QWERTY);
textFileName.setInputType(InputType.TYPE_CLASS_TEXT);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
.setTitle("Finalise List")
.setMessage("Specify file name for saved list.")
.setView(textFileName)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(MainActivity.this,
textFileName.getText().toString(), Toast.LENGTH_LONG).show();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
dialog.show();
}
It's essentially one line of code added just before the dialog.show() call
but it changes nothing. The dialog still pops up with the most beautiful
EditText but no keyboard, until I tap on the EditText.
And here is attempt two, based on the top voted answer in the second link.
@Override
public void onClick(View v) {
final EditText textFileName = new EditText(MainActivity.this);
textFileName.setRawInputType(Configuration.KEYBOARD_QWERTY);
textFileName.setInputType(InputType.TYPE_CLASS_TEXT);
textFileName.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
textFileName.post(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager =
(InputMethodManager)MainActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(textFileName,
InputMethodManager.SHOW_IMPLICIT);
}
});
}
});
textFileName.requestFocus();
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
.setTitle("Finalise List")
.setMessage("Specify file name for saved list.")
.setView(textFileName)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(MainActivity.this,
textFileName.getText().toString(), Toast.LENGTH_LONG).show();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
Same story as before.
Any help please? Would be much appreciated.

Android Studio w/gradle: Package r does not exist

Android Studio w/gradle: Package r does not exist

I'm a novice Android developer trying to convert an Android Studio project
that does not currently use Gradle (and compiles and runs just fine) to
one that uses Gradle on OS X. I'm stuck on a Resource error, which I think
may have to do with either my project structure, settings in the IDE,
settings in the build.gradle files, or some combination of those.
The way I went about doing the conversion was to first create a new
project in Android Studio, copy over files to appropriate locations, then
add some settings in the IDE and build.gradle files. My resulting project
structure is,
„¥„Ÿ„Ÿ frontlinesms-for-android
„¥„Ÿ„Ÿ build.gradle
„¥„Ÿ„Ÿ gradle
„¥„Ÿ„Ÿ gradlew
„¥„Ÿ„Ÿ gradle.bat
„¥„Ÿ„Ÿ local.properties
„¥„Ÿ„Ÿ lib
„¤„Ÿ„Ÿ lib1.jar
„¤„Ÿ„Ÿ lib2.jar
„¤„Ÿ„Ÿ ...
„¥„Ÿ„Ÿ frontlinesms-for-android.iml
„¥„Ÿ„Ÿ FrontlineSMS
„¤„Ÿ„Ÿ build.gradle
„¤„Ÿ„Ÿ src
„¥„Ÿ„Ÿ main
„  „¤„Ÿ„Ÿ res
„  „¤„Ÿ„Ÿ AndroidManifest.xml
„  „¤„Ÿ„Ÿ java
„  „¤„Ÿ„Ÿ net
„  „¤„Ÿ„Ÿ frontlinesms
„  „¤„Ÿ„Ÿ android
„  „¥„Ÿ„Ÿ FrontlineSMS.java
„  „¥„Ÿ„Ÿ ...
Most notably, maybe, is I put the res/ folder at the same level as java/
and AndroidManifest.xml. I'm trying to follow the conventions mentioned in
the Gradle Plugin User Guide so I don't have to customize too much in the
build.gradle files.
I also marked the folder FrontlineSMS/src/main/java/net as source because
if I don't then nothing attempts to compile. I created a new build.gradle
file in FrontlineSMS/build.gradle because it did not exist when I made the
new project, even though an instructional video on the Gradle website said
it would.
In the IDE I also set the dependencies for the external libraries I have
in /lib.
When I try to compile via the IDE I get many Package r does not exist
errors, indicating the auto generated R class is not getting generated or
recognized. This is defined in the project as,
import net.frontlinesms.android.R;
in several files. What can I do to make Android Studio / Gradle recognize
the resources I have defined under src/main/res?
Reading up on others' questions, I notice that some solutions to this
error involved marking a "gen/" folder as a source root or "cleaning" the
project. I tried creating a gen/ folder in the root directory and marking
it as source but that didn't work. And, rebuilding the project just gives
me the same errors.
My root build.gradle file has the following,
dependencies {
compile project(':FrontlineSMS')
}
And the one under FrontlineSMS/build.gradle has,
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile file('lib/acra-3.1.1.jar')
compile file('lib/activation.jar')
compile file('lib/additionnal.jar')
compile file('lib/annotations.jar')
compile file('lib/libGoogleAnalytics.jar')
compile file('lib/mail.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
When I try to build from the command line using ./gradlew clean I get this
error,
FAILURE: Build failed with an exception.
* Where:
Build file
'/Users/rhawkins/workspace-studio/frontlinesms-for-android/build.gradle'
line: 3
* What went wrong:
A problem occurred evaluating root project 'frontlinesms-for-android'.
Project with path ':FrontlineSMS' could not be found in root project
'frontlinesms-for-android'.
In addition to my previous question, I'd appreciate any tips you can lend
as to how this project should be structured. This is not meant to be a
multi-project setup. Thanks for your help.