vendredi 31 octobre 2014

syscall and sysret is pair, but why did I only get syscall, no sysret?


Vote count:

0




I run a guest (xubuntu14_x64) on Xen-4.1.4. I want to intercept all system calls of the guest. but I only geot SYSCALL, not a SYSRET. do linux use IRET to replace SYSRET?



asked 1 min ago







syscall and sysret is pair, but why did I only get syscall, no sysret?

Find a document with the date-time before current date-time in Solr


Vote count:

0




in Solr I have documents containing order dates, and I want to find the documents containing past order dates (before current date time).


I am using orderDate:[* TO NOW] query but it excludes the documents containing order date of the same day.



asked 1 min ago







Find a document with the date-time before current date-time in Solr

Time Validation Range form Mysql


Vote count:

0




This is my Javascript



<SCRIPT TYPE="text/JavaScript">
function validateHhMm(inputField) {
var time= $("#time").val();
var isValid = /^(time)?$/.test(inputField.value);

if (isValid) {
inputField.style.backgroundColor = '#bfa';
} else {
inputField.style.backgroundColor = '#fba';
}

return isValid;
}
</SCRIPT>


PHP Script:



<?php
include 'connect.php';
$time = " SELECT * from schedule where id_ship=24";
$show_time = mysql_query($time);
$row = mysql_fetch_array($show_time);
?>

<input type="text" onchange="validateHhMm(this);" name="time" id="time" value="
<?php
echo $row['time_coming'];
?>">


this schedule table



id_ship | time_coming |
----------------------------
24 | 11:10:02 |


I want to input form time again. And valid value must same or above 11:10:02. Invalid value under 11:10:02. So, what should I do in my Javascript?



asked 1 min ago







Time Validation Range form Mysql

FileResult doesn't work for swf files?


Vote count:

0




I'm using FileResult to show files in my web site as the following:



public ActionResult GetSwf(long id = 0)
{
if (id <= 0) return null;
Attachment attachment = Service.GetAttachmentById(id, new List<string>());
if (attachment == null) return null;

string filename = attachment.Name;
string mimeType = "application/x-shockwave-flash";
string absoluteFilePath = UploadedPaths.GetAbsolutePath(attachment.Path);

return File(absoluteFilePath, mimeType, filename);
}


It doesn't work for the following tag and the browser is going to download file instead of show it!



<object type="application/x-shockwave-flash" width="220" height="166" data="File/GetSwf/1232" class="flash-object" data-name="ads-file"></object>


What's wrong, how can I fix it?



asked 25 secs ago

Mohammad

2,585






FileResult doesn't work for swf files?

Exception: Already connected In HttpURLConnection


Vote count:

0




I am facing problem in this java function i am trying to post data from my table to server but not able to post as i am getting already connected error


Only the first record is posted



public int myfuction(){

try{

String url = "myurl/page.php";
String urlParameters=null;
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

//add reuqest header
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", USER_AGENT);
con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

Cursor c1 = db.rawQuery("SELECT * FROM temtable ", null);
String id = null;
if (c1 != null ) {
if (c1.moveToFirst()) {
do {
suid = c1.getString(c1.getColumnIndex("puid"));
urlParameters ="text=STAT=1,DEVICEID=10,TERMINALID="+terminal+",USERID="+id;
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();

BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
//con.disconnect();
Toast.makeText(this, "Send Para-"+urlParameters, Toast.LENGTH_SHORT).show();
pstatus = 1;
}while (c1.moveToNext());
}
}

con.disconnect();

Toast.makeText(this, "Send Success", Toast.LENGTH_SHORT).show();
}
catch(Exception ex)
{
Toast.makeText(this, "Error:"+ ex.getMessage(), Toast.LENGTH_SHORT).show();
}

return 1;
}


This is what i am using please help...



asked 24 secs ago







Exception: Already connected In HttpURLConnection

Apache 301 redirect rewrite / to /en and keep /fr to /fr keeping all passed variables


Vote count:

0




I have a bilingual Wordpress site that I am changing the domain for and the following redirect works great.



RewriteEngine on
RewriteCond %{HTTP_HOST} !^newdomain\.com$
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [L,R=301]


The problem is I would like to have



http://ift.tt/1nZ6I8v


to redirect to



http://ift.tt/1nZ6FcS


but keep



http://ift.tt/1qcPiRL


redirecting to



http://ift.tt/1nZ6FcV


I'm not sure if having both languages explicit in the URL is a good idea but I'd like to try it out.



asked 43 secs ago

chris

1,176






Apache 301 redirect rewrite / to /en and keep /fr to /fr keeping all passed variables

Using multiple start_urls in CrawlSpider


Vote count:

0




I'm using CrawlSpider to crawl a website. I have multiple start urls, and in each url, there is a "next link" linking to another similar page. I use rules to deal with the next page.



rules = (
Rule(SgmlLinkExtractor(allow = ('/',),
restrict_xpaths=('//span[@class="next"]')),
callback='parse_item',
follow=True),
)


When there is only a url in start_urls, everything is ok. However, when there are many urls in start_urls, I got "Ignoring response <404 a url> : HTTP status code is not handled or not allowed".


How can I start with the first url in start_urls, after dealing with all the "next link", and then start with the second url in start_urls?


Here is my code



class DoubanSpider(CrawlSpider):
name = "doubanBook"
allowed_domains = ["book.douban.com"]
category = codecs.open("category.txt","r",encoding="utf-8")

start_urls = []
for line in category:
line = line.strip().rstrip()
start_urls.append(line)

