Posts

Showing posts from June, 2013

php - Yii: Issue in RadioButtonList -

problem in radiobuttonlist . having 2 radio buttons shown below. performing ajax action on first radio button. but when try click second radio button, first 1 not getting unchecked , not able check second one. <?php echo chtml::radiobuttonlist( 'ck_skill','', array(4 => 'professional skill', 5 => 'suggestion'), array('separator' => ' ', 'onchange'=>chtml::ajax(array('type'=>'post', 'datatype'=>'json',"url" =>array("search/search"), "success"=>"function(response){ $('#textfield-wrapper').html(response.data); }", ))));?> what missing here ? i think article can help: http://www.yiiframework.com/wiki/110/styling-radio-buttons/ or one: http://code.dimilow.com/yii-radio-button-list-example-or-how-to-remove-the-line-break-separator/ things notice in code ( yii class refere

java - not getting any response from server, but able to get response from telnet -

i fist connecting through vpn client able telnet , able response when paste request string on terminal. same request if trying through java program, not getting response. i can see using netstat there established tcp connection when try through java. tcp 10.2.2.22:1154 184.23.23.61:7565 established here java client code sends request. socket client = new socket(serverip, port); outputstream out = client.getoutputstream(); inputstream in = client.getinputstream(); string test = "tue231363**"; stringbuffer response = new stringbuffer("response : "); out.write(test.getbytes()); out.flush(); int c; system.out.println("waiting response.......>>>>>>>>>>>>>"); while ((c = in.read()) != -1) { if (isendofresponse(c)) break; system.out.print((char) c); response.appe

PHP Parse Error unexpected {, expecting ( - don't understand why -

i know might dumb question not able make work. trying webservice php. php parse error can't figure out why. parse error: syntax error, unexpected '{', expecting '(' in /www/htdocs/flight/webserv/shiftswop_register_group.php on line 25 and here part of code of class: <?php include 'shiftswop_constants.php'; include 'shiftswop_db_connect.php'; class shiftswitchregistergroupapi { private $db; //constructor function __construct() { $this -> db = new mysqli(host, user, password, database); $this -> db -> autocommit(false); } //decstructor function __destruct(){ $this -> db -> close(); } function create { <======== line 25 if(isset($_post[key_group_name]) && isset($_post[key_group_password]) && isset($_post[key_user_id]) && isset($_post[key_user_password])){ $groupname = $_post[key_group_name]; $grouppassword = $_post[key_group_password]; $userid

ruby - Why is kernel_required.rb in my stack trace? -

i forgot put word end, @ end of if statement, , got following error: /home/***/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': **/home/****/desktop/ruby/food_finder/lib/restaurant.rb:84: syntax error, unexpected end-of-input, expecting keyword_end (syntaxerror)** /home/****/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' /home/****/desktop/ruby/food_finder/lib/guide.rb:1:in `<top (required)>' /home/****/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' /home/****/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' init.rb:14:in `<main>' my code without errors: def self.saved_restaurants # read restaurant file restaurants = [] if file_usable? file = file.new(@@filepath, '

How to get info_buyRequest in magento admin panel? -

hi need view 1 additional product attribute in magento admin panel. need info_buyrequest->projectid. database table sales_flat_order_item field name product_options my record given below a:7:{s:15:"info_buyrequest";a:9:{s:2:"id";s:3:"715";s:7:"product";s:3:"288";s:15:"related_product";s:0:"";s:15:"super_attribute";a:2:{i:143;s:2:"69";i:144;s:2:"71";}s:7:"options";a:4:{i:79;s:3:"165";i:80;s:3:"166";i:78;s:3:"163";i:81;s:3:"359";}s:15:"attachment_hash";a:1:{i:215;s:32:"cbe019a075d376c0632dae49774370bb";}s:9:"projectid";s:2:"39";s:3:"qty";i:1;s:11:"reset_count";b:1;}s:7:"options";a:4:{i:0;a:7:{s:5:"label";s:7:"coating";s:5:"value";s:21:"uv - ultra high gloss";s:11:"print_value";s:21:"uv - ultra high gloss&

C++ allocates abnormally large amout memory for variables -

Image
i got know integer takes 4 bytes memory. first ran code, , measured memory usage: int main() { int *pointer; } it took 144kb. then modified code allocate 1000 integer variables . int main() { int *pointer; (int n=0; n < 1000; n++) { pointer = new int ; } } then took (168-144=) 24kb but 1000 integers suppose occupy (4bytes x 1000=) 3.9kb . then decided make 262,144 integer variables should consume 1mb of memory . int main() { int *pointer; (int n=0; n < 262144; n++) { pointer = new int ; } } surprisingly, takes 8mb memory usage, exponentially grows respective number of integers. why happening? i'm on kubuntu 13.04 (amd64) please give me little explanation. thanks! note: sizeof(integer) returns 4 memory individually allocated dynamic objects not required contiguous. in fact, due alignment requirements new char[n] (namely aligned @ alignof(std::maxalign_t) , 16), standard

c# - The use of :base() in a constructor -

this question has answer here: c# constructor execution order 7 answers i trying construct object derives different object, before calling base constructor make few argument validation. public fuelmotorcycle(string owner) : base(owner) { argumentvalidation(owner); } now understood base constructor called first, there way can call after argumentvalidation method? now understood base constructor called first, there way can call after argumentvalidation method? no, @ least not directly. but can use small workaround have static method takes argument, validates , returns if it's valid or throws exception if it's not: private static string argumentvalidate(string owner) { if (/* validation logic owner */) return owner; else throw new yourinvalidargumentexception(); } then have derived class constructor pass arguments through

git - CGit on Nginx do not show repository content -

i configured cgit on nginx guide . in result, can see list of repositories, when click view on of them, on main page. cat take here: problem_here . nginx logs says nothing useful. how can debug problem?

c++ - PACKET_TX_RING only sending out first packet, then not doing anything anymore -

i have following code: #ifndef rawsocket_h #define rawsocket_h #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdint.h> #include <unistd.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <poll.h> #include <arpa/inet.h> #include <netinet/if_ether.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/stat.h> #include <linux/if.h> #include <linux/if_packet.h> #include "ippacket.h" #define conf_ring_frames 128 /// initialize packet socket ring buffer // @param ringtype 1 of packet_rx_ring or packet_tx_ring static inline char * init_packetsock_ring(int fd, int ringtype) { tpacket_req tp; char *ring; // tell kernel export data through mmap()ped ring tp.tp_block_size = 1024 * 8; tp.tp_block_nr = 1024; tp.tp_frame_size = 1024 * 8; tp.tp_frame_nr = 10

html - Text centered next to image, and if no space, aligned to top -

let's check this fiddle : img { float: left; } #inner { height: 128px; background-color: yellowgreen; display: table-cell; vertical-align: middle; } #content { background-color: red; } <img src="http://cdn.memegenerator.net/instances/250x250/37934290.jpg" width="128" height="128" /> <div id="inner"> <div id="content">text text tertkl elknr tlken lsl kdmfsldkfmsldkfmslkd mfkndfln dflkfndg lkn</div> </div> this works far expect - text centered, , shrink width, text goes underline: "too far" image. best if vertical-align: middle; became vertical-align: top; when needs jump. how without possibly jquery? a simple way achieve use css media query . your markup stay same , css need have following added: @media screen , (max-width: 290px) { #inner { vertical-align: top; } } in action: http://jsfiddle.net/uwmkh/1/ what says i

objective c - MacOSX 10.8 , xcode 4.6.1 error Cocoa: "Color type user defined runtime attributes on OS X versions prior to 10.7" -

i got warning in xcode 4.6.1/mac osx 10.8 when try open xib file used work in xcode 3.x/ mac osx 10.7 "the file "mqmplugin.xib" has dependency on interface builder 3 plug-in. please choose "upgrade" below remove dependency. changes document may destructive , cannot undone." if click on upgrade button, several compile errors on xib file. cocoa: "color type user defined runtime attributes on os x versions prior 10.7" . [ if select cancel interface builder won't open ]. i tried change user defined runtime attributes[ on bevel button, , other widgets] - color type, , removed user defined run time attribute [color type] in identity inspector, still no luck. tried changing .xib version 4.6 using file inspector. request solve issue. xcode 4.x stopped custom plugin support xib. our project had custom plugin dependency. solve have click on upgrade button, , have replace custom controls [ part of custom plugin ] standard controls

java - About resultset type JDBC -

in this oracle java tutorial, says: type_forward_only: result set cannot scrolled; cursor moves forward only, before first row after last row. rows contained in result set depend on how underlying database generates results. is, contains rows satisfy query @ either time query executed or rows retrieved. " the rows contained in result set depend on how underlying database generates results. " what's difference between query execution time , rows retrieving time? , how can know database supports? in advance. it's difference between eager , lazy loading. i'd recommend researching terms. eager loading means results made available @ once. require great deal of time , memory if set large. lazy loading doles out results needed. it's along lines of google when search pages: they'll find millions, return them 25 @ time higher ranks first.

ruby - Array with several strings is concatenated -

array more 1 string separated space produces array 1 concatenated string. imho, should raise syntax error. behavior correct? ["1" "2" "3"] #=> ["123"] this has nothing array. feature of string literal. if write string literals in quotes next each other, represents string given concatenation.

Progress bar activity is not starting when clicking on the button in android -

i have written following code inside method called on clicking on button: final progressdialog progressdialog = new progressdialog(this); progressdialog.setprogress(0); progressdialog.seticon(r.drawable.ic_launcher); progressdialog.settitle("downloading files…"); progressdialog.setprogressstyle(progressdialog.style_horizontal); progressdialog.setbutton(dialoginterface.button_positive,"ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { toast.maketext(getbasecontext(), "ok clicked!", toast.length_short).show(); } }); progressdialog.setbutton(dialoginterface.button_negative, "cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog,

python - Modifying a set while iterating over it -

i iterate on set while i'm deleting items it. there similar questions deleting 1 item @ time or lists , not work case. the code follows; iterate on set zn , in end of iteration i'm removing few items (the ones belonging set temp ). iteration still happening on "original" zn. how can modify code change set zn while i'm iterating on it? def cyclotomiccosets(q,n): n=q^n-1 zn=set(range(n)) cosets=[] in zn: tmp=set([]) j in range(n): tmp.add( i*(q^j) %n) cosets.append(list(tmp)) zn=zn.difference(tmp) # <------------ not want return(cosets) use while loop , .pop() values process set: def cyclotomiccosets(q, n): n = q ^ n - 1 zn = set(range(n)) cosets = [] while zn: = zn.pop() tmp = {i * (q ^ j) % n j in range(n)} cosets.append(list(tmp)) zn -= tmp return cosets note replaced inner for loop set comprehension make little faste

css - Responsive 2 Column Absolute Positioning -

i have 1 page layout 2 sections (main-containers.) each main-container has 100% height , width. image class "pic" in section 2 absolute positioning sit on bottom of section two. of right sits on bottom of section one. think don't have cleared right. using (mobile first initializr) template. http://www.initializr.com may not here fiddle demo http://jsfiddle.net/jfarr07/7dwey/ html <div class="main-container3" id="sponsorship"> <div class="main wrapper clearfix"> <article> <header class="branding"> oh possibilities </header> </article> </div> <!-- #main --> </div> <!-- #main-container3 --> <div class="main-container4" id="promotion"> <div class="wrap"> <div class="jared"> <img class="pic" src="

php - time() safe in mysql doesnt work -

i have little problem safe current time in mysql. the table have 2 rows: timestamp - on update current_timestamp a php file here code: $stamp = time(); if (mysqli_connect_errno() == 0){ $sql = "update xy set stamp = '$stamp' id = '$id'"; $erg = $db->query($sql); } i have copy files server 1 server 2, , doesnt work on new server. since, not providing errors, going assume works. use mysql's now() function ? or curtime() , utc_timestamp() $sql = "update xy set stamp = now() id = '$id'"; or, use error handler or die(sprintf("[%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));

jquery - Javascript RegEx: validate date time -

i not regex. being frustrated regular expression. example: i have following date time: 05/16/2013 12:00 am i need javascript regex respect format: mm/dd/yyyy hh:mm [am/pm] var datereg = /^[0,1]?\d{1}\/(([0-2]?\d{1})|([3][0,1]{1}))\/(([1]{1}[9]{1}[9]{1}\d{1})|([2-9]{1}\d{3}))$/; if(!datereg.test(inputval)) { $(this).after('<span class="error error-keyup-5">invalid date format.</span>'); } but code works date, not time. help. your code snippet match date, there no atoms match time. regexp should be: datereg = /^[0,1]?\d\/(([0-2]?\d)|([3][01]))\/((199\d)|([2-9]\d{3}))\s[0-2]?[0-9]:[0-5][0-9] (am|pm)?$/

How to set the selected option of a select list by value NOT by selectedIndex using jQuery? -

i trying set selected item of select equals value. using: $("#myselectlist").val(4); this setting list 4th selectedindex instead of selectedindex has value of 4. i using version 1.9.1. help! try this: $("#myselectlist option[value='4']").prop('selected', true);

java - JPA does not use sequence -

i have created sequence in database (postgresql) , have following annotations in domain model. using jpa. however, when invoke web service (rest) without id in object want create throws constraint error. shouldn't use value sequence below? @id @sequencegenerator(name = "user_seq", sequencename = "user_seq", allocationsize = 1) @generatedvalue(strategy = generationtype.identity, generator = "user_seq") private int id; caused by: org.hibernate.exception.constraintviolationexception: not execute statement caused by: org.postgresql.util.psqlexception: error: null value in column "id" violates not-null constraint when value comes database sequence, generationtype.sequence should used strategy. generationtype.identity used identity columns.

Custom JavaScript garbage collector -

i don't want create wheel scratch. curious if there javascript library named gc.js looks like? how can write custom garbage collector javascript in javascript (if possible)? the garbage collection done execution environment of code. not accessible javascript code - @ least not specified be, yet engine can decide expose custom interface native functions ( example node.js ). if write whole garbage collector in javascript, imply javascript engine [partly] written in javascript.

ruby - Breaking changes in Rails 4 JSON rendering? -

i started new app atop rails 4 , i've noticed seems breaking change in how json rendering implemented default, can't find written anywhere wondering if can give me insight on (1) whether api has changed , (2) how can obtain behavior need (namely, old behavior). in particular, i'm seeing that, in rails 3 @answer.as_json ...would return... { id: 1, body: "lorem ipsum..." .... } in rails 4 seems same method returning: { 'answer': { id: 1, body: "lorem ipsum..." ... } } can else confirm behavior has changed? there way old behavior short of overriding as_json every model? this new implementation making more cumbersome return json responses containing multiple models (which either have done hash merge in "render :json ..." call in controller action or overriding as_json). there option activerecord::base.include_root_in_json controls top-level behaviour of as_json method. name se

Bash : Piping to eog -

i'm trying pipe filename via bash code eog. here's code : ls | grep "sample" | head -1 sample name of required file. i'm having trouble figuring out how pipe output eog. i've tried storing output of above code variable , pass variable eog unsuccessfully. any suggestions? is you're looking for? ls | grep "sample" | head -1 | xargs eog

SQL Differences between stored procedure and triggers -

i'm having trouble understanding difference between stored procedure , trigger in sql. if kind enough explain me great. thanks in advance a stored procedure user defined piece of code written in local version of pl/sql, may return value (making function) invoked calling explicitly. a trigger stored procedure runs automatically when various events happen (eg update, insert, delete). imho stored procedures to avoided unless absolutely required .

c++ - Can you use cublasDdot() to use blas operations in non-GPU memory? -

so have code performs matrix multiplicaiton, problem returns zeroes when use library -lcublas , compiler nvcc; however, code runs great few tweaks function names when use compiler, g++ library -lblas. can use -lcublas library perform matrix multiplication memory not on gpu? here's code returns 0's: extern "c" //external reference function code compiles { double cublasddot(int *n, double *a, int *inca, double *b, int *incb); } //stuff happens cout << "calculating/printing contents of matrix c ddot...\n"; c[i][t]=cublasddot(&n, parta, &inca, partb, &incb); //this thing isn't working reason (although compiles fine) i compile using command: nvcc program -lcublas this work however: extern "c" //external reference function code compiles { double ddot_(int *n, double *a, int *inca, double *b, int *incb); } //stuff happens c[i][t]=ddot_(&n, parta, &inca, partb, &incb); compiled

javascript - How do I empty global arrays used in a pop up slideshow? -

i've created program can choose set of images checking checkboxes. image url's , alt-texts stored in 2 arrays. when clicking av button on html-page open new window calls on arrays window.opener. when closing new window empty arrays. otherwise pictures chosen in first round displayed in slideshow when opening second time. understand can empty arrays method: array.length= 0; but add code? i'm quite lost. i'm pasting code, perhaps can give me hand. var imgurllist = [], imgtextlist = [], //these arrays need emptied windvar = null; function init() { var tags, i, openwindow; tags = document.getelementsbyclassname("unmarkedimg"); openwindow = document.getelementbyid("slideshowbtn"); openwindow.onclick = savepicsforslideshow; (i = 0; < tags.length; i++) { tags[i].parentnode.onmouseover = showlargepict; tags[i].parentnode.onmouseout = hidelargepict; } } window.onload = init; function showlargepict(

java - LIBGDX having more than 1 button on the main menu -

i have 5 buttons want put on main menu when have 5 actors doesn't work , when take them out , leave 1 in works. how around having multiple buttons? here code public class mainmenu implements screen { crazyzombies game; stage stage; textureatlas atlas; skin skin; spritebatch batch; button play, option, quit, custom, store, menu; public mainmenu(crazyzombies game) { this.game = game; } @override public void render(float delta) { gdx.gl.glclearcolor(0.09f, 0.28f, 0.2f, 1); gdx.gl.glclear(gl10.gl_color_buffer_bit); stage.act(delta); stage.draw(); batch.begin(); batch.end(); } @override public void resize(int width, int height) { if (stage == null) stage = new stage(width, height, true); stage.clear(); gdx.input.setinputprocessor(stage); /** * quit button */ textbuttonstyle stylequit = new textbuttonstyle(); stylequit.up = skin.getdrawable("8layer"); stylequit.down = skin.getdrawable(

Android Project - Something messed up my .classpath files (Eclipse 4.2? Eclipse 3.8?) -

i'm looking if else got problem, , if found source reason it. what happened this: i have dozens of different project. 1 of this project: that had once me. didn't project, aside importing it. couple months ago. had eclipse 3.7 @ point. in meantime found out eclipse juno out, , thought try it. did, later on due couple different problems decided revert time being. found out 3.8 version of eclipse , gave go, , left eclipse environment while. today opened eclipse wanted work, , found out on half of projects(working projects) stopped working, , gave me error or similar errors: 05-18 19:53:01.672: e/androidruntime(3939): fatal exception: main 05-18 19:53:01.672: e/androidruntime(3939): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.android.bitmapfun/com.example.android.bitmapfun.ui.imagegridactivity}: basicaly errors had classnotfound exception. said myself, that's strange. started investigating, , after couple of hours found

php - Get 2 words in every array value -

i have code 1 $words2= 'if want have preformatted block within list, indent 8 spaces.'; $forbiddenwords=array("word1","word2"); foreach($words2 $b=>$v) { if(in_array($v, $forbidden) ){ unset($words2[$b] ); } } $words2 = array_values($words2); $words2=implode(' ',$words2); $words2 = implode(' ',array_chunk(mb_split('\s', $words2), 2)); echo "<pre>"; print_r($words2); echo "</pre>"; what want create array every value of contain 2 words string. code above doesn't work -implode() not working associative arrays- result i'm trying have that array ( $words2[0]=>'if you' $words2[1]=>'you want' $words2[1]=>'want to' ... ) you over-complicating things, both when removing blacklisted words , when constructing arrays of pairs of words. to remove blacklisted: $inputwords = mb_split('\s+', 'if want have preformatted bloc

assembly - Hexadecimal representation of ASM command's length is weird -

Image
i've come across following piece of code: i know system works in hexa , think it's 32-bit processor (which if remember correctly means length of each memory address should 32 bit , should each command). if that's case, how come length of command @ 8048384 56 bits long (7*2*4)? in general seems length of commands here quite weird. missing something? make sense if 64 bit processor? i hope understanding of asm correct , i'm not missing basic concept. thank in advance :) what have there looks code 32-bit intel processor, say. intel ia32 instruction set has instructions of variable length, see here. 64-bit intel processors (x86_64) similar in regard. if used working on processors have 1 instruction length (like mips example), disassembly of intel program can weird. it's how these processors designed, though. there other architectures fit on either side of fence, or on both, too. example, arm's arm instruction set has 32-bit instructions, ar

c++ - Cuda matrix multiplication gives wrong answer -

update! my current code doesn't check out of bounds memory access. when run cuda memcheck, says memory access bad matrices of 2 2! i'm accessing memory shouldn't somehow , that's problem! to check out of bounds memory access, run cuda-memcheck ./(insert executable here) shown below code matrix multiplication itself: dim3 block(32,32); dim3 grid( (n+31)/32, (n+31)/32 ); matrixmul<<<grid,block>>>(d_c, d_a, d_b, n, k); ka , kb matrices values in them (they're 2's make easier). m, n, k same number square matrices kc matrix store answer. #ifndef _matrixmul_kernel_h_ #define _matrixmul_kernel_h_ #include <stdio.h> __global__ void matrixmul(float *kc, float *ka, float *kb, int n, int k) { int tx = blockidx.x * 32 + threadidx.x; int ty = blockidx.y * 32 + threadidx.y; float value = 0; (int i=0;i<n;i++) { float elementa=ka[ty*n+i]; float elementb=kb[i*k+tx]; value += elementa*e

Take two a list of strings as input in Python -

i'm new python , i'm trying take list of strings input using list comprehensions. here i've tried , gives me errors. m,n = raw_input().strip().split() matrix = [ [str(in) in in raw_input().strip()] in xrange(n)] print matrix it supposed receive list of strings (sth 2d m x n array in c). giving me error syntaxerror: invalid syntax . in keyword. you're using here thinking it's variable.: matrix = [[str(in) in in raw_input().strip()] in xrange(n)] it's syntaxerror because python thinks you're saying in twice, when you're intending different. change in name.

sql - Error when adding foreign key constraint -

i trying alter table in oracle's sql*plus able create table using reserved word order using quotes. able add primary key constraint. when comes adding foreign key have error. researched doing wrong, can't find satisfactory answer. i'll appreciate help. thanks! sql> alter table "order" 2 add constraint order_fk 3 foreign key(c_no) 4 references customer(c_no) 5 on delete restrict; on delete restrict * error @ line 5: ora-00905: missing keyword oracle not support "restrict" according oracle options are: (1) omitting on delete (2) on delete cascade , (3) on delete set null. i believe omitting on delete closest on delete restrict.

git - Configuring TeamCity checkout rules against GitHub repository -

i've repository on github called fruityrepo . inside fruityrepo have 2 visual studio solutions, 1 called fruit.apple , called fruit.pear . i'm configuring teamcity build both solutions, i've created couple of projects inside teamcity. want teamcity pull down pear code when pear changes, , likewise apple. i'm unsure format of checkout rule needed make work. think need 2 rules, like; -:. +:fruit.pear this not work though, teamcity returns error cannot start build runner . how configure checkout rule in teamcity against github? try using checkout rule this +:fruit.pear=>.

php - How to insert a character inside a string -

$string=apple $add=£ $new=app£le i facing problem inserting character in string. $string='apple'; $add='£'; $new=substr_replace($string,$add,3,0); echo $new;

android - How to convert coordinate to lac/cid -

we know how convert lac/cid latitude/longitude, use google gears this: public location callgear(arraylist<cellidinfo> cellid) { jsonobject data,current_data; jsonarray array = new jsonarray(); current_data = new jsonobject(); current_data.put(\"cell_id\", cellid.get(0).cellid); current_data.put(\"location_area_code\", cellid.get(0).locationareacode); // something... location loc = new location(locationmanager.network_provider); loc.setlatitude((double) data.get(\"latitude\")); loc.setlongitude((double) data.get(\"longitude\")); return loc; } however, possible reverse convert? lac/cid valid coordinate? suggestion? i think there no simple way of achieving this. given location can served several cells, , cell mobile device selects depends on number of factors (signal strength, example). the case when sure cell serves given location when know sure there 1 , 1 cell covering location.

ios - Archiving NSArray that contains dictionaries -

i trying save nsmutablearray in coredata . array contains objects nsdictionary nsdictionary has following structure valuedict = { floorid = f0001; endcoordinates = "nspoint: {541, 413}"; linepath = "<uibezierpath: 0x1d0903c0>"; pointsonline = ( ); startcoordinates = "nspoint: {418, 504}"; }, to write core data use following code: parray type binarydata points.parray = [nskeyedarchiver archiveddatawithrootobject:self.locationsarray]; and retrieve value use locationsarray = [nskeyedunarchiver unarchiveobjectwithdata:points.parray]; when try retrieve following error : terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[nsdictionary initwithobjects:forkeys:]: count of objects (0) differs count of keys (5)' i have checked nsarray , nsdictionary adopts nscoding protocol. doing wrong here ? the best way solve create either small test app, or test me

java - Making a user pick first item in a ArrayList -

i have items in array list need check matches. the matches in array list in order should called user. for example.. red, green,orange. in array list in order user should match then. the problem cant figure out how make user call items in order appear. right here how trying no avail.. //here try check see order being clicked matches 1 item less array list size. if(this.getuserdata() == manager.getinstance().currentlist.get(size-1)){ //here produce ingredient since matches item in list. producesquare(); activity.runonuithread(new runnable(){ @override public void run() { toast.maketext(activity, "match", toast.length_long).show(); } }); //if order matches item in array list, remove item. manager.getinstance().currentlist.remove(size-1); this isnt working. right now, if have 2 items need

sql server - SQL Selecting average of rating from another table -

Image
i have 2 tables: anime_list , anime_reviews. anime_list table has 'rating' field grabs average rating anime_reviews. however, ratings (rows) don't exist in anime_reviews , current query returns titles have average rating. select anime_list.animeid, anime_list.name, anime_list.animeimage, anime_list.synopsis, anime_list.type, anime_list.episodes, anime_list.genres, avg(anime_reviews.rating) anime_list inner join anime_reviews on anime_list.animeid = anime_reviews.animeid group anime_list.animeid, anime_list.name, anime_list.animeimage, anime_list.synopsis, anime_list.type, anime_list.episodes, anime_list.genres how return value of 0.0 if there no ratings (rows) in anime_reviews each title listed in anime_list? thanks help! a version using subquery select l.animeid, l.name, l.animeimage, l.synopsis, l.type, l.episodes, l.genres, (select isnull(avg(rating), 0) rating anime_reviews

android - how to display Bas64 String values in the activity screen? -

i have audio file converted byte array. convert byte array in base64. want display base64 values activity screen. don't know how. new android, appreciated. thanks just convert string , set textview, having predefined in layout. textview yourtextview = findbyid(r.id.text_view_id); yourtextview.settext("your base 64 string");

How to use Array in node.js? -

i have make cryptograph using node.js on tonight. have tried can't. what wrong ? help!!! function encrypt(data,j) { for(var = 0, length = data.length; i<length; i++) { j = data.charcodeat(i); //console.log(j); string.fromcharcode(j); process.stdout.write(j); } return j; } function decrypt(data) { return data; } process.stdin.resume(); process.stdin.setencoding('utf-8'); process.stdout.write('암호화할 문장을 입력(input) : ' ); process.stdin.on('data',function(data,j) { //data = data.trim(); process.stdout.write('평문 (uncoded) :' + data); process.stdout.write('암호문(encrypt) :'); encrypt(); process.stdout.write('복호문(decrypt) :'); process.exit(1); }); microsoft windows [version 6.2.9200] (c) 2007 microsoft corporation. rights reserved. c:\users\minji>cd .. c:\users>cd .. c:\>cd workspace c:\workspace>node 3112minji 암호화할 문장을 입력(input) :

android - Is getSimCountryIso returning 3 letters or 2 letters ISO code -

i wondering, getsimcountryiso returning 2 letters or 3 letters iso code? not being mentioned in documentation. tested nexus phone, returning 2 letters. however, i'm not sure true other phones. it returns whatever oem has configured gsm.sim.operator.iso-country property, in experience 2-character code. codes have seen match alpha-2 code iso 3166-1 ( http://en.wikipedia.org/wiki/iso_3166-1 ). based on observation unable find in official documentation.

.net - Some Silverlight and Windows Phone generic questions of a beginner -

Image
i'm starting developing windows phone applications , having strong background in wpf first time silverlight. there things don't understand yet: is silverlight whole executing engine? replaces .net engine? or set of assemblies? are silverlight , .net assemblies different? compatible? why winows phone 8 project in visual studio 2012 shows 3 references when @ csproj there reference microsoft.phone.controls.dll? about point 3, screenshot make more clear: these 3 references creared following csproj line: <reference include="microsoft.phone.controls, version=8.0.0.0, culture=neutral, publickeytoken=24eec0d8c86cda1e, processorarchitecture=msil" /> somewhat simplified can think of silverlight subset of full (desktop) .net framework. more point, .net available on windows phone 8 supports subset of "traditional" .net capabilities. wpf perspective you'll notice there no support commands use them in desktop application instance, the

reporting services - SSRS Result on Multiple Value Parameters -

i have ssrs report takes multiple valued parameter, when try generate sp's multiple values, desired result on contrary when i'm on ssrs env (test), if select multiple values, top row result, below source; sp generate multiple rows select right('0'+storecode,4) + ' - ' + ltrim(rtrim(storename)) result tblinterface_branch storecode in (select * list_to_tbl(@var)) function, i've copied tutorial -- http://www.sommarskog.se/arrays-in-sql-2005.html -- original name: iter$simple_intlist_to_tbl alter function list_to_tbl (@list nvarchar(max)) returns @tbl table (number int not null) begin declare @pos int, @nextpos int, @valuelen int select @pos = 0, @nextpos = 1 while @nextpos > 0 begin select @nextpos = charindex(',', @list, @pos + 1) select @valuelen = case when @nextpos > 0 @nextpos else len(@list) + 1 end - @pos - 1 insert @tbl

Blackberry app compilation error -

please can me.. compiling blackberry html5 app , given out error though have search error have been unable locate error code is(as shown in command line) "out: i/o error: cannot run program "c:\program": createprocess error = 2, system cannot find file specified error response - <"code":1 , "msg":"[error]> \t\trapc exception occurred" this error occurred during compilation could verify have 32-bit jdk installed , not 64-bit?

gmaps4rails - Rails – Geocoder and Google Maps help needed -

i've got bit of problem in app using geocoder , google maps rails. site i'm developing signs venues , addresses of venues gets saved markers on map. on front page search bar address , search radius entered. result goes map page venue markers on , if there markers within search , radius entered displays markers map autofitting include them all. if there no markers present in search radius i've made temporary invisible marker placed @ exact search location, using geocoder can calculate nearest marker point , delete temporary marker , place new new marker @ closest point. map doesn't go south atlantic ocean if no markers in radius , can show user closest venue whatever search rather 'nothing in radius, try again'. i'm sure way i've explained makes sound quite confusing , there better way it. want search bar goes address , includes markers in radius , if there no marker in radius snap closest marker , include markers around that. it doesn't qui

sql - mysql query to get all the unit that a student not enrolled in -

i have 2 tables: chosenunit , units . in chosenunit table there 2 columns student_id , unit_id . units table has unit_id , unit_name columns units in system. lets there 2 students ids of 1000 , 1001. enrolled in several units. chosenunit table this: (1000,2000), (1000,2001), (1000,2006), (1001,2000), (1001,2004), i need units student not enrolled in. if 1000 logs in system,it need show unit_names of subjects except 2000,2001,2006. there many possible solutions on problem. first using left join , is null . select a.* units left join choseunits b on a.unit_id = b.unit_id , b.student_id = 1000 b.unit_id null sqlfiddle demo to further gain more knowledge joins, kindly visit link below: visual representation of sql joins second using not exists select a.* unit not exists ( select 1 choseunit b a.unit_id = b.unit_id , b.student_id =

html - submit form to iframe bug with MacOS -

i have form needs submit iframe. works in windows , in older version of mac os. doesn't works newer version. have tested mac os x mountain lion 10.8.3 , doesn't work. users have reported same problem on different os x version. here code: <form action="https://nidieunimaitre.spreadshirt.com/shop/basket/addtobasket" style="padding: 0px;" method="post" target="formiframe" name="tshirt_form" id="tshirt_form"> <input type="hidden" name="product" id="productid" value="17695932"/> <input type="hidden" name="article" id="articleid" value="7048248"/> <input type="hidden" name="view" id="currentview7048248" value="351"/> <input type="hidden" name="color" id="productcolor7048248" value="2"/> <input type=&quo

MySQL divide prices by currency rate from another table -

i have 2 tables, orders , order_detail. orders id_order | currency | conversion_rate -------------------------------------------- 1 1 1 2 1 1 3 7 8.523856 4 1 1 5 1 1 6 7 8.457893 7 1 1 order_detail id_order | id_order_detail | price -------------------------------------------- 1 1 100 1 2 150 2 3 150 3 4 2500 3 5 2100 4 6 160 5 7 190 6 8 2300 6 9 1500 7 10 125 i need divide prices in order_detail table conversion_rate

java - Translate point coordinates to image -

how translate cartesian point coordinates bufferedimage pixels top left corner? question in context of plotting 2d math functions. let image of height h , width w limited (ymin,ymax) , (xmin,xmax). so far i've managed translate x coordinates, have no idea second dimension. private int transformx(double x) { return (int)((double)w*(x-xmin)/(xmax-xmin)); } private int transformy(double x) { ? } @update it's not homework. transformy more complex because y axis reversed. private int transformy(double y) { return (int)((double)h*(-y+ymax)/(ymax-ymin)); }

winapi - SDL Image Not Supported : cute2.png is not a PNG file, or PNG support is not available -

i trying tutorial, : http://lazyfoo.net/sdl_tutorials/lesson03/windows/msvsnet0508e/index.php http://lazyfoo.net/sdl_tutorials/lesson02/index.php and tried load , display portable network graphics ( .png ) files in application through simple code snippet: #include "sdl.h" #include "sdl_image.h" #include "sdl_ttf.h" #include "sdl_mixer.h" #include <stdio.h> #include <string> //the attributes of screen const int screen_width = 640; const int screen_height = 480; const int screen_bpp = 32; //the surfaces used sdl_surface *background = null; sdl_surface *screen = null; sdl_surface *message = null; sdl_surface *load_image( std::string filename ) { //the image that's loaded sdl_surface* loadedimage = null; //the optimized image used sdl_surface* optimizedimage = null; sdl_rwops *rwop; rwop=sdl_rwfromfile(filename.c_str(), "rb"); if(img_ispng(rwop)) printf(&q

java - From a class, call a function from an activity -

i have made class(paperclip), makes custom dialogbox appear on screen. on activity create instance of paperclip , make dialogbox show on activity. want when button pressed, code on activity executed. want code executed activity, because want dialog box can reuse on lots of different activities within project. i thinking of making variable in class, , attach listener on activity. way, or there easier solution? public class paperclip { int = 0; dialog mydialog; textview t; int mid; context context2; public paperclip(context context) { super(); context2 = context; } public void showit(final string[] messages) { final int lengte = messages.length; mydialog = new dialog(context2, r.style.customdialogtheme); mydialog.setcontentview(r.layout.messagebox); t = (textview) mydialog.findviewbyid(r.id.message); if (lengte != 0) { if (i < lengte) { t.settext(messages[i]

jquery - Selecting the row with the twitter type ahead and updating values in the same row -

i have table of text field bind twitter type ahead this. failed bind twitter bootstrap typeahead jquery generated rows text fields i want result of selection type ahead displayed in next text fields in same row(nth row). first row updated tried this. $('#mytable').find('tr').click( function(){ $(this).find('#mytext1').val(val1); $(this).find('#mytext2').val(val2); } but needs additional click after selection made , duplicates result of last row selected. can , suggest how handle situation? changed code this $('#mytext0').live('change', function(){ //ajax call based on user selection of mytext0, twitter bootstrap bind $(this).closest('tr').find('#mytext1').val(val1); $(this).closest('tr').find('#mytext2').val(val2); }); but not working closest doesn't know method find. ideas?? i figured out using blog tatiyants @ http://tatiyants.com/how-to-use-json

angularjs - Can a controller inherit scope from a parent controller when using ui-router -

i have following: var admin = { name: 'admin', url: '/admin', views: { 'nav-sub': { templateurl: '/content/app/admin/partials/nav-sub.html', controller: function ($scope) { $scope.message = "hello"; } } }, controller: ['$scope', function ($scope) { $scope.message = "hello"; }] } var subject = { name: 'subject', parent: admin, url: '/subject', views: { 'grid@': { templateurl: '/content/app/admin/partials/grid-subject.html', controller: 'admingridsubjectcontroller', } } }; i admingridsubjectcontroller know $scope.message value seems not know it. there doing wrong? stapp.controller('admingridsubjectcontroller', ['$scope', function ( $scope ) { var = $scope.message; }]); in order access scope of parent controller in angul

c# - How to split words in ASP.NET MVC4? -

how split words in asp.net mvc4? this try far. public actionresult index() { var aaa = system.text.regularexpressions.regex.split("12:::34:::55", ":::"); viewbag.test = aaa; return view(); } but page shows system.string[] . you seeing string representation of array. to show elements, use string.join : viewbag.test = string.join(",", //insert separator here aaa); this return "12,34,55" . if want have separate lines, replace "," environment.newline . can have spaces " " , or other separator of choice.

javascript - How do I manipulate object.style.animationDuration outside of Chrome? -

i know throwing webkit prefix @ start works chrome (as object.style.webkitanimationduration ), have yet find way of making work opera prefix, , i'm not sure how effective firefox prefix either. w3schools major browsers support duration property, do? jsfiddle: http://jsfiddle.net/4c7fp/ javascript , jquery suggestions accepted :) maybe can use plugin that. ( prefixfree plugin ) has jquery plugin set/get css without prefixes. btw why didnt use in css? can better , faster javascript.

html - Getting around the CSS height issues -

ok, so, has worked css , html long enough has dealt ridiculous issues of "height:100%". i've read stuff on dealing it, hasn't helped much. below layout need construct. i'm hoping answer me other structures requiring height. rules: it must fill browser window without giving scrollbars. the heights of containers must not go beyond visible area (i.e. not requiring "overflow:hidden" on html or body tags remove scrollbars) the flex areas should adjustable given pixel measurements, whereas filler should fill whatever area left available it. all areas should strictly sized such content should cut off when overflowing, without making area bigger. if possible, i'd prefer without "position:fixed" or "position:absolute", in case time later need such structure inside other wrapper, i'll glad if it's possible in way. lastly, don't want use javascript it. +-------------------------------------------+ |