Saturday, 31 August 2013

This is 2013. C++11 and C++14 is on us. But why still no dedicated IDE for C++?

This is 2013. C++11 and C++14 is on us. But why still no dedicated IDE for
C++?

I'm 26 years old. C++ is nearly 35 years old.
I'm really baffled at seeing the evolution of C++ in my 15 years of
programming. I started with Turbo C blue screen in late 90's to vim in
early 2000's. From there, I have moved on to Java, Python and Ruby. All
beautiful languages having extensive set of IDE's which makes programming
in these languages easy and fun.
But As for C++. With it's latest iteration in C++11 and coming iteration
C++14, There's still no full fledged, dedicated Editor which full support
for latest standard and documentation of libraries and intellisense. This
is really ironic, since today, almost every language have extensive
toolsets.
C++ is not as easy to learn. An IDE will surely go a long way getting new
programmers on-boarding process easy to a great extent.
If anyone knows any reason behind it, please edify us.

NSMutableArray not retaining values outside of method

NSMutableArray not retaining values outside of method

Ive been trying to solve this for the past one hour, but still had no luck
I have an NSMutableArray instance variable which holds objects in the
following class:The array successfully gets populated in the method i
populate it in, but it shows up as empty in all other methods/classes
.h file...
import "RedditPostItem.h"
@interface RedditRepository : NSObject
@property (nonatomic, strong) NSMutableArray redditPosts; //<<* this is
the problem array
@property (nonatomic, strong,readwrite) NSDictionary *allJSONData;
@property (nonatomic, strong,readwrite) NSMutableData *incomingData;
(void)getPosts;
(void)printAllTitles;
@end



