Posts

Showing posts from July, 2010

c# - Asp.net MVC4 Website hosting issue -

Image
i have developed asp.net mvc4 website using vs2010 , running fine after publishing , hosting same developer machine. then hosted same on testing system has .net framework(4.5.1) , asp.net mvc4 run time installed, giving run time exception stating could not load file or assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed' or 1 of dependencies. system cannot find file specified. i checked references in project there no newtonsoft.json referenced. appreciated. please refer screenshot i guess in web.config have lines like <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> remove give errors json in case , update package nuget :)

How to use Android Studio with Java 32 bit? -

today want try migrating of eclipse projects android studio have problems. when open android studio, says need install 64 bit jdk. searched problem , found out need open studio.exe instead of default studio64.exe when open studio.exe says i'm running 64 bit windows, need use studio64.exe the problem need 32 bit java not android development, , eclipse in 32 bit, changing 32 bit 64 bit java hard me. may make of softwares not working , other problems might arise, , need change java_home 64 bit java. avoid things use 32 bit java instead of 64 bit. i searched problem can't find solution yet, idea how solve this? if there's no solution, think i'll keep using eclipse.. i'm using windows 7 64 bit, android studio 135.1641136 i think impossibility of running studio.exe without 64-bit java installed issue in version. had same problem i've installed latest android studio (135.1740770) , ran studio.exe without issues. additionally, if you're behi...

How to set the priority of android service? -

Image
is there way set priority of android service? want run service in background after destroying app's main actvity. returning "start_redelivery_intent" service. restarting of service taking time (around 1-3 minutes). want restart service instantly. there way set priority of android service. fyi, creating service using startservice , passing object through intent.putextra(). below snapshot taken setting/apps/running apps android device, shows app restarting... app real time specific, want restart instantly... you cannot control behavior of service depends on os , available resources. however, continuously running background service, suggest return start_sticky - tries best re-run service once destroyed due reasons.

node.js - Using Mongoose middleware find query document from MongoDB -

i'm using mongoose middleware connect mongodb. i have mongodb collection: { "_id" : objectid("54801a4def32fe8c2bc642a6"), "name" : "cyber kok", "serial" : null } { "_id" : objectid("54801a4def32fe8c2bc642a5"), "name" : "cyber kok", "serial" : "" } { "_id" : objectid("54801a4def32fe8c2bc642a7"), "name" : "cyber kok", "serial" : " " } { "_id" : objectid("54801a4def32fe8c2bc642a8"), "name" : "cyber kok", "serial" : "14a16" } { "_id" : objectid("54801a4def32fe8c2bc642a9"), "name" : "cyber kok", "serial" : "19b20" } how query mongodb collection using mongoose display below in 1 command? { "_id" : objectid("54801a4def32fe8c2bc642a6"), "name" : "cyber ko...

MYSQL convert float to datetime -

