Posts

Showing posts from July, 2011

arm - How uboot passes hardware information to kernel without using DTS -

i new embedded linux development. have port uboot , custom linux distribution new arm based board. the uboot using (2009.08) not have arch , dts folders. suppose older version not use use dts pass hardware information kernel (v 3.0). have read lot dts here not enough information on internet (obsolete?) method of passing hardware information uboot kernel using. internet tells me there c files task both in uboot , kernel source code have sync'd, can 1 point me in direction? also, please correct me if assumptions wrong, , ask more info if needed. the (old) method pass data between u-boot , linux arm kernel called atag memory list. information such usable memory regions, machine type , board information passed u-boot linux arm kernel using data list. in u-boot, atags built in lib_arm/armlinux.c (1.1.5) or lib_arm/bootm.c (2009.08) or arch/arm/lib/bootm.c (2015.04), , require configuration options config_setup_memory_tags , salient config_xxx_tag s. atags pr...

Matlab: Create function with another function as argument -

i need create function f function, g , argument ( g defined in .m file, not inline ). in body of f , need use feval evaluate g on multiple values; like: function y = f(a,b,c,g) z=feval(g,a,b,c); y=... end what syntax ? tried use handles, got error messages. you can way: define f in m-file: function y = f(a,b,c,g) y = feval(g,a,b,c); end define g in m-file: function r = g(a,b,c) r = a+b*c; end call f handle g : >> f(1,2,3,@g) ans = 7

osx - AVFoundation - how to mirror video from webcam - Mac OS X -

i trying mirror video received webcam on mac os x. avoid doing manual flip/tranform after receiving video buffer . so, want setup avcapturesession such video buffer received in captureoutput method of avcapturevideodataoutputsamplebufferdelegate mirrored avfoundation itself. don't want use preview layer. on imac(10.8.5), mirror video, avcaptureconnection isvideomirroringsupported tested before setting videomirrored property. video buffer received in captureoutput delegate isn't mirrored. note: video mirroring on ios successful, when followed this answer. isn't helping on mac os x. code used below. error checking left out post. //create session _session = [[avcapturesession alloc] init]; //get capture device _device = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; //create sesion input nserror * error; _sessioninput = [avcapturedeviceinput deviceinputwithdevice:_device error:&error]; //create session ...

php - Email with activation -

