Posts

Showing posts from June, 2013

reflection - Create Dynamic class in c# -

string name = "register"; class<?> classobj = class.forname(name); statecomponent = (istate) classobj.newinstance(); this code creating dynamic class in java. can give me start how make dynamic class in c#? c#'s class corresponds java's class<t> system.type . unlike java, type not generic (it not need be, because .net not use type erasure implement generics). your java code translates follows: string name = "..."; // full name of class type typeobj = type.gettype(name); // default constructor constructorinfo constr = typeobj.getconstructor(new type[0]); // invoke constructor create object statecomponent = (istate)constr.invoke(new object[0]);

vb.net - Editing hex of code of an application -

i have seen few application can edit blocks of hex giving valid offset. the question is, how that? there function allow binary string editing in vb.net? there no on google, tell me how can edit application source in vb.net in hex editor? have @ this : call file.openwrite filestream file set stream.position jump location want edit call stream.write overwrite bytes in file.

pycrypto - Why must all inputs to AES be multiples of 16? -

i'm using pycrypto implementation of aes , i'm trying encrypt text (24 bytes) using 24 byte key. aes_ecb = aes.new('\x00'*24, aes.mode_ecb) aes_ecb.encrypt("123456"*4) i surprising error valueerror: input strings must multiple of 16 in length why input must multiple of 16? make more sense me input string length must multiple of key size, because allow nice bitwise operations between key , blocks of plaintext. aes block cipher . quote wikipedia page: “a block cipher deterministic algorithm operating on fixed-length groups of bits”. aes can work blocks of 128 bits (that is, 16 chars, noticed). if input can have lengths others multiple of 128, depending on application, may have extremely careful how handle padding .

uitableview - iOS: scrollToRowAtIndexPath doesn't display correct top indexpath for last page -

Image
i trying scroll tableview programmatically coded following. please note have increased content size can see few last few remaining rows. can scroll manually correctly required indexpath @ top programmatically it's not happening. [tableview reloaddata]; cgsize size = tableview.contentsize; size.height += 1000; tableview.contentsize = size; int rows = [tableview numberofrowsinsection:0]; int numberofrowsinview = 17; (int = 0; < ceil((float)rows/numberofrowsinview); i++) { [tableview scrolltorowatindexpath:[nsindexpath indexpathforrow:i * numberofrowsinview insection:0] atscrollposition:uitableviewscrollpositiontop animated:no]; .... } for total rows 60, expect code return cell views of 0-16, 17-33, 34-50, 51-59 last scroll returns 43-59 i.e. full 17 rows view while based on above code, top indexpath should 51 last page! can please me sort out. thanks. this manually scrolling image: this done programmatically: if 17 rows fit on screen can't

C socket program as web server to run in cloud, not receiving any response from browser -

i'm trying develop web server program using c++ suppose run on cloud machine running amazon machine. wrote code in c, won't receive response web browser when ip address , port number entered in address bar. however, receives response localhost . here's source code: #include<stdio.h> #include<string.h> #include<sys/socket.h> #include<arpa/inet.h> #include<unistd.h> int main(int argc , char *argv[]) { int socket_desc , new_socket , c; struct sockaddr_in server , client; char *message; //create socket socket_desc = socket(af_inet , sock_stream , 0); if (socket_desc == -1) { printf("could not create socket"); } server.sin_family = af_inet; server.sin_addr.s_addr = inaddr_any; server.sin_port = htons( 8080 ); //bind if( bind(socket_desc,(struct sockaddr *)&server , sizeof(server)) < 0) { puts("bind failed"); return 1; } puts("bind done"); listen(socket_desc , 3); puts("waiting inc

iexpress resulting executable not a valid win32 application on XP -

i'm using 32-bit iexpress.exe found in c:\windows\syswow64. resulting .exe file fine on windows 7 , windows 8 (x64) can confirm 32-bit app. when trying run on xp, won't, claiming it's not valid win32 application. the similar complaints can find running iexpress .exe's on win2000. don't have 32-bit windows 7 or 8 use check with. can use iexpress on xp create package, version doesn't 1 particular thing newer versions on 7/8 want, hoping find solution newer iexpress. there error in express.exe on windows 8 / server 2012. self extracting packages has dependencies msvcrt (function memcpy_s , except_handler4_common ) not available in mcvcrt.dll on windows xp sp3. error has been fixed microsoft in windows server 2012 r2.

