Posts

Showing posts from July, 2012

javascript - D3 fading SVG path animation -

could please show me how fade out older path segments in d3 svg animation: http://jsbin.com/zegim/2/edit this example fading out entire path in 10 seconds, see how path segments (and remain faded). added line: path.append('svg:animate') .attr('attributename', 'opacity') .attr('from', '1') .attr('to', '0') .attr('dur', 10); the example same code question: changing speed of d3 path animation http://bl.ocks.org/explunit/6082362 thanks!

Javascript: How to use eval() safely -

this question has answer here: when javascript's eval() not evil? 22 answers i building little game , i've gotten point need calculate data in tips of abilities unique each individual unit. figured i'm gonna need formula. don't know if the way it's supposed done here's i've come with tip = 'hurls fire ball @ enemy, dealing [x] damage.'; formula = '5 * unit.magicpower * abilitylevel'; so each unit's tool tip use tip.replace('[x]', eval(formula)) which appears work fine, i'm concerned safety of code. hasn't been once or twice i've seen people discouraging use of it. there potential issues may occur way i'm using eval() ? as long you control input eval , it's safe use it. concern comes in when you're using process input don't control. @ point, becomes unsafe because

java - Querying Mapped Superclasses or Equivalent -

i have 3 classes subclasses of abstract superclass automobile. i'm using single table inheritance model , @mappedsuperclass automobile class. subclasses car, truck, , van. i want query automobile class, have different subclasses returned. i've written couple queries , done research, seems not possible query against mappedsuperclasses. have tried nativesqlqueries, can't seem able figure out how specifiy multiple resultsetmappings. is there anyway accomplish this? you cannot use mapped-superclass in query. if want use automobile in query, don't mark mapped-superclass, instead mark entity. following jpa 2.0 spec , second paragraph what's relevant in case - 2.11.2 mapped superclasses an entity may inherit superclass provides persistent entity state , mapping information, not entity. typically, purpose of such mapped superclass define state , mapping information common multiple entity classes. a mapped superclass, unlike entity, not

java - Calling arbitrary number of object instances -

import java.util.*; public class userinput { public static void main(string[]args){ scanner input = new scanner(system.in); system.out.println("how many students in class?"); student.n= input.nextint(); for(int i=0; i<student.n; i++){ student = new student(null, null, null, null, 0); } } } i new java , wondering if it's possible call number of object instances value inputted user during run time. here "n" number of instances want make , thought use method refer variable "i" create new object instance every "i" until reached inputted value of "n". however, duplicate local variable error. wondering if there way around this???? one possible way this: arraylist<student> manystudents = new arraylist<student>(); for(int i=0; i<student.n; i++){ manystudents.add(new student(null, null, null, null, 0)); }

sas - Encoutering an error 'run executed for function module' while calling function -

i wrote 1 module in proc iml , trying call using call fuctiong , supplied parameters. but throwing erorr: run executed function module. any suggestion? the error message says have defined function returns value ('function module') need call this: x = myfunction(x,y,z); you cannot use call statement call function, call subroutines not return values.

rewrite - Wordpress permalinks redirect to the homepage in Lighttpd -

i have wordpress app live on raspberry pi lighttpd. have activated permalink option in admin pattern http://www.myurl.com/index.php/%category%/%postname%/ when click link see post or other pages (static pages, categories), i'm redirected homepage. is there additionnal rules set in lighttpd? far understand, there if want have clean url without /index.php/ . of course, links such http://www.myurl.com/?p=x work fine. what missing? as stated in comments above, had disable "rewrite" plugin (i downloaded before knowing permalinks anyway). have managed have url without /index.php/ configuring /%category%/%postname%/ in permalinks section of wp-admin , having these rules in lighttpd.conf : url.rewrite-once = ( "^/wiki/.*" => "$0", "^/(.*/)?files/$" => "/index.php", "^/(.*/)?files/(.*)" => "/wp-includes/ms-files.php?file=$2", "^(/wp-admin/.*)" => "$1

multithreading - Java while loop can not detect change by thread -

this question has answer here: loop doesn't see changed value without print statement 1 answer i'm new in java thread, write test program: //mytest.java public class mytest{ public static void main(string[] args){ mythread thread = new mythread(); int n; thread.start(); while (true){ //system.out.print(""); n = mythread.num; if (n != 0){ system.out.println("<num> has been modified " + n); if (n == -1) break; mythread.num = 0; } } system.out.println("main thread terminated!"); } } //mythread.java public class mythread extends thread { public static int num = 0; public void run(){ java.util.scanner input = new java.util.scanner(system.in);

c# - Visual Studio 2012 WPF Designer don't show. It show only the xaml source -

