Posts

Showing posts from September, 2012

java - Why does my App crash? Drawer -

i have problem app doesn't start,it crashes. thankful help. :) tried use listview = (listview) findviewbyid(r.id.drawerlist); but there no elements in drawer. mainactivity.java: package com.ce.de; import android.app.activity; import android.os.bundle; import android.support.v4.widget.drawerlayout; import android.view.menu; import android.view.menuitem; import android.widget.arrayadapter; import android.widget.listview; public class mainactivity extends activity { private drawerlayout drawerlayout; private listview listview; private string[] planets; @override protected void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); drawerlayout=(drawerlayout) findviewbyid(r.id.drawerlayout); planets=getresources().getstringarray(r.array.planets); listview.setadapter(new arrayadapter<string> (this,android.r.layout.simple_list_item_1,planets)); } } act

string - PHP cURL return empty header and body despite HTTP Code 200 -

so try scrap url: xxxx.fr curl, impossible access page html code, both header , body empty. http code return 200 tried other url (different domain) , works charm. try different user agent , referer do know wrong ? @ lest can try code on own server , let me know if have same issue ? thank you below code: $url = 'http://www.xxxx.fr'; $header[] = "accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "cache-control: max-age=0"; $header[] = "connection: keep-alive"; $header[] = "keep-alive: timeout=5, max=100"; $header[] = "accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "accept-language: en-us,en;q=0.5"; $header[] = ""; // browsers leave blank $curl = curl_init (); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_httpheader, $header); curl_setopt($curl, curlopt_useragent, "

validation - Verifying format of 'date'/'timestamp'/'timestamp with time' zone type parameter in oracle script -

i need verify format of input parameter of ' timestamp time zone ' type. passed substitution variable in script. format 'yyyy-mm-dd hh24:mi:ss tzh:tzm' . how should verify passed value given format. oracle function use this? i cannot use to_timestamp_tz function convert char-exp timestamp tz. here want validate format of passed ' timestamp time zone ' variable. you can use to_timestamp_tz ex: select to_timestamp_tz('1999-12-01 11:00:00 -8:00', 'yyyy-mm-dd hh:mi:ss tzh:tzm') dual;

.net - Access violation when calling Delphi DLL from C# in a multi-threaded environment -

i calling dll function written in delphi xe2 c# using p/invoke. appears working when calls made sequentially single thread. however, when multiple threads calling function, c# host application throws system.accessviolationexception seemingly @ random. why code below trigger access violation , how fix this? minimum delphi library code reproducing problem: library pinvokeproblem; {$r *.res} uses windows, sysutils; procedure test(const testbyte: byte); stdcall; begin outputdebugstring(pwidechar(inttostr(testbyte))); end; exports test; end. minimum c# host application code reproduce problem: [dllimport( "pinvokeproblem.dll", callingconvention = callingconvention.stdcall, entrypoint = "test")] private static extern void test(byte testbyte); public static void main(string[] args) { (int = 1; <= 1000; i++) // more iterations = better chance fail { int threadcount = 10; parallel.for(1, threadcount, new parallelop

c++ - Compile libgdiplus source to create statically linked library i.e. libgdiplus.so -

i have downloaded libgdiplus source https://github.com/mono/libgdiplus/archive/master.tar.gz how should compile create statically linked library? reason behind dont want user install dependencies libgdiplus.so require run program. i tried ./configure --enable-static , ./configure ldflags=-static , checked output in /src/.libs directory did not find statically linked shared object library there. want distribute program uses embedded mono.net. thanks, omkay general : ./configure --enable-static --prefix=/usr mkdir somedir install_root=somedir make install should make things simpler searching. please beware in order no-dependencies archive, you’ll need have dependencies of libgdiplus availaible static archives. if of them installed shared objects, programs linked against on libgdiplus.a require .so dependencies @ run-time.

phpExcel - Excel found unreadable content when use formula? -

