Posts

Showing posts from February, 2010

ios - Remove unused resources from XCode project -

i working on ios application , in application have big changes in app design every day code of application going touch 200 mb. in code have big numbers of unused images available. want remove images xcode project can reduce project code size. i had used scripts thats given on stackoverflow.com found script removing used images thats not reliable. had used app named "slender". trial version cant use more. so please 1 suggest me effective way (any application) remove unused images xcode project. unused find unused resources in xcode project https://github.com/jeffhodnett/unused

how free text search works in postgresql -

i working on project in have implement free text using postgresql database, not able understand how can work using @@ instead of command. i have table employee - id - name - location - managername //my query select * employee name @@ 'xxx' i searching on name free text , gives result, can nay 1 tell me index or search catalogue, didn't made , configuration etc still working. any chance postgresql tables or created catalogue on runtime? can 1 tell me how works? what's happening if @ operators defined @@ you'll see there few variants different data types. they're overloads same operator. regress=> \do @@ list of operators schema | name | left arg type | right arg type | result type | description ------------+------+---------------+----------------+-------------+------------------------------ pg_catalog | @@ | text | text | boolean | text sea

sql - Updating NULL Field vs Most Recent Record -

i have table contains null field. needs populated table. while statement getting information other table simple concerned performance of update. the update done script scheduled run every 30 minutes. which better: update using field null statement update table1 set freefield=(select name table2 table1.keyfield=table2.field) freefield null; update using statement updates last x records update table1 set freefield=(select name table2 table1.keyfield=table2.field) rowid in ( select rowid ( select keyfield table1 order keyfield desc ) rownum < 300 ); table1.keyfield , table2.field indexed , have primary/fk relation. table1.freefield , table2.name not indexed , text fields. currently table 100k record grow massively. i'm asking going take longer search null fields in table or order , use recent number specified. the final plan implement trigger records updated @ creation cannot implemented until next release of

c++ - Why do I have to access template base class members through the this pointer? -

if classes below not templates have x in derived class. however, code below, have to use this->x . why? template <typename t> class base { protected: int x; }; template <typename t> class derived : public base<t> { public: int f() { return this->x; } }; int main() { derived<int> d; d.f(); return 0; } short answer: in order make x dependent name, lookup deferred until template parameter known. long answer: when compiler sees template, supposed perform checks immediately, without seeing template parameter. others deferred until parameter known. it's called two-phase compilation, , msvc doesn't it's required standard , implemented other major compilers. if like, compiler must compile template sees (to kind of internal parse tree representation), , defer compiling instantiation until later. the checks performed on template itself, rather on particular instantiations of it, require compiler able resolve

javascript - Mime type for archive -

i trying upload archive file taken through <input type=file> in html, calling servlet using javascript. in javascript trying mime type of it, giving type ""(means empty). how can identify whether archive? looks there isn't 1 mime type archives, each have own (if have 1 @ all). have this wikipedia article more info.

c++ - Boost property tree: Remove a nested node -

suppose have following tree: boost::property_tree::ptree tree; tree.add("1.2.3", "value-1"); tree.add("1.2.3.4", "nested-value"); tree.add("1.2.3", "value-2"); tree.add("1.2.33", "other-value"); which has following serialized info form: 1 { 2 { 3 value-1 { 4 nested-value } 3 value-2 33 other-value } } is there method remove nodes having provided (possibly nested) path? i.e.: remove(tree, "1.2.3"); boost_assert(!tree.get_optional<std::string>("1.2.3") && !tree.get_child_optional("1.2.3")); with result info form: 1 { 2 { 33 other-value } } looking @ ptree docs , source code i've found several methods remove immediate children of tree (nested children not accounted). also, there several methods subtree it's full path (even if nested). since th

Get image name from database in laravel -

i have database, columns image , alttag. want use them in laravel blade view. try this: {{ html::image('images/{{ $item->image }}', $alt="{{ $item->alttag }}") }} but syntax isn't correct. if echo image , alttag this: <h1>{{ $item->alttag }}</h1> then correct. wonder wrong in code. you used blade syntax in php string. watch compiled blade templates see did go wrong. in short. try this: {{ html::image('images/'. $item->image, $alt = $item->alttag) }} or equally short: {{ html::image("images/{$item->image}", $alt = $item->alttag) }}

