Posts

Showing posts from March, 2015

c++ - Loading Data From Comma Separated Text File to 2D Array? -

i trying load data text file looks this: 161,77,88,255 0,44,33,11,111 etc. have functions manipulate it, , ensured array correct size (which may still vary). below attempt @ implementation: bool loaddata(int **imgpix, string filename) { ifstream inputfile; inputfile.open(filename.c_str()); string templinerow; //the resulting line text file string tempelementcolumn; //the individual integer element int numberofcols = 0; int numberofrows = 0; if (!inputfile.is_open()) { return false; } imgpix = new int* [numberofrows]; while (getline(inputfile, templinerow, '\n')) { stringstream ss; ss << templinerow; //stringstream version of line while (getline(ss, tempelementcolumn, ',' )) { stringstream ss2; ss2 << tempelementcolumn; ss2 >> numberofcols; //prob? (**imgpix) = *(*(imgpix + numberofrows) + numberofcols); numberofcols++; } numb

Call python code from Ruby -

i want run python code ruby. using gem. ruby code: require "rubypython" rubypython.start fileinput=rubypython.import("fileinput") rubypython.stop i error : rubypython warning: undefining `object_id' may cause serious problems ruby code: require "rubypython" rubypython.start fileinput=rubypython.import("fileinput") name='' name2="" r=0 i=0 open_file=fileinput.input("lala") output=open("lalal","w") line in open_file: keys=line.split() length=(len(keys)) if length==3: if (keys[0]!=name , i!=0): output.write("%s\t%s\t%s\n"%(name,name2,r)) name=keys[0] name2=keys[1] r=float(keys[2]) output.write("%s\t%s\t%s\n"%(name,name2,r)) output.close() rubypython.stop i error: unique.rb:12: syntax error, unexpected ':', expecting keyword_do_cond or ';&#

ios - Push notifications are not working on my iPhone -

i fallowed tutorial: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 ok, notification approve showed. notifications not arriving. iphone connected wi-fi , notifications allowed. notifications application work on other iphones! wrong? check settings > notifications > (app name) , turn on.

c# - How can I read remote sql tables into a winforms program? -

i have sql server table located on website (remote). table called table1 , contains bunch of fields. goal here read fields of table1 array called results . here attempt: private static void showfields() { using (sqlconnection connection = new sqlconnection(connectionstring)) { connection.open(); sqlcommand command = new sqlcommand("select * information_schema.columns table_name='table1'", connection); string[] results = command.beginexecutenonquery().toarray(); connection.close(); foreach (var v in results) { console.writeline(v); } } } you need use sqlcoomand.executereader() instead of: private static void showfields() { using (sqlconnection connection = new sqlconnection(connectionstring)) { connection.open(); sqlcommand comma

php - Action Variable not accepted -

i have used code million times before i'm having problems. in top.php file have put code http://www.sentuamsg.com/index.php?action=about now when reach index page error code of notice: undefined variable: action in /home/content/90/9753290/html/index.php on line 4 <?php include("top.php"); if($action == "") { echo "<p align=center><img src=mondaymoan.jpg></img></p>"; echo "<p><font face=tahoma><b><font size=2>monday moan:</font></b> <font size=2> weeks gaming action, rumours, news snipplets assessed , talked in 1 blog. have read of own on monday's moan</font></font></p>"; echo "<p align=right><font face=tahoma size=2>[read]</font></p>"; echo "<p><img src=mostloved.jpg></p>"; echo "<p align=center><img src=retrogamer.jpg></img></p>"; echo &qu

Getting "ImportError: cannot import name HTTPSConnection" error in Python 2.7 -

i'm trying deploy django in aws elasticbeanstalk. while following steps shown here , i'm stuck command, "eb init". i'm using python 2.7 in ubuntu 12.10 (vmware) i'm getting error below: eb init ..... lib.aws.http_client import http_get, http_post file "/home/g/documents/files/aws/aws-elasticbeanstalk-cli-2.4.0/eb/linux/python2.7/lib/aws/http_client.py", line 17, in <module> httplib import httpsconnection importerror: cannot import name httpsconnection two possibilities spring mind... the python installation on aws doesn't include ssl support. you've created file called httplib.py shadowing 1 in standard python library. try doing import ssl , , if importerror: no module named _ssl , it's #1, otherwise it's #2.

html - Setting position:absolute prevents me from clicking links in one div? -

i have sidebar, in there 2 sections. on section teo can colick links fine. on section 1 (lorem ipsum - prescriptions 1)setting position absolute on sidebar div, prevents me clicking links. why this? html <div class="container" style="background-color:white; position:relative; top:-20px; height:900px;"> <div id="sidebar" style="margin-top:10px;position:absolute;"> <div id="contentdiv" style="width:250px; height:300px; position:relative; background- image:url('/img/grey_gradient.png');"> <br /> <p style="margin-left:20px;">lorem ipsum dolor sit amet, consectetur adipiscing elit. </p> <p style="margin-left:20px;">our services</p> <ul class="unstyled" style="margin-left:30px;"> <li><img src="img/home_icon.png" /><a href="#"> home visits</a></li> <p>

android - how to find a user in a ParseUser object -

hi wondering why code not work. trying query parseuser's username field find user keeps saying cant find it. private void findusername(string user) { // query user database find passed in user parsequery query = parseuser.getquery(); query.whereequalto("username", user); query.findinbackground(new findcallback() { @override public void done(list<parseobject> objects, parseexception e) { founduser = (objects.size() != 0); } }); } here method calls it if (!founduser) { errormessage.settext("invalid user name"); } founduser field because couldnt return in method... parse treats user objects separate parse objects. should use list<parseuser> instead of list<parseobject> . parse android guide provides example https://parse.com/docs/android_guide#users-querying . here parse example clause. parsequery<parseuser> query = pa

drupal - How to display a custom form in a newly created template page -

i have hook_form in custom module , have customized page.tpl.php file .is there way can pass form tpl page.i thought of passing $form variable tpl page through hook_theme function quite not working. the standard method use preprocess function, either in theme or module function mymodule_preprocess_page(&$vars) { $vars['some_form'] = drupal_get_form('mymodule_some_form'); } then in template file: <?php echo $some_form; ?> you'll need clear caches after implementing hook theme registry pick up.

javascript - Python Mechanize: selecting an option -

how select option select tag? this form contains 1 select tag , no submit button. when option selected, supposed call javascript function __dopostback('d1','') adds more content same page. <select name="d1" onchange="__dopostback('d1','')" language="javascript" id="d1"> <option value="0">- select -</option> <option value="1">option1</option> <option value="3">option2</option> <option value="5">option3</option> </select> although don't have experience mechanize, believe should this: control = form.find_control('d1') control.value = ['3']

r - calculate differences in dataframe -

i have dataframe looks this: set.seed(50) data.frame(distance=c(rep("long", 5), rep("short", 5)), year=rep(2002:2006), mean.length=rnorm(10)) distance year mean.length 1 long 2002 0.54966989 2 long 2003 -0.84160374 3 long 2004 0.03299794 4 long 2005 0.52414971 5 long 2006 -1.72760411 6 short 2002 -0.27786453 7 short 2003 0.36082844 8 short 2004 -0.59091244 9 short 2005 0.97559055 10 short 2006 -1.44574995 i need calculate difference between in mean.length between long , short in each year. whats fastest way of doing this? here's 1 way using plyr: set.seed(50) df <- data.frame(distance=c(rep("long", 5),rep("short", 5)), year=rep(2002:2006), mean.length=rnorm(10)) library(plyr) aggregation.fn <- function(df) { data.frame(year=df$year[1], diff=(df$mean.length[df$distance == "long"] -

php does not loop through mysql results -

the form have created not receive entries. here index.html: <html> <body> <iframe name = "main_frame" src = "http://stelucir.com/entry_ac.php" style = "position:absolute; width:80%; height:70%; left:10%; top:12%;"> </iframe> <form name="form1" method="post" action="http://stelucir.com/entry_ac.php" target = "main_frame"> <div style = "position:absolute; width:80%; height:5%; left:0%; top:84%;">image:</div> <input type="text" name="one" id="one" style = "position:absolute; width:80%; height:5%; left:10%; top:83%;"><br> <div style = "position:absolute; width:80%; height:5%; left:0%; top:89%;">part descr:</div><input type="text" name="two" id="two" style = "position:absolute; width:80%; height:5%; left:10%; top:88%;"><br> <div style =

jquery - Split each string from any given paragraph in javascript -

i have textarea. trying split each string paragraph, has proper grammar based punctuation delimiters ,.!? or more if any. i trying achieve using javascript. trying such strings in using regular expression in answer but here, in javascript me it's not working. here's code snippet more clarity $('#split').click(function(){ var textareacontent = $('#textarea').val(); //split string i.e.., textarea content var splittedarray = textareacontent.split("\\w+"); alert("splitted array "+splittedarray); var lengthofsplittedarray = splittedarray.length; alert('lengthoftext '+lengthofsplittedarray); }); since unable split, showing length 1. apt regular expression here. the regular expression shouldn't differ between java , javascript, .split() method in java accepts regular expression string. if want use regular expression in javascript, need create one...like so: .split(/\w+/) demo: http://j

jsf - ajax listener was not updated the panels for selected item in primefaces -

iam trying update panel based selected data using primefaces selectonemenu , ajax listener taken care updating panels.but panel not updated , selected item shown @ console window.that means ,the ajax call got managed bean.but not updated @ faces pages , mentioned code <p:panelgrid columns="1" style="align:center;width:80%" styleclass="companyheadergrid"> <p:row> <p:column><h:outputlabel for="runobject" value="run object: " /></p:column> <p:column> <p:selectonemenu id="selectedstate" value="#{taschedulebean.selectedrunobjectitem}" > <p:ajax listener="#{taschedulebean.changepanelstate}" render="@this" update=":form:displaydailypanel"/> <f:selectitem itemlabel="select one" itemvalue="select one" /> <f:selectitems value=

How to get screen size in Panorama control of Windows Phone 7 -

Image
how programatically actual screen size (width , height) in windows phone? use following: how screen size on windows phone 7 series but panorama control bit tricky, since above code gives panoramaitem width , height ( not panorama width , height). i have following code creates popup: modalpopup = new popup(); modalpopup.child = new modalwait() { maxwidth = application.current.host.content.actualwidth }; modalpopup.isopen = true; as result popup created width of panoramaitem, not total width of phone screen. there's right margin not covered popup. see screenshot below: any ideas how overcome right margin , actual phone screen size? the maxwidth property not set element's width. gets/sets maximum width constraint of element. want use width property instead. the code showed application.current.host.content.actualwidth give correct screen width, not panorama item's width.

class - How to create new instance dynamically in GWT? -

i have case, generate instance dynamically ie, have map map<string,class> classmap=new hashmap<string,class>(); classmap.put("key1",panel.class); classmap.put("key2",panel1.class); classmap.put("key3",panel2.class); class clazz=map.get("key"); gwt.create(clazz); when compile using gwt compile got exception compile -strict or -loglevel set trace or debug see errors. [error] errors in 'com/asklepian/web/sample/sample.java' [error] line 19: class literals may used arguments gwt.create() is there better way achieve same.thanks in advance retrieving class objects done adding lowercase ".class" classname. maybe change map classmap.put("key1",panel.class); classmap.put("key2",panel1.class); classmap.put("key3",panel2.class); , try recompile that.

zend framework2 - How can i get user role in my actions -

i using zf2 2 modules (zfc-user, bjyauthorize) , want user role actions try this in controller $viewmodel = new viewmodel(); $authorize = $this->getservicelocator()->get('bjyauthorize\provider\identity\providerinterface'); $roles = $authorize->getidentityroles(); $viewmodel->setvariable("roles", $roles); return $viewmodel; in view script <?php var_dump($this->roles); ?>

c# - Cannot read from a closed textreader after iterating through IEnumerable once -

i've got problem "cannot read closed textreader" exception. have program supposed data file, funny stuff , timespans of everything. first in 1 function, i'm loading data: ienumerable<string> somevariable; somevariable = (from _something in file.readlines(@"file location") select _something.split(' ')[1] ); in second function, run through once : foreach (var _something in somevariable) { somelist.add(_something); } hovewer in third function, when try run throgh again: foreach (var _something in somevariable) { someotherlist.add(_something); } i exception: cannot read closed textreader. looks after 1 enumeration, no longer possible iterate through somevariable. is problem ienumerable itself, or have file.readlines function? find silly reload data file every time want iterate through it... ps. did research , aware 1 of sollutions put both actions in 1 function, unfortunatelly university program , have write in way - h

jquery - How to make link to point to view? -

in application.html.erb file have links , <%= yield %> . want when link click, view rendered in <%= yield %> field without refreshing whole page. so, started implementing ajax doing wrong , need help. this did: in webinars_controller.rb index method added format.js : respond_to |format| format.html format.js format.json { render json: @webinars } end then create index.js.erb file in /app/views/webinars/ folder: $('.b-content-container').html("<%=j render @webinars %>"); and following how creating link in application.html.erb file: but clicking on link interal serve error points me code in application.js : // send request // may raise exception actually // handled in jquery.ajax (so no try/catch here) xhr.send( ( s.hascontent && s.data ) || null ); in order fix issue, have use :template option of render render function specify template , :collection pass data current t

is there mathematical model to describe the relationship between running time and input data size for hadoop? -

in hadoop cluster, there mathematical model describe curve transmission time , datainputsize of mapper? for example, if original data size n m mappers, , total transmission time mappers reducers t. wanna double data size 2n in mappers, there approximation estimation transmission time t'(i think t' must less 2t), idea use log curve describe curve, not sure correct. i assume input coming hdfs(?) assume input data has been placed on hdfs, we're not talking time transmit input data local file store hdfs. assume input size n total size of of input files combined. assume m number of map tasks (based on number of input splits input files broken into). if we're talking transmission between map tasks , reduce tasks need know size of output map operations. in general, size of output unrelated size of input n. even if knew how total data needs transmitted between map tasks , reduce tasks, asking transmission time not meaningful, because transmission can happen @

c++ - How can I modify VS_VERSION_INFO from the cpp file -

when go resource view -> myproject.rc -> version -> vs_version_info i've got fields can change. possible change these fields through cpp file? use like: #define filedescription "this program" that cool because it's annoying go there , change these fields. you can't. version resource embedded exe linker, isn't variable. windows knows how find , display version in properties window. trying modify code isn't useful design, isn't running when user looks @ properties. nor can modify own exe file, locked while program running. , uac stops programs tinkering executables, iceberg sinks roman's approach. you don't have use resource editor if annoys you, .rc file text file can edit text editor, .cpp source code. , preprocessor gets shot @ file first, can substitute strings editing .h file .rc file #includes gets job done too.

c# - RadioButtons and Throwing Exception -

i have 2 radio buttons user select type of movie like. example program, want understand throwing exceptions better. when user clicks display button shows type of movie selected, between action or comedy. if no selection made throws exception, best way figure out, going in right direction? string selection; try { if (radaction.checked) { selection = radaction.text; } else if (radcomedy.checked) { selection = radcomedy.text; } else throw new argumentnullexception("please choose movie type"); messagebox.show(selection); } catch(argumentnullexception msg) { messagebox.show(msg.message); } it's not @ practice show error message in scenario. using try...catch , throw...exception comes performance penalty. try avoid as poss

node.js - Nodejs Express Return Error Code with Res.Render -

i using nodejs express. return custom 404 not found error page. have working. have not found solution of how return error code res.render(). saw few similar questions old , using deprecated methods. appreciated. check these: app.use(function(req, res) { res.status(404); url = req.url; res.render('404.jade', {title: '404: file not found', url: url }); }); // handle 500 app.use(function(error, req, res, next) { res.status(500); url = req.url; res.render('500.jade', {title:'500: internal server error', error: error, url: url}); });

c++ - How do I read a double from file? -

i came following code: #include <stdio.h> #include <iostream> #include <fstream> int main() { std::ifstream a0; a0.open("data/a0", std::ios::in | std::ios::binary); double d; a0 >> d; printf("%e\n", d); } i compile with g++ -s -wall -wextra -pedantic -std=c++0x -o program program.cpp but doesn't work - prints 0 (the actual first 8 bytes of file 3d 8f a0 bb e0 00 00 00 ). more interesting, when data/a0 file doesn't exist, garbage output, if file exist, output strictly 0. what doing wrong? if file binary, must use unformatted input functions it: double d; if (!a0.read(reinterpret_cast<char*>(&d), sizeof(d))) { // error occurred } std::cout << d << '\n'; operator >> formatted input, means expects text in file. edit sorry, used get() instead of read() , more useful reading text files in binary format.

iphone - What is the difference between self.managedObjectContext and managedObjectInstance.managedObjectContext? -

so, have coredata entities book , bookmark , highlight . book contains information book , nsset of bookmarks . i want delete bookmarks present in 1 book , repopulate them set. this code have got project , can not seem why have used different kinds of deleteobject method. they go like: for (bookmark *bookmark in book.bookmarks) { [bookmark.mamagedobjectcontext deleteobject:bookmark]; } what's difference between using self.managedobjectcontext , bookmark.managedobjectcontext . also, either doesn't seem have effect on contents , error while trying delete bookmarks in forin loop , adding new set forin loop again. please mention in comments if more information required. the managedobjectinstance.managedobjectcontext returns managed object context receiver registered. in other words, if created, example, bookmark in main thread context (the 1 associated context created in main thread), bookmark.managedobjectcontext point that. are using differe

java - Converting Image-->Sound--->Record sound---->Image -

i creating program following: convert image(png) sound(wav). playing , recording sound. reproducing image sound. the program uses red(from rgb) values of image , put them in wave file this: consider following words red pixel values in image: a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 (i using square image) d1 d2 d3 d4 it puts them in wave file this: a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 problem when sound plays , record starting time , ending time of recording need same of sound produced program(which never possible) otherwise pixels displace like: xx xx a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 you idea right!! here's partial code using convert image sound: imgbuffer = imageio.read(new file("d:\\sound_to_image.png")); int[][][] pixels = new int[width][height][3]; loop ( c = new color(imgbuffer.getrgb(i,j)); pixels[i][j][0] = c.getred(); ) //--------------creating long 1d array 2d array byte buf[]=new byte[width*height+1];

Can I compile and debug (run) a single C++ file in Visual Studio 2012? (How to avoid creating too many projects) -

i'm learning c++ out of book , using visual studio 2012. in order follow book's exercises, need make multiple .cpp files main() function inside them. is there way can compile/debug programs without making new project every single time? for example, if write simple "hello, world!" file , decide make else simple, can avoid making new project each simple program? there way use visual studio 2012 compiler? love if have inside single project compile whichever individual file wanted , see run. thanks help. to compile make cpp file. , use cl command line tool, check msdn link: compile native c++ program command line has example cl /ehsc simple.cpp

wpf treeview get selected value -

i have treeview , listbox . both of them populated different datatable s. the treeview gets data from: datatable product_type = new datatable(); product_type.columns.add(new datacolumn("id_product_type", typeof(int))); product_type.columns.add(new datacolumn("name", typeof(string))); product_type.columns.add(new datacolumn("id_parent",typeof(int))); ds.tables.add(product_type); the parent child relation: ds.relations.add(new datarelation("rsparentchild", product_type.columns["id_product_type"], product_type.columns["id_parent"])); so want the id_product_type treeview on selecteditemchanged , pass listbox, how actual value, int? tht's looking for(i used dataview bind list) : private void tlstview_selecteditemchanged(object sender, routedpropertychangedeventargs<object> e) { int new_value =(int)((datarowview)e.newvalue).row["id_product_type"]; }

html - Turn off responsive for small resolution devices -

how turn off responsive design small resolution devices? responsive looks terrible when trying access phone. more @ screenshots. phone desktop the way restrict responsive style sheet loading on smaller devices eg <link rel="stylesheet" media="screen , (min-device-width: 800px)" href="css/bootstrap-responsive.css" />

json - Why null return for PHP array? -

so i've got datafile contain of "events" supposed in json format such: [{"id":"4f946d7a31b27", "title":"floss otter", "start":1333252800, "end":1333339199}] where more events more json objects [{}, {}, ...]. wrote function try , datafile array of json objects unshift new event onto, , write out datafile, keep getting null return, not array. if($_server['request_method'] == 'post'){ $title = $_post['title']; $start = $_post['start']; $end = $_post['end']; $event = array( 'id' => md5($title), 'title' => $title, 'start' => $start, 'end' => $end ); $data = get_data(); array_unshift($data, $event); if ($fp = fopen($data_file, "w")){ fwrite($fp, json_encode($data)); fclose($fp); } } function get_data() {

javascript - how do i allow header "Accept-Ranges" in nginx? -

i have app working localhost:8888 using tornado, , headers i'v set: def set_default_headers(self): self.add_header("access-control-allow-origin", "*") self.add_header("access-control-expose-headers","accept-ranges") self.add_header("access-control-expose-headers","content-encoding") self.add_header("access-control-expose-headers"," content-length") self.add_header("access-control-expose-headers","content-range") the app on localhot:8888 needs static file locahost:80, , nginx server on localhost:80 looks this: server { listen 80; server_name localhost; root /var/www/statics; passenger_enabled on; passenger_use_global_queue on; add_header access-control-allow-origin *; add_header access-control-allow-origin [http://localhost:8888;] add_header access-control-expose-headers accept-ranges; add_header access-control-expose-headers content-e

javascript - Backbone collection.each() is not working -

i receiving following message when try use backbone's collection.each() method: typeerror: object function (){ return parent.apply(this, arguments); } has no method 'each' . i'm learning backbone jeffrey way tutorials; entered identical code his, reason doesn't work. var person = backbone.model.extend({ defaults: { name: 'besim dauti', age: 15, occupation: 'web developer' } }); var peopleview = backbone.view.extend({ tagname: 'ul', render: function(){ this.collection.each(function(person) { var personview = new personview({ model: person }); this.$el.append(personview.render().el) }, this) return this; } }); var personview = backbone.view.extend({ tagname: 'li', template: _.template( $('#persontemplate').html() ), render: function(){ this.$el.html(this.template(this.model.tojson()) ); return th

javascript - How to populate a select option with value and text -

i trying populate select option this: function listaano(){ var lista = $("#ano"); var currentyear = (new date).getfullyear(); var pastyear = 2000; var rangeyear = currentyear - pastyear; ( var j = 0; j <= rangeyear; j++ ){ (var = currentyear; >= pastyear; i-- ){ lista.append($("<option/>").val(j).text(i)); } } i'm getting this: <select id="ano" name="ano"><option>año</option><option value="0">2013</option><option value="0">2012</option><option value="0">2011</option><option value="0">2010</option><option value="0">2009</option><option value="0">2008</option><option value="0">2007</option><option value="0">2006</option><option value="0">2005</option><option value="0">2004&l

java - Grayed out textfield unless checkbox ticked -

how, using jtextfield , can create program enable/disable textfield depending on whether or not checkbox ticked? i have option which, if checked, needs take input. if not checked, i'd text field remain grayed out user unable enter text. mchq08 did not give complete answer since code nothing if jcheckbox unchecked. don't need if block you'd need single line of code in item listener checkbox.additemlistener(new itemlistener() { public void itemstatechanged(itemevent itemevent){ // line below line matters, enables/disables text field textfield.setenabled(itemevent.getstatechange() == itemevent.selected); } });

SQL SUM total using 2 tables -

i have 2 tables: tbl_equipments , tbl_proposal . tbl_proposal has 3 important columns: id_proposal date discount tbl_equipments has: id_equipment id_proposal unit_price quantity now want know how (in €) proposals year, let's say: for each tbl_proposal.date > "2013-01-01" want use formula: result = (tbl_equipments.unit_price * tbl_equipments.quantity) * (100 - tbl_proposal.discount) i can 1 sql statement? yes can: select e.unit_price * e.quantity) * (100 - p.discount) tbl_proposal p join tbl_equipments e on p.id_proposal = e.id_proposal date >= '2013-01-01' the basic syntax join. p , e called table aliases. make query easier read (the full table names rather bulky). date operations differ among databases. last statement should work in databases. however, might try 1 of following well: where year(date) = 2013 extract(year date) = 2013

c# - How to correctly plan a Windows Phone app -

i'm trying make first wp app , i'm running design problems i'm coming java , i'm not used xaml , stuff that. let's have structure this: pluginbase - class has extended build plugin. various plugins extending base class. each plugin has retrieve infos different sites (something instagram plugin, 500px 1 , on). plugingraphics - class has pluginbase attribute , has use show retrieved data. means class have draw() method print on screen (on gui) infos plugin. here's short pseudocode abstract class pluginbase{ string pluginname; string apiurl; abstract image getimage(); } class instagramplugin extends pluginbase{ public instagramplugin(){ pluginname = "instagram"; apiurl = "http://..."; } image getimage(){ return new image(apiurl + "/img.png"); } } class plugingraphics(){ pluginbase plugin; public plugingraphics(pluginbase plugin){ this.pl

bootloader - Use TCP/IP before OS booted -

i have tried find ways send , recieve data remote computer before os booted windows boootloader. there way can send or recieve data tcp/p before os booted up? there several viable solutions. easiest @ pxe toolkit http://pxe-toolkit.sourceforge.net/web-site.html it's quite powerful, , can wish do. there options, @ bootp protocol. have @ following project well: http://gynvael.coldwind.pl/?id=423

java - How do you install the latest version of Xuggler (5.4, as of 18/05/2013) in eclipse? -

i have literally no clue start doing this. i've downloaded necessary jar's site, , done research on how install xuggler in eclipse, , outdated or irrelevant. my system 64-bit windows 8. things worked in vista , windows 7 should compatible system long 64-bit compatible. able run application in eclipse. any advice, helpful explanations appreciated. you can download xuggler 5.4 here and more jar make work... commons-cli-1.1.jar commons-lang-2.1.jar logback-classic-1.0.0.jar logback-core-1.0.0.jar slf4j-api-1.6.4.jar you can check dependencies xuggler needs here : add jars , xuggle-xuggler-5.4.jar project's build path , s ready. **version numbers may change

html - Responsive Table cell to new line -

there's third party content site have "embed" via dynamic content, don't know ajax or jquery @ moment wondering if possible shift table cell down new line creating new row. the embed ends with: <table> <tr> <td></td> <td></td> </tr> </table> there no classes or id's placed in table, table on page , has way content fit on 1 line, mobile website i've got make whole page 320 pixels wide. is possible using css alone? i can't insert new html, content dynamically created secure server don't have access to, use api key in order access.. mediaqueries work though. i'm trying experiment along lines of: td {clear:both;} you can set td display:block; they'll under eachother. html <table> <tr> <td>1</td> <td>2</td> </tr> </table> css td{ display:block; } see here: http://jsfiddle.net/hdsts/

500 Internal Server Error for my facebook app link -

i see question has been asked before no solution has been provided. i getting nothing 500 internal server error since yesterday when use following link: http://apps.facebook.com/myappid yes, tried clearing cache & cookies don't bother asking me this. have added app link in canvas url should show after click on app url nothing 500 http error. tried on browsers , asked few of friends , said same error. i thought error on facebook don't see how it's not being fixed day now. any help? thank you. the 500 internal server error general http status code means has gone wrong on web site's server server not more specific on exact problem is. so "server-side" error, meaning problem not pc or internet connection instead problem web site's server. maybe should contact facebook center.

Javascript Switch case doesn't work even if conditions are true -

as previous questions coudn't answers solved problem, i've decided post entire code determine issue. problem when button pressed, if 1 of 3 images same (equals others) instance(three 1's appear, or 3 2's appear) no message entered in program outputted instead, nothing happens. here original question( switch case not working images stored in array ) the html: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <body> <form name=slots onsubmit="rollem(); return false;"> <tr> <th align=right>usertokens:</th> <td align=left> <input type=box size=5 name=usertokens readonly value=25> </td> </tr> <tr> <th align=ri

opengl - Misunderstood Compiler Error on glGenerateMipmap(GL_TEXTURE_2D); -

error: there no arguments 'glgeneratemipmap' depend on template parameter, declaration of 'glgeneratemipmap' must available [-fpermissive] i have #include <gl/glext.h> included , can see declaration of function in header, compiler error above. on ubuntu 13.04 up-to-date nvidia drivers installed. assume function defined. my use of function is: if (mipmapped) { glgeneratemipmap(gl_texture_2d); } why compiler choking on function? error mean in context? the glext.h header default not declare functions, have #define gl_glext_prototypes before including file if want to. should warned declaring function not mean can link on platform, gl lib not required export function. on linux, work, though, closest standard opengl application binary interface linux guarantees opengl 1.2 core functions exported. you should consider using opengl extension mechanism, either manually via glxgetprocaddress[arb]() or using convenient library glew or

Required and Placeholder clash on forms -

i writing form , using required tag , placeholder tag on inputs. inputs of type text not seem become required placeholder text making validate. is known problem or there workaround? (example of form below) cheers <form method="post"> <input type="text" placeholder="your name" required> </form>

.net - Function in Discriminated Union Constraining the Type of a Generic Parameter -

i trying port haskell code f# , getting strange error don't know how around. have discriminated union function defined below: type othertype = othertype1 of string | othertype2 of string type mytype<'a> = mysub1 of datetime * string * (float -> mytype<'a>) | mysub2 of 'a | mysub3 of datetime * string * (bool -> mytype<'a>) later have function works on type such let fun1 date mytype (myfun2: ('b -> mytype<'a>)) = match mytype | othertype1(string1) -> mysub1(date, string1, myfun2) | othertype2(string1) -> mysub3(date, string1, myfun2) this constrains myfun2 type (float -> mytype<'a>). there way prevent happening , keep k generic? the result second pattern match falls. thank you. update: looking @ haskell code trying replicate think issue in haskell version othertype gadt , othertype1 becomes othertype double , othertype2 becomes othertype bool. myfun2 able

c++ - How to Get Max Number of Multitextured Units -

lets have function want user able select appropriate texture in type safe manner. instead of using glenum of gl_texturex define method follows. void activate_enable_bind(uint32_t texture_num) { const uint32_t max_textures = gl_max_combined_texture_image_units - gl_texture0; const uint32_t actual_texture = (gl_texture0 + texture_num); if (texture_num > max_textures) { throw std::runtime_error("error: texture::activate_enable_bind()"); } glactivetexture(actual_texture); glenable(target_type); glbindtexture(target_type, texture_id_); } is guaranteed work under implementations based on opengl specification, or implementers allowed have `gl_texture0 - gl_texture(gl_max_combined_texture_image_units -1)` defined in non-contiguous manner? i modifying code aswell here in have: void activate_enable_bind(uint32_t texture_num = 0) { glint max_textures = 0; glgetintegerv(gl_max_combined_texture_image_units, &max_textures); if (static_cas

unique - Removing identical facts in CLIPS -

how remove identical facts in clips? presuming have (fact 2) (fact 3) (fact 2) (fact 4) i want remain (fact 2), (fact 3) , (fact 4). how can that? well did this (defrule removeduplicates ?f1 <- (fact ?number1) ?f2 <- (fact ?number2) (test (eq ?number1 ?number2)) => (retract ?f1) )

ios - UIButton in subview not receiving touch after NSLayoutConstraint -

i have 2 custom uiviews i'm adding uiviewcontroller , aligning them using nslayoutconstraint. after apply nslayoutconstraint on uiviewcontroller view uibuttons in custom uiviews no longer receive touch events. - (void)viewdidload { [super viewdidload]; navigationbar = [[dtnavigationbar alloc] initwithframe:cgrectmake(0,0,320,45)]; [navigationbar settranslatesautoresizingmaskintoconstraints:no]; [self.view addsubview:navigationbar]; switchbar = [[dtswitch alloc] initwithframe:cgrectmake(0,0,320,44)]; [switchbar settranslatesautoresizingmaskintoconstraints:no]; [self.view addsubview:switchbar]; [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:|-0-[navigationbar(45)]-0-[switchbar(44)]-(>=100)-|" options:nslayoutformatalignallleft metrics:nil views:nsdictionaryofva

I need help fetching user group codes and then showing post for those groups with PHP and MySQL -

the code have works, there problem can't sort data id because of way it's fetching group codes. here's code: function displayoverview(){ global $database; global $session; $q = "select username, group_code " ."from classes username = '".$session->username."'"; $result = $database->query($q); /* error occurred, return given name default */ $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "error displaying info"; return; } if($num_rows == 0){ echo '<div id="container"><div id="float_left"><img src="profile_pics/default.gif" class="image3" width="50" height="50" border="0"></div> <div id="float_right"><div id="container2"><div class="bubble"> <p class="user_name"></

java - How to organize a single array into a two-dimensional one? -

i trying split 1 dimensional array of display modes 2-dimensional string array, though have encountered trouble got point of splitting sorted array of display modes. question: how can split single array, sorted, 2 dimensional array? code (sorry weird variable names): public static string[][] organizedisplaymodes (displaymode[] modes) { int iter = 0; int deltaiter = 0; int rows = 0; int columns = 0; string[][] tobe; //bubble sorting (int = 0; < modes.length - 1; a++) { for(int = 0; < modes.length - 1; i++) { if (modes[i].getwidth() < modes[i+1].getwidth()) { displaymode change = modes[i]; modes[i] = modes[i+1]; modes[i+1] = change; } } } for(int = 0; < modes.length - 1; i++) { if ((modes[i].getwidth() == modes[i+1].getwidth()) && (modes[i].getbitsperpixel() < modes[i+1].getbitsperpixel())) { displaymode change = mode

Read jpeg file in Python, encode it into Unicode and put it into protobuf -

i transferring image python backend c++ backend. chose google protobuf, following simple structure: message data { optional string image = 1; } i use python read image , put image field: data = server_pb2.data() data.image = (open(image_fn).read()) but protobuf complains following message: value error: [hex data] has type str, isn't in 7-bit ascii encoding. non-ascii strings must converted unicode objects before being added. i have tried several ways make data unicode without success. maybe has encountered problem before? or there better way transfer image data? thanks! you should using bytes type in .proto file rather string . bytes used arbitrary sequence of bytes (eg image). string used sequence of utf-8 or ascii characters (eg text).

sendmail - Send Mail fails? [php + xampp] -

in sendmail error log error: 13.05.17 22:33:23 : must issue starttls command first. x41sm21034997eey.17 - gsmtp<eol> 13.05.17 23:02:55 : must issue starttls command first. m48sm20850393eeh.16 - gsmtp<eol> 13.05.17 23:08:05 : must issue starttls command first. bn53sm21242331eeb.7 - gsmtp<eol> 13.05.17 23:43:54 : must issue starttls command first. x41sm21511836eey.17 - gsmtp<eol> 13.05.18 00:07:17 : must issue starttls command first. w52sm21617356eev.12 - gsmtp<eol> 13.05.18 03:03:16 : must issue starttls command first. e50sm22561955eev.13 - gsmtp<eol> 13.05.18 20:28:20 : must issue starttls command first. d10sm3967825wik.0 - gsmtp<eol> 13.05.19 05:14:31 : must issue starttls command first. dj7sm5901394wib.6 - gsmtp<eol> and sendmail file: [sendmail] smtp_server=smtp.gmail.com smtp_port=587 error_logfile=error.log debug_logfile=debug.log auth_username=artemkller@gmail.com auth_password=hidepass force_sender=artemkller@gmail.com