.m file
@implementation RedditRepository . . @synthesize redditPosts=_redditPosts;
. .
(void)connectionDidFinishLoading:(NSURLConnection *)connection {
self.redditPosts = [[NSMutableArray alloc] initWithCapacity:20];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//parse json data
_allJSONData = [NSJSONSerialization JSONObjectWithData:_incomingData
options:0 error:nil];
NSDictionary *dataDictionary = [_allJSONData objectForKey:@"data"];
NSArray *arrayOfChildren = [dataDictionary objectForKey:@"children"];
for (NSDictionary *diction in arrayOfChildren) {
NSDictionary *childrenData = [diction objectForKey:@"data"];
RedditPostItem *postItem = [[RedditPostItem
alloc]initWithAPIResponse:childrenData];
//***************** add to array..... [self.redditPosts addObject:postItem];
}
//* if i iterate through 'self.redditPosts' i can see everything uptill
this point and the array successfully gets populated//
}
//*** if I execute any operation from any other method in this class or
any other class...the array shows up as empty!!*//
(void)printAllTitles{ if(self.redditPosts == nil) { NSLog(@"array is
empty....."); ///always shows up as empty for some reason<<<<<< } }

Codeigniter Strange Query Results.

Codeigniter Strange Query Results.

I am trying to build a messaging system in codeigniter. I have three
tables as below.
messages: id--thread_id--message_id--subject--message--sent
messages_thread id--thread_id
messages_participants id--thread_id--to_id--from_id--message_id
I am easily able to compase a new message, and the recipient can see that
a message has been recieved.
The problem comes when there is a reply. After replying the results are
duplicated. it show that the initial message was sent from both the
originator and the reciever and is returning 4 rows instead of the
expected 2 rows. can anyone tell me where I am going wrong?
Here is my model.
function reply_to_thread(){
//Generate random string for the ticket number
$rand = substr(str_shuffle(MD5(microtime())), 0, 11);
//Add the random string to the hash
$messageid = $rand;
$messageinsert = array(
'message_id' => $messageid,
'subject' => $this->input->post('subject'),
'message' => $this->input->post('message'),
'thread_id' => $this->input->post('thread_id'),
);
$participantsinsert = array(
'message_id' => $messageid,
'from_id' => $this->input->post('from_id'),
'to_id' => $this->input->post('to_id'),
'thread_id' => $this->input->post('thread_id'),
);
$this->db->insert('messages',$messageinsert);
$this->db->insert('messages_participants',$participantsinsert);
}
function view_thread($thread_id){
$this->db->where('messages.thread_id', $thread_id);
$this->db->join('messages_participants',
'messages_participants.thread_id = messages.thread_id');
$this->db->join('users', 'messages_participants.from_id = users.id');
$result = $this->db->get('messages');
var_dump($result);
return $result->result_array();
}
My controller:
function check_messages(){
$id = $this->session->userdata('id');
$data['thread'] = $this->message_model->check_messages($id);
$this->load->view('messages/my_messages', $data);
}
function view_thread($thread_id){
$data['thread'] = $this->message_model->view_thread($thread_id);
$this->load->view('messages/view_thread',$data);
}
function reply(){
$this->message_model->reply_to_thread();
redirect('messages/get_messages');
}
and my view thread view:
<div class="well">
<h3>View Messages</h3>
<?php foreach($thread as $threadfield):?>
<div class="message">
<img class="avatar pull-left" src="<?php echo
$threadfield['avatar'];?>">
<div class="message-actions">
<button class="btn btn-success"
id="reply">Reply</button>
</div>
<p>
<strong>From: <a href="profile.html"> Users
id: <?php echo
$threadfield['from_id'];?></a></strong> <span
class="badge
badge-important">Unread</span><br>
<strong>Date:</strong> <?php echo date('M j Y
g:i A', strtotime($threadfield['sent']));?>
</p>
<p><strong>Subject:</strong> <a href =
"/messages/view_thread/<?php echo
$threadfield['thread_id'];?>"><?php echo
$threadfield['subject'];?></a></p>
<p><strong>Message:</strong> <?php echo
$threadfield['message'];?></p>
<hr>
</div>
<?php endforeach; ?>
</div>
<div class="row-fluid" id="replyform" style="display: none">
<div class="well">
<h3>Reply to <?php echo $threadfield['username'];?>'s
Message.</h3>
<?php echo form_open('messages/reply');?>
<input type="text" value="<?php echo
$threadfield['thread_id'];?>" name="thread_id"
id="thread_id">
<input type="text" value="<?php echo
$this->session->userdata('id');?>" name="from_id"
id="from_id">
<input type="text" value="<?php echo
$threadfield['from_id'];?>" name="to_id" id="to_id">
<input type="text" value="RE: <?php echo
$threadfield['subject'];?>" name="subject"
id="subject">
<input type="text" placeholder="Message......."
name="message" id="message">
<button class="btn" type="submit">Submit Reply</button>
<?php echo form_close();?>
</div>
thanks in advance.

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

Optimization of code in javascripts JSON calls

Optimization of code in javascripts JSON calls

I've been involved in a large web application where I have a lot of
functions that calls web services through JSON. For instance:
/*...*/
refreshClientBoxes: function(customerNr) {
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
postObject(jsonURL, JSON.stringify(request), successClientBoxes);
},
/*...*/
Where "postObject" it's a function that receive an URL, the data and a
callback.
As you can see I have to construct this piece of code in every single method:
var request = {};
request.method = "getClientBoxes";
request.params = {};
request.params.customerNr = customerNr;
request.id = Math.floor(Math.random() * 101);
What's change is the name of the method that we will call and the name and
values of parameter that we want to pass.
So I was wondering if there is a way that we can avoid this effort through
a method that receive the name of the method that we will call and array
of parameters, and using some kind of reflection construct the request
parameters and return the request stringifyed.
For the WS I used php + zend 1.12, the MVC framework in JS its ember 0.95
and jQuery.

How to validate if a file was sent in a form?

How to validate if a file was sent in a form?

I have this PHP code, but it doesn't validate whether the image was
uploaded or not, so if there's no image sent in the form it should stop
the process.
How can I change this code to make it work?
if(empty($_FILES['txtImage'])) {
$msg .= "Opss, you forgot the image.<br>";
}

how do i resize tinymce after changin font-size?

how do i resize tinymce after changin font-size?

Issue : when i have changed the font-size like 38pt, the text goes out of
the editor.
I am using tinymce 4.0.
This is my script to load tinymce
<script type="text/javascript">
tinymce.init({
selector: "div#textareasDiv",
theme: "modern",
inline: true,
plugins: [ "textcolor,table"],
toolbar1: " bold italic underline | alignleft aligncenter
alignright alignjustify | forecolor backcolor | fontselect |
fontsizeselect",
image_advtab: true,
menubar: false,
fixed_toolbar_container: "#toolbarCon"
});
</script>
and
<div id="textareasDiv"></div>
<div id="toolbarCon"></div>
and
<style>
#textareasDiv { padding:2px
5px;width:170px;height:80px;background:transparent;word-wrap: break-word;
}
</style>
And I am trying to get its outerHeight so that i can make change on it :
setup : function(ed)
{
ed.on('change', function(e)
{
alert($(this.getContainer()).outerHeight());
});
}
But it gives me nothing.
How can i resize tinymce editor after changing font-size?

Friday, 30 August 2013

How to have a progress bar in jQuery.get()

How to have a progress bar in jQuery.get()

is it possible to have a progress bar measuring the jQuery.get() progress?

Thursday, 29 August 2013

How to query web server for existing text within a web page?

How to query web server for existing text within a web page?

I have a page on a certain domain (let's call it domain1.com) which is
checking for a version number.
Example: 1.0
Then I have another domain (let's call it domain2.com) where there is
another page.
On domain2.com, I manually update the version number by editing the text.
So say I update the number on domain2.com to 1.1
I want the page on domain1.com, on page load to query domain2.com to see
if the number is the same.
If same, then the text next to it says, "up to date!".
If different, then change the text next to it to say, "update available!".
So what is the best way to do this?
My guess is javascript or jquery.
And how do I do it?
Thanks for your help!

Unable to use JSF Ajax

Unable to use JSF Ajax

So far I haven't been able to find a clear answer on SO, so if this has
already been answered, please direct me to it if possible.
What I have:
(HTML)
<span class="btn-group" data-toggle="buttons-radio">
<button id="btn1" onClick="$('#theTest').val('price');" type="button"
class="btn" value="price">Price</button>
<button id="btn2" onClick="$('#theTest').val('time');" type="button"
class="btn" value="time">Time</button>
<input name="theTest" id="theTest" type="hidden" value=""/>
</span>
When a button is clicked, I need to call a function in the backing bean
with the value of the clicked button, ie the value of #theTest
How do I do this? I can't call it from javascript, because I am using JSF,
and the #{} tags don't work with javascript.

Wednesday, 28 August 2013

dropdown is in middle of page, should open list according to position

dropdown is in middle of page, should open list according to position

I have a dropdown which is in the middle of the page. It always opens the
list downwards, as it should be. Now, we have to implement it in a way
that whenever the browser screen size is changed, & the dropdown box does
not have enough space to open the list, it should open the list upwards.
Please let me know, if more details are required.

How to programmatically add active style to header control links using C#?

How to programmatically add active style to header control links using C#?

I have an unordered list for my navigation in my header control. The
header control is called on each of my other pages.
<ul>
<li class="active">Home</li>
<li>About</li>
<li>Store</li>
</ul>
What is the best way to programmatically change the active class to the
About page when I load it?
I'm using C# for this project.

XPath expression to create text delimited string

XPath expression to create text delimited string

I need to create a delimited string of the following format:
Stuff,Things;A,1;B,2
From the following XML Data:
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="3"
x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell><Data ss:Type="String">Stuff</Data></Cell>
<Cell><Data ss:Type="String">Things</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">A</Data></Cell>
<Cell><Data ss:Type="Number">1</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">B</Data></Cell>
<Cell><Data ss:Type="Number">2</Data></Cell>
</Row>
</Table>
Columns are denoted by , and rows are denoted by ;. This should create a
two dimensional array.
---------Notes-----------
I have tried the following expression against the sample XML but it does
not work when applied using NotePad++ XPatherizerNPP:
eval(eval(Row, 'concat(Cell, ";")'), "..")
The above expression throws the following erorr: XSLTContext is needed for
this query because of an unknown function
The "Eval" function typically works in MS InfoPath, but it is possible
that XPatherizer does not handle the XPath in the same way that InfoPath
does. It is also possible that I don't understand the context of this
statement and I am using it inappropriately.
As a sidenote, are there any good web resources that explain the use of
XPath Eval? I don't fully understand it and cannot seem to find any good
explanations.
--------Full XML--------
Here is the full body of the XML I am trying to use. It is an "XML
Spreadsheet" generated by MS Excel. I do not have the ability to create a
custom XML mapping as I do not have the rights to install the XML Tools on
my system.
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Smith, Robert;-</Author>
<LastAuthor>Smith, Robert;-</LastAuthor>
<Created>2013-08-27T16:29:45Z</Created>
<Company>SmithWorks</Company>
<Version>14.00</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>10035</WindowHeight>
<WindowWidth>22035</WindowWidth>
<WindowTopX>240</WindowTopX>
<WindowTopY>90</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11"
ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="3" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell><Data ss:Type="String">Stuff</Data></Cell>
<Cell><Data ss:Type="String">Things</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">A</Data></Cell>
<Cell><Data ss:Type="Number">1</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">B</Data></Cell>
<Cell><Data ss:Type="Number">2</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>3</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet3">
<Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="1" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>

NullPointer Exception in getWidth(), getHeight()

NullPointer Exception in getWidth(), getHeight()

I am working on project . I need the width & Height of a LinearLayout from
Activity using programming code. This Linear Layout has fixed width and
Height . But when i use the following ..i am getting Nullpointer Exception
LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.popup);
Log.e("getWidth",""+viewGroup.getWidth());
Log.e("getHeight",""+viewGroup.getHeight());
I need the width and height of that layout from activity.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup"
android:layout_width="150dp"
android:layout_height="252dp"
android:background="#303030"
android:orientation="vertical" >
</LinearLayout>
Here is the Java code file
public class MainActivity extends Activity {
//The "x" and "y" position of the "Show Button" on screen.
Point p;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn_show = (Button) findViewById(R.id.show_popup);
btn_show.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//Open popup window
if (p != null)
showPopup(MainActivity.this, p);
}
});
}
// Get the x and y position after the button is draw on screen
// (It's important to note that we can't get the position in the
onCreate(),
// because at that stage most probably the view isn't drawn yet, so it
will return (0, 0))
@Override
public void onWindowFocusChanged(boolean hasFocus) {
int[] location = new int[2];
Button button = (Button) findViewById(R.id.show_popup);
// Get the x, y location and store it in the location[] array
// location[0] = x, location[1] = y.
button.getLocationOnScreen(location);
//Initialize the Point with x, and y positions
p = new Point();
p.x = location[0];
p.y = location[1];
}
// The method that displays the popup.
private void showPopup(final Activity context, Point p) {
int popupWidth = 200;
int popupHeight = 380;
// Inflate the popup_layout.xml
LinearLayout viewGroup = (LinearLayout)
context.findViewById(R.id.popup);
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(R.layout.a, viewGroup);
Log.e("getWidth",""+viewGroup.getWidth());
Log.e("getHeight",""+viewGroup.getHeight());
// Creating the PopupWindow
final PopupWindow popup = new PopupWindow(context);
popup.setContentView(layout);
popup.setWidth(viewGroup.getWidth());
popup.setHeight(viewGroup.getHeight());
popup.setFocusable(true);
// Some offset to align the popup a bit to the right, and a bit
down, relative to button's position.
int OFFSET_X = 30;
int OFFSET_Y = 30;
// Clear the default translucent background
popup.setBackgroundDrawable(new BitmapDrawable());
// Displaying the popup at the specified location, + offsets.
popup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x + OFFSET_X,
p.y + OFFSET_Y);
// Getting a reference to Close button, and close the popup when
clicked.
// Button close = (Button) layout.findViewById(R.id.close);
/* close.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popup.dismiss();
}
});*/
}
}

Using file_put_contents on android with php server writes a file, but a Windows user using a USB cable to the device cant see it

Using file_put_contents on android with php server writes a file, but a
Windows user using a USB cable to the device cant see it

I'm using a web server with PHP on my android device, and it works great.
I have a form that ultimately ends up in a file after I write it with
file_put_contents.
The thing is that if I use a file manager on the device, I can see the
file, but not if I try to access it in Windows explorer using a USB cable
to the device. And if I copy the file in said file manager to the same
folder, but to another name, I can see the file using a USB cable in
Windows explorer.
I would like a smooth way of accessing this file from a Windows PC without
using SSH servers (which works. If i ssh to the device I can see it and
copy it) or using a file manager on my Android device to copy it to my PC
(which also works since I can just set some folder shared in Windows).
All files should have atleast read-rights on them, and they're being
written in a folder that's on the sdcard on the device (hence its a
fat-system = not chmoddable?). The device isn't rooted, and I'd like if it
stayed that way (but it might actually be this I need to do to fix it?)
If I list the files it says that all file owners are root, even if its a
file that's been created in Windows and copied to my document root with
Windows explorer (those files are always visible by Windows explorer, it's
just the files created by file_put_contents that doesn't show up). If I
try the exact same code on an Windows apache server the files shows up
right as they're supposed to be.
Hope I made myself clear, and I hope someone can point me in the right
direction! :-)

Tuesday, 27 August 2013

Rails complex if

Rails complex if

