Posts

Showing posts from April, 2013

linux - How can I use the vm_operations struct to intercept page faults to a particular set of pages? -

i create kernel module when given id of process can lookup task struct , memory map. when finds should attach function serve page faults particular set of pages (namely heap pages). set vma->vm_ops->fault of needed vma. can easier, if hack heap allocator , replace mmap s mmap_anonymous mmap of special device. code related: http://lxr.free-electrons.com/source/mm/memory.c?v=3.12#l3676 3689 static int handle_pte_fault(struct mm_struct *mm, 3690 struct vm_area_struct *vma, unsigned long address, 3691 pte_t *pte, pmd_t *pmd, unsigned int flags) 3692 { 3693 pte_t entry; 3694 spinlock_t *ptl; 3695 3696 entry = *pte; 3697 if (!pte_present(entry)) { 3698 if (pte_none(entry)) { 3699 if (vma->vm_ops) { 3700 if (likely(vma->vm_ops->fault)) /* here */ 3701 return do_linear_fault(

c# - VS2012 Debugger can watch variables from third party reference only once -

i sorry vague title, have trouble describing in 1 clear sentence issue, answers me both solution , knowledge surrounding it. so! i have small form application use test new dynamics 2013 web services. added third party reference microsoft.xrm.sdk.dll references. (i named specific dll, occurred me other third party dlls, wanted give bit more context) here small sample of code of line execute in application : retrieveallentitiesresponse response = (retrieveallentitiesresponse) m_orgproxy.execute(raerequest); console.write(response); the type retrieveallentitiesresponse's full type {microsoft.xrm.sdk.messages.retrieveallentitiesresponse} . basically, first time debug application, able watch variable , hover on it, etc. + response {microsoft.xrm.sdk.messages.retrieveallentitiesresponse} microsoft.xrm.sdk.messages.retrieveallentitiesresponse on other hand, let's stop application, restart , break @ same place, not able watch variable. response

php - File upload form does not work with large files -

i have pretty standard upload form. few text inputs, file upload input, recaptcha, , submit button. under normal use, can upload small file fine. form data redirected page in action attribute, , while bunch of things done in php , sql handles uploads. however, when trying upload 40 mb file, not work. @ first, thought captcha, since gave me errors failing type in correct words. after disabling captcha, found variables defined $_post['input'] not being passed through. php errors such as: notice: undefined index: name in /var/www/upload.php on line 18 where line 18 $name=$_post['name']; i 1 of these every input in form. this telling me post not being set because form not working when sending large files, question simply...why? , of course, what's solution? edit: relevant code: submit form: <form action="/upload.php" method="post" enctype="multipart/form-data"> <ul> <li> <in

android - How do I get Bitmap from a TransitionDrawable -

i have transitiondrawable bitmap need. when use getcurrent() drawable, apparently result still transitiondrawable . truth transitiondrawable created in class using final transitiondrawable td = new transitiondrawable(new drawable[] { new colordrawable(android.r.color.transparent), drawable }); where drawable bitmapdrawable. if try cast as bitmap bmp = (bitmapdrawable) transitiondrawable.getcurrent(); then class cast exception. for context, transitiondrawable in line 378 of imageworker of bitmapfun. transitiondrawable inherits layerdrawable can use finddrawablebylayerid(int id) specific drawable. example: using btn_toggle_bg.xml android sources (4.4.1) <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+android:id/background" android:drawable="@android:drawable/btn_default_small" /> <item android:id="@+android:id/toggle" android:drawable="@android:drawable/

java - indexOf null exception -