i want this: 37442.3992708333 -> 05-07-2002 09:34:57 but when try 'easier' syntax, not work. like: select convert(float, '15.6'); result should be: 15.6 i errors like: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'float, '15.6')' @ line 1 i try syntax in xampp phpmyadmin in sql commands. server version: 5.6.20 - mysql community server (gpl) apache/2.4.10 (win32) openssl/1.0.1i php/5.5.15 phpmyadmin 4.2.7.1 you'll need use sec_to_time() function. it unclear haven't provided enough information float represents haven't been able write sample - documentation link above detailed should able work out there. update comment: if float comes excel then: you need research how excel generates float (i'm not going research you) , reverse process store mysql datetime field if coming excel can not create mysql date friendly column formula of =text(a3,...

Simple implementation of operators between different c++ classes -

is there simple/smart way implement missing operator: ‘operator+’ (operand types ‘myclassref<int>’ , ‘myclass<int>’) these 2 classes? know define function takes these 2 types parameters. since implementing several function should take both myclass , myclassref types parameters in simple manner. i have been looking having myclassref inner class of myclass , using implicit conversion, method (to best of knowledge) required function using both types parameters member functions. #include <iostream> using namespace std; template <class t> struct myclass; template <class t> struct myclassref { t* i; myclassref(myclass<t>* a) { = &a->i; } operator myclass<t>() { return myclass<t>(*i); } t& get() { return *i; } }; template <class t> struct myclass { t i; myclass() = default; myclass(const myclass&) = default; myclass(t _i) : i(...

eclipse - Add 9-patch image to Android Studio -

Image
i've created nine-patch image using simple nine-patch generator . creates directory res -folder, containing folders each pixel-density-version of image. in eclipse adt 1 drag & drop these folders in res -folder of project. this seem no-brainer, how add these generated nine-patch images android studio? i'm using android studio 1.0.1. if problem cant find drawables eaisly select pakages top left side in project structure there can find res folder , eailsy paste 9 path in corresponding folders

mysql - mysql_options() crashing in mysqlclient.lib -

i trying use mysql_plugin_dir mysql_options(). , on doing application crashes. here simple code crashes-- #include "stdafx.h" #include <mysql.h> #include <stdio.h> #include<conio.h> #include <stdlib.h> #include <windows.h> #include<process.h> mysql *conn; // connection mysql_res *res; // results mysql_row row; struct connection_details { char *server; char *user; char *password; char *database; }; mysql* mysql_connection_setup(struct connection_details mysql_details) { // first of create mysql instance , initialize variables within mysql *connection = mysql_init(null); // connect database details attached. if (!mysql_real_connect(connection,mysql_details.server, mysql_details.user, mysql_details.password, null, 0, null, 0)) { printf("conection error : %s\n", mysql_error(connection)); exit(1); } return connection; } mysql_res* mysql_perform_query(mysql *conn...

mysql - DISTINCT WITH SUM -

i have mysql join result looks this. id | name | score | someid --------------------------- 1 | abc | 100 | 2 1 | abc | 100 | 2 1 | abc | 100 | 3 1 | abc | 100 | 3 1 | abc | 100 | 4 1 | abc | 100 | 4 i want result of join result in sum distinct like id | name | sum(score) | someid --------------------------- 1 | abc | 200 | 2 1 | abc | 200 | 3 1 | abc | 200 | 4 is there possible solution problem! help? try this: select id, name, sum(score), someid tablea group id, name, someid;

android - Unity Facebook SDK: post screenshot to wall not working -

i using unity 4.5, latest facebook sdk 6.0 , working on android right should work on ios. trying take screenshot , upload wall, therefore use standard example scene facebook sdk. works fine when use private account test account, , works facebook app id's of older projects (at least 1 year old). normal account (no tester) , new facebook app not working. do have full submission use "post image users wall" function or doing wrong? facebook app says "this app public , available users" . guess should work right? i use login: private void callfblogin() { fb.login("email, publish_actions", logincallback); } void logincallback(fbresult result) { if (result.error != null) lastresponse = "error response:\n" + result.error; else if (!fb.isloggedin) { lastresponse = "login cancelled player"; } else { lastresponse = "login successful!"; } } and screenshot method: ...

WCF REST Service not working with log4net -

i've written wcf rest service uses log4net. my problem cannot rest service , logging service work simultaneously. example: public string test() { //log.debug("test called."); return "xyz"; } calling method browser @ localhost:49721/myservice/test gives me result: xyz if uncomment logging row there correct output logfile. 2014-12-16 10:44:56,463 [25] debug myservice - test called. however, don't receive result rest service, when calling method browser. (using chrome developer tools can see see status "pending".) any suggestions? edit 1: this how initiate logger: private static readonly ilogger log = logmanager.getlogger(typeof(myservice));

css - LESSCSS check if closest parent has class -

i use: .first{ .second{ .third{ .between_second_and_third & { /* rules */ } } } } and in end have: .between_second_and_third .first .second .third {/* rules */} but want: .first .second .between_second_and_third .third {/* rules */} how can it? first, & marker refer current parent selector (as mentionned here ) that's why you've got final statement cause defined that: .first{ .second{ .third{ .between_second_and_third .first .second .third { /* rules */ } } } you have nest between_second_and_third class between... .second , .third class declarations this: .first{ /* first rules */ .second{ /* rules second */ .between_second_and_third { /* rules between */ .third{ /* other rules */ } } } this declaration render lines of css code: ...

javascript - How to apply smooth show/hide effect with slideToggle on jQuery -

i trying show hide content slidetoggle , wokign not getting smooth animation effect on table. i have tryied 2 code getting proper animation effect: $('.more').slidetoggle('fast'); $('.more').stop().slidetoggle(500); any idea how that? thanks. here jquery code work: $('#more').click(function () { $(this).text('see less'); if ($('.more').is(':visible')) { $(this).text('see more'); } else { $(this).text('see less'); } //$('.more').slidetoggle('fast'); $('.more').stop().slidetoggle(500); return false; }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <a href="#" id="more">more us</a> <table> <thead> <tr> <th>date</th> <th>address</th> ...

windows - How to prevent WiX from removing registry keys on patching -

i making patch using "wix only" method. is: torch -p -xi old.wixout new.wixout -out differences.wixmst pyro patch.wixmsp -t mypatch differences.wixmst -out patch.msp we write product key registry when install product. user prompted, part of installation, enter product key. when run patch, works fine removes product key registry. other installed registry keys remain; key added part of initial install removed. is there way create patch in way doesn't remove registry key? i can't 100% sure, sounds have made change in same feature registry key. believe cause windows installer 'repair' whole feature, , part of has decided remove registry key.

android - Download Files By Using AQuery Library -

i ussuing aquery , tring use library dowbload files dont understand how use it. thats sample code , don't understand it. aq.download(string url, file target, object handler, string callback) how derfine "object handler" , "string callback" ? you can try way file ext = environment.getexternalstoragedirectory(); file target = new file(ext, "image/test.jpg"); aq.download(imageurl, target, new ajaxcallback<file>(){ public void callback(string url, file file, ajaxstatus status) { if(file != null){ toast.maketext(getapplicationcontext(), "file:" + file.length() + ":" +file+"-"+status, toast.length_long).show(); }else{ toast.maketext(getapplicationcontext(), "download failed", toast.length_long).show(); } } ...

How to automatically call a JavaScript that modify a value before show this value? -

i new in javascript , have following problem solve. i have table contains td cell: <td class= "datetoconvert" width = "8.33%"> <%=saldettaglio.getdatacreazione() != null ? saldettaglio.getdatacreazione() : "" %> </td> this retrieve string object , show cell the problem retrieved string represent date having following horrible form: 20131204 , have convert following form: 2013-12-04 . so thinking create javascript work when value retrieved. my problem is: how can automatically call javascript before show value td cell? (so show modified output in desidered form) edit 1 : so have create thid javascript function page: function convertdata() { var tds = document.queryselectorall('.datetoconvert'); [].slice.call(tds).foreach(function(td) { td.innertext = td.innertext.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); }); } but don't work because never enter in function (i see us...

java - How do I fix "Error starting VisualVM" in Eclipse? -

i tried following steps: in eclipse under window > preferences > run/debug > launching > visualvm configuration . next visualvm executable, choose browse. , select jvisualvm.exe c:\program files\java\jdk1.6.0_32\bin . now when press run error starting visualvm - running visualvm using java runtime environment (jre). tried editing 'c:\program files\java\jdk1.6.0_32\lib\visualvm\etc\visualvm.conf' replacing #jdkhome="/path/to/jdk" #jdkhome=c:/program files/java/jdk1.6.0_32 , i'm still getting same error. how can fix error? open "visualvm_directory/etc/visualvm.conf" file , set jdk path in "jdkhome" attribute ex.: jdkhome=c:\program files\java\jdk1.7.0_67

objective c - Force quit OS X app -

which best way force quit os x or daemon process if know app/daemon name (the name appears in activity monitor)? i using objective c coding. you may use applescript that: //tell application quit nsapplescript* restartapp = [[nsapplescript alloc] initwithsource:@"tell application \"applicationname\" quit"]; [restartapp executeandreturnerror:nil]; if app not responding may try // define command nsstring* appname = @"finder"; nsstring* killcommand = [@"/usr/bin/killall " stringbyappendingstring:appname]; // execute shell command nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/bash"]; [task setarguments:@[ @"-c", killcommand]]; [task launch]; which kills app. good luck

upload - why codeigniter do_upload doesn't work on server? -

i have used codeigniter do_upload upload mp3 files on directory on server. codes work on localhost on production server browser keeps waiting server , processing , nothing happens after long time. $dirpath in following code path of destination directory on server. $data['info']=$this->cp_model->getinfo($service_id); $dirpath = '/var/li/sounds/'.$data['info'][0]->path; $config = array('allowed_types' => 'mp3' , 'upload_path' => $dirpath, 'overwrite' => false, 'max_size' => 0, ); $this->load->library('upload',$config); } if (isset($_post['submit'])) { $this->upload->do_upload();} most don't have write permissions on folder declared on $dirpath. consider uploading mp3 may 4-5 mb server side, can take minutes depending connection. to find ou...

Meteor is math.radians,math.degrees exist -

did math functionality exist in meteor.if please me how convert degree radians.i have convert latitude , longitude values degrees radians. yes. if want on server use meteor.methods if(meteor.isserver) { meteor.methods({ radians: function (degrees) { return degrees * math.pi / 180; }, degree : function(radians) { return radians * 180 / math.pi; } }); } or on client use this. if(meteor.isclient) { var convertradians = function (degrees) { return degrees * math.pi / 180; }; var convertdegrees = function (degrees) { return radians * 180 / math.pi; }; }

c# - How to get the exact Font out of Fontfamily? -

Image
i want create picturebox adapts shape string of font. need can later create texts , lay on axwindowsmediaplayer control. therefore created following class: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.drawing; namespace myproject { class shapedpictureboxes : picturebox { public shapedpictureboxes() { this.paint += this.shapedpaint; } void shapedpaint(object sender, painteventargs e) { system.drawing.drawing2d.graphicspath graphicspath = new system.drawing.drawing2d.graphicspath(); font font = new font("arial", 14f); float emsize = e.graphics.dpiy*font.size/72; graphicspath.addstring(text, new fontfamily("arial"), (int)system.drawing.fontstyle.regular, emsize, new point(0,0), new stringformat()); e.graphics.drawstring(text, font, brushes.red, new point(0, 0)); ...

jquery - Unable to set background-image property in "beforeunload" event -

i'm trying solve ie-problem of not animating .gif image, when displayed in beforeunload or unload events. step this answer , found not working, played little bit code. i have come that: var spinner = $('.spinner-large'), spinnerbackgroundimage = spinner.css('background-image'); console.log(spinnerbackgroundimage); console.log($('.spinner-large').css('background-image')); spinner.css('background-image', spinnerbackgroundimage); console.log(spinner.css('background-image')); spinner.show(); this not working. spinner displayed, there no background image. , console contains: backend-extra.js:97 url(http://127.0.0.1/images/spinner-large.gif) backend-extra.js:98 url(http://127.0.0.1/images/spinner-large.gif) backend-extra.js:102 none what missing? why can't set entire background-image property value jquery? note, don't want set path image in background-image property , because know , how sh...

java - How to break the if condition? -

package com.selenium.utitlity; import java.io.file; import java.io.ioexception; import java.util.hashtable; import org.apache.poi.xssf.usermodel.xssfrow; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook; public class readrows { public static hashtable<string, string> getrowvalues(int row) throws ioexception { file file = new file("./prop.xlsx"); if (file.exists()) { hashtable<string, string> table = new hashtable<string, string>(); xssfworkbook workbook = new xssfworkbook("./prop.xlsx"); xssfsheet sourcesheet = workbook.getsheet("sheet1"); int lastrow = sourcesheet.getlastrownum(); // getheading of row xssfrow headerrow = sourcesheet.getrow(0); // test data xssfrow sourcerow = sourcesheet.getrow(row); if (row > lastrow) { syste...

groovy - Connecting to ActiveMQ form grails -

i trying connect remote activemq server grails app. error: error failover.failovertransport - failed connect transport after: 5 attempt(s) not refresh jms connection destination 'queue' - retrying in 5000 ms. cause: jms connection has failed: connect timed out transport configuration of actievmq server : <transportconnector name="openwire" uri="tcp://0.0.0.0:61616?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> <transportconnector name="amqp" uri="amqp://0.0.0.0:5672?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> <transportconnector name="stomp" uri="stomp://0.0.0.0:61613?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> <transportconnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumconnections=1000&amp;wireformat.maxframesize=104857600"/> <transportconnector na...

C++ audio output -

i output audio stream (asynchronously) in c++. i have looked here , here , , here obsolete , link broken. i sure simple task, yet can't find anywhere on web it. prefer neat , tidy, stl oriented (e.g. device can write writing screeen?). using vc2013, can use windows precompiled headers prefer avoid it. thanks, update: i trying stay close stl, of it, can't, i'll stick windows api. playsound inappropriate because data not on file, in buffer in memory. have tried using waveoutwrite play 2 sound sequentially, i.e @ t=0 start sound 2 sec, , @ t=1 start sound 3 sec (overlap) there many different ways output audio, , can't list them here. since using windows, can use ms apis core audio or directsound . you can use cross platform api fmod ex . either way, outputting audio not hard, isn't trivial ; should expect ~10 api calls decent working audio stream example.

geolocation - Tracking geo-location in background every 5 mins interval with Windows Phone 8 -

i want geo-location every 5 mins interval , should run in backgound using windows phone 8 sdk. i've been thinking use periodic task runs in 20 mins interval not frequent enough. can run more using scheduledactionservice.launchfortest(periodictaskname, timespan.fromseconds(300)); but think not welcomed when want publish app in market. then i've checked continuously tracking location doesnt stop using gps sensor unless stop manually. i'll appreciate guidance lead me achieve goal. thanks help. using geolocator : geolocator = new geolocator(); geolocator.desiredaccuracy = positionaccuracy.high; geolocator.reportinterval = 5000; //here can set interval between every location tracked (in milisseconds) it works fine me

c# - How to prevent LocalDB from detaching MDF file after some idle time? -

i'm building .net 4.5 (winforms) application uses localdb work local mdf file, using connection string: data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\db\databasefile.mdf;integrated security=true;multipleactiveresultsets=true when run application, first sql query takes time execute - nothing drastic, 2 or 3 seconds. after that, next sql queries executed instantly. assume seconds during first execution needed attach mdf file local sql server service. right? i noticed, however, if 10 minutes (or so) pass since sql query last performed, next sql query again take 2-3 seconds more execute. assume after idle time, mdf gets detached, , when new sql command called, re-attaches once again. i'm wondering, there way override behavior? i know create timer , performs simple query every few minutes, there better, cleaner solution? i more suspect data / index no longer in memory. you run fast query select 'a' know if connect time. as forcing ...

sql server - Stopping an SQL Cursor with one of two conditions -

i have cursor want stop running based on 1 of 2 conditions. 1 based on data of table, , other based on fetch status. right cursor ignores both , keeps running. this part of have: open demandcur fetch next demandcur @...., @++++ while @index > 0 or @@fetch_status = 0 begin select ...., ++++ from...... --after doing stuff here--- fetch next demandcur @...., @++++ end close demandcur deallocate demandcur should not and, , not or? if of conditions true, query keep running. , in case @@fetch_status true, until end

docker - --cap-add in Google Container Engine -

i running issue google container engine unable add capabilities running of docker container. i need able alter iptables can forward traffic through docker vpn container. the docker container runs fine when able pass --cap-add=net_admin run command, since gce (seemingly) able run images not seem possible. insufficient permissions error when running docker image , fails deploy. is there anyway around can alter the iptables ? or gce not have ability? i have checked out issue . references building image privileges doesn't seem close resolved. my iptables commands reference: iptables -t nat -a postrouting -s 10.0.0.0/8 -o eth0 -m policy --dir out --pol ipsec -j accept iptables -t nat -a postrouting -s 10.0.0.0/8 -o eth0 -j masquerade there pull request filed yesterday add feature kubernetes. once has been added kubernetes should able test building head , deploying cluster gce. this feature show in google container engine shortly after next release of kube...

Cannot browse local Azure Storage Emulator in VS2013 - Azure SDK 2.4/2.5 -

when using server explorer in vs2013, cannot browse blob storage under development. receive error: "failed connect microsoft azure storage emulator" i have started vs administrator. i having issue using azure sdk 2.4 updated 2.5 , getting same result. however, can browse emulator using azure storage explorer 6. any ideas?

wkhtmltopdf - save a html string to PDF in python -

i have html string want store pdf file in python. using pdfkit purpose. below code tried purpose. in below code trying serve image via tornado server. class mainhandler(requesthandler): def get(self): self.write('hello!') class imagehandler(requesthandler): def get(self): d={} d["mov1"]=1 d["mov2"]=10 d["mov3"]=40 d["mov4"]=3 py.bar(range(len(d)),d.values(),align="center") py.xticks(range(len(d)),d.keys()) io=stringio() py.savefig(io,format='svg') self.set_header("content-type", "image/svg+xml") print io.getvalue() config = pdfkit.configuration(wkhtmltopdf='e:\\wkhtmltopdf\\bin') pdfkit.from_string(io.getvalue(),"e:\\hello.pdf",configuration=config) #error here self.write(io.getvalue()) app = application([ url(r"/", mainhandler...

swing - Java Graphics: setClip vs clipRect vs repaint(int,int,int,int) -

similar last post apologies, lot less long winded. wondering best option optimising redrawing jframe/jpanel when each repaint call small part of screen redrawn. also apart overloading repaint not 100% on how implement setclip or cliprect. understanding used when overriding paint or update? see below code: public class aquasim extends jpanel { //variables //other methods... public void paint (graphics g) { super.paintcomponent(g); //needed? graphics2d g2d = (graphics2d) g; //draws land area penguins. g2d.setcolor(new color(121,133,60)); g2d.fill(land); g2d.setcolor(color.blue); g2d.fill(sea); drawcreatures(g2d); } public void drawcreatures(graphics2d g2d) { (creature c : crlist) //a list of alive creatures { //each creature object stores image , coords. g2d.drawimage(c.createimage(txs,tys), c.getpos(1).width, c.getpos(1).height, this); } } } ideally prefer not ha...

Xamarin android C# ScrollView OnScrollChanged event -

in xamarin android how can extend scrollview in order use protected onscrollchanged event? specifically, how extend scrollview allow eventhandler registered onscrollchanged event? other methods of scrollview need implemented in class extends scrollview? reasons: the android scrollview not have way listen scroll event. there have been various questions regarding how extend scrollview in native android java, however, there not question , answer addressing how apply xamarin. in order extend scrollview in way should implement 3 constructors public usefulscrollview(context context) public usefulscrollview(context context, iattributeset attrs) public usefulscrollview(context context, iattributeset attrs, int defstyle) we need override ondraw method protected override void ondraw(android.graphics.canvas canvas) to achieve functionality of event can respond when user scrolls need override onscrollchanged method. protected override void onscrollchanged(int l, int t,...

php - Multipe flush with doctrine -

i have load users/students list .csv file. each student member of 1 promotion. in file have users' infos , name of promotion. have insert promotions before inserting students. part works. protected function execute(inputinterface $input, outputinterface $output) { /* works */ $start = new \datetime(); $output->writeln('[start] time : ' . $start->format('h:i:s')); $f = fopen($input->getargument('filename'), 'r'); if ($input->getoption('has-headers')) fgetcsv($f, null, ','); $doctrine = $this->getcontainer()->get('doctrine'); $em = $doctrine->getmanager(); $um = $this->getcontainer()->get('fos_user.user_manager'); $promorepo = $em->getrepository('planningbundle:promotion'); $promotions = $promorepo->findall(); /** @var promotion[] $promosidx */ $promosidx = array(); foreach ($promotions $promotion) { $...

ios - Querying CloudKit Users Record gives "Can't query system types" -

okay, i'm building game on top of cloudkit , want query users top 50 scores leaderboard. // create ckquery let predicate = nspredicate(value: true) let sortdescriptor = nssortdescriptor(key: "score", ascending: false) var query = ckquery(recordtype: "users", predicate: predicate) query.sortdescriptors = [sortdescriptor] // create query operation var queryoperation = ckqueryoperation(query: query) queryoperation.resultslimit = 50 queryoperation.recordfetchedblock = { (record: ckrecord!) -> void in self.records.append(record) } queryoperation.querycompletionblock = { (cursor: ckquerycursor!, error: nserror!) in // log error , show , alert if error != nil { println("error querying leaderboard: \(error)") var alert = uialertcontroller(title: "unable donwload leaderboard", message: "unable download leaderboard @ time. please try agin later.", preferredstyle: uialertcontrollerstyle.alert) aler...

Self-modifying Python code to keep track of high scores -

i've considered storing high scores game variables in code rather text file i've done far because means less additional files required run , attributing 999999 points becomes harder. however, require me run self-modifying code overwrite global variables representing scores permanently . looked , considering want change global variables, stuff found advanced. i'd appreciate if give me explanation on how write self-modifying python code just that, preferably example aids understanding. my first inclination "don't that". self-modifying python (really language) makes extremely difficult maintain versioned library. you make bug fix , need redistribute - how merge data stored via self-modification. very hard authenticate packaging using hash - once local version modified it's hard tell version originated because shas won't match. it's unsafe - save , load python class that's not stored package, however, if it's user writab...

html - CSS divs don't align correctly -

that's simplified code have 1 absolute div 4 relatives divs inside 4 columns. why inside divs don't align top of external div? p.s.: know there's other ways make real code more complex , that's kind of solution need. <div style="position: absolute; top: 100px; left: 100px; width: 800px; height: 400px; background-color: red; margin: 0; padding: 0;"> <div style="position: relative; display: inline-block; height: 100%; width: 25%; background-color: blue;"> <p>1</p> <p>2</p> <p>3</p> <p>4</p> </div><div style="position: relative; display: inline-block; height: 100%; width: 25%; background-color: yellow;"> <p>1</p> <p>2</p> </div><div style="position: relative; display: inline-block; height: 100%; width: 25%; background-color: green;"> <p>1</p> <p>2...

Server side automation testing using Java and JSON requests -

i have not done automation testing before, junit testing, have request that. automation not on frontend using selenium or so, simpler that, using jsons requests. understand principles of that, don't know how programmatically correct. have payment request server , see if response correct, not code, details of response well. so far have done part request server, when receive response, best way compare or check it, or how can see if right? can point me in right direction? if understanding requirement correctly, then: first check format of request , response. as said json, can using java. use java package - org.json.jsonobject create request , validate json format. you can send request , response simple code: closeablehttpclient httpclient = httpclients.createdefault(); httpget getrequest = new httpget("serverurl"); closeablehttpresponse response = httpclient.execute(getrequest); use packages: import org.apache.http.impl.client....

expand/collapse using jQuery / JavaScript -

i tried use that jquery function nishutosh sharma (2nd post) collapse , expand sidebar. right won't work, can't find mistake. please me? the function in javascript function expandlist(){ $("#samples").attr("collappsed", "expanded"); } this html: <div id="samples" class="collappsed" onclick="expandlist()"> <ul id="sample-list" class="list"></ul> </div> this css: .expanded { left: 0px; } .collappsed { left: -130px; } more css find in fiddle collapsed not attribute. value of class attribute. function expandlist(){ $("#samples").toggleclass("collappsed expanded"); } you fixed jsfiddle: http://jsfiddle.net/gaby/a7e9xrgb/2/

asp.net mvc 4 - JQuery/MVC selected option does nog change from script -

in mvc application have 2 drop-down lists. second gets populated based on choice made in first one. 'start' value db pushed view second drop-down setting data-zatara-workyearid attribute. updating second 1 done updateworkyeardropdown() function. after loading document call function populate second dropdown start on. far good. the result : <select class="form-control" data-val="true" data-val-number="the field work year must number." data-val-required="the work year field required." data-zatara-workyearid="6" id="workyearid" name="workyearid"> <option value="4">boekjaar 2014</option> <option value="5">boekjaar 2015</option> <option value="6">boekjaar 2016</option> </select> in $(document).ready function try set selected value value stored in data-zatara-workyearid. here goes wrong. have tried dozen combination working, none...

c++ - String Printer problems: no known conversion for argument X from ‘char (*)[xx]’ to ‘char**’ -

if there 1 thing hate c++ pointers. checked other thread , still not make work. code pretty simple, passing string of character in parameter, want pass in reference modify content of string. don't want use std classes. here code: the function declared this: public: static void bitfield_to_strfield ( s_enhancedsqlobject_strfield hash[], char **str, int bitfield ); i trying call function this: enhancedsqlobject::bitfield_to_strfield ( strfld_elemental_property, &p_resistance_str, p_resistance ); the string declared as: private: char p_resistance_str [ enhancedsqlobject_strfield_len ]; i following error no known conversion argument 2 ‘char (*)[94]’ ‘char**’ according thread c++ char*[] char** conversion there seems sort of implicit conversion problem. tried creating temporary variable before passing in parameter , still not work. char **tmptr = &p_resistance_str; gives me cannot convert ‘char (*)[94]’ ‘char**’ in initialization the reason if r...

java - What is the purpose of Objects#requireNonNull -

after checking javadocs method thinking of using, requirednonnull , stumbled across first 1 single parameter (t obj) . however actual purpose of particular method signature? throw , npe i'm positive (as may missing obvious here) thrown anyway. throws: nullpointerexception - if obj null the latter makes sense in terms of debugging code, doc states, it's designed parameter validation public static <t> t requirenonnull(t obj,string message) checks specified object reference not null , throws customized nullpointerexception if is. therefore can print specific information along npe make debugging hell of lot easier. with in mind highly doubt come across situation i'd rather use former instead. please enlighten me. tl;dr - why ever use overload doesn't take message. a principle when writing software catch errors possible. quicker notice, example, bad value such null being passed method, easier find out cause , fix proble...

php - Codeigniter not able to connect to firebird -

i have seen , tried solutions in codeigniter - multiple database connections , you have specified invalid database connection group codeigniter error , firebird - codeigniter connection , none of them worked. $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'root'; $db['default']['password'] = ''; $db['default']['database'] = 'testing'; $db['default']['dbdriver'] = 'mysqli'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = true; $db['default']['db_debug'] = true; $db['default']['cache_on'] = false; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['defaul...

Grouping by year - mySQL -

i have mysql database date field. i need find years in entries. for example. if there 5 entries in 2014, , 1 in 2015. 2014 , 2015 output. i think needs done group by have tried. not sure how complete inner query, think needs done. select field_id_34 start_date exp_channel_data channel_id = 5 group year(field_id_34) can tell me if needs done? , possibly how? if want know distinct years represented in data, want this: select distinct year(field_id_34) year exp_channel_data channel_id = 5 i have no idea field_id_34 is, i'm inferring post date field. also, assume have reasons filter, although not know reasons are. trust can fill in details on end.

c# - Modify existing object with new partial JSON data using Json.NET -

consider below example program var calendar = new calendar { id = 42, coffeeprovider = "espresso2000", meetings = new[] { new meeting { location = "room1", = datetimeoffset.parse("2014-01-01t00:00:00z"), = datetimeoffset.parse("2014-01-01t01:00:00z") }, new meeting { location = "room2", = datetimeoffset.parse("2014-01-01t02:00:00z"), = datetimeoffset.parse("2014-01-01t03:00:00z") }, } }; var patch = @"{ 'coffeeprovider': null, 'meetings': [ { 'location': 'room3', 'from': '2014-01-01t04:00:00z', 'to': '2014-01-01t05:00:00z' } ] }"; var patchedcalendar = patch(calendar, patch); the result of patch() ...

interface - how to code a command for monitor for this case -

i want see min trade_price on interface of monitor. agents. sellers , buyers has 0 trade_price when dont have agent in same patch. want see min trade_price of agents have agent in 1 patch. i code : min [trade_price] of turtles i need code here, have idea? best regards how min [trade_price] of turtles [trade_price > 0] (not tested)

How do I simulate session cookies for RESTful service (Grails, Shiro)? -

i have existing grails application uses nimble plugin (therefore apache shiro security underneath). i adding restful json api it. my login method manages session id shiro , returns client: class apicontroller { def login(string username, string password) { def authtoken = new usernamepasswordtoken(username, password) securityutils.subject.login(authtoken) render(contenttype:"text/json") { [ sessionid: securityutils.subject.getsession().getid() ] } } def getdata() { securityutils.subject... // either expect find populated securityutils.subject or way otherwise } } this looks like: {"sessionid":"61fe89f60f94a4ef7b796783e7a326bc"} that quite encouraging, same 1 see being passed in cookie when browser: cookie:auth=z3vlc3q6dgx1c2lz; m=2663:t|34e2:|47ba:t|4e99:t|6ef2:t|370d:t|3c0d:t|64b8:t|2a03:t|18c3:t|79d4:chart|640c:small|678e:3600%7c60|796a:t;...

Getting a 2D histogram of a grayscale image in Julia -

using images package, can open color image, convert gray scale , : using images img_gld = imread("...path color jpg...") img_gld_gs = convert(image{gray},img_gld) #change floats array of values between 0 , 255: img_gld_gs = reinterpret(uint8,data(img_gld_gs)) now i've got 1920x1080 array of uint8's: julia> img_gld_gs 1920x1080 array{uint8,2} now want histogram of 2d array of uint8 values: julia> hist(img_gld_gs) (0.0:50.0:300.0, 6x1080 array{int64,2}: 1302 1288 1293 1302 1297 1300 1257 1234 … 12 13 13 12 13 15 14 618 632 627 618 623 620 663 686 189 187 187 188 185 183 183 0 0 0 0 0 0 0 0 9 9 8 7 8 7 7 0 0 0 0 0 0 0 0 10 12 9 7 13 7 9 0 0 0 0 0 0 0 0 1238 1230 1236 1235 1230 1240 1234 0 0 0 0 0 0 ...

android - Google Hangouts SMS Update not working for sms_body or Intent.EXTRA_TEXT -

after yesterday's update google hangouts (dec 15, 2014), trying pre-populate body/message sms not working. sendintent.putextra("sms_body", text); sendintent.putextra(intent.extra_text, text); anyone have solution fix or have wait update google?

mongoose - Mongooose query where ObjectId is null? -

how can search document doing .findone objectid field not set? cannot find if should searching on null or undefined or else. in example below, i'm trying find document "email" value known userid has not yet been set: var joinrequest = new mongoose.schema({ email: { type: string, unique: true, lowercase: true, trim: true }, code: { type: string, uppercase: true, trim: true, select: false }, lastsent: { type: date }, userid: { type: mongoose.schema.types.objectid, select: false } }); then again, can objectid field ever null? should use string here? few things undefined in context of mongodb properties value undefined not stored. following have no a property db.insert({a : undefined}) however arrays undefined values converted null db.insert({a : [undefined]}) //stores {a : [null]} also undefined has weird behaviors when used condition db.users.find({a : undefined}) //finds db.users.findone({a : undefined}) //alway...

Powershell SSL TLS Cipher Suites For HTTPS Connections -

i'm trying use powershell grab html content https site. unfortunately, site excepts limited set of ssl / tls cipher suites , suites available powershell not supported. i following error message if try use invoke-webrequest cmdlet: invoke-webrequest : request aborted: not create ssl/tls secure channel. questions: is there way specify client ssl / tls cipher suites powershell uses? is there cmdlet can use send web requests? i'd not have switch alternate language, may have if there isn't way specify cipher suite used powershell. here suites server supports: tls_dhe_rsa_with_aes_256_gcm_sha384 (0x9f) tls_dhe_rsa_with_aes_256_cbc_sha256 (0x6b) tls_dhe_rsa_with_aes_256_cbc_sha (0x39) tls_dhe_rsa_with_camellia_256_cbc_sha (0x88) tls_dhe_rsa_with_aes_128_gcm_sha256 (0x9e) tls_dhe_rsa_with_aes_128_cbc_sha256 (0x67) tls_dhe_rsa_with_aes_128_cbc_sha (0x33) tls_dhe_rsa_with_seed_cbc_sha (0x9a) tls_dhe_rsa_with_camellia_128_cbc_sha (0x45) ...

Python Requests GET and POST to website with verification token -

i'm using python 3.3 , requests library basic post request. i want simulate happens if manually enter information browser webpage: https://capp.arlingtonva.us/tap/ac_xwtappay.aspx . example, try entering "2. parking tickets", clicking next, entering 1234 plate number , virginia state , clicking next, , checking checkbox , clicking next. although url same, there multiple iterations of inputting information , clicking next. currently, doing on url randomly generated strings values "__eventvalidation" , "__viewstate" in source code. post information other information. am using right post payload below in code? my code is: import requests url = r'https://capp.arlingtonva.us/tap/ac_xwtappay.aspx' #get request s = requests.session() r = s.get(url) text1 = r.text #getting "__eventvalidation" value: eventvalstartstring = r'id="__eventvalidation" value="' eventvalstart = text1.find(eventvalstartstring)+...