Posts

Showing posts from May, 2014

c# - Access a button using its string name and change its back color -

i need access buttons using string names , change backcolor property. i tried using this.control[string key] , this.controls.find(string, bool) , none of these work. oledbconnection.open(); oledbcommand command = new oledbcommand("select * customer flightno = '" + variables.depflightno + "'", oledbconnection); oledbdatareader reader = command.executereader(); while (reader.read()) { string seat = reader[3].tostring(); this.controls[seat].backcolor = color.red; } reader.close(); oledbconnection.open(); oledbcommand command = new oledbcommand("select * customer flightno = '" + variables.depflightno + "'", oledbconnection); oledbdatareader reader = command.executereader(); while (reader.read()) { string seat = reader[3].tostring(); foreach (button s in this.controls) //if controls in different place //like panel or groupbox change "this.controls" "groupbox.cont

Please, someone explain me how working rewrite rules in WordPress -

i have read many posts here cant understand how rewrite rules workin. i need rewrite simple category path: http://example.com/category/plugin-reviews/ to: http://example.com/plugin-reviews/ for thes have used next code: function add_rules_for_rewrite() { add_rewrite_rule( '/plugin-reviews/?$', 'index.php?category_name=plugin-reviews', 'top'); flush_rewrite_rules(); } add_action( 'init', 'add_rules_for_rewrite' ); on pge checking rules: global $wp_rewrite; print_r( $wp_rewrite->rules ); and see rule: [/plugin-reviews/?$] => index.php?category_name=plugin-reviews why not working? thanx lot explaining! this make redirect rule work way wanted if permalink settings set default function add_rules_for_rewrite() { add_rewrite_rule( 'plugin-reviews/?$', 'index.php?category_name=plugin-reviews', 'top'); } add_action( 'init&#

Haskell Data.Vector.Storable.unsafeFromForeignPtr with C struct pointer/array field -

i'm using haskell ffi c library defines number of struct types containing members pointers double s, intended treated arrays of double s: typedef struct foo { int length; double* values; } foot; in haskell bindings library have equivalent data type in i'm trying use data.vector.storable.vector double array: data foo = foo { length :: int, values :: data.vector.storable.vector double } deriving (show, eq) in order marshall data between c library , haskell code, of course, have write storable instances these types. i'm trying work out way of using data.vector.storable.unsafefromforeignptr create haskell vector s double* arrays c library has allocated , populated on heap. i'm hoping doing can avoid copying contents of double* arrays , have vector kind of wrapper on array. (side question be: given double* arrays can 10,000s of double s, worth pursuing non-copying?) this have far. i'm using hsc2hs macros generate storable peek implementati

php - Logging in issues with salt and hash -

on registration page have used sha1 has , salt store passwords in database. think have done correctly when check database has salt included. how have done it. $newpassword = $_post['password'] ; if (!empty($newpassword)) { //escape bad characters //$newuser = mysql_real_escape_string($newuser); //remove leading , trailing whitespace $newpassword = trim($newpassword); $newpassword = sha1($newpassword); $salt = '-45dfehk/__yu349@-/klf21-1_\/4jkup/4'; } else die ("error: enter password"); and input is $query = "insert members (memberfirstname, membersecondname, memberemailaddress, memberpassword, memberaddress, memberpostcode) values ('$newfirstname', '$newsecondname', '$newemailaddress', '$newpassword$salt', '$newaddress', '$newpostcode')"; my problem lays when try login. im unsure on how remove salt , unhash password (if needs done). can enter email address , paste hash , s

javascript - How to extend called callback from another function -

i'm not sure title need use or need call i'm gonna do, here problem there code in sortable.js var sortablestuff; sortablestuff = { sortablelist = $('#mysortable'); init: function(){ sortablelist.sortable({ start: function(){ lot of codes here... }, stop: function() { codes here.. } }); } } i want extend start , stop function another file example mysortable.js still run start , stop callback 1 above. sortablestuff.sortablelist.sortable({ start: function(){ run code start before.. run new code } }) i'm not javascript expert, , don't know call i'm trying here, please me. you've got syntax error in first script, mixing object literals variable assignments. should be var sortablestuff = { sortablelist: $('#mysortable'), //

android - Sharing music Service with 2 activities -

i have fragment[1] plays music service , shows progress of song duration,songname etc. when click of albumart of song played, need show screen[2] music playing in same service , progress. passing values [1] [2], using intent .but both [1] , [2] not in sync.how make [1] , [2] both show , play same song,duration etc. changes should make in [1] , [2] both. calling service class in both [1] , [2]. edit creating service both in [1] , [2]. right way it? code in [1] : imgalbumart.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent testintent = new intent(getactivity(),playscreen.class); testintent.putextra("currentdur",currentduration); testintent.putextra("totaldur",totalduration); testintent.putextra("progress",progress); startactivity(testintent); } }); edit tried using broadcast receiver. public class musicintentrece