rules = (
Rule(SgmlLinkExtractor(allow = ('/',),
restrict_xpaths=('//span[@class="next"]')),
callback='parse_item',
follow=True),
)


def parse_item(self, response):
sel = Selector(response)
out = open("alllink.txt","a")
sites = sel.xpath('//ul/li/div[@class="info"]/h2')
for site in sites:
href = site.xpath('a/@href').extract()[0]
title = site.xpath('a/@title').extract()[0]
out.write("***")
out.close()


asked 1 min ago







Using multiple start_urls in CrawlSpider

CameraOverlay behind the Picker iOS


Vote count:

0




I am making the custom camera app for take custom photo using this app.I write this code to take photo .



self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = YES;

UIImageView *suitimage=[[UIImageView alloc]initWithFrame:CGRectMake(50, 70,220 , 330)];
suitimage.image=self.suitimageview.image;
self.picker.cameraOverlayView=suitimage;
self.picker.delegate=self;
[self presentViewController:self.picker animated:YES completion:nil];


But it gives this result. enter image description here


In this case my suit is above the take picture button so when I move this suit(userInteraction is enable , I use pan,pinch and rotation gesture to this suit) this above the take picture button and I don't see the button. Thanks. But I want this suit behind the camera take picture button(rounded button).



asked 55 secs ago







CameraOverlay behind the Picker iOS

Screen.blit() Trouble (Pygame)


Vote count:

0




Sorry for the second post in as many days, but I'm having trouble printing anything onto the screen that isn't the spirte labelled 'pokemon'. I import the image using the funtion;



img_snap = pygame.image.load("images/snap.png")


and then attempt to print the image (called "snap.png") with:



screen.blit(img_snap, (200,200))


where 200 and 200 are the x and y co ordinates that the object will be drawn. If anyone is familiar with pygame please lend your knowledge :)


thanks in advance


MAIN CODE:



import pygame,sys
from classes import *
from process import process

pygame.init()
WIDTH,HEIGHT = 640, 360
screen = pygame.display.set_mode((WIDTH,HEIGHT),0,32)
img_pokemon = pygame.image.load("images/pokemon.png")
img_screen = pygame.image.load("images/screen.png")
img_snap = pygame.image.load("images/snap.png")
#clock
clock = pygame.time.Clock()
FPS = 24
fivesecondinterval = FPS * 5
totalframes = 0
#pokemon object
pokemon = Pokemon(0, HEIGHT -80, 48, 76, "images/pokemon.png")

#-------------------------MAIN PROGRAM LOOP----------------------------
while True:
process(pokemon)
#LogicStart
Pokemon.motion(pokemon)
#LogicEnd
#DrawStart
screen.fill( (0,0,0) )
BaseClass.allsprites.draw(screen)
screen.blit(img_snap, (640,360))
pygame.display.flip()
#DrawEnd

clock.tick(FPS)


CLASSES CODE:



import pygame

class BaseClass(pygame.sprite.Sprite):

allsprites = pygame.sprite.Group()
def __init__(self, x, y, width, height, image_string):

pygame.sprite.Sprite.__init__(self)
BaseClass.allsprites.add(self)

self.image = pygame.image.load(image_string)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y

self.width = width
self.height = height



class Pokemon(BaseClass):
List = pygame.sprite.Group()
def __init__(self, x, y, width, height, image_string):

BaseClass.__init__(self, x, y, width, height, image_string)
Pokemon.List.add(self)
self.velx = 0

def motion(self):
self.rect.x += self.velx


PROCESSES CODE:



import pygame,sys
def process(pokemon):

#processes
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

keys = pygame.key.get_pressed()

if keys[pygame.K_d]:
pokemon.image = pygame.image.load("images/pokemon.png")
pokemon.velx = 5
elif keys[pygame.K_a]:
pokemon.image = pygame.image.load("images/pokemonflipped.png")
pokemon.velx = -5
else:
pokemon.velx = 0


asked 21 secs ago







Screen.blit() Trouble (Pygame)

Jquery Multiple independent Ajax calls


Vote count:

0




I have a table on by website with multiple rows of data. Each row of data can be edited on the row itself, and at the end of each row is a save button.


Hence if i have 10 rows, I will have 10 save buttons.


I want each save button to save the respective rows data to the database via an ajax call, and after the ajax call is complete, the button text changes to "saved". The thing is, the user may click on multiple save buttons in sequence without waiting for the previous save to complete.


Hence I need an ajax call that is unique to each button, however I'm having trouble finding an easy way to do this. Can someone help out with the ajax skeleton code? Do I submit the ajax call including the button ID and in the ajax complete function, I for the button id in the return ajax message?


Cheers Kevin



asked 1 min ago







Jquery Multiple independent Ajax calls

PL/SQL Procedure with cursor "anonymous block completed"


Vote count:

0




I've been trying to get this procedure working for the last few hours:



CREATE OR REPLACE PROCEDURE Search_Testimonials(keyword VARCHAR2)
AS
l_cursor_1 SYS_REFCURSOR;
Temp_Content VARCHAR(255);
BEGIN
OPEN l_cursor_1 FOR
SELECT T_Content
INTO Temp_Content
FROM Testimonial
WHERE T_Content LIKE '%' || Keyword || '%';
dbms_output.put_line(Temp_Content);
DBMS_SQL.RETURN_RESULT(l_cursor_1);
END;


It's pretty much supposed to run through the testimonials table and output every row that has an instance of the keyword in the parameter. It compiles with no errors but when i execute like so:



EXECUTE Search_Testimonials('someword');


I get this error: "anonymous block completed". Does anyone know what's going on? I'm new to PL/SQL and am running out of resources on the internet or just don't understand what I'm reading.


