Posts

Showing posts from June, 2015

Android Toast message doesn't show -

Image
i know there other issues regard problem, however, mine surprisingly different (at least think so). i guess code right don't have idea why toast message doesn't display. firstly, couldn't see toast message in fragments. decided put in activity , amazingly doesn't display here too. this code of activity has been extended fragmentactivity. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.d(tag, "***************************"); log.d(tag, "*** application started ***"); log.d(tag, "***************************"); // assign layout activity setcontentview(r.layout.activity_main); mcontext = mainactivity.this; toast.maketext(mcontext, "hello world", toast.length_short).show(); . . . } application works fine without error , f.toast message doesn't display! replaced mcontext getapplicationcontext...

winforms - Can I host Windows Forms control in a Windows Store app? -

i want create windows store app , in host windows forms controls. possible? the short answer no. pointed out in comments, windows store apps use xaml , not winforms, , run inside app container (modern ui) , cannot access desktop (where winforms works). also, windows store apps run in highly sandboxed environment , cannot run external desktop applications.

unit testing - c# XXXXX is inaccessible due to its protection level -

i having problem "xxxx inaccessible due protection level". have read lot of manuals how test classes internal access. have inserted [assembly: system.runtime.compilerservices.internalsvisibletoattribute("unittests, publickey=mykey")] in projecta class want test. , in testproject have added reference projecta. both have same *.snk. keeps throwing error. some suggestions? without seeing specific class, it's hard precise, ensure following: your class either internal or public your method internal the internalsvisibleto property contains full namespace of test project. i.e. if test project myproject.unittests , need have in internalsvisibleto , e.g.: [assembly: system.runtime.compilerservices.internalsvisibletoattribute("myproject.unittests")] i've never used publickey part of internalsvisibleto , can't comment on that, try removing it. works without me. [assembly: system.runtime.compilerservices.internalsvisiblet...

Pass by Reference / Value in C++ -

Image
i clarify differences between value , reference. i drew picture so, passing value, a copy of identical object created different reference, , local variable assigned new reference, point new copy how understand words: " if function modifies value, modifications appear within scope of calling function both passing value , reference " thanks! i think confusion generated not communicating meant passed reference . when people pass reference mean not argument itself, rather the object being referenced . other pass reference means object can't changed in callee. example: struct object { int i; }; void sample(object* o) { // 1 o->i++; } void sample(object const& o) { // 2 // nothing useful here :) } void sample(object & o) { // 3 o.i++; } void sample1(object o) { // 4 o.i++; } int main() { object obj = { 10 }; object const obj_c = { 10 }; sample(&obj); // calls 1 sample(obj) // calls 3 sample...

c++ - NaN or false as double precision return value -