I wonder what the beautiful way to output this in Rails.
order.items.min.user.email
I want to show the value of email, the only thing I know is order is not
nil, however items and user might be nil.
The only way I see is
if !order.items.empty?
if !order.items.min.user.nil?
if !order.items.min.user.email.nil?
order.items.min.user.email
end
end
end
It looks like not the best way, do you know the better way?

Wordpress Widget - Saving multidimensional arrays into $instance

Wordpress Widget - Saving multidimensional arrays into $instance

In my wp widget, $instance has an attribute called order which will the
listing order of libraries/services. I'd like to store a multidimensional
associative array that will hold the id of each location/service, its type
(i.e. if it's a location or a service), and it's name. I'd like it to look
something like this:
array(
[0] => ( 'id' => 1, 'type' => 'location', 'name' => 'University
Library'),
[1] => ( 'id' => 7, 'type' => 'service', 'name' => 'Circulation
Desk') );
Below is the html markup for the wp widget admin pane and $instance['order']:
<label>
<?php _e( 'Select ordering', 'olh' ); ?>:
</label>
<select
name='select-hours-order'
class='select-hours-order'>
<!-- dynamically populated by jQuery -->
</select>
<a
class='add-location-service'>
<i>+</i>
</a>
<ul
name='<?php echo $this->get_field_name( 'order' ) ?>[]'
id='<?php echo $this->get_field_id( 'order' ) ?>'
class='location-service-order' >
<?php
foreach ($instance['order'] as $order ) : ?>
<li
class="<?php echo $order['class'] ?>"
value="<?php echo $order['value'] ?>">
<?php echo $order['name'] ?>
</li>
<?php endforeach; ?>
</ul>
The user can choose what locations/services s/he wants to display with a
multi-select dropdown. Whenever the user selects a library/service, it
automatically populates select.select-hours-order. The user can then click
the + button of a.add-location-service to add it to
ul.location-service-order.
From there, I'd like to save the lis of ul.location-service-order with the
attributes I specified above.
Thank you gals/guys for any and all info.

TextWriterTraceListener : can I reset/clear the output log via app.config?

TextWriterTraceListener : can I reset/clear the output log via app.config?

I have looked at the properties of the TextWriterTraceListner class and it
parents and dont' see a way to add a propery to the app.config so that the
log file is reset/cleared when the TraceWriter opens the file.

Keeping coustum style of ListBoxItem when selected

Keeping coustum style of ListBoxItem when selected

I have a ListBox where the background color of the items are bound to some
property of the entry:
<ListBox ItemsSource="{Binding ObservableCollectionOfFoos}" >
<ListBox.ItemContainerStyle >
<Style TargetType="ListBoxItem" >
<Setter Property="Content" Value="{Binding SomePropertyOfFoo}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding AnotherPropertyOfFoo}"
Value="true">
<Setter Property="Background" Value="Green" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
This works, but when I mouse over or select an item the background changes
(unsurprisingly perhaps) to the default mouse over / selected color.
I'm new to WPF and I'm not sure I'm going about doing this kind of thing
correctly, I thought maybe I need to use ItemContainerStyleSelector, but
I'm confused as to how to use it, and it seems silly to have to create a
class just for this small thing...
What I also thought was to create an IValueConverter from boolean to the
color, and then bind though it without having to use DataTrigger as a
different approach, woud that be more elegant? would that some how help me
with this problem?

Encoding::UndefinedConversionError: U+00A0 from UTF-8 to US-ASCII

Encoding::UndefinedConversionError: U+00A0 from UTF-8 to US-ASCII

I'm trying to scrap the 52 between the anchor links:
<div class="zg_usedPrice">
<a href="http://rads.stackoverflow.com/amzn/click/B000O3GCFU">52&nbsp;new</a>
</div>
With this code:
def self.parse_products
product_hash = {}
product = @data.css('#zg_centerListWrapper')
product.css('.zg_itemImmersion').each do | product |
product_name = product.css('.zg_title a').text
product_used_price_status = product.css('.zg_usedPrice >
a').text[/(\D+)/]
product_hash[:product] ||= []
product_hash[:product] << { :name => product_name,
:used_status =>
product_used_price_status }
end
product_hash
end
But I think the
http://www.amazon.com/gp/offer-listing/B000O3GCFU/ref=zg_bs_baby-products_price?ie=UTF8&condition=new
part in the URL is producing the following error:
Encoding::UndefinedConversionError:
U+00A0 from UTF-8 to US-ASCII
# ./parser_spec.rb:175:in `block (2 levels) in <top (required)>'
I tried what they suggested in this question. But I'm still getting the
same problem. Is there any workaround for that?
EDIT:
Full error trace:
1) Product (Baby) should return correct keys
Failure/Error: expect(product_hash[:product]["Pet Supplies"].keys).to
eq(["Birds", "Cats", "Dogs", "Fish & Aquatic Pets", "Horses",
"Insects", "Reptiles & Amphibians", "Small Animals"])
TypeError:
can't convert String into Integer
# ./parser_spec.rb:179:in `[]'
# ./parser_spec.rb:179:in `block (2 levels) in <top (required)>'
2) Product (Baby) should return correct values
Failure/Error: expect(product_hash[:product]["Pet
Supplies"].values).to eq([16281, 245512, 513926, 46811, 14805, 364,
5816, 19769])
TypeError:
can't convert String into Integer
# ./parser_spec.rb:183:in `[]'
# ./parser_spec.rb:183:in `block (2 levels) in <top (required)>'
3) Product (Baby) should return correct hash
Failure/Error: expect(product_hash[:product]).to eq({"Pet
Supplies"=>{"Birds"=>16281, "Cats"=>245512, "Dogs"=>513926, "Fish &
Aquatic Pets"=>46811, "Horses"=>14805, "Insects"=>364, "Reptiles &
Amphibians"=>5816, "Small Animals"=>19769}})
Encoding::UndefinedConversionError:
U+00A0 from UTF-8 to US-ASCII
# ./parser_spec.rb:187:in `block (2 levels) in <top (required)>'

Monday, 26 August 2013

Why is this autolayout specification not sufficient?

Why is this autolayout specification not sufficient?

I am trying to get rid of those annoying warnings in Interface Builder,
but I do not understand what it is complaining about (all Interface
Builder, no code):

I have specified a fixed with, fixed height and fixed distances to right
and top.
Yet the warning tells me
Needs Constraints for: Y position, height
Needs Constraints for: X position, width
Can someone please explain how these are constraints are not sufficient?
Edit
Also, when using the "automatic" add constraints commands, it does nothing
and the errors remain.

Nginx serving php as text (want to serve html, not php)

Nginx serving php as text (want to serve html, not php)

Here is my basic config:
server {
server_name mysite.dev;
root location/of/my/html;
location / {
index index.html;
try_files $uri $uri/ =404;
}
}
Yet when I browse to mysite.dev I receive text for a php file:
<?php
if(!defined('APPLICATION_ENV')) {
define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?
getenv('APPLICATION_ENV') : 'production'));
}
define('ROOT_PATH', realpath(dirname(__FILE__)));
define('LIBRARY_PATH', ROOT_PATH . '/library');
.....etc
Here's the thing, I don't even want to serve PHP at all. I just want to
serve the files as they are, no server-side processing.

How to tune search argument in WP_Query to show only exactly the same results?

How to tune search argument in WP_Query to show only exactly the same
results?

Right now I am using this:
$args_search = array(
's' => $search,
'post_type' => array( 'post' )
);
$wp_query = new WP_Query( $args_search );
But the problem is that it shows everything.
E.g. if $search is just "2386" and I have in my db 3 posts:
"12386111" "23861111" "11112386"
I will get 3 results.
But I want to get 0 results. because it's not a full match.
Only if the search is 23861111 then I need to get the 1 result 23861111.
Or when it is 11112386 I need to type the full 11112386 as a $search
variable and not only 2386 or 238 to get the result 11112386
How to change my query to get the results as I want instead of everything
that contains the search string?

Copy data from table of one server to another

Copy data from table of one server to another

How to insert data from table1 in Server1 to table1 in Server2?
I found below code but doesn't work because can't set sqlconnection for
both servers
insert into Server1.tabe1 select * from Server2.table1

Sunday, 25 August 2013

Calculating homology of a Klein bottle (Using only axioms)

Calculating homology of a Klein bottle (Using only axioms)

so let K be the Klein Bottle. I am perfectly aware how to calculate it for
singular homology, using some properties of chains, and an explicit
description of the differential. This is not my problem.
Let us take a (unreduced) homology theory and suppose that we have that
$$h_n(S^1,\emptyset)=\mathbb{Z}$$ if $n=0,1$ and otherwise $0$. I want to
calculate the homology of the Klein Bottle using only this fact, and that
the functors $h_n$ satisfy the Eilenberg–Steenrod axioms. On page 109 of
Switzer's book on Algebraic Topology, he shows how this can be done. The
idea is to cut the klein bottle $K$ into two cylinders $A,B$ and that $A
\cap B \cong S^1 \amalg S^1$ and use Mayer-Vietoris: $$\cdots \rightarrow
h_n(A \cap B, \emptyset) \xrightarrow{\alpha} h_n(A,\emptyset) \oplus
h_n(B, \emptyset) \xrightarrow{\beta} h_n(K, \emptyset)
\xrightarrow{\Delta'} \cdots$$ and that $h_n(A\cap B, \emptyset) =
\mathbb{Z} \oplus \mathbb{Z}$, $h_n(A,\emptyset) =\mathbb{Z}$,
$h_n(B,\emptyset) = \mathbb{Z}$. One can show that the map $\beta$ is
represented by a matrix $$\pmatrix{1 & 1 \\ 1 & v'_\ast}$$ where $v':S^1
\rightarrow S^1$ is the map reversing the orientation. Switzer then states
that, $v_\ast:H^1(S^1,\emptyset) \rightarrow H^1(S^1,\emptyset)$ is $-1$
and $H^0(S^1,\emptyset) \rightarrow H^0(S^1,\emptyset)$ is $1$. Now here
is my question (finally): How can we determine the sign of the map? It is
easy to see that the map is either $\pm 1$, but the sign is more
mysterious...

posting multiple objects in an ajax call

posting multiple objects in an ajax call

I have a list of data which is within multiple objects
each object has an ID and a status and then the main object has a type and
a form id
the problem i am having is posting result via ajax as it doesnt like the
multiple objects.
this is the code i have
var permissionsData = [];
$(".workflowBox").each(function(index, element) {
var obj = {
status: $(this).attr("data-user-status"),
record:$(this).attr("data-user-id")
};
permissionsData.push(obj);
});
permissionsData.userGroupID = userGroupID;
permissionsData.formID = formID;
var posting = $.ajax({
url: "http://www.test.com",
method: 'post',
data: permissionsData
});
How can I wrap/send permission data?
Thanks

[ Other - Business & Finance ] Open Question : Dtdc courier tracking?

[ Other - Business & Finance ] Open Question : Dtdc courier tracking?

For tracking courier status visit www.easytrackstatus.blogspot.in

respectful owners ? Is that right?

respectful owners ? Is that right?

I am reading on many many websites or videos something like:
"All rights goes to their respectful owners"
"Jack and other characters mention are property of Dreamworks and
respectful owners"
"All characters are copyright to their respectful owners All characters
are copyright to their respectful owners "
"All Photos belong to their respectful owners and are being used..."
I am puzzled. Should it not be "respective owners" ?
Well I am sure there should be owners who "show respect", but I am
suspecting they are just misspelling a word in this context. Is that wrong
?

Saturday, 24 August 2013

Creating-organizing my solution ASP MVC, merging from mvc and web site project

Creating-organizing my solution ASP MVC, merging from mvc and web site
project

I've been asked to consolidate multiple projects / types / HTML websites,
MVC under one solution
The issue is the project/sln types vary from ASP MVC 2, 3, 4 to HTML +
javascript websites. Details after summarizing the question below -
Question: How can I
Organize everything under one solution
Can I have a mix and match between web sites project types, and ASP MVC
project types?
What is recommended best practise (I'm leaning towards ASP MVC projects
across the board)
Is there an auto convert in VS 2012 from Html web sites projects type to
ASP MVC projects type?
How can I get membership [already implemented in one project] to
cover/protect the new projects], is this configuration or something
simpler. I.e. I need the membership to spill over and provide coverage to
the HTML projects, will it do this?
Or should I should I put everything in the same project, the functional
features are different, one does BI work, and the other HTML does web form
generation.
Details of project type:
HTML + Jquery UI + underscore, require + backbone projects [could use some
help in how this should be organized inside MVC]
ASP MVC projects with simple membership

foreach issue with if/else retrieving xml data

foreach issue with if/else retrieving xml data

I've been looking for answers to my problem on SW but no luck so far..so
here it goes. I'm writing a form where the user can search for items that
are written in a xml file on the server...the search function works pretty
well; the form sends the values to a php file and using simplexml it
retrieves the data from the xml file using a foreach with an if/else
statement. However, when there is no item found on the xml file, that's
where the issue comes.
Here's my php:
<?php
$zip = $_POST['zip'];
$id = $_POST['id'];
$xml = simplexml_load_file("lista.xml");
foreach ($xml as $entry){
if (($entry->zipCode == $zip) && ($entry->id == $id)){
?>
<p>Id: <?php echo $entry->id;?></p>
<p>Zip: <?php echo $entry->zipCode;?></p>
<p>Item: <?php echo $entry->item;?></p>
<?php
}
else {echo 'nothing found';}
}?>
And this is my xml:
<?xml version="1.0" encoding="utf-8"?>
<entries>
<entry>
<id>id1</id>
<zipCode>zip1</zipCode>
<item>1</item>
</entry>
<entry>
<id>id2</id>
<zipCode>zip2</zipCode>
<item>2</item>
</entry>
<entry>
<id>id3</id>
<zipCode>zip3</zipCode>
<item>3</item>
</entry>
</entries>
The issue is that instead of showing 'nothing found' just once if there is
no item within the whole xml file, it shows 'nothing found' in every entry
that does not have the search query on it. So, for instance, if $zip =
zip4 and $id = id4 the answer is:
nothing found
nothing found
nothing found
instead of just one 'nothing found'
What's the correct way of writing that piece of code?? Thanks everyone in
advance!!!

Prove that this covering map is a homeomorphism

Prove that this covering map is a homeomorphism

Let $p \colon E \to X$ be a covering map. Let $s \colon X \to E$ be
continuous. If $p \circ s = \operatorname{id}_{X}$, show that $p$ is a
homeomorphism.
We know that $p$ is a continuous surjection. Since all covering maps are
open, we just need to show that $p$ is an injection. How is this done?

Email security on an iPhone

Email security on an iPhone

I've started taking security more seriously lately (Why only now you may
ask? Because I'm a trusting fool that's why.) and I've now got emails
signing automatically and encrypting where I have their key.
Previously I only did this when necessary, but I'm trying to breed a sense
of change around me and taking my own medicine seems sensible. I have no
issue with GPG in Thunderbird, Outlook, or on Android with K9 Mail & APG,
but I have no idea how to handle GPG on IOS.
I can't accept there's no way, it seems ridiculous, or maybe I'm
approaching the problem wrong and there is a more appropriate route than
GPG that's better supported?

Dictionary with multiple string values for a key

Dictionary with multiple string values for a key

I need a dictionary that is composed by a lot of keys, and the values must
be a list that contains lots of strings. (in Python) I tried:
d1[key].append(value), but Python says : AttributeError: 'str' object has
no attribute 'append'. I need something like :
{a:[b,c,d,e],b:[t,r,s,z]....} What could I do?
thanks in advance.

{LiveH HErE**} Aston Villa v Liverpool Live Stream Watch Free Online 24 Aug-2013

{LiveH HErE**} Aston Villa v Liverpool Live Stream Watch Free Online 24
Aug-2013

They have also been buoyed by the summer commitment of Christian Benteke
to a new contract, and the powerful Belgian forward has burst out of the
blocks by netting three times in his two outings so far.
Liverpool will be hoping that someone within their ranks steps up to the
scoring plate in the continued absence of Luis Suarez through suspension,
with Daniel Sturridge seemingly the most likely candidate.
The England international struck the Reds' winner as they edged out Stoke
City 1-0 at Anfield in their first fixture of the new campaign.
Brendan Rodgers is eager to see his side force their way back into
top-four contention this term, and he will know that any side harbouring
UEFA Champions League aspirations will need to collect points consistently
on their travels - and Liverpool have emerged victorious in nine of their
last 15 visits to Villa Park, losing just once.
http://tinyurl.com/l84xfdb http://tinyurl.com/l84xfdb
Aston Villa should have defender Ciaran Clark available on Saturday.
Clark was forced off in the first half of the 2-1 loss at Chelsea on
Wednesday with a head injury but is expected to be fit for the Reds' visit
to Villa Park, while midfielder Chris Herd could be in contention for a
first appearance this term following his calf problem.
Defender Nathan Baker (ankle) remains a doubt and winger Charles N'Zogbia
(Achilles) definitely misses out.

Bind all params automatically

Bind all params automatically

If i do a SELECT * FROM xxx is there a way to bind all recieved rows
automatically?
Since it's not that useful if i do a * but need to bind the params
manually anyways.

Divisors of $q^kp^r$

Divisors of $q^kp^r$

This is a generalization of my previous problem. Let $p$ and $q$ be prime
numbers. What is the necessary and sufficient condition (in terms of $p,q$
and $k,r$) such that we can partition the divisors of $q^kp^r$ into two
sets with equal sum ?
For $p \not = q=2$ it is proved that $r$ must be odd and $q^{k+1} > p$.
See Here

Friday, 23 August 2013

How can I prevent /etc/default/keyboard from overriding my xorg xkb configurations?

How can I prevent /etc/default/keyboard from overriding my xorg xkb
configurations?

I have the following file at /etc/X11/xorg.conf.d/11-TECK-keymap.conf
Section "InputClass"
Identifier "TECK"
Driver "evdev"
# If you save this file under xorg.conf.d/ :
Option "AutoServerLayout" "on"
MatchIsKeyboard "on"
MatchProduct "TrulyErgonomic.com Truly Ergonomic Computer Keyboard"
### at-home-modifier options begin here.
# The basic option.
Option "XkbLayout" "us"
Option "XkbVariant" "altgr-intl"
Option "XKbOptions" "lv3:ralt_switch_multikey,numpad:pc,ctrl:swapcaps"
Option "TransMod" "36:64"
EndSection
I know that MatchProduct is correct, as Option "TransMod" (the
at-home-modifier option) works on this specific keyboard. However, the Xkb
lines don't work, unless I comment out the MatchProduct line.
I've found that (with MatchProduct present) the Xkb lines are being
overwritten by /etc/default/keyboard. I've tried deleting this file, and
commenting it out, but I still cannot get the xorg xkb options to stick.
(P.S. I'm using KDE, but "Configure layouts" and "Configure keyboard
options" are unchecked in System Settings.)

Create record and INSERT INTO with Constant field & Variable field data

Create record and INSERT INTO with Constant field & Variable field data

Within VBA, in Access 2003, I need to
Create a record in TableA with a new AutoNumber as the primary key (AID)
and the current date
Create several records in TableC which associate AID from the new record
in TableA with multiple foreign keys (BID) from TableB, as selected by
QueryB.
So if QueryB returns records from TableB with BIDs 2,5,7,8, I would then
like to create a record in TableA with AID = 1 and Date = 8/23/13
and then make TableC appear thusly:
AID, BID
1, 2
1, 5
1, 7
1, 8
How do I do this? I'm pretty sure I can write an SQL string to do the
first thing like so:
INSERT INTO TableA (Date)
VALUES Date()
but I'm not sure how to describe that I want to use the new record, (in
this case, AID = 1) to be the constant that all the QueryB records are
associated with.

ImageBox and HttpWebRequest

ImageBox and HttpWebRequest

a have some problem. I am totally new at C#, so I have very silly problem.
I want to use ImageBox to show user captcha image. I know how to set
typical img from url. But I need to add captcha which need cookies.
Exactly i say about this: https://konto.interia.pl/poczta/nowe-konto. I
don't know how can i hold cookie from this server, which i can use later
to display captcha, and after that send special response to create an
account. Have you any ideas how can i do that? Thanks for all help1

Array won't refresh itself after removeChild

Array won't refresh itself after removeChild

There is an array of objects. I'm trying to removeChild an object from
that array like below. removeChild works fine but the array won't refresh
itself after removing uppest object. As you can see in below, i tried to
trace array items out.
Firstly, array has three items, obviously the myArray.length must be 3.
After removing a child, myArray.length must be 2, but it get 3 (Wrong).
removeChild(myArray[currShape]);
trace(myArray);
Please tell me what am i missing here.

Strongly typed list return from View to fill Model?

Strongly typed list return from View to fill Model?

I'm attempting to pass data around and am having an issue doing it with
strongly typed data.
The over all goal is this:
Index: List of check boxes of all employees. Groups in a table, seperated
by working address (easily doable via foreach(string address) +
foreach(Employee e where e.Where(address) kind of magic.
Details of the report. This part should display the list of users
selected, ask for some hours and a title. Simple enough.
Finalize and display. This part should insert the data in to a database
and render a pdf.
Here is the Class of which I expect data of an employee to be in. I
removed methods in there for the sake of making this shorter:
public class IndexModel
{
public List<EmployeeForList> Employees { get; set; }
public class EmployeeForList
{
public bool IsChecked { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int EmployeeId { get; set; }
public string Building { get; set; }
public EmployeeForList()
{
}
public EmployeeForList(TXEP.InfoWeb employee)
{
this.FirstName = employee.FirstName;
this.IsChecked = false;
this.LastName = employee.LastName;
this.Building = employee.BuildingAddress;
this.EmployeeId = employee.EmployeeId;
}
}
}
Here is the view code:
@using (@Html.BeginForm("TrainingDetail", "Home", FormMethod.Post))
{
<table border="1">
@foreach (string building in Model.GetUniqueBuildings())
{
<tr>
@foreach (var employee in Model.GetEmployeesFromBuilding(building))
{
<td>
@Html.CheckBoxFor(model =>
@Model.GetEmployee(employee).IsChecked)
@Html.HiddenFor(model =>
@Model.GetEmployee(employee).LastName)
@Html.HiddenFor(model =>
@Model.GetEmployee(employee).FirstName)
@Html.HiddenFor(model =>
@Model.GetEmployee(employee).EmployeeId)
@Html.HiddenFor(model =>
@Model.GetEmployee(employee).Building)
@employee.LastName, @employee.FirstName
</td>
}
</tr>
}
</table>
<input type="submit" value="sub" />
}
I'm expecting it to return the model above. Instead it return an empty
list of Employee's. I'm sure I'm missing something silly but I can't
understand what.
The Controller on the receiving end looks like:
public ActionResult TrainingDetail(Models.IndexModel indexModel)
{
if (indexModel.Employees == null)
{
ViewBag.Message = "EMPTY FOO";
return View();
}
int count = indexModel.Employees.Where(x => x.IsChecked ==
true).Count();
ViewBag.Message = count.ToString();
return View();
}
What I suspect I'm failing to grasp is how can I create an Employee in the
View such that it populates a strongly typed list. Or am I
misunderstanding the concepts entirely?
It seems to revolve entirely around being a list as I can pass simple data
easily -- but this list is empty when I get it, however my Google-fu is
failing me and so I beseech you, my fellow brethren, for help.

What are the best plugin architectures?

What are the best plugin architectures?

I want to add plugin capability to a (big, complex) java server, because
some customer want to develop extra modules. It uses OSGi, but it's too
complex for customer's developers. What options do I have? What are the
best plugin architectures?
UPDATE: I want to compare the plugin architectures, to know the advantages
and disadvantages and get ideas to my implementation. Maybe it should use
the OSGi, but with some "wrap" to make it easy to develop a plugin.

Thursday, 22 August 2013

How to start windows service through VB Script?

How to start windows service through VB Script?

How to start windows service through VB Script?
I tried following code to start Mysql service
test.vbs:
service="bthserv"
Set wmi = GetObject("winmgmts://./root/cimv2")
qry = "SELECT * FROM Win32_Service WHERE Name='" & service & "'"
For Each s In wmi.ExecQuery(qry)
s.StartService
Next
But this code not starts the mysql service.

What are famous sights in Shanghai?

What are famous sights in Shanghai?

Can you introduce some interests in Shanghai,such as Jing'an Temple,
Longhua Temple, Lu Xun Park, Gongqing Forest Park,and some places for
shopping, not too much, not more than 50 words, Thank you ~

What could cause Mailman to drop messages after moderator approval?

What could cause Mailman to drop messages after moderator approval?

I run a medium-sized Mailman system that recently developed a problem
where any messages that pass through moderation disappear instead of being
delivered to the mailing list. This is affecting every one of our mailing
lists.
Moderation fails when performed on a separate webserver
The Mailman environment is split across two servers, front-end and
back-end. The back-end server handles Postfix and the Mailman qrunners,
while the front-end server hosts Apache and the Mailman CGI scripts for
moderating lists. The two servers share an NFS mount between them that
includes all the shared Mailman data.
All normaly mail flow is working correctly, but when a list moderator logs
into the web frontend and approves a message, it disappears without a
trace.
Postfix smtpd receives the incoming message over SMTP, then
Postfix smtpd delivers the message to /usr/lib/mailman/mail/mailman.
Mailman marks writes to vette logfile (backend server) that message is
held for approval.
List moderator uses CGI web interface to mark the message as approved.
Mailman writes an entry to vette logfile (on frontend server) saying held
message approved.
At this point, the .pck file related to the held message disappears, but
nothing is delivered, and no further log entries are created.
Moderation succeeds with web interface on the main Mailman server
Although we don't normally run the Mailman web interface on the back-end
server (to reduce attack surface), I got it running for testing purposes.
When we use the Mailman web interface on the backend server, the message
gets delivered normally and we see these log entries.
smtp logfile updated with number of recipients and time for completion
post logfile updated with list name, message ID, and "success".
Background
The problem started after migrating the Mailman environment to new
servers. It didn't crop up on it's own, it's most likely a result of some
configuration error that we haven't caught yet. We're using:
Scientific Linux 6.3 on both servers
Python 2.6.6 on both servers
Mailman 2.1.12 installed from OS packages on both servers
selinux in Permissive mode on backend server
selinux in Enforcing mode on frontend (web) server, but no log entries
with type=AVC are being recorded. Furthermore, using setenforce 0 doesn't
fix the problem.
I found one related post on the Mailman users list, but no solution was
provided.

error in IE while closing. it gives error

error in IE while closing. it gives error

When I close my IE I got below error "an exception occurred while trying
to run c:\windows\system32\inetcpl.cpl" I tried to re install IE but still
error persist.Please help me

SQL code unable to display attendance in percentage format

SQL code unable to display attendance in percentage format

I am having trouble adding the condition to only show those with
attendance less than 81..
Select Absence.StudentID as StudentNumber,
Student.Name as "Student Name",
Subject.Name as "Subject Name",
CONVERT (varchar, 100-(100 * count(*) /10)) as 'Attendance(%)'
FROM Absence,Subject,Student,
(SELECT COUNT(*) as tot FROM Absence) x
WHERE Subject.SubjectCode=Absence.SubjectCode AND
Student.StudentNumber=Absence.StudentID
GROUP BY Absence.StudentID,Subject.Name,Student.Name;
The above is the code that displays exactly what I want but I cannot add
in the condition only. My Attendance(%) is already int right? So using the
CAST or CONVERT does not work either. It says it has trouble converting.
Your kind assistance will be greatly appreciated.

Where can I see code for the C++ String function c_str

Where can I see code for the C++ String function c_str

I want to see the code of c_str function in c++.
How can I see that-->
(1) In Intel Compiler (2) IN Visual Studio 2012 Compiler (3) In GCC/MinGW.

implementation of genetic algorithm for spell checker

implementation of genetic algorithm for spell checker

I want to implement the spell checker which will checks the spelling in a
text file and outputs the errors and corrections. I want to create this
using python.
But, the main thing is I want to implement that with using genetic
algorithm. How can I implement the genetic algorithm for spell checker?

Wednesday, 21 August 2013

How to set ArrayAdapter to Listview - Android

How to set ArrayAdapter to Listview - Android

I have a class that extends ArrayAdapter . I can not set the ListAdapter
to my ListView because I don't know what the code should be when I try to
create the ListAdapter. Here is my current code.
class Item {
String username;
String number;
String content;
}
class ListAdapter extends ArrayAdapter<Item> {
public ListAdapter(Context context, int textViewResourceId) {
super(context, textViewResourceId);
// TODO Auto-generated constructor stub
}
private List<Item> items;
public ListAdapter(Context context, int resource,
List<Item> items) {
super(context, resource, items);
this.items = items;
}
@Override
public View getView(int position, View convertView,
ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi;
vi = LayoutInflater.from(getContext());
v = vi.inflate(R.layout.list_item, null);
}
Item p = items.get(position);
if (p != null) {
TextView tt = (TextView) v.findViewById(R.id.id);
TextView tt1 = (TextView)
v.findViewById(R.id.categoryId);
TextView tt3 = (TextView)
v.findViewById(R.id.description);
if (tt != null) {
tt.setText(p.getId());
}
if (tt1 != null) {
tt1.setText(p.getCategory().getId());
}
if (tt3 != null) {
tt3.setText(p.getDescription());
}
}
return v;
}
}
Here is where I get the problem, trying to declare the ListAdapter
ListView yourListView = (ListView)
findViewById(android.R.id.list);
// Here is the problem
ListAdapter customAdapter = new ListAdapter(this,
R.layout.list_item, List<Item> //I get an error right
here);
yourListView .setAdapter(customAdapter);

Open a binary file using vi and hexedit, why are the contens different?

Open a binary file using vi and hexedit, why are the contens different?

I'm trying to edit a binary file directly and I know two editors, vi and
hexedit. But when I open a binary file separately using them, the cotens
are different. Below is what I did.
First I use "dd if=/dev/sda of=mbr bs=512 count=1" to generate the binary
file, which contains the mbr data. Then I open it using "hexedit mbr", and
it displays this: beginning:
00000000 EB 63 90 D0 BC 00 7C 8E C0 8E D8 BE 00 7C BF 00
00000010 06 B9 00 02 FC F3 A4 50 68 1C 06 CB FB B9 04 00
00000020 BD BE 07 80 7E 00 00 7C 0B 0F 85 0E 01 83 C5 10
ending:
000001E0 FF FF 83 FE FF FF 00 40 D6 02 00 38 2B 01 00 00
000001F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA
I using "vi mbr" open it and type":%!xxd", it displays this: beginning:
0000000: c3ab 63c2 90c3 90c2 bc00 7cc2 8ec3 80c2
0000010: 8ec3 98c2 be00 7cc2 bf00 06c2 b900 02c3
0000020: bcc3 b3c2 a450 681c 06c3 8bc3 bbc2 b904
ending:
00002b0: bfc3 bf00 40c3 9602 0038 2b01 0000 0000
00002c0: 0000 0000 0000 0000 0000 0000 55c2 aa0a
The hexedit displaying is what I expect in mbr. But what to say with vi
displaying? Also the vi displaying seems wrong because there are more than
512 bytes.
Thank you for any explainations!

How to find the input element in my html markup

How to find the input element in my html markup

I am trying to use regular expression to find if the variable contains an
input field.
My html in my variable could be something like this.
<span>test here</span>
or
<span><input tyep="text"></span>
My codes are like
//$(this) is be my variable
if($(this).html().match("/<input type='text'>/")){
console.log('match found')
}
It doesn't seem to be able to find the match. Can anyone help me about it?
thanks a lot!

how to get the time from bootstrap formhelper timepicker

how to get the time from bootstrap formhelper timepicker

I put in a bootstrap formhelper timepicker inside my webapp however, I am
having hardtime getting the time value from it
how to get the timevalue from bootstrap timepicker?
just doing data.time=$("#fromTimeText").val(); doesnt seem to work
http://vincentlamanna.com/BootstrapFormHelpers/timepicker.html
<div class="ltrClass bfh-timepicker" id="fromTimeText"
style="text-align:center;">
<div class="bfh-timepicker-toggle rtlClass " id="pickupTime"
data-toggle="bfh-timepicker">
<label for ="fromTimeText"></label>
<input type="text" id="fromTimeText" class="centralize" readonly>
<i class="icon-time"></i>
</div>
<div class="bfh-timepicker-popover" >
<table class="table">
<tbody>
<tr><td class="hour"><a class="next" href="#"><i
class="icon-chevron-up"></i></a><br>
<input type="text" class="input-mini" readonly><br>
<a class="previous" href="#"><i class="icon-chevron-down"></i></a></td>
<td class="separator">:</td>
<td class="minute">
<a class="next" href="#"><i class="icon-chevron-up"></i></a><br>
<input type="text" class="input-mini" readonly><br>
<a class="previous" href="#"><i class="icon-chevron-down"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>

Spacing between label and input box

Spacing between label and input box

index.php
<div class="detail">
<?php echo Form::label("first_name", "First Name"); ?>
<?php echo Form::input("first_name", $userdetails->first_name); ?>
</div>
I am getting the output in the below format mentioned in image,i want some
space between first name and input box.What css property i should apply.

Google App Engine not reading my environment variables

Google App Engine not reading my environment variables

I'm trying to set up GAE but dev_appservery.py exits with the following
message
Traceback (most recent call last):
File "C:\google_appengine\dev_appserver.py", line 184, in <module>
_run_file(__file__, globals())
File "C:\google_appengine\dev_appserver.py", line 180, in _run_file
execfile(script_path, globals_)
File
"C:\google_appengine\google\appengine\tools\devappserver2\devappserver2.py",
line 727, in <module>
main()
File
"C:\google_appengine\google\appengine\tools\devappserver2\devappserver2.py",
line 720, in main
dev_server.start(options)
File
"C:\google_appengine\google\appengine\tools\devappserver2\devappserver2.py",
line 695, in start
self._dispatcher.start(apis.port, request_data)
File
"C:\google_appengine\google\appengine\tools\devappserver2\dispatcher.py",
line 160, in start
_module, port = self._create_module(module_configuration, port)
File
"C:\google_appengine\google\appengine\tools\devappserver2\dispatcher.py",
line 230, in _create_module
_module = module.AutoScalingModule(*module_args)
File
"C:\google_appengine\google\appengine\tools\devappserver2\module.py",
line 913, in __init__
allow_skipped_files)
File
"C:\google_appengine\google\appengine\tools\devappserver2\module.py",
line 418, in __init__
self._module_configuration)
File
"C:\google_appengine\google\appengine\tools\devappserver2\module.py",
line 176, in _create_instance_facto
module_configuration=module_configuration)
File
"C:\google_appengine\google\appengine\tools\devappserver2\go_runtime.py",
line 104, in __init__
self._module_configuration)
File
"C:\google_appengine\google\appengine\tools\devappserver2\go_application.py",
line 69, in __init__
self._arch = self._get_architecture()
File
"C:\google_appengine\google\appengine\tools\devappserver2\go_application.py",
line 94, in _get_architectu
for platform in os.listdir(os.path.join(_GOROOT, 'pkg', 'tool')):
WindowsError: [Error 3] The system cannot find the path specified:
'C:\\google_appengine\\goroot\\pkg\\tool/*.*'
I have GOROOT set to C:\Go in my environment variables and in my PATH I
have C:\Go\bin
Why is GAE just not reading those values and how can I fix this?
I'm using GAE 1.8.3, Python 2.7.5 and Go 1.1.2.