Wordpress Validate New Nicename/Slug -

i have written custom "edit account" script allows wordpress user update wordpress account. working great, except can't seem find way update user's nicename, doubles user's url slug (via get_author_posts_url function). causing issues because when user changes name, slug still contains original name - not new one. i know sanitize_title function generate new nicename, don't know how verify unique , modify if not before entering db. wondering built-in functions wordpress has handle this. know can write own script this, rather use wordpress functions. couldn't find anywhere in wp documentation. thanks! here function have written in lue of built in function: function new_user_slug($string){ //generate new slug $slug=sanitize_title($string); //make sure slug unique $result=mysql_query("select * wp_users user_nicename='$slug'"); if(mysql_num_rows($result)==0){ return $slug; }else{ $counter=2; $ki

javascript - Collapse with only one item opened not working in AngularJS -

i'm attempting customize collapse in app. i've tried accordion plugin comes angularjs ui bootstrap, rather complex, need 2 links side side , collapsing elements opening in row under, i've decided include transition.js , collapse.js bootstrap. so far code looks this: <div class="logo" id="accordion"> <a data-parent="#accordion" data-toggle="collapse" data-target="#login"> log in </a> <a data-parent="#accordion" data-toggle="collapse" data-target="#signup"> sign </a> <div id="signup" class="collapse">dfkñfkldsklñfdsñlkfd ñlkdflkfdñlfsdñl ksfdlkfdslñsfdñl kfdkfkldl fdksñlfdklfdñksfd <div id="login" class="collapse">blablabla</div> </div> the collapse effect works perfectly, far haven't been able accomplish "only 1 item opened @ time

php - Program not displaying correct data -

Image
i program post highest scoring student in corresponding year, meaning in place "topper 2012: " should post student highest score in year only, along students scores rest of years(does not matter if did not highest score in other years, should based on specific year). in last row "overall topper: ", should display best student overall. note: post "topper 2011: " section, not based on highest score. not posting rest of years after 2011. code: <body> <form> <?php $username = "amar"; $password = "amar"; $hostname = "localhost"; $database = "study"; $set = array('2011' => 0, '2012' => 0, '2013' => 0, '2014' => 0, 'final' => 0, 'final_grade' => 0); $mysqli = new mysqli($hostname, $username, $password, $database) or die("unable connect mysql");

sql - Connection string not working in C# windows application -

for reasons, unable establish data connection using connection string. doing below code var connectionstring = configurationmanager.connectionstrings["connection"].connectionstring; sqlcommand cmd = new sqlcommand(); sqlconnection con = new sqlconnection(connectionstring); cmd.connection = connectionstring; cmd.commandtype = commandtype.storedprocedure; cmd.commandtext = " dbo.selectall"; sqlparameter param = new sqlparameter("@tradedate","201401"); param.direction = parameterdirection.input; param.dbtype = dbtype.string; cmd.parameters.add(param); but reasons when initializing connection property command using cmd.connection = connectiostring , is throwing exception follows cannot implicitly convert type 'string' 'system.data.sqlclient.sqlconnection' you're confusing connection string needed connect database , actual sqlconnection. try (for specific code): cmd.connection = con; according msdn

r - How do I add an existing image when using pander's live report generation? -

i sadly using windows 7, problem... i want add existing image file pander report, using live report generation on windows platform, outputting docx: library(pander) setwd("t:/r/temp") #this contains subfolder & file /plots/temp.png myreport = pandoc$new(author="jerubaal",title="where's picture?", format="docx") myreport$add.paragraph("there should picture after this.") myreport$add(pandoc.image("/plots/temp.png")) myreport$add.paragraph("there should picture before this.") myreport$export() alas, there no image included when running in windows (not in md file). it doesn't work if try putting code straight in: myreport$add("![](/plots/temp.png)") if try this: myreport$add("![/plots/temp.png](/plots/temp.png)") i text path: /plots/temp.png any suggestions? fyi: time ago, trying out ggplot, got work in ubuntu: earlier question this report generated r (3.0.3) , pa

