Posts

Showing posts from May, 2011

sql - Recurring date table -

i got table lot of scheduled events. want create datawarehouse table coming events setup table. how next week? events starts every 5 min, hourly, 3-hourly, daily , so. example table event_name, last_run, next_time, intervallroundup5min job1, 2015-06-10 14:48:03.147, 2015-06-10 14:49:00.000 , 5 job2, 2015-06-10 12:27:09.637, 2015-06-10 15:25:00.000, 180 if rdbms supports recursive ctes, this: with futurecte ( select event_name, dateadd(mi,intervallroundup5min,next_time) nexttime ,intervallroundup5min table1 union select event_name, dateadd(mi,intervallroundup5min,nexttime) ,intervallroundup5min futurecte dateadd(mi,intervallroundup5min,nexttime) <= '2015-06-11' --end date ) select event_name, nexttime futurecte modify end date whatever value want. sql fiddle

php - MySQL difficulties with AS combined with HAVING -

i have as-related mysql question, when combined having: this does work (mind "(250) as", second line): select a.uid, a.name, a.height, a.width, (250) squaresize tx_fach_domain_model_professional a, tx_fach_domain_model_category b, tx_fach_professional_category_mm mm mm.uid_local = a.uid , mm.uid_foreign = 2 having squaresize > 20 order squaresize limit 0 , 4; this not work: select a.uid, a.name, a.height, a.width, (a.height * a.width) squaresize tx_fach_domain_model_professional a, tx_fach_domain_model_category b, tx_fach_professional_category_mm mm mm.uid_local = a.uid , mm.uid_foreign = 2 having squaresize > 20 order squaresize limit 0 , 4; the strange thing doesn't give me errors returns 4 of same rows/records, instead of 4 different ones. pretty clueless here.. above simplified version of real problem.. have (200) in example above, i'm trying measure distance value between longitude , latitude values: select a.uid, a.name, a.latitute, ...

javascript - JS Code didn't work, trying do a demo in css lessons -

but there's demo uses js , css. have been trying fix 3-4 hours. (fyi after 2 hours struggling have found half of solution. i'm using safari , should -webkit-transform ) have tried css added directly element , worked, doesn't worked using js. i have download jquery-1.11.3.js , import it. the lesson i'm watching (on 3:45:55) and when click nothing happened. why!? login.html <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <link rel='stylesheet' type="text/css" href='logincss.css' /> </head> <body> <div id="banner">please login!</div> <form> <div> <label for="name">name:</label> <input type="text" name="name" /> </div> <div> <label for="email">email:</label> ...

android - Achieve different text sizes of RadioButton programmatically -

i'm using different sizes of text different screen resolutions. this, created resource values/dimens.xml , values-sw720dp/dimens.xml . not understand how use values dimens.xml when creating radiobutton programmatically? radiobutton newradiobutton = new radiobutton(this); newradiobutton.settextsize(30); //how use values dimens.xml? newradiobutton.settextcolor(color.parsecolor("#002060")); radiogroup.addview(newradiobutton, layoutparams); getresources().getdimension(r.dimen.test)

rust - Rustc/LLVM generates faulty code for aarch64 with opt-level=0 -

i have 2 files assembled/compiled/linked minimalistic kernel. start.s: .set cpacr_el1_fpen, 0b11 << 20 .set boot_stack_size, 8 * 1024 .global __boot_stack .global __start .global __halt .bss .align 16 __boot_stack: .fill boot_stack_size .text __start: /* disable fp , simd traps */ mov x0, #cpacr_el1_fpen msr cpacr_el1, x0 /* set stack */ adr x0, __boot_stack add sp, x0, #boot_stack_size /* call rust entry point */ bl __boot __halt: /* halt cpu */ wfi b __halt boot.rs: #[no_mangle] pub extern fn __boot() { unsafe { let ptr = 0x9000000 *mut u8; *ptr = '!' u8; } } for opt-level=3 resulting code outputs single '!' serial port (as intended). opt-level=0 have strange infinite loop (e.g. '!!!!!!!!!....'). here disassembled dump of problematic code: 0000000000000000 <__kernel_begin>: 0: d2a00600 mov x0, #0x300000 ...

Rails select and concatenate subset of columns -