Three.js Curve Path Animation

Three.js Curve Path Animation

I am Developing a webgl based game using three.js, however I couldn't find
anything regarding curve path animation. What I want is to create
obstacles in my game which comes in the path of the actor and he has to
dodge the obstacles that is coming. I want this obstacle to follow and
repeat the curve path motion, like a sphere following this curve path.
How do I create such animation ?

Tuesday, 20 August 2013

Gradient Color to CGPath

Gradient Color to CGPath

I am drawing shape using CGPath and after drawing it,adding to
CAShapeLayer.I am getting frame using CGPathGetPathBoundingBox()(this
frame will set to CAShapeLayer) but it is in rectangle form while my path
is in different form.So when i am trying to give gradient colour ,it is
showing too much gradient in some portion of path and in some portion you
cant see anything.basically gradient color is setting on frame of
CAShapeLayer.So is there any way to set gradient color to CGPath?Please
help me.Thanking you.Hint will also be appreciated.

busybox initramfs loop mount

busybox initramfs loop mount

I'm trying to loop mount my root filesystem (a loop file) within a busybox
initramfs.
I try to run the command:
mount /rootfs.raw /root
... which works on my Ubuntu laptop, however, I simply get
mount: mounting /dev/loop0 on /root failed: Invalid argument
No matter what combination of options I use, (including loading to /loop0
manually and trying to mount it), the system will not mount the loop
device.
Why can't I mount it?

