Posts

Showing posts from July, 2012

neo4j - How to retrieve the nodes with multiple relationships using cypher query -

can 1 please me on this. i using cypher query nodes having relationship either 'hive' or 'hadoop' , able nodes. but when try nodes having relationship both 'hive' , 'hadoop' not able nodes. this query using start n=node(*) match (n)-[r]-() type(r)="hadoop" , type(r)="hive" return n,count(n); this query returns 0 rows. is query wrong or need other way. thanks in advance. gouse this should it: start n=node(*) match ()-[:hadoop]-(n)-[:hive]-() return n,count(n)

c# - How to dispose of a PrivateFontCollection correctly? -

i'm using privatefontcollection install uploaded fonts on web server. code below works, on second upload of font privatefontcollection references first font uploaded. isn't being disposed of correctly. spot i'm doing wrong? var fontname = string.empty; using (var ms = new memorystream(fontbytes)) { // used store our font , make available in our app using (var pfc = new privatefontcollection()) { //create memory pointer intptr data = marshal.alloccotaskmem((int)ms.length); try { //copy bytes unsafe memory block marshal.copy(fontbytes, 0, data, (int)ms.length); // have register font system (weird .net bug !) uint cfonts = 0; addfontmemresourceex(data, (uint)fontbytes.length, intptr.zero, ref cfonts); //pass font font collection pfc.addmemoryfont(data, (int)ms.length); ...

jQuery: Handle multiple JSON data -