i have following activerecord row: #<location id: 1, name: "test center", description: nil, address: "some road along way", city: "porto", country: "pt", latitude: nil, longitude: nil, created_at: "2015-06-05 19:03:04", updated_at: "2015-06-05 19:03:04"> what need end this: some road along way,porto,pt which coma seperated list of address , city , country . i tried call select , turn hash first, no avail, ideas? there several solutions many variations this. here two: 1. put them in array , join it: [location.address, location.city, location.country].join(',') 2. use string interpolation: "#{location.address},#{location.city},#{location.country}" you can wrap them in method in model or create rails helper. in model: class location < activerecord::base # other code here def description [address, city, country].join(',') end end helper metho...

java - Getting nullpointer exception in the last node of singlylinked list -

Image
public class node { public string name; public node next; public node(string name, node next ){ this.name = name; this.next = next; } public string getname(){ return name; } public void setname(string n){ name = n; } public node getnext(){ return next; } public void setnext(node n){ next = n; } public string tostring() { return "name " + name; } } public class linkedlist { node head = null; int nodecount= 0; int counter = 0; linkedlist(){ head = null; } public boolean isempty(){ return (head != null); } public void insertnode( string name ){ if( head == null){ head = new node(name, null); nodecount++; }else{ node temp = new node(name, null); temp.next = head; head = temp; nodecount++; } } public nod...

html - How to implement D3 hierarchy view -

i trying make hierarchy table, in want show tree-structure of d3js.org, not showing. can of me in solving problem. i using code : index.html , readme.json https://gist.github.com/mbostock/1062288 link. but using these 2 files , same code given in link, unable see hierarchy. https://gist.github.com/mbostock/1062288 . // readme.json { "name": "flare", "children": [ { "name": "analytics", "children": [ { "name": "cluster", "children": [ {"name": "agglomerativecluster", "size": 3938}, {"name": "communitystructure", "size": 3812}, {"name": "hierarchicalcluster", "size": 6714}, {"name": "mergeedge", "size": 743} ] }, { "name": "graph", "children":...

javascript - HTML5 Canvas circle palette need custom size -

i have palette static size need made smaller or bigger, can anybode me try found can change values, bad result bad. shorter version, full version is: https://github.com/nilium/harmony /* palette.js */ function palette() { var canvas, context, offsetx, offsety, radius = 90, count = 1080, onedivcount = 1 / count, countdiv360 = count / 360, degreestoradians = math.pi / 180, i, angle, angle_cos, angle_sin, gradient; canvas = document.createelement("canvas"); canvas.width = 250; canvas.height = 250; offsetx = canvas.width / 2; offsety = canvas.height / 2; context = canvas.getcontext("2d"); context.linewidth = 1; // http://www.boostworthy.com/blog/?p=226 for(i = 0; < count; i++) { angle = / countdiv360 * degreestoradians; angle_cos = math.cos(angle); angle_sin = math.sin(angle); context.strokestyle = "hsl(" + math.floor( (i * onedivcoun...

ruby - Searching a list of similar elements for a given value -

i have xml this: <team ...some attributes...> <name>my team</name> <player uid="player1"> <name>name</name> <position>goalkeeper</position> <stat type="first_name">name</stat> <stat type="last_name">last</stat> <stat type="birth_date">bday</stat> <stat type="birth_place">bplace</stat> <stat type="weight">84</stat> <stat type="height">183</stat> <stat type="jersey_num">1</stat> </player> <player uid="player2"> ... </player> ... </team> i want search players jersey_num . i'm using nokogiri , code gets me sort of close: feed.xpath("/team[@uid='#{team_uid}']//player/stat[@type='jersey_num']") that returns players in given team, , array of jersey number at...

java - why does buckminster not resolve my passed JVM argument? -

i have jenkins job uses buckminster build eclipse product. at beginning have "extended choice parameter" "customer" key can selected. in buckminster configuration use "customer" variable select right cquery: import '${workspace}/source/scodi-customer/${customer}/server/features/ch.scodi.${customer}.server.feature/site.cquery' since variable "customer" per default not available in commands, added following "jvm arguments": -dcustomer=${customer} this used work well, updated server , build environment java 1.7 32-bit java 1.8 64-bit. since following error trying build: java.io.filenotfoundexception: [path job]\source\scodi-customer\${customer}\server\features\ch.scodi.${customer}.server.feature\site.cquery (the system cannot find path specified) before variable resolved fine. buckminster or java8 problem, not being able resolve ${customer} variable? there maybe (cleaner) way pass variable buckmins...

linux - xattr/extended attributes not settable for file in /tmp while in $home on same mount works fine -

i playing extended file attributes under linux/fedora , stumbling bit since cannot add/change attributes files in /tmp while in home working fine - while both paths on same mount point, i.e., /dev/mapper/fedora-root on / type ext4 (rw,relatime,seclabel,data=ordered) for example, can successful add , retrieve attribute files in home directory, e.g., > setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 ~/foo.bar > getfattr -n user.test.md5 ~/foo.bar # file: foo.bar user.test.md5="58d8e4cd0e60facf386838cbe8b11767" however, same fails same file in /tmp . > cp ~/foo.bar /tmp/foo.bar > setfattr -n user.test.md5 -v 58d8e4cd0e60facf386838cbe8b11767 /tmp/foo.bar setfattr: /tmp/foo.bar: operation not supported i assumed, support extended attributes depends on filesystem mounted 'correctly' xattr support. however, seems directory(??) dependent , wonder, prevents me setting extended attributes in /tmp , how can change it? (it seems ...

android - Why native camera rotating after saving captured image -

i launch native android camera , save image @ specified location. problem after click capture photo, preview comes options save/discard. after click save, native camera rotates in landscape , image captured not displayed. intent intent = new intent(mediastore.action_image_capture); intent.setpackage(defaultcamera); file f = new file(android.os.environment.getexternalstoragedirectory(), "temp.jpg"); intent.putextra(mediastore.extra_output, uri.fromfile(f)); startactivityforresult(intent, 1); it because activity recreated therefore data not there anymore. cannot control whether happen or not. capture picture onactivityresult? if so, try saving path in retained fragment.

Simple and clean java float to string conversion -

this simple question, i'm amazed on how difficult has been answer. documentation didn't give clear , straight answer. you see, i'm trying convert simple float string such result has 1 decimal digit. example: string myfloatstring = ""; float myfloat = 33.33; myfloatstring = float.tostring(myfloat); this indeed return "33.33". fine, except i'm looking way truncate decimal "33.3". needs impose decimal whenever whole number put in. if myfloat 10, example, need display "10.0". oddly not simple sounds. any advice can give me appreciated. edit #1: for moment, i'm not concerned digits left of decimal point. system.out.println(string.format("%.1g%n", 0.9425)); system.out.println(string.format("%.1g%n", 0.9525)); system.out.println(string.format( "%.1f", 10.9125)); returns: 0.9 1 10.9 use third example case

Issue with Google Maps toScreenLocation() method Android -

as title mentions, i'm having issues toscreenlocation() google maps. i'm trying pick arbitrary points on google maps broadcasting google maps fragment. within fragment, want screen point latlng coordinate corresponds with. however, of time error following: caused by: java.lang.illegalargumentexception: left == right @ android.opengl.matrix.frustumm(matrix.java:327) @ com.google.maps.api.android.lib6.gmm6.o.b.b.j(unknown source) @ com.google.maps.api.android.lib6.gmm6.o.b.b.l(unknown source) @ com.google.maps.api.android.lib6.gmm6.o.b.b.a(unknown source) @ com.google.maps.api.android.lib6.gmm6.o.b.b.c(unknown source) @ com.google.maps.api.android.lib6.gmm6.c.y.a(unknown source) @ com.google.maps.api.android.lib6.c.az.a(unknown source) @ com.google.android.gms.maps.internal.ca.ontransact(sourcefile:74) @ android.os.binder.transact(binder.java:380) @ com.google.android.gms.maps.internal.iprojec...

python - 'NoneType' object has no attribute 'kill_cursors' when nltk is imported -

if use pymongo cursor , have nltk package imported, error. i'm not sure if bug, or if can fix somehow: exception ignored in: <bound method cursor.__del__ of <pymongo.cursor.cursor object @ 0x054d0210>> traceback (most recent call last): file "c:\python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor.py", line 211, in __del__ file "c:\python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor.py", line 271, in __die file "c:\python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\mongo_client.py", line 833, in close_cursor file "c:\python34\lib\site-packages\pymongo-3.0.2-py3.4-win32.egg\pymongo\cursor_manager.py", line 56, in close attributeerror: 'nonetype' object has no attribute 'kill_cursors' i'm using python 3.4 , pymongo 3.0.2 , , nltk 3.0.2 . here simple script can use reproduce error: from pymongo import mongoclient import nltk client = mongo...

sqlite - Questions about create table and transaction in sqlite3 of python -

i'm learning use sqlite in python sqlite3. the sql operations insert, update support support transaction , commit() should called before close connection, or nothing change in database. however, 'create table' not support transaction, or create table auto committed. example, con.execute('create table xxx (xxxx)') the table created instantly. what's more, if execute insert statement before creating table, without commit(). execute create table, insert committed, 'create table'. i found nothing mentioned such behavior in document https://docs.python.org/2/library/sqlite3.html#sqlite3-types , https://www.python.org/dev/peps/pep-0249/#id3 or https://sqlite.org/atomiccommit.html . my question is: 1. there other operations behave this? 2. other dbms behave? 3. there specification this? this behaviour comes neither sqlite (commands create table work inside transactions) nor python; it's python sqlite3 module tries clever , inserts ...

Julia: Enforce constraints on objects in a container? -

i rather new julia; programming typically in c++, python, or fortran numerics. understanding julia lacks analogous c++'s private variables (or python's "i suggest treat private" convention of using leading underscore). if have container, there way enforce constraints on objects add container? consider example: let's want array of integers, , constraint integers in array must share greatest common factor greater one. if put 12 array, number that's multiple of 2 or 3 may added. next add 21, , greatest common factor must 3. if try add 26, error because violates constraint. had added 12 26, legal greatest common factor of 2. i realize it's bit of contrived example, should have salient features of hope do, , requires less explanation. true enforcement possible immutable types, can check desired constraints in inner constructor(s). outside type definition there no way add new inner constructors, , if there 1 cannot create instance without...

