Posts

Showing posts from July, 2012

c - Void function error (value computed is not used) -

hi have tried couple variations of code , can't figure out how resolve these warnings. the objective create modular representation of monty hall problem in c problem my outputfinalresult function fails give me correct output error messages - gcc -wall monteball.c monteball.c: in function ‘determineoutcomestay’: monteball.c:125:7: warning: value computed not used [-wunused-value] monteball.c:127:3: warning: value computed not used [-wunused-value] monteball.c: in function ‘determineoutcomeswitch’: monteball.c:134:7: warning: value computed not used [-wunused-value] monteball.c:136:3: warning: value computed not used [-wunused-value] monteball.c: in function ‘getfinalchoice’: monteball.c:119:1: warning: control reaches end of non-void function [-wreturn-type] an aside should worried warning? code void outputfinalresult (int winstay, int winswitch, int staycount, int switchcount); //function 4 print statements using arguments calculated determineoutc

IOS file upload encountering stream error -

Image
i use parse backend , create ios app uploading images. when upload using wifi network there no problem, encountering file upload error when using 4g/3g network. encountered stream error: error domain=nsposixerrordomain code=54 "the operation couldn’t completed. connection reset peer" although catch error in code alert view didn't show up, shows "upload fail" in log. pffile *file = [pffile filewithname:filename data:filedata]; [file saveinbackgroundwithblock:^(bool succeeded, nserror *error) { if (error) { uialertview *alertview = [[uialertview alloc]initwithtitle:@"an error occured!" message:@"please try submiting item again." delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alertview show]; } the data in backend looks this: as can see, successful upload file name image.jpg, unsuccessful ones, shows unknow string. it network problem, can please ensure speed netw

How to configure Mule Properties Editor in Mule Studio -

i have usecase , need encrypt values presented in properties file under src/main/resources. mule provided concept called mule credentials vault. in document there place can open properties file in "mule properties editor" view. can please let me out configured in local mule studio. thanks. regards vikram as per vikram need install plugin first .you can descripotion in below link https://developer.mulesoft.com/docs/display/current/mule+credentials+vault and can find example application in below link https://developer.mulesoft.com/docs/display/current/anypoint+enterprise+security+example+application

ios - "argument contains uninitialised data" when setting frame -

i new ios development , handling memory leaks. in project while analysing project got memory leaks. not fix below logic error @ below code. cgrect labelframe; if ([questonmod.questiontype isequaltostring:@"type1"]) { nooflinesint=questonmod.questiontext.length/20; if (nooflinesint<1) { nooflinesint=nooflinesint+2; } else { nooflinesint=nooflinesint+1; } labelframe= cgrectmake(5, 0, cell.frame.size.width-10, nooflinesint*18); } else if([questonmod.questiontype isequaltostring:@"type2"]) { nooflinesint=questonmod.questiontext.length/10; if (nooflinesint<1) { nooflinesint=nooflinesint+2; } else { nooflinesint=nooflinesint+1; } labelframe= cgrectmake(5,0,cell.frame.size.width-155,nooflinesint*16); } cell.questionlabel.frame=labelframe; //at line got below error. i getting "passed-by-value struct argument contains uninitialised data(e.g., via fiel

python - Django-administration css file not rendered -