i wrote code when open excel file had error "excel found unreadable content". here code $i=8 $objphpexcel->getactivesheet()->setcellvalue('f'.$i,'=d.$i*e.$i'); $i++; where mistake? thank you! your mistake single quotes ( ' ), means php won't interpolate variables inside string , , you're not breaking out of string concatenation. use double quotes ( " ) without trying concatenate: "=d{$i}*e{$i}" or concatenate: '=d'.$i.'*e.'$i

php - Sagepay Error - 3045 : The Currency field is missing -

please not mark duplicate. have gone through previous post same issue, not able tackle error. trying upgrade sagepay protocol v2.23 v3.00 have deployed php kit provided sagepay , getting same error. below aes encryption using make compatible v3.00 in includes.php guidance appreciated. <? /* base 64 encoding function ** ** php natively consistency , ease of maintenance, let's declare our own function **/ function base64encode($plain) { // initialise output variable $output = ""; // encoding $output = base64_encode($plain); // return result return $output; } /* base 64 decoding function ** ** php natively consistency , ease of maintenance, let's declare our own function **/ function base64decode($scrambled) { // initialise output variable $output = ""; // fix plus space conversion issue $scrambled = str_replace(" ","+",$scrambled); // encoding $output = base64_decode($scrambled); // return res

javascript - Understanding momentjs timezones -

i'm using momentjs in project. to current date , time in given format i'm using this: moment().format('ddd, d mmm hh:mm'); // tue, 12 may 12:01 if output , view in browser, see tue, 12 may 12:01 . i'm in london utc+1. if did same florida, assume see tue, 12 may 07:01 (utc-4)? my question how can make sure views utc+1 time regardless of in world? think following way not sure. moment().tz('europe/london').format('ddd, d mmm hh:mm'); // tue, 12 may 12:01 hoping can explain. yup, should work: var = new date(); snippet.log("default: " + moment(now).format('ddd, d mmm hh:mm z')); snippet.log("europe/london: " + moment(now).tz('europe/london').format('ddd, d mmm hh:mm z')); snippet.log("america/new_york: " + moment(now).tz('america/new_york').format('ddd, d mmm hh:mm z')); <script src="http://momentjs.com/downloads/moment.js"></

node.js - How to specify MS visual studio version for nexe? -

i'm trying compile node.js project binary using nexe . have microsoft visual studio 2012, compiler complains can't find msvs2010 error msb8020: builds tools visual studio 2010 (platform toolset = 'v100') cannot found. in nexe's requirement section , mention msvs2012 can supported, i'd figure out way specify msvs version. i tried --msversion=2012 in npm installation no luck. appreciate advice on this.

r - Problems using the kf-function in the KFAS package -

i trying estimate local level state space model on data nile default r library. install.packages("kfas") library("kfas") #example of local level model #using nile observations data(nile) yt<-t(data.matrix(nile)) s2_eps<-15099 s2_eta<-1469.1 f.out<-kf(yt = yt, zt = 1, tt=1, rt=1, ht= s2_eps, qt=s2_eta, a1 = 0, p1=1e7) when evaluate function, error saying function kf not exist. however, kf-function should part of kfas package. hope able help. thanks

How to add nodes in TreeView control from two different Forms in C# -

Image
my program: form (form1) contains: button1 control treeview1 control form (form2) contains: burron1 control label1 control label2 control classarray public static ar2 array my aim make each element ar2 array node in treeview1 control using both forms ( form1 , form2 ). tricky thing need elements meet specific conditions added form2 . don't know how that. i added if condition pretending next element special , must added form2. if (element == "3") { form2 frm2 = new form2(counter); frm2.show(); break; } so when element equal 3 call form2 , add next element form2. on form2 need click button1 , add this special element only (in case element 4) , rest of elements have automatically added foreach loop in form1. form1 code: public partial class form1 : form { int counter = 0; public form1() { initializecomponent(); }

php - Mysql UPDATE ceased working -

please supply fresh eyes, simple script working faultlessly yesterday morning (before started jockey it) in test environment. i created new identical page gave admin ability alter 2 further fields getting blank page when script ran, copied working examples other files , still wouldn't process seemed weird, reason 1 won't process either. if point me in direction of piece of jigsaw i've deleted i'd grateful the form: <form action="scripts/editdata.php" method="post" name="pedit"> <div><input type="hidden" name="editid" value="<?php echo $id; ?>"></div> <div id="uploaddate" class="fluid"><input class="red" type="text" name="editdate" value="<?php echo $livedate; ?>" />&l

c++ why does ((1 / 2) * 2) return 0 -

this question has answer here: why division result in 0 instead of decimal? 6 answers integer division 0 [duplicate] 1 answer first time i'v posted here must know what's wrong simple peace of code: #include <iostream> using namespace std; int main() { double test = (1 / 2) * 2; cout << test << endl; return 0; } when ever run code displays 0, should casting something, happens regardless of compiler use , returns stranger results if '1' divided form of decimal. because in integer maths 1 / 2 == 0 , 0 * 2 == 0 . try 1.0 , 2.0 instead.

php - Image Resize and Upload -

i trying upload images using import.csv file. images need resized before uploading. using code uploading returning black image of given size. <?php error_reporting(e_all); include('config.php'); include('inc/header.php'); define('csv_path', ''); $csv_file = csv_path . "importimage.csv"; // name of csv file $csvfile = fopen($csv_file, 'r'); $thedata = fgets($csvfile); $i = 0; while (!feof($csvfile)) { $csv_data[] = fgets($csvfile, 1024); $csv_array = explode(",", $csv_data[$i]); $insert_csv = array(); $url = $insert_csv['url'] = $csv_array[0]; $image = $insert_csv['image'] = $csv_array[1]; $raw = file_get_contents($url . $image); /*resize using gd*/ /* * php gd * resize image using gd library */ // file , new size //the original image has 800x600 $filename = $raw; //the resize percent of original size $percent

javascript - To delete a variable from req.body in NodeJS ExpressJS -

i receive json lot of information want delete particular data, example, if receive variable name, want remove variable before adding json in database. function post: app.post("/:coleccion", function (req, res, next) { post if(req.body.name) // here need delete "name" if receive variable <------ req.collection.insert(req.body, {}, function (e, result) { if(e) return next(e); res.send(result); }); }); delete req.body.name should work in javascript object check how remove property javascript object?

css - How to get background-url in Python? -

i trying background url property in python selenium webdriver. works fine 'color' , 'position' properties not 'background' or 'background-url'. home = driver.find_element_by_id("link-home") print(home.value_of_css_property("position")) => absolute can me? this css: #main-header a#link-home { background: url("data:image/png;base64,ivborw0kggoaaaansuheugaaab8aaaatcayaaabobnzcaaaagxrfwhrtb2z0d2fyzqbbzg9izsbjbwfnzvjlywr5ccllpaaaaofjrefuenpiplrnnqmr4d8qm2ktshuoysaxmbfpmtknlp6fgqlarktfjdgcweary5et5qefa5iisngdio9baao6gimaxx5avbgihac0h66erw3lks0ob2jqvmcdirfb+ehucgatdostghgpksumsa5ycpuho+dw3jx/kbuc2ei0ij4pxmxqpgjpqmizq+xtkhuae5rfoua8e0l+jhj/jha5fgahq7ydgjfkugogbkgxr7iohudkrwe6ojxsog/bkfl/q4myv4nwqsvilwaahvc04ckhafq80hymwj7ylacimadiujmyhco+maaaaabjru5erkjggg==") no-repeat scroll 0px 0px transparent; left: 10px; padding-left: 23px; position: absolute; top: -102px; color: #dfeffc; } i'

javascript - DataTables.js not loaded -

di'm using datatables.js on web mvc application. here's links: <link href="@url.content("~/content/datatables/jquery.datatables.css")" rel="stylesheet" type="text/css" /> @scripts.render("~/bundles/jquery"); <script type=" text/javascript" src="@url.content("/scripts/datatables/jquery.datatables.min.js")"></script> <script type="text/javascript" src="@url.content("/scripts/datatables/tables/table.js")"></script> i can't understand, jquery library loading twice(2times catch breakpoint), jquery.datatables.min.js - not loading. checked sources in browser - correct - js files in place. i catch error message when trying show grid: var dataset = [ ['trident', 'internet explorer 4.0', 'win 95+', '4', 'x'], ['trident', 'internet explorer 5.0', 'win 95+', '5

logback - embedded tomcat valve spring boot -

i'm trying configure logbackvalve getting access logs in case spring boot based web application running embedded tomcat. following code configuration: import javax.servlet.servlet; import org.apache.catalina.startup.tomcat; import org.springframework.beans.factory.annotation.value; import org.springframework.boot.autoconfigure.condition.conditionalonclass; import org.springframework.boot.autoconfigure.condition.conditionalonproperty; import org.springframework.boot.autoconfigure.condition.conditionalonbean; import org.springframework.boot.context.embedded.tomcat.tomcatembeddedservletcontainerfactory; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import ch.qos.logback.access.tomcat.logbackvalve; @configuration public class embeddedtomcatconfigurator { @bean @conditionalonclass({ servlet.class, tomcat.class }) @conditionalonbean(value = logbackvalve.class) public tomcatembeddedservletconta

notepad++ - Add character to date format using regex -

how add e.g. - or . date format 2006 05 12 using regex in notepad++ in notepad++ press ctrl+h find what: (\d{4})\s(\d{2})\s(\d{2}) replace with: \1-\2-\3 . (\d{4}) \d means digit {4} 4 times () able refer group in brackets number - \1

Node.JS windows service cannot start -

i'm using windows-service package run script windows service. if (process.argv[2] == "--add") { logger.info('starting add service', global.approot + "\\app.js") ws.add (config.service_name, {programpath: global.approot + "\\app.js"}); logger.info('service added', config.service_name, global.approot + "\\app.js") } else if (process.argv[2] == "--remove") { logger.info('removing service', config.service_name) ws.remove (config.service_name); logger.info('service removed', config.service_name) } else if (process.argv[2] == "--run") { logger.info('starting service', config.service_name); ws.run (logger, function() { logger.info('stopping service', config.service_name); ws.stop() logger.info('service stopped') }); } else if (process.argv[2] == "--stop") { logger.info('stopping servic

c# - Getting element from a client list -

i have client connection class in c#. client connection instance created every new client , add list has client id (identifier client) , client connection instance. public sortedlist<uint, clientconnection> clientlist { get; set; } public void addclienttosortedlist(uint clientid, clientconnection clientconnection) { if (!clientlist.containskey(clientid)) clientlist.add(clientid, clientconnection); } now issue have client connection object. need map client list client id particular client. i thought of using ip address , calculating ip address of clients in list , comparing , client id concerned client not getting idea how that.

c# - How to read username which is logged in by VPN in asp.net -

i have requirement when remote user log in using vpn , asp.net application must able read username. i want read username loging in vpn , asp.net application works inside vpn. note: username not same active directory , windows user, don't want read windows user id. i have tried thing shown in link have provided, returning windows login id , need vpn user id user login vpn site first vpn.xxx.xxx , provide user name , password , comes application. @ login of application want use vpn user id

cordova - Failed to install 'plugin.google.maps':Error: Variable(s) missing: API_KEY_FOR_ANDROID -

i have ionic project works fine, when try run ionic platform add android i error : failed install 'plugin.google.maps':error: variable(s) missing: api_key_for_android @ c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js: 299:23 @ _fulfilled (c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54) @ self.promisedispatch.done (c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\q\q.js:8 16:30) @ promise.promise.promisedispatch (c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\q\ q.js:749:13) @ c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\q\q.js:557:44 @ flush (c:\users\rsone\appdata\roaming\npm\node_modules\cordova\node_modules\q\q.js:108:17) @ process._tickcallback (node.js:419:13) even got same error while installing google map plugin. installed phonegap method rather cordova way. first if

performance - Fuzzy Problems in Solr Filter Query -

it grateful if can me problem. have query: select?q=city:frankfurt main~&fq=street:gerhart-hauptmann-str.~ this not working me. want use fuzzy search catch user input mistakes. here want: frankfurt main should searched in field city fuzzy search gerhart-hauptmann-str. should converted 3 terms fuzzy search. debug output of actually: "debug": { "rawquerystring": "city:frankfurt main~", "querystring": "city:frankfurt main~", "parsedquery": city:frankfurt text:am text:main~2", "parsedquery_tostring": "city:frankfurt text:am text:main~2", "explain": {...}, "qparser": "luceneqparser", "filter_queries": [ "street:gerhart-hauptmann-str.~" ], "parsed_filter_queries": [ "street:gerhart-hauptmann-str.~2" ], i (think) want output: "debug": { &quo

c - using variable in initialization of same variable -

i fell on little thing while coding: char* strinit(char* str) { str = (char*) malloc(100); strcpy(str, "hello so"); return str; } int main() { char* str = strinit(str); return 0; } as can see, using same variable declaring initialize it. no problem. tried same thing in java. causes errors. so question is: there problems doing this? can use in code in conscience? c & c++ consider char* str = strinit(str); legal; because evaluated to: char* str; str = strinit(str); see why 'int = i;' legal?

sql server - How to convert row to column in SQL? -

Image
i have stored procedure (join 2 tables , select condition @gid ), want convert table result rows columns. use dynamic pivot query. my stored procedure: after try using pivot i want result this: group_mod_id add edit delete etc... --------------------------------------- g02 1 1 0 .... can give me advice ? thank you. it's because you're using batch delimiter separate queries. means scope of @gid incorrect. remove semi colon after: declare @pivot_cols nvarchar(max); you don't need use batch delimiters in case. logical flow of procedure means can omit them without problems. edit: here's edited code i've devised: alter procedure get_column_value @gid char(3) begin declare @pivotcols nvarchar(max) select @pivotcols = stuff((select distinct ' , ' + quotename(b.function_mod_name) function_group join function_mod b on a.function_mod_id = b.function_mod_id a.group_mod_id =

Exited on signal 11 (nginx + php-fpm) -

i'm creating php script. script receive post data , process it. i found error in /var/log/php5-fpm.log [11-may-2015 15:34:03] warning: [pool www] child 2553 exited on signal 11 (sigsegv - core dumped) after 6943.521858 seconds start [11-may-2015 15:34:03] notice: [pool www] child 3882 started core dumps: warning: can't read pathname load map: input/output error. [thread debugging using libthread_db enabled] using host libthread_db library "/lib/i386-linux gnu/libthread_db.so.1". core generated ` '. program terminated signal 11, segmentation fault. #0 0x083dce46 in ?? () gdb backtrace: #0 0x083dce46 in ?? () #1 0x083e5074 in ?? () #2 0x083ed718 in ?? () #3 0x083e494f in ?? () #4 0x082c1df1 in php_log_err () #5 0x082c226e in ?? () #6 0x081c13cb in ?? () #7 0x0832a7b7 in zend_error () #8 0x083b7ff6 in ?? () #9 0x083b921f in ?? () #10 0x083957a5 in execute () #11 0x0832b5f9 in zend_execute_scripts () #12 0x

html - ul renders below the div containing them -

how put ul above div? tried adding z-index or modify position attribute, neither worked. div code: .wrapper-dropdown-4 { position: relative; width: 368px; margin: 0 auto; padding: 7px 10px 5px 10px; font-size:12px; background: #fff; border: 1px solid #ccc; border-radius:4px; cursor: pointer; outline: none; z-index:50; } ul code: .wrapper-dropdown-4 .dropdown { position: absolute; top: 100%; margin-top: 1px; left: -1px; right: -1px; background: white; border: inherit; border-top: none; list-style: none; display: none; pointer-events:visiblefill; } ul code when div active: .wrapper-dropdown-4.active ul { overflow-y:auto; max-height: 185px; display: block; pointer-events: visiblefill; } html code: <div class="wrapper-dropdown-4"> <p></p> <ul class="dropdown"> <li></li> </ul> </div>

machine learning - Standardize/decompose training/test together or separately? -

two common ml preprocessing steps on x data standardization (e.g. scale unit variance) , decomposition (map features new space, aiui). two possible ways of implementing these steps in ml pipeline including training/test/validation sets : i) standardize/decompose on entire training/test/validation x data set, break training/test sets , make predictions on validation set using lowest error model. ii) break training/test sets, then standardize/decompose training/test sets separately, , make predictions on validation set using lowest error model (after standardizing/decomposing it) is 1 of these approaches more preferable other, , why? i think third option valid: split test/training set, compute parameters standardization/decomposition on training set (e.g. mean , variance of training set standardization) , apply same parameters on test set. for standardization mean, test set not have 0 mean / unit variance. looking @ test set transform training set considered b

javascript - Regexp with accented characters on match -

this question has answer here: how ignore acute accent in javascript regex match? 3 answers ignore accent in regex [duplicate] 3 answers i have check forbidden words in text area when user tries validate. forbidden words list stored in jsblacklist array, , part of code far : var fieldvalue = value; var hasforbiddenword = false; (i = 0; < jsblacklist.length; i++) { var regex = new regexp("\\b"+jsblacklist[i]+"\\b","gi"); fieldvalue = fieldvalue.replace(regex, '***'); hasforbiddenword = hasforbiddenword || fieldvalue.match(regex); } value = fieldvalue; but problem is, jsblacklist has accented characters, while user write without accent (for example, jsblacklist can have "déjà", , user has typed "deja",

javascript - Disable/enable checkboxes based on its values and selected option -

i need hardcode of values of checkboxes enabled/disabled, depending on selected option value. trying this: $("#units").on("change", function () { if ($(this).val() !== "finance") { $(".dissable").val("3").prop("disabled", true); $(".dissable").val("4").prop("disabled", true); } else { $(".dissable").val("3").prop("disabled", false); $(".dissable").val("4").prop("disabled", false); } }).trigger('change'); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <select id="units"> <option value="marketing" > marketing </option> <option value="finance" > finance </option> <option value="operations" > operations </option> </select> &l

c# - How to fix OutOfMemoryException for PerformanceCounterCategory.GetInstanceName -

if execute code performancecountercategory cat = new performancecountercategory("process"); var instances = cat.getinstancenames(); // outofmemoryexception i outofmemoryexception full stack trace is a first chance exception of type 'system.outofmemoryexception' occurred in mscorlib.dll system.outofmemoryexception: exception of type "system.outofmemoryexception" occured. @ microsoft.win32.registrykey.internalgetvalue(string name, object defaultvalue, boolean donotexpand, boolean checksecurity) @ microsoft.win32.registrykey.getvalue(string name) @ system.diagnostics.performancemonitor.getdata(string item) @ system.diagnostics.performancecounterlib.getperformancedata(string item) @ system.diagnostics.performancecounterlib.get_categorytable() @ system.diagnostics.performancecounterlib.getcategorysample(string machine, string category) @ system.diagnostics.performancecountercategory.getcounterinstances(string categoryname, string m

javascript - Transition not working without querying width property -

i want animate translatex transition on click event adding class div in js. transform , transition properties added in css file. var widget = document.getelementbyid('widget'); widget.style.display = 'block'; document.getelementbyid('widget2').clientwidth; //comment line out , wont work widget.classname = 'visible'; it works if query width property of any element in dom before adding class. here jsfiddle: https://jsfiddle.net/5z9flsr5/2/ can explain why not working? that's because begin transition , modified display property "at same time". altering display ruin transition (citation needed, admittedly), idea isolate display changing , actual transiting: https://jsfiddle.net/5z9flsr5/3/ document.getelementbyid('showwidget').addeventlistener('click', function(e) { e.preventdefault(); var widget = document.getelementbyid('widget'); widget.style.display = 'block

oracle - SQL : don't show columns with non data -

i have sql output this t1.column1 t1.column2 t2.column3 t2.column4 ... #1blabla blabla blabla blabla .. #2blabla blabla blabla .. i write sql statement shows rows have data in column3. in case, row #2 should not shown. any ideas? i got far: select * table1 t1, table2 t2 t1.id = t2.id use is not null ! select * table1 t1 join table2 t2 on t1.id = t2.id t2.column3 not null; re-wrote modern join syntax.

c++ - Char* Array Memory Leak -

i having issues de-allocating memory used in char* array. in code snippet below, creating char* array named input holds pointers single words @ time followed pointer null @ end of array. time (i believe) allocate memory in code. char* input[999]; //exec commands for(unsigned int = 0; < commands.size(); i++) { string current = ""; string word = ""; int k = 0; for(unsigned int j = 0; j < commands.at(i).size(); j++) //iterate through letters { current = commands.at(i); //cout << "current: " << current << endl; if(current[j] == ' ') { input[k] = new char[word.size() + 1]; strcpy(input[k], word.c_str()); k++; word = ""; } else word += current[j]; //add letter //cout << "word: " << word << endl; } input[k] = new char[word.size() + 1]; st

save barcode image in require directory php -

i working on barcode project in php. issue when click test.php, barcode image save in same directory php file directory: /demo1/demo2/demo3/demo4/file1/file2/file3/barcodeimage.png /demo1/demo2/demo3/demo4/file1/file2/file3/test.php but need save barcodeimage.png in path: /demo1/demo2/demo3/demo4/image1/image2/image3/barcodeimage.png i change directory name convenience here code: <?php $codetexttwo = '1234567890.png'; $drawexception = null; try { $color_black = new bcgcolor(0, 0, 0); $color_white = new bcgcolor(255, 255, 255); $code_generated = new $classname(); if (function_exists('basecustomsetup')) { basecustomsetup($code_generated, $default_valuetwo); } if (function_exists('customsetup')) { customsetup($code_generated, $default_valuetwo); } $code_generated->setscale(max(1, min(4, $default_valuetwo['scale']))); $code_generated->setbackgroundcolor($color_white); $code_

asp.net - send entire details through email -

i want send student details company mail id .here have used grid view in grid view display student details along check box. when click particular row in grid view, details send through smtp protected void button1_click(object sender, eventargs e) { using (sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["connectionstring"].connectionstring)) { sqlcommand cmd = new sqlcommand("select email details", con); con.open(); sqldatareader rdr = cmd.executereader(); while (rdr.read()) { string email = rdr["email"].tostring(); sendemail(email); } } } private void sendemail(string toemail) { string stremail=string.empty; mailmessage mailmessage = new mailmessage("raj@gmail.com", toemail); stringbuilder sbemailbody = new stringbuilder(); try

linux - Can't run parallel jobs in Heritrix3 Web Crawler -

i created 2 jobs in heritrix 3.2.0 , launched both after building, both started running after 15 20 seconds, 1 job stopped , other continues , when job stopped, status in jobs log follows: 2015-05-12t06:40:33.715z info empty 20150512063923 so not multi-process jobs. how fix it? no means job done (queue empty). if no pages downloaded, means decide rules strict , don't allow downloaded.

javascript - Difference between custom event and postMessage -

in order send message document (let's iframe ), can use both postmessage , createevent functions. assume this: var event = document.createevent('customevent'); event.initcustomevent("message", true, true, 'hello world'); iframe.dispatchevent(event); my question is, if both approaches work, difference between using postmessage , customevent ? it's difference between leaving neighbour message asking them turn down tv, , breaking apartment , turning down tv yourself. you can't dispatch event frame not allowed access same origin policy or access-control-allow-origin, since of messages might mess how page works. messages intended communication between different pages - if don't want listen message, don't have to. another difference messages must serialisable, events not have be.

javascript - Difference between $location.path("/home") and $location.$$path="/home" in angularjs -

i have login page , home page in sample poc. when user completed signed in, have redirect home page login page. i have tried below codes redirecting home page login page using angular.$location code 1 $location.path("/home"); this code working good.no issues. code 2 $location.$$path="/home"; this code not working probably, because page redirected, url shown previous url, does not changed redirected url . why happened? what difference between code1 , code2 angular uses single dollar ($) of api methods, properties, , event names. methods considered "public" , safe use developers. documented , not change much, if change angular team tell it. when see 2 dollars ($$) you're best off leaving alone. can of course use them way want (debugging use), shouldn't need to. if use them own purposes there's no guarantee there on next minor version update code becomes more brittle.

javascript - IE 9 getting hanged up with data jQuery data table 1.1.9 -

i using jquery datatable1.1.9, it's working , getting stuck ie9. want improve performance. dealing 9000-10000 records please suggestion me.. ie versions 9 , below notorious problems table rendering speed. usual suggestions are: set table-layout css attribute fixed on table. explicitly define col objects each column. set width attribute on each col. i'm not sure if of these achieved datatables though.

dll - Interprocess communication with Matlab on Windows -

i'm building game in unity3d integrates code in matlab. i'm looking 1-way communication channel unity3d matlab on 1 computer. the message short string. the frequency of these messages low. example: i start game in unity3d. at start, unity3d send out 'message1' matlab 30 seconds later unity3d sends out 'message2' matlab 30 seconds later unity3d sends out 'message3' matlab i know programming knowledge not advanced enough own. i've been doing ton of research , need advice on focus efforts on. don't need sort of authentication protocol because i'm using 1 computer. based on description above ipc think should use , why? need direction on focus work on because not advanced. dll share memory between 2 processes tcp sockets udp sockets (what's difference tcp socket in case?) (i can't use named pipes because unity3d not support it.) what want use matlab engine api. see : http://www.mathworks.com/help/

javascript - Formstone asap.js proper usage in wordpress -

i trying use asap.js (docs: http://formstone.it/components/asap/ ) component on wordpress site. plugin provided formstone set of useful scripts. can't figure out how address wordpress content using script. i tried code doesn;t seem work nor have errors in chrome's console. can provide me simple example, can start with? jquery(document).ready(function ($) { var $content, $deferred; $(document).ready(function() { // bind asap events $(window).on("request.asap", pagerequested) .on("progress.asap", pageloadprogress) .on("load.asap", pageloaded) .on("render.asap", pagerendered) .on("error.asap", pageloaderror); $content = $(".mypagewrapper"); // init asap $.asap({ cache: false, selector: "a:not(.no-asap)", transitionout: function() { if ($deferred) { $deferred.reject(); }

git merge - Git reset (not hard) then fast forward merging of certain commit -

the case: branch commit1 -> commit2 -> commit3 -> commit4 the head in commit4. i reset (not hard) commit1 , use commit1 base implement whatever changes done in commit4. so end result is: commit1 -> commit4 is there git command that? or should rollback commit1 , implement changes done in commit4 manually? thanks! it is clear me, based on question, want commit sequence read: ... <- c1 <- new-c4 <-- branch (remember, arrows point towards past history, not forward future). it's not clear me whether want new commit (which call new-c4 above) keep source way in old c4 , or whether want discard changes made in c2 , c3 while keeping changes made in c4 . you can achieve latter result using git rebase , keep in mind usual caveat should never rebase published commit. make happen, run: git rebase -i head~4 this bring editor session can keep or discard specific commits. see answer linked in martin konecny's comment , or bar

java - How will this code affect a linked list? -

i have code , want make sure understand how affect linked list. coded , printed first number of list in case 4. list [4,7,1,7,2,0], code make list become [4]. node x = head; while (x != null) { while ((x.next != null) && (x.next.item >= x.item)) { x.next = x.next.next; } x = x.next; } i'm not sure i'm understanding why, , that's if code correct. given code presumably i'm supposed understand without coding it. i suspect that: x.next = x.next.next; should x = x.next;

html - Gifs wont appear on website -

i'm making small website 1 of classes, want put 2 gifs , 2 images in 1 table 2x2 reason show tiny red boxes, css on page creates red border i'm assuming that's showing css. <html> <head> <title> hype! hype! hype! hype! hype! hype! hype! hype! hype! </title> <meta name="description" content ="website game mirrors edge 2" /> <meta name="author" content="---" /> <meta name="copyright" content="&copy;2015" /> <!-- specify base formatting style sheet file--> <link rel="stylesheet" type="text/css" href="base.css" /> <!-- specify local formatting style sheet page--> <style> body {background-color : light-grey; color : silver;} </style> </head> <body> <table> <caption> mirrors edge 2 </caption> <tr> <td><a href="home.html"> home </a>&

android - How to show fixed number of items of rows in a recyclerview -

i'm trying menu footer have 10 button , can horizontalscroll. so use recyclerview that. want footer default show first 5 items in screen screen size , user can scroll this. so have question how show fixed number of items of rows in recyclerview ? how set distance of 2 items in list recyclerview ? thanks read.

vm.$on undefined error in angularjs -

i following best practice style guide angular development , can't seem 1 part working cleanly. best practice style guide: https://github.com/johnpapa/angular-styleguide it recommends declare controllers following: angular .module('app') .controller('feedcontroller', feedcontroller); function feedcontroller(){ var vm = this; //my $scope variable } the problem trying use $on add event listener gives me undefined error vm.$on . temporary solution found inject $scope controller following: feedcontroller.$inject = ['apiservice', '$scope']; and call $scope.$on works feel inconsistent now. there way still use vm in clean way. you can see full controller here https://github.com/bliitzkrieg/trailerfeed/blob/master/app/components/feed/feedcontroller.js this / vm refers instance of controller , not scope associated controller. events exist on scopes, use event system correct inject $scope reference controller's s

Convert factory to service in Angularjs -

i'm using $resource fetch json server working fine: topicservices.factory('topic', ['$resource', function($resource){ return $resource('http://localhost/topic_api_response.json', {}, { fetchdata: {method:'get', isarray:true} }); }]); however, want convert factory service doing this: topicservices.service('topic', ['$resource', function($resource) { this.fetchdata = function() { var resp = $resource('http://localhost/topic_api_response.json'); return resp; }; }]); in doing so, i'm not able figure out specify request method ( get/post ) , give get/post params going "service" style of defining, should read angular docs. anyways here how go: have separated out fetchdata method, seems hit http get. hence can write code follows. topicservices.service('topic', ['$http', function($http) { this.fetchdata = func

git - Avoid re-entering password for each submodule -

i have repo 3 submodules. repo , submodules on same server, have ssh access to. remote urls are: ssh://matt@theserver.com/path/to/sub1.git ssh://matt@theserver.com/path/to/sub2.git ssh://matt@theserver.com/path/to/sub3.git if operation such git submodule update --remote prompts password 3 times. is there way update submodules require password once? same goes committing changes etc. one solution might adding machine ssh public key authourized_keys file of server. after that, not asked password. this possible if have server access. this how it copy public key, present @ ~/.ssh/id_rsa.pub append key ~/.ssh/authorized_keys file in server. after that, can connect server without password

Prevent page load after javascript confirm dialog -

on results portion of employee registration page, need check duplicates prior completing registration. so, variables posted results page , query database 3 different ways find similarities: 1st case: if same ssn, show confirm box either redirects existing chart if ok clicked or redirects registration "try again" if cancel clicked. 2nd , 3rd case: if registrant has last name or first name plus same date of birth of in database, choice given - ok redirects list of persons or cancel continue results page , register new employee. the 1st case works fine because in either case redirecting away results page. second , third cases though, if ok clicked, page redirected not before completing registration - don't want happen. here's code: /*primary check*/ $sql_personnel_check = mysqli_query($globals["___mysqli_ston"], 'select * personnel ssn = "'.$ssn.'"'); $count = mysqli_num_rows($sql_personnel_check); if ($count > 0)

.htaccess - Rewrite single GET variable in folder -

i have page example.com/art/?artist=name want example.com/art/name . i've tried multiple rewrite conditions , rules, none working. examples... rewriteengine on rewriterule ^([^/]+)/? /art/index.php?artist=$1 [l,qsa] rewritecond %{query_string} (.*?)artist=(\w+)(.*) rewriterule ^ /%2?%1%3 [l,r=301] another... rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^users/([^/]+)$ /users/$1/ [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^users/([^/]+)/$ users/index.php?id=$1 [qsa] i'd love have understanding of how works - right now, have no idea how .htaccess file does. you close rewriteengine on rewritecond %{query_string} artist=([^&]+) rewriterule ^art/$ /art/%1 [r=301,l,qsa]