Posts

Showing posts from September, 2010

excel - Prevent the macro break for pass-protected self-destructing file -

i've decided create pass-protected file self-destruct after 3 wrong password entries. macro runs file open (userform pass entry field pops up) weak point ctrl-break allows stop macro , access code. is there way disable/prevent break option in particular workbook (via vba, preferably)? if interested, can provide macro upon request. upd: here's macro i'm using (date based). private sub workbook_open() if date > cdate("30/03/2015") warning.show end if end sub this part of code assigned "ok" , "cancel" buttons of userform "warning". public integer public b integer sub setib() = 2 - b b = b + 0 end sub private sub cnclbtn_click() warning.hide thisworkbook .saved = true .close false end end sub private sub okbtn_click() call setib dim pass string: pass = "*your pass*" dim passinput string: passinput = warning.passfield.text if passinput = p...

mysql - PHP function unserialize stop working after charset change (from latin1 to UTF-8) -

i use php function serialize serialize object big string, in string special character "—". object save when db using latin1 charset migrate db utf-8. i use php function unserialize object back, since changed charset utf-8 function stop working. don't know why. i modify httpd.conf use: addcharset utf-8 .utf8 adddefaultcharset utf-8 php.ini: default_charset = "utf-8" and convert mysql data utf-8. update catch php error when call unserialize function: unserialize(): error @ offset 19146 of 23672 bytes in /xxx/xxx.php:18 now, please show create table ... , show results. if character set of column stored e28094 latin1, have mess. needed converted hex 97, latin1 encoding em-dash, not. had utf8 bytes, (by default) told mysql had utf8 bytes. may read "—" -- latin1 decoding of each byte. because mysql thinks of 3 latin1 characters. here likely solution. but, cautious. if character set of column utf8, in table. the ...

segmentation fault - core dump in python C-extension -

i writing c-extension python. can see below, aim of code calculate euclidean-dist of 2 vectors. first param n dimension of vectors, second , third param 2 list of float. i call function in python this: import cutil cutil.c_euclidean_dist(2,[1.0,1,0],[0,0]) and worked well, return right result. if more 100 times(the dimension 1*1000), cause segmentation fault - core dump: #!/usr/bin/env python #coding:utf-8 import cutil import science import time = [] b = [] d = 0.0 x in range(2500): a.append([float(i+x) in range(1000)]) b.append([float(i-x) in range(1000)]) t1 = time.time() x in range(500): d += cutil.c_euclidean_dist(1000,a[x],b[x]) print time.time() - t1 print d the c code here: #include <python2.7/python.h> #include <math.h> static pyobject* cutil_euclidean_dist(pyobject* self, pyobject* args) { pyobject *seq_a, *seq_b; int n; float * array_a,* array_b; pyobject *item; pyarg_parsetuple(args,"ioo", &n , ...

xcode - WatchKit Invalid Binary -

i have uploaded app update watchkit extension keeps saying "invalid binary" in itunes connect. need tell itunes connect should include watchkit app anywhere? i checked email itunesconnect , issue app icons had alpha channel. corrected icons , works fine.

php - Is there a difference in putting your SQL query in a variable first rather than in the prepare? -

is there difference between following code, speed wise or preference? $sql = "select * users username=?"; $user = $database->prepare($sql); $user->execute(array(request::post('username'))); vs $user = $database->prepare("select * users username=?"); $user->execute(array(request::post('username'))); i have not tried benchmarking, visual difference less amount of code, why should 1 rather other, or should both? $sql = "select * users username=?"; $user = $database->prepare($sql); $user->execute(array(request::post('username'))); vs $user = $database->prepare("select * users username=?"); $user->execute(array(request::post('username'))); if using select statement once, don't put in variable, lessen memory , process used in creating variable , storing value. $sql = "select * users username=?"; if using more once, can use variables avoid repetitive in...

regex - Using grep, how can I extract every number from a blob of text? -

unlike previous question , want on commandline (just grep). how can grep every number text file , display results? sample text: this sentence 1 number, while number 2 appears here, too. i expect able extract "1" , "2" text (my actual text substantially longer, of course). i think want this, $ echo 'this sentence 1 number, while number 2 appears here, too.' | grep -o '[0-9]\+' 1 2 since basic sed uses bre ( basic regular expression ), need escape + symbol repeat previous character 1 or more times.

Java Code: "Iterations & I/O" Pulling a file into Eclipse and using it -

