Posts

Showing posts from May, 2014

Deep copy of object c++ overloading operator assignment -

i trying understand deep , shallow copy concept , apply it. class composed of :int* num, bool signe , int pos. copy not working well, know why? cbigint & operator= (const cbigint & other) { if (this != &other) { int * new_array = new int[30000000]; std::copy(other.num, other.num+ other.pos+ other.signe, new_array); delete [] num; num = new_array; pos = other.pos; signe=other.signe; } return *this; }

android - Application build error phonegap -

i trying create hello world application android using phonegap , beginning phonegap development. have setup environment variables , done project created when run following error d:\hello\example\fuckhead>phonegap run android [phonegap] detecting android sdk environment... [phonegap] using local environment [phonegap] adding android platform... 'c:\users\ram' not recognized internal or external command, operable program or batch file. [error] cmd: command failed exit code 1 have come across such problem . or if have idea why error causing please let me know. thank in advance. make sure have given ant build path in environment variables , sdk path. both wonder

C++ Pointer to Pointer -

im trying pointer pointer dynamic array elements pointer "figurasgeom" how can it? started pointer pointer im not sure if ok.. figurageom ** lista; is there way make dynamic array without using "vector"? i have dont know how implement it figurageom* vectr []; thank in advance! based on description, left vector part out, need this: vector<figurageom*> **lista; but weird data representation, @ least in c++. should start working more higher-level containers and/or smart pointers in c++.

user interface - Writing to and reading from an ArrayList using java with NetBeans GUI -

what im trying code college project creating app using netbeans, adding information players in ryder cup. have text fields variables(team, name, dob, home, college, prof, years, matches, won, captain, pga, champion , intern) on gui, when gui save , read add in info players, ill delete text fields , save button. what want whole page when user clicks radio button either team usa or team europe, info players in team appear. im thinking of using labels display each players info. so stuck on save , read part. when add in info first player , save it, works. if add in players info, read first players info. not sure how save next array list , not on top of first array list object. i hope have made clear trying do. appreciate help, thank you! //my instantiable class code package rydercup; import java.io.serializable; public class players implements serializable { private string team; private string name; private string dob;//date of birth , age private string hom

PHP nested array from flat MySQL query result -