How to activate the dropdown menu of the select element via keyboard?

How to activate the dropdown menu of the select element via keyboard?

I have a select element in my HTML:
<select id="dropdown">
<option value="1">First</option>
<option value="2">Second</option>
</select>
It renders as a drop-down menu, which, when the user clicks it,
(surprise!) drops down. In order for the page to be used via keyboard
only, I wish to make it so that the menu drops down when the user presses
a key.
$('body').keypress(function(event) {
var key = String.fromCharCode(event.which);
if (key == 'a') {
$('#dropdown').doSomething(); // ?
}
});
The best I've found is to invoke focus(). It allows to select the value
via keyboard, but it doesn't drop down the menu. Is there a way to make
the menu drop down?

This is an invalid webresource WebResource.axd missing - Html.Editor

This is an invalid webresource WebResource.axd missing - Html.Editor

In my asp.net webform application I have a problem with Ajax HTML.Editor
control. On the content page, within the update panel, I have 3
HTML.Editor control. When I open the page Firebug records error on line
/ / START HTMLEditor.DesignPanel.js
Type.registerNamespace ("Sys.Extended.UI.HTMLEditor") ...
/ / END HTMLEditor.DesignPanel.js
On the local computer this error does not create problems and applications
behave normally. On a production server, this error makes real big
problems. Occasionally during postback it throws the user session. Elmah
catches error: System.Web.HttpException: This is an invalid webresource
request.
Relating to:
/WebResource.axd?d=o2UO8Ba564lfuU5QBNIFonwI6LzaKfPl-6oTFth2MMUjED9lYqkPs29E7nw_eLFNKT63yrJ1Mxs3mO62IDGiyP3q5_pCSeLWItuaj2vnFb3IX00Y6PRxv6IXZaLwDC_7xo-iCwiDbmuwpnnnYFqDVWgvuiB5iz1jPYg3RkSXF6A1&t=635125941825518770
On the local computer Elmah not catch any errors of this type.
I found a link to
http://blogs.telerik.com/blogs/07-03-27/debugging-asp-net-2-0-web-resources-decrypting-the-url-and-getting-the-resource-name.aspx
from where I downloaded WebResources.aspx page, which I copied to root of
web app, on the production server, and then should be able to decrypt the
above / WebResource.axd? D = o2UO .... in the name of the missing
resource. But trying on a variety of different ways always get: Error
decrypting data. Are you running your page on the same server and inside
the same application as the web resource URL that was generated?
Among other things, I found that there was an error with the latest
version AjaxToolkit concerning Html.Editor and proposed to version -
January 2013 release, which I took from
http://ajaxcontroltoolkit.codeplex.com/releases/view/100852 This reduced
the frequency of errors and the application runs more stable, but still
the problem is there.
The application is built on. NET 4.0 Framework. I use ToolkitScriptManager
Within the content pages I registered control
<% @ Register Assembly = "Ajaxcontroltoolkit" Namespace =
"AjaxControlToolkit.HTMLEditor" TagPrefix = "ajaxToolkit"%>
<% @ Register TagPrefix = "ajaxToolkit" Namespace = "Ajaxcontroltoolkit"
Assembly = "Ajaxcontroltoolkit"%>
and in web.config
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" />
<add assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit.HTMLEditor" tagPrefix="ajaxToolkit" />
</ Controls>
I'm running out of ideas what to do in order to fix it.
Do you have any suggestions