with project learning how pull , outside file , use in our eclipse program. in outside file (wordpad) there needs 50 numbers (1-50, new number each line:1 return, 2 return, 3 return, etc.). these numbers have ask user pull in file (with input.txt input, output.txt output). ask user 5 names , average numbers each student. example user enters joe, jack, jill, james, , jake should output: joe: 5.5 (average of 1-10) jack: 15.5 (average of 11-20) jill: 25.5 (average of 21-30) james: 35.5 (average of 31-40) jake: 45.5 (average of 41-50) what guys think? advise or help? import java.io.file; import java.io.filenotfoundexception; import java.io.printwriter; import java.util.scanner; public class lineio { public static void main(string[] args)throws filenotfoundexception{ scanner console = new scanner(system.in); system.out.print("enter input file name: "); string inputfilename = console.next(); system.out.print("output file: ")...

java - How to handle multiple parent types with JPA? -

i've inherited system has several tables of form this: create table notes ( id int primary key, note text, parent_id int, parent_type varchar ); basically, idea have several other types, "tickets" , "widgets", , if want add note ticket 123, you'd do: insert notes (note, parent_id, parent_type) values ('blah blah', 123, 'ticket'); is there sensible way have jpa create @onetomany relationships from, say, ticket note schema? or need split notes table out separate ticket_notes, widgets_notes, etc tables? would possible create separate ticketnotes, widgetnotes, etc entities in java using @discriminatorcolumn , perhaps? it seems taking advantage of discriminators , inheritance gets me want. for example: @entity class ticket { @id private integer id; // ... @onetomany(mappedby="ticket", fetch=fetchtype.lazy) private list<ticketnotes> notes; } @entity @inheriten...

apache - Whitelist user IPs in Shiro -

i enable facebook crawl website, needs user authentication. facebook says 1 way around whitelist ips. using apache shiro , know can client's ip calling gethost basichttpauthenticationfilter, not know how let ip addresses past authentication. you have build custom implementation of shrio's org.apache.shiro.web.filter.authc.authenticatingfilter minimally, have customize basichttpauthenticationfilter extending , adding logic skip basichttpauthenticationfilter if request coming whitelisted ip address. package com.acme.web.filter.authc; import java.io.ioexception; import java.util.collections; import java.util.hashset; import java.util.set; import javax.servlet.servletexception; import javax.servlet.servletrequest; import javax.servlet.servletresponse; public class whitelistedbasichttpauthenticationfilter extends basichttpauthenticationfilter { private set<string> whitelist = collections.emptyset(); public void setwhitelist(string list) { ...

uiimageview - iOS UIImage Passes Old Image -

in app, im using api images server. using below code, gets images in order of size replace better quality. dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsurl *imageurl = [nsurl urlwithstring: [nsstring stringwithformat:@"%@", [[[self.information objectforkey:@"images"]objectforkey:@"normal"] description]]]; nsdata *imagedata = [nsdata datawithcontentsofurl:imageurl]; self.shotimage = [uiimage imagewithdata:imagedata]; self.image.image = self.shotimage; }); dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ nsurl *imageurl = [nsurl urlwithstring: [nsstring stringwithformat:@"%@", [[[self.information objectforkey:@"images"]objectforkey:@"hidpi"] description]]]; nsdata *imagedata = [nsdata datawithcontentsofurl:imageurl]; uiimage *image = [uiimage imagewithdata:imagedata]; self.image.image = self.shotimage; }); also, if pres...

php - 1146 Table doesn't exist -

i follow error 1146 message: table 'system.qbruw_extensions' doesn't exist sql=select * qbruw_extensions element='com_imageshow' , type='component reinstall of component doesn't fix problem. qbruw_extensions existing in joomla mysql database com_imageshow folder existing in components folder of joomla joomla database repair doesn't fix problem. joomla 3.4.1 installed... try this select * dbjoomla.qbruw_extensions element='com_imageshow' , type='component' solution : next missing table either export required tables dbjoomla , import system database or use jdatabasedriver->getinstance method connect external database

proxy - How to secure android app from network traffic capturing -

my app making http requests , don't want others see content of requests. @ moment can check app doing using fiddler. in order track network traffic on phone had change wi-fi settings , connect internet using proxy server. i.e. computer. possible programatically check whether phone using proxy? if knew phone using proxy forbid user using app showing error dialog. there ways of solving problem? i've seen apps work on normal wi-fi settings not when using proxy therefore assume there solution. way i'm using retrofit library making requests. moving traffic use https help protect against network snoops fiddler. however, fiddler can decrypt https traffic user's help, means can't use https, need implement certificate pinning, whereby client code verifies server presented 1 specific certificate (not interception certificate fiddler generates). however, doesn't solve problem, user can jailbreak device , disable certificate pinning code. you should step...

asp.net - log4net rolling file appender not working -

i have following configuration: <log4net> <root> <level value="all"/> <appender-ref ref="rollingfileappender"/> </root> <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file value="mylog.log"/> <appendtofile value="true"/> <preservelogfilenameextension value="true"/> <rollingstyle value="composite"/> <datepattern value=".yyyymmdd"/> <maximumfilesize value="5mb"/> <countdirection value="1"/> <maxsizerollbackups value="-1"/> <staticlogfilename value="false"/> <layout type="log4net.layout.patternlayout"> <param name="conversionpattern" value="%date [%thread] %-5level %logger - %message%newline"/> ...

cmd - Can i use XCOPY to copy only files that have changed size? -

i'm trying use xcopy backup .pst files outlook , backup files have changed since last use. normally easy using /d switch save files newer modified date outlook changes date when it's opened regardless of whether contents have changed. is possible use if statement compare file sizes , backup if file size different (not larger or smaller)? currently using: xcopy /m /f /i /y c:\*.pst \\networklocation\%username%\backup thanks this unbelievable tool copying cannot "update" target file. @ least xcopy cannot, , neither can robocopy afaik. batchfile clumsy gets job done: @echo off :: copy files targetdir if different, modified date or size or name set targetdir=backup %%f in (*.pst) call :copy_changed %%f %targetdir% goto :eof :copy_changed set saved=(none) set live="%~1" if not exist "%~2\%~1" goto :do_copy rem compare file metadata of %1 in current dir , dir %2 pushd "%~2" /f "tokens=3 usebac...

ios - Adding gesture to UITextView cancels default behavior -

i wanted add single tap gesture uitextview when save dialog opened can cancel tapping uitextview . when cancels normal single tap behavior of textview. when single tap on text without save drawer out nothing. tap trigger callback method correctly cancels default action of uitextview, (to place cursor wherever tapped). // add gesture cancel saving let singlecodetextviewtap = uitapgesturerecognizer(target: self, action: selector("codetextviewtapped")) singlecodetextviewtap.numberoftapsrequired = 1; codetextview.addgesturerecognizer(singlecodetextviewtap) func codetextviewtapped() { if savedrawerout { movefilenamebanneroffscreen() saveastextfield.text = "" } } how can enable default behavior of uitextview while having single tap gesture? edit tried adding cancelstouchesinview = false , not seem work although seem correct answer. code looks this: singlecodetextviewtap = uitapgesturerecognizer(target: self, action: selector("c...

wolfram mathematica - How can I make a Tooltip to show only the epilog value on a ListLinePlot when hover? -

so, have many images of zeeman interference patterns. task find positions of intensity peaks. i've written script finds maximum values, choose values need "hand", very-very boring, , take long time. kep = import["c:\users\martin\documents\egyetem\4. félév\modern fizika \labor\6. zeeman-effektus\sigma_50.png"]; adat = imagedata[kep, "byte"][[577]][[all, 1]]; csucsok = n[findpeaks[adat, 0.6, 0.6, 75]]; listlineplot[adat, axeslabel -> {"pixel", "intenzitás"}, plotlabel -> "sigma_50.png", imagesize -> large, plottheme -> "classic", epilog -> {red, pointsize[0.008], point[csucsok]}] i have little tooltips shows position(x axis value) of red dot(and red dots), , intensity value(y axis) when click on them, or mouse on them. there way this? maybe make tooltip points separate plot: data = table[{i, randomreal[{-1, 1}]}, {i, 20}]; toplot = select[data, #[[2]] > 0 & ]; show[{ ...

regex - ASP.Net Validation remove < > -

does know how set regular expression validator not allow characters < , > because when typing < > (without spaces) example recieve error. keep page validation enabled ideally, , there should never html input. many in advance

javascript - edit tooltip on a kartograph map -

i'm using kartograph on map adapt style/tooltip depending on data, follow showcase : http://kartograph.org/showcase/choropleth/ map.addlayer('layer_0', { styles: { 'stroke-width': 0.7, fill: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0); }, stroke: function(d) { return color(stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0).darker(); }, }, tooltips: function(d) { return [d["nuts-id"], stars[d["nuts-id"]]? stars[d["nuts-id"]].total_stars: 0]; } }); the map good, want edit it. for style did : map.getlayer('layer_0').style('fill', function(d) { ... }); map.getlayer('layer_0...

java - TextView as attribute? -

i'd use textview attribute private textview = (textview) findviewbyid(r.id.tv_up); private textview mid = (textview) findviewbyid(r.id.tv_mid); private textview down = (textview) findviewbyid(r.id.tv_down); instead of define evertime new: public void onbuttonclickup(view v) { textview = (textview) findviewbyid(r.id.tv_up); textview mid = (textview) findviewbyid(r.id.tv_mid); textview down = (textview) findviewbyid(r.id.tv_down); <..> } public void onbuttonclickdown(view v) { textview = (textview) findviewbyid(r.id.tv_up); textview mid = (textview) findviewbyid(r.id.tv_mid); textview down = (textview) findviewbyid(r.id.tv_down); <..> } the upper methode producing force close error on android device. how solve or possible? thanks! public class testactivity extends activity { private textview up; private textview mid; private textview down; @override public void oncreate(...

hive - How to directly get input tables' statistics in HQL? -

this page statsdev - apache hive - apache software foundation tells following statistics once input tables & partitions information in hive: number of rows number of files size in bytes however, can statistics through unparsed hql directly? or them after parsing input tables & partitions information hql? keyword explain want: languagemanual explain - apache hive - apache software foundation

c# - Can't get Value and DisplayMember from CheckedListBoxControl bound to LINQ -

the question has been asked before on stackoverflow might think it's duplicate, i've tried number of solutions, i'm still stuck. i have winforms checkedlistboxcontrol bound linq query , fail value , displaymembers. below tries value , displaymember values: var avail = c in dc.costcenters select new { item = c.costcenterid, description = c.costcenterid + ": " + c.description }; mylist.datasource = avail; mylist.displaymember = "description"; //retrieval: foreach (var item in mylist.checkeditems) { datarowview row = item datarowview; //try 1: row empty string displaymember = item["description"]; //try 2: cannot apply indexing [] expression of type 'object' var x = item[0]; //try 3: cannot apply indexing [] expression of type 'object' row3 = ((datarowview)mylist....

java - JSch scp without known_host file and with StrictHostKeyChecking -

i trying copy files windows machine linux machine, working fine jsch far. can copy files using stricthostkeychecking no or need have known_host file linux machine copy to. using code java project should able send files automatically (unknown) linux machines. got username, password, ip , publickey machine. there way authenticate without known_host file , via publickey? because of security issues not want switch stricthostkeychecking no "com.jcraft.jsch.jschexception: unknownhostkey" fileinputstream fis = null; jsch jsch = new jsch(); //jsch.setknownhosts(""); jsch.addidentity("d:\\uni\\arbeit\\remote_id_rsa"); session session=jsch.getsession(user, host, 22); session.setpassword(password); //session.setconfig("stricthostkeychecking", "no"); session.connect(); that not make sense. either know host public key , can verify either using known_host file or programmatically using: public void knownhosts.add(hostkey hostk...

javascript - Link not working on image? -

i've been attempting create effect user clicks on image, image replaced image acts link. however problem whenever click replaced image, link doesn't work. fiddle: http://jsfiddle.net/ha6qp7w4/321/ $('.btnclick').on('click',function(){ $(this).attr('src','https://placekitten.com/g/200/300') $(this).attr('href','google.com') }); img tags don't have href properties. need wrap image in anchor , assign url that, or custom redirect. notice image html on inspection of element: <img src="https://placekitten.com/g/200/300" id="1" class="btnclick" href="google.com"> <!-- not valid! --> this isn't valid because imgs aren't anchors! function first() { this.src = 'https://placekitten.com/g/200/300'; $(this).unbind("click"); $(this).on("click", second); } function second() { window.location.href = ...

php - PHPMailer refuses to send attachment -

i've been trying while head around , have no clue. i'm trying write simple form send email uploaded file (which expanded useful) , isn't working @ all. the emails coming through appropriate body, no attachments being included. i've tried file upload form, addattachments linking file on server , addattachments pointing image on imgur , none of them work; attachment never comes through. i'm @ end of patience right now, know i'm doing wrong or way without phpmailer? html form <form action="xxxx.php" id="upload" method="post" name="upload"> <input id="filetoupload" name="filetoupload" type="file" /> <input type="submit" /> </form> php code require("../../../classes/class.phpmailer.php"); $mail = new phpmailer(); $mail->from = "xx@xx.co.uk"; $mail->fromname = "uploader"; $mail->addaddress("xx@xx.co.uk...

javascript - Only getting partial user publication in Meteor Jasmine test -

i have client integration test ensure admin user can change user roles via user management interface in app. however, when query user want change, query comes empty though has been created in fixture. describe('admin users', function() { beforeeach(function(done) { meteor.loginwithpassword('admin@gmail.com', '12345678', function(error) { router.go('/users'); tracker.afterflush(done); }); }); beforeeach(waitforrouter); aftereach(function(done) { meteor.logout(function() { done(); }); }); it('should able change user roles', function(done) { var changeuser = meteor.users.findone({ emails: { $elemmatch: { address: 'user@gmail.com' } } }); console.log('changeuser: ', changeuser); console.log('users: ', meteor.users.find().fetch()); $('#user-' + changeuser._id + '-roles').val('...

Non ascii characters in URL param in camel -

i using graph api of facebook , call through camel framework. query has non ascii characters (e.g. küçük). getting following exception:- cause: org.apache.commons.httpclient.uriexception: invalid query @ org.apache.commons.httpclient.uri.parseurireference(uri.java:2049) @ org.apache.commons.httpclient.uri.<init>(uri.java:147) @ org.apache.commons.httpclient.httpmethodbase.geturi @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.commons.httpclient.httpclient.executemethod @ org.apache.camel.component.http.httpproducer.executemethod @ org.apache.camel.component.http.httpproducer.process @ org.apache.camel.util.asyncprocessorconverterhelper$processortoasyncprocessorbridge.process(asyncprocessorconverterhelper.java:61) @ org.apache.camel.util.asyncprocessorhelper.process(asyncprocessorhelper.java:73) @ org.apache.camel.processor.sendprocessor$2.doinasyncproducer(sendprocessor.java:122) does camel support non ascii characters in uri? if not, other things c...

How to get stored variable value from mysql transaction -

i have written transaction mysql innodb engine. has insert in table auto generate key, insert using auto generate key got using last_insert_id() . after second insert have several inserts need foreign key auto generated key last table in have inserted. did made variable , used of them. now, need auto generated key value returned in java program can use it. how do it? transaction large here trying do. start transaction; insert a(value) values(123); insert b(aid,value) values((select last_insert_id()),345); set @key = ( select last_insert_id() ) ; insert c(val,fk) values(1,@key); insert c(val,fk) values(2,@key); insert c(val,fk) values(3,@key); ..... insert c(val,fk) values(10,@key); now need @key variable value returned in program. java program using j connector mysql (if matters). mysql variables session-scoped can following anywhere want long you're using same connection : select @key; for more information, manual friend : https://dev.mysql.com/doc/refman/5.0...

sql - Return unique rows based on minimum id in mysql -

i've stuck on this: need guid based on minimum id , remove other duplicates (guid, id). id unique field here. +-----------------------------+------+-------------+ | guid | id | post_parent | +-----------------------------+------+-------------+ | 5.jpg | 7626 | 2418 | | 3.jpg | 7625 | 2418 | | 2.jpg | 5972 | 2418 | | 2.jpg | 3000 | 2420 | | 0.jpg | 3205 | 2420 | | 9.jpg | 9205 | 2419 | +-----------------------------+------+-------------+ so want: +-----------------------------+------+-------------+ | guid | id | post_parent | +-----------------------------+------+-------------+ | 2.jpg | 5972 | 2418 | | 2.jpg | 3000 | 2420 | | 9.jpg | 9205 | 2419 | +---------------...

doxygen - Put dot in brief description -

i got sample code. want dot in brief comment. const int myvar = 1; //!< doxygen long brief\. //! brief sentence two. i escape dot told in doxygen manual. not work. first line brief, second detailed. bug? note: multiline_cpp_is_brief , qt_autobrief yes ! use latest version (1.8.9.1). the doxygen manual says if enable option , want put dot in middle of sentence without ending it, should put backslash , space after it. your backslash ist on wrong side of dot, , manual has taken literally, meaning space required after backslash. the following should work (without curly braced part): const int myvar = 1; //!< doxygen long brief.\ {← space here!} //! brief sentence two.

ios - AnyObject vs. Struct (Any) -

i create method projects: func print(obj: anyobject) { if let rect = obj as? cgrect { println(nsstringfromcgrect(rect)) } else if let size = obj as? cgsize { println(nsstringfromcgsize(size)) } //... } but can't because cgrect , cgsize struct s , not conform anyobject protocol . so, ideas on how done? @nkukushkin's answer correct, however, if want function behaves differently depending on whether it’s passed cgrect or cgstruct , better off overloading: func print(rect: cgrect) { println(nsstringfromcgrect(rect)) } func print(size: cgsize) { println(nsstringfromcgsize(size)) } in comparison, any both inefficient (converting structs any , back, have big impact if lot in tight loop), , non-typesafe (you can pass function, , fail @ runtime). if intention coerce both types common type , same operation on it, can create 3rd overload takes type, , have other 2 call it.

linux - Is preset dictionary is only useful for first 32 K bytes of data ? -

i wanted use preset dictionary compressor , de-compressor. read here preset dictionary helpful first 32k bytes of data , after recent 32k data used dictionary. true? missing here ? that's correct, preset dictionary used virtual input decompressor processed before actual compressed input, can use compressed codes replicate parts of it. the deflate algorithm of zlib uses window of 32 kb size refer bytes decompressed before - parts of window , byte literals can use decompression. preset dictionary initialises window, data there "shifted out" real decompressed data, first 32k bytes of data can use decreasing part of preset dictionary.

java - Jackson: different XML and JSON format -

in apache wink based rest project, using jackson jax-rs providers handling both json , xml content type. our response object contains hashmap<string, propertyobject> . map key contains whitespaces , hence can't serialized xml element names. json serialization works fine. json format: { "properties": { "a b c": { "name": "a b c", "type": "double", "value": "2.0" }, "x y z": { "name": "x y z", "type": "double", "value": "0.0" } } } desired xml format <rootelement> <property name="a b c" type="double" value="2.0"> <property nam...

android - Where is android_sdk_root? and how do I set it.? -

Image
i set android_sdk_home application find .android when trying run. error stating android_sdk_root undefined. running win 7, new install of android studio, inside parallels on macbook pro. thank response. checked location , identified same location android_sdk_home environment path. still says root undefined. created android_sdk_root enviroment path same location , still undefined. i received same error after installing android studio , trying run hello world. think need use sdk manager inside android studio install things first. open android studio, , click on sdk manager in toolbar. now install sdk tools need. tools -> android sdk tools tools -> android sdk platform-tools tools -> android sdk build-tools (highest version) for each android release targeting, hit appropriate android x.x folder , select (at minimum): sdk platform a system image emulator, such arm eabi v7a system image the sdk manager run (this can take while) , download ,...

gruntjs - How to set the environment for Grunt? -

i defined task section of gruntfile.js 2 environments -- development , production . don't understand, how grunt decides, wheter use environment section. gruntfile.js module.exports = function(grunt) { // project configuration. grunt.initconfig({ pkg: grunt.file.readjson('package.json'), less: { development: { options: { paths: ["public/css"] }, files: { "public/css/style.css": "public/css/style.less" } }, production: { options: { paths: ["public/css"], plugins: [ ], modifyvars: { } }, files: { "public/css/style.css": "public/css/style.less" } } }, watch: { css: { files: 'public/css/*.less', tasks: ['less'], options: { livereload: true, }, }, } }...

javascript - How to hide scroll bar but want to it keep working -

here code #scroll{ overflow-y:scroll; max-height:500px; width:267px;} i explored on stackoverflow , got many answers explained 2 conatiners in html have 1 div , want apply on that. thanks you should parent child approach recommended one. give element scroll bars, wrap in containing element, , make containing element element smaller, , give it: overflow: hidden; in current scenario can pure css. hide scroll bars in webkit-based browsers (chrome , safari). .element::-webkit-scrollbar { width: 0 !important } hide scrollbars in ie 10+. .element { -ms-overflow-style: none; } hide scrollbars in firefox, has been deprecated. .element { overflow: -moz-scrollbars-none; } jsfiddle

django-celery PeriodicTask and eta field -

i have django project in combination celery , need able schedule tasks dynamically, @ point in future, recurrence or not. need ability delete/edit scheduled tasks so achieve @ beginning started using django-celery databasescheduler store periodictasks (with expiration) database described more or less here in way if close app , start again schedules still there my problem though still remains since cannot utilize eta , schedule task @ point in future. possible somehow dynamically schedule task eta ? a second question of mine whether can schedule once off task, schedule run e.g. @ 2015-05-15 15:50:00 (that why i'm trying use eta) finally, scheduling thousants of notifications, celery beat capable handle number of scheduled tasks? of them once-off while others being periodic? or have go more advanced solution such apscheduler thank you i've faced same problem yesterday. ugly temporary solution is: # tasks.py djcelery.models import periodictask, inter...

How to generate non-negative random numbers(integer) using RNGCryptoServiceProvider C# -

i need generate non-negative random integers in code. example below generates integers; using (rngcryptoserviceprovider rng = new rngcryptoserviceprovider()) { // buffer storage. byte[] data = new byte[4]; // ten iterations. (int = 0; < 10; i++) { // fill buffer. rng.getbytes(data); // convert int 32. int value = bitconverter.toint32(data, 0); console.writeline(value); } } ref: http://www.dotnetperls.com/rngcryptoserviceprovider gives both positive , negative values. how generate non-negative random integers? earlier using random.next() giving me positive integers. pseudocode: repeat temp <- rng.nextinteger(); until temp >= 0; return temp;

opengl es - Custom Shader with GPUImage and GLKIT IOS -

i have custom shader take 3 sampler2d uniform values , need pass them 3 mappings shown below each of texture. have created code follows extending gpuimage class. #import "mappingshader.h" #import <glkit/glkit.h> nsstring *const kgpuimageatgmappingfragmentshaderstring = shader_string ( precision highp float; uniform sampler2d inputimagetexture; uniform sampler2d red; uniform sampler2d green; uniform sampler2d blue; uniform float uamount; varying vec2 texturecoordinate; void main() { vec4 color = texture2d(inputimagetexture, texturecoordinate); vec2 indexred = vec2(color.r, 0.0); vec4 redcolor = texture2d(red, indexred); vec2 indexgreen = vec2(color.g, 0.0); vec4 greencolor = texture2d(green, indexgreen); vec2 indexblue = vec2(color.b, 0.0); vec4 bluecolor = texture2d(blue, indexblue); gl_fragcolor = mix( color, vec4(redcolor.r, greencolor.g, bluecolor.b, color.a),...

iphone - is there a way to sort an array by category on ios -

how can create custom sort order on app? suppose have company , workers divided positions inside factory , wanna see performance of workers on specific position. could, on core data, predicate result wanna, @ same time, see more 1 positions, constructor, driver, engineer, etc. how can order fetch request result should of constructors first, drivers , @ end of of engineers? thanks in advance , hope explained want. just create nssortdescriptor position when fetch coredata. nssortdescriptor *sortdescriptor = [nssortdescriptor sortdescriptorwithkey:@"position" ascending:yes]; [fetchrequest setsortdescriptors:@[sortdescriptor]]; that go positions alphabetically... if don't want done alphabetically implement new attribute nsnumber keep track of sort order want , fetch based upon that. this post seems talk bit example. however, if order going different @ times, might better off holding nsmutablearray total list, , performing individual fetches each position...

javascript - AngularJS $watch not updating my output -

i have html looks - <div ng-controller="postsctrl"> <ul ng-repeat="post in posts" style="list-style: none;"> <li style="padding: 5px; background-color: #f5f5f5;"> <h4> <a href="#" ng-click="showdetails = ! showdetails">{{post.posttitle}}</a> </h4> <div class="post-details" ng-show="showdetails"> <p>{{post.postcontent}}</p> </div> </li> </ul> </div> now data being populated json based rest url , being displayed. have form adding new post database- <form data-ng-submit="submit()" data-ng-controller="formsubmitcontroller"> <h3>add post</h3> <p> title: <input type="text" data-ng-model="posttitle"> </p...

linux - What does `!:-` do? -

i new bash scripting , in ubuntu\debian package system. today studying content of preinst file script executes before package unpacked debian archive (.deb) file. my fist doubt line containing this: !:- probably stupid question but, using google, can't find answer. insert last command without last argument (bash) /usr/sbin/ab2 -f tls1 -s -n 1000 -c 100 -t 2 http://www.google.com/ then !:- http://www.stackoverflow.com/ is same as /usr/sbin/ab2 -f tls1 -s -n 1000 -c 100 -t 2 http://www.stackoverflow.com/

javascript - Use inputs multiple times -

i have 3 input fields type:number called separately when pushed on button. instance, click on button1 dialog1 appears , on.. want in code behind ( jquery ) value number input , place in <div class="total-price"></div> <div id="dialog1"> <h2>product 1</h2> <input type="number" class="col-md-4 amount" id="amount" min="0" max="10" step="1" value="0"> <div class="total-price">total:</div> </div> <div id="dialog2"> <h2>product 1</h2> <input type="number" class="col-md-4 amount" id="amount" min="0" max="10" step="1" value="0"> <div class="total-price">total:</div> </div> <div id="dialog3"> <h2>product 1</h2> <input type="number...

c++ - Create a single image from images array -

hi i'm trying create single image multiple images in opencv. images use same size. what reshaping them single line , try merge them new image. i create new image size of 2 images , pass array recieve error exc_bad_access(code=1, address = ..) note: sizes of images correct size of single image : [170569 x 1] size of new_image : [170569 x 2] my code below. thank you int main(){ mat image[2]; image[0]= imread("image1.jpg",0); image[1]= imread("image2.jpg",0); image[0] = image[0].reshape(0, 1); //single line image[1] = image[1].reshape(0, 1); //single line int size = sizeof(image)/sizeof(mat); mat new_image(image[0].cols,size,cv_32fc1,image); } if understand need concatenate 2 image of same size 1 mat. wrote quick code perform task. u can change argument function pointer , add other handlers care variant size image. #include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/hi...

c# - How do I create Optional Type injection for a base class? -

during course of regular agile programming technique, lot of refactoring. if find common things candidates base class. assume code pattern: public subclass : baseclass{ private dynamic somevalue = null; public subclass(){ somevalue = baseclass.method<t>(); } } everything works fine until tired of continually injecting type method. why not inject type base class instead? wait second, don't want have redo 20 classes using pattern above. have 2 potential patterns can use, being second. public subclass : baseclass<t>{ private t somevalue = null; public subclass(){ somevalue = baseclass.method(); } } this second pattern logical derivation of first example whereby merely moving type class ctor instead of using generic type in each method. i ask community thoughts on how accomplish both constructs without changing current code adding in support of generic type baseclass pattern. i have read other posts on "optional generic...

Google Search Appliance search in Google Groups -

i want use gsa serve search results google groups. i lot of research in web did not found information gsa , google groups. understood google groups use #! (hashbang) in url , gsa doesn't support crawling ajax applications. i think solutions use integrating google apps method on this, , other similar, article talk google sites , google docs , not google groups. because try solution have involve various departments in company know if used method that. or if give me advices achieve that. since there no api nor existing oob stuff on gsa crawl google groups, best way use google adaptor framework , create on own. should easy tbh.

sql server - How to write a sql query for different conditions in where clause on demand? -

i have pass different parameters columns code behind, written 15 gridview binding methods 15 columns, avoid set in query.for example if column 1 pick clause , if column 2 pick clause.so how write this? here example of how create , run dynamic queries create procedure sp_search @param1 int = null, @param2 int = null begin declare @query_string nvarchar(4000); set @query_string = 'select * table_name 1 = 1 '; if(@param1 not null) begin set @query_string = @query_string + ' , columnname1 = ' + cast(@param1 varchar); end if(@param2 not null) begin set @query_string = @query_string + ' , columnname2 = ' + cast(@param2 varchar); end exec sys.sp_executesql @query_string; end

objective c - Unable to show child view (iOS view container) -

Image
in ios application, have main view controller 3 buttons, work tab bar: when click 1 of buttons, new view controller invoked. tried implement via container view containers, tried following guide ( http://www.thinkandbuild.it/working-with-custom-container-view-controllers/ ) , invoke presentdetailcontroller method in viewdidload of main controller. actually, no views showed: can me figuring out why? thanks. viewcontroller.h #import <uikit/uikit.h> @interface viewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uibutton *btnone; @property (weak, nonatomic) iboutlet uibutton *btntwo; @property (weak, nonatomic) iboutlet uibutton *btnthree; @property (weak, nonatomic) iboutlet uiview *detailview; - (ibaction)click:(id)sender; @end viewcontroller.m #import "viewcontroller.h" #import "firstviewcontroller.h" @interface viewcontroller () @property uiviewcontroller *currentdetailviewcontroller; @end @implementation viewcontroller ...

arrays - PHP to store all variables from loop to use them later -

i trying use wsdl webservice work each parameters. working absolutely fine; however, once script executed, have "log" emailed me. all works fine when use print , or echo inside loop (this display values of different variables loop). however, outside of loop, display 1 variable. is there way store variables array inside of loop can used later on, outside of loop, example emailing this? this have tried: <?php // api request , response $requestparams = array( 'request' => 'hello' ); $client = new soapclient('https://example.com/webservice.asmx?wsdl'); $response = $client->command($requestparams); //load response xml $xml = simplexml_load_string($response); $rows = $xml->children('rs', true)->data->children('z', true)->row; foreach ($rows $row) { $attributes = $row->attributes(); /* xml document contains 2 columns, first attribute to, second attribute ref. extract required data */ $to = (s...