Posts

Showing posts from March, 2013

Thrift TThreadPoolServer returns "Segmentation fault; core dumped;" when handle concurrent MySQL database requests -

i'm developing simple assignment using apache thrift , c++ poco library. assignment requires me make benchmark creating multiple concurrent threads make same request thrift tthreadpoolserver . this client-side code, creates 10 concurrent threads, of them make same get request (request info 1 user d ) server: // define myworker class inherits runnable class myworker : public runnable { public: myworker(int k = -1) : runnable(), n(k) { } void run() { // create connection boost::shared_ptr<ttransport> socket(new tsocket("localhost", 9090)); boost::shared_ptr<ttransport> transport(new tbufferedtransport(socket)); boost::shared_ptr<tprotocol> protocol(new tbinaryprotocol(transport)); apisclient client(protocol); try { transport->open(); int res = -1; // make request res = client.get("d"); printf("thread %d,...

ios - How to fix issue with Enterprise Account? -

i updating in-house app client have previous version on over 200+ devices of company. i want update new version app, when try sign app distribution provisioning profile asks me private key. after searching, people suggested revoke old certificate , generate new 1 on machine. file build success, devices install failed. how fix issue ? logs : jun 26 10:22:29 dungnguyens-iphone installd[76] : 0x100794000 -[micodesigningverifier performvalidationwitherror:]: 188: failed verify code signature of : 0xe8008018 (invalid signing certificate (it may have expired or been revoked)) jun 26 10:22:29 dungnguyens-iphone installd[76] : 0x100794000 -[miinstaller performinstallationwitherror:]: verification stage failed jun 26 10:22:29 dungnguyens-iphone mobile_installation_proxy[1398] : 0x10050c000 __mobileinstallationinstallforlaunchservices_block_invoke240: returned error error domain=miinstallererrordomain code=13 "failed verify code signature of : 0xe8008018 (in...

jquery - how to bind data to jqureyevent calendar using Ajax -

$.ajax({ type: "post", contenttype: "application/json", data: "{eventdata:" + json.stringify(eventtosave) + "}", url: "business/dashboardcfc.cfc?method=funtodayevent&returnformat=json", datatype: "json", success: function (data) { var events = new array(); $.map(data.d, function (item, i) { var event = new object(); event.id = item.event_id; event.start = new date(item.even_date); event.title = item.eventname; event.allday = false; events.push(event); }) $('div[id*=calendar]').fullcalendar('addeventsource', events); $("#loading").dialog("close"); }, } }); the question vague enough can deduce title of question code isn't working you. here came out of comments questions above: $.ajax({ type: "post", contenttype: "application/json", d...

java - Correct way to change Collapseble Toolbar title -

when change title of collapsed collapsingtoolbar, title not change. tried getsupportactionbar.settitle , collapsetoolbar.settitle. did not help. tell me , what's problem ? i believe this issue describes experiencing. had issue , solved today. code handles collapsing text update text when current text null or size of text changes. bug closed , patch scheduled future release of design library. use workaround of changing size of text , changing back. this have private void setcollapsingtoolbarlayouttitle(string title) { mcollapsingtoolbarlayout.settitle(title); mcollapsingtoolbarlayout.setexpandedtitletextappearance(r.style.expandedappbar); mcollapsingtoolbarlayout.setcollapsedtitletextappearance(r.style.collapsedappbar); mcollapsingtoolbarlayout.setexpandedtitletextappearance(r.style.expandedappbarplus1); mcollapsingtoolbarlayout.setcollapsedtitletextappearance(r.style.collapsedappbarplus1); } in styles.xml have <style name="expande...

javascript - What does {x:expression(...)} do? -

this question has answer here: how polyfill work document.queryselectorall? 1 answer i came across polyfill of queryselectorall ie7: https://gist.github.com/connrs/2724353 i had thought okayish in javascript, have never seen quoted part in line 9 of polyfill: {x:expression(document.__qsaels.push(this))} apparently, javascript object key x , value expression(document.__qsaels.push(this)) , other know, mysterious me. expression function do? not able find close via google. you looking @ generated css rule. not javascript object, css declaration block. the line styletag.stylesheet.csstext = selector + "{x:expression(document.__qsaels.push(this))}"; concatenates css selector declaration block string of css. declaration block contains dummy css property called x value of expression(document.__qsaels.push(this)) . what expression() is...