i need create line chart using highcharts.com js. plugin requires json data following structure: series: [{ { name: 'book 2', data: [ 1970, 120, 2001, 50, 2005, 180, 2014, 50 ] }, { name: 'another book', data: [ 1970, 120, 2001, 50, 2005, 180, 2014, 50 ] } }] (the data example) i want query needed data mysql database. data extracted meekrodb.com library in php. $results = db::query("select booktitle, editionnr, year editions"); the query far outputs flat array: ( [0] => array ( [booktitle] => booktitle_a [editionnr] => 11 [year] => 2012 ) [1] => array ( [booktitle] => booktitle_a (the same) [editionnr] => 12 [ye

javascript - How to call a image class on a regular interval -

i having 4 classes inside each class image called <div id="ban01" class="banner ban01"> </div> <div id="ban02" class="banner ban02"> </div> <div id="ban03" class="banner ban03"> </div> <div id="ban04" class="banner ban04"> </div> and css class contains .ban01 { background-image:url(../images/banner/01.jpg); } .ban02 { background-image:url(../images/banner/02.jpg); } .ban03 { background-image:url(../images/banner/03.jpg); } .ban04 { background-image:url(../images/banner/04.jpg); } and jquery $(document).ready(function () { var totdivs = $(".banner ban03").length; var currdiv = 0; var myinterval = setinterval(function () { if (currdiv > totdivs) { clearinterval(myinterval); return } $(".banner ban03").eq(currdiv).find('class').trigger("click");

python 2.7 - How to concatenate XPath in scrapy -

i struggling quite time on issue. table need extract annual div instead of annual div yield . <table class="horizontaltable col1of3 lastcol"> <tbody> <tr class="first"> <th>annual div <span class="sub">(ttm)</span></th> <td>5.49 <span class="currencycode">gbx</span></td> </tr> <tr> <th>annual div yield <span class="sub">(ttm)</span></th> <td>6.04%</td> </tr> <tr> <th>div ex-date</th> <td><span class="nowrap">sep 25 2013</span></td> </tr> <tr class="last"> <th>div pay-date</th> <td><span class="nowrap">nov 22 2013</span></td> </tr> </tbody> </table> i wrote xpath query bringing both annual div

ios - Finding the position of UIPanGestureRecognizer -

i have uipangesturerecognizer added view controller. want able swipe go next view controller (kind of camera on ios lockscreen). my problem don't know how find position of view being panned. if user passes length , lets go want go next view controller. if user hasn't reached length , lets go want view go default state before panned up. i know locationinview haven't been able work in in scenario. i know need use uigesturerecognizerstatechanged , uigesturerecognizerstateended these things, don't know how find position , set position. thanks. here code: - (void)pangesture:(uipangesturerecognizer *)recognizer{ if (recognizer.state == uigesturerecognizerstatechanged) { cgpoint t = [recognizer translationinview:self.view]; if (t.y < 0) { t = cgpointmake(0, t.y); } else { t = cgpointmake(0, t.y); } //look @ recognizer.view.center = cgpointmake(recognizer.view.cent

How to adjust the position of absolutely positioned element using jquery? -

that's use attempt. first pieces of adjustment work fine, visibility , color. position doesn't want adjusted. i tried $('#feedback_message_signup_final').css({"visibility": "visible", "color": "#347c17", "position": "absolute", "left":"22.8%"}); and this $('#feedback_message_signup_final').css({"visibility": "visible", "color": "#cc0000", "left":"25.8%"}); they different variables idea same , won't work in both cases. what's error? typically when run problems positioning (especially after elements have been display:none'd) -- comes initial dom render doesn't know actual width/height/position of invisible element be. seems rear head on me when use percentages instead of fixed pixels on these elements. can try fixed pixels instead of percentages?

android - Androidannotations RestErrorHandler not called in RestClient Robo Spice Request -

i configured resterrorhandler in restclient: restclient.setresterrorhandler(restclienterrorhandler); but it's not called. i debugged code , see in generated restclient_ class resttemplate.exchange throwing exception, try catch calls resterrorhandler being generated response.getbody() , not entire method. is bug in androidannotations or doing wrong? i'm using androidannotations restclient inside robo spice request. thanks! this aa issue has been fixed today :) may use snapshot until release new version.

javascript - How to show pop-up then user close page use js -

i have broblem. situation - user first time visited in site. user want close page (not go anover page, close). site have pop comprising offer discounts. i need show pop befor user left site. use onbeforeunload method. window.onbeforeunload = function(){ return 'your message here.'; };

Simple twitter timeline iOS (only read tweets for no register user) -

i want twitter timeline displayed in view, without user having put twitter account, simplemete read tweets , hashtag, of accounts have selected during programming of app. possible? can find info this? see includes login in twitter. thank you. you can use sttwitterapiwrapper firstly using twitter must create app , because must use key , secret of app in code. for example : sttwitterapiwrapper *twitter = [sttwitterapiwrapper twitterapiapplicationonlywithconsumerkey:yourtwitterconsumerkey consumersecret:yourtwitterconsumersecret]; [twitter verifycredentialswithsuccessblock:^(nsstring *username) { nsdictionary *parameters = @{@"q" : @"anyhashtag", @"result_type": @"recent", @"count": @"100"}; [twitter getsearchtweetswithquery:parameters successblock:^(nsdictionary *searchmetadata, nsarray *statuses, nsstring *refreshurl) { _refreshurl

php - Fetching data with PDO returns duplicate results -

i have code: ... $query->setfetchmode(pdo::fetch_into, $this); $query->execute(); $data = array(); while ($row = $query->fetch()) { $data[] = $row; } return $data; if put var_dump here: var_dump($data); return $data; this result: array (size=3) 0 => object(chatroom)[4] public 'id' string '3' (length=1) ... 1 => object(chatroom)[4] public 'id' string '3' (length=1) ... 2 => object(chatroom)[4] public 'id' string '3' (length=1) ... if put var_dump here: while ($row = $query->fetch()) { $data[] = $row; var_dump($data); } this result: array (size=1) 0 => object(chatroom)[4] public 'id' string '1' (length=1) ... array (size=2) 0 => object(chatroom)[4] public 'id' string '2' (length=1) ... 1 => object(chatroom)[4] public 'id

javascript - Prevent underlying div from scrolling in iOS Safari -

Image
i have div 100% height, 70% viewport height, , overflow:scroll . now want create overlaying div touch devices can use scroll whole page instead of div . i created div position:absolute , full page height. if android users drag on div , whole page scrolls, expected. however, on ios7 underlying div scrolled, touch event goes right trough div . jsfiddle .scrolldiv{ width:100%; height:200px; overflow-y:scroll; border:solid 1px #f00; -webkit-overflow-scrolling: touch; } .pagescroller{ position:absolute; right:0; top:0; bottom:0; width:50%; background-color: rgba(0,0,0,0.7); } if use ios7 , drag on page div on scrolling div , scrolling div scrolled instead of page. does know solution this? on .pagescroller scroller element, add overflow-y: scroll; , -webkit-overflow-scrolling: touch; attributes, postive z-index . prevents scroll action reach "layer" beneath. .pagescroller{ position:absolute;

haskell - How to tap into hpc information during execution -

consider following use case: have quickcheck test suite consisting of 2 test cases prop_testcase1 , prop_testcase2 . using hpc can observe code coverage of test suite. however, i'd separate results coverage of prop_testcase1 , prop_testcase2 (to further process results). 1 way out run executable several times explicitly specifying test case command line argument , process generated tix file after each run. yet, prefer hide away logic in library. in reality run more 2 test cases. explicitly re-executing binary each test case seems rather inconvenient. @ same time i'd imagine hpc keeps coverage data in kind of intermediate data structure during program execution. question: there way recognize program has been compiled hpc symbols , somehow access data hpc generates @ runtime? i think found way achieve desired effect. required functions provided trace.hpc.reflect module. unfortunately documentation lacking. nevertheless, here minimal example seems work:

javascript - How can I give a customer a non-refundable credit towards their subscription using the Stripe API? -

my app charges premium customers $x.00 per month, however, actions give customers credit against monthly subscription fee. example, if customer submits record database, given credit (stored in database). each credit earn give them $0.50 off of next month's subscription, however, if cancel subscription, not want seem owe them money (it should usable towards subscription fees). best way achieve through stripe api? if makes difference, using rails 4, ruby 2, stripe, koudoku subscriptions, , devise authentication. thanks! you want set app handle stripe web hooks if haven't done so. when new invoice created, if have web hook url set up, notify via hook , wait hour before processing payment. design setup want. when notified invoice has been created, if there credits user, create 1 or more negative invoice items represent credits. since aren't creating credits in stripe until right before payment processing, scenario of them canceling credit doesn't apply.

python - Django serving images from database -

i adding trying app serve image fields in database display in template. wondering if there way bypass having use global media dir/url setting, sake of organization. in modal have set , upload option. id use url mapping app regex named groups tell view path , image name is. concatenate string , serve file. if terrible idea, or grossly inefficient, i'll else. appreciated. here have far. template:` {% category in items %} <div class="col-sm-4 col-lg-4 col-md-4"> <div class="thumbnail"> <img src="{{ category.picture }}" /> <div class="caption"> <h4 class="pull-right">${{ category.price }}</h4> <h4><a href="#">{{ category.itemname }}</a> </h4> </div>

For loop vb.net increase -

i have got small question.if made loop increase myvar value 30 if remainder of division 0. dim myvar integer = 49 integer = 0 myvar console.writeline("pasada " & i) if math.ieeeremainder(i, 3) = 0 myvar += 30 end if next how can make change repetitions new value of myvar?? why don't use loop dim myvar integer = 49 dim integer while <= myvar console.writeline("pasada " & i) if math.ieeeremainder(i, 3) = 0 myvar += 30 end if +=1 loop

php - phpdoctrine save collection of differents entities -

i have interface: interface product { function getamount(); } and php doctine entities: /** * @orm\table(name="orders") * @orm\entity */ class order { private $products = array(); public function addproduct(product $product){ $this->products[] = $product; } public function getproducts() { return $this->products; } function getamount() { $amount = 0; foreach ($this->products $product) { $amount += $product->getamount(); } return $amount; } } /** * @orm\table(name="books") * @orm\entity */ class book implements product { function getamount() { return 1; } } /** * @orm\table(name="pens") * @orm\entity */ class pen implements product { function getamount() { return 2; } } book, pen - different entities , table. how implement relationship order::products collection of books, pens, etc(for save in da

Converting Directx 11 project to work on Windows 8.1 Directx 11.2 -

i'm trying run sample project supplied frank luna (introduction 3d game programming directx 11.0). http://www.d3dcoder.net/d3d11.htm i'm using windows 8.1 windows 8 sdk installed - on visual studio 2012 (as read windows 8.1 sdk includes direct x 11.2). whenever try run project following build errors: error 1 error c1083: cannot open include file: 'd3dutil.h': no such file or directory c:\users\ryan willis\desktop\dvd\code\chapter 14 building first person camera\camera\vertex.h 10 1 camera error 2 error c1083: cannot open include file: 'd3dutil.h': no such file or directory c:\users\ryan willis\desktop\dvd\code\chapter 14 building first person camera\camera\renderstates.h 10 1 camera error 3 error c1083: cannot open include file: 'd3dutil.h': no such file or directory c:\users\ryan willis\desktop\dvd\code\chapter 14 building first person camera\camera\effects.h 11 1 camera error 4 error c1083: cannot open incl

html - Type or namespace not found -

hello doing assignment , program using visual studio 2012 lab getting error in behind code in .cs file error giving me line 20 , compilation error message says the type or namespace name 'player' not found (are missing using directive or assembly reference?). please me line 18: protected void addplayer(string name, int jersey, string team){ line 19: line 20: player player = new player(name, jersey); line 21: line 22: if ( string.equals(team, "team 1", stringcomparison.ordinalignorecase)) my whole code public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } protected void addplayer(string name, int jersey, string team){ player = new player(name, jersey); if ( string.equals(team, "team 1", stringcomparison.ordinalignorecase)) listteam1.items.add(player.getname() + "-" + player.getjersey()); else if (strin

Xamarin.Android SetContentView throws error -

Image
i'm working on android app supposed run on android 2.1 till latest (4.4 right now). worked fine until now, since app decided stop running on android 2.2 device. in attached image think you're supposed know able me. don't know causing this, since app runs fine on android 4.3.1 device. error this: "binary xml file line #25: error inflating class android.support.v7.internal.widget.actionbarview" it gives error @ setcontentview(resources.layout.main);, worked fine until now. i've removed main.axml file , readded it, nothing changed, should change? main.axml file code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="12dp"> <framelayout android:id="@android:id/co

bitmap - Android: lossless WEBP compression -

i compressing image in webp-format following code: bitmap.compress(bitmap.compressformat.webp, 100, outputstream) although using highest quality-settings, looks image not compressed lossless lossy . corresponding android developer docs, should possible compress webp-files lossless: http://developer.android.com/guide/appendix/media-formats.html http://developer.android.com/reference/android/graphics/bitmap.compressformat.html i doing on nexus 4 android 4.4.2 kitkat. furthermore using highest sdk throughout in project. has got idea, how save bitmaps lossless webp-images?

android - is it possible to write a surface view without creating thread? -

i want write surface view without creating thread. possible create surfaceview ,without calling thread. if possible, please provide me simple example. your question doesn't entirely make sense me, i'll try answer think you're asking. yes, can draw on surfaceview without creating dedicated thread. not recommended approach; should rendering off main thread app doesn't become slow respond, it's not absolute requirement. i don't know if counts "simple" example, grafika's "multi-surface test" draws on 3 overlapping surfaceviews ui thread. these static images, drawn once, there's not need separate thread. if start animation on 1 of surfaces (with "bounce" button) kicks off new thread, because it's easier manage way.

java - How to avoid an unchecked cast when using unbounded generified static functions in a ternary? -

i trying figure out if there way avoid unchecked cast in function (using java 7): private static <o> valuevalidator<o> newforalways(always valid_orinvalid) { @suppresswarnings("unchecked") valuevalidator<o> vldtr = (valuevalidator<o>)(valid_orinvalid == always.valid ? newforalwaysvalid() : newforalwaysinvalid()); return vldtr; } here signatures of 2 functions being returned: private static <o> valuevalidator<o> newforalwaysvalid() { private static <o> valuevalidator<o> newforalwaysinvalid() { (and here's always enum, boolean substitute: enum {valid, invalid;}; ) all 3 functions have same return type , contain unbounded generic. these 2 questions explain why happens, although both bounded generics: why doesn't ternary operator generic types bounded wildcards? generics compilation error ternary operator in java 8, not in java 7 so though works valuevalidator<integer

eclipse - Android Maps V2 API: Authentication Failure for some users, but not all -

i'm having issue android maps v2 displaying blank screen of users. have 100k users using app, there small percentage complain can not see app (blank) no matter do. have had them restart app , clear google play store data in hopes it'll work. i have looked @ logs(snippet below) , see classic "authorization failure". @ first thought perhaps user did not have valid internet connection, i'm checking online, plus make web calls work. suspected did not have google play services installed/enabled, do. questions: 1. there problem using android maps v2 api in other countries not know about? 2. suspected @ 1 point these users have proxy in place, google prevent downloading map under conditions? 3. see "04-06 14:57:19.804 e/googleplayservicesutil( 7295): google play services resources not found. check project configuration ensure resources included." in logs well, have read in several locations ignore error. should more that? 3. i'm fresh out of ideas,

javascript - Find if 'cancel' was clicked on file input -

i tried using hack described in various locations uses: document.body.onfocus = checkoncancel(); an example: var fileselectele = document.getelementbyid('fileinput'); fileselectele.onclick = charge; function charge() { document.body.onfocus = checkoncancel; } function checkoncancel() { alert("filename:" + fileselectele.value + "; length: " + fileselectele.value.length); if(fileselectele.value.length == 0) alert('you clicked cancel!') else alert('you selected file!'); document.body.onfocus = null; } is there wrong here? because fileselectedele.value returns previous execution value , not 1 selected user. expected behavior of input file? how resolve read actual file selected? http://jsfiddle.net/smv9c/2/ you can reproduce error by: step 1: selectfile - select file (and notice output) step 2: selectfile - press cancel (and notice output) one solution use onchange event of input . var filese

node.js - Simple flow control in NodeJs -

i've read through number of examples , tutorials , although know solution simple can't brain wrapped around it. here appreciated. i have 2 functions in node. functiona() takes no arguments , returns string in english. second, functionb(english) takes english string returned funcitona() , translates language. i believe callback best solution here life of me can't figure out best structure be. thanks in advance. i'm little unclear you're looking (you might overthinking things) consider following illustrates 4 ways of these functions being called , calling amongst themselves. clarification, should note not writing node-style callbacks, take form callback(err,result) in err evaluates false if there no error. don't have write own callbacks way, although tend myself. // 'functiona' function getmessage(){ return 'hello'; }; // 'functionb' function francofy(str) { var result; switch(str){ case 'hel

c# - In which scenario would EndSend receive a SocketException? -

according msdn socket.endsend method can throw socketexception socket using connection-orientated protocol. when ? i tested couple of scenarios , none threw socketexception . scenario 1: app calls beginsend , , while it's sending data, app calls begindisconnect/disconnect result: socket doesn't send fin until data sent, , endsend successful. scenario 2: app calls beginsend , , while it's sending data, socket receives rst remote endpoint. result: socket stops sending data, calls callback , endsend successful reporting bytes have been sent. don't understand why ? when socket.endsend method throw socketexception on connection-orientated protocol ? i know raise error if connection severed (as opposed orderly shut down). should able reproduce behavior pulling network cable. if can't, please post code.

d - How to set methods private to module? -

i have 2 d classes in 1 module. class have property, can accessed class , class b. how this? class { int = 5; // make accessible to, , to, b. } class b { this(in pa) { int b = pa.a; } } private private module, not class. so, marking symbol private makes stuff in module can access it. package makes stuff in same package can access symbol. protected makes stuff in class , in classes derived class can access symbol (unlike others, protected makes no sense outside of classes). public makes can access symbol. private , package functions never virtual, whereas protected , public functions virtual unless compiler able determine don't need (which @ point, can pretty happen when function final , doesn't override function in base class). so, long 2 classes in same module, , members private, can access each others members - can else within module - nothing outside module can access them. there no way restrict access within module e

php - Laravel Raw query paginate; raw query to eloquent object -

select '0000-00-00' date, 'opening balance' narration, (select debit `account_sub_journal` id=1)as debit, (select credit `account_sub_journal` id=1)as credit, '0' transaction_entry_id,'0' account_sub_journal_id union select * `ledgertransactions` account_sub_journal_id = 1 , `date` between '2014-04-01' , '2014-04-10' i static function in model. couldn't paginate since laravel says not object public static function ledgerbook_to($account_id,$date){ $book = db::select( db::raw("select '0000-00-00' date, 'opening balance' narration, (select debit `account_sub_journal` id =1) debit, (select credit `account_sub_journal` id = :account_id) credit, '0' transaction_entry_id, '0' account_sub_journal_id union select * `ledgertransactions` account_sub_journal_id =:account_id_t , `date` <= :date_to "), array( 'account_id' => $account_id,'account_id_t' =>

sml - Is it possible to do pattern matching without case? -

i'm still learning sml, apologies if rather dumb question. wondering if there better way pattern matching on constructs outside of functions. for example, let's have type type coord = int * int * int and have value b of type coord . understand can pattern matching in functions, example: fun get_x_coord ((x, y, z) : coord) = x but let's we're working b inside of function not given parameter. feel doing case b of (x,y,z) => (* stuff *) is rather clunky if have single result want (for example know there 3 integer values , want isolate them). is there better way this? sure - can use pattern matching in val -bindings too, this: fun foo (b : coord) = let val (x, y, z) = b in (* stuff *) end

java - How to parse JSON object without tag -

how parse json array without object tags? how can files? { "id": "476", //idобращения"status": "2", //Статус: 0=>'Нарассмотрении', 1=>'Вработе', 2=>'Выполнено', 3=>'Отклонено'"latitude": "56.007831", //геокоординаты, заданныеприподачеобращения"longitude": "35.970359", "message": "dfghdfgh", //текстобращения"published_at": "2014-01-30 18:13:29", //датаподачиобращения"comments": [ { "id": 133, "message": "aaa", //тексткомментария(админ/пользователь)"isadmin": "0", //ответданадминистратором(isadmin=1)"curr_status": "1"//статусобращениянамоментответа }, { "id": 134, "message": "112&

python - Clean retry in deferred.defer -

i using deferred.defer quite heavily schedule tasks using push queues on appengine. sometimes wish have clean way signal retry task without having raise exception generates log warning . is there way this? if raise deferred.singulartaskfailure set error http-status, there won't exception in log.

java - What Is Faster One Port Per User, Or All Users On One port -

what faster realtime game server, 1 port per user on server in each user passed thread , receives port assignment, or 1 port per user in each thread handed socket after being established on main thread? it's not question of 'faster'. once connection established doesn't matter. real issue first alternative not implementable without lot of code in slow things down in connect phase. tcp server socket listens on single fixed port clients know about, , connect port. if want move them port have open it, tell them port is, , accept connection. it's pointless.

jsp - URL pattern mapping -

i have jsp url pattern /data/viewableimage.jsp is there way in url pattern have jsp called if user not include .jsp part of url? so if navigate /data/viewableimage page still called? thanks if put jsp pages in common path /web-inf users won't able request jsp pages , can use servlet add jsp extension. <servlet> <servlet-name>data</servlet-name> <servlet-class>com.mypackage.jspaggregationservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>data</servlet-name> <url-pattern>/data/*</url-pattern> </servlet-mapping> the jspaggregationservlet servlet have forward request jsp page including en .jsp extension. request.getrequestdispatcher("/web-inf" + request.getpathinfo() + ".jsp").forward(request, response); example: request /data/car/search response: /data/car/search.jsp

python - Trouble Installing Pillow: Why Am I Receiving Errors? -

i'm attempting install pillow via pip (i.e. sudo pip install pillow ) without success. can tell me problem is? here errors receive: clang: error: unknown argument: '-mno-fused-madd' [-wunused-command-line-argument-hard-error-in-future] clang: note: hard error (cannot downgraded warning) in future error: command 'clang' failed exit status 1 ---------------------------------------- cleaning up... command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-l7hshg-record/install-record.txt --single-version-externally-managed --compile failed error code 1 in /private/tmp/pip_build_root/pillow try with sudo archflags=-wno-error=unused-command-line-argument-hard-error-in-future pip install pillow you see lot of warnings w

malloc - declare memory to struct in c -

i have struct abc in 1 file struct abc { variaables , functions } i using struct in other file follows : struct abc *t = kmalloc(sizeof(struct abc)); kmalloc equivalent malloc then following errors occur: expected '=', ',', ';', 'asm' or '__attribute__' before 'struct' error: variable 't' has initializer incomplete type warning: implicit declaration of function 'kmalloc' invalid application of 'sizeof' incomplete type 'struct trapframe' storage size of 't' isn't known where going wrong? 1, 2, 4 , 5 errors caused missing ; @ end of struct declaration. must be: struct abc { variaables , functions }; 3 error caused missing including of include/linux/slab.h file. have add below file @ head of source code file: #include < linux/slab.h> # please remove space before "linux"

Wait for chrome.tabs.update tab to finish loading -

i'm trying work on chrome extension , trying clean of code relying on sendmessage. callback function activates before page has finished loading in case of new tab, nobody receives , in case of existing tab page being moved getting message (but isn't want). i've looked other people asking problem new tabs , there wasn't clear answer, best suggestion i've seen create global variable , create listener tab loads , compare against global variable. so question is, there way wait in callback function until page has loaded, or create array of js objects contain tab i'm waiting on , information want send tab. for reference here relevant code in background javascript file. chrome.tabs.sendmessage(tab.id, {info: "info"}, function(response) { //this line isn't used when navigating without changing tabs chrome.tabs.create({url: response.info.linkurl}, function(tab1) { chrome.tabs.update(tab1.id, {url: response.info.linkur

ruby on rails - Made a blog application in Mac terminal window. How do I see it in text editor? -

this may seem dumb question. started ruby on rails class , first assignment create blog. did that, teacher tells @ application in text editor. using textwrangler mac. how see application in text wrangler. open textwrangler , search name of application called blog?

How can I discover the model of a smartphone or tablet with Javascript? -

i website show mobile visitors device make , model recognized. aware of javascript scripts tell me whether device mobile phone or tablet, need here actual make , model (htc one, blackberry storm, , on). aware of tools such wurfl, require me perform sort of php development seems overkill kind of feature. am asking much? luca passani, wurfl inventor here. company launched service pretty solves problem mentioned free of charge. advise check out http://wurfl.io/ in nutshell, if import tiny js file: <script type='text/javascript' src="//wurfl.io/wurfl.js"></script> you left json object looks like: { "complete_device_name":"google nexus 7", "is_mobile":true, "form_factor":"tablet" } (that's assuming using nexus 7, of course) , able things like: if(wurfl.form_factor == "tablet"){ //dostuff(); } or modelname = wurfl.complete_device_name this looking for. please

Ruby: String#strip which whitespace characters? -

which whitespace characters string methods lstrip , lstrip! , rstrip , rstrip! , strip , strip! remove? horizontal/vertical tabs, newlines, page/form feeds, carriage returns, , spaces. for ascii strings, strip methods use string class's ascii_isspace method, looks character in isspacetable . this table identifies character codes 9-13 , 32 whitespace. .

javascript - AJAX whenever I try to submit my text my div area duplicates the current data displayed plus my new data -

hi have working script of retrieving json data result small chat application problem displays duplicate result of text posted plus newly text inserted db here whole javascript code: function sendchattext() { if (sendreq.readystate == 4 || sendreq.readystate == 0) { sendreq.open("post", 'includes/getchat.php?last=' + lastmessage, true); sendreq.setrequestheader('content-type','application/x-www-form-urlencoded'); sendreq.onreadystatechange = ajaxretrieve(); var param = 'message=' + document.getelementbyid('txta').value; param += '&name='+user; param += '&uid='+uid; param += '&rid='+document.getelementbyid('trg').value; sendreq.send(param); document.getelementbyid('txta').value =

java - Looping a menu to display after a choice -

so have code: import java.util.scanner; public class studentgradedriver { public static void main(string[] args) { scanner scanner = new scanner(system.in); system.out.println("enter student name: "); string name = scanner.nextline(); studentgrade grade = new studentgrade(name); system.out.println("welcome student grade interface!"); system.out.println("you modyfing grades john doe"); system.out.println("==============================================="); system.out.println("(1) add homework score"); system.out.println("(2) add passed lab"); system.out.println("(3) add midterm exam score"); system.out.println("(4) set final exam score"); system.out.println("(5) calculate final grade"); system.out.println("(-1) exit"); system.out.println("==============================================="); system.out.pri

wix - Windows installer upgrade code generated from command line -

i using windows installer install/upgrade installation. using visual studio can manually change version number , select yes when asked change productcode. creates installer capable of overwriting existing installation provided following properties set on installer project removepreviousversions true detectnewerinstalledversion true now in build server can change version number appropriate new version in .vdproj project. can advise on how generate new productcode project command line or batch script? the solution use uuidgen uuidgen -c will generate appropriate productcode. the following batch script update product code , allow overwrite install when applied through build server prior performing release build. rem rem batch file set release number , version number production release rem rem if not defined release_version exit /b 1 if not defined build_number exit /b 1 if not defined svn_revision exit /b 1 set sdkbin=%programfiles%\microsoft sdks\windows

sql - Having trouble getting results from this query. What am I doing wrong? -

write sub-query returns total number of orders placed customer highest number of orders. include customerid , number of orders placed. use northwind go select customerid, count(orders.orderid) totalorders, sum(orderamounts.dollaramount) totaldollaramount [orders] left outer join (select orderid, sum(quantity*saleprice) dollaramount orderitems group orderid) orderamounts on orders.orderid = orderamounts.orderid group customerid order count(orders.orderid) desc i response: msg 208, level 16, state 1, line 1 invalid object name 'orderitems'. ??? is table orderitems member of northwind database or somewhere else? may have qualify [databasename].dbo.[orderitems]

c - Segmentation fault, 2-Dimensional Matrix, malloc -

i'm trying create 2-dimensional array using malloc. code seems correct when try set values, receive "segmentation fault" message. #include <stdio.h> #include <stdlib.h> int main(){ int i, j; int **m = (int **) malloc(5 * sizeof(int)); if(m == null){ printf("error"); getchar(); exit(-1); } for(i = 0; < 5; i++){ m[i] = (int *) malloc(5 * sizeof(int)); if(m[i] == null){ printf("error"); getchar(); exit(-1); } } for(i = 0; < 5; i++){ for(j = 0; j < 5; j++){ printf("%d %d\n", i, j); m[i][j] = 0; } } for(i = 0; < 5; i++){ for(j = 0; j < 5; j++){ printf("%d ", m[i][j]); } printf("\n"); } } thanks. change int **m = (int **) malloc(5 * sizeof(int)); to //-------------------------

actionscript 3 - How to use remote SharedObject in AS3 and Red5 -

i wish use remote sharedobject created simple script test out techniques. when ran following code 2 instances of swf, both instances output 1, incorrect because second instance supposed output 2. import flash.net.sharedobject; import flash.events.syncevent; var nc:netconnection; var so:sharedobject; nc = new netconnection(); nc.client = { onbwdone: function():void{} }; nc.addeventlistener(netstatusevent.net_status, onnetstatus); nc.connect("rtmp://localhost:1935/live"); var t = new textfield(); addchild(t); function onnetstatus(event:netstatusevent):void{ if(event.info.code == "netconnection.connect.success"){ = sharedobject.getremote("shobj",nc.uri); so.connect(nc); if (!(so.data.total > 0 && so.data.total<1000)) {// undefined so.data.total=1; } else so.data.total=2; t.text=so.data.total; } } did miss out something? need make special settings flash or red5? need create special d

ruby on rails - Twice belongs_to maps back to the same table 'User' -

class comment < activerecord::base belongs_to :commenter, :class_name => "user", :foreign_key => "commenter_user_id" belongs_to :student, :class_name => "user", :foreign_key => "student_user_id" they both belong user. i if done once because helps make more clearer or whatnot ... but why twice map same table?!?!? so, result comment columns this: [0] "id", [1] "comment", [2] "student_user_id", [3] "commenter_user_id", [4] "created_at", [5] "updated_at", [6] "partnership_id" please excuse if seems same previous question. me, it's not. or maybe didn't enough. hm. a comment can posted commentator user , comment can posted student user best define way class comment < activerecord::base belongs_to :commenter, :class_name => "user", :foreign_key => "commenter_user_id" belongs

facebook - Get FB like and share for each country of any page with permission -

i trying use code total fans page : $fql_query_url = 'https://graph.facebook.com/' . 'fql?q=select object_id, metric, value, end_time insights object_id = [139832966167942] , metric in (\'page_fans\') , period = period(\'lifetime\') , end_time = end_time_date(\'2014-3-31\')' . '&access_token=' . $access_token; $fql_query_result = file_get_contents($fql_query_url); $fql_query_obj = json_decode($fql_query_result, true); but time gives : warning: file_get_contents : failed open stream: http request failed! doing wrong?

javascript - JQuery Validate is firing both Highlight and Unhighlight in Chrome -

i having strange problem jquery validate occurs in chrome. validation on page seems firing both highlight , unhighlight functions in .validate() function if dont fill out form cycles through each element , applies "invalid" class in highlight function reason goes through , applies code in unhighlight , cant work out why? js $(document).ready(function () { //validation form fields on payment form /*this adds method test whether value equal placeholder, , if is, don't consider filled out. necessary circumvent ie placeholder plugin*/ jquery.validator.addmethod("notequal", function (value, element, param) { return this.optional(element) || value != param; }, "required."); $('#payment-form').validate({ onfocusout: function (element) { $(element).valid(); }, rules: { "data[payment][card_holder]": { required: true, minlength: 2 }, "data[pa

android - crop free hand selected part of image -

Image
i wants add cropping fature in android app. know there deafault cropping feature available in gallery in them rectangular or circular selection of area possible. wants selected part of image free hand , them crop selected part of image original image. example selecting head part of complete human picture , crop it. see below wants. before after please me , sugest if free lib there. thanks here library used once: android widget cropping , rotating image. to add cropper application, specify com.edmodo.cropper.cropimageview in layout xml <com.edmodo.cropper.cropimageview xmlns:custom="http://schemas.android.com/apk/res-auto" android:id="@+id/cropimageview" android:layout_width="wrap_content" android:layout_height="wrap_content" /> or can modify attributes programmatically. see wiki here.

javascript - How can I Identify the DIv which got clicked in Jquery -

i need know click event happens in document, have divs , , when press cntrl key , click on them events occur, need know how identify divs got clicked, possible generalize them in document.click fn have tried. here sample of have tried html <div class="divone">div1</div> <div class="divtwo">div2</div> <div class="divthree">div3</div> jquery $(document).bind("click", function (e) { if (e.which == '17') { alert(e.parent);//i need know whether click happens on divone or 2 or on no mans land } }); you can use e.target along .is() function achieve want. try, $(document).bind("click", function (e) { if($(e.target).is('.divone')){ alert('div 1 has been clicked..!') } });

sql server - Unpivot SQL statement -

select assylotno, altlotname, wfrnodisplay, param.display, param.value emap_data unpivot (value display in (altlotnumber, wfrnumber, needspeedinfo, maptype, buildlist, type, productgrade, assylotno) ) param objective of query above have assylotno field included in display , value columns. fields exists in table emap_data, however, keep getting invalid column name field assylotno exists in emap_data. emap_data table fields assylotno | altlotname | altlotnumber | wfrnodisplay | wfrnumber | needspeedinfo | maptype | buildlist | type | productgrade desired output follow: assylotno altlotname wfrnodisplay display value ------------------------------------------------------------------ abc1231 abc123 01 altlotname abc123 abc1231 abc123 01 wfrnumber 01 abc1231 abc123 01 needspeedinfo y abc1231 abc123 01 maptype 12 abc1231 abc123 01 buildlist 1,2,3,4,5