Posts

Showing posts from February, 2013

php - What is the difference between OpenID and OpenID Connect? -

we support openid 1.1 , 2.0 lightopenid in our php project. a press release announcing release of "openid connect". the news notes heavy support microsoft of new standard, reporting @ rsa 2014 conference, underscores reliance on oauth 2.0, , written in business speak. so consumer of openid, has changed , there backwards compatibility? converting comment answer off unanswered list: most of answered here: http://openid.net/connect/faq backwards compatibility extends far provide backward compatible user ids, seems. don't have great official document support in detail though.

php - How to change the content according to the location in Drupal? -

for example, if user opens www.example.com in country us, content should change according user location . if user visits site in los angeles title should "los angeles" , block content should according taxonomy term city. i'm new drupal. so, please me. these 2 modules should achieve this: geoip context geoip

sql server - Can I run SSRS custom code on the same data source/query session as the report datasets? -

i doing per process authentication , want authenticate db before datasets done. the oninit function run before datasets on different process/connection. can somehow attach connection datasets going use? edit: making reports use in report manager.

angularjs - Angular ui bootstrap current date (today) highlight without selecting -

i using angular.ui bootstrap datepicker ( http://angular-ui.github.io/bootstrap/#/datepicker ) now challenging 1 problem: client wants see current date highlighted, if not selected. in example ( http://angular-ui.github.io/ui-date/ ). tried google problem, no solution found angular.ui bootstrap datepicker. there no way, switch ui-date. ideas? thank you! replace in datepicker control this var days = getdates(firstdate, numdates), labels = new array(7); (var = 0; < numdates; i++) { var dt = new date(days[i]); days[i] = makedate(dt, format.day, (selected && selected.getdate() === dt.getdate() && selected.getmonth() === dt.getmonth() && selected.getfullyear() === dt.getfullyear()), dt.getmonth() !== month); } with var today = new date(); var days = getdates(firstdate, numdates), labels = new array(7); (var = 0; < numdates; i++) { var dt = new date(days[i]); var highlight = (selected && selected.getdate() === dt.getda...

ruby on rails - wrong number of arguments (0 for 3..6) -

i using mailboxer gem , looking have questions sent users inbox can view , answer question. i receiving argument error wrong number of arguments (0 3..6) . points line @message = current_user.send_message.new(:subject => "you have question #{@question.sender_id}", i trying use send message instance since original line of code @message = current_user.messages.new(:subject => "you have question #{@question.sender_id}" submit question notifications table, not connect conversations table. questions controller: def create @question = question.new(params[:question]) if @question.save #original code @message = message.create @message = current_user.send_message.new(:subject => "you have question #{@question.sender_id}", #original code :sender_id :notification_id => @question.sender_id, #original code :recipient_id :recei...

InsertOnSubmit method throws NullReferenceException ... Linq to sql C# entity/DataContext class -

here's datacontext class: public class dealer : datacontext { public table<vehicle> vehicles; public table<customer> customers => gettable<customer>(); public table<account> accounts; public table<transaction> transactions; public dealer(string connection) : base(connection) { } } here's customer class: [table(name="customers")] public class customer { [column(isprimarykey = true, dbtype = "int not null identity", isdbgenerated = true, canbenull = false)] public int customerid { get; set; } [column(canbenull = false)] public string firstname { get; set; } [column(canbenull = false)] public string lastname { get; set; } [column(canbenull = false)] public string ssn { get; set; } public override string tostring() { return string.concat(this.firstname, " ", this.lastname, " ", this.ssn); } private entityset<vehicle...

javascript - How can I output results to the 'result' window in JSFiddle? -

Image
i've tried using console.log() need have developer window open in chrome see output. alert() writes pop-up box. want output result window (bottom-right pane) in jsfiddle. can tell me please? updated visual of answer jajadrinker - this. add html section: <div id="console-log"></div> add javascript section: var consoleline = "<p class=\"console-line\"></p>"; console = { log: function (text) { $("#console-log").append($(consoleline).html(text)); } }; optionally, add css make more user friendly: .console-line { font-family: monospace; margin: 2px; } you can see example here .

php - Speed of Magento -

so thinking of implementing magento in site @ work. worried since feature heavy, free-source application, might run slow wordpress , joomla sites created in past. is magento fast e-commerce platform? if not, have suggestions ready gui ecommerce solutions, can integrated custom website? can paid gui long not off wall expensive. speed magento store following admin settings: enable cache: navigate system > cache management , enable cache types. reindex data: under system > index management select indexes , hit “reindex data” submit button. enable javascript file merging: navigate system > configuration > developer > javascript settings , select “yes” under “merge javascript files”. combine css files: go system > configuration > developer > css settings , select “yes” “merge css files”. turn off logs: settings under system > configuration > developer > log settings. enable compilation: go system > tools > compilation , hit “run ...

c# - Flattening of AggregateExceptions for Processing -

i'm running few issues call flatten on aggregateexception , inside there still aggregateexception ! means being propagated chain , being rolled aggregateexception . there way recursively flatten inner aggregateexceptions? usually, i'll use handle delegate process these, returns false if there inner aggregateexceeption. not handling these properly? edit: since calling flatten, appears issue it's not being caught until way later in callstack. here code i'm calling flatten(). use in stack trace method called writeexceptionrecord(string, fileinfo): do { try { using (var stream = file.open(filemode.append, fileaccess.write, fileshare.none)) { using (streamwriter writer = new streamwriter(stream)) { await writer.writelineasync(data); } } } catch (aggregateexception ex) { ex.flatten().handle((x) => { if (x ioexception) { ...

c++ - SQLite Incomplete Type Error -

i'm writing c++ program uses sqlite database. line of code; void testrun() { // code here sqlite3_stmt stmt; // code here } i following error; error: aggregate 'sqlite3_stmt stmt' has incomplete type , cannot defined sqlite3_stmt stmt; ^ i'm using amalgamated sqlite source code , have "sqlite3.h" included. causes error , how can solved? i'm on windows 7 64bit, using mingw_64. that's opaque structure known implementation. can't create instance of it, can create pointer one: sqlite3_stmt* stmt; sqlite3_prepare(db, "select...", -1, &stmt, 0);

java - Nothing shows up to the screen when I call the repaint() method -

this common question, unique every situation. here call .repaint() in code: timer = new timer(5, new actionlistener() { double t = 0; public void actionperformed(actionevent e) { arraylist<particle> fireworks = manager.getfireworks(t/1000); showfireworks(fireworks,t/1000); t = t + timer.getdelay(); (particle projectile : fireworks) { canvas = new fireworksdisplay(projectile); canvas.repaint(); add(canvas); } } }); it creating arraylist of firework particles (which works correctly, since tested printing (x,y) postions in console window , went fine). i want program paint little particles on screen every member of arraylist list here drawpanel private class fireworksdisplay extends jpanel { private color colour; private int xpos; private int ypos; private int size; public fireworksdisplay(particle particle) {...

JQuery - My tags box doesn't work because i'm using the clone() event -

i created little script, when write on textbox , click space, words written, goes hidden area, , separated, appear tags. google use script gmail, when write contacts, , youtube too, when write video tags. so, o created script, , working well. but want create new script, clones form, every moment click @ link, new form equal last, appears. i used "clone()" that, working, cant call hidden form tags, resuming, "clone()" cant read tags. i'm new @ jquery, so, want know how can make event clone() read tags. here jquery code tags: $('#tags').keypress(function(e) { //check if space clicked, , create new tag if(e.which == 32) { var tx = $('#tags').val(); if (tx) { $(this).val('').parent().before('<li class="tags"><span><input type="hidden" value="'+tx+'" name="tags[]" />'+tx+'</span><a style="cur...

CvANN_MLP::write in OpenCV creates large XML file. How can I reduce its size by reducing the precision of real numbers in the file? -

i generate xml file containing trained neural network using cvann_mlp::write method in opencv, creates large file. when see content of generated file, contains real numbers many digits after decimal point. not need precision , want reduce file size making precision 6 digits after decimal point. 1 please tell me how reduce precision of real numbers in file? thanks. xml files tend bloated regardless of put in them. how going slimmer option such json? i using rapid json. in c written easy use , integrate , limited bsd license. if wish here example make use of rapid json pay specific attention datatype.h wrote nice interface reading json parameters. here demo see how easy use rapid json example

nasm - Error in compilation of program using gcc -

while compiling nasm programm, command nasm -felf prgname.asm works fine when use gcc command gcc -o prgname prgname.o driver.c asm_io.o gives me error file format not recognized; treating linker script /usr/bin/ld:asm_io.o:1: syntax error collect2: ld returned 1 exit status i not understand error. has system architecture? based on error output, it's not prgname.o file that's causing issue asm_io.o one. per output: file format not recognized; treating linker script /usr/bin/ld:asm_io.o:1: syntax error you can see it's treating some file textual linker script , complaining syntax error in asm_io.o . since tend syntax errors textual source code rather binary object files, it's safe bet file being treated linker script asm_io.o one. so should concentrate efforts there. first thing check both files see type are: file prgname.o asm_io.o i'm including first not because think it's wrong because, if it's right, it'll give i...

json - Grabbing data from firebase with javascript -

i have following code grab data , view in console firebase setup, have no idea why isn't working. here code below. running live @ site if want inspect it. here link jsfiddle <!doctype html> <html lang="en" ng-app="demoapp"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type='text/javascript' src='https://cdn.firebase.com/js/client/1.0.11/firebase.js'></script> <script type="text/javascript"> var dataref = new firebase('https://edengarden.firebaseio.com/test'); dataref.on('value', function(snapshot) { console.log(snapshot.val()); }); </script> </head> <body> </body> </html> if change javascript this: var mydataref = new firebase('http...

Javascript for chrome extension -

Image
i'm trying create button on page my manifest.json has content script inject.js , inject.js this var botao_comunidades = document.queryselector('a[href="#communities"]'); var botao_teste = document.createelement('p'); botao_teste.innerhtml = '<a href="#">test</a>'; botao_teste.classname = "themelighttransparency nsc"; botao_comunidades.insertadjacentelement('afterend',p); manifest.json { "name": "teste", "version": "0.0.1", "manifest_version": 2, "description": "teste", "icons": { "16": "icons/icon16.png", "48": "icons/icon48.png", "128": "icons/icon128.png" }, "default_locale": "en", "permissions": [ "<all_urls>" ], "content_scripts": [ { "matches": [ "https://www.orkut.com.br/*...

Using JavaFX's MenuBar causes 'Glass detected outstanding Java exception' -

i have javafx application. have button when clicked calls action , loads fxml file. works perfectly. i decided place functionality within menu of application. so, created menu , added menu items within scene builder. assign 'on action' event, same way did other button. following error when click: glass detected outstanding java exception @ -[glassviewdelegate sendjavamouseevent:]:src/com/sun/mat/ui/glassviewdelegate.m:541 exception in thread "javafx application thread" java.lang.runtimeexception: java.lang.reflect.invocationtargetexception caused by: java.lang.classcastexception: javafx.scene.control.menuitem cannot cast javafx.scene.node @ plataformavalidezpredictiva.maincontroller.handleaction(maincontroller.java:60) ... 38 more this code handler. once again, works button placed within ui , doesn't work menu bar: public void handleaction(actionevent event) throws exception{ node node = (node)event.getsource(); stage stage=(stage) node.gets...

html - How to make formatted text not shift a bit when chaning -

i made little jquery/javascript timer page because bored. works great except when numbers changing; there's discernible "jump" on page. i don't have slightest idea how make count smoothly can me out? can viewed here: <!doctype html> <html> <head> <link href='http://fonts.googleapis.com/css?family=montserrat:400,700' rel='stylesheet' type='text/css'> <style> header{ font-family: 'montserrat', sans-serif; font-size: 60px; color: white; text-shadow: 3px 3px 3px #000000; background-color: #4169e1; /*position: absolute;*/ width: 110%; padding-top: 55px; padding-bottom: 55px; margin-top: -10px; margin-bottom: 0px; margin-left: -5%; text-align: center; ...

python - What filter is used to remove corner effect on result -

Image
below output here marked in red circle. there lots of such line image, have marked 3 circle. how remove these lines? there filter remove line? think, due presence of corner. you can use median filter remove thing. try code , see difference while changing value of trackbar (mask size). import cv2 import numpy np def nothing(x): pass #image window cv2.namedwindow('image') cv2.namedwindow('image2') # create trackbars color change cv2.createtrackbar('mask','image',1,10,nothing) cv2.createtrackbar('mask2','image2',1,10,nothing) #loading images img = cv2.imread('vfgsn.png') # load image path gray_im = cv2.cvtcolor(img, cv2.color_bgr2gray) while true: # current positions of trackbars m = cv2.gettrackbarpos('mask','image') m2 = cv2.gettrackbarpos('mask2','image2') median = cv2.medianblur(gray_im,(2*m+1)) median2 = cv2.medianblur(img,(2*m2+1)) cv2.imsho...

postgresql - Return tuple and check for null -

i've got function: create or replace function my_function(user_id bigint) returns bigint $body$ declare var1 ???; --- ??? begin --1 var1 := (select table1.field1, table2.field2 table1 inner join table2 -- ...... ); --2 --if var1 not null... first of all, want var1 tuple. have create type take it? create type my_type .... which has 2 fields? or maybe there better way solve this? secondly, want make sure var1 not null. how this? you can create type or use type of existing table. use returns setof my_type . but row type need in single function it's more convenient use returns table (...) - possibly in combination return query : create or replace function my_function(user_id bigint) returns table(field1 int, field2 text) -- replace actual types! $func$ begin return table select t1.field1, t2.field2 -- table-qualify avoid naming conflict table1 t1 join table2 t2 on ... ... ; -- if var1 not null ...

vba - Change cut view text in CATIA -

Image
i'm working catia v5, , want use macros (vba), have problems! my question is: how change text of cut view? (see picture) i tried use : myview.texts.item(1) access "text" i think catia dont consider text ... i want change text without intervention of user ( without selections), can that? ime, vba scripting in drafting workbench quite tricky @ first..."mytexts" collection of drawingtext objects. mydrawingtext.text = "mynewtextvalue" the main trouble have getting handle on specific text object want modify. found best way around either scan entire drawingtexts collection in drawingview, , apply unique name, drawingtext.name="uniqueobjectname" , or create drawing text script , can more handle on drawingtext object put whatever value want in there. creating unique names makes drawing more robust future scripting myview.texts.count useful item number if last created drawingtext object(s). i'm happy further explain i...

r - Forecast with auto Arima, with long term trend line, the 30 day forecast "jumps" -

Image
i'm trying create 30 day forecast using auto.arima forecast package. want capture long term trend, inserted xreg argument. the data: dput(data) structure(list(tkdate = structure(c(15706, 15707, 15708, 15709, 15710, 15711, 15712, 15713, 15714, 15715, 15716, 15717, 15718, 15719, 15720, 15721, 15722, 15723, 15724, 15725, 15726, 15727, 15728, 15729, 15730, 15731, 15732, 15733, 15734, 15735, 15736, 15737, 15738, 15739, 15740, 15741, 15742, 15743, 15744, 15745, 15746, 15747, 15748, 15749, 15750, 15751, 15752, 15753, 15754, 15755, 15756, 15757, 15758, 15759, 15760, 15761, 15762, 15763, 15764, 15765, 15766, 15767, 15768, 15769, 15770, 15771, 15772, 15773, 15774, 15775, 15776, 15777, 15778, 15779, 15780, 15781, 15782, 15783, 15784, 15785, 15786, 15787, 15788, 15789, 15790, 15791, 15792, 15793, 15794, 15795, 15796, 15797, 15798, 15799, 15800, 15801, 15802, 15803, 15804, 15805, 15806, 15807, 15808, 15809, 15810, 15811, 15812, 15813, 15814, 15815, 15816, 15817, 15818, 1...

Posting JavaScript Value to PHP via Ajax issue -

i need value jquery php can search function site. i have tried: <script> $(document).ready(function () { $('#search_button').click(function(e){ e.preventdefault(); e.stoppropagation(); carsearch(); }); }); function carsearch() { $.ajax({ type: "post", url: 'cars.php', data: { mpg : $('.mpg').val() }, success: function(data) { alert("success! "+$('.mpg').val()+"mpg"); } }); } </script> this ajax running when button pressed , js value there displayed in alert. however if(isset($_post['mpg'])) { $query = "select * cars mpg =< ".($_post['mpg']).""; echo "<div class='test'></div>"; } else { ...

linux - Split string using delimiter -

i trying split string using delimiter '|'. but, want '|' sample data in second example. how can achieve this? f() { local ifs='|' local foo set -f # disable glob expansion foo=( $@ ) # deliberately unquoted set +f printf '%d\n' "${#foo[@]}" printf '%s\n' "${foo[@]}" } f 'un|dodecaedro|per|||tirare|per|i danni' expected output: un dodecaedro per | tirare per danni there may way produce expected, here approach, hope using recent version of bash , here string supported string='un|dodecaedro|per|||tirare|per|i danni' awk '{ n=split($0,a,"|") for(i=1;i<=n;i++) { if(length(a[i]) == 0 && length(a[i+1])==0) { print "|"; i+=1 } else { print a[i] } } }' <<<"$string" resulting $ bash f un dodecaedro per | tirare per danni ...

Distinguishing between I-type and R-type Instruction format in MIPS -

in mips, wonder if there way tell if instruction, looking @ machine code, i-type or r-type instruction? if you're looking quick , dirty, op-code (6 significant bits) of r-type instructions set 0 . of course in real cpu there more complicated test deal possible exceptions. see this chart .

python - Importing/Exporting a nested dictionary from a CSV file -

so have csv file data arranged this: x,a,1,b,2,c,3 y,a,1,b,2,c,3,d,4 z,l,2,m,3 i want import csv create nested dictionary looks this. data = {'x' : {'a' : 1, 'b' : 2, 'c' : 3}, 'y' : {'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4}, 'z' : {'l' : 2, 'm' :3}} after updating dictionary in program wrote (i got part figured out), want able export dictionary onto same csv file, overwriting/updating it. want in same format previous csv file can import again. i have been playing around import , have far import csv data = {} open('userdata.csv', 'r') f: reader = csv.reader(f) row in reader: data[row[0]] = {row[i] in range(1, len(row))} but doesn't work things not arranged correctly. numbers subkeys other numbers, letters out of place, etc. haven't gotten export part yet. ideas? since you're not interested in preserving ord...

c# - The specified type member 'Product' is not supported in LINQ to Entities -

i'm getting error 'product' not supported in linq entities whilst using cartitems.product.unitcost when trying total of basket. public decimal gettotal() { //multiply price count of item price each item in cart , them sum prices decimal? total = (from cartitems in db.shoppingbaskets cartitems.basketid == shoppingcartid select (int?)cartitems.basketquantity * cartitems.product.unitcost).sum(); return total ?? decimal.zero; } i tried splitting query see if fix problem int? quantity = (from cartitems in db.shoppingbaskets cartitems.basketid == shoppingcartid select (int?)cartitems.basketquantity).sum(); decimal? price = (from cartitems in db.shoppingbaskets cartitems.basketid == shoppingcartid select cartitems.product.unitcost).sum(); i same problem second separate query 'product'. product class public partial class product { public product() { this.ordercheckouts = new hashset<ordercheckout>(); ...

lisp - Accessing Hunchentoot request objects from the REPL for debugging -

i find incremental development tends break when coding hunchentoot. for example, might write web page composed of few functions. if 1 of these inner functions contains call - - hunchentoot:post-parameters* can't test function in repl. it'll error out because *request* doesn't exist unless page called web client. it nice if function-or-other-source existed such test my-function thus: >(let* ((*request* (get-previous-request-from-somewhere)) (*session* (slot-value *request* 'hunchentoot:session))) (my-function <whatever params>)) does or similar exist? overlooking better approach debugging? my interim solution looks this: (defparameter *save-last-request* t) (defvar *last-request* nil) (defun store-request () (when *save-last-request* (setf *last-request* *request*))) (defmacro with-last-request (&body body) `(let* ((*request* *last-request*) (*session* (slot-value *request* 'hunchentoot:session))) ,@b...

c# - Regex Match string from starts with -

this regular expression. ^ak[0-9a-za-z-/#\s]{1,15}$ it matches whole string when enter text starts like'aktest123' but want match below strings like a ak aktest how can modify regex match string first character? this should magic: ^(a|ak[0-9a-za-z-/#\s]{0,15})$ that means accept a, or ak (notice changed 1 @ end 0), or ak , following 15 characters list. want, right?

javascript - if(negetive number) is true? Is something wrong with js? -

is wrong js? if("hello".indexof("world")) { // forgot add > -1 here console.log("hello world"); } basically if(-1) true. how possible? took me whole day fix this. there list available these kind of things listed? or tools available catch things these. as per ecma 5.1 standard specifications , following table used determine truthyness of expression +-----------------------------------------------------------------------+ | argument type | result | |:--------------|------------------------------------------------------:| | undefined | false | |---------------|-------------------------------------------------------| | null | false | |---------------|-------------------------------------------------------| | boolean | result equals input argument (no conversion). | |--------...

linux - shell script of grep single line in bash script -

i have file following format: 123 2 3 48 85.64 85.95 park parkname location 12 2.2 3.2 48 5.4 8.9 now write shell script extract lines file. first item each line kind of flag. different flags, make different process. see code below: head= ` echo "$line" | grep -p "^\d+" ` if [ "$head" != "" ]; (do something...) fi head=` echo "$line" | grep -p "^[a-z]+" ` if [ "$head" != "" ]; (do something...) fi the code works. dislike complicated way of writing 2 "if". have simple like: if [ "$head" != "" ]; (do something...) elif [ "$head" != "" ]; (do something...) fi any thoughts? how pure bash solution? bash has built-in regexp functionality, trigger ~ character. aware though processing huge files bash read line not yield in optimal performance.. #!/bin/bash file=$1 while read line echo "read [$line]...

asp.net mvc - Can I create a Visual Studio project file from files on a server? -

i have access working asp.net mvc 4 website through ftp not have visual studio project file. using these files can create visual studio project file? if have access class files, views etc missing solution/project file technically can wrap them in empty project still different project. if have access published output (the views , javascript) in short answer no, not without trying reverse engineer dll have heard possible have never tried myself.

javascript - How to get variable into chained function with mootools -

i've created function spice html forms check if fields valid on submit, , if not flashed red warn users. works great until tries return color normal. if (response.length > 0) { (var = 0; < response.length; i++) { if (response[i].getattribute('field') != '') { var errfield = $(response[i].getattribute('field')+'err'); if (errfield) { errfield.set('html', response[i].getattribute('msg')); var color = errfield.getstyle('color'); window['cfx'+i] = new fx.morph(errfield, { duration: 400, transition: fx.transitions.quad.easeinout }); window['cfx'+i].start({'color': '#000000'}).chain(function() { window['cfx'+i].start({'color': color}); }); } } } } i've debugged point can tell crashed when gets inside chained function, because loses variable @ point. i've l...

api - OPTAsport data for livescores -

i want create site football live scores optasports. recieved test data 2 bundesliga scores. free ?. rest european leagues available on premium account ?. there free api leagues ? i think not find free football statistics (if can, want make money football statistics site). opta gives free account test data if make contract later use.

screen scraping - XPATH Contain() Function Not Working for Multiple <div> Tags with Same Name -

i trying scrape following section (only excerpt) of xml code. second form-item i'm trying scrape: <div class="form-item"> <a href="http://www.avaopera.org" target="_blank" rel="" class="">http://www.avaopera.org</a> </div> <div class="form-item"> <script type="text/javascript"> document.write('*[block of text]*') </script> <a href="mailto:ademarco@avaopera.org">ademarco@avaopera.org</a> </div> i used following xpath query contain function because there multiple form-item tags: //div[@class='form-item' , contains(.,'@')]/a/text() this query not work. tried removing /a/text() displays text within <script> not tag text. what doing wrong? you're targeting text within <div> instead of text within <a> , if understand goal correctly. try using //div[@class='form-item' , c...

java - How does Spring Data jpa know properties changed? -

so lookup object repository. if save object after lookup, spring data smart enough not update database. if change property within object , save, spring data update. how know needs update or not? this not provided spring data, feature of persistence framework (hibernate, openjpa, eclipselink,...). persistence providers enhance domain objects "stuff" optimization. normally, done called runtime enhancement, class gets loaded inside of application , enhanced there(runtime weaving). openjpa allows build-time-enhancement, means, "openjpa-domain-extension-stuff" becomes added entities @ compile time. (there maven goal in openjpa plugin too) https://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/ref_guide_pc_enhance.html if run mvn openjpa:enhance simple domain following: (i used jad decompile class, long show stuff inside, copied relevant parts) import org.apache.openjpa.enhance.*; import org.apache.openjpa.util.intid; import org.apache.openjpa...

c - Red Black Tree - Initialization -

how can correctly initialize red black tree in c? structure: typedef struct node{ int key; struct node *left; struct node *right; struct node *parent; enum {red, black} color; }node; typedef struct rbtree{ struct node *root; struct node *nil; }rbtree; main function: int main(){ rbtree *tree; init_rbtree(&tree); } init function: void init_rbtree(rbtree **t){ (*t)->root = null; node *n = (node*)malloc(sizeof(node)); if(n != null){ n->color = black; (*t)->nil = n; } } the program crashes run code. you need allocate memory *t before can use it. void init_rbtree(rbtree **t) { *t=malloc(sizeof(rbtree)); if (*t==null) { //handle error } else { (*t)->root = null; node *n = malloc(sizeof(node)); if(n != null){ n->color = black; (*t)->nil = n; } } }

android - Can't send integer value more than 127 from c++ to java via UDP protobuf -

i'm trying send int data via udp using protobuf. visual c++ java(android studio) proto file : message rbr { required int32 rpm = 1; required int32 gear = 2; required int32 speed = 3; } c++ sending: telemetry.set_rpm(1200); telemetry.set_speed(120); telemetry.set_gear(4); telemetry.serializetostring(&serializedmessage); memset(message, '\0', buflen); memcpy(message, serializedmessage.c_str(), serializedmessage.size()); //send message if (sendto(s, message, serializedmessage.size(), 0, (struct sockaddr *) &si_other, slen) == socket_error) { printf("sendto() failed error code : %d", wsagetlasterror()); exit(exit_failure); } java(android) receive using square wire protobuff library: socket = new datagramsocket(8888); wire wire = new wire(); while (true) { packet = new datagrampacket(buf, buf.length); socket.receive(packet); s = new string(packet.getdata(), 0, packet.getlength()); byte[] bytes = s.getbytes(); ...

mobile - How cookies are persisted in webview on IOS -

i doing research , want know how cookies persisted in webview on ios. i planning write application server sends session cookies needs available in multiple sessions of webview. not sure webview persist these cookies sent server later use. please point me resources can read. thanks kiranse

npm - New mark ^ in package.json file -

after last npm update, found package versions started ^ . can't found information it, because of filtering suck signs search engines. so, looks like: "grunt-autoprefixer": "^0.4.2", "grunt-bower-install": "^0.7.0", "grunt-concurrent": "^0.4.3", "grunt-contrib-clean": "~0.5.0", some, old ~ . grateful likes or information that. i have suggestion indicates witch packages updated. the caret, [...] update recent major version (the first number). ^1.2.3 match 1.x.x release including 1.3.0, hold off on 2.0.0. http://fredkschott.com/post/2014/02/npm-no-longer-defaults-to-tildes/

c++ - Converting an XML stream to hexadecimal -

so rather new c++, , hope contructive advice. i working on telemetry system scientific rocket takes data instrument, stores data pipe software, , subsequently sends data available serialport. problem instrument transmits data packets in xml format, e.g.: <sample value="-4.80521e-012" /> <sample value="4.90272e-012" /> <sample value="3.49013e-011" /> <sample value="2.13785e-010" /> <sample value="2.38185e-010" /> <sample value="1.70573e-010" /> <sample value="1.16129e-011" /> these stored temporarily in buffer created createfile/writefile (from serial port). probe cannot send other formats xml, , need convert implicitly or explicitly 4 byte hex (due telemetry requirements), e.g.: 2c34b73f 2c1dfc77 2bbd69d2 a9220b89 a8a0cedf 290bc781... my question then: can suggest way this? should try remove sets of substrings stream, or easier way translate between xml , hex? n...

php - Create assoc array from array of asoc array -

how can create new array structure: [id] => [prop] data this $foo = array( array('id' => 2, 'prop' => 'val2'), array('id' => 1, 'prop' => 'val1'), array('id' => 3, 'prop' => 'val3'), ); but in elegant way, without foreach loop? in php 5.5: $result = array_column($foo, 'prop', 'id'); for php<5.5: $result = array_combine( array_map(function($x) { return $x['id']; }, $foo), array_map(function($x) { return $x['prop']; }, $foo), ); i have note, despite hidden inside callbacks or built-in functions, it's still loop inside - thus, in terms of complexity it's same plain loop.

mysql - Visual Studio 2013 Query results multi-line -

i'm connecting mysql database inside visual studio 2013. run query , have grid query results. in table, have fields multiline values. grid result can't show multiline fields. edit: have record has field several lines , want see these lines in query result pane inside visual studio. how can change visual studio configuration allow multiline values in query results pane? thanks in advance

c++ - How to find currently used size of UDP receive buffer in Winsock -

i have udp socket in blocking mode, have bursts of packets , getting lost. how can find out current used size in receive buffer in winsock? how can understand whether system discarding packets? wsaioctl passed fionread documented way: if socket passed in s parameter message oriented (for example, type sock_dgram), fionread returns reports total number of bytes available read, not size of first datagram (message) queued on socket. i think answers first question. second, see no way programmatically figure out. should use sequence numbers in application detect gaps, , @ receive buffer size , guess if it's close full, losses due running out of buffer space.

Create Custom Column data in analytics canvas -

Image
i'm newbie in analytics canvas , try create report first column in sheet name of source tables. i have: and result of combined tables is: this want don't know how do: if can me happy thanks!!! to add profile name and/or id query, go "additional data" tab in query definition- there find check box list following columns: accountid, accountname, webpropertyid,profileid,profile,currency,timezone, apirequeststartdate , apirequestenddate just check ones want- in example above profilename

How to convert SQL query to Ruby on Rails -

how convert following sql query ruby on rails? select health_workers.name,health_workers.surname,clinics.name clinic,count(observations.id) count,observations.observation_date health_workers left join observations on health_workers.id = observations.health_worker_id, clinics health_workers.clinic_id = clinics.id group health_workers.name,health_workers.surname,clinics.name,observations.observation_date. you can way query = "select health_workers.name,health_workers.surname,clinics.name clinic,count(observations.id) count,observations.observation_date health_workers left join observations on health_workers.id = observations.health_worker_id, clinics health_workers.clinic_id = clinics.id group health_workers.name,health_workers.surname,clinics.name,observations.observation_date." results = activerecord::base.connection.execute(query) and gives result

java - Can't dispose of jframe window? -

i'm trying dispose of difficulty window after 1 of difficulty button's clicked won't happen. i've tried .dispose , frame.setdefaultcloseoperation(jframe.exit_on_close); can't it. placement or more? import java.awt.flowlayout; import java.awt.event.*; import javax.swing.jbutton; import javax.swing.jdialog; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jtextfield; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.gridlayout; public class game extends jframe{ public static jframe frame = new jframe(); private jlabel lab; public static void main(string[] args) { game difficulty = new game(); difficulty.setsize(350,105); difficulty.settitle("difficulty."); difficulty.setvisible(true); difficulty.setlocationrelativeto(null); /**game sudoku = new game(); sudoku.setsize(900, 900); sudoku.setvisible(false);*/ } ...

jquery - Fetching the link to a video from an RSS feed item -

i new web development , first chrome extension. here script fetch , parse rss feeds : $(document).ready(function() { // fetch rss feeds , parse them $.get(rssurl, function(data) { var $xml = $(data); $xml.find("item").each(function() { var $this = $(this), item = { title: $this.find("title").text(), link: $this.find("link").text(), description: $this.find("description").text(), pubdate: $this.find("pubdate").text(), url : $this.find("enclosure").attr("url"), author: $this.find("author").text() }; // add array items.push(item); if(items.length == 1){ $(".title").html(item.title); $(".description").html(item.url); $(".author").html(item....