my code: $.ajax({ url: 'online.php', success: function(data) { var useronline = $.parsejson(data); $('#usersonline').append($('<div id="usersonlineuser">').text(useronline['username']).append($('<span class="badge">').text('aktiv'))); } }); json: {"username":"aarivex","active":"1"} it works fine. how can handle multiple json data, like {"username":"aarivex","active":"1"}{"username":"aarivex2","active":"1"} ? if assume data is: var data = [{"username":"aarivex","active":"1"}, {"username":"aarivex2","active":"1"}]; your success function becomes: success: function(data) { $.each(data, function(index, element) { $('#usersonline').append($...

Python tabular problems -

i have been trying question while code keep running without returning implement following function fahrenheit return fahrenheit equivalent of celsius temperature.f = 9/5c + 32 : use function write program prints chart showing fahrenheit equivalents of celsius temperatures 0–100 degrees. use 1 position of precision right of decimal point results. print outputs in neat tabular format minimizes number of lines of output while remaining readable here code def temp_check(c): f = 0 c in range(0, 101): f = (9/5) * c +32 print "celsius %3.1f c" %"fahriant f" print " %3.1f c" % f(c, f) you need call temp_check function adding line after (no indentation): temp_check(none) the value passed temp_check doesn't matter here, since you're overwriting anyway.

php - joomla: adding a select.optgroup to select.genericlist -

i need add select.optgroup select.genericlist, code: foreach ($this->methods $method) { if ($this->checkconditions($cart, $method, $cart->pricesunformatted)) { $methodsalesprice = $this->calculatesalesprice($cart, $method, $cart->pricesunformatted); $method->$method_name = $this->renderpluginname($method); $session = jfactory::getsession(); $htmli[] = $this->getpluginhtml($method, $selected, $methodsalesprice); // attempt $htmli[] = jhtml::_('select.optgroup', 'my optgroup'); // attempt ends here $htmli[] = jhtml::_('select.genericlist', $this->banks, 'service_issuer', 'size=1', 'key', 'value', $session->get('service_issuer', 0, 'vm')); $html[] = $htmli; } } this returns following: array has done before? advice appreciated i've ...

visual studio 2013 - Interop assembly not found in F# solution -

f# newbie here, spent many painful hours trying resolve errors simple piece of code msdn f# tutorial. #r "microsoft.office.interop.excel.dll" // fails invalid/not found errors #r "microsoft.office.interop.excel" // works charm. any f# gurus know why? "microsoft.office.interop.excel.dll" name of file (inferred, because of .dll suffix). when supply file name, #r file in file system. since didn't supply path, it'll in present working directory. likely, "microsoft.office.interop.excel.dll" isn't in working directory. explains why first example fails. "microsoft.office.interop.excel" , on other hand, inferred name of assembly (because there's no file extension). assemblies libraries, , distributed in .dll files. don't have to, though; can, example, dynamically emitted @ run-time. additionally, .dll file can technically contain more single assembly, although i've never seen in wild. normal ...

Agent not reading /etc/sysconfig/puppet server= -

we have several servers working puppet agents today, i'm having problem new server running centos 7. update /etc/sysconfig/puppet file puppet master name , start daemon , move signing certificate on master. however, puppet agent doesn't appear reading server = myhost.domain in config file. following error in /var/log/messages : puppet-agent[11133]: not request certificate: getaddrinfo: name or service not known i tried: myserver:root$ puppet agent --configprint server puppet myserver:root$ but /etc/sysconfig/puppet file has: puppet_server=myserver.domain.com can please me understand why puppet agent doesn't server config file? the /etc/sysconfig/puppet file not typically read puppet agent. (i'm not familiar centos operations, suppose location might hold settings external process, such environment, command line switches etc.) you want use proper puppet configuration file: /etc/puppet/puppet.conf puppet 3.x , earlier /etc/puppetl...

Is it possible to print page number on Report header in Crystal Report -

i have latest version of crystal report (2012 ? believe) , inserting crosstab in report header summary. printing fine , correctly except page number in page footer (actual whole page footer page number defined in) not print. if crosstab has lot of data , runs on multiple pages, page footer not print either until report header section has finished. for example, if cross tab section run on 2 pages, footer print starting page 3 , onward. page numbering correct footer not print on report header only. there way make crystal report print out footer in report header section? think can put cross tab in report header section want print once. putting in page header make print each time there new page.

python - Dataset that holds a list of pre-defined classes for each observation - in R -

i'm new r , need keep dataset contains each observation (let's - user) list of classes (let's events). example - each user_id hold list of events, every event class contains fields: name, time, type. my question - optimal way hold such data in r? have several millions of such observations need hold in optimal manner (in terms of space). in addition, after decide how hold it, need create within python, original data in python dict. best way it? thanks! you can save dict .csv using csv module python. mydict = {"a":1, "b":2, "c":3} open("test.csv", "wb") myfile: w = csv.writer(myfile) w.writerows(mydict.items()) then load r read.csv . of course, depending on python dict looks like, may need more post processing, without reproducible example it's hard be.

c++ - Use a QPixmap as OpenGL texture -

i writing qt code in c++, including openql graphics (qglwidget). i assign qpixmap texture opengl quad. possible ? use class qopengltexture in article youwill see short example.

vb.net - Observe List(Of) additions -

i have list (of customclass). somewhere within code, items added list although should not. code huge, can't debug occurs. therefore thinking of creating extension can break in when insert / add occurs when don't expect it. can tell me if possible, , if yes, how? i hope can somehow detect caller (the function) additions occur. thank you. i think have it: imports system.collections.objectmodel public class clscelllistextender public class list(of t) inherits collection(of t) private _iid integer = 0 protected overrides sub insertitem(index integer, item t) 'your checks here if typeof (item) clscell _iid += 1 dim ncell clscell = trycast(item, clscell) ncell.tempid = _iid end if mybase.insertitem(index, item) end sub end class end class i declare list clscelllistextender.list(of clscell).

r - Logarithmic mean of vector -

to follow exact methodology presented in article calculate logarithmic mean of data vector. did not find functions in r, or previous discussions. case 2 numbers clear, not work out efficient method calculate log mean large vector of numbers. suggestions? # calculating different types of means # data dat <- c(0.008845299, 0.040554701) # arithmetic mean arith.m <- mean(dat) # logarithmic mean # http://en.wikipedia.org/wiki/logarithmic_mean log.m <- (dat[1] - dat[2])/(log(dat[1])-log(dat[2])) # geometric mean # http://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in geo_mean <- function(data) { log_data <- log(data) gm <- exp(mean(log_data[is.finite(log_data)])) return(gm) } geo.m <- geo_mean(dat) # show arithmetic > logarithmic > geometric arith.m; log.m; geo.m # how calculate logarithmic mean vector? dat.n <- c(0.008845299, 0.040554701, 0.047645299, 0.036654701, 0.017345299, 0.018754701, 0.032954701, 0.043145299, 0.0...

html - Dygraph data not plotting in WIN7 and beyond? -

the hardware utilizing dygraph javascript embedded pic24fj64gb004 configured data logger , mass storage device, thumb drive. unplugged usb logs 9 axis of inertial data: accerleration, angular velocity, , magnetometer onto root drive .csv files. when plugged usb port batch file parses data text files location available .html display utilizing dygraph javascript. the system works ok within winxp sp3 fails display data in future versions of windows. utilizing f12 developer tools text files not formed within winxp, in windows 10 - f12 states following: dygraph-combined.js:2 xmlhttprequest cannot load file:///c:/users/cal/desktop/er9d0f/temp/graph/data/accelerate.txt. cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.dygraph.start_ @ dygraph-combined.js:2 dygraph-combined.js:2 xmlhttprequest cannot load file:///c:/users/cal/desktop/er9d0f/temp/graph/data/gyrate.txt. cross origin requests supported protocol sche...

powershell - Excluding a file while using Copy-Item -

i'm having few issues while copying desktop files part of process local folder server. my script automatically creates backup folder on server , realised when creates folder windows automatically creates desktop.ini file, , desktop.ini system file script failed write desktop.ini desktop backup folder in server. my initial code : copy-item ("$global:localbackuprestorelocation\desktop\$file") ("$global:remotebackuprestorepath\$nameofbackupdirectory") ($recursive="true") but use exclude in line , know exclude not work recursively , have use get-childitem . try this $exclude = @('desktop.ini') copy-item -path $source -destination $dest -exclude $exclude

c++11 - Read complex numbers (a+bi) from text file in C++ -

i want read array of complex numbers (in a+bi form). there several suggestions found on internet, methods result real part , while imaginary part 0 . , infact real part of next number imaginary of previous number. for example, have text file follow: 2+4i 1+5i 7+6i and here suggestion reading complex data int nrow = 3; std::complex<int> c; std::ifstream fin("test.txt"); std::string line; std::vector<std::complex<int> > vec; vec.reserve(nrow); while (std::getline(fin, line)) { std::stringstream stream(line); while (stream >> c) { vec.push_back(c); } } (int = 0; < nrow; i++){ cout << vec[i].real() << "\t" << vec[i].imag() << endl; } while (1); return 0; and output result is: 2 0 4 0 1 0 is there proper way read a+bi complex numbers text file? or have read data string, , process string extract , convert complex numer? thanks ! one option read separate...

Rails input form boolean -

i got problem make form can chose between true or false. in model ticket got: type:boolean when i'm making check_box in form got error msg: invalid single-table inheritance type: 1 not subclass of ticket my form code: <%= form_for [@movie, @seance, @ticket] |f| %> <div> <%= f.label :type %> <%= f.check_box :type %> <%end%> type reserved word in ruby-on-rails, used sti. change column name to, say, :ticket_type

Difference between tag cloud and Google Tag Manager? -

i liked tag cloud in technical webinar of google tag manager wasn't able find tags on webpage. need understand difference. different kinds of tags. "tag" "tag cloud" refers short single-word textual descriptions of content. instance, you've tagged question "google" "marketing" "tag-cloud" , "google-tag-manager". the "tag"s managed google tag manager html tags services google analytics or other services provide html need include in site work. the 2 have nothing 1 another, other word "tag" has many meanings.

c# - Why is my route-enabled HttpGet method viewed as not supporting GET? -

i have pair of , post web api methods work fine. have pair seem set exact same way, , yet method refuses accept calls. attempts end msg, " the requested resource not support http method 'get' ." yet (again) method set , decorated same working one. here working 1 (both unlabeled "get" (first method) , labeled "post" entered when called): [routeprefix("api/pricecompliance")] public class pricecompliancecontroller : apicontroller { [route("{unit}/{begindate}")] public httpresponsemessage get(string unit, string begindate) { . . . [route("{unit}/{begindate}")] [httppost] public void post(string unit, string begindate) { . . . ...and here pair seem identical (different name, of course, , 1 more parameter): [routeprefix("api/produceusage")] public class produceusagecontroller : apicontroller { [route("{unit}/{begindate}/{enddate}")] publ...

javascript recursive class: undefined method -

i have javascript class meant deal promises. first add functions array, executes them pops them , calls next one. @ end of array resolves promise. hope propagate resolution way stack of recursive calls. allow force multiple asynchronous functions run sequentially using simple set of commands. furthermore employ logic modify flow of ansync functions. function sequencer() { this.functionsequence = []; this.addfunction = function (func) { this.functionsequence.push(func); } this.getfunctionsequence = function () { return functionsequence; } this.executeall = function () { var functionlist = this.functionsequence; var deferred = $q.defer(); if (functionlist.length > 0) { functionlist[0]().then(function (result) { if (result) { functionlist.splice(0, 1); executeall().then(function (resultinner) { if (resultinner == true) {...

Using git for deployment with preexisting untracked code on production server -

so have production server code out of date , have remote git repository date code. what want of date code onto production server without deleting stuff uploads exist on server. what's best way this? have git init'ed on production server, added remote , done git fetch --all. need know next. after taking full backup, should safe cp -r git-dir/* production-dir/ copy on date content along .git . you'll want add dir's containing uploaded data .gitignore .

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -

i realize similar post others (e.g. this one ), there details missing posts might significant case. to start with, here's simplified program: #include "stdafx.h" #include <windows.h> #include <wincrypt.h> int _tmain(int argc, _tchar* argv[]) { // usage: certextract certpath char keyfile[] = "c:\\certificates\\public.crt"; byte lp[65536]; security_attributes sa; handle hkeyfile; dword bytes; pccert_context certcontext; sa.nlength = sizeof(sa); sa.lpsecuritydescriptor = null; sa.binherithandle = false; hkeyfile = createfile(keyfile, generic_read, file_share_read, &sa, open_existing, file_attribute_normal, null); if (hkeyfile) { if (readfile(hkeyfile, lp, getfilesize(hkeyfile, null), &bytes, null) && bytes > 0) { certcontext = certcreatecertificatecontext(x509_asn_encoding, lp, bytes); if (certcontext) { printf("yay...

jquery - Resize uploaded image to multiple dimensions -

i'm building own simple cms. here problem images. loading large size images slow down website. i'm here ask how resize image multiple dimensions example: image.jpg orginal size 1280x720pixels; thumbnail create image250x250.jpg ; inside post usage image500x350.jpg , on. using same image thumbnails, posts , on. i'm styling css. thanks , best regards! after user uploads image, you'll need create , retain multiple copies of image on server (one copy per desired size). imagemagick software commonly used such tasks. there many explanations online go more detail, in general you'll want install imagemagick on server, enable imagemagick php extension. after creating few copies of uploaded image, can use imagick::resizeimage function independently modify size of each one. if you're unable install php extension, can instead invoke imagemagick's convert command line utility via php's exec() function.

Converting two lists to type : List[List[scala.collection.immutable.Map[String,String]]] -

have 2 lists : val list1 : list[list[(string, string)]] = list(list("1" -> "a" , "1" -> "b")) //> list1 : list[list[(string, string)]] = list(list((1,a), (1,b))) val list2 : list[list[(string, string)]] = list(list("2" -> "a" , "2" -> "b")) //> list2 : list[list[(string, string)]] = list(list((2,a), (2,b))) //expecting val toconvert = list(list(map("1" -> "a" , "2" -> "b"), map("1" -> "b" , "2" -> "a"))) attempting convert these lists type : list[list[scala.collection.immutable.map[string,string]]] = lis //| t(list(map(1 -> a, 2 -> b), map(1 -> b, 2 -> a))) using code : val ll = list1.zip(list2).map(m => list(m._1.to...

Copying Data from split text into main data storage arrays is returning 'exception in thread "main" java.lang.NullPointerException -

Image
this question has answer here: what nullpointerexception, , how fix it? 12 answers this code example , seems working inputting data, when trying export input data output code returning error: "exception in thread "main" java.lang.nullpointerexception @ javaproject.main(javaproject.java:50)" i have included gyazo snapshot of how looks , error: import java.util.scanner; import java.io.filewriter; import java.io.ioexception; import java.util.arrays; public class javaproject { private static char[] input; @suppresswarnings("null") public static void main(string[] args) { int hrs, mins; int[] gamecount; int[] minutesplayed = null; string gamername, gamerreport; //main data storage arrays string[] gamenames = new string[100]; int[] highscores = new int[1...

javascript - .show() not working after the class has been hidden() -

so i'm trying show triggered click event after element has been hidden. can't life of me figure out why .show() not working. i've tried can think of. have right following: function hidearrows(index){ var hiddenid = parseint($(".queuelistdiv .track").first().attr("id"), 10); console.log("hiddenid = " + hiddenid + currentindex) if(index == hiddenid){ console.log("true son") $("#" + hiddenid + " .soundmove").hide(); $("#" + (hiddenid + 1) + " .fa-arrow-up").hide(); } } function showarrows(){ $(".queuelistdiv .track").each(function(){ var otherid = parseint($(this).attr("id")) if (otherid > 1){ $(this).attr(".queuelistdiv .track .soundmove .fa-arrow-up").show() } }) } the html looks this: <div id="queuelist" class="queuelistdiv col-md-4"> <div class='track' i...

list - Java Generics - Get and Put Principle exceptions -

i'm studying generics programming class, , while reading past examination papers, came across question: give example of wildcard definition might use when want items collection object? give wildcard definition might use when wish put items collection? exceptions in each case? i know extends wildcard (? extends t) should used 'get' values collection object , super wildcard (? super t) should used 'put' values collection object, exceptions?

loops - Why is my ASM (using Turbo Assembler) program looping infinitely? -

i tried make small program accepts 4 digit number. reason doesn't stop after entering 4th digit. this concept using. a 4 digit number example 1234 "1000+200+30+4" when enter 1234 in program happens: 1 bx = 0000 0000 0000 0000 2.1 bx = bx + 1000 3.1 bx = bx + 100 3.2 bx = bx + 100 4.1 bx = bx + 10 4.2 bx = bx + 10 4.3 bx = bx + 10 5.1 bx = bx + 1 5.2 bx = bx + 1 5.3 bx = bx + 1 5.4 bx = bx + 1 so bx = 0000 0000 0000 1234 following program goes infinite loop. can me out problem. ;===========macros========== ;-----input macros input_bcd_sub macro digit call common_inp_proc mov digit_place, digit call num_convertor endm input_bcd macro var xor bx,bx show t_msg2 input_bcd_sub 1000 input_bcd_sub 0100 input_bcd_sub 0010 input_bcd_sub 0001 mov var, bx xor bx,bx endm ;-----show macro show macro msg mov ah, 09h lea dx, msg int...

layout - R legend: placement and sizing of symbols and labels for barplots in base graphics -

i using layout create 15 panels: first 3 panels being titles followed 12 barplots using base r. want include legend multiple plots along title in 3rd panel. there 3 legend items in horizontal legend. i'm struggling resize , position these elements fit neatly , legibly under title. the default patch size large can find no way independently resize patch symbol , text ( pt.cex not work, because not using point symbol). using cex = 0.5 resize legend gives me patch size want text far small (i want text cex = 1). is there way resize symbols in legend independently of labels? # layout graphs in grid of 3 cols 5 rows final <- layout(matrix(c(1:15), 5, 3, byrow = true)) plot.new() text(0.5, 0.5, "direction of wind gusts", cex = 1.5) # cex rescales text plot.new() text(0.5, 0.5, "direction of extreme wind gusts", cex = 1.5) plot.new() text(0.5, 0.5, "direction of plants", cex = 1.5) # add legend below third title text legtext <- c("sh...

node.js - Mongorito: save(...).then is not a function -

i tried similar example given on readme.md file: var mongorito = require('mongorito'); var model = mongorito.model; mongorito.connect('mongodb://localhost:27017/cr-test'); class user extends model { collection() { return 'users'; } } var user1 = new user({ name: "james gosling", email: "user1@gmail.com", password: "changeme" }); user1.save().then(() => { console.log('user created'); }); when run node --harmony server.js error: user1.save().then(() => { ^ typeerror: user1.save(...).then not function @ object.<anonymous> (...\app\server.js:24:14) @ module._compile (module.js:398:26) @ object.module._extensions..js (module.js:405:10) @ module.load (module.js:344:32) @ function.module._load (module.js:301:12) @ function.module.runmain (module.js:430:10) @ startup (node.js:141:18) @ node.js:980:3 could explain me how fix that? the...

c - Parallelizing LibTomMath's Karatsuba impl. with OpenMP failed -

i thought i'll give openmp try before roll myself (it?) failed quite miserably. the karatsuba multiplying , squaring needed small change recurse instead of common multiplication branches in bn_mp_mul.c , addition of openmp pragmas. changes karatsuba multiplication diff (squaring done in same manner) libtommath master : diff -rtbbw libtommath-master-original/bn_mp_mul.c libtommath-master/bn_mp_mul.c 32a34,37 > #ifdef use_open_mp > #include <omp.h> > #pragma omp parallel > #pragma omp master 33a39,41 > #else > res = mp_karatsuba_mul(a, b, c); > #endif diff -rtbbw libtommath-master-original/bn_mp_karatsuba_mul.c libtommath-master/bn_mp_karatsuba_mul.c 51a52,54 > #ifdef use_open_mp > int e1,e2; > #endif 57c60,62 < --- > if (b < karatsuba_mul_cutoff) { > return mp_mul(a,b,c); > } 120c125,135 < if (mp_mul(&x0, &y0, &x0y0) != mp_okay) --- > #ifdef use_open_mp >...

c++ - How to erase elements from a vector based on a specific condition in c++11 -

i have vector of objects , want erase objects, without re-sorting. i found solutions here, these based on comparing vector element value. [ how erase value efficiently sorted vector? however, need erase based on conditional statement, don't think can use functions way are. in example, have vector of 3d vectors need remove elements have z value less 0; what have right vector created original one: for (int = 0; < original_vectors.size(); i++) if (original_vectors[i].z > 0) new_vectors.push_back(original_vectors[i]); what can drop elements don't have z > 0? you want erase-remove idiom , standard way remove elements stl container support condition. code snippet remove vector elements predicate returns true: vector.erase(std::remove_if(vector.begin(), vector.end(), predicate), vector.end()); a predicate checks if z < 0 is: auto predicate = [](const vec3 &v) { return v.z < 0; }

c# - Cant check if User is in a Role ASP.NET Identity 2.0 -

so i'm trying build off identitie's individual authentication system every check role of user returns false, here controller logging in redirect user if role check. var result = await signinmanager.passwordsigninasync(model.email, model.password, model.rememberme, shouldlockout: false); switch (result) { case signinstatus.success: var r = roles.isuserinrole( "trainer"); var y = user.isinrole("trainer"); return redirecttoaction("index", "home"); every time i've run both of these methods(vars r , y) return false. have enabled rolemanager with <rolemanager enabled="true" defaultprovider="aspnetwindowstokenroleprovider"/> , sure have role "trainer" since run make test user await usermanager.addtoroleasync(user.id, "trainer"); it looks mix microsoft.aspnet.identity system.web.security not working e...

javascript - increase maximum byte size of nodejs pipe -

i'm trying write little commander script proxies other scripts in project , i'm trying use node pipe stdout spawned process current process's stdout: function runcommand(command, arguments) { var commandprocess = childprocess.spawn(command, arguments); commandprocess.stdout.pipe(process.stdout); commandprocess.on("exit", process.exit); } this works fine until start getting large output sub processes (for example 1 of them maven command). i'm seeing prints out first 8192 bytes of stdout , stores rest until next "data" event. prints out next 8192 etc. means there's lag in output , @ times when we're running server process stops printing things out until trigger on server triggers "data" event. is there way increase size of buffer or avoid behavior? ideally commander script proxies our other scripts , should print out is. you using node process spawn asynchronously asynchronous give output when child proc...

c - Sum of the all the numbers between a and b -

i need create program gives sum of numbers between constants of a , b given user. b needs greater a . #include <stdio.h> void main() { int index, begno, endno, sum = 0; printf("program sum of numbers in given range\n"); printf("enter beg. no.: "); scanf("%d", &begno); printf("enter end. no.: "); scanf("%d", &endno); index = begno; for(; index <= endno; index ++) sum = sum + index; printf("the sum of numbers between %d , %d is: %d", begno, endno, sum); } the code given looks ok, if want sum without including last number, case should change loop this for(; index < endno; index ++)

mysql - How do I store the results of an SQL call in a php array -

i have been trying create sign form website , keep struggling trying check if user's username had been used else signed website in past. using mysql database store information , trying access past usernames through using php. specific part of code keeps returning error. $query = "select username users"; $records = mysql_query("select username users"); $result = mysql_query($records); $result_array = array(); while($row = mysql_fetch_assoc($result)) { $result_array[] = $row['username']; } the error messages receiving are: warning: mysql_query() expects parameter 1 string, resource given in ... warning: mysql_fetch_assoc() expects parameter 1 resource, null given in... thank much! the problem doing mysql_query twice 1 on $records variable , on resultlike so: $records = mysql_query("select username users"); $result = mysql_query($records); what need this: $records = "select username users";...

d3.js - c3js / highcharts multi series nested json chart with many data points -

i'm trying figure out whether possible generate c3js chart following json structure. [ { "name": "linetest1", "data": [ {"date": 1452049754,"value": 118}, {"date": 1452049759,"value": 120} ] }, { "name": "linetest2", "data": [ {"date": 1452049758,"value": 54}, {"date": 1452049759,"value": 59} ] } ] i've seen mentions in documentations of using xs or keys: chart options appear setting x , y axis specific key in flat data array although haven't been able find docs or examples / google related multi series nested json, or how handle that. with data above objective render 2 lines on chart. line 1 having title of linetest1 , line2 having title of linetest2. data points x axis line 1 use data.date timeseries , data.y value. is possible? if not there better way this? if p...

onejar - Using resource in kotlin func - does not work with fat jar (one jar) -

i have following piece of code: fun main(args: array<string>) { val urlforcsr: url = classloader.getsystemclassloader().getresource("merchant.id") // tried classloader.getsystemresource("merchant.id") ... the following when run intellij works fine , finds resource. when run using bundled jar gives nullpointerexception . path resource: /src/main/resources/merchant.id path code: /src/main/java/route.kt following maven config snippet: ... <!-- make jar executable --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <mainclass>routekt</mainclass> <!-- class generated (for above main func - named route.kt) --> </manifest> </archiv...

android - IllegalStateException: in DatabaseHelper file -

following link contains gist file in getting exceptions. getting exceptions @ lines 29 , 66. https://gist.github.com/shashwathkumar/e1b26e8d4f6956c2afd4 use try-catch in both places. public void insertcontact(contacts c){ try{ db = this.getwritabledatabase(); contentvalues values = new contentvalues(); string query = "select * contacts"; cursor cursor = db.rawquery(query, null); int count = cursor.getcount(); values.put(column_id, count); values.put(column_name, c.getname()); values.put(column_email, c.getemail()); values.put(column_password, c.getpassword()); db.insert(table_name, null, values); db.close(); }catch(exception e){ system.err.println(e); } } use try-catch other method also.

Codeigniter - Get the value of Checkboxes and display it on the another page -

i newbie here in code igniter, i'm having problem of getting checked values in checkboxes, , don't know how display on other view ... here's code view <?php foreach($sen_votes $sen) { ?> <?php echo form_open("votation/balot_form"); ?> <div class="col-md-6"> <center><div class="featurette panel panel-info" id="about"> <div class="form-group"> <div class="form-section"> <label class="form-label--tick col-md-12"> <div class="col-md-6"> <img class="img-hov img-responsive" src="<?php echo base_url();?>webroot/assets/img/faces/face-2.jpg" id="" height ="120px" width = "120px" /> </div> <div class="col-md-6"> <input type="radio...

java - Using EJB interface for helper class -

my colleague told me ejb shoudln't contain method implemetation, must delegate method calls "helper" classes, i.e. ejb methods should this: public string bsuinessmethod1() { return helper.bsuinessmethod1() } public void bsuinessmethod2() { helper.bsuinessmethod2() } and reason delegate methods above, have less coupled code (for example when want reuse methods of "helper" class not in ejb context). told business methods shouldn't know java ee. (correct me if above statement wrong, , please note don't use jpa transactions, use framework dealing data persistence) so if above statement correct, "helper" classes should have same methods ejb. can reuse ejb interface helper class (i.e. make helper class implement same interface ejb)? not bad architectural point of view? i dont think delegate method calls "helper" classes , means keep ejb method 1 liner calls helper class(es). intent of delegating implemen...

javascript - Trying to call a value out of an array that is labeled as a number -

i had diffrent api before one. when run javascript can array when try append table tells me "uncaught syntaxerror: missing ) after argument list" don't know if because i'm trying call number or because working fine when had name value there. javascript. var bitcoinapiurl = "https://crossorigin.me/http://api.bitcoincharts.com/v1/weighted_prices.json"; $(document).ready(function(){ $(".btn").on("click", function(){ var usercurrency = $('#usercurrency option:selected').text(); $("#div1").append("<p id='currencylabel' />"); $.ajax({ type: "get", url: bitcoinapiurl, datatype: "json", success: function(currency) { // loop through currency (var = 0; < currency.length; i++) { if(currency[i].usd == usercurrency) { var $tr = $("<tr class='hello' />"); ...

logic - Consider the numbers 1,2,...,1000. Show that among any 501 of them, two numbers exist such that one divides the other one. -

i came across question in book 'invitation discrete mathematics' matousek , nesetril. new these kinds of problems. approached problem in way: 2 numbers selected among 501 numbers consist of divisor , dividend. number greater 500 cannot divisor. need @ least 1 number in range 1-500 inclusive. , in fact number in range given fact need select 501 numbers 1000 numbers. i divided selection of 501 numbers following cases: case 1- select numbers between 501-1000 inclusive , number between 1-500 inclusive. in case, statement provable because numbers between 1-500 have @ least 1 dividend in range 501-1000 , whole range selected. case 2- select numbers between 1-500 inclusive , 1 number between 501-1000 inclusive. in case also, statement provable there many pairs in range 1-500 serve divisors , dividends each other. case 3- select numbers in range 1-500 , numbers in range 501-1000. having trouble proving number in range 1-500,there dividend selected. this question may of...

amazon s3 - Carrierwave, Minimagick image upload to S3 not working -

i want save several version of images. i'm following , customizing uploading-images-with-carrierwave-to-s3-on-rails , image parameters not allowed form, don't know why. model class attachment < activerecord::base mount_uploader :img, s3uploaderuploader end my form looks this. <%= form_tag(img_upload_create_path, { multipart: true, method: "post"}) %> <div class="fileupload btn btn-default"> <span>file open</span> <%= file_field_tag 'user_pic[]', multiple: true, accept:'image/png,image/gif,image/jpeg', class: "pictures btn btn-success" %> </div> <%= submit_tag "upload", :class => "btn btn-success btn-lg" %> </div> <% end %> and controller class imguploadcontroller < applicationcontroller def create params[:user_pic].each |pic| attachment.create( img: pic ) end ...

.net - How to set column value in SQL select statement? -

i want set 1 column value in rows "0" sqlcommand cmd = m_objdbcapex.getsqlcommand(commandtype.text); cmd.commandtext = "select capex_billofmaterialitem.* capex_billofmaterialitem,capex_billofmaterial capex_billofmaterialitem.szbillofmaterialid = capex_billofmaterial.szbillofmaterialid , capex_billofmaterial.szprojectcode = '" + szprojectcode + "'"; da = new sqldataadapter(cmd); da.fill(dtdat); adding point @rahul's answer. if field has specific values , if want alone make 0 need case statements. select case when capex_billofmaterialitem.fieldname = 'checking value goes here' 0 else capex_billofmaterialitem.fieldname end fieldname1, capex_billofmaterialitem.* capex_billofmaterialitem, capex_billofmaterial capex_billofmaterialitem.szbillofmaterialid = capex_billofmaterial.szbillofmaterialid , capex_billofmaterial.szprojectcode = '...

Is there a way to include .launch files with a plugin for eclipse? -

i trying create plugin automatically generate external tool when eclipse opens. have looked options , seems best way done loading .launch file, information create external tool, eclipse when plugin run. have not been able find way this, know how accomplished? you can use debuguitools launch .launch file. more information can find in this eclipse article.

dayofweek - How to find documents in all mondays from last 7 weeks in mongodb -

{ "_id" : objectid("568b650543712795bf864a45") "companyid" : "55e2d7cfdc8f74d14f5c900f", "timestamp" : isodate("2014-12-02t18:30:00.000z") }, { "_id" : objectid("568b650543712795bf864a46") "companyid" : "55e2d7cfdc8f74d14f5c900f", "timestamp" : isodate("2014-12-03t18:30:00.000z") }, { "_id" : objectid("568b650543712795bf864a47") "companyid" : "55e2d7cfdc8f74d14f5c900f", "timestamp" : isodate("2014-12-04t18:30:00.000z") } retrieve documents in mondays timestamp field last 7 weeks. you have use mongodb aggregation framework achieve this. find date of start (current day - 7 weeks) in whatever programming language using. have use aggregation operation $dayofweek achieve this var pipeline = [ { $match: {timestamp: {$gte: startdate}} ...