Posts

Showing posts from January, 2015

linux script to test connectivity IP -

linux script to test connectivity IP - any thought how create script in order test connectivity ip represents default gateway. , in case of connectivity, print message "default gateway up" , if it's not connected give message "default gateway down" #!/bin/bash ping -c 1 192.168.1.1 2>&1 > /dev/null if [ $? -ne 0 ] echo -e "host not respond ping" fi put script in crontab , allow run every min or whatever frequency want. linux

drupal 7 - Using theme_hook_suggestions in hook_preprocess_page stops html.tpl.php from being used -

drupal 7 - Using theme_hook_suggestions in hook_preprocess_page stops html.tpl.php from being used - i've added line hook_preprocess_page in template.php: if (isset($vars['node']) && $vars['node']->type=='landing_page') { $vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type; } this worked fine on test server have set on staging , has caused: a) page template output - not surrounded html.tpl.php. b) preprocess_html function in template.php not beingness called @ all. if comment out line html.tpl.php used again. this thread discussing similar opposite problem. i'm stumped on - points useful! this beingness caused calling undefined function in page template. this wasn't apparent until started searching error logs. hope may save else time... drupal-7

sql - find COUNT using LIKE from an inner query without JOIN -

sql - find COUNT using LIKE from an inner query without JOIN - so im trying generate listing of artists in table & lookup total matches within rows of different table name, not exact. cant bring together tables cause dont have col bring together on. when run inner query preset artist name returns right count. however, running inner query returns 0 count. just curious if knows how can using sql, or if can done. otherwise can figure out looping. here illustration of im doing: select ar.name, (select count(*) sound au au.artist like('%'+ar.name+'%')) count artist ar order ar.name asc; try: select ar.name, count(*) count artist ar, sound au au.artist like('%'+ar.name+'%')) grouping ar.name sql

wpf - Control click through transparency c# -

wpf - Control click through transparency c# - i making form transparent. however, able click "through" form. mean need able command whether clicks go through form or not. using windows 8, heard makes difference in case well. how can this? thanks! edit: refining question: making form transparent , maximized. when user clicks, form catches click moves previous location clicked, , clicks "through" form @ new location. i've got of working in c# , wpf, cannot simulate clicks "through" form. how this? c# wpf transparent

android - EditText Loses Focus on Click -

android - EditText Loses Focus on Click - i'm writing activity list bunch of items database , show additional column quantity. implemented arrayadapter show custom layout. here code of of import parts of adapter: static class viewholder { protected textview text; protected edittext edittext; } @override public view getview(int position, view convertview, viewgroup parent) { view view = null; if (convertview == null) { layoutinflater inflator = context.getlayoutinflater(); view = inflator.inflate(r.layout.rowquantitylayout, null); final viewholder viewholder = new viewholder(); viewholder.text = (textview) view.findviewbyid(r.id.label); viewholder.edittext = (edittext) view.findviewbyid(r.id.edittext); viewholder.edittext.addtextchangedlistener(new textwatcher() { public void aftertextchanged(editable s) { log.i(tag, "editable:" + s.tostring()); } ...

c# - In what scenarios do I need foreign keys AND navigation properties in entity framework -

c# - In what scenarios do I need foreign keys AND navigation properties in entity framework - my order class has: public int customerid { get; set; } public client customer { get; set; } do need both properties create relation working? i not using disconnected entities, using code first approach. according julia lerman's book: programming entity framework: dbcontext, difference lies @ difficulty of updating navigation property. in page 85, suggests "if there 1 thing can create life easier in n-tier scenarios, it’s expose foreign key properties relationships in model." book includes samples both scenarios. the reason including foreign key property tells entity framework utilize foreign key association, simpler using so-called independent association when need update relationship, i.e., changing order 1 client in example. foreign key association, need changing customerid. without customerid foreign key, need more steps. independent association us...

greendao and sqlite triggers -