WP Help. Backslash at the end of searchword breaks custom search form

WP Help. Backslash at the end of searchword breaks custom search form

Accidentally, I discovered that whenever there is a backslash at the end
of a search, the page after clicking submit will return a broken search
form. In my case, the submit button turned into a text area.
Using google chrome's inspect element I saw that my search form turned
into this:
<form method="get" action="">
<input type="hidden" name="type" value="books">
<input type="text" name="search" value="\"> <input type="&gt;
&lt;/form&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div id=" sidebar"=""
class="sidebar widget-area"></form>
The following code is my form. I am guessing that I need to
sanitize/escape the value from the input type text? But why isn't
esc_attr() working? I am very new at this. Please help. I will extremely
appreciate it!
<form action="" method="get">
<input type="text" name="search" value="<?php echo
esc_attr(stripslashes($_GET['search'])); ?>">
<input type="submit" value="Search">
<input type="checkbox" name="title">
</form>
P.S. I am using this custom search form to search custom fields and
display the resulting custom post types using Pods Plugin. It doesn't
appear that this is a Pods plugin issue though.
https://github.com/pods-framework/pods/issues/1620 Also, this doesn't
appear to be a conflict from another theme or plugin.

Is there a way to stop Windows 7 from minimizing a window with focus when using win+# hotkey

