Posts

Showing posts from July, 2014

How to get username in Windows domain from service using Ruby? -

i need name of domain user in windows. here ways tried name, return domain name: 1. ... env['username'] # or env['username'] or env['userid'] ... 2. ... require 'etc' puts etc.getlogin ... 3. ... require 'dl/win32' def get_user_name api = win32api.new( 'advapi32.dll', 'getusername', 'pp', 'i' ) buf = "\0" * 512 len = [512].pack('l') api.call(buf,len) buf[0..(len.unpack('l')[0])] end ... 4. this way return string "system" : ... require 'win32ole' network=win32ole.new("wscript.network") puts network.username ... how can username or pair domain\username? can't run system commands , store them in variable. u = `whoami /user` now u has user information processing, isnt?

jquery - Trigger autohotkey using javascript -

i'm making chrome extension me automatize tasks have , reached point need trigger autohotkey scripts. is there way can trigger authotkey using javascript (i use jquery)? couldn't find until , tried failed. any or direction appricated. in advance. the http route right way go. can set small server using node.js node.js , , have spawn ahk script using 1 of child process functions. don't know how chrome extension security model works, might have mitigate cross-site scripting concerns. think that's solvable, haven't done so.

gtk - Tab creation with Gtkada -

i'm trying set hmi in ada gtkada , want have tabs (notebooks in gtk language). i didn't found lot of documentation gtkada, here wrote doesn't work, have idea why? simple grey window opening. with gtk.main; use gtk.main; gtk.window; use gtk.window; gtk.enums; use gtk.enums; gtk.notebook; use gtk.notebook; gtk.button; use gtk.button; gtk.label; use gtk.label; procedure ihm win : gtk_window; notebook : gtk_notebook; generationbutton : gtk_button; label_generation : gtk_label; begin init; gtk_new (win, window_toplevel); gtk_new (generationbutton); gtk_new (notebook); gtk_new (label_generation, "generation"); notebook.append_page (generationbutton, label_generation); win.set_title ("generator"); win.set_default_size (1200, 800); win.set_position (win_pos_center); win.add (notebook); win.show; main; end ihm; ...

css3 - Obtain background properties of element during css transition JQUERY -

i have element add classes jquery in order animate/carry out css transition of background property. aim have pause transition while it's in motion, thought maybe obtaining current background property of element , setting css properties obtained. html <div id="productimage"> </div> css #productimage { -webkit-transition: 2.5s ease-out; -moz-transition: 2.5s ease-out; -o-transition: 2.5s ease-out; } #productimage.step2 { background-size:1500px 2275px; background-position: 30% 30%; } #productimage.step3 { background-image: url("../img/blusen-back.jpg"); background-size:396px 600px; -webkit-transition: 2.5s ease-out; -moz-transition: 2.5s ease-out; -o-transition: 2.5s ease-out; } to property of background, can use: element.css() here link and jsfiddle: link hope helps

javascript - Kendo grid custom editor dropdown list doesn't reflect the selection -

i create dropdownlist editor on grid , works, when click on dropdownlist , select item click somewhere else (lose focus of dropdownlist), selected item doesn't reflect grid, see text before selection (but selected, when click on same item see item in dropdownlist i've selected) here example: http://jsfiddle.net/umws5/2/ how make selection reflect grid? the way commonly solve problem in kendo grid create lookups of available selection items can use retrieve value displayed in grid id: window.lookups = {}; var usertypelookup = window.lookups["user_type"] = {}; $.each(user_type, function (idx, value) { usertypelookup[value.typeid] = value.typename; }); in column template can reference lookup display value: { field: "typeid", editor: usertypelist, template: '#= lookups["user_type"][typeid] #' } here updated fiddle implements approach: http://jsfiddle.net/umws5/4/

javascript - Dictate event jquery order -

is possible dictate order in jquery events should fired? i.e. <div class="c1 c2 c3"></div> $('.c1').click(someclickevent); $('.c2').click(firstevent); $('.c3').click(lastevent); where firstevent should fired first , lastevent should fired last. someevent doesn't care when called. the main reason being firstevent may want prevent other events firing returning false assume order in events bound can't changed. assume events bound same domelement (or elements) though not same selector (as above) finally assume events know nothing of each other, in entirely different (and possibly unrelated) sections of code. by using little-known .when() method, can force events occur in specific order , base end result on each individual result. $.when($('.c1').click(), $('.c2').click()) .then($('.c2').click(), clickerror); this fire off both c1 click , c2 click , , evaluate responses. if both s...