i have function returns double value. in cases result zero, , results should handled in caller routing accordingly. wondering proper way of returning 0 (nan, false, etc!) in place of double value number: double foo(){ if (some_conditions) { return result_of_calculations; } else { // of following better? return std::numeric_limits<double>::quiet_nan(); // (1) return 0; // (2) return false; // (3) return (int) 0; // (4) } } the caller routine so: double bar = foo(); if (bar == 0) { // handle 0 case } else { // handle non-zero case } is if (bar == 0) safe use #3 , #4? can use #2 or should fabs(bar - 0) < epsilon ? how should 1 handle case of quiet_nan ? read in site (e.g. 1 , 2 ) comparison of nan not necessary false. that? in summary, how 1 returns false value in place of double later co...

ScrollTop - jQuery does not scroll -

i've got code: http://jsfiddle.net/goodghost/mer3a/ $(function() { var mywidth = $(".container").width(); var myheight = $(window).height(); console.log(myheight); var myshift = (1920 - mywidth)/2; $(".container").scrollleft(myshift); //small window $(".dragme").css({"left":myshift/10+"px", "width":(mywidth)/10+"px", "height":myheight/10+"px"}); $(".dragme").draggable({ addclasses: false, containment: "parent", drag: function(event, ui) { var offset = $(this).offset(); var xpos = offset.left; var ypos = offset.top; console.log(ypos); $(".container").scrollleft(xpos*10); $(".container").scrolltop(ypos*10+"px"); } }); }); what want achieve scroll in every direction image inside .container tri...

excel - Taking rows of data and converting into columns with consecutive rows -

i've seen similar posts not quite need or understand solve simple problem. i have hundreds of rows of data i'd transform columns. original data 2 empty rows between , sets of related data can vary in length: 9 8 7 6 5 4 3 2 1 j h g f e d c b i'd able reverse order of each set , transpose them in columns going down row each data set so: 1 2 3 4 5 6 7 8 9 b c d e f g h j i had success first part using simple formula =offset($a$2,counta(a:a)-row(),0) because wasn't sure how in vba. the code i'm using grab data , transpose, i'm having trouble getting go down row each unique data set. here's code i'm trying use, doesn't seem work , start running down worksheet until macro craps out. sub transposerange() dim inrange range dim outrange range dim long set inrange = sheets("output").range("a3:a10002") set outrange = sheets("output").range("h2:ntr2") =...

android - Upgrading database version of an already built database -

i have database stored in assets folder built using sqlite manager. now, when add new records table of database, have uninstall , reinstall app. have upgrade database in right way without uninstalling app? note: my oncreate() , onupgrade() empty because mentioned, database built. i call super(context, db_name, null, 1); in helper constructor, changing version not because onupgrade() empty. to allow upgrading, must implement onupgrade , whatever necessary convert old version new version. if have new database file in assets folder, must replace old file. not possible sqliteopenhelper because has active transaction while onupgrade called, when not using automatic creation/versioning mechanism, there not reason use sqliteopenhelper in first place.

c++ - Error detection Visual Studio 2010 -

i downloaded visual studio 2010 professional , surprised error correction not seem work. have checked under tools -> options -> texteditor -> c/c++ -> advanced seems ok. error detection disabled set false. i want vs autodetect error - in same way misspellings detected in eclipse instance cout // error notification if omitt namespace std cour // oups, wrong keystroke. underline and on ... i think have hit f5 or build project. vs2010 sluggish sometimes.

java - How does one create a JFrame application with custom buttons -

i looking create atm style application, in sense enter pin , check amount of money, etc. create pin system , looking use jbuttons this. however, not fond of default skin buttons, sort of orb look. wondering if there way in apply custom skins these buttons. have heard of defaultlookandfeel or similar not sure if looking for. hope direct me in correct direction, thanks! depending on situation, create separate custom button class extends jbutton or create new jbutton. your code similar this: imageicon yourimage = new imageicon(imagelocation); jbutton buttondeposit = new jbutton(yourimage); frame.add(button);

hadoop - RANK OVER function in Hive -

i'm trying run query in hive return top 10 url appear more in adimpression table. select ranked_mytable.url, ranked_mytable.cnt ( select iq.url, iq.cnt, rank() on (partition iq.url order iq.cnt desc) rnk ( select url, count(*) cnt store.adimpression ai inner join zuppa.adgroupcreativesubscription agcs on agcs.id = ai.adgroupcreativesubscriptionid inner join zuppa.adgroup ag on ag.id = agcs.adgroupid ai.datehour >= '2014-05-15 00:00:00' , ag.siteid = 1240 group url ) iq ) ranked_mytable ranked_mytable.rnk <= 10 order ranked_mytable.url, ranked_mytable.rnk desc ; unfortunately error message stating: failed: semanticexception [error 10002]: line 26:23 invalid column reference 'rnk...

javascript - Android WebView using loadDataWithBaseURL the loaded document imports additional scripts, but they aren't ran -

problem: for android webview, need html doc downloaded cdn. i need periodically re-download document see if it's been updated. i want webview load document, load new version if different current version preserve page variables (i have no influence on document , cannot change way runs). my solution natively load document using httpurlconnection , use webview.loaddatawithbaseurl(...). way can diff document versions , call method when there's new document. also, document can fetch additional resources using baseurl. webview.getsettings().setjavascriptenabled(true); webview.setwebchromeclient(new webchromeclient(){ /*...*/ }); webview.setwebviewclient(new webviewclient(){ /*...*/ }); string html = gethtmldoc("http://somecdn.com/doc.html"); webview.loaddatawithbaseurl("http://somecdn.com/", html, "text/html", "utf-8", null); the unexpected behavior: d/console(xxxx): onpagestarted:http://somecdn.com/doc.html d/console(xxxx):...

jquery - Change javascript depending on what's checked in a form -

so basically, need piece of javascript magic. want have form multiple checkboxes (representing webpages) , people check these boxes "on" or "off", generate different javascript. the idea give visitors button, link them webpages selected in form, 1 single click. making sense here...? so sort of script turn parts of off when conditions met within form. i hope genius mastermind able me here. thanks in advance! it doesn't sound need wizard code, need code open many separate windows. you don't need javascript rewrites itself, need bunch of if-statements open windows if option checked.

Excel If Then formulas for adding multiple values to a total -

i working excel , want use if-then statements tally values on separate sheet. example be: if text in cell l1=d, add value in cell, k1 cell a1 in separate tab ongoing tally. if text in cell l1=e, add value in cell, k1 cell b1, on separate tab ongoing tally. basically, have purchased 5000 books. of these books library , library b. need pull costs of each book based on destination , tally them in separate sheet. need formula keep adding book price book price in tallying cell have grand total location. it sounds want use sumifs. in a1 on sheet2: =sumifs('sheet1'!$k:$k,'sheet1'!$l:$l,"d") in b1 on sheet2: =sumifs('sheet1'!$k:$k,'sheet1'!$l:$l,"e") in english, translates to: "in cell (eg a1) add values in column k on other sheet (sheet1). but, include cells corresponding value in column l meets criteria (eg equal 'd')."

Binary search recursive function returning undefined in JavaScript? -

hi, getting undefined following javascript code. tool debugging javascript, webstorm best? //input var inputarray = [1, 2, 3, 4, 5, 5, 5, 6, 66]; var searchvalue = 2; //output var arraylength = inputarray.length; var arraycurrent = inputarray; var currentindex = arraylength; function binarysearch() { currentindex = math.floor(arraycurrent.length / 2); if (searchvalue == arraycurrent[currentindex]) { var x=currentindex; return x; } else if (searchvalue > arraycurrent[currentindex]) { arraycurrent = arraycurrent.slice(currentindex + 1); binarysearch();//recursive call } else if (searchvalue < arraycurrent[currentindex]) { arraycurrent = arraycurrent.slice(0, currentindex - 1); binarysearch();//recursive call } } var found=binarysearch(); console.log("the index of searched value is: " + found); console output: index of searched value is: undefined the recursion happens if function cal...

xml - Looping over XmlChildern with Coldfusion -

i have xml document: <book> <content> <chapter2> </chapter2> <chapter3> </chapter3> </content> </book> <cffile action="read" file="file.xml" variable="myxml"> <cfset mydoc = xmlparse(myxml)> <cfset booknodes = xmlsearch(mydoc,'book/content') > <cfloop from="1" to="#arraylen(booknodes)#" index="i" step="1"> <cfset bookxml = xmlparse(booknodes[i])> #bookxml.content.xmlchildren[i].xmlname# </cfloop> in trying make sure had code correct trying print out xmlname element. chapter2 , chapter3. the loop prints chapter2 , when print arraylen of booknodes says 1 when dump variable booknodes chapter 3 node present of childern. the loop seems stop after one. am missing something? you referencing wrong thing , don't need convoluted xmlsearch, etc... here: <cfset booknodes = myx...

How to capture image automatically when application start in android? -

hi friends working on application. in application when application start pic should automatically captured camera. my code is: 1. camera demo public class camerademo extends activity { private static final string tag = "camerademo"; camera camera; preview preview; button buttonclick; chronometer ch; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); preview = new preview(this); ((framelayout) findviewbyid(r.id.preview)).addview(preview); buttonclick = (button) findviewbyid(r.id.buttonclick); ch=(chronometer)findviewbyid(r.id.chronometer1); ch.start(); preview.camera.takepicture(shuttercallback,rawcallback,jpegcallback); // if write above code here shows error. ...

jquery - PHP array to javascript conversion altering the index values -

i have javascript function gets user info database via ajax. has following code. var temp_id = new object; function checkrequests() { $.ajax({ url: "bin/inc/classes/mechanism_class.php", type: "post", data: {'checkrequest': '1'}, success: function(data1) { for(var i=0; i<jquery.parsejson(data1).length; i++) { $.ajax({ url:"bin/inc/classes/mechanism_class.php", type: "post", data: {'checkrequest2': jquery.parsejson(data1)[i]}, success: function(data) { requestpopper(data); } }).error(function() { }); } } }).error(function() { }); } function requestpopper(data) { var id = jquery.parsejson(data)[0]; var firstname = jquery.parsejson(data)[1]; var lastname = j...

sql - MS Access sum of 2 table in one query -

i have 2 tables: name "mfr" name "pomfr" both have many columns, same, , want sum of similar column in 1 query based on 1 of them similar column group by data sample table1. mfr rfno|ppic|pcrt 101 | 10| .30 102 | 15| .50 103 | 18| .68 table2 pomfr rfno|ppic|pcrt 101 |100 | 1.15 102 | 50 | 1.50 103 | 0 | 0 and result in query should mfrquery rfno|ppic|pcrt 101|110 |1.45 102| 65 |2.00 103| 18 | .68 i'll nice. isn't efficient method, it'll work... select* #temp table1 union select* table2 select id,sum(ppic) ppic, sum(pcrt) pcrt #temp group id what says is, select table 1 , use union table 2 , place in temporary table called #temp. filter variables , ranges need. then 2nd part says, take sum of ppic , sum of pcrt #temp table , group id. since you're new so, future reference, people ...

Passing id through the check_box value in Ruby on Rails using form_for -

Image
i have 2 controller project_controller.rb , service_controller.rb . have field in project named service_id . when create project, value of service_id kept null default. need update service_id field of project id of service . for have created form using project object. shown below : <%= form_for(@project) |f| %> <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> <div class="field"> <% @services.each |service| %> <%= f.label "#{service.name}" %> # here want pass array of <%= f.check_box :service_id %> # service_id through value of check box <% end %> </div> <div class="actions"> <%= f.submit %> </div> <% end %> now in source coming this.. please .. thanks if refer rails api see check_box(method, options = {}, checked_value = "1...

android.database.sqlite.SQLiteException: table contacts has no column named uid -

this code : public void oncreate(sqlitedatabase db) { string create_contacts_table = "create table if not exists" + table_contacts + "(" + key_id + " integer primary key," // , auto increment handled primary key + key_uid + " text," + key_name + " text," + key_ph_no + " text," + key_comapny + " text," + key_email + " text," + key_country + " text," + key_street + " text," + key_city + " text,"+ key_state + " text," + key_zip + " text);"; db.execsql(create_contacts_table); } i getting below exception : : e/sqlitedatabase(2645): android.database.sqlite.sqliteexception: table contacts has no column named uid (code 1): , while compiling: insert contacts(uid,zip,phone_number,email,...

dictionary - Python: Trying to create a dict containing limited MRU entries -

i trying create dict contains limited number of mru entries (for helping in caching output of costly c function call via ctypes). here code: from collections import ordereddict class mrudict(ordereddict): def __init__(self, capacity = 64): super().__init__() self.__checkandsetcapacity(capacity) def capacity(self): return self.__capacity def setcapacity(self, capacity): self.__checkandsetcapacity(capacity) in range(len(self) - capacity): self.__evict() # execute if len > capacity def __getitem__(self, key): value = super().__getitem__(key) # if above raises indexerror, next line won't execute print("moving key {} last i.e. mru position".format(key)) super().move_to_end(key) return value def __setitem__(self, key, value): if key in self: super().move_to_end(key) else: # new key if len(self) == self.__capacity...

c# - Overriding GetHashCode and Equals on a class because it's used in a dictionary -

i have been asked override gethashcode , equals on particular class because using instances of class key (lookup) in dictionary. i've noticed class not contain public properties , private fields reference types. public methods , events. do still need override these methods? haven't seen problem far during testing. how equality tested in scenario? if nothing, default ok? thanks in advance. then can use hash of 2 private objects hash. hash1 ^ hash2; and can compare values of read fields equality. the idea 2 identical objects should equal.

javascript - Karma test fails in Firefox with strange error -

i've got odd behavior 1 of tests. runs in chrome, fails in firefox. tests directive , error occurs in beforeeach block. typeerror: menu null (path/to/file.js:6) //this points block of comments process.on/global.onerror@/dir/node_modules/mocha/mocha.js:5708 //this function throws every unhandled error the directive work in firefox. beforeeach compiles , sets properties on scope. strange may seem, tests of describe block report have passed, webstorm reports 24 out of 28 it s done. any ideas hack going on?

Sending a HTTP request using python -

i have intercepted http request using fiddler. i send same request, time using python , not browser. i did research , found httplib way go, reason code not work. no request sent computer (i can verify using fiddler). any ideas whats wrong ? import httplib headers = { "host":" unive.edu", "connection":" keep-alive", "content-length":" 5142", "cache-control":" max-age=0", "accept":" text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "origin":" http://unive.edu", "user-agent":" mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/34.0.1847.137 safari/537.36", "content-type":" application/x-www-form-urlencoded", "dnt":" 1", "referer":" http://unive.edu/webtixsnetglilot/selectcoursepage2.aspx?dtticks=635358672778578750&hidebackbutt...

javascript - iframe contentWindow is undefined when use window.frames[name] to access -

if use following way contentwindow, value undefined <html> <head> <title>iframe test</title> </head> <body> <iframe id="frame1" src="frame1.html" name="frame1"></iframe> <script> document.body.onload = function() { console.info("index loaded"); var frame1 = window.frames["frame1"]; console.info(frame1.contentwindow); } </script> </body> </html> if use other way following, works fine: var frame1 = document.getelementbyid("frame1"); console.info(frame1.contentwindow); i tested on ff 29.0.1, chrome 34, ie11, work same way. so have 2 questions: why first way can't contentwindow value iframe.contentwindow compatible in browser? window.frames["frame1"]; is contentwindow , get's named window, , in case it's same thing document.getelementbyid("frame1").contentwi...

Returning SQL Server Output parameter to C# by Stored Procedure -

i have stored procedure in sql server 2012 output parameter. when call c# decrypt function, @ point when hit executenonquery() , error: procedure or function 'decryptccode' expects parameter '@decryptedstr', not supplied. how output value of stored procedure in code? thanks. stored procedure: alter procedure [dbo].[decryptccode] @decryptedstr nchar(5) output begin set nocount on; if not exists (select * sys.symmetric_keys symmetric_key_id = 101) create master key encryption password = 'rfsdffsssdfsdfwerefeses' if not exists (select * sys.certificates name='clientcert') create certificate clientcert subject = 'my clientcode certificate'; if not exists (select * sys.symmetric_keys name='clientcode_k1') create symmetric key clientcode_k1 algorithm = aes_256 encryption certificate clientcert; open symmetric key clientcode_k1 decryption certificate clientcert; selec...

error handling - Try and catch with while loop: jumps to catch block even after the input is correct only if the first input was incorrect - C++ -

i'm trying check if user has entered name correctly, or without space i.e. joe bloggs. cannot have special characters or numbers in name or pop error message i.e. jo3_bl0ggs. i'm trying if enter name in wrong format, error message alerted , program ask user enter name again, until enter correctly. i'm using while loop if it's correct, change value of flag , break out of loop, if not i'll rerun setname() function asks name. however problem i'm having if enter first time , it's incorrect, asks them enter name again , if second input correct message "welcome joe bloggs", loop continue , ask them enter name in again. the way can avoid problem if first input correct, kind of defeats whole point of try , catch block. below 2 functions i'm concerned with. if can point me in right direction, great. i'm new c++ why i'm bit confused this. inputclass::inputclass(){//empty constructor} void inputclass::validatename(string name){ ...

html - Randomly inserting images into table using Javascript -

i'm new javascript , i'm creating game user re-arranges table of pictures clicking. images scrambled pieces of larger image user has sort out. the user clicks on 1 of images in table, clicks image in table, , swap positions. have use javascript this, ive created 3x4 table , filled 12 "partial" images need re-arranged. each time page loads, need have images put in random cells each game, user has sort images in different way. to this, use diffimage() function picks random image array of images have. if 1 of images named "mario01.jpg", function takes image , makes <img src="mario01.jpg" />. my diffimage() function takes image selected out of array image won't inserted second time table. i use diff image function each image give random source. however, when load page, no images show , error says, [error] typeerror: 'null' not object (evaluating 'document.getelementbyid("image1").src = diffimage()') ...

database - retrieve single record with kohana 3.3 with request->param() is NULL -

i try use kohana framework have little issue wen try retrieve single record table of database. table: ads id_ads title_ads description_ads my controller: public function action_single() { $ads_id = $this->request->param('id_ads'); $ads = orm::factory('ads', $ads_id); $view = new view('ads/single'); // load view/ads/single.php $view->set('ads', $ads); // set 'ads' object view $this->template->set('content', $view); } my view <h2><?php echo $ads->title_ads; ?></h2> <pre><?php echo $ads->description_ads; ?></pre> when go to localhost/kohana/index.php/ads/single/1 browser display nothing, problem? try this: $ads_id = $this->request->param('id_ads'); $ads =orm::factory('ads'->find($ads_id); or $ads_id = $this->request->param('id_ads'); $ads =orm::factory('ads')->where(...

ngtable - AngularJS ng-table fixed headers -

i'm using ng-table display information. make header , footer of ng-table fixed , force ng-table draw scroll bars within rows. the ng-table documentation site has no documentation on how make happen. any ideas? that far reliable solution found. , i've looked hours before deciding use jquery plugin. in version of plugin using, can stick header scrollable container. take @ plunker use case ng-table: http://plnkr.co/edit/ypbadhifajwapxvs3jcu?p=preview javascript app.directive('fixedtableheaders', ['$timeout', function($timeout) { return { restrict: 'a', link: function(scope, element, attrs) { $timeout(function() { var container = element.parentsuntil(attrs.fixedtableheaders); element.stickytableheaders({ scrollablearea: container, "fixedoffset": 2 }); }, 0); } } }]); html <div id="scrollable-area"> <table ng-table="tableparams" fixed...

php - Unable to set the remember me cookie expiry date in laravel 4.1.28 -

background: i using laravel 4.0.x , , resetting remember_me cookie expiry date 1 month (since default 5 years ) using code : app::after(function($request, $response) { // if user tryin log_in , wants stay logged in, reset remember_me cookie expiration date 5 years 1month $remember = input::get('remember',false); if ($remember) { if ( auth::check()){ // check if user logged in $ckname = auth::getrecallername(); //get name of cookie, remember me expiration time stored $ckval = cookie::get($ckname); //get value of cookie return $response->withcookie(cookie::make($ckname,$ckval,43200)); //change expiration time 1 month = 43200 min } } that code app\filters.php of course, , working charm. the problem : i updated laravel 4.0.x v4.1.28, , remember_me cookies set 5 years, tried last hours digging in code trying debug no luck :( . notice changing $ckname value "test" in last line of abo...

python - How do I get a raw, compiled SQL query from a SQLAlchemy expression? -

i have sqlalchemy query object , want text of compiled sql statement, parameters bound (e.g. no %s or other variables waiting bound statement compiler or mysqldb dialect engine, etc). calling str() on query reveals this: select id date_added <= %s , date_added >= %s order count desc i've tried looking in query._params it's empty dict. wrote own compiler using this example of sqlalchemy.ext.compiler.compiles decorator statement there still has %s want data. i can't quite figure out when parameters mixed in create query; when examining query object they're empty dictionary (though query executes fine , engine prints out when turn echo logging on). i'm starting message sqlalchemy doesn't want me know underlying query, breaks general nature of expression api's interface different db-apis. don't mind if query gets executed before found out was; want know! this should work sqlalchemy >= 0.6 from sqlalchemy.sql import co...

javascript for loop order -

var x = ["a", "b", "c"]; for(var = 0; < x.length; i++){ x[i] = x[2 - i]; } approach: = 0 => x[0] = x[2] (which "c", replace "a" "c") = 1 => x[1] = x[1] (which "b", replace "b" "b") = 2 => x[2] = x[0] (which "a" replace "c" "a") = 3 test failed, stop. x = ["c", "b", "a"] why console return x ["c","b","c"]? please tell me whether have misunderstood loop logic? thank you! var x = ["a", "b", "c"]; for(var = 0; < x.length; i++){ x[i] = x[2 - i]; } let's write code out longhand: var x = ['a', 'b', 'c']; x[0] = x[2]; // ['c', 'b', 'c'] x[1] = x[1]; // ['c', 'b', 'c'] x[2] = x[0]; // ['c', 'b', 'c'] the problem time i = 2 you've modified x[0] ...

css - Why do I still have a margin around my body on mobile? -

i learning basics of responsive design, , started scratch. want simple page no margin on sides. yet on iphone, site has still big white margin left , right. css have far: div#header_image img{ max-width:100%; } div#chart img{ max-width:100%; } div#chart_place{ margin-bottom:2em; } @media screen , (min-width: 800px) { div#container{ width:800px; margin: 0 auto; } } @media screen , (max-width: 800px) { div#container{ width:max-width; margin: 0; padding: 0; } } body{ font-family:verdana, geneva, sans-serif; margin:0; } h1{ font-size: 1.5em; margin-top:2em; margin-bottom:2em; } ul{background-color:white;} div#feesboek_button{ } input[type='text'], textarea {font-size:16px;} what do wrong? edit/update: since previous answer not loo...

jquery - Background-image + Making a Div into a link -

i created small box placed @ bottom right of map , have facebook logo background image , make div clickable directs site. tried adding code cannot seem either fb image nor link work. fiddle css (background image): #facebook { background-image: url(http://www.ridersmatch.com/facebook_logo.png); background-repeat: no-repeat; height: 30px; width: 30px; margin-right: 5px; margin-bottom: 5px; background:#fff; border: 1px solid #ccc; border-radius: 10px; } jquery (click function): map = new google.maps.map(document.getelementbyid("map_canvas"), map_options); map.controls[google.maps.controlposition.top_left].push($('<div id="infowindow"/>')[0]); map.controls[google.maps.controlposition.right_bottom].push($('<div id="facebook"/>')[0]); $('#facebook').click(function() { window.open('http://www.fac...

xcode - gitignore not ignoring file -

no matter put in .gitignore can not git ignore userinterfacestate.xcuserstate file below: $ git status on branch master branch up-to-date 'origin/master'. changes not staged commit: (use "git add <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) modified: .gitignore modified: calfoo.xcodeproj/project.xcworkspace/xcuserdata/wcochran.xcuserdatad/userinterfacestate.xcuserstate i using/editing .gitignore file listed on this post . tried match pattern including exact pathname: calfoo.xcodeproj/project.xcworkspace/xcuserdata/wcochran.xcuserdatad/userinterfacestate.xcuserstate no avail. this particular problem arises workflow xcode used create initial git repo , .gitignore file here added afterwards. more general answer ignoring tracked files in git can found this question (i guess never found post in search since didn't have "gitignore" in title). ...

html - Centered-fixed-width-div with fluid divs on left and right? -

Image
i working on wordpress site. have these decorative titles constructed this: (the following not real html structure, example purpose) <div class="decoration-left"> <div class="title"> <div class="decoration-right"> .title has h1 title inside. .decoration-left, , .decoration-right, empty divs, decorative background. need title centered time. i first tried give 3 divs 33.3% width, worked nice on big screens, reduce window title breaks 2 lines, , looks ugly. need title have constant width therefore. dont want text smaller. right now, have .title div "width:auto" works fine. need left , right decorative divs take each one, half of remaining space in responsive/fluid way. attaching picture better understunding.! my guess is: put decorative divs inside title div, , title div inside wrap div. make title div 'position: relative; display:inline-block; background:#fff;' decorative ones 'position:abs...

angularjs - Spring MVC and Web Application separated -

i have been googling lot lately, find myself coming short on answers. i have complete spring mvc application secured spring security , services exposing logic controllers (controllers -> service -> repository -> pojo's). currently controllers, except login controller, serve nothing json/xml , want stay way. not want render different views on each controller. however, want able to, separate web application backend because in time want able integration service using more platforms web browser. currently have regular spring mvc application: configuration domain(pojo's) repository service controller login done using thymeleaf rendered view , spring security nothing more filtering urls under application root. after this, bunch of static files being served resources: spring controllers send "{ontrollername}/layout" serve angularjs html partial used data under given spring controller. what want, way separate in /webapp directory rest of pro...

github - Checkout a git repo and keep updated with only the latest tag -

is there way keep checkout updated between tags, , tags? ideally, want go checkout's directory, type "git pull", have command fail if there no new tags in repo or pull code down newer tag. is bad idea? maybe, because can't find solution, no 1 this. there issues executing way? you use following script: git fetch origin currenttag=$(git describe --tags --abbrev=0) lasttag=$(git describe --tags --abbrev=0 origin/master) if [ $currenttag != $lasttag ]; git checkout $lasttag; exit 0 else exit 1 fi

android - how to separate the content of a string? -

Image
json gives me value contains 3 values ​​within keep in separate map gives me content, content has 3 values ​​should separated, language occupies? "mapa":[ "a:3:{s:7:\"address\";s:54:\"volc\u00e1n parinacota 1202-1220, chill\u00e1n, biob\u00edo, chile\"; s:3:\"lat\";s:19:\"-36.620445433045944\"; s:3:\"lng\";s:18:\"-72.07966608584445\"; }" ] in json string , there 2 symbols guide through parsing : { - indicates jsonobject [ - indicates jsonarray when parsing json string, should go through items iteratively. understand how many jsonobjects , jsonarrays have in string , , should start parsing, use json-visualizer tool this website . : example : see, root object jsonobject consists of jsonarray 3 jsononjects. parse such structure can use : jsonobject jsonobj = new jsonobject(jsonstring); string result = jsonobject.getstring("success"); strin...

Saving and Reading struct array with binary file in C language -

there problems reading function. my reading function is: int readfiletopic(file* f, pic* picture_reccord, int picnumber){ int count = 0; f = fopen("record.dat", "rb"); if (f == null){ printf("\n unable open file!\n"); } else{ count= fread(&picture_reccord, sizeof(picture_reccord), maximun_picture, f); fclose(f); } if (count <=0 && count >= maximun_picture) return -1; //breaking programe //picture_reccord[count].filename[0] = '\n'; return count; } this how call case 3: printf("read picture records disk\n"); count= readfiletopic(file, picturerecord, picnumber); printf("\n\nread %d photos\n", count); //testing printf("\n%d\n", picturerecord[0].location); break; it prints "read 4 photos" every time , grabage in testing part this saving function in case problems are void savepic(file* f, pic picture_record){ f= fopen...

class - Same variablename and propertyname in a constructor in JavaScript -

consider following definition of class in javascript: // car constructor function car(color) { var haswheels = true; this.color = color; this.haswheels = haswheels; } var redcar = new car('red'); console.log(redcar.haswheels); it seems work because gives no errors in firefox , writes true console. however, code correct or javascript forgiving? netbeans complains in car constructor variable haswheels unused. not give hint haswheels when type redcar. . works property color . have rename variable haswheels e.g. _haswheels ? (i know in simple example set property hasweels directly true , not point of question.) new code like: // car constructor function car(color) { var _haswheels = true; this.color = color; this.haswheels = _haswheels; } var redcar = new car('red'); console.log(redcar.haswheels); this seems work fine netbeans. however, rather gives properties , variables same name, since @ end assigned. this['haswheels'] = h...

java - Mapping JPA or Hibernate projection query to DTO (Data Transfer Object) -

in dao layer, have find function this public list<?> findcategorywithsentencenumber(int offset, int maxrec) { criteria crit = getsession().createcriteria(category.class, "cate"); crit.createalias("cate.sentences", "sent"); crit.setprojection(projections.projectionlist(). add(projections.property("title"), "title"). add(projections.count("sent.id"), "numberofsentence"). add(projections.groupproperty("title")) ); crit.setfirstresult(offset); crit.setmaxresults(maxrec); return crit.list(); } so, in order read data, have use loop (with iterator ) list<?> result = categorydao.findcategorywithsentencenumber(0, 10); // list<dqcategorydto> dtolist = new arraylist<>(); (iterator<?> = result.iterator(); it.hasnext(); ) { object[] myresult = (object[]) it.next(); string title = (string) myresult[0]; long count = (long) myresult[1]; ...