i have windows 8.1 , visual studio 2010 upgraded visual studio 2012. when open .xaml file can see xaml source , not visual designer. 2010 version works good. i tried reinstalling , doing reset of settings command line nothing changes. have no errors. if click on "show projection window" open again xaml source , not visual designer. why can't see visual designer? pc hp 655 notebook 4gb ram , ati hd raedon 7600 graphics card. thank in advance. mauro i know i'm coming quite late, 1 thing found going to: tools > options > text editor > xaml > miscellaneous then see if "always open documents in full xaml view" checked. if so, uncheck it. (vs2010)

c++ - Is it possible to change the entry point of a process from a DLL? -

the default entry point application processes 0x401000. is there way shift or change entry point of process? example, if wanted change entry point 0x901000 externally using dll (assuming process loaded dll via c++)? i'm trying create dll edit process's default entry point. yes, can change imagebase in optional header of portable executable, if linker allows this. linkers set imagebase=0x10000 when linking executable , 0x400000 when linking dll. however, number chosen arbitrarily (i guess because easy remember , looks in debuggers) , may disobeyed loader if memory occupied. see http://msdn.microsoft.com/en-us/library/ms809762.aspx table 3. paragraph image_optional_header.imagebase: when linker creates executable, assumes file memory-mapped specific location in memory. address stored in field, assuming load address allows linker optimizations take place. if file memory-mapped address loader, code doesn't need patching before can run. in executables produc

c# - Unit testing Entity Framework 6 with context inheriting from IdentityDbContext -

i'm looking unit testing methods using entity framework 6 using instructions provided here . my set-up different though - i'm using asp.net identity (the default implementation uses ef). such context inherits identitydbcontext. when run tests exception following details: castle.proxies.identityuserlogin: : entitytype 'identityuserlogin' has no key defined. define key entitytype. castle.proxies.identityuserrole: : entitytype 'identityuserrole' has no key defined. define key entitytype. identityuserlogins: entitytype: entityset 'identityuserlogins' based on type 'identityuserlogin' has no keys defined. identityuserroles: entitytype: entityset 'identityuserroles' based on type 'identityuserrole' has no keys defined. i've read in normal uses these set in default onmodelcreating method. but can offer advice on handling within mocked context illustrated in method linked above? thanks andy as p

java - How to mock this in an Enum class using jmockt? -

