Posts

Showing posts from May, 2011

php - Protecting all admin/ routes with auth in Laravel -

i brand new laravel , setting admin panel authorization on first application. way have files setup setup is: controllers/ admin/ dashboard.php settings.php non-admin-controller1.php non-admin-controller1.php views/ admin/ dashboard.blade.php login.blade.php template.blade.php non-admin-view1.php non-admin-view1.php non-admin-view1.php ...and these routes route::get('admin/login', function() { return view::make('admin.login'); }); route::get('admin/logout', function() { return auth::logout(); return redirect::to('admin/login'); }); route::post('admin/login', function() { $userdata = array('username' => input::get('username'), 'password' => input::get('password')); if (auth::attempt($userdata)) { return redirect::to('admin'); } else { return redirect:

mysql - PHP returning output of other user request -

i'm facing problem php response. used ajax 3 seconds delay check user's logs. when user account used simultaneously 2 users, 1 must kicked. used track log id in db if equal session. problem users getting kicked there no other user using his/her account. tried print_r query statements , returning different values. might response other users. i'm using iis server , fastcgi php response. can tell me how possible , give me ideas solve issue? thanks. here of codes : checking logs in db using ajax: public function checklogstatus( $name, $email, $sess_code ) { $qry = "select log $this->tablename name='$name' , email='$email'"; //when print statement returns different values of $name , $email $result = mysql_query( $qry ) or die(mysql_error()); if( !$selresult = mysql_fetch_array($result) ) { return false; } if(!isset($_session)) { session_start(); } if( !isset( $selresult['

sql - MySQL row numbers for table -

i trying row numbers table. far sql prompt: select @i = @i + 1 rank, x.name, x.partyname, x.constituencyname, x.votes ( select concat(t1.firstname, ' ', t1.lastname) name, t1.partyname, t1.constituencyname, coalesce(t2.count, 0) votes ( (select db.user.pid, db.user.firstname, db.user.lastname, db.party.partyname, db.constituency.constituencyname db.user left join db.party on db.user.partyid = db.party.partyid left join db.constituency on db.user.cid = db.constituency.cid db.user.partyid not null , db.user.cid not null ) t1 left join (select db.user.vote, count(*) 'count' db.user group db.user.vote ) t2 on t1.pid = t2.vote order t2.count desc) ) x, (select @i:=1) r so that, first create table t1(that gets information 2 different tables) , joi

javascript - HTML5 edit text on the canvas -

i'm trying create similar http://www.listhings.com can edit text within canvas. i've read other post html5 canvas text edit . don't want edit text outside of canvas. want edit text within canvas. i'd appreciate if can point me in right direction. thanks first, mohsen correctly points out when context.filltext "painting picture of letters" on canvas. it's not word processor! you can capture key events on window , write keystrokes out canvas. here code , fiddle: http://jsfiddle.net/m1erickson/7txd4/ this example types lowercase a-z (no capitals, spaces, backspaces, etc) you want make more enhancements these: adding more keys (a-z, 0-9, etc). respond command keys backspace remove letters keyhistory. put cursor users know on line type (hint: http://www.html5canvastutorials.com/tutorials/html5-canvas-text-metrics/ ) if allow multi-line text, handle [enterkey] , move new line. etc here's code just started : <!doct

python - MySQLdb return average of results -

its possible return average of selected data using mysql, can't seem using mysqldb, code follows cursor = database.cursor() cursor.execute ("select avg(points) table entry =%s , id =%s", (e_id, g_id)) average = cursor.fetchone() print average would know how this..? edit: error getting 1064, "you have error in sql syntax...

asp.net - Including a model within a model, I think? -

i extremely new asp/mvc3/c# undertaking project requires me list users in database drop down list, ideally want filter shows users in roles (i.e. either admin, staff or student). however problem lies in following, have controller (requests.cs) method following, , allows me go http://server/requests/userlist : public actionresult userlist() { // create our view model var users = membership.getallusers(); var model = new studentlistviewmodel { users = users.oftype<membershipuser>().select(x => new selectlistitem { value = x.provideruserkey.tostring(), text = x.username }) }; return view(model); } a view model looks this: using system; using system.collections.generic; using system.linq; using system.web; using system.componentmodel.dataannotations; using system.web.mvc; namespace academicregistry.viewmodels { public class studentlist

php sum values of form check boxes when checked -

i have form in php displays checkboxes. these checkboxes associated numerical value populated mysql. i'm looking add values of each checkbox, if box checked. the problem running no matter boxes have checked, value first checkbox(es) returned. example, if there 5 total checkboxes , select bottom 2, returned sum 2 top boxes not bottom boxes. seems php code knows boxes being checked, doesn't know boxes being checked. here form code echo "<input type=\"hidden\" name=\"id[]\" value=\"".$row['id']."\" />"; echo "<tr><td>&nbsp;<input type=\"checkbox\" name=\"checked[]\" value=\"y\"></td>"; echo "<input type=\"hidden\" name=\"amount[]\" value=\"".$row['amount']."\" />"; and here post if('post' == $_server['request_method']) { $amt = 0; $totamt = 0; foreach($_p

php - MySQL Drop Multiple Columns -

i'm trying drop multiple columns, having trouble. syntax below works when alter table , add multiple values in brackets () doesn't work drop column . using wrong syntax? $table3 = " alter table $table3_name drop column ( user_firstname, user_lastname, user_address, user_address2, user_city, user_state, user_zip, user_phone ); "; alter table `tablename` drop `column1`, drop `column2`, drop `column3`;

css - CSS3 transform - rotate and font goes away -

Image
i'm using simple css3 transformation rule on html element (wich contains many other elements h1,h2,inputs,and img): div{ -moz-transform: scale(1) rotate(-3deg) translatex(0px) translatey(0px) skewx(0deg) skewy(0deg); -webkit-transform: scale(1) rotate(-3deg) translatex(0px) translatey(0px) skewx(0deg) skewy(0deg); -o-transform: scale(1) rotate(-3deg) translatex(0px) translatey(0px) skewx(0deg) skewy(0deg); -ms-transform: scale(1) rotate(-3deg) translatex(0px) translatey(0px) skewx(0deg) skewy(0deg); transform: scale(1) rotate(-3deg) translatex(0px) translatey(0px) skewx(0deg) skewy(0deg); } the problem font skretched can see how possible? check img: is there way/trick fix font not skrech or going bad, when using rotate css3? nb : avoid comments "it looks me" :d please check word's chars not vertically aligned, check example word quale l , e chars in chrome have no problems, firefox seems make problems fonts in rotating :(

Best practice - Passing instance variables or using params in Ruby on Rails views? -

according following example, what's best practice? case 1 controller.rb ... def index ... @group = params[:group] @team = params[:team] @org = params[:org] ... end index.html.haml = link_to @group, '#' = link_to @team, '#' = link_to @org, '#' case 2 controller.rb ... def index ... ... end index.html.haml = link_to params[:group], '#' = link_to params[:team], '#' = link_to params[:org], '#' or maybe there option, passing 1 instance variable of hash type... thanks! generally it's better idea split out parameters instance variables, if need cleaning on them. using params directly inside view bit messy, , has effect of needlessly tying view structure of incoming parameters. it's controller's job intermediate between incoming parameters , view itself. should convert 1 format can make change parameters without affecting view, , view without changing requirements parameters

haskell - Why is there no Show instance for functions? -

just quick conceptual question, trying learn , understand haskell better. i know show function used convert values strings, why can't function types used show? prelude> (\x -> x*3) <interactive>:7:1: no instance (show (a0 -> a0)) arising use of `print' possible fix: add instance declaration (show (a0 -> a0)) in stmt of interactive ghci command: print prelude> it's not can't, there's not reason to. but if you'd like, can: prelude> :{ prelude| instance show (a -> b) prelude| show _ = "a function." prelude| :} prelude> print (\x -> x + 7) function. prelude> print (\a b c -> + b + c) function. if you'd show textual representation of function, - can't that. unlike metaprogramming languages ruby, js, etc, haskell code little knowledge of own internals.

c# - allow a user to choose a location to save file on the server -

so when user uploads file, need allow him/her able choose location on remote file-server. there file choosers allow user browse file-server? through asp.net mvc-3 website if makes difference. (the file server remote hard drive). i need hint in right direction. should looking for/at? thanks i don't think find out of box that. basically, need create treeview file browser menu (for mvc client-side jquery control preferable, jquery-file-tree ) functionality represents folder structure user can save. then, upon choosing right folder information pushed along uploaded file, , mvc controller can handles logic save in appropriate folder. note, need read/write access on server application pool account preserve file.

c# - Custom Model Binder does not fire -

i have registered custom model binder mylist in global.asax. model binder not fire nested properties, simple types works fine. in example below, fires index() not not fire index2() global.asax protected void application_start() { arearegistration.registerallareas(); modelbinders.binders.add(typeof(mylist), new mylistbinder()); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); } code: public class mylistbinder : imodelbinder { public object bindmodel(controllercontext controllercontext, modelbindingcontext bindingcontext) { return new mylist(); } } public class mylist { public list<int> items { get; set; } } public class mylistwrapper { public mylist listitems { get; set; } } public class testcontroller : controller { public actionresult index(mylist list) // modelbinder fires :-) {

c# - CPU Sampling in VS2010 via Attach To Process? -

Image
is possible perform cpu sampling in vs2010 via attach process option? when use option seems default memory profiling. can't launch cpu sampling wizard because ridiculous security software on our work pcs don't allow dll injection uses. if select analyze\profiler\new performance session , performance explorer open new performance session. in properties of item, can specify type of profiling want use: you can attach session process via "attach/detach" in session's context menu:

php code is not changing the header -

this question has answer here: how fix “headers sent” error in php 11 answers it giving me , not changing header: warning: cannot modify header information - headers sent (output started @ /home/content/27/10711827/html/contact.php:2) in /home/content/27/10711827/html/contact.php on line 24 here code. <?php if (empty($_post) === false){ $errors = array(); $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; if (empty($name) === true || empty($email) === true || empty($message) === true){ $error[] = 'name, email , message required!'; } else{ if (filter_var($email, filter_validate_email) === false){ $errors[] = 'that\'s not valid email address'; } if (ctype_alpha($name) === false){ $errors[] = 'name must cotain letters'; }

C# Workflow code activity result -

Image
hello new worklows. attempting build proof of concept workflow process files in specified directory. have added foreach loop , codeactivity (validatexml), code activity validates xml , returns bool, inherits codeactivity class. now take @ picture, use result of codeactivity in writeline activity. please me in how that. thank you! it's quite easy wanto do. see in screenshot below:

shell - Bash Script: How to use variables from list -

i trying write script report last time file updated in folder. folders created everyday example: /home/user/todaysdate. inside todaysdate folder exsist created when somethng created. example have fol1 fol2 fol3. trying script login each folder , display time of last file created. #!/bin/bash folder=`date +%y%m%d` ssh -q server "cd /home/user/$folder/ ; bash -c "ls -la | uniq" > list.txt this create list of different folders made. need ssh each folder stuck. output of list.txt be: fol1 fol2 fol3 ssh -q server "bash -c \"ls -ltr /home/user/$folder/<need list variable here> | tail -1\"" awk '{print $8} the above command gives me time. believe need while loop ssh server , variables created in list.txt can't working on. help? if list.txt space separated (eg "fol1 fol2 fol3") try bash for/in loop: for folder in $(cat list.txt); echo $folder; done if list.txt newline separated try bash while loop:

Creating a variable in PHP -

hi trying create string, stored variable, value determined values in url. but, unsure how go it. keep getting error "unexpected t_if". doing wrong? thanks php: $where= if (isset($_get['name'])) { echo "name=" . $name; } if (isset($_get['number'])) { echo " , number=" . $number; } if (isset($_get['address'])) { echo " , address=" . $address; } if (isset($_get['city'])) { echo " , city=" . $city; } if (isset($_get['state'])) { echo " , state=" . $state; } if (isset($_get['zip'])) { echo " , zip=" . $zip; } if (isset($_get['color'])) { echo " , color=" . $color;

c# - windows form will run in background automatically -

i develop windows form this source folder: destination folder: start button i set timer after every 2 minutes program run. , move shortcut of application in start folder. want after first time press start button program form close run in background , every time log on pc .exe run in background automatically. mean want after 1st time press start button form never come ui, run in background. please me how able that. if don't understand query please let me know. you need work upon communication. question phrased badly. there 2 option, either process or command line in windows start processstartinfo psi = new processstartinfo(realcmd.tostring(),realargs.tostring()); if (domainname != null) psi.domain = domainname; psi.username = realusername; psi.password = securepassword; psi.createnowindow = true; psi.useshellexecute = false; i

javascript regex to indicate unwanted digit at the start of string -

i have javascript regex pattern string ten digits. reg =/^\d{10,10}$/; but not sure how modify match string not start number 1 thanks you want this: ^[02-9]\d{9}$ and can visualize on debuggex .

sql server - Why the procedure is not going into the catch block -

i have stored procedure selecting entry entity table doesn't exists in our database. in code below if execute stored procedure, it's not going catch block while every error in try block should go catch block automatically. i not able understand reason create procedure addupdateentity (@name varchar(20), @age smallint) begin try select name, age entity name = @name , age = @age end try begin catch select error_number() statuscode, error_message() [message] end catch go /* command execute sp */ exec addupdateentity 'sandeep',20 this execute statement showing error "invalid entity object" not calling catch block. the stored procedure has crashed , showing message msg 208, level 16, state 1, procedure addupdateentity, line 10 nom d'objet 'entity' non valide. as per msdn (follow link http://msdn.microsoft.com/en-us/library/ms175976.aspx ) errors unaffected try…catch construct try…catc

PostgreSQL group by bug on Unicode strings? -

i have weird thing happening, noticed group (word) wasn't grouping word if word utf-8 string. in same query, cases it's been grouped correctly, , cases hasn't. wonder if knows what's that? select *,count(*) on (partition md5(word)) k ( select word,count(*) n :tmpwl group 1 ) order 1,2 limit 12; /* gives: word | n | k ------+---+--- いい | 1 | 1 くず | 1 | 1 ごみ | 1 | 1 さま | 1 | 1 さん | 1 | 1 へま | 1 | 1 まめ | 1 | 1 よく | 1 | 1 ろく | 1 | 1 ネガ | 1 | 2 -- heck? ネガ | 1 | 2 パス | 1 | 1 */ note following workaround works fine: select word,n,count(*) on (partition md5(word)) k ( select md5(word),max(word) word,count(*) n :tmpwl group 1 ) order 1,2 limit 12; /* gives: word | n | k ------+---+--- いい | 1 | 1 くず | 1 | 1 ごみ | 1 | 1 さま | 1 | 1 さん | 1 | 1 へま | 1 | 1 まめ | 1 | 1 よく | 1 | 1 ろく | 1 | 1 ネガ | 2 | 1 パス | 1 | 1 プア | 1 | 1 */ the version postgresql 8.2.14 (greenplum database 4.0.4.0 build 3 single-node edition) on x86_64-unknown-l

c - Reading from a file opened using append mode -

it might dumb question modifying else's code , seems need read file opened in append mode. tried fseek beginning of file nothing being read. know can change mode rw wanted know why fseek not working. in man page write ignores fseek nothing read though. there 1 pointer @ start of file when write operation attempted moved end of file. can reposition using fseek or rewind anywhere in file reading, writing operations move end of file. when open in append mode, file pointer returned end of file before every write. can reposition pointer fseek reading, call function writes file, pointer goes end of file. the answer @ does fseek() move file pointer beginning of file if opened in "a+b" mode? references appropriate section of c standard. use "w+" mode if write arbitrary places in file. existing file overwritten. if append existing file initially, fseek arbitrary place, use "r+" followed fseek(f, 0, seek_end) hope helps..

angularjs - Two way binding, $watch, isolate scope not working together -

please refer fiddle questions. http://jsfiddle.net/aqr55/ 1) why watch attached isolate scope property - bidirectionally bound parent property, not triggering on changing parent scope property. in fiddle, below metioned watch not getting triggered, on changing parent scope property bound. $scope.$watch('acts', function(neww ,old){ console.log(neww) }) 2) ng-click="addaction()" addaction="addaction()" . can code put in more elegant way? because, perform action in isolated scope, seems need set bidirectional binding , attach ng-click. 3)can declare methods inside isolated scope shown below? if this, i'm getting .js error. <isolate-scope-creating-cmp ng-click="isolatecmpclickhandler()"></isolate-scope-creating-cmp> scope:{ isolatecmpclickhandler:function(){ //if this, i'm getting .js error } } question 1. since adding item acts array, need set third param

mysql query inner join result set issues -

create table if not exists `maf_game_questions` ( `id` int(11) not null auto_increment, `gid` int(11) not null, `qid` int(11) not null, `qtext` text not null, primary key (`id`) ) engine=innodb ; insert `maf_game_questions` (`id`, `gid`, `qid`, `qtext`) values (1, 1, 6, 'click on state has part of rocky mountain range reveal fact agriculture.'), (2, 1, 1, 'click on state borders country see fact agriculture.'), (3, 1, 15, 'find state part of border created river show fact agriculture.'), (4, 1, 14, 'choose state has part of missouri river see fact agriculture.'), (5, 1, 5, 'click on state borders mississippi river see fact agriculture.'), (6, 1, 16, 'click on state panhandle see fact agriculture.'), (7, 1, 8, 'find state part of great plains check out fact agriculture.'), (8, 1, 3, 'select state has bay show fact agriculture.'), (9, 1, 13, 'select state has part of ohio river view fact agriculture.'

Getting sprockets-rails to compile assets in vendor and lib automatically like it used to in rails 3 -

sprockets-rails, has been moved out of rails , own gem, no longer auto complies assets gems in gems respective vendor , lib folders. meaning have add every file gems vendor , lib folders either application.js, application.css, or images/fonts add them each config.assets.precompile. https://github.com/rails/rails/pull/7968 how restore default behavior , have act did in rails three? this works me in application.rb config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)

html - How to put these two accordion inline in bootstrap? -

i walking through example bootstrap: <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseone"> collapsible group item #1 </a> </div> <div id="collapseone" class="accordion-body collapse in"> <div class="accordion-inner"> anim pariatur cliche... </div> </div> </div> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapsetwo"> collapsible group item #2 </a> </div> <div id="collapsetwo

iphone - iOS: optional code fragments for debug builds -

for app i'd have debug view want have in debug-builds , not in release builds. don't want change code though. thats why wondering if can check compiler flag if release build , exclude code want have debug builds. in projects build settings, preprocessor defines section, in there can define variable in debug build only, such debug=1 , , use in code: #if debug nslog(@"this print in debug!"); #endif just make sure in release configuration, same define set 0 in same location in build settings

.net - How can I run some function every night using quartz.net scheduler in C# -

i developing functionality using c# of quartz.net. task read data database , log data text file or send mail. have written code required insert text file struggling run function every night automated. scheduler having features or properties given bellow should wcf service. hosted on multiple server on multiple location. execute once though scheduler service running on multiple server particular time. history can maintained through kind of database. can execute kind of job .exe file, image file, particular task, kind of command, sql queries, etc. i'm trying work out if possible use quartz scheduler across multiple servers, pointing @ same database. also main motivation fail-over mechanism, spread load. can please me code how call function @ specific time using quartz.net. below structure of file read function. task call function c# code @ particular time of day. public void getgreeting() { const string path = @"e:\hello.txt"; textwriter tsw = !f

knockout.js - KnockoutJS dynamic templates -

please excuse if particular question has been asked. searched through blogs, thread in search of not find particular needs. i'm trying build single-page application knockout js , i'm relatively new can't seem wrap head around problem. i have 2 templates: <script id="template1" type="text/template"> <h3>template 1</h3> <button id="templbutton" text="go template 2" /> </script> and <script id="template2" type="text/template"> <h3>template 2</h3> </script> i have 2 div's bind these templates: <div data-bind="template: { name: template1 }"></div> <div data-bind="template: { name: template2 }"></div> in template 1, have button that, when clicked, should populate template 2 , clear out template 1. there seems no way this, without 3rd party addition? update 1 on page load, use jquery value

android - how to open a local file in android -

i trying open local kml file in sdcard getting error.in stackoverflow have seen questions related not answered , not related this. android - how open kml file in android android - how open google maps intent , kml? my code public void openkmlfile(view v) final intent myintent = new intent(android.content.intent.action_view, uri.parse("geo:0,0?q=file://" + environment.getexternalstoragedirectory() + "/test.kml")); startactivity(myintent); } android manifest file have given permission <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.demo" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="16" /> <uses-permission android:name="android.permission.inte

Remove link 'add your review' from upsell product grid in magento product view page -

i displaying upsell product in product view page in grid format. problem using code <?php echo $this->getreviewssummaryhtml($_link, 'short') ?> it displays me 2 links under product image. first number of reviews in 'x' review(s) format , second link 'add review' . i want remove 'add review' link, how that? i've added 'short' getreviewssummaryhtml($_link,) ?> in upsell.phtml file , shows 'x' reviews(s) without 'add review' link, how wanted work. magento 1.8.0.0

c# - Retrieve medium blob from MySQL return only 13 bytes -

Image
i searched lot , tried various methods couldn't able solve problem. need save image mysql file. i used below code save image database. try { string location = @"c:\users\test\downloads\photos\batman-greenscreen.jpg"; filestream fs = new filestream(location, filemode.open, fileaccess.read); uint32 filelength = (uint32)fs.length; byte[] buffer = new byte[filelength]; fs.read(buffer, 0, (int)filelength); string sqlphotoquery = "insert tab_photo values('" + photo.photoid + "','" + photo.projectid + "','" + photo.day + "','" + photo.barcode + "','" + photo.photoname + "','" + photo.photoxml + "','" + buffer + "','" + filelength + "')"; int result = mysqlhelper.executenonquery(connectionstring, sqlphotoquery); if (result > 0) return true; else return false; } cat

c++ - OpenCV can`t find image -

i trying basic tutorial found here http://bsd-noobz.com/opencv-guide/40-1-load-and-display-an-image handles loading , displaying image. doing in visual studio 2012. i have placed image file "lena.png" in debug folder beside exe file. when try execute exe file terminal replies "cannot load image!". have tried in release folder same result. this code have program: #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { if(argc > 1){ cout << argv[1] << endl; } mat img = imread("lena.png", cv_load_image_color); if (img.empty()) { cout << "cannot load image!" << endl; return -1; } namedwindow("image", cv_window_autosize); imshow("image", img); waitkey(0); return 0; } i not understand why hapens, picture in same directory .exe , followi

windows phone 7 - Add option missing in FILE menu in vs2012 express for wp7 while adding a scheduled task -

Image
while trying implement background agents windows phone per msdn document, procedure mentioned is: to create app uses scheduled tasks in visual studio, create new windows phone app project. template in windows phone category. next, add scheduled task project solution. file menu, select add->new project…. in add new project dialog, select windows phone scheduled task agent. leave default name, scheduledtaskagent1, , click ok. but failed find add option in file menu. :( please guide me in regard. in advance try right click on solution in solution explorer , add->new project

Parse XML String to Sax parser android -

i have string containing xml file data such as <?xml version="1.0" encoding="utf-8"?> <data> <type> <lory>vroom</lory> <car>crack</car> </type> <type> <lory>doom</lory> <car>chack</car> </type> </data> this kept in string named label; i use sax parser retrieve data follows saxhelper sh = null; try { sh = new saxhelper(newxml); } catch (malformedurlexception e) { e.printstacktrace(); } sh.parsecontent(""); part of saxhelper class class saxhelper { public hashmap<string, string> userlist = new hashmap<string, string>(); private string data; public saxhelper(string url1) throws malformedurlexception { this.data = new string(url1); } public rsshandler parsecontent(string parsecontent) { rssh

Android Maps v2 API...How to calculate distance between two locations (Lat, long) -

in "native" android app i'm trying calculate distance in feet and/or meters (as crow flies) between 2 locations on map. ideally there method take 2 latlng values (as have readily available) input , return distance in meters and/or yards. noted above i'm using android maps v2 api. i've looked @ many postings (20-30) regarding calculating distances , haven't found have helped me resolve issue. again native android application , i'm using maps v2 api. not sure if best approach i'm trying use location method: distancebetween(double startlatitude, double startlongitude, double endlatitude, double endlongitude, float[] results) but unfortunately app crashes every time because null value results. have verified via debugger latitude , longitude dummy values i'm passing in valid , value of results null (hence problem). here logcat: 04-04 23:48:04.770: d/onmapclick(17970): lat/lng: (32.90843038503306,-117.22537234425546) 04-04 23:48:08.710: d

Analytics receives events, but does not log them in reporting -

Image
i've been on google , looking answers here. i've checked code against google's tracking code suggestions , i've tested sample code . cannot events tracked in google analytics. code has been live on site time (~ month), should have overcome lag on reports there. i'm using analytics, async version, works fine page tracking , other 'normal' features. trying set event tracking, followed example, , waited week. still nothing. i've been debugging , i'm not having of 'normal' problems (as far can see). so: example tracking code fired: <a href="#" onclick="_gaq.push(['_trackevent', 'videos', 'play', 'baby\'s first birthday']);">play</a> this triggers event, according ga_debug.js, fired successfully. checking network panel can see request , _umt.gif returns status 200. i've checked request string in there. seems good. but checking ga, there nothing in reports. b

Architecture of a Java EE project -

i have java ee project ear , 4 wars. have pojos used in wars. classes contain static variables , methods , should same across wars. should placed? some background: had inherited project used pojos in 1 of wars. wanted 4 of wars refer same instance of new staticly accessed classes. not possible them held in 1 of wars, each war appeared take it's own runtime instance of static classes, , changing class in 1 war, did not result in change class in war. so combat installed in jar , deployed server. every time project deployed jar must built , installed on server if has changed. the person deploys here doesn't architecture , wondered if there way it? yes, war files each loaded under own classloader, not see each other's classes. you can place jar file in root of ear , refer in manifest of each each war.these jars called "utility jars". i agree self-contained deployment of kind preferable having separate jar file somewhere else.

c# - jQuery cannot deserialize json object properly -

i cannot succeed deserialize json object passed c# code behind. have been working on 3 hours , couldn't understand reason. here json object creation struct specialitiy_struct { public int id; public string name; }; [webmethod] public static string get_specialities(string professionalid) { database db = databasefactory.createdatabase("connection"); dbcommand dbcommand; dbcommand = db.getstoredproccommand("select_profes_speciality"); db.addinparameter(dbcommand, "prof_id", dbtype.int16, convert.toint16(professionalid)); idatareader dr = db.executereader(dbcommand); list<specialitiy_struct> my_list = new list<specialitiy_struct>(); specialitiy_struct my_speciality; while (dr.read()) { my_speciality = new specialitiy_struct(); my_speciality.id = convert.toint16(dr["specialtyid"].tostring().trim()); my_speciality.name = dr["specialtyname"].tostring().t

eclipse how to show package explorer in debug perspective -

the package explorer in eclipse shows on java tab (perspective) show in debug mode also. there way that? can't find in windows->show view in debug mode there in java mode (actually, that's project explorer looks same thing) you can open selecting window / show view / other... / java / package explorer.

javascript - Jquery Drag & Drop: Change element from li to div and back -

i trying following: stage 1: change draggable element li div on drop in #canvas move draggable element inside #canvas stage 2: change draggable element div li on drop in #imagelist move draggable element inside #imagelist js: $(function () { var $imagelist = $("#imagelist"); var $canvas = $("#canvas"); $('li', $imagelist).draggable(); $canvas.droppable({ drop: function (event, ui) {} }); $imagelist.droppable({ drop: function (event, ui) {} }); }); html: <div id="listwrapper"> <ul id="imagelist"> <li class="draggable>content should not lost on drag/drop</li> <li class=" draggable>content should not lost on drag/drop</li> </ul> </div> <div id="canvas"> <div class="draggable">content should not lost on drag/drop</div> </div> could me this?

xcode - MonoTouch + Jenkins - how to use my keychain accounts to build for iOS devices -

i have installed jenkins ci. uses it's own user jenkins build operations. i'd set build steps. when jenkins tried build project ios devices, error appeared: error: no valid iphone code signing keys found in keychain. seems jenkins user account doesn't have keys , certificates in keychain, basic user account have. how grant jenkins user access keychain entities? note: seems xcode native projects code signing problem solved via xcode plugin . you can copy user's certificates system certificate. jenkins user able see certificates. see answer https://stackoverflow.com/a/9477067/1131820

asp.net - Multiple Page_Load methods, which is called? -

in existing asp.net application, have base class containing page_load method: public class pagebaseclass : system.web.ui.page { protected virtual void page_load(object sender, eventargs e) { // stuff... } } i have actual page inherits base class. however, doesn't override existing page_load method, declares new 1 this: public class actualpage : pagebaseclass { protected void page_load(object sender, eventargs e) { // other stuff... } } the compiler gives me warning page_load method in actual page hiding existing page_load method. effectively, there 2 seperate page_load methods, since old 1 wasn't overridden, hidden. now question is, asp.net architecture in it's lifecycle in such situation? 1 being called? or both being called? note: know bad design, i'm not sure original author had in mind, i'm trying understand what's happening , how affect logic of system. after digging around, i've found out wh

c - Arduino Due HTTPS Support -

in previous versions of arduino, limiting 8-bit microcontroller board, seems implementing https (not merely http) impossible. newer version of arduino due provides 32-bit arm core - see spec here . i tried check several network libraries (libcurl, openssl, yassl), didn't find ported work arduino due. openssl heavy able run on processor, believe yassl embedded library should possible do. do have information of library can use trigger https requests on arduino due? unfortunately long comment. ► no out of box solution from have gathered, there no straightforward solution webserver running on atmel sam3x8e arm cortex-m3 cpu outputs https out of box. texas intstruments provides better options @ moment using boards equipped stellaris microcontroller arm cortex-m3 cpu . ► alternative there several options available render cryptographic functions, based upon 1 lay out , implement simple secure communication protocol communicates intermediary device, in turn

pass many arguments to a C function -

this question has answer here: in c function declaration, “…” last parameter do? 5 answers how can pass many arguments c function? assuming have function: void f(int n, char* a, char* b, ...) i want undefined number of char* arguments. how can so? what needs called variable number of argument functions, can read : 9.9. variable numbers of arguments , essay tutorial. a short theory in 4 points understand code: the <stdarg.h> header file must included, introduces new type, called va_list, , 3 functions operate on objects of type, called va_start, va_arg, , va_end . va_start: macro set arg_ptr beginning of list ap of optional arguments va_arg: use saved stack pointer, , extract correct amount of bytes type provided va_end: macro reset ap , after arguments have been retrieved, va_end resets pointer null. this theory not enough

android - How To set UP Activities in Manifest -

<application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".precus" android:label="@string/app_name" android:screenorientation="portrait" > <intent-filter> <action android:name="com.yair.guessit.precus" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="customize" android:label="@string/app_name" android:screenorientation="portrait" > </activity> <activity android:name="firstpage" android:label="@string/app_name" android:screenorientation="portrait" >