c# - T4 Template throws error when inserting a control block -

i using following line in text template file <settingsfilepath> <#=getparametervalue("blah")#>\deploy\settings\deploymentsetting_<#environment.name#>_<#=workflow.name#>.xml </settingsfilepath> when try modify line insert expression ( environment.type.tostring() ) follows <settingsfilepath> <#=getparametervalue("blah")#>\deploy\settings\<#=environment.type.tostring()#>\deploymentsetting_<#environment.name#>_<#=workflow.name#>.xml </settingsfilepath> i following error in visual studio compilation of tt templates an unexpected start or end tag found within block. make sure did not mis-type start or end tag, , not have nested blocks in template. does know doing wrong? <#= #> blocks matched. thanks everyone. worked around using string.format per aaron's suggestion <settingsfilepath><#=string.format(@"{0}\deploy\settings\{1}\deploymentsetting_{2}_{

github - Git, ignored files appear in every branch -

i have repo test-repo , contains 2 branches master , dev . files / directories in master branch's .gitignore files appear locally in both branches when git checkout them, assume normal behaviour files aren't being tracked git they're in test-repo directory no matter what. don't want happen. ideal setup below: when git checkout master local file / directory structure should so: test-repo/ .gitignore (this file contains `should-be-ignored.md`) should-be-ignored.md should-only-show-in-master.md when git checkout dev local file / directory structure should so: test-repo/ should-only-show-in-dev.md if has idea on how achieve setup i'd appreciate it. the real-world version: i'm working on github, when add branch of gh-pages acts free static web hosting essentially. have repo contains front-end web build boilerplate, master branch contains code , gh-pages branch include examples of code etc. when i'm working on boilerplate locally

c++ - typedef return type of template parameter's member function -

i'm trying typedef return type of member function of template argument. this: template <typename t> class dosomething{ typedef return_type (t::*x)(void)const data_type; data_type x1; }; in case, want typedef return type of const member function of template parameter, called x . in example return_type place holder, show want. won't compile. edit: reason want way is: want operations on x1 or other variable of type data_type in example, same precision return type of x() member function. if x() returns float template ops in floats , on. i found one answer on so. don't want use c++11 features. no decltype , no auto . work c++03 compiler. this seems work (even when boost typeof forced use long way rather c++11 or compiler-specific feature): #include <boost/utility/declval.hpp> #include <boost/typeof/typeof.hpp> template <typename t> class dosomething { typedef boost_typeof_tpl(boost::declval<t const&>().x(

c# - Find Values using Linq -

i have string value shown below. how return values contained in quotes. below answer 70116280,05/06/2014 16:31:38,etc......essentially answer contained in quotes fired list. string value <!-- capacitor stack signoff record --> <stack_signoff_result lead_traveler="70116280" date="05/06/2014 16:31:38" employee_id="testuser" total_energy="77.266345" status="true" operation_mode="manual" result_detail="na"> <signoff_data> <adhesive part_number="1234" kanban_number="5678"/> </signoff_data> <capacitor_set> <top_capacitor traveler="45911012" energy="26.000567" capacitance="0.000287553595"/> <middle_capacitor traveler="45817588" energy="25.576334" capacitance="0.00028426705"/> <bottom_capacitor traveler="45911141" energy="25.689444" cap

