Posts

Showing posts from March, 2015

Nouveau kernel rejected pushbuf on Allegro5-C++ -

i'm in trouble this: i've installed allegro5 on ubuntu, , compiled helloworld project #include <allegro5\allegro.h> #include <allegro5\allegro_native_dialog.h> int main(void) { allegro_display *display=null; if(!al_init()) { al_show_native_message_box(null, null, null, "failed initialize allegro!", null, null); return -1; } display=al_create_display(640, 480); if(!display) { al_show_native_message_box(null, null, null, "failed initialize display!", null, null); return -1; } al_destroy_display(display); return 0; } with " g++ -wall testprogram.cc pkg-config --libs allegro-5.0 allegro_font-5.0 allegro_ttf-5.0 ". running on terminal, gives me error (or crash?) message: nac@nac:~$ ./a.out nouveau: kernel rejected pushbuf: bad file descriptor nouveau: ch0: krec 0 pushes 1 bufs 1 relocs 0 nouveau: ch0: buf 00000000 00000002 00000004 00000004 00000000 nouveau: ch0: psh 000...

java - Getting ArrayIndexOutOfBound on String split -

i splitting string in string array. string = "somestring1, somestring2 00000-0000"; string[] b = a.split("(\\, )|(\\ )|(\\-)"); and assigning array values string c = b[0]; string d = b[1]; string e = b[2]; string f = b[3]; which giving exception arrayindexoutofbound array index out of range: 4

c++ - Character constant too long for its type using switch case -

i wish use more 1 character in case statement whole 'cosech' in program: #include <iostream> #include <math.h> using namespace std; int main() { char select[10]; cout<<"enter value of angle in degrees";float angle; cin>>angle; cout<<"choose trigonometric function \ntype cosech function cosech()"; cin>>select; switch(select[0]<<9) { case 'cosech': cout<<"the cosech of angle "<<angle<<" = "<<1/sinhf(angle); break; } return 0; } the compiler gives following error line 10 character constant long type you can't. c++, in common c, not support using switch statements in way. however, not cause of error. single quotes ' used character constants, i.e., single letter. should use double quotes " string literals. however, still not work, cannot use string in sw...

sql - whats wrong with mysql tigger -

this trigger im trying add. keep getting "updating of new row not allowed in after trigger" delimiter $$ drop trigger if exists leaderboard.badges_aupd$$ use leaderboard$$ create trigger `badges_aupd` after update on `badges` each row set new.badgelevel := case when badgepercent < 50 0 when badgepercent < 75 1 else 2 end; $$ delimiter ; your trigger should before update since after update cant set column of same table, , missing begin part delimiter $$ drop trigger if exists leaderboard.badges_aupd$$ use leaderboard$$ create trigger `badges_aupd` before update on `badges` each row begin if new.badgepercent < 50 set new.badgelevel = 0 ; elseif new.badgepercent < 75 set new.badgelevel = 1 ; else set new.badgelevel = 2; end if; end;$$ delimiter ;

c# - Double returning NaN but not all the time -

i baffled here. have function return double, returns correct value, of times return nan. understanding nan returned when have 0/0. below function returning nan, it's variables declared doubles. public double superiorvalue(list<double> l) { valuekn[0] = 0; valuekn[1] = 0; valuekn[2] = 1.69; valuekn[3] = 1.18; valuekn[4] = 0.95; valuekn[5] = 0.82; valuekn[6] = 0.75; valerkn[7] = 0.67; valuekn[8] = 0.63; valuekn[9] = 0.58; valuekn[10] = 0.561; valuekn[11] = 0.542; valuekn[12] = 0.523; valuekn[13] = 0.504; valuekn[14] = 0.485; valuekn[15] = 0.466; valuekn[16] = 0.447; valuekn[17] = 0.428; valuekn[18] = 0.409; valuekn[19] = 0.39; valuekn[20] = 0.382; xm = (l.sum()) / (l.count); (int = 0; < l.count; i++) { sumtemporary = l[i] - xm; sum = sum + sumtemporar...

XSLT field validation -