html5 - How to get the Menu with list of choices using jquery? -

Image
i'm trying menu different style in jquery mobile list of choices in page footer.like shown below. updated: my code here in keep menu option in header when keep footer show options in menu below. try: function(event) { console.log(event.currenttarget); }

c++ - floating point values read from file and calculations discrepancy -

i have dll reads floating point values binary files, makes simple calculation , gives boolean result. each file 8bytes length variables of type double ( visual studio 2008 ). calculation simple: if( fa < fb - ( ix * fc ) ) { return( 1 ); } else { return( 0 ); } this dll loaded , function called 2 different applications on same pc. debug reasons values read files written files, calculations split parts , written files. each app outputs same files except final result! 1 application gives 1, 0. dll compiled /mt /fp:precise /od options. ideas please? unless dll goes out of way have different paths on different architectures (for instance 387 path , sse path), possibility @ least 1 of applications changes fpu state. typically, rounding mode, in case of 387 fpu , can significand width @ instructions compute (“the x87 can configured via special configuration/status register automatically round single or double precision after each operation”).

codeigniter - Calling another controller within a controller if already logged in -

i have login controller, check wether logged in or not so if($logged_in){ $this->load->view('profile_view'); } else{ $this->index(); } like can see i'm loading view if im not logged in. instead of loading view i'd rather have load controller loads view, because want send data controller view. so want this if($logged_in){ $this->load->controller('profile_controller'); } and in profile controller put this function index(){ $logged_in = $this->logged_in->is_logged_in(); if($logged_in){ $this->load->model('profile_model'); if($query = $this->profile_model->getalluserinfo()){ $data['records'] = $query; $this->load->view('profile_view', $data); } } else{ echo "you don't have access on page"; } } but seems loading controller controller isn't possible! how can create view while se

Cannot start activity on Android through Unity -

i'm using unity create android application. i have 2 plugins. each works fine on own, when want both of them used cannot switch activities between them. i have spent past ten days reading similar question , have tried decompiling/editing/recompiling java code doing unity itself, no luck. here final code have written, , errors get. my androidmanifest.xml file: ... <activity android:name="com.company.game.rrandroidpluginactivity" android:label="my game"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.browsable" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.codiwans.iab.iab" android:screenorientation="landsc

unix - Display something in specific day with PHP -

ive got products on site going importat people in specific day, lets products perfect display on valentine's day, of them @ first of april , many products in many other days. question is: how can let site display specific products in specific days? i think there should way can use unix time in db , every day load script check current unix time unix time in db bit complicated (unix time in second , need specific days not hours or seconds) wonder if there easier way how pseudo code no specifics given... first create array/object representing promotions: $promos = array(array('product_id' => 566, 'date' => '12-04'), array('product_id' => 565, 'date' => '16-07'), array('product_id' => 565, 'date' => '23-07'), array('product_id' => 565, 'date' => &#

php - Codeigniter: Integrating Ion Auth screens with Bootstrap Modals -