ios - Converting PFObject (Parse) into JSON in Swift? -

is there way convert pfobject parse json? saved json, when try load i'm getting [anyobject] back. casting json won't work: class func loadpeople() -> [string : person] { var peopledictionary: [string : person] = [:] let query = pfquery(classname: "userpeeps") query.findobjectsinbackgroundwithblock { (objects, error) -> void in if error == nil { //this returns first entry, how them all? if let peoplefromparse = objects?.first?.objectforkey("userpeeps") as? json { name in peoplefromparse.keys { if let personjson = peoplefromparse[name] as? json, let person = person(json: personjson) { peopledictionary[name] = person } } } below save function, works , saves json parse want: class datamanager { typealias json = [string: anyobject] class ...

Java JDBC display first 500 records at a time, commit, than display the next 500 records and etc -

so want able display 500 records @ time, commit , print has been displayed records 1 500 records have been committed. , next 500 records , commit again until reached maximum records on 20k records. managed first 500 records stuck how can commit them , in commit them , continue next 500 records , on. public static void selectrecordsicore() throws sqlexception { connection dbconnection = null; preparedstatement preparedstatement = null; statement statement = null; string selecttablesql = "select profile_id, ingress_flag, egress_flag, ce_ingress_flag, ce_egress_flag cos_profile" + " profile_id >= ? , profile_id <= ?;"; try { dbconnection = getinformixconnection(); //connects icore database system.out.println("i in try"); //gets max profile_id record statement = dbconnection.createstatement(); resultset r = statement.executequery("select max(profile_id) rowcount cos_profil...

sql - Optimizing postrgeSQL query with joins and "ghost" references? -

i made query data. select th.id, th.ticket_id, tp.name priority, ts.name state, owner_id player_id, g.id team_id, tt.name ticket_type ticket_history th, ticket_priority tp, ticket_state ts, users, queue, ticket_type tt, groups g th.priority_id = tp.id , queue.id = g.id , th.state_id = ts.id , owner_id = users.id , th.queue_id = queue.id , th.type_id = tt.id , th.id > $lastupdateid order th.id desc it works fine, got complains query slow (the 'complainer' didn't bother test though)... decided tweak inner joins - first question: efficient way join tables , avoid repeating main id (ticket_history in case) right? i refactored query this: select th.id, th.ticket_id, tp.name priority, ts.name state, owner_id player_id, g.id team_id, tt.name ticket_type ticket_history, groups inner join queue on queue.id = groups.id inner join ticket_priority on ticket_priority.id = ticket_history.priority_id inner join ticket_state on ticket_state.id = ticket_history...

Generate permalink to a blog post Hindi PHP -

i have 1 form in following inputs taken user: blog title blog description permalink access blog i converting blog title lower case , replacing white spaces dash(-) , storing in permalink access blog . below code handle operation: setlocale(lc_all, 'en_us.utf8'); function toascii($str, $replace=array(), $delimiter='-') { if( !empty($replace) ) { $str = str_replace((array)$replace, ' ', $str); } $clean = iconv('utf-8', 'ascii//translit', $str); $clean = preg_replace("/[^a-za-z0-9\/_|+ -]/", '', $clean); $clean = strtolower(trim($clean, '-')); $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean); return $clean; } $prmlkn = toascii($blog_headline, $replace=array(), $delimiter='-'); this code works fine till blog headline in english. if user types in hindi getting - permalink means not recognizing hindi post values. this happens be...

sql server - SQL Query AVG Date Time In same Table Column -

i’m trying make query returns difference of days average of days in period of time. situation need max date status 2 , max date status 3 request , how time user spend on period of time so far query have right mas , min , difference between days not max of status 2 , max of status 3 query have far: select distinct t1.user, t1.request, min(t1.time) mindate, max(t1.time) maxdate, datediff(day, min(t1.time), max(t1.time)) [hst_log] t1 t1.request = 146800 group t1.request, t1.user order t1.user, max(t1.time) desc example table: ------------------------------- user | request | status | time ------------------------------- user 1 | 2 | 1 | 6/1/15 3:25 pm user 2 | 1 | 1 | 2/1/15 3:24 pm user 2 | 3 | 1 | 2/1/15 3:24 pm user 1 | 4 | 1 | 5/10/15 3:18 pm user 3 | 3 | 2 | 5/4/15 2:36 pm user 2 | 2 | 2 | 6/4/15 2:34 pm user 3 | 2 | 3 | 6/10/15 5:51 pm user 1 | 1 | 2 | 5/1/15 5:49 pm user 3 | 4 | 2 | 5/16/15 2:39 pm user 2 | 4 | 2 | 5/17/15 2:32 pm user 2 ...

javascript - Detecting drag position on an element -

i building wysiwyg editor build html emails. want able add row layouts editor drag , drop. if row dragged , dropped above halfway point of drop target, want prepend row before drop target; , if dropped below halfway point, want append row after drop target. is there way this? you can use getboundingclientrect() coordinates of element while mouse button pressed , moving this element.onclick = function() { element.onmousemove = function() { var x1 = element.getboundingclientrect().left, x2 = x1 + element.getboundingclientrect().width, y1 = element.getboundingclientrect().top, y2 = element.getboundingclientrect().height; } } and can whatever these coordinates.

java - Using a interface type to instantiate a class object that implements the interface -

some confusion using interface type instantiate class object. why need interface type? when can use class instead? class implements interface anyway. know cannot instantiate interface. many suggestions, public interface sortrecords { int query(int rowid); } public class ourprice implements sortrecords { @override public int query(int rowid) { return 0; } } public void test() { /* * why has interface type? */ sortrecords sorterv1 = new ourprice(); sorterv1.query(1); /* * why not this? */ ourprice sorterv2 = new ourprice(); sorterv2.query(2); } the interface declares contract , , provides freedom specify other class providing same contract. code referencing interface agnostic implementation you're providing. in above example, it's not particularly useful. however, in wider context, factory provide impleme...

ios - stop/start NSTimer when app goes to background -

as title suggests, trying stop nstimer when game goes background , start when game starts again. interruptions such receiving phone call etc.. i using following code in app delegate stop , restart scene when app gets interrupted, not stop timer. - (void)applicationwillresignactive:(uiapplication *)application { skview *view = (skview *)self.window.rootviewcontroller.view; view.scene.paused = yes; } - (void)applicationdidbecomeactive:(uiapplication *)application { skview *view = (skview *)self.window.rootviewcontroller.view; view.scene.paused = no; } in scene place timer, have placed observers in -(id)initwithsize:(cgsize)size method. here observers: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(gobackground) name:uiapplicationdidenterbackgroundnotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(backbackground) name:ui...

c - How to read a char array stored in a file, into a char buffer during runtime -

i'm working in c , i'm modifying existing code. i have char array stored in file follows: "\x01\x02\x03" "\x04\x05\x06" "\x07\x08\x09" in original source code char array included follows: const static char chs[] = #include "file.h" ; i'm modifying code load file char array during runtime (to exact same result above approach) instead of included pre-processor. first approach read file char buffer, follows: file *fp; const char *filename = "file.h"; fp = fopen (filename, "rb"); assert(fp != null); fseek(fp, 0l, seek_end); long int size = ftell(fp); rewind(fp); // read entire file buffer char *buffer = (char*)malloc(sizeof(char) * size); size_t nrofbytesread = fread(buffer, 1, size, fp); however i've discovered not correct. file contains exact code representation of char array, cannot read char buffer , same result include approach. what best way char array stored in file, char array during r...

hibernate - ColdFusion ORM is loading base component rather than derived component? -

let's have request base component , requesta , requestb subclasses mapped using table per subclass, without discriminator. we did entityloadbypk('request', somesubclassentityid) , method return instance of requesta or requestb component. somehow, stopped behaving morning , code haven't changed @ all. entityloadbypk function return instances of request rather derived components. to make sure code did not changed, copy-pasted entire application on coldfusion box (running cf11) , behaved used on our cf9 box. obviously, there must setting or have changed on cf9 box, looked @ think off , cannot find explanation. the problem still persists after rebooted server , cleared possible caches think of (template cache, component cache, , called ormevictqueries , ormevictentity). here's orm settings: <cfset this.ormsettings = { dialect = 'microsoftsqlserver', eventhandling = true, flushatrequestend = false, logsql = true, sa...

c++ - How to use C Libraries for Arduino code -

i have code in visual studio want implement in arduino. there problem. many libraries usable in visual studio aren't usable in arduino ide. how can use them in arduino code. precise, libraries want use #include <iostream> #include <iomanip> #include <queue> #include <string> #include <math.h> #include <ctime> respectively. okay know have <iostream> available in arduino. <math.h> available think along <string> library. the main problem how use #include <queue> , functions such priority_queue() , other fucntions of iostream .pop() ? arduino behind scenes using avr-gcc compiler, provides support many of features of c++ language. not, however, include implementation of libstdc++, means lot of libraries , features used having other development environments not there. big reason is not practical implement of functionality on small microcontroller. there several libraries available implement simplifi...

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

i developing app in xamarin android. have splash screen serialize class , pass mainactivity using intent . when try deserialize in mainactivity error message : "serializationexception unable find constructor use types" serialization : void loaddata() { currency currency = new currency(this); intent = new intent(this, typeof(mainactivity)); intent.putextra("currency", newtonsoft.json.jsonconvert.serializeobject(currency)); startactivity(intent); } deserialization : cur = newtonsoft.json.jsonconvert.deserializeobject<currency> (intent.getstringextra("currency")); // error here class constructor : public currency(context context) { thiscontext = context; } i began experiencing problem after added parameter context context constructor. has caused this? how can solve it? possible serialize/deserialize class has parameters? you need have empty constructor in currency class in order deserialize it. ...

html - Url based content filtering in wordpress -

i have searched long , far plugin allow me filter content on page based on url extension example wwww.examcple.com/stuff/us display stuff relevant us; there wordpress plugin allows me using ip https://wordpress.org/plugins/custom-content-by-country/ . but there 1 allow me exact same thing using url? somone know of way of doing using html only?

Enable JavaScript debugging with IntelliJ and source maps -

i using intellij 14.1.4 creating javascript application. debugging, fire webserver using gulp. fire javascript debugging , connect chrome (via plugin). can debug "normal" javascript way when using source maps (created browserify), intellij not trigger break points anymore. if use chrome's debugging tools, works expected intellij not seem being able translate break points. is there way make work? have spent quite time researching issue , far understand it, intellij supports source maps. also, able debug gwt generated javascript using approach uses source maps, well. update : seems there current issue problem . if workarround know, happy hear solution. the answer below solves problem. here how set gulp build: bundler.bundle() .pipe(exorcist('./build/bundle.js.map', null, null, '../src')) with ./build being build folder , ../src being root of javascript source files, relative build folder. the current workaround use exorcist ge...

regex - Lookup table with subset/grepl in R -

i'm analyzing set of urls , values extracted using crawler. while extract substrings url, i'd rather not bother regex so—is there simple way lookup table-style replacement using subset/grepl without resorting dplyr(do conditional mutate on vairables)? my current process: test <- data.frame( url = c('google.com/testing/duck', 'google.com/evaluating/dog', 'google.com/analyzing/cat'), content = c(1, 2, 3), subdir = na ) test[grepl('testing', test$url), ]$subdir <- 'testing' test[grepl('evaluating', test$url), ]$subdir <- 'evaluating' test[grepl('analyzing', test$url), ]$subdir <- 'analyzing' obviously, little clumsy , doesn't scale well. dplyr, i'd able conditionals like: test %<>% tbl_df() %>% mutate(subdir = ifelse( grepl('testing', subdir), 'test r', ifelse( grepl('evaluating', subdir), 'eval r', ...

php - Custom Field Select Box (Adding Select Keyword) -

i have added couple of custom fields wordpress posts, theme creating hobby (cars). having trouble selecting option html select box. if select it, works , save correctly ~ displaying correct value on front end, when return post page, shows first value of options, , not chosen one. example, if select automatic, show on front end, when revisit backend manual again. i know stick selected post, have add selected keyword choice, having problems. what i've done what have done far work tutorial: http://wpshed.com/create-custom-meta-box-easy-way/ i created select box so: function wpshed_meta_box_output( $post ) { // create nonce field wp_nonce_field( 'my_wpshed_meta_box_nonce', 'wpshed_meta_box_nonce' ); ?> <p> <label for="transmission_textfield"><?php _e( 'transmition', 'wpshed' ); ?>:</label> <!-- <input type="text" value="<?php echo wpshed_get_custom_field(...

php - How can I explode a string into an array by space, but preserve quoted words? -

given string abc "def ghi" , how can return array: [0] => abc [1] => def ghi other examples: abc "def ghi" => ['abc','def ghi'] abc def => ['abc','def'] str_getcsv() $str = 'abc "def ghi"'; $arr = str_getcsv($str, ' ', '"'); print_r($arr); returns: array ( [0] => abc [1] => def ghi )

c# - VSIXManifest cannot be loaded -

i've installed microsoft visual studio sdk develop extensions visual studio. when create simple example without changes templates, visual studio refuses compile extension. 1>------ rebuild started: project: vspackage1, configuration: debug cpu ------ 1> vspackage1 -> 1> vspackage1 -> 1> vspackage1 -> o:\daten\visual studio 2012\projects\vspackage1\vspackage1\bin\debug\vspackage1.dll 1> creating intermediate pkgdef file. 1>c:\program files (x86)\msbuild\microsoft\visualstudio\v11.0\vssdk\microsoft.vssdk.targets(75,5): error : vsixmanifest cannot loaded. ensure vsixmanifest valid xml file. 2>------ rebuild started: project: vspackage1_integrationtests, configuration: debug cpu ------ 2> vspackage1_integrationtests -> o:\daten\visual studio 2012\projects\vspackage1\vspackage1\vspackage1_integrationtests\bin\debug\vspackage1_integrationtests.dll ========== rebuild all: 1 succeeded, 1 failed, 0 skipped ========== projects build report: ...

Testing non-java dependency with maven -

i wondering if possible test external "non-java" dependencies maven . have project depends on 2 external programs (one in c , other in python ) , include tests sure installed , accessible through java .

arrays - Matlab : Storing large numbers -

my csv file looks this 'have', 1436271616097.0, 33.0, 'nochange', 1436271538982.0 'four', 1436271616130.0, 466.0, 'nochange', 1436271538982.0 'have', 1436271616596.0, 467.0, 'nochange', 1436271538982.0 'four', 1436271617063.0, 100.0, 'nochange', 1436271538982.0 i tried using [num, txt, raw] = csvread('test.csv') shows error saying many output arguments. i tried converting csv file .xlsx changes numbers this, have 1.44e+12 33 nochange 1.44e+12 4 1.44e+12 466 nochange 1.44e+12 have 1.44e+12 467 nochange 1.44e+12 4 1.44e+12 100 nochange 1.44e+12 minutes 1.44e+12 666 nochange 1.44e+12 then used [num, txt, raw] = xlsread('test.xls') problem if display eyet = vpa(eyet(:,1)) shows same float value. how can use textscan this? this short example using textscan mentioned csv-file. gives cell array each column. % reading data file = fopen('fil...

send checkbox value in php -

does knows how code in php every time tick check-box in form? , when tick check-box,the value suppose inserted id column in database , auto increase every time tick , submit form. you need use ajax. following code snippet. $('input:radio[name="tickexam"]').click(function() { if(this.checked){ $.ajax({ type: "post", url: 'increase.php', data: {id:$(this).val()}, success: function(data) { alert('increased.....'); }, error: function() { alert('sorry! there issue'); } }); } }); in increase.php write code increase value in table.

Extending array to source file from header file in C -

is there way extend 1 big array header file source file, , use elements in main program? array byte codes[95][8] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 134, 255, 255, 255, 255, 255, 255, 143, 255, 143, 255, 255, 255, 255, 235, 128, 235, 143, 235, 255, 255, 255, 237, 213, 128, 213, 219, 255, 255, 255, 157, 155, 247, 226, 220, 255, 255, 255, 201, 112, 170, 221, 250, 255, 255, 255, 255, 175, 129, 255, 255, 255, 255, 255, 255, 227, 221, 190, 255, 255, 255, 255, 255, 190, 221, 227, 255, 255, 255, 255, 235, 247, 193, 247, 235, 255, 255, 255, 247, 247, 193, 247, 247, 255, 255, 255, 255, 250, 249, 255, 255, 255, 255, 255, 247, 247, 247, 247, 247, 255, 255, 255, 255, 252, 252, 255, 255, 255, 255, 255, 253, 251, 247, 239, 223, 255, 255, 255, 193, 186, 182, 174, 193, 255, 255, 255, 255, 222, 128, 254, 255, 255, 255, 255, 222, 188, 186, 182, 206, 255, 255, 255, 189, 190, 174, 150, 185, 255, 255, 255, }; never define variables in heade...

node.js - Add express to Gruntfile -

i add express routes working when run grunt server . code written in coffee script, if don't have knowledge on coffee script answer without it, rewrite. have tried grunt-express , grunt-express-server , many others without success. gruntfile. "use strict" livereload_port = 35728 lrsnippet = require("connect-livereload")(port: livereload_port) mountfolder = (connect, dir) -> connect.static require("path").resolve(dir) module.exports = (grunt) -> require("load-grunt-tasks") grunt require("time-grunt") grunt yeomanconfig = app: "client" dist: "dist" try yeomanconfig.app = require("./bower.json").apppath or yeomanconfig.app grunt.initconfig yeoman: yeomanconfig watch: coffee: files: ["<%= yeoman.app %>/scripts/**/*.coffee"] tasks: ["coffee:dist"] comp...

Public PGP Key sync with OpenPGP and Symantec Universal PGP Server -

i working pgp encrypted email service using openpgp , service low cost , affordable every users , able sign keys , send public key servers https://pgp.mit.edu/ http://keyserver.ubuntu.com/ etc openpgp not able send or receive public keys mail services , users use symantec universal pgp server is there api available can sync our openpgp users symantec universal pgp server users users these networks can communicate each other using pgp encryption want keep service low cost , easy use thanks steve

makefile - How to express dependence on a shared library when making multithreaded -

i use shared library.so in order avoid remake executables (which linked against it) when implementation ( library.cpp ), not interface ( library.hpp ), has changed, i.e. obj/library.o: library.cpp library.hpp lib/library.so: obj/library.o program : program.cpp library.hpp $(cxx) program.cpp -llib -lrary thus, program not depend on library.cpp or library.so . however, when making scratch (rather remaking because of changes files), library.so must made before program . can ensured setting: default: library.so program but when using make -j broken. so correct way 1) ensure library.so made before program 2) avoid re-making program if library.cpp has changed? the solution want order-only prerequisite. from types of prerequisites section of gnu make manual: occasionally, however, have situation want impose specific ordering on rules invoked without forcing target updated if 1 of rules executed. in case, want define ...

php - Pagination with placeholder cakephp 3.X -

i have searched 2 days, found no answer. use query placeholders (%$string%) searching customers. in controller: ` public function searchname() { $data = $this->kunden->find()->where([ 'kunden.name like' => '%'.\filter_input(\input_post, 'name', \filter_default).'%']); $this->set(\compact('data'), $this->paginate($data)); $this->set('_serialize', ['data']); } ` in search_name.ctp: <?php foreach ($data $suche): ?> <tr> <td><?= $this->number->format($suche->kundennummer,['precision' => 0, 'pattern' => '####']) ?></td> <td><?= h($suche->anrede) ?></td> <td><?= h($suche->name) ?></td> <td><?= h($suche->vorname) ?></td> <td>...

playframework - Play Framework 2.4 Ebean Id Generation -

until have been using play 2.3.9 , migrating play 2.4.1 when use old version of play saving entity works new verion id not generated. setup new project scratch , tried realize works , auto generated database has id field auto increments while old project has database uses sequences. have been trying configure play/ebean use sequences have not been succesfull far. i took here http://www.avaje.org/topic-97.html , gave try still not working. suggestions appreciated. my config looks this: ebean.default.identitygeneration=sequence ebean.default.supportsgetgeneratedkeys=false ebean.default.supportssequences=true ebean.default.debug.sql=true i tried ebean.default.identitygeneration=generator i put lines directly in application.conf fooled around serverconfigstartup way of configuring ebean no luck. anyways, got work, if has same problem following fixes it: public class myserverconfigstartup implements serverconfigstartup { @override public void onstart(serverconfig...

ios - NSTimer does not call selector or repeat in time interval -

i newbie in objective-c , having trouble nstimer. while learning objective-c developing games, tried move sprite using left , right button of nstimer. but, seems selector not being called. searched stack overflow , found solutions, solutions i've seen, not working. here code- #import "gameviewcontroller.h" @interface gameviewcontroller () @property (strong) uiimage *playerimage; @property (strong) uiimageview *playerview; @property (strong) nstimer *movetimer; @property cgrect playerrect; @property int count; @end @implementation gameviewcontroller - (void)viewdidload { [super viewdidload]; self.count=0; self.playerimage = [uiimage imagenamed:@"ship.png"]; self.playerview = [[uiimageview alloc] initwithimage: self. playerimage]; self.playerrect = cgrectmake(50,400, 32,32); self.playerview.frame = self.playerrect; [self.view addsubview: self.playerview]; // timer calls selector // self.movetimer = ...

Swift initialize a struct with a closure -

public struct style { public var test : int? public init(_ build:(style) -> void) { build(self) } } var s = style { value in value.test = 1 } gives error @ declaration of variable cannot find initializer type 'style' accepts argument list of type '((_) -> _)' does know why won't work, seems legit code me for record won't work either var s = style({ value in value.test = 1 }) the closure passed constructor modifies given argument, therefore must take inout-parameter , called &self : public struct style { public var test : int? public init(_ build:(inout style) -> void) { build(&self) } } var s = style { (inout value : style) in value.test = 1 } println(s.test) // optional(1) note using self (as in build(&self) ) requires properties have been initialized. works here because optionals implicitly initialized nil . alternatively define property non-optional in...

Maniging relations in rails -

i working on application , have create model product has many pictures , main picture . want model situation through relations , not using additional boolean field can tell if 1 picture main picture or not. think solution use has_one , has_many relations in product both link picture don't know how this. you're going need way distinguish "main" picture other pictures. can done in number of ways: a separate database table, say, main_pictures class product has_many :pictures has_one :main_picture end or other attribute on picture . can boolean or other field. in example, below, we'll use boolean attribute named primary on pictures table. class product has_many :pictures has_one :main_picture, -> { where(primary: true) } end

orientdb - Implementing an infinite scroll news feed graph model -

i building social networking kind of website. using python , orientdb. trying fetch posts of users ( user2 , user3 , user4 , etc) connected user1 , show posts in news feed of user1 . for this, using graphity model retrieve top 'k' news feed efficiently. but, challenge comes in when, example users scrolls down , top 'k' feeds shown him already. want fetch 'k' left off, ie. 'k+1', 'k+2', etc. right or efficient way this? i can think of retrieving top '2k' news feed again, , when that's consumed, retrieve top '3k' feeds , on. but, can see, heavy that. is there predefined solution problem or solution can think of, can continue fetching posts left, once top 'k' feeds retrieved first. i recommend use linkmap if wish store mixed values. more efficient cause won't have traverse through whole list. experimenting, found can expand array of keys , it's efficient ! here how syntax looks : select exp...

javascript - RegExp is not working properly -

i'm writing function switches urls embed url. so, have two-dimensional array has original url , embed url. i'm trying use regexp make sure valid url, won't work.. this code worked: arr[x].match(/^(http:\/\/){0,1}(www.){0,1}(allmyvideos.net\/){1}([a-z0-9])+$/ig); while code won't work: var sites = [ ["allmyvideos.net/vidid", "allmyvideos.net/embed-vidid"] ]; var arr = document.getelementbyid('original').value.split("\n"); for(var x in arr) { var regex = new regexp("/^(http:\/\/){0,1}(www.){0,1}(" + sites[0][0].replace("vidid", "").replace(/[\/]/g, "\\/") + "){1}([a-z0-9])+$/ig"); regex.test(arr[x]); } what doing wrong here second approach not working? the new regexp() constructor form doesn't use surrounding / characters: var re = new regexp("thing check", "ig"); re.test("thing check") // => true

Publishing an private android app -

i've done app company , have decide de way share out. , i'm wondering if there's way publish on playstore in private way, mean, does'nt visible until write down name of app download it... so, if want users of company don't have change permissions of android allow apps not trusty locations, best or differents ways it? thanks! take @ various distribution ways google listed on site. you want distribute via email or through company's website.

angularjs - Angular UIRouter $state.go inside onEnter not passing params -

i trying pass $stateparams url non-child state , i'm coming blank. redirect working fine , console.log threw in there giving me expect, i'm not finding way params in other controller. have in state controller: .state('vip', { url: '/vip/:name', onenter: ["$state", "$stateparams", function($state, $stateparams) { $state.go('leasee.two', {name: $stateparams.name} , {inherit: true}); console.log("name: " + $stateparams.name); }] }); what should accessing in other controller?

ios - Custom UICollectionViewCell not showing UIImage and crashes -

i'm using custom uicollectionviewcell call examplecell, within uicollectionview, , images trying set cells not showing up, , app crashes. found similar question here , , followed comments best of knowledge, didn't help. when comment out self.collectionview!.registerclass(redeemcell.self, forcellwithreuseidentifier: reuseidentifier) inside examplecollectionviewcontroller, app doesn't crash shows black boxes (since set cell background color black) instead of actual images. if uncomment out line, app crashes error fatal error: unexpectedly found nil while unwrapping optional value examplecollectionviewcontroller.swift : import uikit private let reuseidentifier = "examplecell" private let sectioninsets = uiedgeinsets(top: 50.0, left: 20.0, bottom: 50.0, right: 20.0) class examplecollectionviewcontroller: uicollectionviewcontroller { let examples = example.allexamples() override func viewdidload() { super.viewdidload() // reg...

java - Text/Icons/JLabels disappear over Gif background -

java form loads gif background playing images , text overlay appear few seconds disappear forever. form built using netbeans form builder within null layout gif jlabel @ bottom , numerous text , images on it. the gif rather large 350mb bpanel = new javax.swing.jpanel(); board = new javax.swing.jlabel(); bpanel.setpreferredsize(new java.awt.dimension(1156, 786)); board.seticon(new javax.swing.imageicon(getclass().getresource("/resources/game_2.gif"))); // noi18n board.settooltiptext(""); board.setalignmenty(0.0f); javax.swing.grouplayout bpanellayout = new javax.swing.grouplayout(bpanel); bpanel.setlayout(bpanellayout); bpanellayout.sethorizontalgroup( bpanellayout.createparallelgroup(javax.swing.grouplayout.alignment.leading) .addgroup(bpanellayout.createsequentialgroup() .addcomponent(board) .addgap(0, 0, short.max_value)) ); bpa...

c# - Owin Call Duration -

is there simple way find call duration in c#. i using owin middleware intercept calls api , log information them , part of log duration of call. public override async task invoke(iowincontext context) { var request = context.request; var response = context.response; var username = request.user != null && request.user.identity.isauthenticated ? request.user.identity.name : "no username"; var entity = new trackingentity() { username = username }; // invoke next middleware in pipeline await next.invoke(context); writerequestheaders(request, entity); writeresponseheaders(response, entity); await storage.insertentity(entity); } if tracking entity has duration field on storing time length of call best way go recording it? public timespan duration { get; set; } is accurate way use timer starts before calling next , ends after? any input appreciated think i'm overthinking this. thanks in advance. i don...

primefaces - How to make an editable cell clickable in order to open a pop-up -

i have editable table: <p:datatable id="mytable" ... editable="true"></p:datatable> there 1 line in table , want cell of line clickable in order open pop-up. tried solution given there <p:column id="mycolumn" headertext="name" styleclass="align-center"> <p:celleditor> <f:facet name="output"> <h:panelgrid update="@widgetvar(infosnameformdialog)" onclick="pf('infosnameformdialog').show();"> <h:outputtext value="#{element.name}" /> </h:panelgrid> </f:facet> <f:facet name="input"> <p:inputtext value="#{element.name}" /> </f:facet> </p:celleditor> </p:column> this solution has problem: because of h:panelgrid have rectangle frames data of cell, not acceptable. so tried p:link other solution <p:...