greendao and sqlite triggers - i tried utilize code below ensure referential integrity in database, seems not working greendao. can still delete records. on other hand, when seek delete in sqlitemanager, trigger raised , delete operation fails. devopenhelper helper = new daomaster.devopenhelper(this, common.dbname, null) { @override public void oncreate(sqlitedatabase db) { super.oncreate(db); db.execsql("create trigger grupe_artikli before delete on groups "+ "for each row begin "+ "select case " + "when ((select id_group products id_group = old._id) not null) "+ "then raise(abort, 'error') "+ "end; end;"); daosession session = new daomaster(db).newsession(); } does greendao back upwards triggers, or there method maintain database referential integrity? greendao has no built-in trigger support. however, cannot think of reason why app...

javascript - How to make all future dates non-clickable -

javascript - How to make all future dates non-clickable - i want disable future dates in calendar after today. today's date highlighted in yellowish ( feb 23rd 2012 )in diagram below. other future dates should non clickable. how can ? for instance 24th,25th.... etc should not clickable note: $('.datepicker').blackoutdates.add(new calendardaterange(datetime.now.adddays(1), datetime.maxvalue)); doesn't work if using jquery ui datepicker calandar, utilize maxdate method : http://api.jqueryui.com/datepicker/#option-maxdate $( ".selector" ).datepicker({ maxdate: new date() }); new date() corresponds current date demo : http://jsfiddle.net/uqty2/21/ javascript jquery jquery-ui

ffmpeg - Android using JNI without static variables -

ffmpeg - Android using JNI without static variables - i created own version of android's mediametadataretriever using source code mediametadataretriever.java basis. version uses ffmpeg retrieve metadata. approach works relies on static variables in c code retain state in between jni calls. means can utilize 1 instance of class @ time or state can corrupted. 2 java functions defined follows: public class mediametadataretriever { static { system.loadlibrary("metadata_retriever_jni"); } public mediametadataretriever() { } public native void setdatasource(string path) throws illegalargumentexception; public native string extractmetadata(string key); } the corresponding c (jni) code code is: const char *tag = "java_com_example_metadataexample_mediametadataretriever"; static avformatcontext *pformatctx = null; jniexport void jnicall java_com_example_metadataexample_mediametadataretriever_setdatasource(jnienv *env, j...

java - Cannot find symbol when calculating whether weekend -

java - Cannot find symbol when calculating whether weekend - i trying check whether given day weekend or not, receiving error saying if (startdate.get(day_of_week) != calendar.saturday && (startdate.get(day_of_week) != calendar.sunday)) with pointer under sunday not sure issue here is, sure have imported relevant classes necessary, fact startdate in calendar format. know issue here is? import java.util.*; import java.text.*; import java.lang.*; //some code... if (startdate.get(day_of_week) != calendar.saturday && (startdate.get(day_of_week) != calendar.sunday)) if haven't imported constants in static way, have access them via class name like if (startdate.get(calendar.day_of_week) ... ^^^^^^^^^ everywhere utilize static fields. java calendar

c# - I need advice developing a sensitive data transfer/storage/encryption system -

c# - I need advice developing a sensitive data transfer/storage/encryption system - intro i'm working on project involves daily extraction of info (pharmacy records) visualfox pro database, , uploading of wordpress site, clients of pharmacy can securely view it. advice in terms of general methodology of software - able code it, need know if i'm going right way it. i'm writing both pc software (in c#/.net 4.5) , php wordpress plugin. question 1: encryption the current process encrypting info server-side plan utilize based on this article. summarised, advocates encrypting each separate user's info asymmetrically own public key, stored on server. private key decrypt info encrypted symmetrically using user's password, , stored. way, if database stolen, user's password hash needs broken, , process needs repeated every user's data. the weakness, pointed out author himself, , main point of question, fact while user logged in, decrypted key store...

MongoDb reads happening from a secondary in RECOVERY state -

MongoDb reads happening from a secondary in RECOVERY state - i have replica set in new secondary node added. node status in "recovering". when seek execute java driver client nearest readpreference, reads going secondary syncing , throwing exception. should driver intelligent plenty not create read requests secondaries in "recovering" state? or missing something. indeed driver should not sending requests node in recovering state. i've created jira ticket track bug: https://jira.mongodb.org/browse/java-753 mongodb

Creating Excel file in C# gives and error in Office 2003 -

Creating Excel file in C# gives and error in Office 2003 - i creating application creates excel file when button clicked without saving it, works fine in local machine while there microsoft office 2007. problem when set application on server has microsoft office 2003 gives me error microsoft.office.interop.excel, version=12.0.0.0 is because using microsoft.office.interop.excel api ? i've searched problem , found solutions didn't work expected downloading pia !! install office 2007 on server. since cannot redistribute microsoft dlls application, machines should in case have required dlls in gac. c# office-2007 office-2003

c++ - Basics of strtol? -

c++ - Basics of strtol? - i confused. have missing rather simple nil reading strtol() making sense. can spell out me in basic way, give illustration how might next work? string input = getuserinput; int numberinput = strtol(input,?,?); the first argument string. has passed in c string, if have std::string utilize .c_str() first. the sec argument optional, , specifies char * store pointer character after end of number. useful when converting string containing several integers, if don't need it, set argument null. the 3rd argument radix (base) convert. strtol can binary (base 2) base of operations 36. if want strtol pick base of operations automatically based on prefix, pass in 0. so, simplest usage be long l = strtol(input.c_str(), null, 0); if know getting decimal numbers: long l = strtol(input.c_str(), null, 10); strtol returns 0 if there no convertible characters @ start of string. if want check if strtol succeeded, utilize middle...

java - comparing 2 array list and loop through contents -

java - comparing 2 array list and loop through contents - i retrieving elements 2 array lists , looping , comparing them. there improve way loop though this?. little slow , doesn't seem efficient string name = employee.get(0).getempname(); for(int = 0; < employee.size(); i++) { if (name.equals(employee.get(i).getempname())) { (int j = 0; j < employer.size(); j++) { if (name.equals(employer.get(i).getempchoice()) && (employers.get(j).getcompchoice() == 1)) { if (!test.contains(name) || !test.contains(employers.get(j).getcompname())) { test += name + employers.get(j).getcompname() + "\n"; } } } } else { name = employees.get(i).g...

jquery - How to change the selected option of a select by using JavaScript? -

jquery - How to change the selected option of a select by using JavaScript? - i've got simple problem can't figure out how ... in html page, have simple select tag : <select id="selection-type"> <option disabled="disabled">type</option> <option value="0">tous les types</option> <option value="1">appartement</option> <option value="2">maison</option> <option value="3">terrain</option> </select> i want set specific value dynamically using javascript, managed alter selected index, , not displayed value. currently, i'm doing (in footer section of html page) : <script type="text/javascript"> $(document).ready(function(){ document.getelementbyid("selection-type").selectedindex = 2; }); </script> and in result, it's alter selected index of select, displayed text not...

html - Capturing the ESC key using Javascript only -

html - Capturing the ESC key using Javascript only - i have custom video play it's own controls. have script create changes controls when user enters , exists fullscreen. problem when exit fullscreen using esc key instead of button, style changes controls not reverted back. need ensure exiting fullscreen using esc or button result in same behaviour. css: function togglefullscreen() { elem = document.getelementbyid("video_container"); var db = document.getelementbyid("defaultbar"); var ctrl = document.getelementbyid("controls"); if (!document.fullscreenelement && // alternative standard method !document.mozfullscreenelement && !document.webkitfullscreenelement) { // current working methods if (document.documentelement.requestfullscreen) { ctrl.style.width = '50%'; ctrl.style.left = '25%'; full.firstchild.src = ('images/icons/unfull.png'); ...

Windows XP The specified locale is not supported on this operating system. [ LCID = 16393 ] -

Windows XP The specified locale is not supported on this operating system. [ LCID = 16393 ] - i utilize sql server compact edition 4.0 , have installed on scheme (windows 7). solution when run works fine line of code sqlceconnection.open() connection string "datasource='e://s.sdf';" there no lcid specified in connection string . and works fine . but if run same on windows xp scheme error "the specified locale not supported on operating system. [ lcid = 16393 ]" so tried changing lcid in connection string "datasource='e://s.sdf';lcid=1033" still not work. i tried sqlceconnectionstringbuilder.initiallcid property 1033 , 1030 still not work. kindly suggest missing windows xp/windows server error . i have installed x86 msi windows xp , windows 7 scheme 64bit installation done . thanks when create database on windows 7 scheme add together "lcid=1030;" connection string, property creation time property...

osx - Applescript to add grandparent folder+parent folder prefix to filename -

osx - Applescript to add grandparent folder+parent folder prefix to filename - i have multiple folders sub folders have files in them need labeled parent folder+grandparent folder name. i.e. folder 1>folder 2>file.jpg needs renamed folder_1_folder_2_file.jpg i able find script it, , have been trying reverse engineer it, not having luck. script below presents 2 challenges, 1) includes entire path root directory, , two, deletes name of file, hence allowing 1 file renamed before errors out. know problem script renaming entire file, don't know how proceed. tell application "finder" set every folder of (choose folder) repeat aa in set base_name makebase(aa string) set all_files (every file in aa) repeat ff in all_files set ff's name (base_name & "." & (ff's name extension)) end repeat end repeat end tell makebase(txt) set astid applescript's text item delimiters set applescript's text item...

regex - How to extract "StrB(StrC,StrD)(StrE)" from "StrA(StrB(StrC,StrD)(StrE)) StrF " in C#? -

regex - How to extract "StrB(StrC,StrD)(StrE)" from "StrA(StrB(StrC,StrD)(StrE)) StrF " in C#? - i tried utilize this: regex.match(input, @"\(([^)]*)\)") , give me "(strb(strc,strd)" not want. i want extract string between 2 parentheses, string within can have own set of parentheses nested within main 2 parentheses , string can infinitely nested parentheses like: "a(b(c(d(...))))" , thought how done? thanks. this want: var regex = new regex( @"(?<=\()(?:[^()]|(?<br>\()|(?<-br>\)))*(?(br)(?!))(?=\))"); var input = "stra(strb(strc,strd)(stre)) strf"; var matches = regex.matches(input); the regular look breaks downwards follows: (?<=\() preceeded ( (?: don't bother capturing grouping [^()]+ match 1 or more non-brackets | or (?<br>\() capture (, increment br count | or (?<-br>\)) capt...

Java, HTML and Android application using the same ServerSocket server -

Java, HTML and Android application using the same ServerSocket server - is possible web html site, android or ios , desktop client communicate using java sockets (the server using serversocket)? you should utilize implementation of websockets in server, instead of pure serversockets, : http://jwebsocket.org/ , web clients utilize http://socket.io/ mature implementation of websockets. like utilize same html create communicate server using websockets, pages , android runnning embeded in phonegap. hope helps. java android html

iphone - Convert a NSString into a NSArray -

iphone - Convert a NSString into a NSArray - i received info json web service , converted nsarray. i've saved nsarray in database retrieval @ later date. info in database looks this: ( { responsecount = 2; responsetotal = 8; }, { responsecount = 6; responsetotal = 8; } ) now i'm @ point want take info , turn nsarray. seek doing along lines of nsarray *responsearray = self.coredatatable.responsearray; //nsstring value or nsarray *responsearray = (nsarray *) self.coredatatable.responsearray; //nsstring value but when runs, nsarray comes no objects in it. ideas wrong? code clarify info saving process. coredatatable *coredatatable = [nsentitydescription insertnewobjectforentityforname:@"coredatatable" inmanagedobjectcontext:self.managedobjectcontext]; coredatatable.categoryname = [d objectforkey: @"categoryname"]; coredatatable.responsearray = [d objectforkey: @...

php - Database implementation of simple "like it" functionality -

php - Database implementation of simple "like it" functionality - i want implement functionality working "like it" in fb. i want users able simple click button under object like. positive vote. the thing want remember, objects have maintain in database. let's say, there's 1 type of object maintain simple. the simplest way create table implement many many relation (users objects). my questions are: is reasonable solution in terms of performance? table quite big , used often. ;) any improve way this? 1) yes, is. remember maintain indexes on both foreign keys (better yet, have both keys composite primary key) 2) not know of. php mysql sql