i'm trying make form login , registration in php website. users can register administration approval. in php send email admin activation code, code didn't work want. in users table have 2 rows (ativo,code) register.php require ("ligacaobd.php"); $user=$_post['user']; $pass=md5($_post['pass']); $email=$_post['email']; if($user && $email && $pass) { $confirmcode=rand(); $query=mysql_query("select * utilizadores user='".$user."'"); $numrows=mysql_num_rows($query); if($numrows==0) { $sql="insert utilizadores(id_user,id_type,user,email,password,ativo,code) values(null,'2','$user','$email','$pass','0','$confirmcode')"; $result=mysql_query($sql); if($result) { echo "thanks! please wait adminstration approval!"; ...

c++ - How does scoped_lock avoid emitting an "unused variable" warning? -

boost::mutex::scoped_lock handy raii wrapper around locking mutex. use similar technique else: raii wrapper around asking data interface detach from/re-attach serial device. what can't figure out, though, why in code below object mst — instantiation , destruction do have side effects — causes g++ emit "unused variable" warning error whereas l manages remain silent. do know? can tell me? [generic@sentinel ~]$ cat test.cpp #include <boost/shared_ptr.hpp> #include <boost/thread/mutex.hpp> #include <iostream> struct myscopedthing; struct myworkerobject { void a() { std::cout << "a"; } void b() { std::cout << "b"; } boost::shared_ptr<myscopedthing> getscopedthing(); }; struct myscopedthing { myscopedthing(myworkerobject& w) : w(w) { w.a(); } ~myscopedthing() { w.b(); } myworkerobject& w; }; boost::shared_ptr<myscopedthing> myworkerobject::ge...

Drawing a real time route in android, google maps v2 -

i'm looking better way @ drawing route on google map v2 on android in real time. i'm developing android route tracking application, have service continuasly tracks location in background , sends location update via broadcast activity map fragment. in activity have implemented local broadcast receiver receives location updates service. code works @ drawing route not smartest way because have continuasly clear map avoid route overdrawing itself. there better , efficient way maps v2? public class trackingservice extends service { // ... @override public void onlocationchanged(location location) { //... datasource.open(); datasource.insertlocation(location.getlatitude(), location.getlongitude()) datasource.close(); broadcastlocation(location); } private void broadcastlocation(location location) { intent intent = new intent(action_receive_location); intent.putextra(key_new_location, location); sendbroadcast(intent); } } pub...

c# - iLNumerics isn't displaying my 3d plot - the plot remains 2d -

the code this: //we need render locations. ilarray<float> ourpositions = oursimulator.getstars(); var scene = new ilscene(); var plotcube = scene.add(new ilplotcube(twodmode: false)); var ourposbuffer = new ilpoints(); ourposbuffer.positions = ourpositions; plotcube.add(ourposbuffer); plotcube.fieldofview = 120; plotcube.lookat = new vector3(0, 0, 0); ilstarchart.scene.configure(); now, earlier version of code (in different solution) still uses 3.3.2, , var plotcube = scene.add(new ilplotcube(null, false) ) i've tried both on 3.3.3 version, , neither displays 3d plot. instead, it's 2d grid. doing wrong here? (the points are: <single> [3,4] -32.00000 37.00000 36.00000 38.00000 54.00000 107.00000 106.00000 130.00000 -81.00000 -16.00000 -124.00000 -226.00000 ) edited: missing ) on 3.3.2 example edited: reduced of non criti...

string - Python function input with variable length -

this kind of vague, i'm in process of making english-to-kong translator. kong, being "language" word "grape" turns "gong rong pong e", requires split input word, in case grape, each individual letter, check if it's vowel, , if not append "ong" it. i came across problem way if knew number of letters in word, because ended running each letter through function checked if vowel, , if not appended "ong". that, did first = word[0] , second = word[1] , , on, , ran through vowelchecker function. is there way have word number of letters go through function , still come out properly? you can loop through string list of letters. for example: word = 'grape' in word: #do here, in each iteration of loop, a set value of current letter of word string. don't need know length ahead of time because loop run until has looped through letters (unless write condition break loop).

python - How do I test whether an nltk resource is already installed on the machine running my code? -

i started first nltk project , confused proper setup. need several resources punkt tokenizer , maxent pos tagger. myself downloaded them using gui nltk.download() . collaborators of course want things downloaded automatically. haven't found idiomatic code in docu. am supposed put nltk.data.load('tokenizers/punkt/english.pickle') , code? going download resources every time script run? provide feedback user (i.e. co-developers) of being downloaded , why taking long? there must gear out there job, right? :) //edit explify question: how test whether nltk resource (like punkt tokenizer) installed on machine running code, , install if not? you can use nltk.data.find() function, see https://github.com/nltk/nltk/blob/develop/nltk/data.py : >>> import nltk >>> nltk.data.find('tokenizers/punkt.zip') zipfilepathpointer(u'/home/alvas/nltk_data/tokenizers/punkt.zip', u'') when resource not available you'll find erro...

c# - ArgumentOutofRangeException was unhandled,"InvalidArgument=Value of '0' is not valid for 'index'." -

i have been getting error "invalidargument=value of '0' not valid 'index'." private void button3_click(object sender, eventargs e) { object lst=listview1.selecteditems[0].clone(); listview1.items.removeat(listview1.selecteditems[0].index); listview2.items.add((listviewitem)lst); sqlcommand cmd = new sqlcommand("update visitortb set checkstat=1 passno=" + text_passno.text + "", db.connect()); if (cmd.executenonquery() >= 0) { messagebox.show("check out complete"); } } you've haven't selected items in listview . the selecteditems property collection of listviewitem objects, , collection it's possible empty. check count property of collection first, before trying access first element. if (listview1.selecteditems.count == 0) return; // rest of code

python - Calculation of age of domain by passing value in URL using POST method -

i want calculate domain age of several website http://www.webconfs.com/domain-age.php passing variable in url http://www.webconfs.com/domain-age.php?domains=youtube.com . the problem in form tag of site, using post method, in python code, whether append domain name or not returns same web page. how can pass value of different website url , result web page? you can use requests making post request , beautifulsoup html parser getting age form html page: >>> import requests >>> bs4 import beautifulsoup >>> import re >>> url = "http://www.webconfs.com/domain-age.php" >>> domain = 'youtube.com' >>> r = requests.post(url, {'domains': domain, 'submit': 'submit'}) >>> soup = beautifulsoup(r.content) >>> item in soup.find_all('a', href=re.compile('website-history')): ... print item.text ... 9 years 0 months old

Android (API level 17) - Backup API - Backup/Restore data in SQLite Database -

i afraid read backup of data using android backup api not clear answer possible take sqlite database file , up. this have achieved (at least there no crashes or anything). question is possible retrieve data file (sqlite .db) file , restore data information application. any suggestion in regard helpful i creating backup agent follows: mcbbackupagent extends backupagenthelper

content_for head tag doesn't work (ruby on rails) -

<% content_for :head %> <%= javascript_include_tag "http://code.jquery.com/jquery-latest.min.js" %> <% end %> it doesn't work. how insert html head tag? thanks. do have <%= yield :head %> inside <head> tag (probably in layouts/application.html.erb)? no? add :).

debian - OpenVPN + iptables: not forwarding traffic -

i trying forward traffic through vpn openvpn on vps. did on openvz virtualized server in past, cannot replicate working behaviour on new installation on different vps. changed provider because of reasons unimportant question's scope. i can correctly connect vpn windows client, reach pages through machine's public ip instead of vps public ip. the vps runs debian 7, 32bit. server openvpn config: port 1194 proto udp dev tun ca /etc/openvpn/easy-rsa/keys/ca.crt # generated keys cert /etc/openvpn/easy-rsa/keys/server.crt key /etc/openvpn/easy-rsa/keys/server.key # keep secret dh /etc/openvpn/easy-rsa/keys/dh1024.pem server 10.9.8.0 255.255.255.0 # internal tun0 connection ip ifconfig-pool-persist ipp.txt keepalive 10 120 comp-lzo # compression - must turned on @ both end persist-key persist-tun push "redirect-gateway" status log/openvpn-status.log verb 3 # verbose mode client-to-client client (windows 7) openvpn config: c...

shell - Create a "Recently Added Albums" m3u playlist -

i trying create playlist same idea "recently added albums" playlist see in itunes using $num_of_days_before parameter. i've used ideas post: how recursively find , list latest modified files in directory subdirectories , times? i've created script can run following params: create_m3u /dir_root/with/mp3s 60 where $1 directory root of mp3s (that have folders within have mp3s) $2 number of days backwards today i'd create m3u playlist file. the main part of script command: find $1 -type f -iregex '.*\.mp3' -mtime -$2 -exec stat --format '%y %y %n' {} \; | \ sort -n | \ cut -d' ' -f5- | \ sed -e 's/^/\./' now problem is, above command , including the cut d' ' -f5- part gives me type of output: .... ./ratking - goes - 2014 [v0]/09. protein.mp3 ./ratking - goes - 2014 [v0]/08. puerto rican judo.mp3 ./ratking - goes - 2014 [v0]/02. canal.mp3 ./ratking - goes - 2014 [v0]/05. remove ya.mp3 ./ratking - goes - 2...

ios - stored unreadable text - NSJSONSerialization -

i new objective c. got situation causes me lot of trouble... in app, there textfield people can enter comments , store in server , display them somewhere else. however, of these comments in different languages... e.g. chinese... , returns unreadable strings such "ä½ Ã¥¥½" in server. pretty sure server set properly... question is: there standard ways/methods can server recognize foreign text? many in advance! the followings codes. nsmutabledictionary *query = [[nsmutabledictionary alloc] init]; [query setvalue:usercommenttextfield.text forkey:@"comment"]; nsdata *postdata = [nsjsonserialization datawithjsonobject:query options:0 error:null]; // set dictionary json nsmutableurlrequest * req = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:@"http://testurl"]]; [req sethttpmethod:@"post"]; [req sethttpbody:postdata]; [req setvalue:@"text/html" forhttpheaderfield:@"content-type"...

asp.net mvc - MVC5 startup URL and routing -- not working on local -

Image
i have project , running fine on website. if deploy now, works fine. issue when i'm trying run in debug mode on local computer--the routing seems messed up. here project web configuration: route configuration: public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "pvp", action = "play", id = urlparameter.optional } ); } on main controller, named pvpcontroller, method named play no no parameters. when launch project starting debug, url goes (ignore parenthesis): (http)://localhost:64397/ everything loads fine since routing knows redirect /pvp/play. however, if type in (http)://localhost:64397/pvp/play, 404 not found error. same thing happens if try call action i...

Android Add javadoc to Gradle project -

my goal: add javadoc 3rd party library in android studio. (specifically parse) my setup : i'm using android studio 0.5.2 , it's gradle setup. stuck jar library in /libs folder , updated gradle file. (ex - it's parse library compile filetree(dir: 'src/main/libs/parse-1.5.0', include: [' .jar'])* worked.) what tried: given documentation list of html files. dropped them in project in libs folder , nothing worked. used jar cvf create javadoc in jar format , tried link *.jar.properties file. still nothing worked. know can javadocs working because android support libraries pulling respective javadocs. here few links of interest: *.jar.properties explained how attach sources or docs external libraries in eclipse how attach javadoc or sources jars in libs folder how import third party libraries in android studio you can find path-settings in [project > .idea > libraries] if add 'parse-1.5.0' library, [project > .idea...

java - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' -

i getting exception while trying run j2ee application. here's full stacktrace: info: initializing spring root webapplicationcontext 21:15:11,416 error contextloader:308 - context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in servletcontext resource [/web-inf/datasource-config.xml]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: up_notation] unable build entitymanagerfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1455) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.b...

How to resume MediaPlayer in Android after pressing the home button and reopen the app -

i tried lot of methods, made lot of changes on code, read android mediaplayer document, tried stackoverflow examples none of them solve problem. my problem: when press home button of emulator or phone reopen app starting beginning. hope can me. in advance. here code : public class mediaplayer extends activity implements oncompletionlistener, onerrorlistener, oninfolistener, onpreparedlistener, onseekcompletelistener, onvideosizechangedlistener, surfaceholder.callback, mediacontroller.mediaplayercontrol { display currentdisplay; surfaceview surfaceview; surfaceholder surfaceholder; mediaplayer mediaplayer; mediacontroller controller; int videowidth = 0; int videoheight = 0; boolean readytoplay = false; public final static string logtag = "custom_video_player"; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.video); surfaceview = (surfaceview) this.findviewbyid(r.id.surfacevi...

typescript - Duplicate Identifier in duplicate module -

i have 2 files contain same module in solution (different projects). module mymodule{ export function dostuff(){} // in here "dostuff" getting redlined } this error because have 2 files same piece of code in it. seeing don't reference each other or matter, don't see how can conflict. if using visual studio, treats files implicitly references typescript files. therefore, if thinks both modules have same common root, think 1 extension of other , try warn duplicate declarations. although argue aren't same module, worth drawing inspiration framework class libraries, rely on namespaces alone distinguish between 2 classes, example both of following have been called command , have been distinguished class name namespace: system.data.sqlclient.sqlcommand system.data.oracleclient.oraclecommand

shared libraries - C compiler errors during otherwise successful build -

i made library link frontend i'm working on. library isn't complete, it's done enough start testing i've got. here function in frontend far: int main(string[] args) { try { mcth.init_lists(); mcth.init_names(); } catch (fileerror e) { stderr.printf("error: %s\n", e.message); } // no errors return 0; } as far can tell, it's valid syntax library (the error , methods defined in vapi). however, when go build, errors in c compiler: valac src/main.vala -o bin/mctradehelp --pkg mctradehelp --pkg libxml-2.0 /tmp/ccdiz2sn.o: in function `_vala_main': main.vala.c:(.text+0x27): undefined reference `mcth_init_lists' main.vala.c:(.text+0x3f): undefined reference `file_error_quark' main.vala.c:(.text+0x11a): undefined reference `mcth_init_names' collect2: error: ld returned 1 exit status error: cc exited status 256 the vapi located @ /usr/share/vala/vapi , header in /usr/local/include , , .so...

javascript - Chrome Extension: yql API ERROR: Content Security -

i trying make call yql api. error: have following manfiest.json: "content_security_policy": "script-src 'self'; object-src 'self'", error: refused load script 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where…withkeys&callback=jquery20208888747137971222_1400373036635&_=1400373036638' because violates following content security policy directive: "script-src 'self' chrome-extension-resource:".' i tried doing w/o having "content_security_policy" still error. the code call: yqlapi = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeuricomponent(query) + ' &format=json&env=store%3a%2f%2fdatatables.org%2falltableswithkeys&callback=?'; $.getjson(yqlapi, function(r){ $.each(r.query.results.li, function(){ if(typeof this.font !== 'undefined') { gogoanime1.push([this.a.href,this.font.content]); } }); ...

android - Java convert 16 bits signed to 4 digits hex -

when dealing signed int conversion hex, integer.tostring(value, 16) useful see a post on subject need format 4 hex digits (leading zeros positive numbers , not 32bits/8chars negatif numbers), in c++ right function inttohex( value,4) http://docwiki.embarcadero.com/libraries/xe3/en/system.sysutils.inttohex but didn't fiund equivalent in java (android). found : int stepref =-2; string ss = string.format("%08x",stepref); string ss4 = ss.substring(ss.length() - 4);

php - Create list per 4 records -

this question has answer here: display data in multiple columns 3 answers i trying create multi-list of records 4 records per list without knowing how many records there are. however, cannot figure out how handle math. manually typed in $n == 5 || $n == 9 etc knowing stipud , cannot solve problem. can me how handle that. also, lists underneath works if total number of records cannot evenly divided 4. if can, create blank list @ end. $query = "select * `table` `field` = $whatever"; if ($result = $con->query($query)){ $n = 1 $row_cnt = $result->num_rows; $total_lists = round($row_cnt / 4, 0); $current_list = 1; echo "<ul>list $current_list of $total_lists"; while ($row = $result->fetch_assoc()) { echo "<li>$row['something']</li>"; if ($n == 5 || $n == 9 || $n == 13 || $n == 17 || $n == 2...

ios - NSCoding - Protocol Methods (encodeWithCoder, initWithCoder) Repeated Code -

this question has answer here: easy way nscoder enabled class 2 answers i using nscoding local data persistence. have bunch of model classes need stored locally. i've been implementing encodewithcoder , initwithcoder protocol methods hours. it's not "coding", it's repeating following 3 steps: find variables need stored locally. write encodewithcoder given variables. write initwithcoder given variables. is there more efficient way this? just make of classes inherit single class nscoding stuff.

javascript - Drag and Drop between 2 tables using Jquery sortable with rowspan and colspan -

i`m trying move row has rowspan > 2 or colspan > 2 in table. the problem when drop cell , creates new tr in cell. i`m thinking set parent rowspan or colspan same child when dragged object dropped. http://jsbin.com/jumalofe/1/watch?html,js,output let`s "aibd" should 08-00 12:00 . how should that?? here's do. use receive event of sortable: receive( event, ui ) this event triggered when item connected sortable list has been dropped list. latter event target. receive:function(event, ui) { //we check if <td> has rowspan property if(typeof ui.item.attr('rowspan') !== 'undefined' && ui.item.attr('rowspan') !== false){ //if does, store in variable rowspan = ui.item.attr('rowspan'); //the element dropping to, set rowspan there //(content automatically inserted) $(this).attr('rowspan',rowspan); //we set rowspan of sender el...

php - Why doesn't end(( )) throw a strict notice? -

this question has answer here: parentheses altering semantics of function call result 2 answers end(array_keys(array(0))) says php strict standards: variables should passed reference ( http://3v4l.org/cnlvt ) end((array_keys(array(0)))) on other hand, works ( http://3v4l.org/168fi ). why? the vld decompiler shows same opcodes being ran difference in ext column can't find documentation on means. what's happening array_keys passing result reference. such, php throwing notice shouldn't that. wrapping in parenthesis changes reference , forces php evaluate statement inside first. such, removes reference. 1 of weird things doesn't makes difference does. more on weirdness here http://phpsadness.com/sad/51

hash - Django admin interface: Invalid password format or unknown hashing algorithm -

i've made register , login function saves user data database using django user object. when register user, password linked user doesn't hashed properly. means have error in django admin interface: "invalid password format or unknown hashing algorithm.". i've made sure use set_password. models.py django.db import models django.contrib.auth.models import user class user_information(models.model): # links userprofile user model instance user = models.onetoonefield(user) # override __unicode__() method return username def __unicode__(self): return self.username forms.py django import forms django.contrib.auth.models import user authentication.models import user_information class user_form(forms.modelform): # using passwordinput widget hide entered content of password field password = forms.charfield(widget=forms.passwordinput()) # define nested class. default fields can edited here,...

How to save the setting of font size in notepad++ as default? -

Image
i'm using solarized-light theme in notepad++. default font of theme consolas 10 . i've reset size 12 every time open notepad++, font size changes 10 again. it's annoying have change it. there anyway keep font size default? well can style settings. go settings> style configurator and set desired font size theme, , set style global override , check enable global font size checkbox. i've attached screenshot

C# Windows Phone: Is it possible to fill LongListSelector with images? -

i fill longlistselector names of products , put images of products in longlistselector. datas webserver using webclient method. image know should use this: pic.source = new system.windows.media.imaging.bitmapimage(new uri("http://srvname.com/images/greenpasta.jpg")); but don't know how show images on long list selector. you should keep url of image attribute product, not image source itself. can have like myproduct.uri = new uri("http://srvname.com/images/greenpasta.jpg") and in xaml: <datatemplate> <grid> <grid.columndefinition> <columndefinition witdh="100" \> <columndefinition witdh="auto" \> <columndefinition witdh="*" \> </grid.columndefinition> <image source="{binding uri}" height="100" stretch="fill"/> > <textblock text="{binding name}" /> >...

javascript - Make a button unclickable after one click -

i'm trying create button becomes deactivated after first click; have no clue how it. have now: <input type="button" id="btnsearch" value="search" onclick="fuction();" /> this button not submit form. me? i'm totally new this. i've tried following answer in other threads got lost. not preferred way of course, result after. function fuction() { document.getelementbyid('btnsearch').disabled = 'disabled'; }

sql - How to design db for holding Dominion cards? -

i'd store information games of card game dominion. don't need know game, except that: there around 200 unique cards each game includes ten of these cards, or on occasion eleven i'll tracking lots more each game (who played, won, etc), i'm having trouble working "supply" (the ten included cards game). i'm thinking want 3 tables, card_name , supply , , game : card_name supply game id | name supply | card game | supply | player1 | player2 | ... ----+--------- --------+------ ------+--------+---------+---------+----- 1 | village 1 | 1 301 | 1 | 'mike' | 'tina' | ... 2 | moat 1 | 3 3 | witch 1 | 200 ... | ... ... | ... 200 | armory i think reasonable way represent "mike , tina played game contained village, witch, armory, , other cards didn't both...

python - How does Flask keep the request global threadsafe -

in flask every function has access request global. how designers of flask stop global being overwritten in middle of 1 request when 1 starts? it's threadlocal, not true global. since each thread can dealing 1 request @ time, there's no danger of interference. in fact there's full description of in flask docs here . (still doesn't make design, of course.)

addressing - MIPS - How to find the address value of branch and jump instructions -

i have exam coming up, , stuck on question (see below); looking @ model answer did not help. i've tried reading our main text topic, still have no idea how this. if provide step-by-step walk through of question, grateful. "assuming first instruction of mips snippet below located @ memory address 0x10001000. value else , exit in bne , j instruction?" 1 0x10001000: addi $s0, $0, 5 2 0x10001004: sub $s2, $0, $s1 3 0x10001008: beq $s0, $s2, else 4 0x1000100c: add $s0, $0, $0 5 0x10001010: add $t0, $s2, $s0 6 0x10001014: j exit 7 0x10001018: else: addi $s1, $s0, -1 8 0x1000101c: exit: model answer: else: 0000000000000011 exit: 00000000000000010000000111 i have included link image of original question well. http://i.imgur.com/nghpzxs.png first, we'll deal branch. branches i-type instruction, branch target encoded in 16 bits. easiest way figure out immediate field of branch count number of instructions between ...

php - Passing javascript array in the url -

how can pass array in url in javascript? i tried : http://codeigniter/index.php/assistancemonitoringmodule/assistancemonitoring/getreport?remarks="+stat+"&sortby="+sortby+"&fromdate="+fromdate+"&todate="+todate+"&area="+area; which remarks 1 being catch in php array , stat javascript array being supplied in remarks . there solution that? whenever time catch remarks in php use $this->input->get_post('remarks') (since im using codeigniter) got error 'invalid argument supplied foreach()' thans help. :) you can encode array json, json.stringify , decode in php json_decode . don't forget use encodeuricomponent values in url, otherwise might not url expected.

python - Django admin not serving static files? -

django 1.6 i'm having trouble serving static files django admin. urls.py: urlpatterns = patterns('', url(r'^$', 'collection.views.index', name='home'), url(r'^collection/', include('collection.urls')), url(r'^admin/', include(admin.site.urls)), ) if settings.debug: urlpatterns += patterns('', url(r'^media/(?p<path>.*)$', 'django.views.static.serve', { 'document_root': settings.media_root, }), url(r'^static/(?p<path>.*)$', 'django.views.static.serve', { 'document_root': settings.static_root, }), ) settings.py ... media_root = '/users/me/projectdir/media/' media_url = 'media/' static_root = '/users/me/projectdir/static/' static_url = 'static/' ... template (base.html) <!doctype html> <html lang='en-us'> <head> ...

javascript - Change Total with a click of the button -

<button id "add" onclick="changetotal()">change total add 5</button> <button id "subtract" onclick="changetotal()">change total subtract 5</button> var total = 10; function changetotal () { if (add === true) { total = total + 5; } else (subtract === true) { total = total - 5; }; i not sure how heck accomplish this...newbie...but want have 2 buttons. 1 adds total in ...and button subtracts total in . need ongoing...like not stop @ number -negative or +positive. all! i tried screwing around newly learned knowledge of innerhtml... <p>click button display date.</p> <button onclick="displaytotal()">the time is?</button> <script> function displaytotal() { var x = 5; var p = document.getelementbyid("demo").innerhtml = x; var y = document.getelementbyid("demo").innerhtml = + 5; } </script> <p id="demo"></p>...

multiple form validation using jquery validation plugin -

i have single form, having 2 buttons, , when both buttons clicked, validate differently. having trouble doing that. have following form looks this: <form id="testform" method="post"> <input type="textarea" name="remarks" /> <input type="file" name="files[0]"/> <button id="button1">button 1</button> <button id="button2">button 2</button> </form> how use validation plugin in such way when button1 clicked, validates remarks field, button2 validates both remarks , files[0] fields? have tried using following doesn't seem work... $("#testform").validate({ //e.preventdefault(); rules : { remarks: { required: true, } }, highlight: function(element) { $(element).closest('.form-group').addclass('has-error...

java - Google Calendar API - How To Create Service -

looking @ google calendar api v3 documentation, see them show under events.list snippet of code. string pagetoken = null; { events = service.events().list('primary').setpagetoken(pagetoken).execute(); list<event> items = events.getitems(); (event event : items) { system.out.println(event.getsummary()); } pagetoken = events.getnextpagetoken(); } while (pagetoken != null); i wondering how person go setting "service" in line events = service.events().list('primary').setpagetoken(pagetoken).execute(); i think might calendar service = calendar(httptransport, jsonfactory, httprequestinitializer) but not 100% sure asking help. thanks! this seems code web based calendar thing, might need web services run on android.

does mechanize python library have the ability to wait until javascript has dynamically loaded content before getting the page contents -

i scrape site dynamically loads content using javascript. i scrape content javascript loads. i know there ways of getting javascript load (ghost or pywt4 webkit) have not been able pyqt4 installed , recognised ipython installation. therefore since using requests (and have used mechanize) requests have ability scrape pages content after javascript has finished dynamically loading page content (i.e. divs, img, href, links etc) as far know, mechanize not support that, there easy way of doing selenium : from selenium import webdriver driver = webdriver.firefox() driver.get(url) driver.set_window_position(0, 0) driver.set_window_size(100000, 200000) driver.execute_script("window.scrollto(0, document.body.scrollheight);") time.sleep(5) # wait load # print response print driver.page_source you have install firefox in case.

html - How to check input in Javascript for input type=text -

i trying fill table random numbers , have user complete totals. after entering totals wanted check answers, if answer correct wanted no longer allow input if answer wrong wanted cell highlighted , allow user try again. the table filling , incorrect answers being identified further attempts modify answers don't give feedback. not sure why input button can't used multiple times guessing needs cleared accept entry. playing js simple haven't been able find working solution. thanks <!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 content="text/html; charset=utf-8" http-equiv="content-type" /> <title>testing</title> <link href='https://fonts.googleapis.com/css? family=open+sans:300italic,400italic,600italic,700italic,800italic,400,800,...