i have requirement validate field content within 1..n structure, data come in pairs of result_id , result_value. if "<" found in result.min_limit characteristic, value must put in max_limit characteristic target field , min_limit must cleared out in target structure. sample of source structure data: <?xml version="1.0" encoding="utf-8"?> <test> <results> <result> <d_result> <d_result_id>result.derived</d_result_id> <d_result_value>59w</d_result_value> </d_result> <d_result> <d_result_id>result.min_limit</d_result_id> <d_result_value>&lt;=600.0000</d_result_value> </d_result> <d_result> <d_result_id>result.max_limit</d_result_id> <d_result_value/...

c++ - How to create one or more spheres using OpenGL? -

we have create ball game. however, before implementing our code graphics, given 3 codes 3 types of graphics. code cubes, code random spheres don't move, , code moving cube, if i'm not mistaken (maybe am). first code cube follows: #include "vue_opengl.h" #include "vertex_shader.h" #include "contenu.h" // ====================================================================== void vueopengl::dessine(contenu const& a_dessiner) { q_unused(a_dessiner); draw first cube (at origin) dessinecube(); qmatrix4x4 matrice; // dessine le 2e cube matrice.translate(0.0, 1.5, 0.0); matrice.scale(0.25); dessinecube(matrice); // dessine le 3e cube matrice.settoidentity(); matrice.translate(0.0, 0.0, 1.5); matrice.scale(0.25); matrice.rotate(45.0, 0.0, 1.0, 0.0); dessinecube(matrice); } // ====================================================================== void vueopengl::init() { prog.addshaderfromsourcefile(qglsha...

android - java.io.StreamCorruptedException:Wrong format:56 -