how to run super user commands in java? -

i running 1 (runtime)sample java program in ide. not getting in console. the program execute super user commands. try { process p = runtime.getruntime().exec("su -c xl list"); // or "sudo xl list" bufferedreader in = new bufferedreader( new inputstreamreader(p.getinputstream())); string line = null; while ((line = in.readline()) != null) { system.out.println(line); } } catch (ioexception e) { e.printstacktrace(); } ^ xl list super user command. how call one. or give me suggestion call "ipconfig" command. perhaps getting error, or su asking password i suggest you read error messages using sudo in way doesn't require password.

mongodb - grails 2.2.4 and grails-spring-security-facebook plugin with GPmongoDB 1.3.0GA -

when use grails spring security facebook plugin mongodb database, keep throwing optimisticlockingexception on these section . then override facebookauthservice these. class facebookauthservice { def create(facebookauthtoken token) { facebookuser fbuser = new facebookuser(uid: token.uid) fbuser.accesstoken = token.accesstoken?.accesstoken fbuser.accesstokenexpires = token.accesstoken?.expireat facebook facebook = new facebooktemplate(token.accesstoken.accesstoken) facebookprofile fbprofile = facebook.useroperations().userprofile user user = user.findbyusernameorfacebookid(fbprofile.email,fbprofile.id) if(!user){ user = new user() user.facebookid = fbprofile.id user.firstname = fbprofile.firstname.tols() user.lastname = fbprofile.lastname.tols() user.gender = gender.strtoenum(fbprofile.gender) user.acceptterms = true user.accepttermsda...

upgrade - Postgresql's pg_dump and pg_restore across different major versions? -

recently came across (maybe known problem) when postgre's versions differ in major number (always upgrade, no downgrade), example field types. in case, there little conflicting data changed hand, wanted know more, in case come across problem again more data. in concrete case (but can extended other possible problems in future), created backup using data inserts, had table structure saved. the problem came when upgrading 8.x 9.x money type, got errors because inserts had value like insert foo(...) values (...,'eur300',...); so postgres refusing insert in 9.1 my idea, , tried convert field decimal , redoing dump, worked, in future, there mechanism, using newer pg_dump connecting old database, instead of current one? (did not tested this) when going etween different versions, should use new version of pg_dump . meaning when go 8.x 9.1, should use pg_dump version 9.1. should take care of conversions necessary.

javascript - Jquery - how to get jquery object of checkbox that are checked -

this question has answer here: how retrieve checkboxes values in jquery 16 answers i'd ask how jquery object of checkboxes checked. i have several checkboxex have "checkboxes" class. checked, , others not checked. <input type="checkbox" class="checkboxes" checked="checked" /> i put $('.checkboxes') checkboxes variable. var checkboxes = $('.checkboxes'); but don't know write after this. could me? thanks in advance :) jquery has selector checked or selected items: :checked . checked checkboxes object use this: var checkedboxes = $( '.checkboxes:checked' );

java - How to retrieve data on button and move to Next button? -

i working on android quiz . have created database 1 question , 4 options along-with difficulty level. have created layout display question 4 buttons . problem how connect database question , 4 buttons. so to, when click on right button moves next question , when click on wrong button gives error , exits. code in xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:background="@drawable/background"> <linearlayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="110dp" android:paddingtop="5dip" android:paddingbottom="5dip" android:gravity="center_horizontal"...

How to build project with AspectJ using Ant -

our project using aspectj. works fine in eclipse ide since it's aspectj project in eclipse ide (having aspectj runtime in classpath) doesnt work if use ant build project in unix. have seen articles mention ivy target, i'm looking more details on how config aspectj project build ant. after googling, found need create aop.xml under meta-inf , add aspectjweaver.jar jvm options in ant build.properties. aspect seems working since saw methods being intercepted. found below exception @ startup: error org.aspectj.weaver.bcel.bcelworld - unable find class 'object' in repository java.lang.classnotfoundexception: object not found - unable determine url @ org.aspectj.apache.bcel.util.classloaderrepository.loadclass(classloaderrepository.java:292) ~[aspectjweaver.jar.0:1.7.3] @ org.aspectj.weaver.bcel.bcelworld.lookupjavaclass(bcelworld.java:402) [aspectjweaver.jar.0:1.7.3] @ org.aspectj.weaver.bcel.bcelworld.resolvedelegate(bcelworld.java:376)...

html - Balancing the height of an element in two different containers using CSS -

i have few consecutive section elements each of contains heading tag. possible force browser render heading tags same heights using css (making browser use largest computed value without specifying exact value). following code fragment should provide clearer picture of have in place , parts want browser render using largest computed value of height. <section> <h2>heading one</h2> <img src = ''> <p>some text</p> </section> <section> <h2>heading two</h2> <img src = ''> <p>some text</p> </section> <section> <h2>heading three</h2> <img src = ''> <p>some text</p> </section> as of headings in structure can have text spans couple of lines resulting in varying heights headings, know solution using css, if 1 exists, can force browser use largest value of height of 3 heading tags 3 of tags. notes: all 3 of se...

c++ - Strange lighting effect in direct3d switches dark and light -

Image
i drawing d3dpt_pointlist , have set direct3d 9 device number of states. don't want use lighting, because want show vertex colors. depending on view matrix, vertices appear become dark or light. change @ once , can't find renderstate solves problem. i'll try keep short possible. if there info missing, please let me know. struct myvertex { float x, y, z; d3dcolor color; }; // in initialization of device g_d3d9device->createvertexbuffer (sizeof(myvertex)*g_maxverts, d3dusage_writeonly | d3dusage_dynamic, 0, d3dpool_default, &g_d3d9dynamicvb, null); each frame set these render states: g_d3d9device->setrenderstate (d3drs_cullmode, d3dcull_none); g_d3d9device->setrenderstate (d3drs_alphablendenable, false); g_d3d9device->setrenderstate (d3drs_zfunc, d3dcmp_lessequal); g_d3d9device->setrenderstate (d3drs_zwriteenable, true); g_d3d9device->setrenderstate (d3drs_zenable, true); g_d3d9device->setrenderstate(d3drs_localviewer, false);...

.net - Serializing abstract class over WCF with subclasses in different assemblies -

we using c# , .net 4 build wcf-enabled application. have "parent" assembly implements: [datacontract] public abstract class { //... } then, other "child" assemblies implement subclasses of a , this: [datacontract] public class b : { //... } in assembly have methods trying encapsulate wcf services. of these methods have return type of a . evidently, child assemblies need include reference parent assembly in order derived classes inherit class a . problem arises when wcf seems demand add knowntype attributes class a list potential subclasses; need parent assembly a resides had references child assemblies, create circular dependencies. is there other way around this? wcf need know types of potential concrete classes of abstract class being used return type? thank you. edit . have tried approach based on knowntypeattribute.methodname , suggested comments. allow dynamically load assemblies subclasses reside , return subclasses wcf on demand. work...

ios - Getting error using iCarousel -

this icarouselviewcontroller.m - (void)dealloc { //it's idea set these nil here avoid //sending messages deallocated viewcontroller carousel1.delegate = nil; carousel1.datasource = nil; carousel2.delegate = nil; carousel2.datasource = nil; [carousel1 release]; [carousel2 release]; [items1 release]; [items2 release]; [super dealloc]; } i getting error saying 'release' unavailable: not available in automatic reference counting mode arc forbids explicit message send of 'release' 'release' unavailable: not available in automatic reference counting mode arc forbids explicit message send of 'release' 'release' unavailable: not available in automatic reference counting mode arc forbids explicit message send of 'release' 'release' unavailable: not available in automatic reference counting mode arc ...

java - Get rid of a checked exception when using NIO2 API -

currently, loading property file classpath using following code of guava api: final url fileurl = resources.getresource("res.properties"); final file file = new file(fileurl.getfile()); i decided give try new nio2 api introduced in java7se , remove guava api calls transformed code following: final url fileurl = getclass().getresource("/res.properties"); final path path = paths.get(fileurl.touri()); but modified code throws checked exception in line conversion occurs between url , uri . there way can rid of it. can path instance given url , example? p.s. aware modified code not semantically same original 1 - guava's getresource throws illegalargumentexception if resources not found, java's getresource returns null in case. you use: final file file = new file(fileurl.getfile()); final path path = file.topath(); //can throw unchecked exception

git rewrite history - Shrinking Git Repo - Object in packet, not in commits -

i'm trying shrink git repo that's around 2gb. i'm following "removing objects" section of chapter 9 (9.7) in progit book: http://git-scm.com/book/en/git-internals-maintenance-and-data-recovery after running git gc , git verify-pack , git rev-list command, i've found .tar file that's 118mb. don't need in repo @ all. needs destroying forever. but when try find out commits have used file, nothing: git log --oneline -- news/news.tar does mean file not in repository history? , if that's case can leave or still pushed object when git push ? if that's case, how rid of it. use bfg, not git-filter-branch... the bfg gives foolproof method of getting rid of large files, easier using git filter-branch , see http://rtyley.github.io/bfg-repo-cleaner/ : $ bfg --strip-blobs-bigger-than 100m my-repo.git ...still here? if you'd try figure out what's gone awry when following steps "removing objects" in sect...

javascript - Isotope Filtering not working in IE -

my website has isotope filtering function portfolio, working fine in ff , chrome not in ie9 below.. here script. <script> jquery(document).ready(function () { var mycontainer = jquery('#projects'); mycontainer.isotope({ filter: '*', animationoptions: { duration: 4000, easing: 'liniar', queue: false, } }); jquery('#projects-filter a').click(function () { jquery('#projects-filter a.active').removeclass('active'); var selector = jquery(this).attr('data-filter'); mycontainer.isotope({ filter: selector }); jquery(this).addclass('active'); return false; }); }); </script>

How to enable CSS3 transitions in internet explorer 10? -

i'm trying reproduce effect: http://tympanus.net/tutorials/3dshadingwithboxshadows/ can suggest exact method how make css3 transitions work correctly on internet explorer 10. you not need add more standard syntax make work in ie10. in fact, ie10, other vendor products, supports shorthand animation property alone well. visit : http://msdn.microsoft.com/en-us/library/windows/apps/dn279623.aspx more details. to know different syntax comparison , version compatibility, please see below : chrome 1.0 (-webkit prefix) firefox 4.0 (2.0) (-moz prefix) 16.0 (16.0) (no prefix) internet explorer 10.0 (no prefix) opera 10.5 (-o prefix) 12.0 (no prefix) safari 3.2 (-webkit prefix)

How to return an array as table from C function to lua? -

i need impelement c function lua script call.i shall return array table function.i used code blow crashed.could tell me how use it? struct point { int x, y; } typedef point point; static int returnimageproxy(lua_state *l) { point points[3] = {{11, 12}, {21, 22}, {31, 32}}; lua_newtable(l); (int = 0; 3; i++) { lua_newtable(l); lua_pushnumber(l, points[i].x); lua_rawseti(l, -2, 2*i+1); lua_pushnumber(l, points[i].y); lua_rawseti(l, -2, 2*i+2); lua_settable(l,-3); } return 1; // want return lua table :{{11, 12}, {21, 22}, {31, 32}} } need change lua_settable @lhf mentions. also, adding first 2 indices of sub-tables typedef struct point { int x, y; } point; static int returnimageproxy(lua_state *l) { point points[3] = {{11, 12}, {21, 22}, {31, 32}}; lua_newtable(l); (int = 0; < 3; i++) { lua_newtable(l); lua_pushnumber(l, points[i].x); lua_raws...

Python project versioning -

the problem: i need set versioning in python project. every time make release - merge production , development branches in vcs. need make least amount of corrections in setting version of project , automate process. what i`ve done: i`ve read pep 396 module versioning (it not need) i figured out how set version project setup.py file in this documentation i figured out how django works versions here my next steps: i need release: release date revision version number so plan make release number format major.minor.changeset , because keeping release date in version makes pretty long. want create version.py file: major_version = 1 minor_version = 1 release_date = '28 .08.2013 ' def get_revision ():     ... def get_version (): .... and import version there when need (but i'm affraid can forget set proper date), , put file change.txt next describes release changes. the question: i want know how set versions in python projec...

php - Using HMAC with Web App and API -

i have been trying implement system of authorisation api able work web app. have looked @ 3 legged oauth signature verification, not interested in oauth. method testing out can found here . uses hmac authorize sign request similar amazon signature. have cobbled working example here. nothing fancy. proof of concept. client side uses cryptojs , jquery //dummy credentials var username = 'username'; var password = 'password'; //first create key , store in memory duration of app var key = cryptojs.sha512(username + "." + password).tostring(); var url = "http://127.0.0.1/whisppa/api"; //setup parameters sent server var params = { "user" : username, "requested_url" : cryptojs.md5(url).tostring(),//hash url make shorter "signature_version" : "1.0", "time" : 0 } //get parameters , sort them var props = []; for(var ...

objective c - Xcode refactor name of file -

as know can change name of file created in xcode option "refactor -> rename" (by selecting class name after @interface keyword). it works well, found doesn't change/rename class name header comment. know minor one, wanted know that, default behaviour of "rename" option or doing wrong? solution reflecting in header comment also? thanks you have manually search , replace occurrences of old filename. xcode's refactor tools quite limited. xcode can't automatically rename tokens in comments. if refactor code might want @ appcode , objective-c ide has way better refactoring tools. appcode can rename tokens in comments.

web services - Consuming .asmx webservice using coldfusion error -

i trying consume .asmx webservice in coldfusion. can view wsdl when trying access methods gives me error: webservice operation ... parameters ... cannot found i have tried add refreshwsdl = true stated in other similar stackoverflow questions no luck. what missing? <cfinvoke webservice = "urlhere.asmx?wsdl" method="loginrequest" returnvariable ="result" refreshwsdl="true" > <cfinvokeargument name="oid" value="a"> <cfinvokeargument name="username" value="b"> <cfinvokeargument name="password" value="c"> </cfinvoke> here part of wsdl: <s:schema elementformdefault="qualified" targetnamespace="http://blahblah"> <s:element name="loginrequest" type="s0:loginrequest" /> <s:complextype name="loginrequest"> <s:sequence> <s:element minoccurs="0" maxo...

javascript - How to get Jquery scrollTo plugin work with AngularJS - without flickering -

i'm trying combine scrollto plugin jquery angularjs. reason why want want have automated scrolling specific section of website if corresponding url used. until works, not perfectly. there short flickering if 1 clicks on link, before animation starts. i think problem can solved using: event.preventdefault(); but don't know how combine call of preventdefault function angularjs code ... i'm new angularjs maybe there simple solution don't know yet. tried several solutions found on net without success. here can find abstract of current solution : http://jsfiddle.net/hcb4b/6/ it's not runnable because can't include easing plugin ... thanks in advance the entire source of ngclick super simple https://github.com/angular/angular.js/blob/v1.2.0rc1/src/ng/directive/ngeventdirs.js#l43-l52 effectively: ng.directive('ngclick',['$parse',function($parse){ return function(scope, element, attr) { var fn = $parse(attr[...

shieldui - Passing arguments to a new window after click on a Shield UI JavaScript pie chart -

i using shield ui javascript chart on web page. current type of chart pie. need provide users more data after click on slice of pie. data provided in separate window, , need pass parameters in url of opened document. tried techniques; none of them working properly. use pointselect events events: { pointselect: function(args) { } }, but stuck @ point. appreciate help. if open window window.open , can reference window afterwards: var w = window.open("http://www.google.com/", "popup"); // wait window load , w.onload = function(){ w.dosomething(); }; see https://developer.mozilla.org/en-us/docs/web/api/window.open if have pass parameters, can make use of location.hash , example, link page.html#/some/variables/here , split location.hash , etc.

java - How to use and set appropriately concurrency level for ConcurrentHashMap? -

i working around 1000 elements in concurrenthashmap . default concurrency level 16 . can me algorithm or factors can identify concurrency level suitable scenario or in way concurrency level affects processing of multiple threads . concurrenthashmap<string, string> map=new concurrenthashmap<string, string>(500,1,20); 20 concurrency level (dummy value) .need set efficiently according docs: the allowed concurrency among update operations guided optional concurrencylevel constructor argument (default 16 ), which used hint internal sizing . table internally partitioned try permit indicated number of concurrent updates without contention. because placement in hash tables random, the actual concurrency vary. ideally, should choose value accommodate many threads ever concurrently modify table. using higher value need can waste space , time, , lower value can lead thread contention. so need answer 1 q...

java - Why I'm getting Javassist objects in the middle of a result set? -

Image
i'm having strange problem when try retrieve entities database. table entities lives have 4 rows. when try select rows list first , last elements loaded correct, however, second , third has properties null. here print of debug console: the entity simple, can see below: @entity @table(name = "empresa") public class empresa implements serializable { @id @generatedvalue(strategy = generationtype.identity) @column(name = "id_empresa") private integer idempresa; @basic(optional = false) @column(name = "nome_empresa") @ordercolumn private string nomeempresa; @column(name = "cnpj") private string cnpj; @onetomany(cascade = cascadetype.all, mappedby = "idempresa", fetch = fetchtype.lazy) private list<cadastro> cadastrolist; } if want know how retrieving entities, here code: @override public list<t> recuperartodos() { query query = entitymanager.createquery(criar...

amazon web services - Hosting a Git repository on an AWS Windows Server -

i'm trying host own private git setup on aws windows server instance. here setup: openssh installed via cygwin this works. have sshed server git daemon installed via cygwin this seems work. have created , cloned repos locally using git bash outgoing firewall rule allowing tcp on ports 22 , 9418 incoming firewall rule allowing tcp on ports 22 , 9418 i'm not sure required. as far can tell, need, except can't clone repo. i'm using command remotely: git clone ssh://myuser@myserver.com/git/myrepo and output: clone 'myrepo' fatal: not read remote repository please make sure have correct access rights , repository exists. however, exact same command works fine when run on myserver 's through git bash... leads me believe firewall issue. can't seem find port needed, though. extra details: my repo initialized using git init --bare --shared my aws instance's security group (sg) has following rules (currently debugging) ...

php - Search code optimisation - CakePHP -

i have database containing list of files (around 6000 files). these files have additional details linked them (such project numbers, sectors, clients, comments, disciplines). although code , search works, it's slow. simple search 2 terms takes minute complete. my code below. want know is, can simplify , optimize search function? public function search() { $terms = explode(' ',$this->request->data['kmfiles']['search']); $possible = 0; $matches = array(); foreach($terms $term) { $files = $this->kmfile->find('list', array( 'conditions' => array( 'file_name like' => '%' . $term . '%' ), 'fields' => array('id') ) ); $possible++; $clients = $this->kmclient->find('list', array( 'conditions' =...

php - 1000 checked elements maximum in a post? -

this question has answer here: posting form few thousand values 1 answer i'm having trouble understand html forms : i tried send 50 000 checked checkboxes through form (post method), var_dump($_post) tells me there 1000 element in array. in local, value correct 50 000 elements. is there parameter somewhere in apache or php limit number of checked elements posted ? note : 1) tried change post_max_size 16m, , limit not reached. 2) name of inputs doesn't matter (same result t1, t2, t3... , test_with_a_long_name1, test_with_a_long_name2 ... etc) limit 1000. thank in advance ! frederic there setting in php.ini called max_input_vars more here: http://anothersysadmin.wordpress.com/2012/02/16/php-5-3-max_input_vars-and-big-forms/

jquery sortable, changing sequence of items -

is possible reorder items in sortable list without dragging them? example if have list of items, 1,2,3, click on link (a button - whatever) , list 3,1,2. maybe shouldn't use "sortable" this? suppose have following html: <ul id="sortable" class="ui-sortable"> <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 3</li> <li class="ui-state-default" style=""><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 2</li><li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 4</li><li class="ui-state-default" style=""><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>item 1</li> <li class="ui-state-default" style=""><span class=...

javascript - simple setInterval with paper.js not working -

i'm trying understand how use setinterval paper.js. made simple test, same code inside setinterval function , outside. works on latter case, not when inside setinterval. idea? // interval (not working)// var id = setinterval(function() { var path = new path.circle(new point(20, 20), 30); path.fillcolor = 'red'; var pointx = 80; var pointy = 50; var symbol = new symbol(path); symbol.place(new point(pointx, pointy)); pointx = pointx+50; pointy = pointy+50; } }, 1000); //no interval// var path = new path.circle(new point(20, 20), 30); path.fillcolor = 'red'; var pointx = 80; var pointy = 50; var symbol = new symbol(path); symbol.place(new point(pointx, pointy)); pointx = pointx+50; pointy = pointy+50; symbol.place(new point(pointx, pointy)); http://jsfiddle.net/miguelrivero/2bzul/10/ thanks! the first reason } have syntax error. second reason[s] there errors: refused execu...

javascript - How to use one single Prototype-Instance throughout multiple HTML pages? -

i created javascript "classes" within own files using prototype function this: function playlist(id, name){ this.id = id; this.name = name; } playlist.prototype.getid = function(){return this.id;} playlist.prototype.getname = function(){return this.name;} i create instances of "class" this: var playlist = new playlist(); is there possible way can use 1 single instance throughout multiple html pages? tried this: "<a href='next.html?pl="+playlist+"'>next</a>" but gives me [object, object] can't anything. appreciate solutions. no, there no way pass javascript function instances on http. json not serializes properties , not methods. can serialize function declarations , recreate them via eval , evil , not want anyway. two possible solutions are: keep on single page. single page apps popular. load need load asynchronously , still have access playlist instance on page. pass propert...

java - sqlite4java no such table error by attaching another database -

i'm using sqlite4java handle sqlite db. want copy table database dbtest. found code here on stackoverflow. error. first of open connection new created database , afterwards attach other database following command: attach database database database; this works fine. dbtest has been opended earliere new database. want copy tables: hence, table created , same in other database. insert dbtest.routing (id, source, destination, metadata, zone_src, zone_dst,cost) select * database.routing; but after executing error: com.almworks.sqlite4java.sqliteexception: [1] db[1] exec() no such table: dbtest.routing i tried sqlite studio , there working without problems, cannot attach database there (this done automatically). have use notation use 2 databases? edit : use answer cl. leads new issue: com.almworks.sqlite4java.sqliteexception: [1] db[1] exec() no such table: second.routing what did change? attach database database second; //new name database file...

PHP strange behavior.Different outcome on server and localhost -

i ran weird trouble php.i have script checks folder articles ( , similar script checks folder images ) , based on creates article menu ( or gallery) on localhost works fine , , finds files , handles them expected. on real server though , both scripts break unexpectedly after few files. image check script this function gallerylist() { echo ' <div class="gallerygrid"> <ul>'; error_reporting(e_all); $thumbs = array_diff(scandir('images/thumbs'),array ('..','.','thumbs.db')); foreach ($thumbs $key => $current) { $imagelist[filectime('images/thumbs/'.$current)] = $current; } krsort($imagelist); foreach ($imagelist $key => $thumb) { $fullimage = substr($thumb,6); echo '<li><a href="images/'.$fullimage.'"><img src="images/thumbs/'.$thumb.'"> </a> </li>'.php_eol; ...

c# - Gridview Format Field as Phone Number but some results are 4 digit extensions, how to handle? -

so displaying results sql table in gridview. fields phone numbers. specific field may normal 10 digit number, might 4 digit extension. if it's 4 digit number, want @ minimum not put 10 digit formatting on it, @ max i'd prepend , ext: followed data. here have far. not programmer visual studio wizards , google results cobbled together. assistance. <form id="form1" runat="server"> <div> <asp:gridview id="gridview1" runat="server" datasourceid="sqldatasource1" autogeneratecolumns="false"> <columns> <asp:templatefield headertext="call destination" sortexpression="calldestination"> <edititemtemplate> <asp:textbox id="textbox2" runat="server" text='<%# bind("calldestination") %>'></asp:textbox> </edititemtemplate> ...

php - get the current k2 item ID -

i want current item id k2 , store cookie. ( of course when wrote "the current item" in item view of k2 template.) how can item id k2? i tried $this->item->id seems it's not working. any ideas? thanks! $k2itemid = jrequest::getint('id'); $db = jfactory::getdbo(); $db->setquery("select title #__k2_items id = ".$k2itemid ); $k2catid = $db->loadresult(); echo $k2catid;

How can I kill regular part in perl -

i have lot of following regular part in file want kill word between test1 , test2 how can in perl? test1 xxx xxx xxx test2 ggg test1 xxx xxx test2 ggg use flip-flop operator: $ perl -ne 'print unless /^test1$/ .. /^test2/' <<'end' test1 xxx xxx xxx test2 ggg test1 xxx xxx test2 ggg end output: ggg ggg

c# - Resolving generics in Windsor Castle -

i'm trying resolve object inherits template class using system; using controller; namespace controller { public interface icontrollerbase<t> t:iviewbase { } public class controllerbase { public string modulename { get; set; } } public class controllerbase<t> : controllerbase, icontrollerbase<t> t : iviewbase { public virtual t view { get; set; } public controllerbase (t instance) { view = instance; } } } icontrollerbase added recently, match strategy: container.register (component.for(typeof(icontrollerbase<iviewbase>)).implementedby(typeof(controllerbase<iviewbase>)).lifestyle.transient); next have class derrived controllerbase using system; namespace hardwareconnections { public class hardwareconnectionscontroller : controller.controllerbase<ihardwa...

Emacs and Helm - How to not show 'buffer-history' when i do 'kill-buffer' -

Image
i use helm , , every time c-x k ( kill-buffer ) shows "kill-buffer history" @ top. is there way show "kill-buffer" section? don't use "kill-buffer history" @ all. also, emacs froze couple of times when tried kill buffer! don't want section more :-) configuration-wise, have: (helm-mode 1) nothing else. thank much! use projectile package provides various list buffers should based on a)major-mode, b)derived mode, c)only project files, d) test files. etc... if want use please try emacs prelude(better preconfigured) https://github.com/bbatsov/prelude .

php - make certain pages expire after specific time and redirect to home page -

for example have url mysite.com/page1-bla-bla.html that have time specific content available specific time period after url should redirect home page. i think solution problem found today when checked google webmaster account today , found have many crawl errors due 500 internal server error pages content has expired content in kind of pages time limited available specific time. i have no idea how may htaccess solution or what? looking ideas usually, it's being done programmatically in php script, let have more control on data , logic. if want in .htaccess, check out article on time-related usage of mod_rewrite: http://www.askapache.com/htaccess/time_hour-rewritecond-time.html .

python - Making an overridden abstract method in a subclass "private" -

say have abstract base class, , subclass abstract: class daemon(object):: __metaclass__ = abc.abcmeta def __init__(self, pid_file): ... @abc.abstractmethod def run(self): return class worker(daemon): __metaclass__ = abc.abcmeta def __init__(self): ... def run(self): # stuff self.process() @abc.abstractmethod def process(self): """ override method when subclassing worker. """ return when other developers build new actual "working" worker sub-classes, i'd make clear shouldn't mess run method. if use __run hints method private, i'm creating private abstract method in daemon , bit confusing. seems odd have protected using _run because don't want worker sub-classes mess it. realize private , protected names useful conventions in python, want make clear others how build new worker sub-classes. is there pythonic ...

ios - Progress bar with image -

Image
i trying make progress bar 2 images. 1 of them grey , other picture green. when click button, want progress it, not working. here code ( progressgreen , progressgrey uiimageview s): - (ibaction)nextbutton:(id)sender { self.progressgreen.tag = rownumber; // giving number [self progess]; } -(void) progess { cgrect rect = self.progressgrey.frame; rect.size.width = (rect.size.width * (self.progressgreen.tag)) / questions.count; self.progressgreen.frame = rect; } what mistake? use progressimage , trackimage properties on uiprogressview . easier doing manually.

c# - Insert JavaScript array into database table -

the following script creates person object , inserts values sql server database $(document).ready(function () { var person = {}; person.firstname = "bill"; person.lastname = "wilson"; $('#button').click(function () { var sender = json.stringify({ 'p': person }); $.ajax( { type: "post", url: "getdrugquiz.asmx/insertperson", contenttype: "application/json; charset=utf-8", datatype: "json", data: sender, success: function (data) { console.log(data.d); }, error: function (xhr, ajaxoptions, thrownerror) { console.log(xhr.status); ...