i using django administration basic crud . admin template loads , css files loaded showing no effect @ all. i tried collect static files below manage.py collectstaic it shows following errors traceback (most recent call last): file "c:\python27\lib\site-packages\django\bin\hello\manage.py", line 10, in module> execute_from_command_line(sys.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line utility.execute() file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 272, in fetch_command klass = load_command_class(app_name, subcommand) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 76, in load_command_class return module.command()

java - JOptionPane not showing up (null parameter, called from inner class) -

i new java, trying make simple application , there no way can joptionpane show correctly , guess missing something: here's code: import java.awt.color; import java.awt.window; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jframe; import javax.swing.jmenu; import javax.swing.jmenubar; import javax.swing.jmenuitem; import javax.swing.joptionpane; import javax.swing.jpanel; public class frame extends jframe { private static final long serialversionuid = 1l; final static int width = 400; final static int height = 400; public frame() { super("convert dxf alpha ver. - survey apps 2014"); setdefaultcloseoperation(exit_on_close); setsize(width, height); setresizable(false); setlocation(100, 100); setbackground(color.white); setvisible(true); welcomepanel welcomepanel = new welcomepanel(this); add(welcomepanel);

actionscript 3 - How to force debug player not to launch a debug window, but silently output a message -

i want test cpu intensive swf file in firefox browser. problem whenever unhandled error encountered, shows debug window. trying handle each , every error,but becomes difficult because @ each error, browser hangs completely. , have restart. so, there way, eg. through compiler etc, can tell debug player, not show in window, , halt process, other way show output ? i use general try..catch block. still many times, window pops up. seems like, try..catch block not work in every case. here simple example : code, lists files in directory, list component. when clicked, selected file, must load. so, there no problem swf or picture files ( jpg, png etc). say, click upon "fla" should not load. error window pops unpredictably : error #2044: unhandled ioerrorevent:. text=error #2124: loaded file unknown type. var loader:loader =new loader(); loader.contentloaderinfo.addeventlistener(event.complete,doneload); loader.contentloaderinfo.addeventlistener(ioerrorevent.io_error,loading

html - change innertext without affecting dom elements in Javascript (not jquery) -

i need inside firefox extension, not using jquery, here code: var label = document.createelementns(xul_ns, "label"); // create new xul label label.setattribute("value", actionlabel); label.setattribute("class", "label-title"); var description = document.createelementns(xul_ns, "description"); description.setattribute("id", actionid); description.appendchild(label); description.innerhtml=actiontext; output should be: <description id=actionid> <label class="label-title" value=actionlabel/> long section of text word wrap when displayed. </description> this did job: description.insertbefore(label,description.firstchild);

ios - RSA Encryption using existing public key -

i trying encrypt nsdata following method: - (nsdata *) encryptwithdata:(nsdata *)content { size_t plainlen = [content length]; void *plain = malloc(plainlen); [content getbytes:plain length:plainlen]; size_t cipherlen = 256; void *cipher = malloc(cipherlen); osstatus returncode = seckeyencrypt("public key here", ksecpaddingpkcs1, plain, plainlen, cipher, &cipherlen); nsdata *result = nil; if (returncode != 0) { nslog(@"seckeyencrypt fail. error code: %ld", returncode); } else { result = [nsdata datawithbytes:cipher length:cipherlen]; } free(plain); free(cipher); return result; } where written "public key here" want load existing public key copied bundle. how can that? for example use certificate file contains public key: nsdata *certificatedata = [nsdata datawithcontentsofurl:certificateurl options:0 error:&error]; if (certificatedata) {

c - Why doesn't compiler remove the useless loop? -

if have code such as int main() { int i, j, k; int sum = 1; (i = 0; < size; i++) { (j = 0; j < size; j++) { (k = 0; k < size; k++) { sum = -sum; } } } printf("hello, world\n"); return 0; } the optimize code still appears going through loops. why doesn't compile remove because doesn't affect print or return statements? it appears gcc remove long specify -o2 gcc -wall -o2 i compiling (no optimization) gcc -wall

android- dropbox download files -

i working on android app support android dropbox api. sending files dropbox folder.now want download files , save sdcard. @ moment when trying download files gives me error dropboxserverexception (nginx): 404 not found (file not found) here code public void downloadfiles(string filename){ log.i("filename ",filename); file mfile=new file(environment.getexternalstoragedirectory().getpath() + "/download1"); try { fileoutputstream mfileoutputstream=new fileoutputstream(mfile); dropboxfileinfo mdropboxfileinfo=mapi.getfile(filename, null, mfileoutputstream, null); } catch (filenotfoundexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (dropboxexception e) { // todo auto-generated catch block e.printstacktrace(); } } filename printing on logcat. , file in photos folder in dropbox. not able downloa

Windows store app C# XAML - Listview scroll position not maintained when app is resumed -

i'm writing windows store app using c# , xaml. 1 of pages split page listview user can select item , details item displayed in "details card" next list. the problem listview doesn't maintain scroll position when suspend , shutdown visual studio , resume app. item selected gets selected , it's details shown scroll position not updated. works fine suspend , resume. when save state of page upon suspend save selected items index in list. when app resumed let loadstate movecurrenttoposition(selectedindex) selectedindex saved index. makes correct item selected. i've tried using scrollintoview update scroll position no effect. had same problem search functionality in case scrollintoview solved problem. have else encountered problem? known problem , can when scrollintoview doesn't work?

javascript - Optimize route by distance -

i building here maps based web application. main features include ability upload spreadsheet file (.xls, .xlsx) server , plan route addresses in file, 500 waypoints. of course, these waypoints aren't way in optimized order, i'd let user click on "optimize route" button , optimize distance. for example if file has these 3 addresses: new york san francisco long island the route default go ny sf, li. the application check distances , reorder waypoints array in way this: ny -> li -> sf my question: there built in route optimization function in here maps, or should write own? you should take @ matrix routing api (sign-in required). calculate "real" distance between each of n x m locations. information, have reduced issue travelling salesman problem . of course, tsp np-complete, can't you've got optimal answer unless use brute force algorithm. personally i'd @ nearest neighbour solution - quick, simple code , re

linux - Change the default port(22) SSh [CENTOS] -

i trying change d default port (22) system, edited sshd_config file changing desirable port no (5555) , restarted service seem not work . there else have change? thanks yes, must allow new port in iptables. iptables firewall program linux. with root privileges need this: iptables -i input 1 -p tcp --dport 5555 -j accept make sure can connect using port 5555 disable old port. iptables -a input -j drop -p tcp --dport 22 then save new settings /etc/init.d/iptables save check out webpage more information: http://www.rackspace.com/knowledge_center/article/introduction-to-iptables#save_save_save_your_ruleset

expression - BizTalk - Multiple Conditions in Decide Shape -

in biztalk decide shape, how can handle below conditions in 1 decide shape node? code == 'code1' code == 'code2' code == 'code3' code == 'code4' i'm trying do, (code == 'code1' or code == 'code2' or code == 'code3' or code == 'code4' ) but not working, please suggest. the decide shape takes (mostly) c# formatted condition use: (code == "code1") || (code == "code2") || (code == "code3") || (code == "code4") you have use double quote since single quote means char data, not string.

visual c++ - C++ Header #define compiler error -

Image
i'm learning c++ , i'm @ low level still. - i'm looking @ using header files , have 2 part question. part 1 as understand them far, header file definitions similar hard coded strings within vb.net? example can following #define stock_quantity 300 , reference definition when using within functions? assume works same way vb.net strings need change value in 1 place should need make changes definition , program references number 300 on few hundred different lines? part 2 now, said i'm still learning i'm still doing ye old multiplication tasks. i'm within using functions main .cpp file i'm not moving on header files. code snippet far. add.h #ifndef add_h #define add_h int add(int x, int y); #endif main.cpp #include "stdafx.h" #include <iostream> #include "add.h" int main() { using namespace std; cout << add(3, 4) << endl; return 0; } when trying run receive 2 build errors , not compile.

Division by 0 in r, avoid NaN -

i have code here: d$icer <- d$delta_cost/d$delta_ly i each row, in matrix in r, now, first row has values of delta_cost , delta_ly = 0 , icer 0/0 , gives me value nan . how can modify 0 instead of nan ? you can use ifelse : d$icer <- ifelse(!d$delta_cost, 0, d$delta_cost / d$delta_ly)

c - How to change the value of char pointer? -

this main: int main(void) { char w1[] = "paris"; changetheword(w1); printf("the new word is: %s",w1); return0; } and need change value of w1[] in function: changetheword(char *str) { ... } int main() { char w1[]="paris"; changeword(w1); // means address of w1[0] i.e &w[0] printf("the new word %s",w1); return 0; } void changeword(char *str) { str[0]='d'; //here str have same address w1 whatever did str refected in main(). str[1]='e'; str[2]='l'; str[3]='h'; str[4]='i'; } read this answer too

time series - Gnuplot: x-axis narrow label spacing in timeseries plot -

Image
gnuplot tends clutter x-axis in timeseries plots. see following image example of labels narrow spacing: is there way make gnuplot avoid such narrow spacing? preferably should done within gnuplot script generate plot. i generated plot following gnuplot script , file of random data: set terminal png set output "plot.png" set timefmt "%s" set xdata time set xlabel "time" set ylabel "random data" set boxwidth 600 set style fill solid 0.5 set key below plot "random.dat" using 1:2 w boxes title ".60" note: using gnuplot 4.6. edit writing less times should sufficient this. an example file produce plot available @ http://pastebin.com/w0kia7dt you can use set xtics mark less points on x-axis. first , last argument must in same format times, in case %s , or seconds since unix epoch. middle argument number of seconds. for example, mark every 8 hours, rather every 4 above, this: hours = 8 start = &q

linux - how to loop through 3 files , search for a specific string and match it to a string in another file using bash -

i hav 3 text files hav use following code. these : subscribers.txt ,towns.txt & calls.txt . their link http://www.cs.ub.bw/teaching/csi223 : subscribers.txt has format: callerid|name |gender|birthyear|hometownid|email 10000025|kgosi|f |1981 |33 |10000025@cs.ub.bw town.txt has format : hometownid|townname |location 28 |ramatlabama|b calls.txt has format: date |time |duration|calleeid|callerid|locationofcallee|locationofcaller 18/02/2005|19:25:27|257 |10000025|10000017|3 |28 i created function takes callerid parameter print out calls sent out callerid.how modify following code such read callerid keyboard,display calls of callerid.the first line before displaying calls must contain: callerid,name(from subsribers.txt),age(take birthyear subscribers.txt , calculate age),gender(from subscribers.txt)and townname(from towns.txt) the code :: #!/bin/bash echo "enter caller id " read x ex

java - Avoid sleeping snail in swing unit tests -

i want avoid sleeping snail in swing unit tests, don't see way events. have somethink like windowwithkeylistener window = new windowwithkeylistener(); robot robot = new robot(); robot.keypress(keyevent.vk_1); robot.keyrelease(keyevent.vk_1); asserttrue(window.key1pressed()); robot.keypress(keyevent.vk_2); robot.keyrelease(keyevent.vk_2); asserttrue(window.key2pressed()); this doesn't work without thread.sleep() before assertions, events slow. how avoid thread.sleep() here? swing timers cannot executed in specific order. best approach testing here? jemmy seems handle org.netbeans.jemmy.operators.componentoperator.typekey(int) seems waiting.

ruby - Rails 4 Passing existing/previous record values to new record -

i'll try explain thoroughly possible. i'm trying figure out best way of passing existing data should not tampered hidden value through form -- or if there better way send data on rails new "create" method. basically i'm trying achieve is, first transaction created , stores group_id, owner_id, user_id, message , status. when user "accepts" request, new transaction created same information (group_id, owner_id, , user_id), except status , message can changed. so here's how flow goes: user first creates request such: request.create("gid" => 1, "user_id" => 2, "owner_id" => 4, "message" => "bla bla", "status" => 'pending') then owner of request views request, , able accept or reject transaction. bare in mind, requests in same page, there many accepts, , rejects on same page, each iterated through @request = requests.where(:owner_id => 4). the problem hidde

php - A button result in a mysqli_fetch_array cannot get through to the next page -

i have php page code passes variable of button next page: <div><center><table> while($row = mysqli_fetch_array($result)) { echo "<td><form action= display.php method= 'post'><input type='hidden' name='projectid' value=".$row['projectid']."> <input type= 'submit' name= 'type' value= 'view/amend project details'></form></td>\n"; } echo "</table></div>"; i have on next page in table: $projectid= $_post['projectid']; echo "<td>" . $row['projectname'] . "</td>"; i still cannot see problem, idea? the problem you're trying use $row on second page, , isn't set there. you have either mysqli query again, or transfer value of $row['projectname'] through form, using hidden input field.

c# - iTunes how to calculate bpm for songs? -

what calculate bpm songs in itunes library (using c#). i aware of itunes com automation library doesn't allows audio data of of tracks. how calculate bpm tracks in library when itunes com library doesn't allow access audio data? i open suggestions , can point me in right direction helpful!

c# - regular expression to retain only img src text -

i have string given: < img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/> i want regular expression return me "megamillions_nobkgd.png" part of above string result after using regular expression should "megamillions_nobkgd.png" stored in string variable. thanks in advance then believe should give need, more or less: var x = "< img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/>"; // result be: // ^f('himagepath')[1].label()^megamillions_nobkgd.png' var result = regex.match(x, @"\^f\((.)*'").value; of course simpler , more readable solution this, , avoid using regex completely: var x = "<img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/>"; var urlstart = x.indexof("'") + 1; var urlstop = x.lastindexof("'"); var result = x.substring(urlstart, (urlstop - urlstar

django - How to save ForeignKey in queryset? 'NoneType' object has no attribute 'myfield' -

how save foreignkey in queryset? class bookfile(models.model): myfile = models.filefield(upload_to="mybooks") class mybook(models.model): number = models.charfield(max_length=10) file = models.foreignkey(bookfile) my try in views: bookfile = form.cleaned_data.get('bookfile') mybook = mybook.objects.create(number="5555") mybook.file.myfile = bookfile mybook.save() error: 'nonetype' object has no attribute 'myfile' what in bookfile ? object or id ? if it's id, try: bookfile = form.cleaned_data.get('bookfile') mybook = mybook.objects.create(number="5555") bookfileobject = bookfile.objects.create() bookfileobject.myfile = bookfile bookfileobject.save() mybook.file = bookfileobject mybook.save()

jquery - tinyscrollbar scroll not working in chrome in windows 8.0 -

i have machine chrome installed on windows 8.0 laptop (which has touchscreen) have implemented tinyscrollbar in web application. tinyscrollbar shows , scrolls when application opened in mozilla. in chrome having issues , scrollbar displays scroll functionality not working found "ontouchstart" in windows property returns true value. has got scroll not working ? i had same problem on windows 8 machine running on chrome. there problem if(hastouchevents) statement. enter if(hastouchevents) on chrome , never initialize binding of thumb , mouseevents . if want attach mouse events , drag track must comment out else statement in v2.1.8 of plugin to: else { $thumb.bind("mousedown", start); $track.bind("mousedown", drag); } to: $thumb.bind("mousedown", start); $track.bind("mousedown", drag); and: else { $(document).bind("mousemove", drag); $(document).bind("mouseup", end); $thumb

Google maps driving mode url scheme not working on Android -

i trying call external google maps app android app. intent mintent = new intent(intent.action_view, uri.parse("http://maps.google.com/maps?saddr=" + stringlatitude + "," + stringlongitude + "&daddr=" + latitud + "," + longitud+"&dirflg=d")); startactivity(mintent); it works on android 2.3.6 . but not on android 4.2 , first time click in button executes code google maps opened correctly nothing driving mode appears there. but once go main app click again in button works fine. fails on first attempt. i cannot understand going on any clue? i using following code working fine on android 4.2 intent = new intent(android.content.intent.action_view, uri.parse("http://maps.google.com/maps?saddr="+a+","+b+"&daddr="+c+","+d+"&mode=driving")); i.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivit

php - I want to redirect to another controller's action -

error: exception 'zend_controller_dispatcher_exception' message 'invalid controller specified (phonenumber)' in /usr/share/php5/zend/controller/dispatcher/standard.php:248 stack trace: #0 /usr/share/php5/zend/controller/front.php(954): zend_controller_dispatcher_standard->dispatch(object(zend_controller_request_http), object(zend_controller_response_http)) #1 /usr/share/php5/zend/application/bootstrap/bootstrap.php(97): zend_controller_front->dispatch() #2 /usr/share/php5/zend/application.php(366): zend_application_bootstrap_bootstrap->run() #3 /home/bina/public_html/telco-portal-testing/public/index.php(22): zend_application->run() #4 {main} in want redirect phonenumbers controller's addnew action , in want pass data of csv file if(!empty($files)){ $name = ($files['csvfile']['tmp_name']); $row = 1; $handle = fopen($name, "r"); if ($handle !== false) {

android - How much can I scale the image's dimension after a quality scale? -

hi guys brand new topic , i'm rooky in image stuff. i need upload on webserver image user's smartphone. before upload operation downscale image quality jpeg 60% of quality. after quality compression can downscale image pixel size without losing lot of overall quality? is there equation can give me % of pixel downscale can if know dimension in pixels of source image , how i've scaled down quality? thank much, sorry if question stupid or obvious said not main topic. the quality percentage in jpeg meaningless (at best qualitative) figure. jpeg "quality" values translate quantization table selection. jpeg implementations use numeric range scale base quantization table. resulting quality of compressed image spends upon nature of image being compressed.

c++ - __sync_synchronize() not working as expected? -

consider following scenario: requirements: intel x64 server (multiple cpu-sockets => numa) ubuntu 12, gcc 4.8.1, mpich-3 two processes sharing data on shared-memory program sequence (pseudo code): program: volatile int data = 0; //allocated in (named) shared-memory volatile int flag = 0; //allocated in (named) shared-memory void setdata() { data = 1; __sync_synchronize(); flag = 1; } void getdata( int& result ) { //wait while( !flag ){}; //data ready result = data; } process a: int main( int argc, char** argv ) { setdata(); ::std::cin.ignore(); return 0; } process b: int main( int argc, char** argv ) { int result = 0; getdata(); //print result (result should 1) ::std::cout << "received: " << result << ::std::endl; return 0; } when run program, expect "result" 1 @ end of process b. while "waiting loop" in getdata() works fine, result

regex - How to parse random key value pair string in Python? -

what's efficient way parse string? accountsid=ac03e13571d5434152f33553f6&messagesid=sm16bbbc0a82847e61200a59d82cc1732b&body=https%3a%2f%2fwww.youtube.com%2fwatch%3fv%3dztwuf1mmama%26feature%3dyoutube_gdata_player&tozip=92707&tocity=garden+grove&fromstate=ca&tostate=ca&smssid=sm16bbbc0a82847e61200a59d82cc1732b&to=%2b17147866508&tocountry=us&fromcountry=us&smsmessagesid=sm16bbbc0a82847e61200a59d82cc1732b&apiversion=2010-04-01&fromcity=santa+ana&smsstatus=received&nummedia=0&from=%2b17145420218&fromzip=92704 use urlparse.parse_qs() parse url-encoded key-value pairs. demo: >>> import urlparse >>> inputstr = 'accountsid=ac03e13571d5434152f33553f6&messagesid=sm16bbbc0a82847e61200a59d82cc1732b&body=https%3a%2f%2fwww.youtube.com%2fwatch%3fv%3dztwuf1mmama%26feature%3dyoutube_gdata_player&tozip=92707&tocity=garden+grove&fromstate=ca&tostate=ca&smssid=sm16b

c - How to execute ./process 2>&1 | tee log.txt with execvp -

i try write process controller. should restart process again every time fails. start process following terminal command: ./process 2>&1 | tee log.txt now want execute command execvp : int main() { int status; while(1) { pid = fork(); char* const argv[4] = {"2>&1", "tee", "log.txt", null}; if(pid == 0) { // make child process ./process if(execvp("./process", argv) { perror("execvp"); exit(1); } } else if(pid > 0) { sleep(3); // wait ./process return waitpid(pid, &status, 0); } } } this example program doesn't fail , ./process starts 2>&1 | tee log.txt not executed or @ least log file doesn't appear. any suggestions?

C Hello world: Code Blocks IDE, MinGW C compiler on windows -

i can't code blocks ide compile hello world c program creates when create new c project. i've installed mingw , recognised ide. when try build following output: -------------- build: debug in testc3 (compiler: gnu gcc compiler)--------------- mingw32-gcc.exe -wall -g -c c:\users\jody\codeblocks\testc3\testc3\main.c -o obj\debug\main.o mingw32-g++.exe -o bin\debug\testc3.exe obj\debug\main.o execution of 'mingw32-g++.exe -o bin\debug\testc3.exe obj\debug\main.o' in 'c:\users\jody\codeblocks\testc3\testc3' failed. why trying run mingw32-g++.exe mingw32-gcc.exe ? (and if shouldn't doing this, how can configure not to?) the mingw32-gcc.exe step compile step. mingw32-g++.exe link step. correct sequence , work if mingw32 installation "normal" , correct - "normal" means have installed c++ c tools. the link step failing because mingw32-g++.exe cannot executed, because not exist on path . try running mingw32-g++.exe

matlab - Writing sums of product taken two or three at a time -

i have variables a1 a2 a3 a4.... etc want find out f1 f2 f3 ...fk.... fn where f1 = a1+a2+a3+a4+.....an f2 = - (sum of products of a's taken 2 @ time ) f3 = (sum of products of a's taken 3 @ time) fk = (-1)^(k+1)* (sum of products of a's taken k @ time) , on till fn can me how fk through pseudo code or matlab code. there built-in function in matlab can me in doing ? use in-built function poly(r) in matlab takes roots of polynomial r array: function fk = get_comb(r,k) p=poly(r) fk=(-1)^(k)*p(k+1); end

jsf - JavaServer faces redirecting form -

hello have form: <h:form> <h:selectoneradio layout="pagedirection" value="#{votesbean.answer}"> <f:converter converterid="pollconverter"/> <f:selectitems value="#{pollsbean.selectitems}"/> </h:selectoneradio> <h:messages/> <h:commandbutton value="#{msgs.vote}" action="/profile/main.xhtml"/> </h:form> but when submit form, page no redirects main.xhtml, refresh current page (viewpoll.xhtml, ‘think because there errors in form), not include view parameters. use view parameter know current poll… in result nullpointer exception, because don’t have poll id. if navigate directly without validation , conversion, use immediate="true" in h:commandbutton . otherwise, there might failure in request processing life cycle , eg. validation phase . finally, url (/profil

Decision trees & continuous-valued attributes -

how decision tree handle continuous valued attributes? know attributes such sex have 2 arcs denoting male or female . how continuous valued attributes such age ? not possible create arcs each possible value? create age-range sets? example having 3 sub-branches labeled <18 , <30 , >30 ? if how decide on creation of these age-groups? some algorithms cart evaluates possible splits using gini index or other impurity functions. sort attributes , @ impurity of each split. drawback of method is greedy, need @ every possible split. see image here.

I can't find the create xml option while trying to create a new layout in android project -

Image
i trying create new layout in layout folder of res, xml file option not available. have attached link below. try updating eclipse plugin: eclipse --> --> install new software --> pasted url: http://dl-ssl.google.com/android/eclipse/

mysql - Subtract one week from current week of the year -

i trying 1 week earlier current week of year sql query returning null. here query select date_sub(yearweek('2014-01-01'),interval 1 week) what wrong query if want yearweek of week prior date, can this: note: yearweek results in 6-digit number, first 4 digits week year, trailing 2 digits week number. select yearweek('2014-01-01' - interval 1 week) if need date 1 week before given date, then: select '2014-01-01' - interval 1 week

javascript - Share score on facebook -

i have application few pictures , when user check picture, gets +1 score. display total score on page code: total score: <span id="perk1"></span> my script is: <script type='text/javascript'>//<![cdata[ $(window).load(function(){ var actor=0; $(document).ready(function() { $('#perk1').html(actor); $("#img100").click(function() { if($('#img100').is(':checked')) actor=actor+1; else if(actor>0) actor=actor-1; $('#perk1').html(actor); }); $("#img95").click(function() { if($('#img95').is(':checked')) actor=actor+1; else if(actor>0) actor=actor-1; $('#perk1').html(actor); }); }); });//]]> html: <div class="imgs"> <div class="thumb">

asp.net mvc - .Net MVC When to use OnActionExecuting? -

some basic question. when initialize or assign in onactionexecuting? very simple scenario: public partial class ordercontroller : defaultcontroller { private int customerid = 0; protected override void onactionexecuting(actionexecutingcontext filtercontext) { customerid = websecurity.currentuserid; base.onactionexecuting(filtercontext); } } should assign customerid in onactionexecuting can reuse in code in each action? readability eliminating repeating or should assign in separate actions each time? we not need assignment or in case of initialization of object in each action)? the answer is, of course, it depends on team's coding style , other circumstances. another option haven't considered creating custom action filter contain logic, , reuse 1 line of code above action-method signature. then if decide apply all/any action-methods, can apply controller, or base-controller even.

jquery - Trigger Javascript with URL parameter -

i using snippet fade content div when specific link clicked.... <script language="javascript"> $(document).ready(function () { $('#section1, #section2, #section3').addclass('js'); $('#content-container a').click(function (e) { e.preventdefault(); var rel = $(this).attr('rel'); $('#' + rel).fadein().siblings('div').fadeout(); }); var link = document.url.split('#')[1]; if (link) { var el = $('#' + link); if (el) el.click(); } }); </script> is there way load specified content using url instead of clicking? can link www.mydomain.com/mypage.php#section2 or similar? update here jsfiddle of simplified code http://jsfiddle.net/k6rhr/ try this <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>mou

ruby on rails - Is there any way to access the parent object in a Cancan nested resource ability? -

i have nested resource i'm using cancan authorization. need able access parent object in order able authorize :index action of child (since no child instance passed :index action). # memberships_controller.rb class membershipscontroller < applicationcontroller ... load_and_authorize_resource :org load_and_authorize_resource :membership, through: :org .. end ability.rb can [:read, :write], membership |membership| membership.org.has_member? user end this doesn't work :index action unfortunately index action doesn't have membership instance associated , can't work way check permissions. in order check permissions, need interrogate parent object (the org) , ask whether current user member e.g. # ability.rb ... can :index, membership, org: { self.has_member? user } cancan lets me this... cancan states can access parent's attributes using following mechanism: https://github.com/ryanb/cancan/wiki/nested-resources#wiki-accessing-parent-i

rest - Remove all members from a group in WSO2 IS using SCIM endpoints -

i have created 1 group in wso2 using scim endpoint. updated group members. want remove members group, have used same update command this, couldn't remove members group. no errors there. have used following curl commands this. create group : curl -v -k --user admin:admin --data "{"displayname": "groupname"}" --header "content-type:application/json" https://example.com:9443/wso2/scim/groups update group add 1 member : curl -v -k --user admin:admin -x put -d "{"displayname": 'groupname' ,"members":[{"value":"dfd437b5-2e52-4077-9c31-84bc2ea8c117","display":"hasinitg"}]}" --header "content-type:application/json" https://example.com:9443/wso2/scim/groups/328b8e27-4869-45c5-9857-1afa9aaacf59 update group remove existing member : curl -v -k --user admin:admin -x put -d "{"displayname": 'groupname' }" --header "conte

readline - Left key exit insert mode in bash commandline -

i in bash: bind -m vi-insert '"{" "\c-v{}\e[d"' this works except after autoclosing } , put cursor in middle, exits insert mode, annoying. the given macro assumes emacs key bindings; after inserting braces, escape sequence \e[d moves cursor 1 cell left, positioning between braces. in vi mode, \e has effect of exiting insert mode , going command mode. simple fix leave insert mode, re-enter, reposition cursor want it; no explicit cursor movement necessary. bind -m vi-insert '"{" "\c-v{}\ei"'

Android: Implementing Slideshow -

i trying implement slideshow in android app. have imageview , text view in xml file. want imageview show slideshow of images. images stored in drawable-hdpi. when opening page, text view showing , not slideshow. not single image showing. following java file same. package abc.xys; import android.annotation.suppresslint; import android.app.activity; import android.os.bundle; import android.os.handler; import android.os.message; import android.widget.imageview; import android.widget.textview; public class wishes extends activity { imageview slide; textview msg; int i=0; int imgid[]={r.drawable.friends01,r.drawable.friends02,r.drawable.friends03,r.drawable.friends04,r.drawable.friends05}; refreshhandler refreshhandler=new refreshhandler(); @suppresslint("handlerleak") class refreshhandler extends handler{ @override public void handlemessage(message msg) { // todo auto-generated method stub wishes.this

php - How to create two controller with different table in zend 2 -

Image
i want create 2 controller different tables fetch records view,edit , update them first album controller works fine when create controller gives me error. you need register service album\model\demotable service manager; have existing album\model\albumtable . the documentation shows how register albumtable ; so modifying example, should work: // module.php public function getserviceconfig() { return array( 'factories' => array( 'album\model\demotable' => function($sm) { $tablegateway = $sm->get('demotablegateway'); $table = new demotable($tablegateway); return $table; }, 'album\model\albumtable' => function($sm) { $tablegateway = $sm->get('albumtablegateway'); $table = new albumtable($tablegateway); return $table; }, 'albumt

groovy - How to get a reference of cucumber RuntimeOptions when using cucumber-java and junit? -

i using cucumber-java in groovy code. prefer cucumber-java cucumber-groovy because can run tests plain old junit tests. however, step definition templates spitted out cucumber in java style. instead, have groovy style. example, in java style, like @when("^an http request sent obtain config.xml of \"([^\"]*)\"$") public void an_http_get_request_is_sent_to_obtain_config_xml_of(string arg1) throws throwable { // express regexp above code wish had throw new pendingexception(); } since using groovy, like @when(/^an http request sent obtain config.xml of "([^"]*)"$/) void 'an http request sent obtain config.xml of'(string arg1) { // express regexp above code wish had throw new pendingexception(); } i thinking implement such feature. basically, idea add new field, maybe called templatelanguage , in cucumber.api.cucumberoptions . when new field equal groovy , groovy-style templates spitted. involve if statement in cucu

winapi - NTLM Authorization in Perl -

i trying implement ntlm authorisation web server written in perl (or perhaps xs module). understanding should work in following way: c -> s: s -> c: 401, www-authenticate: ntlm c -> s: get, authorization: ntlm [type1 message] s -> c: 401, www-authenticate: ntlm [type2 message] c -> s: get, authorization: ntlm [type3 message] if s.check([type3 message]): s -> c: 200 else: s -> c: 401 to generate type3 message have used both authen::perl::ntlm , authen::ntlm::http , both of these seem generate messages fine, however, offer no functionality check type3 message. my next step has been try , use win32::intauth authenticate ntlm token. this have been running in trouble, developer , other snippets of information found searching module should able authenticate ntlm binary token. the module wraps around win32 api calls, namely acquirecredntialshandle, acceptsecuritycontext, completeauthtoken , impersonatesecuritycontext. unfortunately attempts authenti

How to Sum Conditional Data in Crystal Report -

i have table called tbl_sale , there 7 columns in table want sum quantity returned shop in negative so show how many quantity has been returned create these formula fields: // {@fields} {table.amount_0}+{table.amount_1} // {@negative} if {@fields}<0 {@fields} insert summarized field on {@negative} formula.

c# - VB.NET Class implements event -

i don't see did wrong. the ide tells me "class 'capturedevice' needs implement event 'event newframe(sender object, e cameraeventargs) 'ivideosource'. the class 'capturedevice' looks this: imports system.drawing imports system.drawing.imaging imports system.io imports system.threading imports system.runtime.interopservices imports system.net imports dshow imports dshow.core namespace videosource public class capturedevice implements ivideosource private source string private m_userdata object = nothing private m_framesreceived integer private thread thread = nothing private stopevent manualresetevent = nothing ' new frame event ' public event newframe cameraeventhandler '(...)' end class end namespace my class 'ivideosource' looks this: namespace videosource 'ivideosource interface' public interface ivideosou

android - How to know Typing Status in XMPP openfire using Smack -

i developing chat application using openfire xmpp server. can text chat between 2 user. want know typing status when 1 typing message. created class :- public class typingstatus implements chatstatelistener { @override public void processmessage(chat arg0, message arg1) { // todo auto-generated method stub } @override public void statechanged(chat arg0, chatstate arg1) { // todo auto-generated method stub system.out.println(arg0.getparticipant() + " " + arg1.name()); } } but confuse how work? know need packet can in listener. unable find packet. please 1 suggest, how work? and difference between smack , asmack? thank you! to enable chatstatelistener need create custom messagelistener class public class messagelistenerimpl implements messagelistener,chatstatelistener { @override public void processmessage(chat arg0, message arg1) { system.out.println("received message: "

actionscript 3 - Why is my flash animation getting cropped? -

you can view swf file here :- http://shrineweb.in/other-files/other/seniorschool.swf on above link, swf not getting trimmed , plays fine. when download , view in flash player, gets trimmed little sides. notice seeing half cut 'skip' button @ top-right. does have idea why happening? your swf file published stage dimensions of 800x650, make sure content doesn't exceed bounds. if does, change stage size in document properties.

extjs - Android native browser having issues with sencha -

i have existing app build in sencha 2.0 extjs version 1.1.1. working fine in galaxy s3 4.1.2 version. application loads both in chrome , s3 native browser. when install same application in galaxy s4 (version 4.2.2), few features not working in android native browser. eg: sencha drop down , scrolling, etc. not working. works fine in chrome same device. i know if settings/configuration needs done in app work fine in android native browser 4.2.2. host app in tomcat server , browse device browser. does extjs 1.1.1 need upgraded android 4.2.2 ? things working fine in 4.1.2 version. issue observed in galaxy s4 default browser. thanks

c# - How to send email using threading when new record in inserted before return a data ? how to achieve that -

i need send email concern employee when ever complain posted against him.in insertion record inserted , same details returned user . i want send email using threading in c# that,i created email method don't know how use it. code: public string insert(string context) { sam_erpentities entities = new sam_erpentities(); dynamic list = utility.desearlizejson(context); int userid = new base().userid; int departmentid = utility.intval(list["departmentid"]); empcomplaint.complainttypeid = utility.intval(list["complainttypeid"]); empcomplaint.complaintstatusid = utility.intval(list["complaintstatusid"]); empcomplaint.departmentid = utility.intval(list["departmentid"]); empcomplaint.complaintsubject = utility.strval(list["complaintsubject"]); empcomplaint.complaintnotes = utility.strval(list["complaintnotes"]); empcomplaint.createdby =

java - Less4j Compiler NullPointerException on ASTManipulator -

i have styles.less parent files has references less modules. first have less file variables , furthermore making couple of module less files have overview. the problem have less compile throws nullpointer exception while compiling less files. when use validator or grunt, less files ok. the following situation fails. styles.less @import "core/_settings"; @import "shared-components/_messages"; _settings.less @breakpoint-two: ~"only screen , (min-width: 767px)"; @breakpoint-three: ~"only screen , (min-width: 960px)"; _messages.less .message { text-align: center; list-style: none; margin: 0 0 @spacing 0; a{ color: @color-black; &:hover {opacity: .5} } } .message--include { display: block; font-weight: 600; line-height: 1.5rem; margin-bottom: 0.25rem; padding: 0.75rem; vertical-align: baseline; @media @breakpoint-three { padding: 1rem 1.5rem; } p