during time, develop android application, use object[input/output]stream send/receive message.the following code send method: public void sendmsg(message msg) { try { if(connectedfalg) { outputstream.reset(); outputstream.writeobject(msg); outputstream.flush(); } } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } at same time, there thread receive message time, code following: while(true) { try { message msg = (message) inputstream.readobject(); buffermanager.instance.addreceivequeue(msg); } catch (optionaldataexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (classnotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } } in project, have 3 ball...

vba - Excel count rows between 2 strings -

Image
i need place row headers in column a. vary each page need vba handle this. need count number of rows between 2 cell , serielize headers. to so need too loop thrugh column b scell = find cell in samples = count cells in between s , inspector startcell = scell + 1 loop startcell samples is correct? non-vba solution (personally feel vba unnecessary) you can use formula starting in a1 , autofill down: =iferror(if(and(match("s",b:b,0)<match(b1,b:b,0),match("inspector",b:b,0)>match(b1,b:b,0)),iferror(offset(indirect(char(column()+64)&row()),-1,0)+1,1),""),"") a few notes: this work numbers , text this not work blanks if value searching not unique, there might unexpected results now hardcoded "s" , "inspector" in this, can of course change cell reference. lets d1 , e1 (just remember use absolute references $d$1 , $e$1 : =iferror(if(and(match($d$1,b:b,0)<match(b1,b:b,...

php - Scraping data using simple html dom and simpleXML -

i'm trying scrape data several links retrieve xml file. keep getting error seem appear on of news. below can see output get http://www.hltv.org/news/14971-rgn-pro-series-groups-drawnrgn pro series groups drawn http://www.hltv.org/news/14969-k1ck-reveal-new-teamk1ck reveal new team http://www.hltv.org/news/14968-world-championships-captains-unveiled fatal error: call member function find() on non-object in /app/scrape.php on line 266 where line 266 $hltv_full_text = $hltv_deep_link->find("//div[@class='rnewscontent']", 0); full code scrape function function scrape_hltv() { $hltv = "http://www.hltv.org/news.rss.php"; $sxml = simplexml_load_file($hltv); global $con; foreach($sxml->channel->item $item) { $hltv_title = (string)$item->title; $hltv_link = (string)$item->link; $hltv_date = date('y-m-d h:i:s', strtotime((string)$item->pubdate)); echo $hltv_link; ...

if statement - Selecting elements from Data Frame which meet an if condition inside a For Loop R -

i'm working data frame inside function,and have problem in syntaxis. frame i'm working with: c id nobs 1 1 117 2 2 1041 3 3 243 4 4 474 5 5 402 6 6 228 7 7 442 8 8 192 9 9 275 10 10 148 and code i'm using. threshold=250 c (i in c[1]){ if(threshold > any(c[i,2])){ print(c[i,1]) } } what want first element of data frame condition met, result: [1] 1 2 3 4 5 6 7 8 9 10. has be: 1 3 6 8 10 any appreciated. in advance. let's call data.frame x avoid conflict of function name c . following syntax, should be: for (i in seq_len(nrow(x))){ if(threshold > x[i,2]){ print(x[i,1]) } } or simply, x[x[,2] < threshold, 1]

PostgreSQL transform json to composite type -

i'm experimenting new json functions in postgresql 9.4 , find of them usefull. example transforming composite type json in order end processes map functions result easier. but can't working other way, transforming json string object of composite type. please note functioncall to_json(...) used here simulate json string has exact structure of composite type drop type if exists mytype_1; drop type if exists mytype_0; create type mytype_0 ( id smallint, name text ); create type mytype_1 ( since timestamp, objects mytype_0[] ); select json_populate_record(null::mytype_1, to_json( row( now(), array[row(1,'name1')::mytype_0, row(2,'name2')::mytype_0, row(4,'name3')::mytype_0])::mytype_1)) the code returns error: malformed array literal: "[{"id"...

php - Restore magento quote after payment was refused -

i'm creating magento payment extension following: when user clicks on checkout in merchant site, gets redirected web site (like paypal) inputs payment data. if payment method fails, user gets redirected merchant site. however, appears quote no more active. what possibilities make possible end user reuse quote ? a few possibilities : duplicating quote if user gets back retrieve quote , set active shows again here of code use in payment model: to initialize payment method pending_payment /** * instantiate state pending_payment * @param * @param */ public function initialize($paymentaction, $stateobject) { $state = mage_sales_model_order::state_pending_payment; $stateobject->setstate($state); $stateobject->setstatus(mage_sales_model_order::state_pending_payment); $stateobject->setisnotified(false); } to redirect payment method (the url redirect remote host) /** * checkout redirect url getter onepage checkout * * @see mage_chec...

matlab - vector of indices -

i have 10x10 matrix called a: i have vector of column numbers: c = [ 2, 6, 8 ]; i have vector of row numbers: r = [1; 3; 7]; the column numbers correspond each row. i.e. column 1 looking @ row numbers given r, column 3 looking @ row numbers given r , on. i want replace exact locations in other number 13. i.e. each of these locations in matrix a: (1,2) (1,6) (1,8), (3,2), (3, 6), (3,8) want insert 13. how achieve above ? you can a(r,c) = 13 .......

scala - How to unit test Dispatch Http in an Akka actor? -

i have akka actor follows; receives message , returns http response. i having trouble testing interaction dispatch http, nice library seems difficult test. class service(serviceurl:string) extends actor actorlogging { implicit val ec = context .dispatcher override def receive: receive = { case get(ids) => request(ids) } private def request(ids:seq[int]):unit = { val requesturl = buildrequesturl(ids) val request = url(requesturl).get http(request) pipeto sender() } } one way actor: case class get(ids:seq[int]) class service(serviceurl:string) extends actor actorlogging { implicit val ec = context .dispatcher def receive: receive = { case get(ids) => request(ids) } def request(ids:seq[int]):unit = { val requesturl = buildrequesturl(ids) val request = url(requesturl).get executerequest(request) pipeto sender() } def executerequest(req:req) = http(req) ...

python - pylab.plot exists but can't be imported? -

edit: example comes directly "ein" documentation ipython notebooks in emacs: https://github.com/tkf/emacs-ipython-notebook with fresh installation of ipython on mac os yosemite: ipython python 2.7.9 (default, feb 12 2015, 17:01:13) type "copyright", "credits" or "license" more information. ipython 3.1.0 -- enhanced interactive python. ? -> introduction , overview of ipython's features. %quickref -> quick reference. -> python's own system. object? -> details 'object', use 'object??' details. in [1]: %pylab using matplotlib backend: macosx populating interactive namespace numpy , matplotlib in [2]: dir(pylab) long spew, verified 'plot' in list in [3]: pylab import plot --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-3-8618f02f2b7e> in <...

sql server - EF6 (6.1.3/ net45) Logging feature does not seem to work -

when attempt run line: mydbcontext.database.log = console.write compiler smiles , tells me don't know doing... the app won't compile because of line , error on line is: overload resolution failed because no accessible write accepts number of arguments. that makes sense. 'console.write' returns nothing , setting equal system.action(of string) this seems kind of half baked. tried numerous ways fix including delegates, , of other 'new possibilities' moving off context supposed offer still no dice. missing? changed @ last minute? i have 2 large edmx files (one connects sql server , other oracle) in solution , of working great. here version numbers if can help. entityframework 6.0.0.0 (folder ...\entityframework.6.1.3\lib\net45\entityframework.dll) entityframework.sqlserver 6.0.0.0 (folder ...\entityframework.6.1.3\lib\net45\entityframework.dll) oracle.manageddataaccess.entityframework 6.121.2.0 i have tool created lets me paste output of l2s ...

javascript - How do I specify MongoDB key/value parameters in an $http.get with an AngularJS controller? -

i'm using mean stack web app. in controller.js, have following: var refresh3 = function() { $http.get('/users').success(function(response) { console.log("i got data requested"); $scope.users = response; $scope.contact3 = ""; }); }; refresh3(); this pulls every object in "users" collection mongodb. how add parameters bring back, example, objects "name" : "bob" ? have tried adding parameters in '/users' parentheses using: $http.get('/users', {params:{"name":"bob"}}) i've tried variants of that, no luck. appreciated! if server receiving data (and should, $http.get('/users', {params:{"name":"bob"}}) correct) on server side, make use of query string: req.query like so: app.get('/users', function(req,res){ if(req.query.name){ db.users.find({"name":req.query.name},function ...

ruby on rails - Got the right node with Nokogiri, but need to search further -

i using this. doc = nokogiri::html(open(url)) pic = doc.search "[text()*='hires']" to script node: <script type="text/javascript"> var data = { 'colorimages': { 'initial': [{"hires":"http://ecx.images-joes.com/images /i/71mbtep1w9l._ul1500_.jpg","thumb":"http://ecx.images-joes.com/images /i/41xe2xadivl._us40_.jpg","large":"http://ecx.images-joes.com/images /i/41xe2xadivl.jpg","main":{"http://ecx.images-joes.com/images /i/71mbtep1w9l._ux395_.jpg":[395,260],"http://ecx.images-joes.com/images /i/71mbtep1w9l._ux500_.jpg":[500,329],"http://ecx.images-joes.com/images /i/71mbtep1w9l._ux535_.jpg":[535,352],"http://ecx.images-joes.com/images /i/71mbtep1w9l._ux575_.jpg":[575,379]} and node keeps going there.. but thing need pull out entire url contains string. "ul1500" or url follows "hires:".. ex. http:...

Display wait time WebDriverWait using selenium python -

i'm interesting in getting time waited until object clickable on page. once element clickable metric displayed showing how long took element become active. try: webdriverwait(self.driver, 10, poll_frequency=0.5).until( lambda d: self.submit_button) except timeoutexception: assert false above code using poll element, i'm looking way time waited metric out. any suggestions ? you not exact time, because have polling every n seconds , overall wait. can have average approximation. it's not selenium purposes, can use import time , example. just before executing command add: start = time.time() and right after command: end = time.time() then, needed value print end - start

angularjs - TypeScript and Angular - when to use a module vs an IIFE -

i'm starting out using typescript angular. looking through sample applications, , see .js starts iife, while other times file starts module declaration. can explain when 1 of these should used on other? when write module in typescript: module mymodule { export class example { } } the result invoked function expression: var mymodule; (function (mymodule) { var example = (function () { function example() { } return example; })(); mymodule.example = example; })(mymodule || (mymodule = {})); so can use modules in typescript make code less noisy.

templates - Prestashop remove the call us info header -

in module , tpl file can delete "call us" info , number phone appear in header template i'm using? using prestashop 1.6 go themes-> theme -> modules -> block contact -> nav.tpl edit file.

objective c - Google Map Integration in OS X Application -

i use use google map in mac application. i found ios sdk of google maps not os x. i want show 2 annotation , line connecting them on google map. coordinate of both annotation dynamic per user selection. below way find out can work: call api , pass location coordinate both annotation. now server side html form generate using javascript , create page showing 2 annotation , line connecting them. in api response url of html page. i show page in uiwebview . i want know there other way can achieve this. i want distribute application outside mac app store , distribute outside mac store need sign app developer id not support maps. i didn't find related that's why created thread. thanks in advance. you have make webkit , google maps api. mapkit available in os x 10.9 mavericks: https://developer.apple.com/library/mac/documentation/mapkit/reference/mapkit_framework_reference/index.html there of course many ways of hiding fact you're using webkit ...

jsf 2 - Invoke method with varargs in EL throws java.lang.IllegalArgumentException: wrong number of arguments -

i'm using jsf 2. i have method checks matching values list of values: @managedbean(name="webutilmb") @applicationscoped public class webutilmanagedbean implements serializable{ ... public static boolean isvaluein(integer value, integer ... options){ if(value != null){ for(integer option: options){ if(option.equals(value)){ return true; } } } return false; } ... } to call method in el tried: #{webutilmb.isvaluein(otherbean.category.id, 2,3,5)} but gave me a: severe [javax.enterprise.resource.webcontainer.jsf.context] (http-localhost/127.0.0.1:8080-5) java.lang.illegalargumentexception: wrong number of arguments is there way execute such method el? no, not possible use variable arguments in el method expressions, let alone el functions. your best bet create multiple different named methods different amount of fixed arguments. public static boolean isvaluein2(integer val...

python - Good way to upload and browse uploaded file -

i want make upload/browse file in admin django upload , insert images in editor of admin django. know choice django-filebrowser, django-adminfiles . django-filebrowser : if use pack, have install grapelli has problem vs auto slug (although native theme of django work perfectly, dont understand why) django-adminfiles : not work @ all, show error 'querydict' object has no attribute 'has_key' django when try upload file. both of them not work me. should do? look @ answer: enter link description here ,it gives use steps of django-adminfiles. hope helps out!

fingerprinting - fingerprint digital reader connected to a data base -

i wan't create system allow me connect several fingerprint reader , send data server (with arduino). i need key store on db , allow me compare other points. don't want store data on fingerprint. my real question more, if know fingerprint reader can send me instead of id stored in device. thanks lot of fingerprint sensors return "image" of fingerprint. sensors have extractor template. template list of minuitae , other info, extrated fingreprint image. fingerprint recognition done comparing template. there's open-source extractor provided nist: nbis there's lot of fingerprint sensor providers futronic , fingeprints , crossmatch , morpho , ... return fingerprint image.

To populate multiple textboxes when a DropDownList value is selected using jQuery or Javascript -

i want populate multiple textboxes value of selected dropdownlist (select list) using jquery. here code have the jquery script <script type="text/javascript"> $("#item").change(function () { $("#txtbox").val($(this).val()); }); </script> the drop down <select name="item" id="item"> <option value="1">orange</option> <option value="2">apple</option> <option value="3">grapes</option> </select> them html text boxes <input type="text" name="name" id="txtbox" /> <input type="text" name="name" id="txtbox" /> <input type="text" name="name" id="txtbox" /> , on.... from codes when select dropdown first textbox populated. want textboxes...

c - How to use popen? -

i'm trying inter process communication stdin , stdout . posix function found popen , failed write working sample code. please me work. <edit1> have use dup ? can see examples found google using it. linux manual of dup not me understanding how use that. </edit1> a.c #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void){ char *s; for(;;){ scanf("%ms",&s); printf("%s\n",s); if(!strcmp(s,"quit")){ free(s); printf("bye~\n"); exit(exit_success); } free(s); } } b.c #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void){ file *fread; file *fwrite; char *s; int i; fread=popen("~/a.out","r"); fwrite=popen("~/a.out","w"); for(i=1;i<=10;++i){ fprintf(fwrite,"%d",i); ...

Parse XML through JavaScript and get node value -

my code this var tariffdate = pricesheet.children('tariffeffdate')[1].text; where expect data inside tariffeffdate tag. gives me undefined instead. i can <tariffeffdate>1999-01-01t00:00:00</tariffeffdate> result code console.log(pricesheet.children('tariffeffdate')[1]) but when add .text data inside node giving me undefined . can point out doing wrong here? you need use node.nodevalue instead of .text . .children('tariffeffdate')[1] give htmlelement inherits node , won't give leaf node, meaning htmlelement might have multiple children. why cannot value of (technically) multiple child-nodes. can access first node calling node.firstchild . essentially, want final code be: var tariffdate = pricesheet.children('tariffeffdate')[1].firstchild.nodevalue;

java - Launch program web clients -

i'm working on intranet society. created programs. need when client clicking on <button> of web site, program launched. of programs .jar in clients's computers. need launch them arguments. know it's impossible launch cmd command website on client's desktop. possible launch programs ? clients on ie. i tryed : <script type="text/javascript"> var obj = new activexobject("wscript.shell" ); obj.run('explorer.exe /e "c:\\ton dossier"', 0, true); </script> but open me document folder (always). idea ? i found : wshshell = new activexobject("wscript.shell"); wshshell.run("c:/users/adm_adv/desktop/ouvrir.jar c:", 1, false); thx all.

php - Why construct function creates issue in codeigniter 3? -

i new codeigniter 3.x, in codeigniter 3.x when write class auth extends ci_controller { public function __construct() { parent::__construct(); echo "ya"; } } it shows me error 404 page not found page requested not found. and when write class auth extends ci_controller { public function __construct() { parent::__construct(); echo "ya"; } public function index() { echo "aya";exit; } } it works fine , shows output {yaaya}. can let me know y this? the reason behind when run url http://ip/cifolder/index.php/controller by default index() of controller if use url like http://ip/cifolder/index.php/controller/function it function of controller and if not written function in controller __construct function __construct() { parent::__construct(); } it means no index() function show 400 error

sql - delete duplicates records leaving unique in group with priority -

i have table generated procedure cannot modify , returning data so: user_id active_street street ----------- ----------- ----------------- 1 1 street1 1 0 street1 1 0 other street 2 0 other user street 2 0 other user street 2 0 other user street 2 1 other user street i need remove records table following rules: every user has only one active street. i must delete duplicates removing have active_street set 0 so i'd leave these records: user_id active_street street ----------- ----------- ----------------- 1 1 street1 1 0 other street 2 1 other user street i've tried grouping there no id column can't id's delete. how can delete duplicates without alterin...

best practice Java package design -

i'm trying figure out how design small application. application service, has files input (excel files or pdf files, represent reports 3rd party companies), , output shall generate pdf invoice various reports. these invoices sent hand report-issuing company. know how make app want, classes in 1 package "default package". i'd change that. started renaming classes, fit metaphore: "office". these current classes , interfaces: officedesk (the hub of kind-of everything) translator (opens pdf , excel files, parses them string) report (an object represents content of pdf or excel report file) reportbook (a list of reports) bookkeeper (converts report strings reports, adds reports reportbook, implements readingskill) readingskill (interface, forces bookkeeper able convert string report object) typesetter (some general string utilities) typist (converts reportbook pdf, uses typesetter, implements invoicetypingskill) invoicetypingskill (forces typist imp...

json - how to write lex file for input like "{\"a\":1,\"b\":2}" -

i want implement json parser, having problem parse object "{\"a\":1,\"b\":2}", parser output somthing '(json (object "{" (kvpair "\"a\":1,\"b\"" ":" (json (number "2"))) "}")) but want is '(json (object "{" (kvpair "\"a\"" ":" (json (number "1"))) "," (kvpair "\"b\"" ":" (json (number "2"))) "}")) i using #lang ragg , parser-tools/lex, how can write lex rules can right output. source_code change rule string-literal in lex.rkt to: [string-literal (:: #\" (:* char-literal1) #\")] note added 1.

c - Are memory addresses in assembly language statically allocated at once? -

i write c-program allocates 20,000 memory lines each line containing 8 bytes , labeled in range 2500 24999.. program simulates simple assembly language ide. 20,000 memory lines may or may not used @ once. suggest me how allocate memory locations in c program. should static allocation? visit http://screencast.com/t/69t7u0avh try unsigned char (*ptrtomem)[8]; unsigned char (*ptr)[8]; /* ... */ ptrtomem = malloc(20000*8); ptr = ptrtomem-2500; /* use ptr[2500][] ptr[24999][] */ /* when done */ free(ptrtomem); or use _alloca() (or alloca() depending on compiler) if want allocate off stack.

c# - Execute function in external assembly loaded in different appdomain -

task load and/or unload external assembly @ runtime. execute code in external assembly, passing variables external code , expecting return value. problem there no way unload individual assembly without unloading of application domains contain it. use unload method appdomain unload application domains. solution create new appdomain , load external assembly new appdomain , execute whatever code need execute in external assembly , ( optional ) destroy new appdomain afterwards. problem 2 unfortunately process not trivial , requires use intermediary proxy object can invoke method in remote appdomain without referencing object in local application domain in way (which again lock assembly local appdomain ). solution 2 creating assembly proxy (or wrapper), derived marshalbyrefobject , clr can marshal reference across appdomain boundaries. i found this piece of code doing need do, but... therefor have come stackoverflow ask can't seem figure out ...

c# - Telerik RadWindow -

Image
i'm facing issues telerik themes in wpf have added reference telerik.windows.themes.windows8 , merged resources using file app.xaml following code: <application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="/telerik.windows.themes.windows8;component/themes/system.windows.xaml"/> <resourcedictionary source="/telerik.windows.themes.windows8;component/themes/telerik.windows.controls.xaml"/> <resourcedictionary source="/telerik.windows.themes.windows8;component/themes/telerik.windows.controls.navigation.xaml"/> <resourcedictionary source="/telerik.windows.themes.windows8;component/themes/telerik.windows.controls.docking.xaml"/> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources> now want apply windows 8 style main window...

javascript - angular js maps call: url failed to load webpage the url can't be shown -

i'm trying make maps call ionic framework app. in html file use: <a ng-href="maps://?q={{dest.latitude}},{{dest.longitude}}">maps</a> <div>{{dest.latitude}},{{dest.longitude}}</div> in controller data dest looks this: {"latitude":12.34567, "longitude":1.23456} the latitude , longitude shown in div correctly. but error if click on link: failed load webpage error: url can't shown i tried cast lat , long string had no effect on it. if use static geocordinates works fine: <a ng-href="maps://?q=12.34567,1.23456">maps</a> what missing? you have add map in href sanitization white list. example code: angular.module('app',[]) .config( function( $compileprovider ){ $compileprovider.ahrefsanitizationwhitelist(/^\s*(https?|ftp|mailto|chrome-extension|map|geo|skype):/); } ); <script src="https://ajax.googleapis.com/ajax/libs/angular...

ruby on rails 4 - Intermittent "Circular dependency detected while autoloading constant" errors in production -

i have rails project that, every , then, throws exception in production, in non-reproducible manner. works in development , test, , apparently in production too, exceptionnotifier every few weeks emails me exception... i have no idea going on, i'm going dump information environment think relevant, in hopes of troubleshoot it. ruby 2.1.5 rails 4.2.1 running in heroku, regular ruby interpreter (ie. not jruby) the full error is: "circular dependency detected while autoloading constant deferredupdateshelper" deferredupdateshelper module defined in lib/deferred_updates_helper.rb , such: module deferredupdateshelper def self.something_something(params) end end i can't think of dependencies module has. it's simple, , far can tell, needs global variable called $redispool, not sure how there can circular dependency... this module used 1 of models: models/user.rb class user < activerecord::base def self.process_deferred_something defe...

android - HttpURLConnection GET method works in api 22 only in debug -

httpurlconnection method works in api 22 in debug mode, while in other apis works properly. works in approximately in 3 of 4 cases fires exception: e/http httpurlconnection:﹕ 2015/05/15 13:18:04 failed connect /10.254.254.1 (port 80) after 5000ms this code: try { url url = new url(path); urlconnection = (httpurlconnection) url.openconnection(); urlconnection.setinstancefollowredirects(false); urlconnection.setconnecttimeout(5000); urlconnection.setreadtimeout(5000); urlconnection.setrequestmethod("get"); urlconnection.setrequestproperty("user-agent", user_agent); urlconnection.setrequestproperty("content-type", "text/plain;charset=utf-8"); int responsecode = urlconnection.getresponsecode(); mfunctions.addlog(3, "http responsecode: ", integer.tostring(responsecode)); bufferedreader in = new bufferedreader( new inpu...