use jquery to enable textbox on button click -

use jquery to enable textbox on button click - how enable textbox on link button click, i'm disabling textbox in html here jquery code i'm trying use: <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#ledit').click(function () { $('#corporationname').removeattr('disabled'); }); }); </script> <asp:linkbutton id="ledit" runat="server" clientidmode="static" >edit</asp:linkbutton> <asp:label id="lblcorporationname" runat="server" text="corporation name" width="130px"></asp:label> <asp:textbox id="corporationname" runat="server" width="250px" clientidmode="static" enabled="false"></asp:textbox> it looks you're doing right. if isn't working, try: $('#corporationna...

javascript - having issue with scrollTo() method -

javascript - having issue with scrollTo() method - i want scroll image mouse in div, not able find right x , y coordinate value move image. below sample code .. able scroll image without div. can help if doing wrong here. <html> <head> <script type="text/javascript"> document.onmousedown = function(){ var e=arguments[0]||event; var x=getwindowsize()[2],y=getwindowsize()[3],mx=e.clientx,my=e.clienty; document.onmousemove=function(){ var e=arguments[0]||event; window.scrollto(x+(mx-e.clientx), y+(my-e.clienty)); homecoming false; } document.onmouseup=function(){ document.onmousemove=null; } homecoming false; } function getwindowsize(){ if (window.innerheight) homecoming [window.innerwidth-10,window.innerheight-10,window.pagexoffset,window.pageyoffset]; else if (document.documentelement.clientheight) homecoming [document.documentelement.clientwidth-10,document.documentelement.clientheight-10,document.documentelement.scrollleft,document.docu...

php - Wordpress, paged doesn't work -

php - Wordpress, paged doesn't work - i trying create archive of posts custom post type. this, want check on page user is. trying accomplish code (emptied area in while, because irrelevant) <?php global $wp_query; $temp_wp_query = $wp_query; $wp_query = null; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'video', 'posts_per_page' => 3, 'offset'=> (($paged -1) * 3) ); $loop = new wp_query( $args ); $wp_query = $loop; if ($loop->have_posts()) : while ( $loop->have_posts()) : $loop->the_post(); ?> <?php endwhile; ?> <p><?php posts_nav_link('&#8734;','&laquo;&laquo; view newer posts','view older posts &raquo;&raquo;'); ?></p> <?php...

report - Lookup function for reporting services (visual studios 2008) -

report - Lookup function for reporting services (visual studios 2008) - i building study requires 2 datasets , 2 info sources. trying combine 2 info sets mutual field. my 2 info sets are: dsses (tied sessql source) , dsqqst (tied qqst source) my dsses has employee id field , dsqqst has employee_id field well. want utilize these 2 fields compare 2 info sets. purpose of study find if employee has changed or name. want utilize lookup function compare 2 employee id fields , produce list of first name , lastly name in each info set produce answer. here of fields of 2 datasets: dsses: employeeid employmentstatuscode lastname firstname preferredname employeetype dsqqst: employee_id company_id employeeid firstname middlename lastname supervisor_id active_yn department_id hire_dt sup_dept_id term terminationdate make table 5 columns linked dsses dataset. show employeeid , firstname , lastname fields. in 4th column, set next formula: =lookup(fields!e...

actionscript 3 - Progress Bar, but NOT a Preloader or FLV Seekbar -

actionscript 3 - Progress Bar, but NOT a Preloader or FLV Seekbar - i'm trying create progress bar monitor timeline progression of loaded film clip. of tutorials out there based on preloaders. while concept similar, i'm struggling. users load various film clips clicking on left navigation menu. i'd progress bar show users in film clip's timeline. i'd progress bar start on when new film clip loaded. my progress bar 508 pixels wide. any ideas? it's simple really. multiply total width percentage film clip, this: var clip:movieclip; //set film clip has been loaded clip.addeventlistener( event.enter_frame, this.enterframehandler ); var progressbar:shape = new shape(); var totalwidth:number = 508; function enterframehandler( e:event ):void { this.progressbar.graphics.clear(); this.progressbar.graphics.beginfill( 0x000000 ); this.progressbar.graphics.drawrect( 0, 0, ( this.clip.currentframe / this.clip.totalframes ) * this.totalw...

php - Wordpress - loop image description -

php - Wordpress - loop image description - function the_post_thumbnail_caption() { global $post; $thumbnail_id = get_post_thumbnail_id($post->id); $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment')); if ($thumbnail_image && isset($thumbnail_image[0])) { echo '<p>'.$thumbnail_image[0]->post_content.'</p>'; } } i've seen code in net. displays first image description has been attached. i'm new in wordpress , still getting problems coding. how can set within loop display image description has been attached. thanks! try this <?php function the_post_thumbnail_caption() { global $post; $childs = get_children(array('post_parent' => $post->id)); if($childs) { foreach($childs $child) { echo '<p>'.$child->post_content.'</p>'; } } ...

How to retrieve related records in Ruby on Rails? -

How to retrieve related records in Ruby on Rails? - i trying find user 's overdue invoices : class user < activerecord::base def overdue_invoices invoices.where("overdue = ?", true) end end class invoice < activerecord::base def overdue balance > 0 && date.today > due_date end end the problem seems overdue method on invoice model, not database column. how can retrieve records anyway? , create sense or improve store true , false values in database? you should create equivalent class method or scope overdue on invoice : class invoice < activerecord::base def self.overdue where('balance > 0').where('? > due_date', date.today) end end then can phone call overdue on invoice relation: class user < activerecord::base def overdue_invoices invoices.overdue end end note i’m assuming due_date database column, if it’s not, cannot utilize method—however, may able...

terminal - How to talk to IMAP server in Shell via OpenSSL -

terminal - How to talk to IMAP server in Shell via OpenSSL - i want send imap commands via mac os x terminal server , response. can connect server using line: openssl s_client -connect imap.gmail.com:993 and can login: ? login m.client2 passwordhere but other commands not work, no response server. tried instance this: ? list "" "*" ? select inbox found error help of friend: openssl s_client -connect imap.gmail.com:993 -crlf -crlf critical terminal openssl imap

map - Draw a popup window in android mapView on a place -

map - Draw a popup window in android mapView on a place - i wanted create popup window on place in mapview . have seen codes on net, complex understand. wanted create popup window on single place. if have code or link this, please share me. thank you. if welling utilize maps v2 can find sample code within android-sdk directory > extras > google > google_play_service > samples > maps i believe find need in there android map popupwindow

javascript - how to change the iframe? -

javascript - how to change the iframe? - i have 2 iframes in page. both have same source. when alter 1st iframe, changes must reflected in 2nd one. looks remote browsing. how can accomplish in javascript? var iframes = document.getelementsbytagname('iframe'); var src = iframes[0].src; iframes[1].src = src; without knowing page or seeing code can't give more this... javascript html

java - Why doesn't `text.charAt(i+1) <= text.length()` work? -

java - Why doesn't `text.charAt(i+1) <= text.length()` work? - case 1: if (text1input.charat(i+1) <= text1input.length() && character.isuppercase(text1input.charat(i+1))) { += 60; b += 100; } else { += 55; b += 60; } break; does line of code create sense? doesn't work how want , can't figure out problem. code meant check next character in string. if character exists (meaning hasn't reached end of string already), , character uppercase, uses these coordinates. else, uses others. problem uses latter regardless of case. youre comparing character location, might not intended, might utilize i+1 instead of x.charat(i+1) java if-statement

Resolving Coldfusion J2EE sessions with ajax calls to cfc methods using verifyclient -

Resolving Coldfusion J2EE sessions with ajax calls to cfc methods using verifyclient - i utilizing cf session management , have been investigating transitioning utilizing j2ee session management. in attempts so, ajax requests made ( when cfsession management set utilize j2ee sessions ) cf chlorofluorocarbon remote methods fail verifyclient authorization. code below works when session management uses cf session management. my assumption _cf_clientid no longer right value pass remote method - generated using cfid , cftoken. how implement j2ee session management , utilize remote chlorofluorocarbon methods verifyclient? or can not done? using cf tag cfajaxproxy not option. the illustration code below demonstrates how utilize jquery ajax phone call remote chlorofluorocarbon method verifyclient='true', though cf documentation indicates utilize of cfajaxproxy required. not case. (thanks ray camden , dwmommy. ) leads me believe there may work-around implement simila...

drupal 7 - adding two webform to web site -

drupal 7 - adding two webform to web site - i have used webform drupal 7 website.and want set webform page(two webforms in different web pages).how can configure webform it? have used, webform node, or block? if u have used, webform block, u goto admin/block , configure. from page, can configure, u want page dispaly web form drupal-7 drupal-webform

android - Intent to take picture, if i press back, the application crashes -

android - Intent to take picture, if i press back, the application crashes - i phone call function: private void takephoto() { logservice.log(tag, "intakepicture"); intent intent = new intent(mediastore.action_image_capture); file = new file(environment.getexternalstoragedirectory().getabsolutepath() + "/blueskybio/media/", "test.jpg"); outputfileuri = uri.fromfile(file); intent.putextra(mediastore.extra_output, outputfileuri); startactivityforresult(intent, take_picture); } which takes me on next onactivityresult: public void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == take_picture) { if(outputfileuri != null){ logservice.log("mainfragment", outputfileuri.tostring()); string path = outputfileuri.tostring(); selectedvideopath = path.substring(7); logservice.log("in take pic", "selectedimage...

My number format in C# is not giving me a padded number -

My number format in C# is not giving me a padded number - i using following: public static selectlist getoptions<t>(string value = null) t : struct { var values = enumutilities.getspacedoptions<t>(); var options = new selectlist(values, "value", "text", value); homecoming options; } public static ienumerable<selectlistitem> getspacedoptions<t>(bool zeropad = false) t : struct { var t = typeof(t); if (!t.isenum) { throw new argumentexception("not enum type"); } var numberformat = zeropad ? "d2" : "g"; var options = enum.getvalues(t).cast<t>() .select(x => new selectlistitem { value = ((int) enum.toobject(t, x)).tostring(numberformat), text = regex.replace(x.tostring(), "([a-z])", " $1").trim() }); ...

python - Why does easy install want access to my rootfs for a "develop" install? -

python - Why does easy install want access to my rootfs for a "develop" install? - i'm looking @ python application server , wanted play around code. i'm lead believe passing "develop" setup.py should leave in place without installing anything. when running attempting creating directories in rootfs. ./setup.py develop gives: running develop checking .pth file back upwards in /usr/local/lib/python2.7/dist-packages/ error: can't create or remove files in install directory i thought might bundle checking certainly attempting write stuff rootfs wrong? the develop command wants add together .pth entry project can imported egg. see development mode documentation, develop command docs. the default set entry in site-packages. set different library path --install-dir switch. python easy-install

android - CSS Media Query for Samsung Galaxy Tab 2 10.1 (Chrome Browser) -

android - CSS Media Query for Samsung Galaxy Tab 2 10.1 (Chrome Browser) - there related question in: media query ipad (landscape) applied samsung galaxy tab 2 (landscape) well my question media query chrome browser on android samsung galaxy tab 2 10.1 (chrome browser 18) detected portrait mode. i'm using: @media , (min-width: 479) , (max-width: 1199) , (max-device-width:1199px , (orientation: portrait) but doesn't work. work on android web browser not work 1 time flip landscape mode , portrait mode. work when load page in portrait mode. i had same problem found actual resolution of galaxy tab 2 10.1 2560px x 1600px using px values able pull right style sheet. android css google-chrome responsive-design media-queries

java - Android : How to Store the Value for a Variable in Strings.xml through coding -

java - Android : How to Store the Value for a Variable in Strings.xml through coding - requirement : need store values of user id , password string values in string.xml, indeed taken user. problem : far have seen solutions utilize shared preferences. though utilize shared preferences , values don't stored in string.xml here, strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">sp</string> <string name="hello_world">hello world!</string> <string name="menu_settings">settings</string> <string name="id" ></string> <!-- fill in value java code, how ? --> <string name="pwd"></string> <!-- fill in value java code, how ? --> </resources> layout page : activity_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=...

debugging - jquery document ready issue -

debugging - jquery document ready issue - i wanted know difference between both. (function($){ //some console.log code }); $(document).ready(function() { //some console.log code }); you guys might phone call me stupid don't know why happening. well here problem. when utilize (function($){ can't see result in console.log it's showing console debug result when utilize document.ready . i using jquery v1.8.2 . thanks. you missed @ closing in first example: (function($){ //some console.log code })(jquery); // <----------add (jquery) here , test or this: jquery(function($){ // <---------add jquery first here //some console.log code }); jquery debugging document-ready

git - Delete live site and pull in new code from repo -

git - Delete live site and pull in new code from repo - i have local development environment , live server. on same server in home directory have git repository. date i've been moving files over, 1 @ time, via ftp. yuck . when ssh server , issue pull request bunch of merge conflicts. since know committed , pushed repo , of want, there way wipe out what's on production server , pull in repo? i don't care old commit history, etc - i'm hoping way limited, or no downtime. thanks! git fetch --all git reset --hard origin/master but careful overwrite local files in production server. git

python - Sum of numbers in array, not counting 13 and number directly after it (CodingBat puzzle) -

python - Sum of numbers in array, not counting 13 and number directly after it (CodingBat puzzle) - the question: return sum of numbers in array, returning 0 empty array. except number 13 unlucky, not count , numbers come after 13 not count. my code: def sum13(nums): l = len(nums) tot = 0 if l==0: homecoming 0 x in range(l): if nums[x]!=13: if nums[x-1]!=13: tot+=nums[x] homecoming tot where it's failing: sum13([1, 2, 2, 1, 13]) should → 6, code outputting 5 sum13([1, 2, 13, 2, 1, 13]) should → 4, code outputting 3 your problem when x zero. x - 1 -1 lastly element of list ( 13 ). prepare it, don't test x - 1 if x zero: if x == 0 or nums[x-1] != 13: in python, when pass negative index list accesses elements backwards, so: >>> x = [1,2,3,4,5] >>> x[-1] 5 >>> x[-2] 4 python list

documentation - How can I find out what's causing differences in generated Sandcastle docs? -

documentation - How can I find out what's causing differences in generated Sandcastle docs? - in noda time, generate our documentation using sandcastle , shfb. commit documentation source repository - because makes easy view latest (and historical) docs. i'm primary developer project, utilize 2 computers - , unfortunately, @ moment they're building different documentation though they're both updated same source. the 2 computers same in every of import way can think of: sandcastle 2.7.2.0 shfb 1.9.6.0 vs 2012 professional (both reported version 11.0.50727.1 in "programs", both "version 11.0.51106.01 update 1" in "about" page) latest version of local help content .net framework 4.5 (and no local help content other framework versions) steps taken ensure clean build: deleted shfb cache folder ( c:\users\jon\appdata\local\ewsoftware\sandcastle help file builder\cache ) deleted folder documentation generated into deleted user s...

ruby on rails - Problems with has_secure_password -

ruby on rails - Problems with has_secure_password - i'm trying create user model uses has_secure_password , i've followed examples rails documentation , still fails. this model: class user < activerecord::base attr_accessible :username, :email, :full_name, :password_digest has_secure_password end and i'm trying create user so: @user = user.new({ username: params[:user][:username], password: params[:user][:password], password_confirmation: params[:user][:password_confirmation], email: params[:user][:email], full_name: params[:user][:full_name] }) # tried `@user.new(params[:user])` however i'm getting error: can't mass-assign protected attributes: password, password_confirmation i've tried searching solutions on here , google, taken @ "sample apps" , appear doing same are, except i'm still getting error. is there i'm doing wrong or missing? try adding :password, :password_confirmation attr_acce...

c++ - Qt Connect Signals to Slots -

c++ - Qt Connect Signals to Slots - i trying connect signal. maintain on encountering this. sure have linked *.h file contains qaction *actioncamerasetup. missing out? please help. thanks. error: 1>camera.cpp 1>.\camera.cpp(10) : error c2065: 'actioncamera_setup' : undeclared identifier camera.cpp #include "camera.h" #include "camera_setup.h" #include "ui_camera.h" camera::camera(qwidget *parent, qt::wflags flags) : qmainwindow(parent, flags) { ui.setupui(this); connect(actioncamera_setup, signal(activated()), this, slot(opencamerasetup())); } camera::~camera() { } void camera::opencamerasetup() { newcamerasetup = new camera_setup(); newcamerasetup->show(); } camera.h #ifndef camera_h #define camera_h #include <qtgui/qmainwindow> #include "ui_camera.h" #include "ui_camera_setup.h" class camera_setup; class photographic camera : public qmainwindow { q_ob...

cocoa touch - iOS CGAffineTransform odd behavior -

cocoa touch - iOS CGAffineTransform odd behavior - i trying animate view 1 position another, using code below, animation not smooth. there "pop" in animation. moves before moving downwards example. can allow me know if there wrong setup? [uiview animatewithduration:0.2 animations:^{ [_label settransform:cgaffinetransformmake(1, 0, 0, 1, 0, 88)]; transformstate = 1; }]; thanks reading! if have min please download simple test project, can see issue, , if do, much taking time. http://owolf.net/uploads/stackoverflow/transformtest.zip your view controller has autolayout turned on in storyboard, , autolayout can interact transform in unexpected ways. either turn autolayout off, or consider using autolayout constraints animation. cocoa-touch uiview cgaffinetransform

c# - Novice enquiry on using TryParse() properly -

c# - Novice enquiry on using TryParse() properly - i've tried tryparse , , new c# , trying understand everything, , best practices... syntactically works: double number = double.parse(c.readline()); does tryparse homecoming boolean, true if parse succeeds? when this: double number; bool b = double.tryparse(c.readline(), out number); number parsed input, c.readline() , expected, works. how tryparse used? trying efficient, appreciate advice this. any advice on approach welcome, plus info on online resources try(things). you utilize tryparse when may fail, , don't want code throw exception. for example if (!double.tryparse(someinput, out number)) { console.writeline("please input valid number"); } c#

workflow - Is there a way to pan in sublime text 2? -

workflow - Is there a way to pan in sublime text 2? - does know of sublime text plugin allows pan code similar photoshop file canvas? space+drag or middle mouse+drag? i can imagine becoming useful if don't have text wrapping on in tall document. if plugin doesn't exist might possible start work on one. thanks! no way yet, added feature request on website, can upvote. http://sublimetext.userecho.com/topic/159170-drag-scroll-or-pan-or-touch-scroll/ i looked plugin api, , seems not provide way implement plugin. workflow keyboard-shortcuts sublimetext2

osx - Homebrew’s `git` not using completion -

osx - Homebrew’s `git` not using completion - when using osx’s git, after modify file can git commit <tab> , , that’ll auto finish file’s name 1 modified. however, if install newer version of git homebrew , utilize it, feature no longer works (meaning press <tab> , “asks” me file want on, including ones have no changes). can shed lite why, , how solve that? i’d prefer using homebrew’s git, since it’s more up-to-date. my shell zsh, , neither installing bash-completion or zsh-completions worked (even after next homebrew’s post-install instructions). also, after installing git homebrew says bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completion has been installed to: /usr/local/share/zsh/site-functions so shouldn’t able utilize 1 of those? you're looking for: brew install git bash-completion as warpc's comment states, you'll need add together next ~/.bash_profile homebrew's bash-completion...

authentication - django's logout(request) also logout django admin and vise versa? -

authentication - django's logout(request) also logout django admin and vise versa? - i'm using django's auth module login , logout users in website. when login user website , go django admin page, automatically logs in user. natural? from django.contrib.auth import authenticate, login, logout def login_request(request): user = authenticate(username=username, password=password) login(request, user) def logout_request(request): logout(request) edit: think same question. logged-in-the app user logged-out when superuser logs in django admin please confirm answer thanks yes, because utilize same authentication backend. django authentication

validation - Comparing time ranges in javascript -

validation - Comparing time ranges in javascript - i need validate time picked user, start date must greater 6 , smaller end date must not exceed next day 2 am. though dont have date input assume should append dates picked times compare, best way accomplish or there smarter 1 ? here can think of far function comparetimes(start,end){ var t1 = new date(); var t2 = new date(); var starttime = t1 + " " + start; if (end >= '00:00'){ t2.setdate(t2.getdate()+1); } var endtime = t2 + " " + end; if(date.parse ( endtime ) > date.parse ( starttime )){ alert ("greater than"); homecoming true } } the next function appends time string 1 give, date, , returns new date object. if pass no date, utilize today’s date. function setdatetime(timestring, date) { var result = (date ? new date(date) : new date()) , match = /(\d+):(\d+)/.exec(timestring) ; result.set...

asp.net mvc 3 - Telerik MVC3 Grid Differentiating Filtered Column Name -

asp.net mvc 3 - Telerik MVC3 Grid Differentiating Filtered Column Name - can suggest me possibilities differentiate filtered telerik grid column other columns. meaning can provide different color scheme differentiate filtered column. thanks speaking has had deal telerik mvc grid in similar manner, share solution doing this: 1) run web page has grid, , view source. 2) find out, viewing source, happens when filter turned on (i.e. attribute change, function beingness called, etc.). 3) using jquery, set color scheme of column when event occurs. it's rather annoying can't using telerik's command itself, should help out. asp.net-mvc-3 telerik-mvc

asp.net - Limit the number of rows in a multiline textbox -

asp.net - Limit the number of rows in a multiline textbox - is there way limit number of rows in multiline textbox? want allow user input 12 lines of text in multiline textbox. right textbox accepts many lines user throws @ it. another hurdle fact multiline textbox within of listview making hard retrieve textbox name using javascript. can utilize regular look validator limit number of new lines 12? if so, proper regex? i've tried ^(\n|\r|\r\n){0,12}$ doesn't work @ all. you should able utilize regex validator this. seek expression: ^[^\n]*(?:\n[^\n]*){0,11}$ if want limit lines maximum of 65 character each, can use: ^[^\n]{0,65}(?:\n[^\n]{0,65}){0,11}$ if want count lines if there soft line breaks lines longer 65 characters, work: ^[^\n]{0,65}(?:\n?[^\n]{0,65}){0,11}$ note ? after \n , making line break character self optional. you may want optimize look minimize backtracking adding atomic groups, example: ^(?>[^\n]{0,65})(...

Symfony 2.1 enable/disable stack traces -

Symfony 2.1 enable/disable stack traces - few moments ago realised symfony prints out exceptions in prod env. how can turn off? after little bit of looking, seems how (there improve solution couldn't find it). under web/app.php , alter $kernel = new appkernel('prod', true); - true here sets display_errors true, alter false . if fails, should ensure display_errors turned off (if it's production, best done in php.ini rather using ini_set ). symfony-2.1

google apps script - Using "sheet.appendRow([ file.getUrl()]" is working, but how would I make it show a pretty name? -

google apps script - Using "sheet.appendRow([ file.getUrl()]" is working, but how would I make it show a pretty name? - the title explains all. well, @ to the lowest degree hope does... give thanks in advance help. ' function onopen() { var folder = docslist.getfolder("my folder"); var contents = folder.getfiles(); var file; var data; var sheet = spreadsheetapp.getactivesheet(); sheet.clearcontents(); sheet.appendrow(["link", "name", "type", "id"]); (var = 0; < contents.length; i++) { file = contents[i]; var value1,value2,value3; if (file.getfiletype()==docslist.filetype.spreadsheet) { var othersheet = spreadsheetapp.open(file).getsheetbyname("sheet1"); value1 = othersheet.getrange('b2').getvalue(); value2 = othersheet.getrange('b7').getvalue(); valu...

node.js - Global variable in javascript function -

node.js - Global variable in javascript function - this code: var csv = require('csv'); var loader = function() { var rows; csv() .from.path('./data/ebay.csv', { columns: true, delimiter: ';' }) .to.array( function(rows) { setrows(rows); }); function setrows(input) { rows = input; } homecoming rows; }; module.exports = loader; i want rows when phone call loader object. i'am beginner in oop javascript, have no thought it. start learning javascript oop node? found many tutorials describe how start node , how create webs using various frameworks, know. programmed in php , moving nodejs , i'm wasted. like node.js functions deal i/o csv works asynchronously. therefore, phone call csv.from..to.. returns immediately, callback function called later. create loader asynchronous well, this: var csv = require('csv'); var loader = function(ondata) { csv() .from.path('./data/ebay.csv...

javascript - Where does an ASP.NET code-behind file execute? (client or server) -

javascript - Where does an ASP.NET code-behind file execute? (client or server) - my friend experienced developer (but not familiar .net) asked me asp.net code-behind code executed; on server or on client. assumption executed on client , hence compiled javascript, since methods in code-behind file respond client-side events such selecting dropdown list, not cause postback. what i'm looking more intimate understanding of how/where code in code-behind file executed in relation rest of application. the codebehind executes on server. that's reason, called asp.net webforms . when web page executed, below happens in nutshell. the web page gets flushed html form web controls flushed html input elements necessary javascript the javascript remains as-is (unless injected dynamically) the next question ... how asp.net server side know events performed on client side execute appropriate events on server side? the reply is, asp.net converts each web command 1 or mor...

Refresh JavaScript section only? -

Refresh JavaScript section only? - i have section of javascript displays current temperature, not update temperature changes. there way have section of javascript update on timer? edit: sorry, here's code (not created me). <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript"> // javascript go here $(function(){ // specify zip/location code , units (f or c) var loc = '10001'; // or e.g. spxx0050 var u = 'f'; var query = "select item.condition weather.forecast location='" + loc + "' , u='" + u + "'"; var cachebuster = math.floor((new date().gettime()) / 1200 / 1000); var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeuricomponent(query) + '&format=json&_nocache=' + cachebuster; window['wxcallback'] = function(data) { var info =...

regex - Perl - Parse last occurrence of whitespace -

regex - Perl - Parse last occurrence of whitespace - i trying parse lastly chunk of next line: 77 0 wl1271/wpa_supplicant_lib/driver_ti.h unfortunately, spaces not same length. assume printf or similar used output info lined in columns. means have spaces, , have tab characters. i have gotten first 2 numbers through utilize of regex in perl. way thought lastly bit search of lastly occurrence of whitespace character , grab rest of string starting there. tried using rindex accepts character searchable parameter , not regex (i thought \s trick). can solve issue i'm having here either walking through how lastly whitespace character or helping me solution grab string other way? why not split ? use strict; utilize warnings; $string = '77 0 wl1271/wpa_supplicant_lib/driver_ti.h'; ( $num1, $num2, $lastpart ) = split ' ', $string; print "$num1\n$num2\n$lastpart"; output: 77 0 wl1271/wpa_supplicant_lib...

ASP.Net Application Performance Analysis -

ASP.Net Application Performance Analysis - is there tool can help in detecting pages in asp.net application performing slowly, without having measure performance of each individual page? please reply & help. asp.net performance analysis

regex - How to use PHP preg_match for text between a colon and period? -

regex - How to use PHP preg_match for text between a colon and period? - i have string: $style = "width:87.0%;"; how utilize php preg_match() extract "87" it? life of me can't head wrapper around regex :( preg_match('/:(.*?)\./', $style, $matches); echo $matches[1]; the ? makes regex reluctant/ungreedy php regex preg-match