Is there a way to stop Windows 7 from minimizing a window with focus when
using win+# hotkey

Is it possible to have win+{windows number} hotkey not to minimize running
and focused window?
(I have several monitors and use taskbar autohide feature together with
fullscreen applications, so I don't know which window currently has focus.
Pressing win+{currently focused window number} makes that window minimized
and it is really annoying =( )
There is a similar question already - Is there a way to stop Windows 7
from minimizing a window with focus when clicking the taskbar item? but it
solves this problem for mouse clicking only, not for hotkey.

Is it possible to update the itunes without updating Xcode?

Is it possible to update the itunes without updating Xcode?

I am having updates for both itunes and xcode in the App store.

When I click update to itunes, it asks me to close both the itunes and
xcode. I don't want to update xcode.
Is it possible update the itunes without updating Xcode?
What will happen if I click continue on the below image?

Monday, 19 August 2013

How to send email in asp.net C#

How to send email in asp.net C#

I'm very new to ASP.net C# area. I'm planning to send a mail thru asp.net
C# and this is the smtp address from my ISP: smtp-proxy.tm.net.my
Below is what I tried to do but failed.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="SendMail" %>
<html>
<head id="Head1" runat="server"><title>Email Test Page</title></head>
<body>
<form id="form1" runat="server">
Message to: <asp:TextBox ID="txtTo" runat="server" /><br>
Message from: <asp:TextBox ID="txtFrom" runat="server" /><br>
Subject: <asp:TextBox ID="txtSubject" runat="server" /><br>
Message Body:<br>
<asp:TextBox ID="txtBody" runat="server" Height="171px"
TextMode="MultiLine" Width="270px" /><br>
<asp:Button ID="Btn_SendMail" runat="server"
onclick="Btn_SendMail_Click" Text="Send Email" /><br>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
And below is my CodeBehind:
using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
public partial class SendMail : System.Web.UI.Page
{
protected void Btn_SendMail_Click(object sender, EventArgs e)
{
MailMessage mailObj = new MailMessage(
txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
SmtpClient SMTPServer = new SmtpClient("127.0.0.1");
try
{
SMTPServer.Send(mailObj);
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
}
**P/S: I'm sorry that I couldn't understand the receiver/sender SMTP
concept and so I am trying to understand the whole concept from here.

Does W3C allow elements to be display:inline;?

Does W3C allow elements to be display:inline;?

Doing a code review, I noticed that a heading was using <span> tags
instead of headings, so I suggested using an <h4> tag, to gain the
semantic benefits. The context is a website footer, where there are
various lists of links under different headings.
<span>Category 1 Links</span>
<ul>
<li>Link 1 in the footer</li>
<li>Link 2 in the footer</li>
<li>Link 3 in the footer</li>
<li>Link 4 in the footer</li>
<li>Link 5 in the footer</li>
</ul>
The counterargument was that <h4> is a "block-level" element, whereas an
inline element was needed. Therefore he didn't think the element should be
changed. (And yes, he knows CSS and is familiar with the display: inline;
property.)
That sounds absolutely insane to me--goes against everything I always
thought was best practice: separation of content and presentation,
semantic web, the very purposes of HTML and CSS... yet in trying to
formulate a response, I came across this section in the HTML 4.01 spec:
Certain HTML elements that may appear in BODY are said to be "block-level"
while others are "inline" (also known as "text level").
...
Style sheets provide the means to specify the rendering of arbitrary
elements, including whether an element is rendered as block or inline. In
some cases, such as an inline style for list elements, this may be
appropriate, but generally speaking, authors are discouraged from
overriding the conventional interpretation of HTML elements in this way.
The alteration of the traditional presentation idioms for block level and
inline elements also has an impact on the bidirectional text algorithm.
See the section on the effect of style sheets on bidirectionality for more
information.
So here is the question: does this section make the issue sufficiently
vague for there to be valid difference of opinion here, or is it (as I had
thought) pretty clear in one way or the other? If this section is open to
interpretation, are there any other W3C guidelines that are more concrete?
I don't want to get into opinions on this, I just want to make sure I'm
understanding the spec and the W3C guidelines correctly: is there true
ambiguity here, or not?

Remove item from std::list with only having access to the iterator

Remove item from std::list with only having access to the iterator

std::list is a double linked list. Doesn't that mean that it should be
possible to remove an item from a list by only having access to the
iterator?

Spring Data Neo4j does not recognize externally inserted nodes

Spring Data Neo4j does not recognize externally inserted nodes

I am using a small Clojure script which batch-inserts nodes to my Neo4j
instance. To show these nodes, I am using a spring-based webapp with
Spring Data Neo4j. I also created a small domain object which represents
the node.
When I insert a node by utilizing the webapp, it will be loaded and showed
right out of the box. But when I try to load a node which has been
inserted by the external script, it cannot be found. To be compatible, I
thought it is sufficient enough to add the _type_ attribute with the FQN
of the domain class. But it seems to me, that there's more to do.
I am using Neo4j 1.8.2 server and SDN 2.2.2
Can you give me a hint?
Thanks in advance.
Best, Markus

How to reload any slickgrid dataview?

How to reload any slickgrid dataview?

What is the method used to reload any slickgrid dataview?
Is there any methods in slickgrid API to do so?

Sunday, 18 August 2013

Detecting when a weak object reference IsAlive status changes

Detecting when a weak object reference IsAlive status changes

I'm looking for a way to sneak a call back function whenever an object
reference has been garbage collected.
I know I can wrap the object in a weak reference, but I would still have
to poll a collection of references for status change.
I would prefer not to poll as that seems like a waste of CPU cycle when
nothing happens. Is there a more effective method to detect when an object
has been garbage collected?
Note: I do not have access to the object code and hence would not be able
to add the call back in the finalizer.

GNU Assembly Issues on OSX - Referencing Strings

GNU Assembly Issues on OSX - Referencing Strings

I've run into an issue after following this tutorial -
https://www.youtube.com/watch?v=RvvRO_gWYIg
A few noticeable issues is it looks like the processor architecture and
operating system may differ quite heavily from the one I'm working on. In
the video it seems to be an i386 linux box, and I'm working on an x64 OSX
machine.
Posted below is my broken code, and it seems to work when I remove the
string reference, so I'm guessing it has something to do with that.
Any help would be greatly appreciated!
Thanks~
# Hello World Program:
.data
HelloWorldStr:
.ascii "Hello World"
.text
.globl start
start:
# Load all the arguments for write():
# write(output, string, string_size)
movl $4, %eax # Load write()
movl $1, %ebx # Arg Output of write() :: STDOUT
movl $HelloWorldStr, %ecx # Referencing the Memory Loc. of the String
movl $11, %edx # Byte length of the String "Hello World"
int $0x80
# Call Exit:
movl $1, %eax
movl $0, %ebx
int $0x80

match_parent property for children in a RelativeLayout

match_parent property for children in a RelativeLayout

In short, is it possible to tell a child in a RelativeLayout to always
match the height of that RelativeLayout regardless of how other children
in that same RelativeLayout behave? In short, that's it. Details below.
What I'm trying to achieve is a ListView row with at least three views,
and one of those views would be kind of a stripe at the right side of the
list entry (the red view below). The problem I'm having is that there is a
TextView at the left side, and depeding on how much text I have, the
stripe won't fill the whole layout. This is very clearly explained by
images below.
ListView item layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:id="@+id/bottom_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_alignParentBottom="true"
android:background="#fc0" />
<!-- Why match_parent does not work in view below? -->
<View
android:id="@+id/stripe"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:background="#f00" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/stripe"
android:text="This is a very long line, meant to completely break
the match_parent property of the box at right"
style="?android:textAppearanceLarge"/>
</RelativeLayout>
Result:

Setting stripe and root height to match_parent makes no difference. I did it.
Repeating the question, I want the red stripe to always fill the parent
vertically. You can see stripe is not aligning to the top of root.
A note: the above example is the simplest, self-contained example I can
think of. It's just a ListActivity with an anonymous ArrayAdapter
populated by a static String array. The relevant code in onCreate is at
most 8 lines, so no worries there. It's really the layout. Besides, I have
this working with nested LinearLayouts already, but I'm trying to reduce
the depth of my layout structure a bit, if possible. LinearLayout works
fine, as expected.

Coffeescript compile error

Coffeescript compile error

i just installed Coffeescript and tried a test compile but it always drop
me errors for silly things, Coffeescript only compile correctly when only
Coffeescript syntax is used?
because if yes then i understand the error.
concDev.js contents:
/*! ProjectName 2013-08-18 06:08:39 */
$(function() {
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time',
'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
}
}());
});
// New file
$(function() {
// Handler for .ready() called.
});

It's possible to add css modifications to Wordpress admin panel?

It's possible to add css modifications to Wordpress admin panel?

I'm making a theme for wordpress and I don't know how to apply a custom
set of css rules that will remain still when wordpress will get updated.
Is there any way that I can apply a css file using functions.php from my
theme? Thank you!

Unity3D Apps crashing/force-closing on Cyanogenmod

Unity3D Apps crashing/force-closing on Cyanogenmod

I recently acquired a Samsung Galaxy S4 and flashed the most recent
CyanogenMod. Works like a charm except for my Unity3D applications. They
just seem to force-close. Before flashing CyanogenMod, they worked, so it
has to be something CM-related.
I've tried google-searching for similar posts, but none of them had
straight answers or no answers at all.
I really need to be able to test the Unity apps on my phone, but I don't
want to go back to Stock SGS4 because of all the useless apps it has.
Does anyone know what the problem is and how to fix it?
The only maybe-related thing I found was the "No content provider found
for permission revoke" error, the solution I found for this was to give
/data/local read/write permissions, but that didn't help at all.

Saturday, 17 August 2013

Which file calls the command for logo.bin in android

Which file calls the command for logo.bin in android

It may be a noob question but I want to know which file gives command to
the logo.bin file. My aim is to replace the logo.bin by another file so as
to start android OS when charger is connected.
So, by replacing this file instead of showing animations I want to start
the android operating system itself at charger connect. Kindly help!