-I'm running this all in oracle sql developer.



asked 56 secs ago







PL/SQL Procedure with cursor "anonymous block completed"

Polymorphism and std::vector


Vote count:

0




So I have a vector of "Widgets"



std::vector<Widget> widgets;


And a class called dial which extends Widget



class Dial : public Widget


And also a loop which loops through all the Widgets in widgets. However, there is and update method in Widget which gets overriden in Dial, and whenever I loop through widgets it calls Widget's update and not Dial's update. How can I fix this? (It also calls Widget's draw and not Dial's as well)



asked 23 secs ago







Polymorphism and std::vector

Can someone please differentiate MapOwinPath to Map in owin


Vote count:

0




I am trying to understand RouteTable.Routes.MapOwinPath and it appears to serve the same purpose as Map and MapWhen of IOwinContext. Can someone please explain which to use when?



asked 28 secs ago







Can someone please differentiate MapOwinPath to Map in owin

Webalizer deletes past log list on every beginning of month


Vote count:

0




I am using Webalizer V2.23-08 on Ubuntu 14.04.1 LTS.


When new month comes, old data (2 months ago and earlier) disappear from the "Summary by Month" list. The analized data (HTML and graph images) don't be deleted and when I edit webalizer.conf manually using previous data, the list can be recovered.


I suspect that webalizer.current may be broken, but I have no idea how to recover it without analizing all past Apache logs.


Please tell me how to fix webalizer.current or other method to solve this problem.



asked 1 min ago







Webalizer deletes past log list on every beginning of month

Object Not Resolved to a Local Variable (Java)


Vote count:

0




I'm writing a Java program to process each state of a search graph, but can't seem to create instances of State inside one of my loops.


The program takes numbers from a file, line by line, and converts each number into a State object, however I'm getting an error State cannot be resolved to a variable



public class ABSrch {

static HashMap<Integer, State> states = new HashMap<Integer, State>();

public static void main(String[] args) {
File file = new File("D:\\Stuff\\TextExample.txt");
int level = 0, depthBound = 0, stateNumber = 0;

try {
Scanner s = new Scanner(file);

depthBound = Integer.parseInt(s.nextLine().split(" ")[1]);

s.close(); s = new Scanner(file);

while(s.hasNextLine()) {
String line = s.nextLine();
String[] tokens = line.split(" ");

if(level >= 0 && level <= 7) {
if(level == 0) tokens = line.split(" |7");
}
for(int i = 0; i < tokens.length; i++)
State parent = new State(false,0,0,null); //error: State not resolved to variable

level++;
}
s.close();
} catch (FileNotFoundException e) {
System.err.println("File not found");
}
}
}


State class:



public class State {
private boolean max;
private int name, value;
private State parent;
private ArrayList<State> children;

public State(boolean max, int name, int value, State parent) {
this.max = max;
this.name = name;
this.parent = parent;
children = new ArrayList<State>();
}

public boolean isMax() { if(max == true) return true; else return false; }
public void setMax(boolean max) { this.max = max; }

public int getValue() { return value; }
public void setValue(int value) { this.value = value; }

public int getName() { return name; }


}



asked 24 secs ago







Object Not Resolved to a Local Variable (Java)

Issues with adding new array in update


Vote count:

0




The update for my app is now ready, however I have noticed that updating directly from the version of my app that is on the app store, to the new version that I am working on in Xcode seems to crash my app.


Basically, I added a new array that stores data for notes which was not present in previous versions and this is stored in NSUserDefaults (Not ideal, I know, but I would rather keep it this way for now)


When I go into the table view tab of my app, it crashes at this line:



cell.notesLabel.text = (notes.objectAtIndex(indexPath.row)) as? String


The error just states - "Thread 1: breakpoint 1.1" as soon as the table view tab is tapped.


I was discussing this with someone else and they suggested that I need to check for the existence of the array in the defaults and create and synchronise it if it is missing.


I'm not entirely sure how I would go about this, but I have tried changing my code from this:



if var tempNotes: NSArray = NSUserDefaults.standardUserDefaults().arrayForKey("notes") {
notes = tempNotes.mutableCopy() as NSMutableArray
}


To this:



if NSUserDefaults.standardUserDefaults().arrayForKey("notes") != nil {
var tempNotes: NSArray = NSUserDefaults.standardUserDefaults().arrayForKey("notes")!
notes = tempNotes.mutableCopy() as NSMutableArray
}


However it doesn't seem to have made a difference. That code is in viewWillAppear() by the way.


Any ideas?



asked 49 secs ago







Issues with adding new array in update

Adding a full width background video in Twitter boostrap


Vote count:

0




I know this can be done in HTML5, but how do I achieve the same in bootstrap, Ive tried the following and am having issues:


http://ift.tt/1qaOUmH



asked 1 min ago

Kaur

17






Adding a full width background video in Twitter boostrap

Odoo 8 - cost price of product


Vote count:

0




How cost (standard) price is stored in odoo 8? How we can edit it directly in db?


In openerp 7 it was part of product_template table. Now we have product_price_history table, but updates in it are not enough.



asked 54 secs ago







Odoo 8 - cost price of product

Stripe API Balance


Vote count:

0




I am trying to retrieve my Stripe balance using the Stripe API with PHP.


I am calling the following:



function retrieve_balance()
{
$response = Stripe_Balance::retrieve();

return $response;
}


This returns something like this:



