Posts

Showing posts from May, 2010

Connecting slider to separate graphics view in OS X Cocoa using Swift -

i have custom class containing slider , plotting code , these connected view in os x storyboard. unfortunately, slider in plotting area , can not place in different part of window since slider not recognized outside of plotting class. (this seemed easy in objective c using nibs). can suggest way of doing this? slider code is: @ibaction func freqvalue(sender: nsslidercell) { freq = float(sender.doublevalue) display() } the custom plotting class sinecurveview. thanks! can make outlet in appropriate view , set programmatically there? might not have full understanding of setup however, im on ios side.

x86 - Invalid effective address (assembly) -

the following code: mov edx,dword[ecx+(5*ebx)] gives me error of "invalid effective address". far know, ok take content of (register1+ register2 multiplied constant). why getting error here? full code: section .text align 16 global main main: push ebp mov ebp, esp pushad mov ebx, 1 mov ecx, 2 mov edx,dword[ecx+(5*ebx)] popad ; restore registers mov esp, ebp ; function exit code pop ebp ret

java - Selenium says invalid xpath for span -

html : <div class="accept"><a class="red_keep popup_action"><span>click here view terms</span></a></div> xpath have tried : 1. //span[text()='click here view terms'] 2. normalize-space(//href[@class="red_keep popap_action"]/text()='click here view terms') from above xpath none of them working. assuming need match span text content after spaces normalized (using normalized-space() ), xpath can 1 of following : //span[normalized-space(text())='click here view terms'] //span[text()[normalized-space(.)='click here view terms']] the first xpath works if target text node first child node of span , while second xpath should work regardless.

using a library in android studio -

i hoping if point me in right direction implementing library lobster picker in android studio project. i have been looking @ different sites on how implement, ask link .jar file (github has access src). i'm little confused add compile 'com.larswerkman:lobsterpicker:1.0.1' . tried in couple different gradle files, broke build. could me? look build.gradle(module:app) , add reference inside dependencies, so: dependencies { compile 'com.larswerkman:lobsterpicker:1.0.1' } make sure internet connection working fine, otherwise receive error, project app: apk dependencies can jars.

php - yii multiselect dropdown with search property? -

i want searchable multiselect dropdown.i have seen yii multiselect , echmultiselect extension these not according need. please suggest ext or code this. suggestion appreciated. dropdown example - same stackoverflow uses tags input. you can use chosen plugin. available yii extension, called chosen widget example of usage: //1st step make list box proper selector <?php echo chtml::activelistbox($model, 'attribute', $data, array('class'=>'chosen', 'multiple'=>true, 'data-placeholder'=>'select')) ?> //2nd step use widget <?php $this->widget('ext.chosen.echosenwidget',array( 'selector'=>'.chosen', )); ?> it magic , convert normal multiple select searchable multiple select. of course there lot of options, described in chosen plugin documentation .

html - Auto adjusting image -