public int indexof(x item) { node <x> current = head; int c = 0; if (current.getvalue().equals(item)) { return c; } while (current != null) { current = current.getlink(); c++; if (current.getvalue().equals(item)) { return c; } } return -1; } . @test public void testindexof() { llist<string> b = new llist<string>(); (int = 0; < 20; i++) b.add("str" + i); assertequals(19, b.indexof("str0")); assertequals(0, b.indexof("str19")); assertequals(-1, b.indexof("not found")); } for reason last assertion bringing error nullpointer exception. made when reach null return -1, trying return in third assertion in test, missing here? the problem this: while (current != null) { current = current.getlink(); you ensure current not null . . . change current in way makes possible null again.

ios - Zooming in UIScrollView - Unable to zoom beyond single image and scroll -

i have array of images loading nsurl scroll in , pinch zoom. able implement scroll part when try zoom image beyond first one, scroll stuck , scale on image. here code: scrollview = [[uiscrollview alloc]initwithframe:cgrectmake(0, 100, screen_width, self.view.bounds.size.height)]; scrollview.showshorizontalscrollindicator = false; scrollview.maximumzoomscale = 4.0; scrollview.minimumzoomscale = 1.0; scrollview.delegate = self; [self.view addsubview:scrollview]; (int i=0; i<[listofimageszoom count]; i++) { imageview = [[uiimageview alloc] initwithframe:cgrectmake(leftmargin, self.scrollview.bounds.origin.y-100, screen_width, self.view.bounds.size.height-100)]; // [imageview setimage:[uiimage imagenamed:@"img_def.png"]]; nsstring *urlimage1 = (nsstring*)[listofimageszoom objectatindex:i]; nsstring *productimageurl1 = [urlimage1 stringbyreplacingoccurrencesofstring:@"~" withstring:@""]; nsstring *productimageurl2 = [productimage

c# - url rewrite : how to remove value from url and make seo friendly url -

url rewrites work me. there's 1 more thing: i wanted remove value url , parse seo friendly url for example: http://www.abc.com/bus/22/data-mapping-tech/loc want parse url this: http://www.abc.com/bus/data-mapping-tech/loc here, dont want response.redirect , all. how can handle in process level? i think looking asp.net routing. this enables programatically transport users pages correspond different more readable (seo friendly) path read more here on msdn

xml - google maps api v3 display different markers -

i'm trying display different markers depending condition every time. for example : if temp > 1 display "ilios" if humidity > 97% display "omixli" i trying create inside createmarker() function var marker1( code in comments ) cannot find way. does have idea how i'm gonna in or in different way? suggestion , examples , comments appreciated! var infowindow; var map; function initialize() { var mylatlng = new google.maps.latlng(38.822590,24.653320); var myoptions = { zoom: 5, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); downloadurl("moredata.xml", function(data) { var items = data.documentelement.getelementsbytagname("item"); (var = 0; < items.length; i++) { var description = items[i].getelementsbytagname("description")[0].childnodes[0

symfony - Composer use SVN fails - SVN was not found -

i have symfony2 project uses composer manage packages. want add package personal svn storage. repository configuration in composer.json. changed svn url show real 1 sake of not showing sensitive information in stackoverflow. running on windows 7 platform. have installed svn windows http://sourceforge.net/projects/win32svn/ "repositories": [ { "type": "package", "package": { "name": "jquery/jquery", "version": "1.9.1", "dist": { "url": "http://code.jquery.com/jquery-1.9.1.js", "type": "file" } } }, { "type": "svn", "url": "https://this-is-where-my-path-is" } ] when execute composer --verbose update i following result loading composer repositories package information

c# - Error propagation from wcf to asmx -

i have web method ( .asmx web service ), consume service method ( wcf service ). however, want write more logic within web method based on different type of custom exception thrown wcf service using faultcontract<t> . may able achieve if revise target framework of .asmx web service 2.0 3.x support generics. however, not advisable since web service been live , been used other legacy application @ client side. can advise me on how handle wcf custom exceptions within .asmx web method ?. not fuss having generic exception long shall able identify type of wcf fault in web method. note: trying achieve staged decommission approach individual .asmx web service shall replaced wcf counterpart. , prove stakeholders on how both web service , wcf service can coexists without impacting business. hope make sense. because you're restricted running in .net2 in order interoperate wcf service, service have use basichttpbinding. because basichttpbinding uses soap 1.1 communicate

winforms - C# Order a list of labels by location on screen -

how can order list of labels location on screen? labels move around screen in x axis, code have notice isn't working. labels.orderby(x => x.location.x); thank in advance! edit: how i'm testing if works or not... private void actualizarposicoes() { labels.orderby(x => x.location.x); messagebox.show(labels.first.value.text.tostring()); } but want use when label removed screen first have make orderby working. private void reorder(label lb) { labels.orderby(x => x.location.x); var = labels.getenumerator(); var node = it.current; while (it.movenext()) { var nextnode = it.movenext(); if (nextnode != null) { if (nextnode.equals(lb)) { nextnode = it.movenext(); it.current.location = new point(node.right, 0); } } node = it.current; }

javascript - Define a promise creating a new Service Object -

i have question promise system in angularjs , creation of services. have service called customer: angular.module("app").factory("customer", ["customerdbservices", "officeslist", "$q", function(customerdbservices, officeslist, $q){ return function(customerid){ var self = this; //attributes this.name = null; this.id = null; this.code = null; this.isvisible = 1; this.showoffices = true; this.offices = new officeslist(); //constructor if(typeof customerid !== "undefined"){ var metacustomer = customerdbservices.find({id:customerid}, function(){ self.name = metacustomer.results.customer_name; self.id = metacustomer.results.customer_id; self.code = metacustomer.results.customer_internal_code; self.isv

javascript - How to get the current value of attribute -

i have table gets data database, each column contains button gives review of particular row in modal box, modal box contains next , previous button, next gives details of next row of table , previous give previous data of row. question is: i able next , previous once? $('#review_essay').delegate('.navbtn', 'click', function () { var current_row_id = $(this).parents('#review_essay').attr('current_row_id'); var position_value = $(this).attr('position_value'); var navvalue = parseint(current_row_id) + parseint(position_value); alert(current_row_id) alert(position_value) alert(navvalue) var qid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('qid'); alert(qid); var uid = $('#essay_data').find('tbody').find('tr').eq(navvalue - 1).attr('uid'); var paper_id = $('#essay_data').find('tbody').f

android - How to create imageviews dynamically? -

Image
hello everyone. need create this,displayed in picture. have no idea how should implement it?. if press camera button , add photo - must added list. i think create row of invisible imageview , initialize them when needed, think bad solution. you can use way create imageviews dynamically: imageview iv=new imageview(context); iv.setid(id); iv.layout(l, t, r, b); l,t,r , b specify padding left,top,right , bottom respectively can add imageview respective layout

security - PHP Login page and home page in single page, is it advisable? -

i have simple web app , did login page , homepage in 1 page. here scene: #php login script goes here inc. database config , authentication if(!login()) { <html> <head> <title>homepage</title> <css goes here> <js goes here> <body> [ login form goes here ] </body> </html> } else { #php main page script goes here inc. database config , authentication <html> <head> <title>homepage</title> <css goes here> <js goes here> <body> [ main page if login ] </body> </html> } my question is, advisable chop instead of redirecting different/success page? affect speed , security or vulnerability? there vulnerability if form posts index.php . this because susceptible in following scenario: alice logs in , views logged in home page news. alice's login session times out. alice goes lunch. carol loads browser's developer tools , clicks refresh. the browser res

ios - Rational Test Workbench iPhone - could not merge original binaries could not merge instrumented binaries -

below given environment specification of system system: macbook pro os x version: 10.8.5 worklight: 6.1 emulator: 6.1 build ios: 6.1 have installed mobile test workbench 8.5.1.2 in eclipse-kepler i followed instruction on page @ url: https://pic.dhe.ibm.com/infocenter/rtwhelp/v8r5m0/index.jsp?topic=%2fcom.ibm.rational.test.lt.moeb.doc%2ftopics%2frvar_select_device.html but when try instrument , install iphone app simulator error occurs every time. here have copied error log terminal says: could not merge original binaries not merge instrumented binaries ------ start localization folder creation ----- found localization files in: /users/sarfaraz/documents/workspace/sumapp/apps/sumapp/iphone/package/sumapp-1.0-iphone/resources/localizations.bundle/ print: entry, ":cfbundledevelopmentregion", not exist ------ localization folder created 51235 blocks 51235 blocks print: entry, ":rmotuid", not exist print: entry, ":cfbundleiconfile",

java - xml (activity) stays open in the back ground when it should close -

i making quiz android app using eclipse , made every question has own activity, works ok if answer qustions slow if faster xml stays open in background added onpause method still open. not know how use threads told me make app faster xml close. hope there easy fix problem if not, can explain me how use threads. here 1 of xml layouts: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/qh4" tools:context=".pov6" > <textview android:id="@+id/povrat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_margin

Use Java Pattern to extract word between HTML tag with attributes -

i using java pattern & matcher extract words between 2 tags. my code like: final pattern pattern = pattern.compile("<([a-za-z][a-za-z0-9]*)\\b[^>]*>(.*?)</\\1>"); list<string> topicarray = new arraylist<string>(); final matcher matcher = pattern.matcher("<city count='1' relevance='0.304' normalized='shanghai,china'>shanghai</city>"); while (matcher.find()) { topicarray.add(matcher.group(1)); } the system gives me city output instead of shanghai. what's wrong it? thanks you can try next: private static final pattern regex_pattern = pattern.compile("<[^>]*>([^<>]*)<[^>]*>"); public static void main(string[] args) { string input = "<city count='1' relevance='0.304' normalized='shanghai,china'>shanghai</city>"; system.out.println( regex_pattern.matc

cordova - Best way to distribute Cloud HTML5 App -

i thought phonegap simple wrapper html5, looks in fact compile native in way. i have cloud based, html5 single page web application want run full screen, , distribute via app store. should create phonegap app inappbrowser? if intend publish html5-based app in "native" app store sucha s google play or apple store, have 2 options: 1- implement own native application using webview show web-based app. 2- use existing framework phonegap/cordova not use native api. framework setup deploy html5 code. however, if web app meant hosted remotely (i.e. not run local files), may encounter problems when trying publish in apple store. have strict rules remote content, , publishing apps may not provide more value and/or functionality simple web-app can. best.

php - Insert a post type every x posts in custom loop -

i hoping me problem. i'm trying make loop in wordpress 2 different post types ('product' , 'outfits') the code below working fine, outputs list of 2 post types ordered newest older. $loop = new wp_query( array( 'post_type' => array( 'product', 'outfits' ), 'posts_per_page' => 15 ) ); $counter = 0; ?> <?php if ( $loop->have_posts() ) { while ( $loop->have_posts() ) { $loop->the_post(); $counter++; ?> <?php $loop->is_home = false; ?> <?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->id), 'large'); $titulo = get_the_title(); $content = apply_filters ('the_content', $post->post_content); ?> <div class="caja-<?php echo $counter; ?>">

css3 - How can I do this CSS transform with jQuery? -

i using transit.js before, works beautifully, reduce script dependancies want myself. have searched everywhere no avail. before: main.stop().transition({ x: -thex }, 600) now (which doesn't work): main.animate({ borderspacing: -thex }, { step: function(now,fx) { main.css('transform',"translatex("+now + "px) translatez(0)"); }, duration:600 }); what doesn't work snaps correct position no animation, , reason animates out (in other direction) 10px. any ideas? of if know of way css transform jquery/css/less dynamic value, let me know!

asp.net mvc - Bad day fixing references in mvc 5.1 app -

i have problem visual studio , nuget package manger i running when project stopped compile telling me applicationdbcontext should derive dbcontext or that, couldn't see problem cleaned solution rebuilt project compiled had stupid runtime erros searched stackoverflow , web , found out reference error in first place removed bin folder described here in question higher version referenced assembly then went bad tried remove references , re-install them manually nuget pmc kept telling me project had reference assembly,, closed visual studio re-cleaned project , done once again no results! so question here how re-install latest version of compatible asp.net mvc 5.1 without getting message telling me project has reference assemblies nonsense ! i had happen every 1 of projects upgraded mvc 5.1. had add binding-redirects web.config. package manager console easy. http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#add-bindingredirect

Javac fails to find symbol when wildcard is used, but works when .java file is manually specified -

Image
when compile compiler code: @echo off javac -d bin -sourcepath src/*.java src/sign/*.java src/alert.java pause i don't errors. when compiler code @echo off javac -d bin -sourcepath src/*.java src/sign/*.java pause i errors the alert.java first file have tried one navigate src directory javac -d ../bin *.java sign/*.java all required jars , dependencies must set in class path before compilation or can use -classpath option while compiling. --edit-- try 1 without -sourcepath option javac -d bin src/*.java src/sign/*.java

c++ - How can you get more detailed exception information from a vectored exception handler? -

in windows application, if have vectored exception handler: long winapi vectoredexceptionhandler(pexception_pointers exception) { } ...and add in this... addvectoredexceptionhandler(1, vectoredexceptionhandler); if handler called, contextual information on exception such exception code, exception->exceptionrecord->exceptioncode , exception information, exception->exceptionrecord->exceptioninformation . how translate information string type (such tchar) tells user exact problem occurred was? example, if write mini-dump using winapi method, minidumpwritedump write dump file, show details in dump file: exception code: 0xc0000005 exception information: thread tried read or write virtual address not have appropriate access. i can convert exception code quite easily, how such detailed exception information? exception->exceptionrecord->exceptioninformation , in environment ulong_ptr (windows 8.1 x64 running application built in release / x64 p

c# - ListView showing System.Data.DataRowView instead of DataTable -

my problem every row of listview shows "system.data.datarowview" after change listview template style. i've defined datatable here: datatable data = new datatable(); lsvoutput.itemssource = data.defaultview; this xaml columns: <listview.view> <gridview> <gridviewcolumn header="column1" displaymemberbinding="{binding column1}"/> <gridviewcolumn header="column2" displaymemberbinding="{binding column2}"/> <gridviewcolumn header="column3" displaymemberbinding="{binding column3}"/> </gridview> </listview.view> this part breaks i'm assuming: <contentpresenter horizontalalignment="{templatebinding horizontalcontentalignment}" verticalalignment="{templatebindin

PHP converting mysql to excel -

Image
working on php converting excel, having problems in excel file doesn't add each row in own cell. here how looks: https://www.dropbox.com/s/64lz7lqy8z7x72j/export.csv writes on first cell , looks has written of cell. and here php code: <?php $conn = mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db('chart', $conn) or die(mysql_error($conn)); $result = mysql_query('select * chartgoogle', $conn) or die(mysql_error($conn)); header('content-type: text/csv'); // tell browser treat file csv header('content-disposition: attachment;filename=export.csv'); // tell browser download file in user's system name export.csv $row = mysql_fetch_assoc($result); // column names if ($row) { outputcsv(array_keys($row)); // wil pass column names outputcsv function } while ($row) { outputcsv($row); // loop used fetch rows table , pass them outputcsv func $row = mysql_fetch_assoc($result

amazon web services - Creating multiple sub accounts in IAM AWS -

i have parent iam account , have multiple clients. want have multiple child account in aws. dont want child account see resources in parent account , other child account. how can implement this? thanks you can create multiple aws accounts, , link them. have master account root credentials, not iam account. full details here: http://docs.aws.amazon.com/awsaccountbilling/latest/about/consolidatedbilling.html update, q1 2017: aws has introduced organizations, lets create new account linked payer account. organizazions supported aws cli, can create new accounts programmatically, whithout needing root credentials.

javascript - How to clear a timer in setInterval function with on click trigger? -

i've wrote code: var timer = 0; $('.tour-slider').on('click', 'li a', function(e){ e.preventdefault(); $(this).closest('.slider').hide(); var sliderhref = $(this).attr('href'); $(sliderhref).fadein(); if(sliderhref == '#slider-1'){ anim1.pause(); anim2.pause(); anim3.pause(); anim1.start(); }else if(sliderhref == '#slider-2'){ anim1.pause(); anim2.pause(); anim3.pause(); anim2.start(); }else if(sliderhref == '#slider-3'){ anim1.pause(); anim2.pause(); anim3.pause(); anim3.start(); } }); function slideshow(){ $('#slider-1').siblings().hide(); anim1.start(); timer = setinterval(function(){ $('.slider:visible .active').next('li').find('a').trigger('click'); $('.helper').first().removeclass('helper'); if (!$('