object(Stripe_Balance)#28 (5) {
["_apiKey":protected]=>
string(32) "my_key_here"
["_values":protected]=>
array(4) {
["pending"]=>
array(1) {
[0]=>
object(Stripe_Object)#32 (5) {
["_apiKey":protected]=>
string(32) "my_key_here"
["_values":protected]=>
array(2) {
["amount"]=>
int(0)
["currency"]=>
string(3) "usd"

etc...


I've tried doing the following but it only resulted in an error. I'm trying to get the amount of pending and available.



<?php
var_dump($balance);
/*Issue Line Below*/
echo $balance->pending->amount;
?>


The error I get is: Trying to get property of non-object



asked 21 secs ago







Stripe API Balance

Can ServerSocket write to client before reading from client?


Vote count:

0




After a ServerSocket accepts a connection to a client, can the ServerSocket start writing data to the client before the client sends a message? When I try to write to the client from the ServerSocket first, the client is blocking forever tyring to read it. However, if have the client send a message to the server first, the I/O streams between them work OK.



asked 38 secs ago







Can ServerSocket write to client before reading from client?

compare ordinal type in data mining


Vote count:

0




I have several variables That type of them is ordinal type .


never < rarely < occasionally < often


I would calculate the amount of nearly two variables. Is it possible ؟


For Example 1 : v1 = often v2= often so v1 is completely near v2


For Example 2 : v1 = occasionally & v2 = often


For Example 3 : v1 = rarely & v2 = often


so V1 and v2 values in example 2 ​​are closer together than values in Example 3 .


How can I show degree close of them with a number?



asked 59 secs ago







compare ordinal type in data mining

bValidator phone number


Vote count:

0




I am trying to validate a US phone number with bValidator. It needs to be such as (111) 111-1111.


I believe you can use regex but I am not sure how to put it in.


I think the regex for it would be: "reg:{{(?:(?:(\s*(?([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*)|([2-9]1[02-9]|[2​-9][02-8]1|[2-9][02-8][02-9])))?\s*(?:[.-]\s*)?)([2-9]1[02-9]|[2-9][02-9]1|[2-9]‌​[02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})}}"


Does anyone know how I would do this with bValidator?


I tried:


It didn't work, so I am taking it I am doing it wrong.


Any help would be appreciated. Thanks!



asked 53 secs ago







bValidator phone number

Replace number with last four digits of it


Vote count:

0




I want to replace seven or more digits number with the following pattern.


1234567 to 4567/1234567


I'm using the following regex for matching the number (\d*(\d{4})) and replace it with the $2/$1


Is there any efficient way to do this?



asked 1 min ago

ogun

499






Replace number with last four digits of it

Django Admin, showing related tables fields


Vote count:

0




For the Admin interface in Django, I have a class called RideInfo set with attributes. I have another class called Rider that is related to RideInfo via foreign key. It is a 1 - Many relationship between RideInfo and Ride. Admin.py looks like the following:



from django.contrib.gis import admin
from django.contrib.gis.admin import OSMGeoAdmin
from models import Bike, RideInfo, Rider

class BikeInline(admin.TabularInline):
model = RideInfo
extra = 0

class BikeAdmin(OSMGeoAdmin):
inlines = [BikeInline]

admin.site.register(Bike,BikeAdmin)


How do I show the fields from Rider in the Admin interface?



asked 46 secs ago







Django Admin, showing related tables fields

How is it possible to make multiple rectangle instances in Pygame?


Vote count:

0




I'm trying to create multiple rectangles using a for loop with PyGame but I'm not really clear on how I could do this. My first approach was storing all rectangle instances in an array but then I ran into another problem, how to assign a .get_rect() to it. So I did this:



def MultiRect(amount):
objects = []
objectsRect = []

for i in range(0, amount):
objects.append(pygame.Surface([200,100]).convert())
objects[i].fill((130,130,130))
objectsRect.append(objects[i].get_rect())


So what I tried to do was make two arrays, one stores the instance and the other stores the instance.get_rect() but I know this is the wrong way to do it and I also get multiple out of range errors. Is there another way I could go about this?



asked 48 secs ago

Toby

11






How is it possible to make multiple rectangle instances in Pygame?

Why Creating new session id every time in wsHttpBinding


Vote count:

0




I am using following configuration to make my service sessionful, but for each request wcf service is responding me with new session id. Why it so, what I need to make it sessionful for that client so that for each request there should be same session id



<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttp">
<readerQuotas maxStringContentLength="10240" />
<reliableSession enabled="true" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="wcfservice.serviceclass" behaviorConfiguration="MyFileServiceBehavior">

<host>
<baseAddresses>
<add baseAddress="http://localhost:51/"/>
<add baseAddress="net.tcp://localhost:52/"/>
</baseAddresses>
</host>
<endpoint address="pqr" binding="wsHttpBinding" bindingConfiguration="wsHttp"
name="b" contract="wcfservice.Iservice" />
<endpoint address="pqr" binding="netTcpBinding"
name="c" contract="wcfservice.Iservice" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyFileServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>


asked 30 secs ago







Why Creating new session id every time in wsHttpBinding

read text file with fixed columns in c#


Vote count:

0




is there any way to read text files with fixed columns in C # without using regex and substring?


I want to read a file with fixed columns and transfer the column to an excel file (.xlsx)


example 1



Id name age training
----------------------
1 John 22 graduate
2 Deep 23 technical

example 2



Id name age training
----------------------
1 John 22 graduate
2 Deep 23

remembering that I have a case as in the second example where a column is blank, I can get the columns and the values ​​using regex and / or substring, but if it appears as a file in Example 2, with the regex line of the file is ignored, so does substring.



asked 1 min ago







read text file with fixed columns in c#

Laravel - Undefined variable


Vote count:

0




I'm having difficulty accessing a variable, when it's clearly there within the table.


The error falls on this line:



@if ($alert->alert_when == 1)
@endif


Undefined variable: alert_when - is the error.


I dd() the get() request prior to accessing the data in the view and I can see the variable it's retrieving:



["alert_when"]=> string(1) "1"


Why is this error occurring? Many thanks in advance.



asked 26 secs ago

Ben

443






Laravel - Undefined variable

How could a log X, Y mouse position on my grid?


Vote count:

0




I have this script to create grid of rectangles, how would I go about logging map co ordinates of the mouse position so if the mouse was on 1,1 it would log 1,1?:



0,0|0,1|0,2|0,3
1,0|1,1|1,2|1,3
2,0|2,1|2,2|2,3
3,0|3,1|3,2|3,3


here is the script I have to create the grid;



var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = (32 * 12);
canvas.height = (32 * 12);
document.body.appendChild(canvas);

var posX = 0;
var posY = 0;
var tileSize = 32;

$(document).ready(function(){
drawGrid();
});

function drawGrid(){
for(var x = 0; x < 12; x++){
for(var y = 0; y < 12; y++){
ctx.rect(posX, posY, tileSize, tileSize);
ctx.stroke();
posX += tileSize;
}
posY += tileSize;
posX = 0;
}
}


asked 43 secs ago







How could a log X, Y mouse position on my grid?

Letters to numbers code


Vote count:

0




I have been given a task to do as part of my computing homework in vb.net form


Firstly, I had to take a persons first name and take their first and last letters of their first name, which I have already done and works perfectly fine.


However, the next step is where I have to covert the first and last letters to numbers when A = 1 and B = 2 and C = 3 etc to Z = 26 and then add these 2 numbers together to give a value between 2 and 52


How would I write this code?



asked 1 min ago







Letters to numbers code

Properly trigger a click event on an AngularJS directive in Mocha test suite


Vote count:

0




I have a regular angular app with a directive. This directive contains an element with a ng-click="clickFunction()" call. All works well when I click that element. I now need to write a test for this click, making sure that this function was actually run when the element was clicked - this is what I'm having trouble with.


Here's a jsfiddle to illustrate my issue: http://ift.tt/1toV3z1


The controller contains a function clickFunction() which should be called on click. The unit test should imitate a click on the directive's element and thus trigger the call to that function.


The clickFunction is mocked with sinonjs so that I can check whether it was called or not. That test fails, meaning there was no click.


What am I doing wrong here?


I've seen the answer to similar questions like Testing JavaScript Click Event with Sinon but I do not want to user full jQuery, and I believe I'm mocking (spying on) the correct function.



asked 1 min ago

miphe

206






Properly trigger a click event on an AngularJS directive in Mocha test suite

jar build using maven showing error


Vote count:

0




i have build an application that fetch the value from Count tag of some xml files and writes it to the output excel XLSX file.


i have 2 functions in my program which are called by main(). First is readXml() which read the xml files and second is writeXlsx() which writes to the output excel file.


i have used maven to add dependencies and build jar file.


when i run the created jar, it works well for half of the program but gives an error when try to write XLSX. Error comes up is :



Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook
at com.mpstddn.App.writeXLSX(App.java:107)
at com.mpstddn.App.main(App.java:64)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSFWorkbook


same program works well when i run it from eclipse but gives error when i make a jar of it and run it. It seems to me that jar is not able to include the apache poi lib. I am new to maven and don't know where i am making mistake. here is my pom.xml :



<project xmlns="http://ift.tt/IH78KX" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/IH78KX http://ift.tt/VE5zRx">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mpstddn.java</groupId>
<artifactId>myMavenProject</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>myMaven</name>
<url>http://ift.tt/19pvvEY;
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>openxml4j</artifactId>
<version>1.0-beta</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<scriptSourceDirectory>src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>src\test\java</testSourceDirectory>
<outputDirectory>target\classes</outputDirectory>
<testOutputDirectory>target\test-classes</testOutputDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>lib</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.jar</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.mpstddn.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
<execution>
<id>default-testResources</id>
<phase>process-test-resources</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.mpstddn.App</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<configuration>
<packagingExcludes>*.jar</packagingExcludes>
</configuration>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<outputDirectory>target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<outputDirectory>target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>target\site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</project>


asked 2 mins ago







jar build using maven showing error

Hibernate @OneToOne Mapping


Vote count:

0




I have following piece of code.. ---- 1 : working fine (staffTbl is not getting fetch lazily) @OneToOne(fetch=FetchType.LAZY) @JoinColumns({@javax.persistence.JoinColumn(name="inst_id", referencedColumnName="inst_id", insertable=false, updatable=false), @javax.persistence.JoinColumn(name="staff_id", referencedColumnName="staff_id", insertable=false, updatable=false)}) private StaffTbl staffTbl;


2 : but when i made this transient its always fetching null


@OneToOne(fetch=FetchType.LAZY) @JoinColumns({@javax.persistence.JoinColumn(name="inst_id", referencedColumnName="inst_id", insertable=false, updatable=false), @javax.persistence.JoinColumn(name="staff_id", referencedColumnName="staff_id", insertable=false, updatable=false)}) private transient StaffTbl staffTbl;


Is there any mistake ???(I'm using hibernate3, with jboss 6.1)



asked 2 mins ago







Hibernate @OneToOne Mapping

How to open different div using Div as a navigation.bar


Vote count:

0




I am trying to make a navigation tab(for mobile application ) with div as navigation bar. can anyone suggest what exactly should be the jQuery code to run the same and its improvemnet to make it compatible for mobile application .


HTML :


Insert title here


This is tab 1


This is tab 2


This is tab 3


CSS: div.bottom { height: 50px; width: 100%; text-align:center; margin-left: auto; margin-right:auto; margin-top: none; margin-bottom: none; background-color: #E6E6E6; }



asked 35 secs ago







How to open different div using Div as a navigation.bar

How to change the color of a div using jquery?


Vote count:

0




I have multiple items in my website having same class name here is my code for single item price section only



<tr>
<td><table cellspacing="0" cellpadding="0" width="100%"><tbody><tr><td><div class="prod-price"><span class="price-old" style="display: none;">9.90</span>
<span class="price-new">9.90</span></div>
<div style="font-size: 0.8em; padding-top: 4em; display: none;" class="save- sale">0.00</div>
<div class="pc"></div>
</td><td><div class="prod-price">
</div></td></tr><tr><td class="medtext">&nbsp;<b>(Out of Stock)</b></td></tr>
</tbody></table></td>
</tr>


What i need to do i want to change the color of only for that div(having class name price-new) which has (out of status) message.i tried the below code but it changes the color for all divs having class name price-new i want this script to be apply only for those items which is having out of stock message using either jquery or java script.


this is what i have tried



<script>
$(function () {
$(".medtext").each(function(){
if($.trim($(this).text()) == 'Out of Stock') {
$(".price-new").css("color","black");
}
});
});
</script>


asked 1 min ago







How to change the color of a div using jquery?

Recent Questions - Stack Overflow

Arrange buttons centrally in screen below title TextView in Android Layout


Vote count:

0




I am trying to arrange 3 buttons vertically in the centre of the available space in an Android Activity. I also have a title field in a TextView and I need this to be at the top of the display screen with a vertical gap between it and the buttons. I also need the blank space between the bottom button and the bottom of the screen to be the same as the space between the top button and the bottom of the TextView.


From reading the docs istm that a pair of nested vertical LinearLayouts should do the job as below but this leaves me with the buttons arranged immediately following the TextView with no space between the TextView and the top button.


Any ideas how I can achieve my aim would be gratefully received.



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView android:id="@+id/app_title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_title_label"
android:gravity="top"
style="?android:listSeparatorTextViewStyle"
/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="center" >

<Button android:id="@+id/button_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
/>

<Button android:id="@+id/button_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
/>

<Button android:id="@+id/button_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
/>

</LinearLayout>

</LinearLayout>


Thanks,



asked 24 secs ago

Boo

8






Arrange buttons centrally in screen below title TextView in Android Layout

Why Phpmyadmin don't recognize INTERSECT in a query


Vote count:

0




i'm trying to do a query with the INTERSECT clause but PHPmyAdmin don’t recognize INTERSECT and this is the error :



#1064 - 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 'INTERSECT (SELECT users.name, users.id, users.email FROM users ' at line 10


I can't understand and i haven't found a problem like this. So any solutions please ? Thanks



asked 39 secs ago







Why Phpmyadmin don't recognize INTERSECT in a query

spinner values not displaying in android


Vote count:

0




Hi In This code first two values showing data and from third string array it giving null pointer Exception but data coming from database.can any one please help me.


This values only showing NullPointerException



patient_main_type_name[i] = JA.getJSONObject(i).getString("patient_main_type_name");
patient_type_name[i] = JA.getJSONObject(i).getString("patient_type_name");
religion_name[i] = JA.getJSONObject(i).getString("religion_name");
caste_name[i] = JA.getJSONObject(i).getString("caste_name");


class file



String result = DatabaseUtility.executeQueryPhp("getpatient","");
System.out.print(result);

try
{
JSONArray JA = new JSONArray(result);



initial_name = new String[JA.length()];
initial_id = new String[JA.length()];
patient_main_type_name = new String[JA.length()];
patient_type_name = new String[JA.length()];
religion_name= new String[JA.length()];
caste_name= new String[JA.length()];



for(int i=0;i<JA.length();i++)
{
initial_name[i] = JA.getJSONObject(i).getString("initial_name");
initial_id[i] = JA.getJSONObject(i).getString("initial_id");
patient_main_type_name[i] = JA.getJSONObject(i).getString("patient_main_type_name");
patient_type_name[i] = JA.getJSONObject(i).getString("patient_type_name");
religion_name[i] = JA.getJSONObject(i).getString("religion_name");
caste_name[i] = JA.getJSONObject(i).getString("caste_name");
}

spinner_fn();


}


catch(Exception e)
{
Log.e("Fail 3", e.toString());
}


asked 20 secs ago

user

10






spinner values not displaying in android

Access text values from dynamically created UITextFields. iOS


Vote count:

0




I am creating UITextField 's in my view based on the count of an NSArray.


I want to know how I can access the text values based on the tag of the UITextField in my NSArray.


So after I add the below UITextField 's to my view how would I write code to retrieve .text values for myTextfield0, myTextfield1 and myTextfield2 respectively?


Example:



NSString *textFeildTextString = [NSString stringWithFormat:@"%@",myTextfield1.text];


Actual Code:



self.textFieldArray = [NSArray arrayWithObjects:@"one", @"two", @"three",nil];

NSMutableDictionary *myDict = [NSMutableDictionary dictionary];
for (int i=0; i<[self.textFieldArray count]; i++) {

UIView *spacerView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
UITextField *myTextField = [[UITextField alloc]initWithFrame:CGRectMake(20, 60*i+150, 280, 45)];
myTextField.borderStyle = UITextBorderStyleNone;
myTextField.font = [UIFont systemFontOfSize:14];
myTextField.returnKeyType = UIReturnKeyDefault;
myTextField.placeholder = NSLocalizedString(@"Answer", nil);
myTextField.inputAccessoryView = [super createInputToolbar];
myTextField.background = [UIImage imageNamed:@"TextFieldBg"];
myTextField.textColor = [UIColor appTextColorGrey];
[myTextField setLeftView: spacerView1];
myTextField.leftViewMode = UITextFieldViewModeAlways;
myTextField.delegate = self;
myTextField.tag = 200+i;
[myDict setObject:myTextField forKey:[NSString stringWithFormat:@"myTextfield%d", i]];
[self.view addSubview:myTextField];
}

NSLog(@"Dict: %@",myDict);


The NSlog of my UITexfields



2014-10-31 11:58:32.715 [51992:13536821] Dict: {
myTextfield0 = "<UITextField: 0x7faea14f8430; frame = (20 150; 280 45); text = ''; clipsToBounds = YES; opaque = NO; tag = 200; layer = <CALayer: 0x7faea14f82d0>>";
myTextfield1 = "<UITextField: 0x7faea14fae70; frame = (20 210; 280 45); text = ''; clipsToBounds = YES; opaque = NO; tag = 201; layer = <CALayer: 0x7faea14faca0>>";
myTextfield2 = "<UITextField: 0x7faea16dce30; frame = (20 270; 280 45); text = ''; clipsToBounds = YES; opaque = NO; tag = 202; layer = <CALayer: 0x7faea16d19c0>>";


}



asked 29 secs ago







Access text values from dynamically created UITextFields. iOS

string split '\' in jquery or javascript


Vote count:

0




I tried to split the string with special character '\' but its not working.


str = 'c:\images\jhjh.jpg';


result = str.split('\');


help me to resolve the issue. Thanks in advance



asked 1 min ago







string split '\' in jquery or javascript

Unable to "save as" large PDF files on nginx server


Vote count:

0




I currently have a web application that generates fairly large PDF files (100 - 200 MB per file). The application is currently configured to display the PDF in a new window. When the PDF file size is low (50mb or so), I can successfully use "Save as..." in Chrome and Firefox to download the file. But, if the filesize is larger, I'm able to see the output of the PDF in the browser, but unable to use "save as" (nothing happens).


The server is running on nginx / PHP-FPM. I've tried upping the memory limit for the script, disabling the script execution time and a few other random tweaks to try and diagnose the issue, but I'm unable to make any progress. My logs aren't showing anything of use (at least, not that I can tell).


Any advice on how I can get the file downloads working for larger PDF data?



asked 39 secs ago







Unable to "save as" large PDF files on nginx server

why do we certificate installed on Client?


Vote count:

0




I am describing below scenarios. please help me understand the concept of SSL: we have the below architecture:

F5 Load Balancer --> Iplanet Web Server --> Weblogic --> Webservices(Backend) The Iplanet, weblogic and WEbservices(backend) has certificates installed which are signed by symantec(verisign)


1) The Webservices(Backend) certificate is also installed on Weblogic. why is this needed? Because the traffic between Weblogic and WebSErvice backend is using https and secured. why a cer still needs to be installed? 2) Do we need to install the certificate of Weblogic in web server, if yes why? 3) Do we need to install any certificate of Webserver in Load balancer? if yes why?



asked 38 secs ago







why do we certificate installed on Client?

Overhead of using PowerShell instead of C# for quering WMI from inside my app


Vote count:

0




I need to obtain some information about virtual systems on the hosts and also manage these virtual system. My application is currently doing it querying WMI, but I would like to turn to PowerShell scripts from now on. Personally I feel better using PowerShell for building WMI queries. I like its readablilty and the fact that the code is isolated into the script body. But I'm afraid that using it instead of directly querying WMI from my app will cause overhead.


From the point of performance is it worth it to struggle with writing WMI queries in C# if I feel more comfortable writing them in PowerShell script?


What are the other pros and cons in both approaches? Does PowerShell provide any optimization of querying WMI that quering directly from C# code doesn't?



asked 39 secs ago







Overhead of using PowerShell instead of C# for quering WMI from inside my app

CSS Menu Sub Menu Not Working Correctly


Vote count:

0




I cannot seem to get the sub-menu to appear on this website I built: http://ift.tt/10EdTJj


If you use Dev tools/Firebug, and check .sub-menu to display: block; then you can see that the sub-menu does appear, but not in plain sight. I've tried adding z-index to several of the menu areas with no luck. The odd thing is, that it does appear correctly in FF on Windows?!


I haven't pasted the code here because there would be so much to copy and paste.


Any help would be much appreciated.


Thanks



asked 27 secs ago







CSS Menu Sub Menu Not Working Correctly

on change event datepicker in Ext.form.DateField not working


Vote count:

0




I have html span for datepicker like this



<span id="spanLimitFBClaim"></span>


then i call it's js



$("#spanLimitPaymentDate").datepicker("LimitPaymentDate")


datepicker comes form another global.js



$.fn.datepicker = function (id) {
var mydate = new Ext.form.DateField({
xtype: 'datepicker',
format: 'd-M-Y',
margin: '2 0 2 0',
renderTo: Ext.get($(this).attr("id")),
cls: 'sa-datepicker',
inputId: id,
value: new Date()
});
$("#" + id).attr("readonly", true);
}


it is works. the problem is. i want to get change event. i try to add in global js the listener like this



$.fn.datepicker = function (id) {
var mydate = new Ext.form.DateField({
xtype: 'datepicker',
format: 'd-M-Y',
margin: '2 0 2 0',
renderTo: Ext.get($(this).attr("id")),
cls: 'sa-datepicker',
inputId: id,
value: new Date(),
listeners: {
select: function () {
console.log('Date selected: ', this.getValue());
}
}
});
$("#" + id).attr("readonly", true);
}


and it works. i see the value on global.js (console.log) the problem is how to add it in my span (from the first js). because i do below code is not working



$("#spanLimitPaymentDate").datepicker("LimitPaymentDate", {
listeners: {
select: function () {
console.log('Date selected: ', this.getValue());
}
}
});


i'm very newbie in ext.js :(


Many thanks



asked 1 min ago







on change event datepicker in Ext.form.DateField not working

Error of omitted data in R although using na.omit()?


Vote count:

0




i used na.omit() to omit NA data, however, every time i got a warning message of removal some rows containing missing data such as this one.


Removed 201 rows containing missing values (geom_point) can any one explain why this happens and how to avoid it? thanks in advance



asked 40 secs ago







Error of omitted data in R although using na.omit()?

How to set font " Balzano" to the text in enclosed in on my website?


Vote count:

0




I want to set font "Balzano" to the following text enclosed in


by means of inline css. How to achieve it?

<p>Nice Site</p>


asked 44 secs ago







How to set font " Balzano" to the text in enclosed in on my website?

the value of local variable temp is not used


Vote count:

-1




here the value of local variable temp is not used,this code was done in eclipse // My code



int temp = n;



while(n > 0)

{

r = n % 10;

temp = n / 10;

if(r!= 0 && r!= 1)

{


asked 1 min ago


1 Answer



Vote count:

0




It's not used, it's only assigned. Since it's not used, it can be eliminated.


However, it's just a warning.



answered 7 secs ago

Eran

39.6k





the value of local variable temp is not used

jeudi 30 octobre 2014

Antlr4 grammar ambiguity for two same prefixed rules


Vote count:

0




So I have the following grammar rules for an SQL expression editor (simplified):



FUNCTIONID: 'sum' | 'avg';
functionExpr: FUNCTIONID '(' expr ')'

AGGFUNCTIONID: 'sum' | 'avg'
aggFunctionExpr: AGGFUNCTIONID '(' expr ')' 'over' ...


The code works for expressions such as "sum(1) over ..." but not when there's no over.


How could I make this grammar work for both cases and still have these two rules?



asked 47 secs ago







Antlr4 grammar ambiguity for two same prefixed rules

nested model search under sunspot


Vote count:

0




How to search if many models has_one comment for its model,


the comment has 3 attributes needs to be searched.



text :model_name do
camera_info_comment.model_name
end
text :version do
camera_info_comment.version
end
text :mac_address do
camera_info_comment.mac_address
end


Now I have to put the above code in every model which has association with camera_info_comment


How to make my code more DRY (not to repeat many times)



asked 26 secs ago

poc

1,188






nested model search under sunspot

AppLock command not working with MDM on Supervised device


Vote count:

0




I created an mobile config profile with General, Restrictions, Credentials, Mobile Device Management payload. I can successfully installed the profile in my "Supervised" iPhone4S. From Server, Device Lock command is working fine. But AppLock command is not working? Below are the logs of that device and code of server.



Oct 31 11:33:16 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Received push notification.
Oct 31 11:33:16 iPhone4S-1 mdmd[156] <Notice>: (Warn ) MDM: Ignoring extra keys in push dictionary: {
aps = {
};
}
Oct 31 11:33:16 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Polling MDM server http://ift.tt/1rYKmk0 for next command.
Oct 31 11:33:19 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Transaction completed. Status: 200
Oct 31 11:33:19 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Polling MDM server http://ift.tt/1rYKmk0 for next command.
Oct 31 11:33:19 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Transaction completed. Status: 200
Oct 31 11:33:19 iPhone4S-1 mdmd[156] <Notice>: (Note ) MDM: Polling MDM server http://ift.tt/1rYKmk0 for next command.


Server Code:



public static String getAppLockPList(){
StringBuffer backString = new StringBuffer();
backString.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
backString.append("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"");
backString.append("\"http://ift.tt/vvUEPL\">");
backString.append("<plist version=\"1.0\">");
backString.append("<dict>");
backString.append("<key>PayloadContent</key>");
backString.append("<array>");
backString.append("<dict>");
backString.append("<key>App</key>");
backString.append("<dict>");
backString.append("<key>Identifier</key>");
backString.append("<string>com.company.identifier</string>");
backString.append("</dict>");
backString.append("<key>PayloadType</key>");
backString.append("<string>com.apple.app.lock</string>");
backString.append("<key>PayloadIdentifier</key>");
backString.append("<string>com.company.identifier</string>");
backString.append("<key>PayloadUUID</key>");
backString.append("<string>d7e27098ad530884664a98a6f93ab3796f97b</string>");
backString.append("<key>PayloadVersion</key>");
backString.append("<integer>1</integer>");
backString.append("</dict>");
backString.append("</array>");
backString.append("<key>PayloadType</key>");
backString.append("<string>Configuration</string>");
/*backString.append("<key>PayloadDisplayName</key>");
backString.append("<string>##########</string>");*/
backString.append("<key>PayloadIdentifier</key>");
backString.append("<string>com.company.identifier</string>");
backString.append("<key>PayloadUUID</key>");
backString.append("<string>d7e27098ad530884664a98a6f93ab3796f97b</string>");
backString.append("<key>PayloadVersion</key>");
backString.append("<integer>1</integer>");
backString.append("</dict></plist>");
return backString.toString();
}


asked 44 secs ago







AppLock command not working with MDM on Supervised device