Ansible git clone 'Permission Denied' but direct git clone working -

i got troubling issue ansible. setup git cloning on environment using ssh key of current host: - name: add user public key copy: src: "/users/alexgrs/.ssh/id_rsa.pub" dest: "/home/vagrant/.ssh/id_rsa.pub" mode: 0644 - name: add user private key copy: src: "/users/alexgrs/.ssh/id_rsa" dest: "/home/vagrant/.ssh/id_rsa" mode: 0600 - name: clone repository git: repo: repo.git dest: /home/vagrant/workspace/ update: true accept_hostkey: true key_file: "/home/vagrant/.ssh/id_rsa.pub" if vagrant ssh on vagrant , execute git pull repo it works. when vagrant provision got following error message: stderr: permission denied (publickey). fatal: not read remote repository. please make sure have correct access rights , repository exists. i'm pretty sure publickey not used vangrant provision i'm not able detect why. did see kind of issue ? thank you. edit: seems an...

ios - Segue animation doesn't align screen correctly -

Image
this how should like, filling screen fully: and how looks when transition via a segue that's set present modally , using custom animation( http://www.appcoda.com/custom-view-controller-transitions-tutorial/ ):

jQuery ajax() success data - retrieving object results from Python server -

i trying display success data after jquery ajax function python server (gae). able make work single string or number success data, relay several pieces of info server in ajax call. thinking best way store data in python object , send object in callback. object showing "", object properties "undefined". advice can give appreciated- javascript: $.ajax({ type: "post", url: "/update_cart", data: {'item1': item1, 'item2': item2, 'item3': item3}, //datatype: 'jsonp', success: function(data) { $("#amount").val(data.total); $("#shopping_cart_count").text(data.cart_item_count); alert(data); //displays "<main.ajaxobject object @ 0x042c8890>" alert(data.cart_item_count); //displays "undefined" ...

Configure httpd.conf to add new site on Apache Red Hat Linux -

Image
i have linux server (red hat enterprise linux server release 5.3 (tikanga)) apache installed. used browsing documents. add new directory (with html page), whenever directory browsed can display html page. but not sure of edit httpd.conf file existing httpd.conf: when hit url " http://servername/eng " displays list of folders. now, want add website existing, when user hit url " http://servername/builds " should display html page in browser.i have added "index.html" page in location "/var/www/html/builds/" for added below code httpd.conf file please let me know modifications required in conf file you can in few different ways. putting index.html in /build this requires have setting: directoryindex index.html (it should there default on platform.) also work, rather putting new <directory> , should put build/ directory in directory holds http://example.com/ files. instance: /var/www/example.com/public...

Getting javascript variable in Scala -

i'm trying use varible javascript in scala array. need objects list. entrytype scala list. var options = ""; (t = 0 ; t < @entrytypes.size(); t++) { @defining('t') { => alert(@i) options += "<option value='0'selected='selected'>@entrytypes(i).title</option>"; } } the thing can't access t, if try put @defining(t' { i=> not scala variable. should do? try this: var options = ""; var entrytypes = @{html(json.stringify(json.tojson(entrytypes)))}; (t = 0 ; t < entrytypes.length; t++) { alert(t); options += "<option value='0'selected='selected'>" + entrytypes[t] + "</option>"; } }

html - How do i echo selected options from a loop of questions with php -

i have loop echo questions database form predetermined answers in select option yes, no, not sure. user can answer amount of question except @ least 1 question must answered. how echo question(s) , corresponding selected answer user on submitting form. here retrieve questions dbase <form method="post" action=""> <?php $sql = 'select starttime, country,league, home, away,gamecode games starttime > date_format(now(),"%d/%m/%y %h:%i") order starttime' ; $retval = mysql_query($sql); if(! $retval ) { die('could not games date selected: ' . mysql_error()); } while($row = mysql_fetch_array($retval, mysql_assoc)) { here echo question user echo "{$row['country']} | {$row['league']} | time:{$row['starttime']} <br> ". "<div align='center'><span class='style3'>{$row['home']} vs "....

OneDrive direct download URLs for files and file versions -

i putting question in 2 lines does onedrive supports direct download urls files? urls returned onedrive same mobile , web ? onedrive returns file versions via rest api calls ? read below more details. i building standalone app uses various onedrive rest apis different operations, e.g. upload/download/update/browse document/folder. have following needs not able accomplish based on readings onedrive rest api support page https://msdn.microsoft.com/en-us/library/office/dn659752.aspx . direct download urls: want give user of app facility directly downloading file. know 'link' property of file object gives direct view url takes user onedrive account , there user can download file clicking download button. need link direct download of file (such link when typed in browser has authenticated onedrive session should directly prompt download box.) are direct view/download link different browser , mobile cients? versions: how version numbers files programmatically. not s...

MOQ unit Testing for C# .NET basic CRUD Controller Routing -

i trying set basic moq testing crud routes controller. our application small , want establish basic testing first before move more advance testing (using fakes , not). this current test page: [testclass()] public class adminnotestest { [testmethod] public void creatingonenote() { var request = new mock<httprequestbase>(); request.setup(r => r.httpmethod).returns("post"); var mockhttpcontext = new mock<httpcontextbase>(); mockhttpcontext.setup(c => c.request).returns(request.object); var controllercontext = new controllercontext(mockhttpcontext.object, new routedata(), new mock<controllerbase>().object); var adminnotecontroller = new adminnotescontroller(); adminnotecontroller.controllercontext = controllercontext; var result = adminnotecontroller.create("89df3f2a-0c65-4552-906a-08bceabb1198"); ...

javascript - DropDownList Change() doesn't seem to fire -

so, have been bashing head against desk day now. know may simple question, answer eluding me. help? i have dropdownlist on modal built partial view. need handle .change() on dropdownlist, pass selected text dropdownlist method in controller give me data use in listbox. below code snippets research led me to. all other controls on modal function perfectly. can see going wrong or maybe point me in right direction? processcontroller // have tried [httpget], [httppost], , no attribute public actionresult regionfilter(string regionname) { // breakpoint here never hit var data = new list<object>(); var result = new jsonresult(); var vm = new propertymodel(); vm.getproperties(); var propfilter = (from p in vm.properties p.region == regionname && p.class == "comparable" select p).tolist(); var listitems = propfilter.todictionary(prop => prop.id, prop => prop.name); data.a...

html - Three extra pixels at the bottom of the page unaccounted for and not sure how to get rid of them? -

i'm working on building responsive website , have run issue where, upon scrolling, there looks 2 or 3 pixels @ bottom of page beyond content. i'm not sure they're coming or how rid of them. appear inside of overall container outside of header , content blocks. i'm assuming it's kind of margin issue? any assistance appreciated! js fiddle here: http://jsfiddle.net/bramvanroy/toxk8lde/1/ html <div id="container"> <div id="header"> <div id="headerleft"> <div id="logo"> <img src="http://mbeach.me/arch/images/layout/logo_100.png" alt="miles arch logo" id="miles_arch_logo" /> </div> <div id="companyname"> <span id="miles_arch">miles architecture group</span> </div> </div> <div id="headerright...

excel - VBA - Search for cell, grab contents to the right of cell -

i have working macro loops through folder open files , important info columns of names "holder" , "cutting tool" , printing info 1 excel document, masterfile. prints file name column 1 , name of "tooling data sheet" column 4. have set printing cell j1. this works of time information not in j1. want search header "tooling data sheet (tds):" have done "holder" , "cutting tool" grab contents in one cell right of header , print masterfile (as works instead of printing j1, print cell right of header). ideas? the information "tooling data sheet" printed in second half of section (5). major commented out sections in code have been attempts @ solving issue. full code option explicit sub loopthroughdirectory() const row_header long = 10 dim objfso object dim objfolder object dim objfile object dim myfolder string dim startsht worksheet, ws worksheet dim wb workbook dim integer ...