i'm trying make simple webpage when open it, photo called "wallpaper.jpg" adjust based on window size there's no scroll bars. photo 1920 x 1080 if matters. currently have: <html> <body bgcolor = "#000000"> <style> img { height:100%; width:100%; } </style> <img src = "wallpaper.jpg"> </body> </html> but it's still leaving vertical scrollbar first things first: don't use bgcolor deprecated, you should reset margin on body because has margin:8px default (the value may change depending on browser), remove white space around. then using img going have vertical scrollbar if img height higher viewport height (if img hasn't parent width ) so solution using image background , using cover make full page responsive body { margin: 0; background: url("//placehold.it/1920x1080") fixed no-repeat center center / cover } `

class - Javascript Inheritance and the words "this" and "that" -

this question has answer here: inheritance in javascript, variables in “parent” 3 answers i have class use methods event listeners, don't use this that in methods. this base class: function modal(){ var = this; this.opened = false; this.open = function(){ that.opened = true; var id = this.id; // more code }; this.close = function () { if (that.opened) // something; }; } this inherited class: function modalbook(){ var = this; this.open = function(){ that.opened = true; var id = this.id; // more code }; } modalbook.prototype = new modal(); var modalbook = new modalbook(); now value of modal.opened true when modal opened when it's closed value false. on debugging on line of this.close , saw that instance of modal , , modalbook instance

relay - Integrating RelayJS and Azure table storage -

the documentation on relayjs says relayjs can use node.js graphql server, not asp.net web service. how can use relayjs asp.net web api end point? how can use relayjs asp.net web api end point? tl;dr; by placing graphql server in-between relay client-side , asp.net web api end point. the getting started page of relay documentation mentions 2 additional things needed use relay: a graphql schema: data model. need map asp.net web api graphql schema. a graphql server: client-side speaks server. in case, graphql server talk asp.net web api. a example of graphql schema , server wrapping star wars api . some conecptual clarifications question relay specification. it's called graphql relay specification . it's not restricted javascript. check awesome relay find list of languages relay libraries available. it helps think of relay , graphql 2 sides: server-side consisting of graphql server, speaks schema. can receive queries , mutation requests.

c - Why is a pointer value is changed once being returned? -

disclaimer: homework assignment question being asked unrelated actual assignment. i have implement simple memory manager 1 of classes, in function my_malloc before return function value being return 1 (say: 0x7fb0049ed410) , in calling function (say: 0x49ed410). my_malloc(unsigned int); typedef void* addr; addr raddr = (addr) (memoryheader + sizeof(header))) printf("giving memory: %p : %p\n", addr, raddr); return raddr calling function(); void* mem = my_malloc(10*sizeof(char)); printf("calling function: %p\n", mem); i'm sorry if isn't helpful thought might enough problem across without giving 600 , line of code. warning begin given: incompatible integer pointer conversion assigning 'void *' 'int' the code calling my_malloc() function isn't being given proper declaration/prototype function, it's treating returned pointer int . place following before call my_malloc() (ideally should in header included co

c++ - QObject::connect crash at signalOffset(senderMetaObject) due to QMetaObject::superdata contains null data -

Image
my connection code following: qobject::connect(_scene, &vscene::activeobjectchanged, _scene->manipulatornode(), &vmanipulatornode::onactiveobjectchanged); vscene subclass of vnode , subclass of qobject . both of them contain q_object macro. vscene signal sender: class vscene : public vnode { q_object public slots: void markactiveobject(vobject *obj); void unmarkactiveobject(vobject *obj); signals: void activeobjectchanged(vobject *obj); } vnode: class vnode : public qobject { q_object } vmanipulator: class vmanipulatornode : public vnode { public: void onactiveobjectchanged(vobject *obj); } the program crashes while calling qobject::connect , @ function signal_index += qmetaobjectprivate::signaloffset(sendermetaobject); whiling debugging, found out superdata pointer of qmetaobject of sender vscene contains null data. i see qmetaobject of vscene point qmetaobject of vnode , , then, qmetao

python - Loop that adds user inputted numbers and breaks when user types "end" -

create function expects no arguments. function asks user enter series of numbers greater or equal zero, 1 @ time. user types end indicate there no more numbers. function computes sum of values entered. i'm supposed able while loops , if statements. the main issue i'm running don't know how make "end" stops loop, rather add value. def sumfunction(): """sum of values entered""" number = 0 while number >= 0 , number not "end": number = number + (float(input("enter next number: "))) return number think loop checking for: "do this, while number greater or equal 0 , not 'end'`. which value satisfies both conditions? if enter 'end' satisfy both criteria; because loop break if both conditions true. so want or not and . once solve issue, you'll run problem: >>> def sum_function(): ... number = 0 ... while number >= 0 or number not 'e

imageview - Android - How to embed local image into an Activity and display with Photo Sphere on 4.2+? -

i trying load photo sphere image activity , view 1 in gallery. cannot seem find examples or samples of functionality anywhere on web. documentation panoramaclient thoughts, examples, code sets or suggestions on how accomplished? the announcement posts photo sphere api details how load photosphere uri: // listener called information given panorama. onpanoramainfoloadedlistener infoloadedlistener = new onpanoramainfoloadedlistener() { @override public void onpanoramainfoloaded(connectionresult result, intent viewerintent) { if (result.issuccess()) { // if intent not null, image can shown // panorama. if (viewerintent != null) { // use given intent start panorama viewer. startactivity(viewerintent); } } // if viewerintent null, image not viewable panorama. } }; // create client instance , connect it. panoramaclient cli

javascript - How do I dynamically fill the heatMapData array and load a heat map layer with the Google Maps API? -

i'm having hard time getting heat map appear on site. i'm trying plot homicide , shooting data baltimore. load in data via json - can plot of points, can't heatmap show up. populating array right information? need work? javascript: var map; function initmap() { var infowindow = new google.maps.infowindow(); var mapdiv = document.getelementbyid('map'); var map = new google.maps.map(mapdiv, { center: {lat: 39.2888414, lng: -76.6099112}, zoom: 12 }); google.maps.event.addlistener(map, 'click', function() { infowindow.close(); }); map.data.loadgeojson('https://data.baltimorecity.gov/resource/4ih5-d5d5.geojson?description=shooting'); map.data.loadgeojson('https://data.baltimorecity.gov/resource/4ih5-d5d5.geojson?description=homicide'); var data; $.ajax({ datatype: "json", url: "https://data.baltimorecity.gov/resource/4ih5-d5d5.geojson?desc

ruby on rails 4 - Jittery jQuery animation -

html <div class="phone"> <a href="#" > <img src="/assets/phonenew.png" alt="" height="90px" width="90px" /> </a> </div> <div class="phone-number"> <a href="#"> <img src="/assets/phonenumber.png" class="phone-full" height="45px" /> </a> </div> css .phone { position: absolute; top: 200px; left: 915px; cursor: pointer; z-index: 100; } .phone-number { position: absolute; top: 225px; left: 908px; display: none; cursor: pointer; font-family: 'open sans'; font-size: 28px; color: rgb(68, 69, 67); } this jquery i'm using make phone icon (phonenew.png) slide left on mouseenter exposing .phone-number, rolls right on mouseleave, hiding .phone-number. animation jittery. think missing step queueing or something.. $.fn.animaterotate = function(angle,prevangle, durat

php - Wrong DateTime in created_at and updated_at fields in Laravel 5.2 -

Image
i using jenssegers mongodb trying save created_at , updated_at in controller, "updated_at" : isodate("1970-01-11t19:45:21.925z"), "created_at" : isodate("1970-01-11t19:45:21.925z") and update also, wrong dates saving in app.php in aliases 'moloquent' => 'jenssegers\mongodb\eloquent\model', in providers 'jenssegers\mongodb\auth\passwordresetserviceprovider', in model use moloquent; class task extends moloquent{ //$fillables = []; } please me in solving issue in advance! actually - when using jenssegers/laravel-mongodb package - created_at , updated_at attributes automatically set when saving new model object. however if still want manually set timestamps or else datetime field must convert datetime object (or carbon) mongodb\bson\utcdatetime . so this: $mymodel = new mymodel(); $mymodel->created_at = $mymodel->fromdatetime(new \datetime()); //... and datetime a

android - NPE error using Retrofit -

i want login in service called vid.me, https://api.vid.me/oauth/authorize post.but when try data log have nullpointerexception.i tryed make toast , have error too.i'm trying response code see did right or no. my api class: public interface videoapi { @get("/videos/featured") call<videos> getfeaturedvideo(); @get("/videos/new") call<videos> getnewvideo(); @formurlencoded @post("oauth/authorize") call<signinresults>insertuser(@field("name") string name, @field("password") string password ); } my fragment: public class feedfragment extends fragment { edittext username; edittext password; button btnlogin; public list<signinresult> signinresult; public static final string root_url = "https://api.vid.me/"; public view oncreateview(layoutinflater inflater, viewgroup container,

php - Codeigniter Zip Encoding - Where is my zip folder? -

as described in documentation i trying add files zip folder. data files saved php variables $remotefile , $data. //archive generated files zip future download $this->load->library('zip'); $zipfiles = array( 'index.php' => $remotefile, 'assets/remote.php' => $data ); $this->zip->add_data($zipfiles); $this->zip->archive(base_url() . 'assets/remote_files/files.zip'); $this->zip->download(base_url() . 'assets/remote_files/files.zip'); when load page zip downloads automatically intended. file contents there , good. however, when on server zip file, none existent.when ssh server directly, or via ftp , navigate 'assets/remote_files' directory website there no zip file shown. run 'ls -la' , no files.zip shown. where zip file? automatically deleting after downloads? permissions: :~/www-dev/site/assets$ ls -la | grep remote_files drwxrwxrwx 2 www-data admin 4096 apr 25 00:30 remote_fil

python - mutually_exclusive_group with optional and positional argument -

i created cli specification docopt works great, reason have rewrite argparse usage: update_store_products <store_name>... update_store_products --all options: -a --all updates stores configured in config how that? what important don't want have this: update_store_products [--all] <store_name>... i think rather this: update_store_products (--all | <store_name>...) i tried use add_mutually_exclusive_group , got error: valueerror: mutually exclusive arguments must optional first off, should include the shortest code necessary reproduce error in question itself . without answer shot in dark. now, i'm willing bet argparse definitions bit this: parser = argumentparser() group = parser.add_mutually_exclusive_group(required=true) group.add_argument('--all', action='store_true') group.add_argument('store_name', nargs='*') the arguments in mutually exclusive group must optional,

java - Is it safe to do a Collections.swap() inside a arraylist for loop? -

i have following code: private list<string> listofstrings = new arraylist<>(); listofstrings.add("a"); listofstrings.add("b"); listofstrings.add("c"); listofstrings.add("d"); (string temp : listofstrings) { if (temp.equals("c")) { collections.swap(listofstrings, 0, listofstrings.indexof(temp)); } } the list may not list of string list of objects defined class wrote. i'm not sure swap here, see compiled , running fine don't know if it's safe here. does have suggestions on this? if need swap. planned use for (int = 0; < size; i++) iterate , use list.get(i) item, think it's not idea use list.get(i) on arraylist? any appreciated!! in advance!! if worried concurrentmodificationexception , yes, calling swap within loop safe. the enhanced loop use iterator internally, , iterator may throw concurrentmodificationexception when detects structural modification of list not done iter

r - How to store a very large data.frame in an excel workbook? -

i have large data.frame, has 9000 obs. of 1600 variables, , need store in excel workbook. have tried xlconnect package, got error back: error : outofmemoryerror ( java ): java heap space i tried set jvm heap size by: options ( java . parameters = " - xmx1024m " ) unfortunately, did not work. besides, have tried write.csv() , write.table , outputs wrong. there other way?

android - How to get user birthday from facebook -

i used below code facebook user information when he/ login. problem couldn't user birthday or firstname of that. when wanted show user birthday show me empty string. package com.example.test; import java.security.messagedigest; import java.util.arraylist; import java.util.arrays; import com.facebook.request; import com.facebook.request.graphusercallback; import com.facebook.response; import com.facebook.session; import com.facebook.sessionstate; import com.facebook.uilifecyclehelper; import com.facebook.model.graphuser; import com.facebook.widget.loginbutton; import android.app.activity; import android.app.progressdialog; import android.content.context; import android.content.intent; import android.content.pm.packageinfo; import android.content.pm.packagemanager; import android.content.pm.signature; import android.os.bundle; import android.util.base64; import android.util.log; import android.view.view; import android.widget.toast; public class mainactivity extends activity

python - Django + Angular2: How to fetch data from database? -

i using angular2 front end in html pages.i have django project uses postgresql. best approach use angular2 in django project connect django models , database perform basic operations(crud)like read,update etc? currently need fetch data database dynamically. (e.g.if user clicks on product product list product details should retrieved database , shown user) any advice or reference example link helpful. create rest api end points using django (use drf standard rest api's or use vanilla django generate json response requests , call rest api). for ex: /product/:id api end point you've created fetch details of particular product in django then use angular request throught api's , responses , whatever want data. for ex: make request /product/1 fetch details of product pk = 1 when user clicks product. browse through github inspiration.

c++ - Function does not take 1 arguments when passing this into it -

i'm trying pass instance of this (the instance in question being gameengine class) playerbrain.run method takes gameengine * const argument corresponding this is. i'm curious cause such error thrown in case, when there no alternative function definitions run() or that. playerbrain own class, not descending anything. there's no alternative definitions run might cause problems. here's relevant code: all public methods in playerbrain.h #pragma once #include "gameengine.h" #include "species.h" #include "neuron.h" #include "genome.h" #include "genepool.h" #include "gene.h" #include <sys/stat.h> #include <vector> #include <iostream> #include <fstream> #include <windows.h> using namespace std; class playerbrain { private: int popsize; int stalenessthreshold; int timeoutconstant; int currenttimeout; int maxnodes; int farthestdistance; bool buttons[6];

payment gateway - What is success url & failure url while integrating payU Money in android? -

Image
here activity code, surl & furl? please me? thanks in advance :) map<string, string> mapparams = new hashmap<>(); mapparams.put("key", mmerchantkey); mapparams.put("txnid", mtxnid); mapparams.put("amount", string.valueof(mamount)); mapparams.put("productinfo", mproductinfo); mapparams.put("firstname", mfirstname); mapparams.put("email", memailid); mapparams.put("phone", mphone); mapparams.put("surl", msuccessurl); mapparams.put("furl", mfailedurl); mapparams.put("hash", mhash); mapparams.put("service_provider", mserviceprovider); system.out.println("mapparams=="+mapparams); webviewclientpost(webview, maction, mapparams.entryset()); the following diagram explains how customer ma

dataframe - Adding a character before every specific character in each line in R -

i have .csv, file unfortunately 1 of columns contains dictionary has commas in , example: {"name": "umbulharjo", "type": "kecamatan", "level": "3", "region1": "yogyakarta", "region2": "yogyakarta", "region3": "umbulharjo", "postcode": "55161"} how can put " before every { , after every } in r? can set " quote when using read.csv or read.csv2 or read.table your data looks json-ish. if you're doing lot of json stuff, suggest using library understands json .

ios - tableview doesn't work properly in iPhone 6 simulator -

Image
i have tableview gets data , shows them list. when run code on iphone 5 simulator, works fine. when test on iphone 6 simulator, 2 first cells have no functionality. form third cell, works fine too. i'm new on swift programming , have no idea why happens. here screenshot of app: when plus or minus sign or add order, they're not working. after two, third item, works correctly. here's code: class drinkdetailcell : uitableviewcell { @iboutlet var title: uilabel! @iboutlet var price: uilabel! @iboutlet var image2: uiimageview! @iboutlet var addbasket: uibutton! var order = orderdrink() @ibaction func addtobasket(sender: anyobject) { order.count = string( amounth ) orderdrinktable().add(order) nsnotificationcenter.defaultcenter().postnotificationname( "reloadprice", object: nil) hud.flash(.success, delay: 1.0) } var amounth = 1 @ibaction func mines(sender: anyobject) { if( amounth > 1 ) { amounth -= 1 qu

android - Receiving the Broadcast -

i want make application gets incoming calling number if call specific number stuff . want incoming calling number when application not running .. using braodcastreceiver incoming number . i have 2 java class 1 extends activity , other extends braodcastreceiver getting incoming calling number . main class extends activity : package digicare.ringmanager; import android.os.bundle; import android.app.activity; import android.view.menu; public class main_activity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_layout); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main_layout, menu); return true; } } it pretty simple , number checker class extends broadcastreceiver : package digicare.ringmanager; import android.cont