Meteor won't start, npm shrinkwrap fails -

so i'm trying run a simple boilerplate app , start meteor => started proxy. => meteor 0.8.0.1 available. update project 'meteor update'. => started mongodb. npm: updating npm dependencies -- async, xml2js... npm err! error: enoent, open '/users/whit/.meteor/tools/c2a0453c51/package.json' npm err! if need help, may report *entire* log, npm err! including npm , node versions, at: npm err! <http://github.com/isaacs/npm/issues> npm err! system darwin 13.1.0 npm err! command "/users/whit/.meteor/tools/c2a0453c51/bin/node" "/users/whit/.meteor/tools/c2a0453c51/bin/npm" "shrinkwrap" npm err! cwd /users/whit/programming/mrt2/meteor-bone/packages/npm/.npm/package-new-1767w7f npm err! node -v v0.10.25 npm err! npm -v 1.3.24 npm err! path /users/whit/.meteor/tools/c2a0453c51/package.json npm err! code enoent npm err! errno 34 npm err! npm err! additional logging details can found in: npm err! /users/whit/program

Android Activity not Responding -

i have 3 activities in app , when user press next button, next activity shown user, works fine except when reaches last activity i.e. when user presses next on 2nd last activity, error message shown app has stopped working , there no error in logcat, following .java file of final activity package com.example.first; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.content.intent; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.os.build; public class finalactivity extends actionbaractivity { textview name,address,phone,email,dob,matg,mati,interg,interi,graddeg,gradi,cgpa,skills; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentvi

emacs - Fine-tuning: `set-process-sentinel` | `set-process-filter` | `start-process` -

there few examples on internet involving 3 of functions @ issue in question -- i.e., set-process-sentinel ; set-process-filter ; , start-process . i've tried few different methods of fine-tuning the processes in effort force process number 1 ( push ) finish prior commencement of process number 2 ( push ). in of attempts, second process always runs , finishes before have finished entering password process number 1. process number 2 has password stored in osxkeychain . the first method tried magit, both synchronous , asynchronous processes. second method tried using function while . . . search list of remotes in buffer containing said list. third attempt listed below -- uses list of remotes created @ outset of function , mapcar s down list push git. any ideas on how better control process number 1 ( push ) finishes prior commencement of process number 2 ( push ) appreciated. it not end of world process number 2 starts , finishes early, matter of learning how take c

javascript - Using define() in require.js -

i'm started learning using require.js main.js require(['jquery', 'underscore', 'module1'], function($, _, module1) { module1.init(); $('#output').html('hello world!'); }); module1.js define('module1', [], function(app) { var init = function() { alert('hello world!') ; } return { init: init }; }); it's working i'm wondering can change define('myapp', [] function(app){}); in module1.js ?, , modify main.js to require(['jquery', 'underscore', 'myapp'], function($, _, myapp) { myapp.init(); $('#output').html('hello world!'); }); please help, can understand more using require.js. thanks. edited with below answer, i've modified coding to module1.js define('myapp', [], function(app) { var init = function() { alert('hello world!') ; } return { in

javascript - Precise decimal multiplication (js-assessment) -

i working on js-assessment numbers.js exercise. thought should multiply decimal numbers ten power number of digits (e.g. 0.22 -> 0.22*10^2 = 22) precise decimal multiplication in js. solution test. i checked solution proposed author of test , can't figure out how algorithm working. here code: function adjust(num) { var exponent, multiplier; if (num < 1) { exponent = math.floor( math.log(num) * -1 ); multiplier = math.pow(10, exponent); return { adjusted: num * multiplier, multiplier: multiplier }; } return { adjusted: num, multiplier: 1 }; } what proof math.floor( math.log(num) * -1 ) is enough exponent?

sql - how to join two string columns into one in MySQL -

i have table ________________ | authors | |name | surname| |------|--------| |jeff | lindsay| |george| martin | |______|________| and need join these 2 columns 1 space between them. tried select (name + ', ' + surname) name authors but returns me this: ________________ | name | | 0 | | 0 | |_______________| how join these 2 have full name? in mysql called concat select concat(name,' ',surname) fullname author

jsp - jstl xml variables for select attribute -

i'm using jstl xml specified values xml here i'm using "userroleselector" variable select node. variable set as, <c:set var="userroleselector" value="role-id='test'" scope='session'/> the tag use variable follows, <x:if select="$parsedrolexml//roles/role[$userroleselector]/features/feature[text()='viewevents']"> //html code </x:if> the node not selected according role-id provided. works if use right hand side variable. what issue here? there few problems here: the xpath predicate syntax [$userroleselector] not doing comparison the xpath predicate syntax searching index, not attribute value userroleselector not xpath variable c:set variables not in xml scope, unlike x:parse variables userroleselector jsp variable to test role-id properly, try instead: [@role-id='test'] to test jsp variable, try instead: [@role-id=$sessionscope:userrolese

javascript - Prevent optimization of text! and json! plugins on requirejs optimization tool -

i'm using following architecture multipage requirejs based application.: https://github.com/requirejs/example-multipage-shim the repository explains how optimize application running r.js, command line tool used kind of task. everything should work fine project modules have dependencies perform http request fetch data server (wich can text or json) this because of jsons , templates used pages need server-side processed localization. here basic example show i'm talking about: define( function( require ){ var applang = require('json!/pagelang/login'), //(a) logintemplate = require('text!/template/login'), //(b) module = require('app/model/user'), //(c) .... an http request made server localhost/pagelang/login returns json { "hash": "translated_value", ... } the same applied template/template_name where html it's ui translated user language re

python - How do I include non-.py files in PyPI? -

i newb pypi...so let me qualify that. trying put package on pypi having bit of trouble when try install pip. when upload file pypi, warning (but setup.py script finishes not fatal errors , 200 status): 'my_package/static/my_folder' not regular file -- skipping and when go install in pip, error: "error: can't copy 'my_package/static/my_folder': doesn't exist or not regular file. from other answers on so, i've tried changing manifest.in , setup.py files, no luck. here current manifest.in: recursive-include my_package *.css *.js *.jinja2 and setup.py: try: setuptools import setup, find_packages except importerror: distutils.core import setup, find_packages setup( name='my_package', packages=find_packages(), include_package_data=true, platforms='any', version='1.0', description='my_description', license='mit', author='me', author_email='me@exa

android - Listview default item selected -

i have listview show below: <listview android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_below="@id/profile_picture" android:layout_gravity="start" android:layout_margintop="30dp" android:background="#f7f7f7" android:choicemode="singlechoice" android:divider="@android:color/transparent" android:dividerheight="0dp" android:entries="@array/navigation_drawer" android:listselector="@color/navigation_selector" android:paddingleft="20dp"/> and want make first item in list selected, have tried list.setselection(0), setitemchecked none of them works. looks need state- aware backgrounds on list items described in of answers here: listview item selection android

sometimes javascript run perfect and sometimes not in ruby on rails 4 -

Image
i used datepicker in calendar shows perfect not shows arrow button change month. , give error this: actioncontroller::routingerror (no route matches [get] "/assets/images/ui-icons_ef8c08_256x240.png") datepicker.js $(document).ready(function(){ $('[data-behaviour~=datepicker]').datepicker(); }); css link sorry long question , tell me if miss something. big in advance edit: observed when delete public/assets directory , enter rake assets:precompile time error not showing arrow still not showing. it looks turbolinks problem added rails 4 default. in turbolinks $(document).ready not firing. can see more information turbolinks , suggestions how use them here railscast or can add links data: { no_turbolink: true } you can remove turbolinks gemfile if don't need them. check if have ui-icons_ef8c08_256x240.png in /assets/images/

c# - Are there other functions that can result in "StartIndex cannot be less than zero"? -

we have customer reported receiving error message along lines of "startindex cannot less zero. parameter name: startindex". standard error message thrown in substring , remove functions of string class. unfortunately, unable ahold of data failing on them, i'm forced debug looking @ source code. i have looked incidences of substring , remove , verified startindex parameter not less 0. searched uses of "startindex" , verified that, in 2 cases being used first parameter of string function, not mathematically less 0 (in both cases, given return value of indexof function, string length , value of 2 added it, 1 smallest value have). this suggests me either issue fixed in prior codebases, have nonstandard codebase, or i'm looking in wrong place. there other functions in c# raise sort of error text? or there way in reporting wrong input parameter? misunderstanding error message? here's 91 methods system.dll , mscorlib.dll: static class

javascript - LiveCycle drop-down list reference another field in an If statement -

i have 2 drop-down lists, both of offer choice of other . when other chosen, text field ("other") becomes visible. if different option chosen, field hidden. don't want field hidden when different option list "tool" chosen, if list "cut" displaying other (or vice-versa). i'm missing here: form1.rfq.body.requireditems.table1.row1.col2.types.tool::change - (javascript, client) if(xfa.event.newtext == "other"){ other.presence = "visible"; } else{ if (cut.caption == "other"){ other.presence = "visible"; } else{ other.presence = "hidden"; } } if want "other" textfield show if both options other, need in both drop down lists' exit event. if(tool.rawvalue == "other" && cut.rawvalue == "other") other.presence = visible; else other.presence = "hidden"; using exit event work "change" event l

matlab: image search image in google -

i using matlab create mosaic image. this, use google image search instead of self-create own image database. procedure be: 1.get image , divided small box. 2. each box, using image search image similar image , download matlab 3.combine every downloaded image mosaic image. i have try search internet of result "words image", instead of "image image", there example or other keys word me complete step 2? google has functionality search similar looking images. visit google.com , switch on image search on top. in search bar, there little camera icon on right. when open can either choose url or directly upload image want search for. so firstly do, export current box (e.g. jpg). then, , may tricky, code script (maybe not in matlab rather in other scripting language, e.g. python) uploads current box image google image search , searches appropriate pictures. think may able use google custom search apis - i'm not familiar it. call script via matlab

SVG path(Raphael.sketchpad.js) not smooth in Chrome, but smooth in Firefox -

i have svg layer on image (png in background). svg is put above image z-index , given "pointer-events:none". the path drawn on svg done through raphael.sketchpad.js , creates path (as example) as: <path fill="none" stroke="#000000" d="m337.375,853l337.375,853l275.375,776l280.375,717l370.375,683l418.375,719l433.375,773l431.375,782l430.375,783l428.375,784l428.375,785l428.375,786" stroke-opacity="1" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); stroke-opacity: 1; stroke-linecap: round; stroke-linejoin: round; -webkit-user-select: text;"></path> when draw circular path on mozilla lot of path points(around 20-25) generated , curve smooth. however, when similar path drawn in chrome, around 5-10 path points generated , path not @ smooth. how can correct this, path works fine on every browser? this pro

html - Image under anchor tag onmouseover highlighted background color not changing -

here code onmouseover on image under anchor tag highlighted color not changing please can know doing wrong <div class="iconlink"> <a href="/classification/classificationlabel" title="classification label"> <img src="/content/images/labels-72x72.png" /><div>classification label</div> </a> </div> i tried these types .iconlink a:hover {background-color: #000000; color: #000000;0} and <div class="iconlink"> <a href="/classification/classificationlabel" title="classification label" class="hove"> <img src="/content/images/labels-72x72.png" /><div>classification label</div> </a> </div> .hove:hover{background-color: #000000; color: #000000;} you need apply background-color img in css like: .iconlink a:hover img { background-color: #000; } .iconlink a:hover { co

SQL Server selecting one record for a day -

i have query selects [orderdate] sites in last week. want able select 1 record given site in day. solution follows: select sitename , orderdate table1 orderdate >= dateadd(dd,(datediff(dd,-53690,getdate()-1)/7)*7,-53690) ,but when @ results, notice date 21st site2 gives 2 records. need select one. sitename..................orderdate site1....................2014-04-21 16:00:37.650 site2....................2014-04-21 16:00:39.697 site2....................2014-04-21 16:00:39.697 site3....................2014-04-21 16:00:35.180 site1....................2014-04-22 16:00:46.113 site2....................2014-04-22 16:00:50.817 site3....................2014-04-22 16:00:53.163 site1....................2014-04-23 16:00:50.993 site2....................2014-04-23 16:00:53.193 site3....................2014-04-23 16:00:55.727 ** editing question ** hi, sorry complicated inserting distinct. included below entire query, included part of simp

objective c - Combine UIPageViewController swipes with iOS 7 UINavigationController back-swipe gesture -

i have navigation controller pushes view-controller ( parent ) contains uipageviewcontroller ( pages ). used pan/swipe gestures switch between children of page-view-controller. however, can no longer pop parent -view controller using swipe gesture left border of screen, because interpreted gesture in pages . is possible accomplish swipe-to-pop when left-most view-controller shown? two ideas: return nil in pageviewcontroller:viewcontrollerbeforeviewcontroller -> doesn't work. restrict touch area, described here . or there more straightforward way? i had same situation @smallwisdom, handled differently. i have view controller a push on top of navigation controller's stack. view controller a contains horizontal scroll view stretches way left side of screen right. in scenario, when wanted swipe screen pop view controller a navigation controller's stack, ended doing scrolling horizontal scroll view. the solution pretty simple. inside view c

what is the difference in java objects created with "new" and the ones that do not use "new" -

what difference between creating object , without "new"? example: thing = new thing(); vs. path filepath = path.get("c:\\......) in first example understand when instantiating object, "new" allocating memory object , memory location referenced something. my text book says " create path object" using second example. difference how object stored or memory allocated? not sure why create object way. in second case using static method internally creating object or passing reference existing object. common pattern particularly when apis wish hide internal implementation (as case here).

c++ - std::string as map key and efficiency of map.find() -

i have std::map<std::string,foo> , need find() elements when instead of std::string , have const char* . however, map.find("key_value") won't work, need std::string . so, need map.find(std::string{"key_value"}) , create temporary std::string (with allocation , de-allocation) each time, making potentially inefficient. reasoning correct? if yes, how can improve situation? i think using wrapper around const char* key map has own comparison function , can cheaply wrapped around const char* , no need allocations. idea? (note mapped values not copyable, movable). you can avoid temporaries using 0-terminated strings , custom comparator map. still, using unordered_map yield better indexing performance. an alternative (much better), using wrapper, think. there std::reference_wrapper task. still, first rule of optimisation: not it. second rule: not it. third rule (only experts): after measurement , careful consideration, might anyway.

python - Django template doesn't render properly, just prints "{ % extends base % }" etc to the page -

Image
i'm trying basic django template working on google app engine app (on local machine, not yet deployed, if matters), app acting has no idea how templates work. prints { % extends "base.html" %} webpage instead of using load template so: although, views seem working otherwise, since "{{ message }}" @ least loads correct thing. feel i'm missing silly piece of information, i'm @ loss. i've been looking @ django documentation while , have no idea went wrong. here relevant code: snippet of settings.py: template_dirs = ( os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'hello/templates')) # put strings here, "/home/html/django_templates" or "c:/www/django/templates". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. ) in views.py: from django import http django.shortcuts import render_to_response def home(request): return render_to_response(&

c# - Appending dropdown menu to specific menuitem in Kendo UI -

Image
i have created menubar in kendo ui follows @html.kendo().menu().name("navigationmenu").items(items => { if (request.isauthenticated) { foreach (searchhub.models.shared.submodule s in viewbag.submodule) { items.add().htmlattributes(new { id = s.controller }).text(s.title).action("index", s.controller); } items.add().htmlattributes(new { id = "td" }).text("training").action("index", "td") ; } else { items.add().text("login").action("index", "login"); } }) ; this viewing below: i want have drop down menu teacher , student when keep mouse on traning menu item. for tried append <ul> <li> : items.add().htmlattributes(new { id = s.controller }).text(s.title).action("index"

How to reset password in MariaDB on Windows? -

how reset password in mariadb? use windows not linux. know how reset mysql mariadb password. tried search on google did not help. i bumped same problem. lost root password test server on windows development machine. following linux step: after net stop mysql try invoking mysqld mysqld --skip-grant-tables mysqld exit short message [note] mysqld.exe <...5.5.48.mariadb> starting process <pid> ... then quit. tried launch mysqld directly, there no mysqld.exe process. service start command might have argument combination enabled mysqld run. tried pass setting configuration file works. put skip-grant-tables=true into mariadb 5.5\data\my.ini restart mysqld, net stop mysql && net start mysql then able login root. don't forget removing inserted line , restart mysqld again.

ios - Objective C Subclass UITextField to copy only -

Image
i'm trying create class makes read text field allows user copy contents. here code: copyonly.h #import <uikit/uikit.h> @interface copyonly : uitextfield @end copyonly.m #import "copyonly.h" @implementation copyonly - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code [self attachtaphandler]; } return self; } - (void) attachtaphandler { [self setuserinteractionenabled:yes]; uigesturerecognizer *touchy = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletap:)]; [self addgesturerecognizer:touchy]; } - (bool) canperformaction: (sel) action withsender: (id) sender { return (action == @selector(copy:)); } - (void) handletap: (uigesturerecognizer*) recognizer { [self becomefirstresponder]; uimenucontroller *menu = [uimenucontroller sharedmenucontroller]; [menu settargetrect:self.frame inview:self.superview]; [menu

c++ - Moving Mouse Pointer -

i doing project on gesture based mouse. using hand object. have tracked hand , co-ordinate of center of hand-contour. if use co-ordinates directly, can't move mouse outside hand-window. tried using scaling factor, then, instead of scaling, mouse position shifts downwards, area covered new pointer same hand-contour window. can covering entire screen. using visual c++ 2010 opencv. code snippet mouse call , mouse function below. /*setcursorpos sets cursor position @ x,y*/ int mymouse(int x,int y) { x*=3; /*i have tried many value this, screen size/handcontour window size etc*/ y*=3; setcursorpos(x,y); return 0; } /* x , y of hand center passed shown below*/ mymouse(mc[0].x,mc[0].y); update: can use clienttoscreen () or mapwindowpoints achieve same?? if please explain same .

macros - Creating prompt for missing and nonmissing -

i trying add prompt missing or nonmissing options. code doesn't work ,need fix that. rec_and_issues new table created in report. need pick rec_and_issues.sfvfdbk_feedback_comments missing or not. %macro missing_or_nonmissing; %if "&sel_issue" eq "missing" %then %do; data rec_and_issues; set rec_and_issues; rec_and_issues.sfvfdbk_feedback_comments null; run; %end; %else %if "&sel_issue" eq "nonmissing" %then %do; data rec_and_issues; set rec_and_issues; rec_and_issues.sfvfdbk_feedback_comments not null; run; %end; %mend missing_or_nonmissing; you shouldn't put data step inside macro. how decide depends on style - not include where in macro if it's avoided, makes easier read , understand code - variation on should fine. put parts of datastep in macro vary. %macro missing_or_nonmissing(sel=); %let not = %sysfunc(ifc(&sel=nonmissing,not,)); svfdbk_feedback_comments &not. null %mend missing_or

How to calculate factorial in ruby -

this question has answer here: ruby factorial function 17 answers question : input: 4 # number of input 1 2 4 3 output: 1 2 24 6 cannot desired output my code: num = integer(gets.chomp) k = [] in 1..num k[i] = integer(gets.chomp) end k.each |w| in 1..w w.to_i = w*i end puts w end you can try like: input = integer(gets.chomp) ans = 1 in 1..input ans = ans*i end print(ans)

Is there a way of adding JAXB custom annotations without using annox? -

i've been struggling lot past 2 days annox library, been on every google result , can't make work. keep getting 'unsupported binding namespace " http://annox.dev.java.net ". perhaps meant " http://java.sun.com/xml/ns/jaxb/xjc "' error. i need add annotation before attribute in class created in xsd schema, knows if there's way of doing without using annox? or how can fix error? thank you.

javascript - Show & Hide an element after click -

what want simple. when click image, want message appear. afterwards, when click again want disappear. have problems iplementing due lack of jquery knowledge. appreciate following code, other implementations. know can class="hidden" , have jquery add/remove oh well. this i'm trying work with. <!doctype html> <html> <head> <script> function greet(){ = document.getelementbyid('here'); if (a.trim().length==0){ a.innerhtml = 'message!'; } else{ a.innerhtml = ''; } </script> </head> <body> <img src="http://www.clker.com/cliparts/k/9/m/i/m/8/on-button-small-th.png" alt="alt" onclick="greet()"/> <p id='here'></p> </body> </html> edit: seems should use a.value, must doing else wrong too. if using jquery simple; use javascript (don't forget link jquery main library - google cdn tha

php - Regular expressions - \| not works -

i have problem regular expression. have code: <div class="textpremium">premium access 25.04.2014 | 20:59<br>server: on | bandwidth: 200mb<br /></div> i want match: "25.04.2014" (date) "20:59" (time) "200" (bandwidth) here regular expression : <div class=\"textpremium\">premium access (.*) \| (.*)<br>server: on | bandwidth: (.*)mb<br><\/div> i matched date , time, can't match bandwidth. adding \ before | doesn't work. try updated expression : <div class="textpremium">premium access (.*) \| (.*)<br\s*/?>server: on \| bandwidth: (.*)mb<br\s*/?></div> as can see in comment, trying match <br> when line break formatted <br /> . html not regular language, , should not use regex attempt match it. however, improved expression match both <br> , <br /> using <br\s*/?> . allo

php - Issue on Registering and Using jQuery in domPDF Library -

i need load html content dynamically based on user selection print.php page using php dompdf library export html pdf. have include jquery , other js libraries html seems jquery not registering correctly (or not @ all). in following example tried simple insert text #result using .html() getting empty pdf on output. <?php require_once("dompdf_config.inc.php"); $codigo= ' <!doctype html> <html> <head> </head> <body> <div id="result"></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> $( document ).ready(function() { $( "#result" ).html( "this test" ); }); </script> </body> </html> '; $codigo = utf8_decode($codigo); $dompdf = new dompdf(); $dompdf->load_html($codigo); ini_set("memory_limit","32m"); $dompdf->render(); $dompdf->stream("ejemplo.pdf&q

javascript - How to share a class development between node module and browser environment -

i have code developped node.js: user.js: var underscore = require( '/usr/local/lib/node_modules/underscore' ), backbone = require( '/usr/local/lib/node_modules/backbone' ); var user = backbone.model.extend( { // handle calls mysql }); module.exports = user; and have code developped browser: user.js: define( function( require ) { var backbone = require( "backbone" ); var user = backbone.model.extend( { } ); return luser; } ); is possible share 1 file of user implementation both environment ? yes, can this. it's bit of tricky problem , there several different attempts solve it. current recommendation approach: code exclusively node.js-style commonjs modules this means use require , module.exports not define , no wrapper functions, etc use browserify package bundle of code , ship browser use packages npm whenever available (backbone, underscore, etc), otherwise use browserify's support no

maven - java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory -

this question has answer here: java.lang.illegalstateexception:could not find backup factory javax.faces.application.applicationfactory 2 answers i want migrate jsf 2.1 2.2 can not run server (tomcat) couse of following error: (i'm yours inform used [hibernate + spring + jsf] in project maven) `root webapplicationcontext: initialization started refreshing org.springframework.web.context.support.xmlwebapplicationcontext@37fc34bf: display name [root webapplicationcontext]; startup date [fri apr 25 19:38:18 west 2014]; root of context hierarchy loading xml bean definitions servletcontext resource [/web-inf/spring-beans.xml] bean factory application context [org.springframework.web.context.support.xmlwebapplicationcontext@37fc34bf]: org.springframework.beans.factory.support.defaultlistablebeanfactory@55251cfd pre-instantiating singletons in org.springframework.bean