javascript - submit select box value on clicking submit button in php -

following form code <form id="ajax-contact" method="post" action="mailer.php"> <div class="field"> <label for="name">name:</label> <input type="text" id="name" name="name" required> </div> <div class="field"> <label for="email">email:</label> <input type="email" id="email" name="email" required> </div> <div class="field"> <label for="message">message:</label> <textarea id="message" name="message" required></textarea> </div> <div class="field"> <label for="select">select</label>

parsing - Transform grammar into LL(1) -

i have following grammar: start -> stm $ stm -> var = expr stm -> expr expr -> var var -> id var -> * expr with first and follow sets: first set follow set start id, * $ stm id, * $ expr id, * $, = var id, * $, = i've created parsing table follows: $ = id * $ start start → stm $ start → stm $ stm stm → var = expr stm → var = expr stm → expr stm → expr expr expr → var expr → var var var → id var → id var → * expr var → * expr from here can see not ll(1) . how can modify grammar becomes ll(1) ? if think sorts of strings can generated particular grammar, it's strings of 1 of following forms:

java - sending single parameter through servlet -

how send single parameter through query string in servlet? following code giving me asyntax error: out.println("\n<a href='delete?index=" + '">delete</a>"); corrected: out.println("\n<a href='delete?index=" + +"'>delete</a>");

c# - Should a class that provides functionality be static or singelton? -

i'm writing c# app, , have class dos provide functionality different class use. example class provides clock service , more. there reason make class singelton class? or static class? or maybe should not either? if class needs keep inner state should singelton , if doesn't make static ! inner states be: a file reference a user preference any kind of history if merely collection of functions etc.. math , kiss (keep static)!

c++ - Segmentation fault (core dumped) while creating binary tree of given height -

this first time working trees. wrote c++ code, says segmentation fault (core dumped) , far searched, error comes accessing memory location may null. tried 'new' keyword malloc() should avoided in c++, still didn't how resolve in code. # include<iostream> using namespace std; struct node { int data; node *left; node *right; }*next; int k=0; void tree(int i,/*struct*/ node *next = new node) { ++k; --i; if (i==0) return; //next = new node; next->data = k*k; next->left = null; next->right = null; tree(i, next->left); tree(i, next->right); return ; } void display (node* next) { cout<<next->data<<" "; if (next->left!=null) { display(next->left); display(next->right); } } int main() { int h; cout<<"enter expected height of tree : "; cin>>h; node *root; root = new node; root->data=0; root->left=null;

python - LookupError: Resource 'corpora/stopwords' not found -

i trying run webapp on heroku using flask. webapp programmed in python nltk (natural language toolkit library). one of file has following header: import nltk, json, operator nltk.corpus import stopwords nltk.tokenize import regexptokenizer when webpage stopwords code called, produces following error: lookuperror: ********************************************************************** resource 'corpora/stopwords' not found. please use nltk downloader obtain resource: >>> nltk.download() searched in: - '/app/nltk_data' - '/usr/share/nltk_data' - '/usr/local/share/nltk_data' - '/usr/lib/nltk_data' - '/usr/local/lib/nltk_data' ********************************************************************** the exact code used: #remove punctuation toker = regexptokenizer(r'((?<=[^\w\s])\w(?=[^\w\s])|(\w))+', gaps=true) data = toker.tokenize(data) #remove stop words ,

cygwin - Multi-Session Manager for Git Bash Like GNU's Screen -

i'm not sure name question, not sure technical name type of program talking about. is there program available git bash similar screen , tmux , or byobu ? know 3 available cygwin , can not find information using them git bash . git bash because simpler , takes less space, among other things. nowadays official git windows based @ msys2 seems have tmux package @ least. can install g4w sdk described here , install tmux through pacman.

What is the Swift equivalent of -[NSObject description]? -

in objective-c, 1 can add description method class aid in debugging: @implementation myclass - (nsstring *)description { return [nsstring stringwithformat:@"<%@: %p, foo = %@>", [self class], foo _foo]; } @end then in debugger, can do: po fooclass <myclass: 0x12938004, foo = "bar"> what equivalent in swift? swift's repl output can helpful: 1> class myclass { let foo = 42 } 2> 3> let x = myclass() x: myclass = { foo = 42 } but i'd override behavior printing console: 4> println("x = \(x)") x = c11lldb_expr_07myclass (has 1 child) is there way clean println output? i've seen printable protocol: /// protocol should adopted types wish customize /// textual representation. textual representation used when objects /// written `outputstream`. protocol printable { var description: string { } } i figured automatically "seen" println not appear case: 1> class myclass:

Unable to start Jekyll server in --watch mode in Windows 7 -

i'm trying run jekyll server in --watch mode in windows 7. fails start , throws error message: blog [ master ] > jekyll server --trace --watch configuration file: c:/vraa/repo/blog/_config.yml source: c:/vraa/repo/blog destination: c:/vraa/repo/blog/_site generating... done. c:/ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.7/lib/listen/adapter/windows.rb:21:in `rescue in usable?': undefined method `_log' listen::adapter::windows:class (nomethoderror) c:/ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.7/lib/listen/adapter/windows.rb:17:in `usable?' while building jekyll site , starting server successful, --watch mode 1 failing. any ideas? i'm using jekyll version 2.0.03 in windows 7 64 bit , ruby version 1.9.3. there have been changes in newer versions of jekyll (v 1.0+). --server command obsolete. run server in watch mode, type following: jekyll serve --watch also, run following update list

Best way to check for well formed XML in Mule (3.4) -

what current best approach checking incoming xml message formed in mule? for example if send badly formed (or non) xml choice mule throws error , flow stops: <choice> <when expression="#[xpath('fn:count(//event/@publicid)') != 0]"> .... the error like: [fatal error] :1:1: content not allowed in prolog. java.lang.runtimeexception: org.mule.api.muleruntimeexception: failed evaluate xpath expression: "fn:count(//event/@publicid)" @ org.mule.module.xml.el.xpathfunction.call(xpathfunction.java:50) and, alternatively, there way catch , ignore error in flow? i've tried exception strategies per docs , got no where. thanks, geoff you might have solved now, there's convenient filter in mule xml module may help: <mulexml:is-xml-filter /> this filters out non/bad xml. can use message-filter route dlq or throw exception etc. also can catch exception follows: <choice-exception-strategy> <cat

ruby on rails - Rake Task doesn't load Model with Paperclip -

in rake task production migrate assets want require model uses paperclip. error nomethoderror: undefined method `has_attached_file' #<class:0x00000006c12680> ~/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.18/lib/active_recor/dynamic_matchers.rb:55:in `method_missing' /app/models/user.rb:74:in `<class:user>' line 74 declares attachment: has_attached_file :photo, styles: { original: '1024x1024>', s64: ["64x64#", "jpg"] }, :convert_options => { original: "-quality 85 -strip", s64: "-quality 85 -strip" }, processors: [:trimmer, :cropper], url: '/system/product/:attachment/:id/:style/:filename', path: ':rails_root/public/system/product/:attachment/:id/:style/:filename' from rakefile: lib/task/asset.rake task :preload => :environment require 'user' end i tried require 'paperclip' before 'user', didn't help. the problem seemed have beeen

java - .execute cannot be resolved to a type - AsyncTask (Android) -

im writing app needs json db, receive data, im trying view icon beside information shown in listview. the line making trouble is: mchart.settag(url); new downloadimagestask.execute(mchart); <------ mainactivity: public class mainactivity extends activity { listview list; textview icon; textview name; textview developer; textview size; button btngetdata; arraylist<hashmap<string, string>> mlist = new arraylist<hashmap<string, string>>(); private static string url = "http://appwhittle.com/getdata.php"; private static final string tag_item = "app_item"; private static final string tag_icon = "app_icon"; private static final string tag_name = "app_name"; private static final string tag_developer = "app_developer"; private static final string tag_size = "app_size"; jsonarray mjsonarray = null; @override protected void oncreate(bundle savedinstancestat

indexing - Google Webmaster Tools won't index my site -

i discovered robots.txt file on site causing google's webmaster tools not index site properly. tried , removed file (using wordpress still generate it) keep getting same error in panel, "severe status problems found on site. - check site status". , when click on site status tells me robots.txt blocking main page, not. http://saturate.co/robots.txt - ideas? edit: marking solved seems webmaster tools accepted site , showing no errors. you should try adding disallow: end of file. looks this: user-agent: * disallow:

javascript - AngularJS if statement condition in an ng-repeat -

i'm using ng-repeat in angularjs <ul> <li ng-repeat="question in questions" class="question list-group-item media"> <span class="question__type">{{ question.question }}</span> <br> <div class="btn-group question__answer justified nav-tabs"> <a class="btn {{question.type}}" ng-repeat="answer in question.answers">{{ answer }}</a> </div> </li> </ul> i want able make section below if statement if {{question.type}} == 'radio' justified on btn-group div. <div class="btn-group question__answer justified nav-tabs"> <a class="btn {{question.type}}" ng-repeat="answer in question.answers">{{ answer }}</a> </div> you can use ng-class . here jsbin demonstrating works. i've made justified class change t

ios - how to look up two (or more) app Ids with appstore API? -

i know can search specific application in app store via itunes (app store) api or app id , json using : https://itunes.apple.com/lookup?id=284882215 and know can search using app bundle or search application 1 developer, but there way 2 applications , jsons in 1 file? for example want have facebook , twitter itunes's jsons in 1 file, how achive that? i found solution! it simpler seems! use comma (,) seprator! https://itunes.apple.com/lookup?id=1st_app_id,2nd_app_id,3rd_app_id

php - set javascript validation based on condition -

i m trying check whether username exits in db or not. if exits should give error msg , prevent user add details db till edit user field or make valid or available. ajax call $('#user').keyup(function(e) { var check_user=$(this).val(); $.ajax({ type: "post", url: "ajax.php", data: {check_user:check_user}, success: function(data) { $("#user-result").html(data); } }); }); ajax.php if(isset($_post['check_user'])){ $class->mqry="and barcode='".$_post['check_user']."' "; $class->selected_fields=array('this.user_id'); $check_user= $class->gettable('users'); $class->resetfields(); $count=count($check_user); if($count) { die('<img src="imgs/not-available.png" />user exits'); }else{ die('<img src="imgs/available.png" />'); } } thi

gwt - How do I bind named providers in a Jukito module? -

i testing gwtp presenter using jukito , , can't seem named bindings work. i want able test onreveal() of login widget, need provide copy of currentuserdto logged in, , 1 isn't. i'm trying do: @runwith(jukitorunner.class) public class loginwidgetpresentertest { public static class module extends jukitomodule { @override protected void configuretest() { bind(currentuserdto.class).annotatedwith(names.named("loggedin")).toprovider(loggedinuserprovider.class); bind(currentuserdto.class).annotatedwith(names.named("loggedout")).toprovider(loggedoutuserprovider.class); // these don't work either: // bindnamed(currentuserdto.class, "loggedin").toprovider(loggedinuserprovider.class); // bindnamed(currentuserdto.class, "loggedout").toprovider(loggedoutuserprovider.class); } public static class loggedinuserprovider implemen

opencv - ANN - Artificial Neural Network training -

i know possible save trained ann file using cvfilestorage , don't way cvfilestorage saves training, wondering: possible retrieve informations of training , save in custom way? thanks in advance. just @ xml structure, it's simple. names of objects same in ann class. here xor solving network: <?xml version="1.0"?> <opencv_storage> <my_nn type_id="opencv-ml-ann-mlp"> <layer_sizes type_id="opencv-matrix"> <rows>1</rows> <cols>3</cols> <dt>i</dt> <data> 2 3 1</data></layer_sizes> <activation_function>sigmoid_sym</activation_function> <f_param1>1.</f_param1> <f_param2>1.</f_param2> <min_val>-9.4999999999999996e-001</min_val> <max_val>9.4999999999999996e-001</max_val> <min_val1>-9.7999999999999998e-001</min_val1> <max_val1>9.7999999999999998e-001&

java - Connect to server via socket in Android -

i pretty new android app development, , have created following below activity's oncreate(): public string test(){ string test = ""; try{ socket s = new socket(inetaddress.getbyname("ipaddress"), port#); test +=(s.isconnected()); bufferedreader readfromhost = new bufferedreader(new inputstreamreader(s.getinputstream())); readfromhost.ready(); test += (readfromhost.readline()); s.close(); }catch(exception e){ e.printstacktrace(); } return test; } this routes a: textview2.settext(test()); but string "test_message" grabbed server not appear in text view. however, when textview2.settext("hi"); it appears in view, or if run test() in java outside of android program resulting "test_message" appears in console. thoughts on why not appear in android runtime? ports treated differently? great. attached logcat. there appears "networkonmainthreadexception"? all

c# - Entity Framework Code First and SQL Server 2012 Sequences -

i in middle of implementing database audit trail whereby crud operations performed through controllers in web api project serialize old , new poco's , store values later retrieval (historical, rollback, etc...). when got working, did not how made controllers during post because ended having call savechanges() twice, once id inserted entity , again commit audit record needed know id. i set out convert project (still in infancy) use sequences instead of identity columns. has added bonus of further abstracting me sql server, though not issue, allows me reduce number of commits , lets me pull logic out of controller , stuff service layer abstracts controllers repositories , lets me work auditing in "shim" layer. once sequence object created , stored procedure expose it, created following class: public class sequentialidprovider : isequentialidprovider { private readonly iservice<sequencevalue> _sequencevalueservice; public sequentialidprovider(ise

sql - How to write a query for a nested object that varies on a field of the parent? -

this may difficult question ask correctly. idea have thing has schema result in json object so: { id:1, x:1, y:1, type:"map" settings: {... settings type "map" ...}} each of fields id, x, y, type directly column in table. want take string of type "map", , in map_settings table properties in properties. i have instance: { id:1, x:1, y:1, type:"graph" settings: {... settings type "map" ...}} which has different type . , reference graph_settings table instead. how can write query that? i'm not sure how sql server produce json, produce similar in xml. perhaps there way convert xml json.. i'm assuming schema this: create table [thing] ( [id] int, [x] int, [y] int, [type] varchar(10) ) create table [map_settings] ( [thing_id] int, [mapsetting1] int, [mapsetting2] int ) create table [graph_settings] ( [thing_id] int, [graphsetting3] int, [graphsetting4] int )

Extending Array from custom Sequence in Swift? -

i'm trying to: make custom protocols descended sequence , generator specialsequence , specialgenerator implement specialgenerator specialgen extend array implement specialsequence here's i've tried far: protocol specialgenerator: generator { typealias t; func next() -> t?; //... } class specialgen<t>: specialgenerator { var objects: array<t>; var currindex = 0; init(objs: array<t>) { self.objects = objs; } func next() -> t? { return objects[currindex]; } //... } protocol specialsequence: sequence { typealias t; func generate() -> specialgenerator; //... } extension array: specialsequence { func generate() -> specialgenerator { return specialgen(objs: self); } } but error array<t> not conform protocol "specialsequence" i've tried using various combinations of specialgenerator , specialgen<t> return types no ava

sed - awk replace serialized number lines and move up other lines -

i have file has following format 1 - descrio #944 name address 2 - desanother #916 name address 3 - somedes #957 name address and want output as, usercode #944, name, address usercode #916, name, address usercode #957, name, address with awk awk 'nr%3 == 1{sub(/^.*#/, "usercode #")};{ors=nr%3?", ":"\n"};1' file usercode #944, name, address usercode #916, name, address usercode #957, name, address for variable number of rows awk -v rs='(^|\n)[[:digit:]]+[[:blank:]]*-[[:blank:]]*' '{sub(/\n$/, ""); gsub(/\n/, ", "); printf "%s", $0""rt}end{print ""}' file

php - Laravel 4.2 does not save data to the database -

i have problem, don't know i'm messing laravel not save data database , not display errors. here code: user.php use illuminate\auth\usertrait; use illuminate\auth\userinterface; use illuminate\auth\reminders\remindabletrait; use illuminate\auth\reminders\remindableinterface; class user extends eloquent implements userinterface, remindableinterface { use usertrait, remindabletrait; /** * database table used model. * * @var string */ protected $table = 'users'; protected $fillable = array('first_name', 'last_name', 'username', 'email', 'password', 'password_temp', 'code', 'active'); /** * attributes excluded model's json form. * * @var array */ protected $hidden = array('password', 'remember_token'); } routes.php route::get('/', array( 'as' => 'home', 'uses' => 'pagescontrolle

iphone - Adding leftbarbuttons and custom title to navigation bar in iOS -

i adding custom title , leftbar buttons navigation bar using following code:- uibarbuttonitem *button1 =[[uibarbuttonitem alloc]initwithimage:[uiimage imagenamed:@"img1.png"] style:uibarbuttonitemstyleplain target:self action:@selector(popback)]; uibarbuttonitem *button2 =[[uibarbuttonitem alloc]initwithimage:[uiimage imagenamed:@"img2.png"] style:uibarbuttonitemstyleplain target:self action:nil]; self.navigationitem.leftbarbuttonitems = [[nsarray alloc] initwith:button1, button2, nil]; uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 360, 30)]; [label setfont:[uifont fontwithname:@"arial-boldmt" size:14]]; [label setbackgroundcolor:[uicolor clearcolor]]; [label settextcolor:[uicolor whitecolor]]; [label settext:@"detail controller"]; label.textalignment = uitextalignmentcenter; //nstextalignmentcenter self.n

jquery - When reset-btn is clicked, calculate-btn stops and then does not work -

when reset-btn clicked, calculation stops after being started, doesn't work afterward. how can use restart-calculate-btn ? click reset-btn , stop calculate-btn after when both options selected calculate-btn animated... calculate-btn opacity 1 . $(document).ready(function(){ var count = 0; $(".choose").change(function(){ count++; if(count ==2){ blink(); } }); function blink() { $(".calculate-btn").animate({ opacity: '0' }, function(){ $(this).animate({ opacity: '1' }, blink); }); } $(".reset-btn").click(function(){ $(".calculate-btn").stop(); }); }); <form> <select class="form-contol"> <option value='0'> select</option> <option value='1'> 1</option> <option value='2'> 2</option> <option value=&#

GIF animate too fast on Computer - iOS -

i trying create gif animated images, pass array of images. lets have 4 seconds video , extract 120 frames it. regardless of created gif size, create gif 120 frames. problem is, when open gif in iphone (by attaching mailviewcomposer or imessage) runs fine, if email it, or import computer, runs fast. can suggest wrong here? i using hjimagestogif gif creation. dictionary gif properties below: nsdictionary *prep = [nsdictionary dictionarywithobject:[nsdictionary dictionarywithobject:[nsnumber numberwithfloat:0.03f] forkey:(nsstring *) kcgimagepropertygifdelaytime] forkey:(nsstring *) kcgimagepropertygifdictionary]; nsdictionary *fileproperties = @{ (__bridge id)kcgimagepropertygifdictionary: @{ (__bridge id)kcgimagepropertygifloopcount: @0, // 0 means loop forever

python - Very slow MongoDB count in big database -

i have database collection in large amount of documents (several millions). in database have (amongst others) fields _violationtype (int) , _duration (int). count amount of documents have _violationtype of 15 or less , _duration of 10 or less. execute following python script: #!/usr/bin/env python import pymongo import timeit client = pymongo.mongoclient('localhost', 27017) database = client['bgp_route_leaks'] collection = database['valleys'] collection.ensure_index('_violationtype', unique=false) collection.ensure_index('_duration', unique=false) start = timeit.default_timer() cursor = collection.find({'$and': [{'_violationtype': {'$lt': 16}}, {'_duration': {'$lt': 10}}]}, {'_duration': 1, '_id': 0}) print('explain: {}'.format(cursor.explain())) print('count: {}'.format(cursor.count())) print('time: {}'.format(timeit.default_timer() - start)) this prin

c# - RDLC #Error driving me nuts (per page subtotals) -

i've got report table looking this: usercode|recordid|originatingbranch|originatingaccount|homingbranch|homingaccount|amount|actiondate|seqno|onus|homedback the last 2 columns booleans, contain either y or n. in fact, onus column contain ys. need have subtotal @ end of each page showing how many onus transactions there , value, , same onus transactions. i've tried several things including described here when try i'm left nondescript #error in report. have no errors or logs or anything, #error should have number. now i'm trying answer here , says: add additional column , enter expression: =runningvalue(fields!yourvalue.value,sum,"yourtable1"), , set hidden property true. in page header or footer, use expression: =last(reportitems!textbox12.value) subtotal of previous pages.( assume above column’s detail row textbox12) i've put in table, expression: =runningvalue(iif(fields!homedback.value="y", fields!amount2.value

monads - How to apply higher order function to an effectful function in Haskell? -

i have functions: higherorderpure :: (a -> b) -> c effectful :: monad m => (a -> m b) i'd apply first function second: higherorderpure `someop` effectful :: monad m => m c where someop :: monad m => ((a -> b) -> c) -> (a -> m b) -> m c example: curve :: (double -> double) -> dia curve f = fromvertices $ map p2 [(x, f x) | x <- [1..100]] func :: double -> either string double func _ = left "parse error" -- in other cases func can useful arithmetic computation right value someop :: ((double -> double) -> dia any) -> (double -> either string double) -> either string (dia any) someop = ??? curve `someop` func :: either string (dia any) the type monad m => ((a -> b) -> c) -> (a -> m b) -> m c is not inhabited, i.e., there no term t having type (unless exploit divergence, e.g. infinite recursion, error , undefined , etc.). this means, unfortunately, impossible imp

security - Access restriction with JavaScript -

i have application done in javascript using ember.js. want following: i have 2 account types: basic , premium. depending on account type user have wish display ads him. the user can use parts of application if has premium account. what must have in mind in order protect application it's secure against people trying use premium features without having privilege? because javascript sent single file, people can @ app code , maybe reverse or copy , use locally without entering site, put effort waste. your client side code shouldn't considered more sugar user's experience, not layer trusted. that means backend should pessimistic in nature, not trusting requests client, making sure can make said request, , sanitizing data sent them assuming user trying harm.

Django 1.6 trying to create new database entry from form -

i trying develop thank-you note system using django. have set admin ok , able add new entries database through that. have been able set index shows current thank-you notes in database, , detail view shows full details given thank-you note. trying create form view lets people without admin access add thank-you notes system. form loads fine , fields can filled everytime press submit 404 error. way doesn't happen if set form action nothing: <form id=“new_ty_form” method=“post” action=> and pressing submit regenerates blank form , nothing previous fields. i unable implement {% url %} system means have hardcode urls using. whenever try use {% url %} following error: templatesyntaxerror @ /thank_you/ not parse remainder: '‘thank_you.views.detail' '‘thank_you.views.detail'. syntax of 'url' changed in django 1.5, see docs. i stuck on this, please can help? include of code can. mysite/settings.py """ django settings mysite proj