android - Please suggest me on proper usage of notifyDataSetChanged() -

i'm using view pager swiping tab layouts. , i'm displaying list view of data using custom adapter. , onclick of list view have list view detail activity i'm displaying data in more detail. in these detail activity i'm performing changes data(some post method). after create instance of customadapter class , call notifydatasetchanged() in order refresh list view. problem on here list view times refreshes , times there delay of seconds. so, can suggest me proper usage of list view , changes needs done in order refresh list view whenever post method performed. code fragment class: private void showjsondata(string response) { try { string serviceid = loggedinuserstore.getloggedinserviceid(getcontext()); list<complaint> userlist = new arraylist<>(); //arraylist of type user(pojo class) jsonarray jsonarray = new jsonarray(response); (int = 0; < jsonarray.length(); i++) { if (serviceid.equals(jsonarray.getjs

java - Open the Google-drive Application with floating button pressed -

Image
i have button in fragment when use press opens screen google drive screen. in other words opens google drive simply. but need screen in can see floating button or plus button pressed. here code of java file public class threefragment extends fragment{ public threefragment() { // required empty public constructor } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view rootview = inflater.inflate(r.layout.fragment_three, container, false); button b1 = (button) rootview.findviewbyid(r.id.managecloud); b1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = new intent(); intent.setaction(intent.action_main);

php - How can I process this fail? -

file html: <div id="background"> <div class="form-group"> <label for="usr" style="position:fixed;margin-top:180px;margin-left:900px;"><u>account id</u>:</label> <form action="processlogin.php" method="post" onsubmit="return process_login()"> <input type="text" placeholder="enter id in here" class="form-control" id="usr" name="idcuaban" style="position:absolute;width:350px;margin-top:205px;margin-left:900px;"> </div> <div class="form-group"> <label for="pwd" style="position:fixed;margin-top:230px;margin-left:900px;"><u>pin</u>:</label> <input type="password" placeholder="enter pin in here" class="form-control" id="pwd" name="passcuab

RC4 Encryption in Python -

i've had through several python scripts using rc4 block cipher... i'm having issues completing program outputs properly... program asks "key" , "plaintext" (text encrypt key). , outputs encoded string... think. if enter word "plaintext" encrypt following. think incomplete... [187, 243, 22, 232, 217, 64, 175, 10, 211] i want have encrypted output in hex bb f3 16 e8 d9 40 af 0a d3 my program incomplete @ moment, direction on how to finish off encryption part outputs hexadecimal (i think have convert bytes hex?) edit: above has been resolved ebrahim. need decryption i'm lost on begin decryption... want able have input take key , ciphertext both in hexadecimal; , decrypt ciphertext plaintext. i understand logic in encryption process, i'm having trouble grasping decryption process though quite similar. # global variables state = [none] * 256 p = q = none def setkey(key): ##rc4 key scheduling algorithm glo

ios - beginReceivingRemoteControlEvents not triggering events for Apple Music -

i playing apple music application , apple music player code - -(void) submitapplemusictrackwithproductid: (nsstring *) productid // productid in last numbers after i= in share url apple music { [skcloudservicecontroller requestauthorization:^(skcloudserviceauthorizationstatus status) { nslog(@"status %ld", (long)status); skcloudservicecontroller *cloudservicecontroller; cloudservicecontroller = [[skcloudservicecontroller alloc] init]; [cloudservicecontroller requestcapabilitieswithcompletionhandler:^(skcloudservicecapability capabilities, nserror * _nullable error) { nslog(@"%lu %@", (unsigned long)capabilities, error); if (capabilities >= skcloudservicecapabilityaddtocloudmusiclibrary || capabilities==skcloudservicecapabilitymusiccatalogplayback) { nslog(@"you can add icloud!"); [[mpmedialibrary defaultmedialibrary] additemwithproductid:produ