if user clicks on link on page, check if user logged in in controller method. if not logged show login screen modal onscreen. works fine till point. if user give wrong user name password. next page appears new page without css. how return result modal login screen? view/index.php $('.index-product img').click(function() { var product = $('<div id="modal-productdetail" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"></div>'); $.ajax({ url: "<?php echo site_url('gallery/openproductdetail');?>", type: 'post', success: function(msg) { product.html(msg); product.modal('show'); } }); }); controller function openproductdetail() { if (!$this->i

What exactly are the benefits of using a PHP 5 DirectoryIterator over PHP 4 "opendir/readdir/closedir"? -

what benefits of using php 5 directoryiterator $dir = new directoryiterator(dirname(__file__)); foreach ($dir $fileinfo) { // handle has been found } over php 4 "opendir/readdir/closedir" if($handle = opendir(dirname(__file__))) { while (false !== ($file = readdir($handle))) { // handle has been found } closedir($handle); } besides subclassing options come oop? to understand difference between two, let's write 2 functions read contents of directory array - 1 using procedural method , other object oriented: procedural, using opendir/readdir/closedir function list_directory_p($dirpath) { if (!is_dir($dirpath) || !is_readable($dirpath)) { error_log(__function__ . ": argument should path valid, readable directory (" . var_export($dirpath, true) . " provided)"); return null; } $paths = array(); $dir = realpath($dirpath); $dh = opendir($dir); while (false !== ($

private key - X.509 Self Signed Certificates -

i'm trying understand more x.509 digital certificates. there seems lots of contradiction around. using bouncy castle generate key pair, using public static void savetofile(x509certificate newcert, asymmetriccipherkeypair kp, string filepath, string certalias, string password) { var newstore = new pkcs12store(); var certentry = new x509certificateentry(newcert); newstore.setcertificateentry(certalias, certentry); newstore.setkeyentry(certalias, new asymmetrickeyentry(kp.private), new[] { certentry }); using (var certfile = file.create(filepath)) newstore.save(certfile, password.tochararray(), new securerandom(new cryptoapirandomgenerator())); } this saves generated certificate disk. articles tell there no need password protect certificate there no private key stored in there. this article says certificate indeed contain private key . i guess have 2 questions me understand this: if generate keys in way, should password same pa

python 2.7 - vehicle type identification with neural network -

i given project on vehicle type identification neural network , how came know awesomeness of neural technology. i beginner field, have sufficient materials learn it. want know places start project specifically, biggest problem don't have time. appreciate help. importantly, want learn how match patterns images (in case, vehicles). i'd know if python language start in, i'm comfortable it. i having images of cars input , need classify cars there model number. eg: audi a4,audi a6,audi a8,etc you didn't whether can use existing framework or need implement solution scratch, either way python excellent language coding neural networks. if can use framework, check out theano, written in python , complete neural network framework available in language: http://www.deeplearning.net/software/theano/ if need write implementation scratch, @ book 'machine learning, algorithmic perspective' stephen marsland. contains example python code implementing ba

javascript - How to apply filter in Angular -

i new angular , apply filter json "place" objects. { "places": { "live": "true", "status": "default", "place": [ { "-name": "test", "-url": "http://myurl" }, { "-name": "test", "-url": "http://myurl" }, { "-name": "test", "-url": "http://myurl" } ] } } i thinking of applying filter this: <div ng-repeat="place in places | filter:{place:'http'}"> this wrong . there way apply filter "place" objects <div ng-repeat="place in places.place"> should work think

ruby - How do I install Rails on Windows using Development Kit? -

i'm new ruby , rails, i'm not confident install. when typed: gem install rails i got response saying need update path , download development kit . but, when enter: c:\users\tim\documents\ruby\dk.rb init i error windows saying not recognise file type. can easy understand solution? per instructions, supposed type: ruby dk.rb init

iphone - how to add custom view to interface builder in iOS -

this question has answer here: receiving error unknown class pfimageview in interface builder file parse 3 answers i using framework includes header .h files. there view called pfimageview have added story boards. did first dragging uiimageview custom prototype cell. changed uiimageview class pfimageview. dragged view class create iboutlet. when run app, error: unknown class pfimageview in interface builder file. [uiimageview setfile:]: unrecognized selector sent instance 0x97a9150 the framework added project target. .m file not viewable/available in framework. there else need have interface builder recognize file? maybe it's subclass of uiview, not uiimageview? or, why not alloc init pfimageview , addsubview?

transform Modelica to FMU? How to implement the process through Java -

everyone. want simulate modelica model, not use openmodelica or dymola, think if can transform model code fmu, call jfmi process. read corresponding material, still can not find material clear whole process. so, there know can detail process or implemented this? well, if have modelica model , want generate fmu, you'll need modelica compiler that. don't explain requirements well. example, dymola has interface java (although i'm not sure how supported these days). write java code make "system call" openmodelica (there may other more java friendly ways use openmodelica well). but assuming that, reason, methods not sufficient, might consider jmodelica.org compiler modelon or cymodelica cydesign since both of these implemented in java.

android - Error when creating project in AndroidStudio -

whenever try make new project in android, error failed import gradle project: not fetch model of type 'ideaproject' using gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'. build file 'c:\users\vvina_000\androidstudioprojects\myapplicationproject\myapplication\build.gradle' line: 9 problem occurred evaluating project ':myapplication'. problem occurred evaluating project ':myapplication'. not create plugin of type 'appplugin'. com.google.common.collect.maps consult ide log more details (help | show log) i opened build.gradle file , says is: // top-level build file can add configuration options common sub-projects/modules", there no line 9. had same problem recently. solution remove gradle , reset androidstudio: (osx mountain lion) show hidden files execute in terminal: defaults write com.apple.finder appleshowallfiles yes restart fi

nginx - Why does capistrano puts my Rails app in Releases folder? -

after fighting through lot of issues, able deploy rails app ... whole rails directory structure in /var/www/-myappname-/releases/-datetimestamp- folder i expected app put /var/www/-myappname- routing work? missing here? did forget step? this done couple of reasons app doesn't go down during deploy (as files overwritten while app still running in same dir) so can , rollback in case of fuckup on deploy also, current release should symlinked /var/www/-myappname-/current , that's there server should point to.

excel vba - Google Maps Directions Only -

i working on project want display google map in webbrowser object in on excel sheet. have accomplished using url.... http://maps.google.com/?saddr=29.9390146,-90.0696139&daddr=29.962506,-90.1930133&f=d&output=embed i display driving directions same link (or different one). i cannot find info on how google maps return directions via url. ahia, larryr you want check out googlemaps api: static map api directions api these api provides xml response can parse them results displayed. made 1 find time , distance can use example: 1 of earlier attempts no xml used give idea how work responses google. public function gmap(origin_address string, destination_address string, optional mode integer = 1, optional datatype integer = 1) dim surl string dim oxh object dim bodytxt string dim time_e string dim distanc_e string dim strmode string if mode = 1 strmode = "walking" elseif mode = 2 strmode = "driving" elseif mode = 3 str

oop - JavaScript, trying to make my game more OOPey, broke it -

originally used var playerpaddle1 = {...} , got pong game working, want learn better oop techniques have: function paddle() { this.x = 50; this.y = 234; this.vx = 0; this.vy = 0; this.width = 19; this.height = 75; this.draw = function() { var self = this; var img = new image(); img.src = 'images/paddle.png'; img.onload = function(){ ctx.drawimage(img, self.x, self.y); }; }; this.update = function() { // divide velocity fps before adding // onto position. this.x += this.vx / fps; this.y += this.vy / fps; // collision detection if ( (this.x) < 0 ) { this.x = 0; } /*if ( (this.x + this.width) > (canvas.width / 2) ) { this.x = (canvas.width / 2) - this.width;*/ if ( (this.y) < 0 ) { this.y = 0; } if ( (this.y + this.height) > canvas.height) {

java - using javax.mail to send message -

i send email using javax.mail example@uni.ac.uk receiver@uni.ac.uk. have tried below code gives error put below. welcome. properties prop = new properties(); session sess = session.getdefaultinstance(prop,null); message msg = new mimemessage(sess); msg.setfrom(new internetaddress("example@uni.ac.uk", "sender")); msg.addrecipient(message.recipienttype.to, new internetaddress("receiver@uni.ac.uk", "receiver")); msg.setsubject("your example.com account has been activated"); msg.settext("testing messgage"); transport.send(msg); } error generated exception in thread "main" javax.mail.messagingexception: not connect to smtp host: localhost, port: 25; nested exception is: java.net.socketexception: permission denied: connect @ com.sun.mail.smtp.smtptransport.openserver(

sql - SQLite complex query -

for page on site need list of distinct usernames ordered descending percentage of deleted tweets. , column deleted1 1 means deleted tweet, 0 means not deleted (tweet exists), , 2 unknown. know complex query group by... use help. here table: create table twitt_tb ( link text primary key not null, username text not null, content text not null, datum integer not null, avatar text not null, nik text not null, deleted1 integer check (deleted1 in (0, 1, 2)) not null ); edit: additional clarification: need list of usernames ordered percentage, , percentage each user. percentage calculated users-deleted-tweets/total-tweets-of-that-user, , not user-deleted-tweets/total-tweets-of-all-users. the following gives proportion of deleted tweets user -- of tweets user known. select username, (sum(case when delete1 = 1 1.0 else 0.0 end) / sum(case when delete1 in (0, 1) 1.0 e

c++ - Truncate binary number -

this question has answer here: getting leftmost bit 9 answers i truncate every digit after first non 0 digit in binary representation of integer. need simple possible (no function or multiple lines of code). in example: // in c++ int int1=7,int2=12,int3=34; //needs work number using sort of operator (maybe bitwise combination?), need these give following values int1 -> 4 int2 -> 8 int3 -> 32 truncating in binary thing think of, open ideas. thanks! a pretty neat trick can used that: if ((v & (v - 1)) == 0) { return v; } v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; v >>= 1; return v; the idea " or in" ones below top 1 after decrementing value, , increment value @ end. added shift right @ end standard trick, because original code designed find small

Ruby: Why calling the superclass method on an object gives an error -

class a subclass of class b . class b subclass of class c . a object of class a . b object of class b . 1 of following ruby expressions not true? b.respond_to?('class') a.superclass == b.class a.superclass == b a.class.ancestors.include?(c) the answer quiz question (2). i understand why (1), (3), , (4) correct, (2) bit confusing. (2) confusing because when input a.superclass irb , got nomethoderror: undefined method 'superclass' #<a:0x7fbdce1075f0> . but when input a.superclass == b irb , true . why can call superclass on class not on class's object? class c end class b < c end class < b end = a.new b = b.new p b.class p a.superclass --output:-- b 1.rb:14:in `<main>': undefined method `superclass' #<a:0x0000010109bc88> (nomethoderror) why can call superclass on class not on class's object ? first, proper term "an instance of a". reason can call superc

Formatting JSON output in PHP MYSQL -

i trying devbridge autocomplete jquery script work, , oh close. can give me suggestions (dropdown values) need use it's data attribute. the suggested json formatting as follows: { suggestions: [ { value: "united arab emirates", data: "ae" }, { value: "united kingdom", data: "uk" }, { value: "united states", data: "us" } ] } so far, have managed this: { "suggestions": [ "show name 1", "show name 2" ], "data": [ "1", "2" ] } the code producing output follows: $reply = array(); $reply['suggestions'] = array(); $reply['data'] = array(); while ($row = $result->fetch_array(mysqli_assoc))//loop through retrieved values { //add row reply $reply['suggestions'][]=$row['show_name']; $reply['data'][]=$row['show_id']; } //format array json

javascript - nodejs cluster socket.io express app -

var httpsport = 8080, // used httpsapp httpport = 8000, // used httpapp numcpus = require('os').cpus().length; var credentials = { key: fs.readfilesync('./cert/client.key'), cert: fs.readfilesync('./cert/client.crt'), requestcert: true }; var cluster = require('cluster'), socketstore = require('socket.io-clusterhub'); var redis = require('redis'); var redisclient = redis.createclient(); if(cluster.ismaster) { for(var i=0; i<numcpus; i++) { cluster.fork(); } } else { var io = require('socket.io'), express = require('express'), httpsapp = express(), // https services httpapp = express(), // http services http = require('http'), https = require('https'); httpapp.configure( function () { httpapp.use(express.bodyparser()); httpapp.use(express.methodoverride); httpapp.

apache - XML to Google Map Markers -

i using xampp apache server project. project turn csv xml document using xmlhttprequest loop through xml document, extract attributes(such as: lat, long, , etc...) each location , create map point marker. below code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>read xml files google maps</title> <script src="http://maps.google.com/maps? file=api&amp;v=2&amp;key=abqiaaaa7_kd1t_m22hbf9fecadpzxqwcaty4fxmxywkk9lnwgtaqdnktbs1kbsteqrrpg2kwxundmf2jvcikq" type="text/javascript"></script> <script src="markermanager.js"></script> <script> var map; function initialize () { if (gbrowseriscompatible()) { map = new gmap2(document.getelementbyid("map_canvas")); map.setcenter(new glatlng(30.27

c# - must be a non-abstract type with a public parameterless constructor in redis -

when save object, got below error must non-abstract type public parameterless constructor in order use parameter 't' in generic type or method 'servicestack.redis.redisclient.store<t>(t) redisclass.getinstnace().store(msg); // error here redisclass.getinstnace().save(); as third party's class, can not edit how save object? could create wrapper around third party object call constructor, store wrapper? e.g. public class mywrapper { public thirdpartyobject thirdpartyinstance { get; set; } public mywrapper() { thirdpartyinstance = new thirdpartyobject("constructors"); } }

android - Galaxy S IV does not have voice recognizer intent? -

i created app uses voice recognition , works on phones on new galaxy s iv , galaxy note ii fails with: java.lang.runtimeexception: unable start activity componentinfo{<my.pakage.myactivity>/<my.pakage.myactivity>}: android.content.activitynotfoundexception: no activity found handle intent { act=android.speech.action.recognize_speech (has extras) } @ android.app.activitythread.performlaunchactivity(activitythread.java:2247) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2297) @ android.app.activitythread.access$700(activitythread.java:152) @ android.app.activitythread$h.handlemessage(activitythread.java:1282) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:137) @ android.app.activitythread.main(activitythread.java:5328) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:511) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1102

javascript - How to get the new URL after URL redirect -

http://www.mcmaster.ca/academic/faculties.cfm when type url above in browser, redirects me new url: http://www.mcmaster.ca/vpacademic/faculties.html is there method can use obtain redirect url given first one? to programatically little difficult since original url redirects second url via client side redirect (with javascript) , not server side 1 (with 301 or 302 , location header). this particular site using javascript code redirect: <script type="text/javascript"> <!-- window.location="http://www.mcmaster.ca/vpacademic/faculties.html"; //--> </script> you use called headless browser (such phantomjs ) programatically load first url , execute javascript end @ second url. this answer provides more details headless browsers: https://stackoverflow.com/a/20231244/1547546 .

Pdf libraries that allow rendering and editing in android -

i working on android application requires rendering , editing pdf file. have tried using pdftron, editing functionalities inbuilt. need library allow me add own editing functionality. you can make pdftron work. can't use built in view. instead, use functionality render page bitmap, , draw bitmap onto own view. can add editing functionality , draw onto pdf using pdftron. moderate amount of work though, if want scrolling, zooming, , other things view built in. of course not going different using other library, , pdftron works on pdfs pretty start if can afford freaking insane license fees.

Android ListView: looping through json array to list -

been working on few hours now, not sure how should going sorting through test array. i've tried few different options have seen posted 1 simplest implement project. suggestions or ideas might me on hump? json array php { "questions": { "0001": { "title": "what stackoverflow", "answer": "c", "user": "testuser", "date": "0000-00-00", "used": "0" }, "0002": { "title": "what stackoverflow", "answer": "c", "user": "testuserb", "date": "0000-00-00", "used": "1" }, "0003": { "title": "what stackoverflow", "answer": "c",

docx - Identify table ID in microsoft word -

there lots of table in word document. want uniquely identify table microsoft offfice doesn't provide unique identifier(id) them. there way identify microsoft word table uniquely? problem: user provides me word file tables. have convert them images. if user provides me same file content of table has been updated have update image. delete , again generate image not worked in case because can't change name of image first assign it. what tried. generate xml of word doc , there id or unique identifier. no such thing exists. look @ table properties 1 field alt text still not relible because user can change it. this how table looks in xml (3*3): <w:tbl> <w:tblpr> <w:tblstyle w:val="grilledutableau"/> <w:tblw w:type="auto" w:w="0"/> <w:tbllook w:firstcolumn="1" w:firstrow="1" w:lastcolumn="0" w:lastrow="0"

javascript - Problems with jQuery Resizable & Draggable -

i'm trying build simple photo editing module using jquery ui on our website's products page, i'm having serious problem getting thing done. issue i'm facing in first load works fine. when load image again, draggable stop working, means dragging works drop wont. cannot drop image when start dragging it. , resize handle stays same place in first image. below code (some of it, reckon important) html <div id="pp-dlite-area"> <div id="dl-canvas"> <div class="dl-design-mask">&nbsp;</div> <div class="dl-photo-wrap"> <img id="pp-dlite-photo-mask1" class="dl-photo" /> <img id="pp-dlite-photo-image1" class="dl-photo-img dl-linked" /> <img id="pp-dlite-photo-trans1" class="dl-photo-trans dl-linked" /> <div class="dl-photo-trap dl-linked">&nbsp;</div>

backbone.js - Variable passed into backbone view coming up undefined -

i in process of learning backbone / underscore, , finding more break away basic stuff in tutorials, more come realize tutorials aren't teaching me of anything. my current problem passing variable view. have 3 different templates available, render same, hoping pass template use view when being rendered collection. thought work adding property call view, , accessing this.options.property, throwing error property undefined. i have tried number of variant options, nothing seems work. doing wrong? thanks advance. var projectlistview = backbone.view.extend({ el: '#projectlist', initialize: function() { this.collection = masterprojectlist; this.render(); }, render: function() { this.$el.html(""); this.collection.each(function(project) { this.renderitem(project); }, this); }, renderitem: function(project) { var projectview = new projectview({model: project, projecttype: '#theatricalpro

angularjs - pyramid not work with angular $http post -

$http({method: 'post', url: 'http://localhost:5001/products', data: {token: $scope.product.token}}).success( function () { alert('success'); } ); in pyramid side, request.post show novars: not form request. not html form submission( content-type: application/json) i using cornice provide api(/products) , thinks pyramid's problem. does have solution? angular sends post body (data) application/json while forms sent application/x-www-form-urlencoded . pyramid parses body , let access in request.post when it's encoded normal form. it not possible represent every data encoded angular way (json) key/value pair provided pyramid api. [ 1, 2, 3, 4 ] solution on pyramid side it can solved per view or globally per view this pyramid way , flexible way handle this. @view_config(renderer='json') def myview(request): data = request.json_body # deal data. return { "success"

php - AJAX no data showing up from server request -

i tryng ajax post seperate php file , have data put div. ultimate goal set long poll auto updating, baby steps. so nothing shows in div when page loaded. checked console , ajax send 'initiate' post doesn't seem receive except headers. fixed whole time missing curly brackets. syntax guys. here code php file ajax calls <?php require "dbc.php"; $function = $_post['function']; switch($function) case('initiate'): $search="select * feedtest order id desc"; $request = mysql_query($search); $mostrecent= mysql_fetch_array($request); $mostrecentid = $mostrecent['id']; header("content-type: application/json"); echo json_encode($mostrecentid); break; case('update'): $search="select * feedtest order id desc"; $request = mysql_query($search); $update= mysql_fetch_array($request); $updateid = $update['id']; header("c

posix - Testing for leap seconds for a given time_t in Linux -

is there simple way of determining how many (if any) leap seconds applied given implementation of: time_t unix_seconds = mktime(&my_tm); for example, there field populated in my_tm? otherwise, suppose option test known time_t values given times bordering leap second transitions, nice if there more convenient. you reduce problem finding out how many leap seconds there between 2 time_t times. to find that, calculate tm struct both times ta , tb , , calculate number of seconds have passed since last hour doing atmstruct->tm_min*60 + atmstruct->tm_sec . store seca , secb . then calculate difftime of ta , tb . (diff + secb - seca) % 3600 should give number of leap seconds, long fewer 3600 leapseconds between ta , tb . basically, if there leap second inserted difftime should 1 larger difference between seca , secb.

How to run msbuild from ant so that I can see msbuild (compilation) errors on teamcity -

i have multilanguage project using java, c#, c++. , using ant script building , running test. currently, exec msbuild ant script , redirect msbuild output log files. if build fails on msbuild (.net) compilation errors should go artifacts , log file , search error in file. want see compilation error on overview tab of teamcity build (both java , .net). teamcity has msbuild task nant out of box, has no support msbuild on ant. of course can split build process in 2 parts: ant script java ant nant .net, it's undesirable. so, best way msbuild (compilation) errors on teamcity build page in case of msbuild called ant build script. i found answer in topoc: how teamcity recognize msbuild compilation errors, using rake runner . need run msbuild this: msbuild /l:jetbrains.buildserver.msbuildloggers.msbuildlogger, path dll

hyperlink - Jquery Mobile issue with sliding back when im clicking back -

i have great issue data-transition of a tag. when i'm clicking on tag goes right transition back(right left) , goes from left right . button(a tag): <a href="#account" data-direction="reverse" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-iconpos="notext" data-rel="back"></a> html structure: <!-- #account --> <div data-role="page" id="account"> <div data-role="panel" id="panel_menu" data-display="reveal"></div> <div data-role="header" data-position="fixed"> <div class="ui-btn-left"> <a href="#panel_menu" data-display="push" data-role="button" data-inline="true" data-icon="home" data-iconpos="notext"></a> </div>

json - Couldn't fix Future Task exception in android -

i'm pretty new in android programming, , i'm trying write piece of codes include httppost,json,asynctask etc. i'm getting error couldn't fix it. public void onclick(view v) { mainactivity.this.runonuithread(new runnable() { public void run() { requestloginfromserver rl = new requestloginfromserver(); rl.execute().tostring(); } }); } }); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } public class requestloginfromserver extends asynctask<object, object, object> { textview txt = (textview) findviewbyid(r.id.textview1); edittext edt = (edittext) findviewbyid(r.id.edittext1); @override protected object doinbackground(object... params) { httpclient httpclient = new defaulthttpclient(