i trying write unit test below old legacy enum class. method trying unit test - tolocalpookstring . whenever running unit test code, going inside if statement in tolocalpookstring method since this getting resolved corp . public enum datacenterenum { corp, phx, slc, lvs; private static final datacenterenum ourlocation = comparelocation(); private static datacenterenum comparelocation() { // code here } private string tolocalpookstring() { if (this == corp || !(testutils.getenvironmentname().equalsignorecase("production"))) { return "/pp/dc/phx"; } return "/pp/dc/" + name().tolowercase(); } public static final string beta_pook_string = ourlocation.tolocalpookstring(); } is there way can mock this phx or slc or lvs apart corp in tolocalpookstring should not go inside if statement ? using jmockit here. new mockup<testutils>() { @mock public string

Floats, CSS, HTML - How can I do my positioning? -

Image
previously asked how position buttons align horizontally element? . need little more css , html until i've completed it. i have buttons correctly positioned, so, great! in advance. current output: current html: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>aspen development | home</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="navmenu"> <div id="header"> <div id="brand"><a href="index.html">aspen development</a></div>

matlab - Transform current workspace variables into code -

sometimes rather not show data other people , therefore need modify it. when ready export, wish export workspace data, instance table, is, posting here instance. i know generate script function, , feel answer related not that, , publish not command require. how do that? update example: how print table code? %% table example export workspace t={'a2p3';'a2p3';'a2p3';'a2p3 (extra1)';'a2p3 (extra1) , (extra 2)';'a2p3 (extra1)';'b2p3';'b2p3';'b2p3';'b2p3 (extra 1)';'a2p3'}; a={1 1 0 1 1 0 1 1 0 1 1 } t(:,2)=num2cell(1); t(3,2)=num2cell(0); t(6,2)=num2cell(0); t(9,2)=num2cell(0); t=table(t(:,1),t(:,2)); class(t.var1); class(t.var2); t.var1=categorical(t.var1) t.var2=cell2mat(t.var2) class(t.var1); class(t.var2); since matlab 2014a there new feauture: matlab provides ability save workspace variables matlab script. once script saved, can regenerate workspace variables ru

jquery - Ajax submit multipart form without defining form fields -

i want submit form through ajax contains file input. use xmlhttprequest or iframe fallback. preferably, use plugin achieve this, however, far can see pretty plugins don't use existing forms create own, , require additional fields handset. form created framework , works, including csrf-protection example. don't want change backend, nor want hardcode fields , form properties in plugin, want tell 'here's form, handle it. , if form change (which in near future) want submit work without changing anything. are there ways existing plugins such dropzone, jquery file upload (or iframe transport part of it) use existing forms basis? or there plugin this? dropzone works existing forms. <form action="/upload" class="dropzone" id="my-dropzone"> <input type="hidden" name="csrf" value="xxx" /> </form> dropzone automatically find form(with class dropzone ) , initialize new dropzone. f

list - Why does adding the error case break my implementation of last? -

this code works fine: last' :: [a] -> last' (x:[]) = x last' (x:xs) = last xs but if try add: last' [] = error "empty list" anywhere. error: "couldn't match type 'a' [char] -> a0' 'a' rigid type variable bound type signature last' :: [a] -> in expression: error in equation last': last [] = error "empty list" why this? implementations of head, tail , init did not scream when put in case empy list. i'm idiot. had typos. thanks! adding error not breaking code. should correct implementation: last' :: [a] -> last' (x:[]) = x last' (x:xs) = last' xs -- xs not x last' [] = error "empty list"

android - How to display map using fragment -

mainactivity.java import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; import android.os.bundle; import android.annotation.targetapi; import android.app.activity; public class mainactivity extends activity { static final latlng latlng = new latlng(13 , 80); private googlemap googlemap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); try { if (googlemap == null) { googlemap = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map)).getmap(); } googlemap.setmaptype(googlemap.map_type_hybrid); marker mar = googlemap.addmarker(new markeroptions(). position(latlng).title("google map"

linux - Grep Shadow File Meaning -

will please me output of following code? egrep -v '.*:\*|:\!' /etc/shadow |awk -f: '{print $1}' why don't try it? it's list of users have password. other users have * or ! after name: in /etc/shadow file.

git - Complete Merge/Copy/Push of a Branch -

as part of build process, need make 1 branch another. needs actual branch (tagging not option). both branches exist. destination branch never touched other process. this have: git checkout destination git merge source git push does approach? there simpler way? edit to clarify, end goal take snapshot of source , push remote destination. each time specific build run. i need make 1 branch another. git branch -f one_branch now one_branch looks another . if want have one_branch checked out locally well, replace branch -f checkout -b .

java - Evaluating jFileChooser options -

i'm working program opens jdialog jmenu, need evaluate option users choose (open, cancel or exit) in order proceed in different ways. int result;// result = jfilechooser1.showopendialog(this); if (result == jfilechooser.approve_option) { system.out.println(jfilechooser1.getselectedfile().getname()); system.out.println(jfilechooser1.getselectedfile().getabsolutepath()); ... } else if (result == jfilechooser.cancel_option) { ... } the problem everytime need evaluate result, showopendialog() opens again dialog. there other way options without oppening dialog? it seems mean have run code block again , again evaluating result choosed. if truth, , can't split showopendialog() thing if...else... thing, can define varible belong class, name can "ischoosed"(boolean), , doing this: if(ischoosed == false ) { result = jfilechooser1.showopendialog(this); ischoosed = true ; }

json - How to get the Grid Size in JQuery -

i had div id ("mydivid"), in i'm able json result it. problem - when json result size zero, want show message - "result size zero" . if size greater than zero. usual display content in it. $("#mydivid").setgridparam({datatype:'json', page:1,url : url}).trigger('reloadgrid'); i got answer. it can done using isemptyobject method, passing response input argument. if(jquery.isemptyobject(response)) { jquery("#gbox_"+divid).hide(); jquery("#no_record_found").html("result size zero"); $("#test").removeattr("disabled"); if(callback!= null) callback(); }

android - Using getExternalFilesDir with multi SDCards (Galaxy S3) -

with android 4.4.2 have have change environment.getexternalstoragedirectory() use context.getexternalfilesdir(null) this works fine on 4.4.2 emulator , galaxy s3 on galaxy s3 using internal memory , not sdcard i have used ( how can external sd card path android 4.0+? ) answer 18 find sdcard is there anywhere round issue on galaxy s3 combining getexternalfilesdir() , galaxy s3 thanks this works fine on 4.4.2 emulator , galaxy s3 on galaxy s3 using internal memory , not sdcard it using external storage on both emulator , galaxy s3. completed blog post series explaining internal storage , external storage , , removable storage mean in android. is there anywhere round issue on galaxy s3 combining getexternalfilesdir() , galaxy s3 you welcome use getexternalfilesdirs() (note plural) on android 4.4+. if array has more 1 entry, second , subsequent entries on removable media (sd card, usb storage, etc.).

c# - Best tools/practices for active and passive monitoring for a service/api -

i have running service instrument active/passive monitoring. the service/api written in c# - are there tools can use write/do active monitoring (i.e. call service verify expected result)? are there tools instrument code records when "bad" happens - i.e. exception thrown or processing time high? it great if there tools capture data , alerting off of it. sure exist , see community recommend. we using nagios http://nagios.org monitoring webservices coded in c#. can check new relic http://newrelic.com

Writing into a div within a view for angularjs -

using angular js , document.getelementbyid('comments1').innerhtml= how write div within view. new angular js , not know how this. you don't 'write view' using angular. more correctly, set property on scope bind view property. this. //in controller $scope.name = "tyler'; //in view <div> {{name}} </div> obviously there lot more though. i'd recommend getting deeper understanding of strengths , weaknesses of angular before decide use though. *if did want write view, you're better off setting directive because shouldn't doing dom manipulation anywhere directive.

jquery - How can i add dynamic data inside flag series in highcharts -

i getting data in code chart running,i added flags max value , min value in x-axis,now want display rating inside flag.but here catagories data come rating not come on flag.here data , rating dynamically data not static. have tried on stack overflow suggestion,as including highstock.js , highcharts.js file still not working. please give me proper solution column chart. $(document). ready(function() { var options = { chart: { renderto: 'container', type: 'column', marginright: 130, marginbottom: 50 }, title: { text: 'top 15 projects facilities rating', x: -20 //center }, subtitle: { text: '', x: -20 }, xaxis: { categories: [] }, yaxis: { title: { text:

Insert update and delete in servlet and jsp -

i new servlet , jsp trying achieve operation view,add , update , delete dont have idea achieve operation how forward page , maintain session , pass value jsp kindly in right way. had gone many tutorial no idea , here tried controller.java package servlet; import java.io.ioexception; import java.io.printwriter; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import db.dbconnect; public class controller extends httpservlet { private static final long serialversionuid = 1l; public controller() { super(); } protected void doget(httpservletrequest request, http

cloudera - Oozie Web Console working very slow -

in cluster oozie web console slow. when go web console takes 10 -15 secs pass request oozie server , takes 10-15 secs publish result got oozie server. same working fine in hue. has 1 experienced this? getting issue in both cdh 4.4 , cdh 5.0.0 beta2. i guess there issues in oozie tomcat war file. idea guys? often bottleneck oozie it's internal database - derby. works small installations, not if have dozens of coordinators hundreds of materializations. recommend setup external database oozie (postgres/mysql/..). cloudera provided instruction on subject - http://www.cloudera.com/content/cloudera-content/cloudera-docs/cm4ent/4.5.1/cloudera-manager-enterprise-edition-installation-guide/cmeeig_topic_5_3.html

php - CodeIgnitor - Image upload. -

whenever choice file browse , click upload, not work. it codeignitor project. new in php , codeignitor. #my coctroller name member , code below: public function profile_change_avater(){ $this->load->model('member_model'); if($this->input->post('upload')) { $this->member_model->do_upload(); } $data['title'] = "choise avater"; echo "<pre>"; print_r($data['title']); echo "</pre>"; $this->common_load_view('member/user_extended_profile_change_avater_content_view', 'members', 'profile_change_avater', $data ); } model name member_model, code below: public function do_upload(){ //$this->image_path = realpath(apppath .'../asset/images' ); $this->upload->initialize($config); $config = array( 'allowed_type' => 'jpg|jpeg|gif|png', 'upload_path' => '

ksoap2 - Parse Ksoap response array in android -

i want parse ksoap response array not getting it response when debug app: events_data { events = [events { groom = sanskaar; bride = saumya; event_name = wedding; venue = new delhi; event_date = tuesday april 14, 2014; }, events { groom = sanskaar; bride = saumya; event_name = hzbrgbj; venue = new delhi; event_date = tuesday april 14, 2014; }, events { groom = sanskaar; bride = saumya; event_name = wedding; venue = new delhi; event_date = tuesday april 14, 2014; } ]; } code using parse response: soapobject response = (soapobject) envelope.getresponse(); //soapobject response = (soapobject) envelope.bodyin; system.out.print(response); int count = response.getpropertycount(); system.out.

Coupling and how to reduce it -

Image
in of following lines of code coupling occurs? kind of coupling? problem induced coupling? how can code refactored reduce coupling? one way approach @ function/method depends upon. it explicitly depends on arguments - form of control coupling, in case. however if tried compile method in isolation, can see other objects depends upon: log , , specific methods of log (note seem call both of these methods) ignore_user_requests log_verbosity_level , repeated 4 times in method a specific collector class. mem , 4 attributes (size, startaddress, etc) - form of content coupling i think argue there several cases of common coupling (shared global variables) there, though it's not terribly clear limited context. , variables may scoped within object or package, not 'global'. then consider: what happen if wanted change 1 of these items. example, if wanted use different collector implementation, or different logger; or structure of mem changed? how tes

cgi - Linux bash interruptions -

i'm trying put when receives event, , http request apache cgi-bin generate "flag" script picks , execute code? another "interrupt" push button im getting of problems, becuase want put in loop, if source script sourcing script halt because of loop, if use name pipes halt waiting data... i've been triying named pipes, sourcing scripts , sorts of things dont manage consistent, wondering thinking on using other ipc options, signals, shared memory , thoose kind of things. to start have experience this, know resources , if it's possible. i needed work @ kernel level using inter-process communications socket or known domain sockets

Matrix Row manipulation in Breeze using Scala? -

i've densematrix 1 2 3 0 0 0 0 0 0 0 0 0 11 22 33 0 0 0 0 0 0 0 0 0 111 222 333 i want remove first row , last row 0 s 0 0 0 11 22 33 0 0 0 0 0 0 0 0 0 111 222 333 0 0 0 0 0 0 0 0 0 how achieve in breeze ? first, gather rows still want: val subset = matrix(::, 2 3) then add zeroes: val newmatrix = densematrix.horzcat(subset, densematrix.zeros[double](1,9)) i might have mixed rows , columns in last line.

javascript - Sending json data to next jsp page -

my problem follow : making ajax call jsp , getting json object comprising of flag , arraylist jsp : gson gson = new gson(); jsonobject root = new jsonobject(); root.addproperty("flag", flag); //add flag root.addproperty("list", gson.tojson(list)); out.println(gson.tojson(root)); now in success function of ajax function want move other jsp did : success: function(response){ alert(json.stringify(response.list)); //alert(json.stringify(response.flag)); if(json.stringify(response.flag).indexof("true")>=0){ location.href="grouploginscreen.jsp"; } else{ alert("unsuccessful"); } } now,the problem part though getting results here correct how send list argument in url grouploginscreen.jsp @ recieving end can obtained doing : arraylist<string> list1 = (arraylist<string>)request.getattribute("mylist"); please help. location.href="grouploginscreen.jsp" make new request browse

java - Unable to find a factory for http://www.w3.org/2001/XMLSchema -

i'm having annoying problems following code, worked okay until switched java 1.7 import javax.xml.validation.schemafactory; schemafactory factory = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); running netbeans -djaxp.debug=1, following error thrown: the above snipped code part of osgi bundle jaxp: using thread context class loader (sun.misc.launcher$appclassloader@5e3a78ad) search jaxp: looking system property 'javax.xml.validation.schemafactory:http://www.w3.org/2001/xmlschema' jaxp: property undefined. jaxp: found null in $java.home/jaxp.properties jaxp: no meta-inf/services/javax.xml.validation.schemafactory file found jaxp: attempting use platform default xml schema validator jaxp: instanciating org.apache.xerces.jaxp.validation.xmlschemafactory jaxp: failed instanciate org.apache.xerces.jaxp.validation.xmlschemafactory java.lang.classnotfoundexception: org.apache.xerces.jaxp.validation.xmlschemafactory @ java.net.urlclassloader$1.run(urlcl

curl - Trouble querying the VersionOne query.v1 api -

i trying access versionone (enterprise edition) server's query.vi api. able query rest services , meta.v1, going /query.v1 gives "trouble executing url" error. i using curl , browser access @ moment query apis. e.g. works: curl -x -u user:pass <baseuri>/rest-1.v1/data/timebox error: curl -x post -u user:pass --header "content-type:application/json" -d @data.txt <baseuri>/query.v1 where data.txt = { "from":"timebox" } also error, going localhost/versionone/query.v1 gives trouble executing url error. what going wrong here? how fix it? i have no problems using curl query.v1. if provided more problems executing url. http status code clue. some potential problems: the query.v1 endpoint introduced in versionone 13.2, summer 2013. see error on release before that. if have selected windows integrated authentication on-premise installation of versionone, query.v1 may require ntlm authentication

Clone HTML Element vs creating it with Javascript -

i'm getting list of employees via ajax request. i'm creating bunch of divs name address telephone etc. these new elements have buttons provide functionality. have been using approach: var employee = function(params) { this.name = params.name; this.hrid = params.hrid; this.initialize = function() { this.container = document.createelement('div'); this.contname = document.createelement('div'); this.conthrid = document.createelement('div'); this.mybutton = document.createelement('button'); this.contname.innerhtml = this.name; this.conthrid.innerhtml = this.hrid; this.container.appendchild(this.contname); this.container.appendchild(this.conthrid); this.container.appendchild(this.mybutton); this.addobservers(); } this.addobservers = function() { this.mybutton.observer = this.dostuff.bind(this); this.mybutton.addeventlistener('click', this.mybutton.observer); } this.dost

php - Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) -

warning: mysql_connect(): access denied user 'root'@'localhost' (using password: yes) in c:\xampp\htdocs\login\sessionhandler.php on line 35 so what's on line 35. //to make connection database $conn = mysql_connect("localhost", "root", "password") or die(mysql_error()); i don't know whether problem or code i'm writing. have searched every possible answer not looking for. this code (if problem not on line 35) //validation error flag $errflag = false; //input validation if($_post['uname'] == '') { $errmsg_arr[]='login id missing'; $errflag = true; } if($_post['pword'] == '') { $errmsg_arr[] = 'password missing'; $errflag = true; } //if there input validations, redirect login form if($errflag) { $_session['errmsg_arr'] = $errmsg_arr; session_write_close(); header("location: login.php"); exit(); } //to make

c++ - Assigning texture to an object using multiple textures -

Image
i'm making object loader, , texture parts in different texture files. best solution of having mapped on model? need treat every part has it's own texture 1 model, final body has many separate drawing calls 1 texture each? with advent of programmable rendering pipeline (i.e.: shaders ) can apply , combine multiple textures meshes without need multiple draw calls. modern gpus have several texture units ( glactivetexture ) , shaders can read may units @ time. model on right showed in picture, example, uses variation of phong lighting model diffuse texture, normal map texture , specular map texture highlights. these 3 textures applied each texture unit , whole model rendered in 1 draw call. fragment shader reads textures , combines them produce final image. your question not specific, can now. if have more specific questions, please fell free ask.

c# - How to avoid loss of precision in .NET for converting from Unix Timestamp to DateTime and back? -

consider following snippet var original = new datetime(635338107839470268); var unixtimestamp = (original - new datetime(1970,1,1)).totalseconds; // unixtimestamp 1398213983.9470267 var = new datetime(1970,1,1).addseconds(1398213983.9470267); // back.ticks 635338107839470000 as can see ticks value got different started with. how can avoid loss of precision in c# while converting date unix timestamp , back? http://msdn.microsoft.com/en-us/library/system.datetime.addseconds.aspx datetime.addseconds() per documentation rounds nearest millisecond (10,000 ticks). using ticks: // have datetime in memory datetime original = new datetime(635338107839470268); // convert unix timestamp double unixtimestamp = (original - new datetime(1970, 1, 1)).totalseconds; // unixtimestamp saved somewhere // user needs make 100% precise datetime unix timestamp datetime epochinstance = new datetime(1970, 1, 1); datetime = epochinstance.addticks((long)(unixtimestamp * timespan.ti

php - Wordpress MultiSite - Showing Latest Blogs of ALL Sites? -

in experimenting multisite, see each site gets it's own wp tables numbered. is there efficient way combined results among sites? or independent in database? one thing i'd have list of latest blogs on front page. yet see no apparent way this. forgive fact there no code or "attempts" on question. new me.

Use of request.getSession(false) in TagLib of Grails throws exception -

i trying use below code in taglib of grails 2.3.5. class logintaglib { def logincontrol = { if(request.getsession(false) && session.user){ out << "hello ${session.user.login} " out << """[${link(action:"logout",controller:"user"){"logout"}}]""" } else { out << """[${link(action:"login", controller:"user"){"login"}}]""" } } } i getting following error: groovy.lang.missingmethodexception: no signature of method: org.apache.catalina.connector.requestfacade.session() applicable argument types: (java.lang.boolean) values: [false] possible solutions: getsession(boolean), getsession() racetrack.logintaglib$_closure1.docall(logintaglib.groovy:9) d__java_grails_workspace_racetrack_grails_app_views_layouts__header_gsp.run(_header.gsp:7) d__java_grails_workspace_racetrack_grails_app_views_layouts_m

how to push git branch -

i need git branches. not think understand procedure @ all, keep getting confused. what want make simple branch, can fix issue on website without erasing things i've worked on far. have moved far away have on production server, cant tidy code prevent breaking site. so have tried in several ways make new branch, things keep giving me errors , such. example, saw somewhere can create tag, , turn branch. have. tagged commit wanted branch work from, made new branch, , sure enough have 2 heads "master" , new branch. however, in gitlab page, cannot see new branches... , pushing server gives me errors can't figure out why occur. it gives me log when try push: counting objects: 97, done. delta compression using 2 threads. compressing objects: 100% (25/25), done. writing objects: 100% (51/51), 21.31 kib | 0 bytes/s, done. total 51 (delta 39), reused 35 (delta 25) remote: /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/dsl.rb:33:in `eval_gemfile': ge

c# - Windows Phone 8.1 and Windows Phone 8 device - Will it work -

i've started new windows phone 8.1 project in visual studio 2013 , i've been doing lot of coding already. my questions is, can run project on windows phone 8 device? wikipedia (for example) says isn't possible, that's why wanted second opinion. if have start over, have lot of trouble importing previous files? obviously project needs target 8.0 run on 8.0 or higher. start new 8.0 project , import code. if don't have 8.1 specific code (which likely), compile fine , run on 8.0 , 8.1.

sockets - How to implement SuperSocket -

i trying implement supersockets - https://supersocket.codeplex.com/ project working on. have server uses configuration run. in project i have referenced: supersocket.common, supersocket.socketbase, supersocket.socketengine i added following config section: <configsections> <section name="supersocket" type="supersocket.socketengine.configuration.socketserviceconfig, supersocket.socketengine" /> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <appsettings> <add key="servicename" value="someservice" /> </appsettings> <supersocket

excel - Sort a list by another list... to organize matching pairs on the same row -

i know title sounds little funky. i'm trying do: have large list of data , i'm trying sort small list off of large list. want small list row number match large list row number. looks this: aaa aaa bbb ddd ccc eee ddd hhh eee kkk fff ggg hhh iii jjj kkk what want this: aaa aaa bbb ccc ddd ddd eee eee fff ggg hhh hhh iii jjj kkk kkk i didn't see in research, wondering if there's simple way in excel. tried pivot table couldn't results want. insert column between with: =iferror(if(match(a1,c:c,0)>0,a1,),"") copied down, select first 2 columns, copy, paste special, values... on top , delete third column.

How can I get the IP address and port of a client with PHP? -

how ip , port of client php? i tried script below gives me ip address. <?php print $_server['remote_addr']; ?> port defined in http server (apache or other , 80 or 443) the php $_server variables can check @ : http://www.php.net/manual/en/reserved.variables.server.php i sure : remote_addr' ip address user viewing current page. but if server behind nat: if serving behind proxy server, save time looking @ these $_server variables on machine behind proxy. $_server['http_x_forwarded_for'] in place of $_server['remote_addr'] $_server['http_x_forwarded_host'] , $_server['http_x_forwarded_server'] in place of $_server['server_name'] :-)

html - Lost Background on Wordpress Post Area -

i'm in need of serious help. i'm working on wordpress website , removed shouldn't have, , can't back, plus, i'm not sure deleted. page seems affected home page, while rest of pages fine. i trying remove few things sidebar, , they're gone now, post background gone (needs white), , footer pushed left side. i've looked @ page encoding through browser, , can identify div it's in, however, i'm having trouble locating in wordpress files. any appreciated. the website located here: http://mathenyheatcool.com/ here's code editing (i working @ bottom): enter code here <?php /* template name: matheny home page */ ?> <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post();?> <div class="post"> <?php the_content(); ?> </div> <?php endwhile; endif; ?> <div id="matheny-sidebar-block"> <div style="width:100%;text-align:center;"&g

google play services - How to implement leaderboard in Android application? -

i'm trying implement leaderboard in android application, don't know connect google play game services , display/update leaderboard. i read google documentation, searched on internet, couldn't find solution. i created except code. created game in developer console, added leaderboard, downloaded google play services android studio, updated androidmanifest <meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> can please post code needs go inside @override protected void oncreate(bundle savedinstancestate) { ... } , required connect google play game services , display/update leaderboard? follow documentation google play services using able implement game, best! https://developers.google.com/games/services/android/l

c# - How to save settings from an windows form app using a savedialog -

i have word search creator app. user inputs list of words, width , height settings, word placement settings etc. when user clicks save button, these settings saved file, later user can open app saved settings. have no idea how though. (except opening savefiledialog) the savefiledialog provides application gui save window allows user choose save location , filename. dialog comes event handler (which believe called fileok) can access mysavefiledialog.filename . no data or file has been saved yet. that, take variety of routes, simplest using system.io.streamwriter: using system.io; ... streamwriter sw = new streamwriter(mysavefiledialog.filename); //pass chosen filename sw.writeline( string goes here ); sw.close(); you'll have come string representation of data, though. for more complex types, use xml serialization. can define data structure class , use .net's built in system.xml.serialization namespace automatically output representation of class easy re

php - How to handle concurrent DB connections by multiple users using PDO in PHP5 -

i want use pdo in application. confused regarding use of pdo here. because application access target multiple users. lets 100 users in simultaneously . so, read pdo create 100 db connections access. can create problem limit on concurrent connections allowed server. , new users connection error. how can use pdo such way handles concurrent connections , not overhead? 100 concurrent users not impressive number though. taken average user makes click once minute, have 100 connects 60 seconds, makes 1.5 connects / second. sanely written app should perform no longer 0,1 sec. means 10 connections fit in 1 second. , have 1.5. yes, can peak sometimes, anyway, number of allowed connections last thing think of. database killed far earlier limit reached - due improper indexing , architecture.

c# - Register multiple components with multiple services in Castle Windsor -

i have services , interfaces them in 2 separated assemblies, 1 interfaces , implementations. i'm trying register them using castle windsor. works using this: container.register(component .for(iservice1) .implementedby(service1) .lifestyle.transient()); container.register(component .for(iservice2) .implementedby(service2) .lifestyle.transient()); the thing here is... possible register components @ once? without having register them 1 one. have seen possible register multiple interfaces simple component, o multiple implementations single interface, haven't seen if it's possible register multiple interfaces 1 assembly multiple implementations assembly. i don't know if has relevance, interfaces have same base(iservice in case). thanks lot. what looking registering components conventions . declare implementations castle should consider, , services should associate implementations with. container.register( // want concrete classes in assembly

java - Is it ok to use 'this' in final instance variable declaration? -

is ok use this keyword in final instance variable declaration/initialization in java? like this: private final someclass foo = new someclass(this); it worked when tried out. , since not static variable guess should referring particular instance. felt unsure if advisable or not therefore wanted ask here. edit: main class android activity class, , someclass-instance needs activity context. it "technically valid" this. indeed, this refers particular instance - namely, instance contains instance of someclass . but not recommend in general. exact behavior , state of this passed constructor depends on subtle details. consider following example: class someclass { public someclass(dangerousselfreference dangerousselfreference) { system.out.println("state: "); system.out.println(" a: "+dangerousselfreference.geta()); system.out.println(" b: "+dangerousselfreference.getb()); system.

code generation - Sitecore Glass Mapper always null -

i using sitecore glass mapper new project i'm setting up. using sitecore 7.2, latest version of team development sitecore (tds) code generation , latest version of glass. the code trying execute: var b = new sitecorecontext(); var c = b.getcurrentitem<t01_homepage>(); b not null. c null. var d = b.getitem<t01_homepage>("path") d null. i added assembly in glassmappersccustom: public static iconfigurationloader[] glassloaders(){ var attributes = new attributeconfigurationloader(new[] { "company.framework.websites.corporate", "company.framework.core", "company.framework.common" }); return new iconfigurationloader[] { attributes }; } when b.glasscontext.typeconfigurations models there. i figured language issue because site in dutch , maybe wrong language resolved incorrectly. not case. i disabled webactivator , added glassmappersc.start() in global.asax application_start method. we using

php - codeigniter don't get the right value using for loop -

i'm struggling getting right values in of loop. here data pass controller view $data['moisstring'] = $moisstring; //result of var_dump var_dump($data['moisstring'] ); array (size=3) 0 => string 'janvier' (length=7) 1 => string 'février' (length=8) 2 => string 'mars' (length=4) $data['year'] = $year; //result of var_dump var_dump($data['year'] ); array (size=3) 0 => int 2014 1 => int 2014 2 => int 2014 in view have form_dropdown , want obtain like: **************** * janvier 2014 * * février 2014 * * mars 2014 * **************** here view: echo form_open('suivrepaiement/view', 'method="get"'); $month = array(); $annee = array(); ($i = 0; $i < count($moisstring); $i++) { $month[] = $moisstring[$i]; $annee[]= $year[$i]; foreach ($fichefrais $mois) {

Prolog - parse with DCG -

i want write dcg can deal text presented in notepad. i've read online tutorial writing dcg none of delt text free , involves strings,dates , integers. i'm not sure how start writing dcg (how represent line or date). help? the 'trick' it's approach problem in declarative way, giving first more selective patterns. data format has apparently defined columnar structure, , using library(dcg/basics) handled: :- [library(dcg/basics)]. row([date,key|numerics]) --> date(date), separe, key(key), separe, numeric_pairs(numerics). date(d/m/y) --> integer(d), "/", integer(m), "/", integer(y). key([f|ks]) --> [f], {f \= 0' }, string(ks). numeric_pairs([num:perc|nps]) --> integer(num), separe, number(perc), "%", whites, !, numeric_pairs(nps). numeric_pairs([]) --> []. separe --> white, whites. test: ?- atom_codes('02/18/2014 bats z 235122734 6.90% 109183482 10.50% 147587409 7.80%', cs

javascript - Dropdown selection creating dynamic input types -

i have 3 options in dropdown in html.now on selecting each 1 of option in dropdown want different input types created dynamically. firstly here options in dropdown : <select name="choicetosearch"> <option value="none" style="display:none;"> ---none--- </option> <option value="searchname"> notification sender </option> <option value="searchtype"> notification type </option> <option value="searchdate"> notification date </option> </select> now, on selecting notification sender want a textbox displayed. on selecting notification type want two checkboxes should shown. on selecting notification date want two date type input fields shown. how can done?please help. you need learn javascript since didn't provide attemts solve problem. anyway, need create fields wan