Posts

Showing posts from June, 2013

deployment - How to store login Information from within setup dialog -

i have created 1 windows desktop application using visual studio 2010 . @ time of creating setup this, in user interface able add dialog textboxes (for storing username, password, email id, , contact number), how store them, can use these values user can login application using username , password? i searched, didn't doing first time, don't have in-depth idea of it. you have two options : 1. files you can store application login information in file structure want like xml or etc . if want store data more 1 person, must create logic desired structure reading/writing data in file every one. then, can add in application setup project copy in application install , use values. 2. windows os registry you can store application login information in subkey of windows os registry structure want. if want store data more 1 person in every windows os user account, must create logic desired structure reading/writing data in value of subkey in windows os re...

amazon web services - EC2 Instance : Access RDS via Alias Name -

is possible set rds in such way ec2 instances use rds instance identifier "mydb" connect rds instead of using public dns name : mydb.cfnr64hlvtcp.us-east-1.rds.amazonaws.com . ? the way access rds database using public dns endpoint name generated rds when database created. you setup own cname rds dns name if wanted hide public dns name component in system, must maintain entry, seems bit complicated. aws recommends don't use ip address behind rds dns entry directly since ip may change, example if database has failover new instance. [1] [1] http://aws.amazon.com/rds/faqs/#what_is_a_db_subnet_group_and_why_do_i_need_one

javascript - Remove/avoid adding target link to URL -

this 1 may simple jquery/javascript gurus here, can't find solution around web. case i have link @ bottom of page says back top , link target link this: <a href="#top" class="standard">back top</a> so when click it, jumps top of page. simple. problem when target link clicked, id #top added url of page, ie: http://website.com/about-us/#top question is there way remove or avoid getting id #top added url of page retain functionality of page jumping top? any appreciated. in either case (jquery or vanilla javascript), you'll want following: select anchor tags href set #top create "jump" function sets page position top , returns false prevent default link behavior bind "jump" function click event of of nodes found to jump have several options. i've provided them (jquery , js specific) in first example below. using jquery jquery makes selecting , binding click event easy. can jum...

html - How can I select all the empty tag using jQuery.? -

this question has answer here: how select empty p tag using jquery? [closed] 3 answers how can select empty tag using jquery. i want select <p></p> <p style="display: block"></p> <p> </p> <p> </p> <p>&nbsp;</p> and not <p>0</p> <p>test</p> i tried :empty not working options. on appreciated. you can using jquery.filter() . var empty_p = $('p').filter(function(){ return !$.trim($(this).text()); }).get();

android - Layout is beyond the right margin -

Image
i have listview in activity. each listview item use (in array adapter) layout: <gridlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="top" android:background="#ffffff" android:columncount="2" android:rowcount="1" > <gridlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="0" android:layout_gravity="left|top" android:layout_margin="5dp" android:layout_row="0" android:rowcount="3" > <textview android:id="@+id/settingsheader" android:layout_column="0" android:layout_gravity="left|top" android:layout_r...

javascript - How to make text appear when you choose a certain option -

i'm sort of stuck @ moment. want make div text appear when user selects 1 option select dropdown form. how can done in javascript? found online takes selected , shows value chose. whereas, want this: <select> <option>one</option> <option>two</option> </select> <div id="text" style="display:hidden;">the text show if user chooses option "two"</div> anyone know how this? update: here's problem. i've tried using script both in body , in header: <script type="text/javascript"> document.getelementbyid('script-choose').onchange=function(){ for(var i=0;i<document.getelementsbyclassname('option-show').length;i++){ document.getelementsbyclassname('option-show')[i].style.display='none'; } document.getelementbyid(document.getelementbyid('script-choose').value == 'gold').style.display='block';} </script> my ...

mercurial - how to convert an hg repo to a git repo on os x -

yes, know hg-fast-export.sh which people hate even when managed find mercurial module, still doesn't work on repo: $ $home/notes/fast-export/hg-fast-export.sh -r $home/path-to-repo error: repository has @ least 1 unnamed head: hg r194 git-fast-import statistics: . . . producing nothing in target git repo. i tried hg-to-git in git repo: $home/desktop/tmp/git-master/contrib/hg-to-git/hg-to-git.py -v . tip 1197 analysing branches... traceback (most recent call last): file "/users/dsw/desktop/tmp/git-master/contrib/hg-to-git/hg-to-git.py", line 135, in <module> hgchildren[parent] += ( str(cset), ) keyerror: '-1' maybe hg-to-git trying tell me same thing hg-fast-export telling me, in more visceral , gestalt way. somehow think tool should keep going in face of odd situation , produce @ least partial result, if informs user of problem. does have suggestions? i've never wanted this, believe easiest way is: install hg-git cre...

cocos2d iphone - cocos2dx - get transition progress after CCDirector::pushScene -

i writing own cclayer extending cclayer in cocos2d-x-2.1.4. used ccdirector::pushscene() method push scene contains cclayer.. when push cctransitionslide*** scene, cccustomlayer::visit() call continuously. how transition progress within method? i'll need know progress animating custom layer... i new cocos2d-x- , have no idea @ all. i've investigated variables changed throughout call doesn't seem tally i'm looking out.. thanks!

Android Email Intent - Received file attachment is Zero bytes -

i setup email intent in app. attach binary file it. when email editor opens shows how many bytes. when receive email 0 bytes! i have done on separate project , worked before copied code new project. intent emailintent = new intent(android.content.intent.action_send); emailintent.settype("application/octet-stream"); emailintent.putextra(android.content.intent.extra_email, new string[] { "" }); emailintent.putextra(android.content.intent.extra_text, "message here"); emailintent.putextra(android.content.intent.extra_subject, "subject"); emailintent.putextra(intent.extra_stream, uri.parse("file:///data/data/com.example.app/files/filename.extension")); i have tested on gingerbread , jelly bean. used default email editor of devices(galaxy y , htc one). again received attachment 0 bytes if email editor shows bytes(i.e. 306 bytes) -------update--------- so created project , tested code below. sends email attachment. when use sam...

c# - How to use less CPU in a thread (mainly) responsible for publishing -

when using infinite loop trydequeue queue, uses cpu. is possible make operation execute user interface notification, when queue not empty? , run event or function? i reached conclusion in implementation uses zeromq library, in thread responsible publishing, infinite loop can not avoided. using (var context = new context(1)){ using (socket client = context.socket(sockettype.pub)){ while (!stopallthread){ sqlqueue.trydequeue(out message); if (message != null){ ... } } } it's not clear api or technology use, guess there should blocking alternative, such var message = sqlqueue.dequeue(); in general case block thread until message read queue. shall not consume cpu when there nothing read. if use zeromq (from comment) there blocking call on server ( taken here ) // zmq context, server socket using (zmqcontext context = zmqcontext.create()) using (zmqsocket server = context.createsocket(sockettype.rep)) { server.bind("t...

android - Custom obfuscated class name in proguard -

is there way set custom class name in proguard (command in proguard.cfg)? let's i've got class com.scana.myclass , want proguard obfuscate "tx" problem solved. can use: -applymapping file-name in proguard.cfg file content example: com.scana.myclass -> tx:

one row insert into mysql from a loop php -

i have loop need elements , need insert each element in mysql table code able insert 1 element.(p.s. variable loaded min 4 element). why i'm not able insert multiple element loop? please need know urgently.thanks function addmijloc(){ foreach ($_session["mijloc"] $check) { $sql="insert isu_mijloace (`nr_rap_ext_mijl`, `mijloc`) values ('".$_session['nrraport']."', '".$check."')"; if(mysql_query($sql)) { $mijloace="ok"; } else { echo '<script>alert("tabela mijloace eronata");</script>'; } } } did try result when print_r($check) in loop?

android - Confusion with .cacheInMemory() vs .cacheOnDisc() in Universal Image Loader -

i using .cacheondisc() method storing images in cache memory (default method-unlimited extrenal storage).should enable cacheinmemory app?what r effects if dont use cacheinmemory option? a memory cache caches images in memory (ram), i.e. not have load , decode image internal storage because rather slow. should imo use memory cache. the effect of not using memory cache can - depending on implementation - scrolling through lists of images either stuttering or slower necessary. disk (e.g. sd card) cache makes sense if images downloaded internets , don't want re-download them each time app starts again. local storage faster internets still slower memory.

sass - Is it possible to @extend a class defined in a .css file to a .scss file? -

for example: app.scss @import url('orange.css'); @import 'navel.scss'; orange.css .orange { color: orange; } navel.scss .navel { @extend .orange; } in sass if add @import "test.css"; or @import url("test.css"); it compiled pure css @import directive. because file .css extension sass preprocessor things pure css , code inside not involved in sass language operations. in example, if try extend .orange get: the selector ".orange" not found. shortly: extending possible if use sass files.

linux - How to disable (turn off) tripwire -

i setup ids tripwire , found when check integrity of fs it's have huge cpu consumption. in manuals says how setup this, not how delete. i have root permissions, cause server. how may turn off? i forget install tripwire via apt-get :) that's why found answer myself sudo apt-get remove tripwire

Android: View cut off when moved out of screen -

Image
i creating custom view can moved on screen left , right. adding view in relative layout. here of code of custom view: parent view of subtopicsview class: import android.app.activity; import android.content.context; import android.content.res.configuration; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmenttransaction; import android.util.attributeset; import android.util.displaymetrics; import android.view.view; import android.widget.relativelayout; import com.example.androidstackedview.r; import com.example.androidstackedview.views.baseview.viewstate; public class stackedview extends relativelayout { context context; view dashboardview; topicsview topicsview; subtopicsview subtopicsview; detailsview detailsview; float widthfactor = 10; public static int screenheight; public static int screenwidth; public static float xd...

css - display angular input elements on the same line -

i trying replace excel sheet , angular app. such need display number of inputs in horizontal line emulate row. when add angular input elements, seem display on newline. i have tried using css "display : inline-block" style, doesn't seem have effect. checkout article : spreadsheet using angularjs

Restrict GWT client class to get cached -

is there way restrict our gwt client class cached in browser when compile gets cached *.cache.js file. i don't want cached how restrict it the name of generated .cache.js file different after each compilation won't cached. have reason think otherwise ? i've been hot-swapping gwt-generated war since morning , never had clear browser's cache.

jquery - Populate dropdown value looping thru a set of links -

i want loop thru a 's inside div , populate option value of select box above href value of a in order appears using jquery this code <div class="results_filter"> <label for="sort" class="dropdown_label">sort by:</label> <select name="sort" id="sort" class="custom_select"> <option value="">make</option> <option value="">year of manufature</option> <option value="">price</option> </select> <a href="/cars/index/sort:make_id/direction:asc">make</a><a href="/cars/index/sort:model_year/direction:asc">year of manufature</a><a href="/cars/index/sort:asking_price_from/direction:asc">price</a> </div> i tried not working $(document).ready(function () { $('div.results_filter > a').each(func...

cakephp - View link if depended on user rights -

i working cakephp 2.x. have 3 columns: user | course | usercourserole each user can edit multiple courses , 1 course can edited multiple users. far good. if user wants see index of courses i want show 'edit'-link next courses can in fact edit. how can realize this? figured have set sort of field inside coursecontroller , check field inside view. right way go? my current code is coursecontroller.php ... public function index() { $courses = $this->course->find('all', array('recursive' => 2)); $this->set('courses', $courses); } ... courses/index.ctp <!-- file: /app/view/courses/index.ctp --> ... <?php foreach ($courses $course):?> ... <?php echo $this->html->link('edit', array('action' => 'edit', $course['course']['id'])); ?> ... in beforerender() or beforefilter() set $this->auth->user() varia...

javascript - Angular.js and server-side search - how to, best practices -

in app had simple angular.js filter , worked fine, need integrate server-side search. have endpoint , created directive watches query in input , makes request server returning results: html: <search ng-model="query"></search> js: ... restrict: 'e', scope: { ngmodel: '=' }, template: '<input type="text" ng-model="ngmodel" />', link: function (scope, elem, attrs) { var timer = false; scope.$watch('ngmodel', function (value) { if (timer) { $timeout.cancel(timer); } timer = $timeout(function () { if (value) { scope.$parent.items = rest.query({ resource: 'search', query: value }); } }, 1000); }); } ... however problem in scope . see i'm writing ...

amazon ec2 - Cassandra 1.2: new node does not want to joing the ring -

we have cassandra's cluster of 6 nodes, 3 seeds. 1 day aws sent message 1 of our instance decommissioned , seed01. fix should stop/start instance move new aws host. before stop/start did: 2) stop gossip 3) stop thrift 4) drain 5) stop cassandra 6) move data ebs (we using ephemeral volumes data) 7) stop / start instance 8) move data 9) start cassandra but after starting cassandra on seed01 nodetool status shows: datacenter: unknown-dc ====================== status=up/down |/ state=normal/leaving/joining/moving -- address load tokens owns (effective) host id rack dn 10.149.45.115 ? 256 17.3% ae4166fb-76e1-4900-947c-7e87ca262ea0 unknown-rack dn 10.164.84.171 ? 256 17.5% 638dae19-a6f5-4330-9466-f46ddb3b9d79 unknown-rack dn 10.149.44.215 ? 256 16.2% 987914af-f057-4922-8ee1-2a999108c75d unknown-rack dn 10.232.20.72 ? 256 14.8% ...

javascript - Google maps responsive resize -

i'm trying google maps responsive , resize while keeping center when windows resizes. read other stack questions in regards such as: responsive google map? , center google maps (v3) on browser resize (responsive) from second stack question i got link helps me part of code still have no luck. code using, when resize window, maps doesn't resize @ all function initialize() { var mapoptions = { center: new google.maps.latlng(40.5472,12.282715), zoom: 6, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map-canvas"), mapoptions); } google.maps.event.adddomlistener(window, 'load', initialize); google.maps.event.adddomlistener(window, "resize", function() { var center = map.getcenter(); google.maps.event.trigger(map, "resize"); map.setcenter(center); }); html <div id="map-canvas"/...

windows - Unable to rectify the cause during installation of java and setting java path in batch file -

i need install java , set java path. i'm able install java , can see 2 folders in c:\program files (x86)\java i.e jre , jdk . but when i'm trying set java_path in code can't path on command propmt echo command i.e @echo java_home = %java_home%. though have started scripting today unable rectify i'm missing out ? here code tried :- @echo off /f %%j in ("java.exe") ( set java_home=%%~dp$path:j **@echo java_home = %java_home%** echo "ok1" pause ) if %java_home%.==. ( @echo java.exe not found pause cd c:\users\pathfinder\desktop echo "time in" jdk-6u43-windows-i586.exe /s "/v\"/qn addlocal=all reboot=suppress javaupdate=0 custom=1\"" timeout /t 10 /nobreak echo "time out" set path="c:\program files (x86)\java\jre6\bin";%path% @echo path= %path% set java_home="c:\program files (x86)\java\jdk1.6.0_4...

sql - msdb.dbo.sp_send_dbmail Invalid Recipients get stripped out automatically -

looking @ documentation on http://technet.microsoft.com/en-us/library/ms190307.aspx (and more googling) cannot find information following behaviour: i'm trying send database email on microsoft sql 2008r2 using following command exec msdb.dbo.sp_send_dbmail @profile_name = 'profilename', @recipients='valid@gmail.com; unvalid_gmailcom', @body = 'testing', @body_format = 'html', @subject = 'testing'; the obvious problem unvalid_gmailcom isn't valid e-mail address. expected sort of error or warning maybe, sql strips out invalid address , sends mail remaining (if any) recipient(s). is there way find out when sql or way sanitize code cannot happen? you won't error, results (failure , success) stored in msdb. following views sysmail_allitems, sysmail_sentitems, sysmail_unsentitems, sysmail_faileditems available in msdb purposes. more here: http://technet.microsoft.com/en-us/library/ms191278.aspx

user interface - Xcode Instruments Time Profiler Understanding which methods are taking the most time -

my ui acting choppy , trying understand source is. there lot of options using xcode instruments , not sure set of them best me. from playing around of them seems time spent in [calayer drawincontext] , [calayer layoutsublayers] have no idea in context methods called (what part of ui doing that). which options should choosing in order better understand? also know if there way see running in background doesn't belong current visible ui (i think in background may thrashing cpu) toogle display of primary views , select: separated thread invert call tree hide system libraries show obj-c only try see this: http://www.raywenderlich.com/23037/how-to-use-instruments-in-xcode

pyqt4 - pyqt qtextedit move cursor -

i using qtextedit search button. here code. format = qtextcharformat() format.setbackground(qbrush(qcolor("gray"))) regex = qregexp(pattern) if (self.ui_log.checkbox_case.ischecked()==false): regex.setcasesensitivity(false) pos = 0 index = regex.indexin(self.ui_log.log_textedit.toplaintext(), pos) while (index != -1): cursor.setposition(index) cursor.moveposition(qtextcursor.endofword, 1) cursor.mergecharformat(format) pos = index + regex.matchedlength() self.ui_log.log_textedit.movecursor(??????) index = regex.indexin(self.ui_log.log_textedit.toplaintext(), pos) qtextedit have scrollbar input file providing in qtextedit large.. the searched text high lighted, how can move searched text providing index of word ? instead of moving existing cursor, set new one: self.ui_log.log_textedit.settextcursor(cursor);

android - Listview background color not getting updated -

i have following listview: <listview android:id="@+id/listview1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignleft="@+id/textview1" android:layout_below="@+id/textview1" > </listview> i want update background color of first nth columns. for using: int numofmessages=lst.length-lstnew.length; arrayadapter<string> adpt = new arrayadapter<string>(messages.this, android.r.layout.simple_list_item_1,lst); lm.setadapter(adpt); (int i=1;i<numofmessages;i++) { tv.settext("welcome " + i); lm.getchildat(i).setbackgroundcolor(color.blue); tv.settext("welcome : " + i); } but there wrong line: lm.getchildat(i).setbackgroundcolor(color.blue); because after control not moving further. please me change background color of textview dynamicaly. you can by: arrayadapter<string> adp...

javascript - onclick div open selectmenu in jquery mobile -

Image
i have issue regarding jqm selectmenu widget , doing opening select menus on container in contained. fiddle demo:- http://jsfiddle.net/4ckae/1/ my html:- <div class="container" onclick="$('#select-choice-7').selectmenu('open');"> <label for="select-choice-7" class="select">select, native menu3</label> <select name="select-choice-7" id="select-choice-7" data-native-menu="false"> <option value="standard">standard: 7 day</option> <option value="rush">rush: 3 days</option> <option value="express">express: next day</option> <option value="overnight">overnight</option> </select> </div> i trying open selectmenu through inline jquery onclick="$('#select-choice-7').selectmenu('open');" shows some weird er...

php - How can I efficiently identify the a natural division point between two sets of numbers? -

i have 2 datasets (a & b). each have 1000 numbers. 99% of time: < 5 <= b however, 1% of time b < 5 < a. if division point unknown - x - how can 1 determine x given dataset? obviously max(a) , min(b) misleading. , i'd prefer not loop through entire range (or between min(b) , max(a)) guessing , identifying greatest probable division point. sample dataset 1 1 1 2 b 2 <--anomoly 3 3 3 4 5 <--anomoly b 5 <--division, or `x` b 5 b 5 b 5 6 <--anomoly b 7 b 8 b 8 b 8 b 9 b 9 b 10 b 10 assume pair of datasets exists (c & d). how can find point c becomes d after allowing threshold of anomalies. what recommend? here's rough "guessing" strategy. i'd same without "guessing" loop. $maxprobable = 0; $pointofdivision = 0; ($i = min($b); $i <= max($a); $i++) { // probability $i in_array($a) $countbelow = below($i,$a); // assume function returns count of $a items below $i $countabove = above($i,$b);...

Put focus back on previously focused control on a button click event C# winforms -

Image
i have made custom number keypad control want place in winform application. of buttons have onclick event send value focused textbox in form have placed custom control. this: private void btnnum1_click(object sender, eventargs e) { if (focusedctrl != null && focusedctrl textbox) { focusedctrl.focus(); sendkeys.send("1"); } } focusedctrl supposed set on mousedown event of button this: private void btnnum1_mousedown(object sender, eventargs e) { focusedctrl = this.activecontrol; } where this.activecontrol represents active control on form. my problem button receives focus before event detects focused control previously. how can detect control had focus before button got focus? there event should using? in advance! edit: also, rather not use gotfocus event on each textbox in form set focusedctrl since can tedious , because have coding of custom control in control , not on form placed. (i this, though, if there n...

hadoop - Logical / Virtual data store in HDFS -

is there way creating logical / virtual data store in hdfs ? say want create catagory product. if query on product hadoop go product catagory not perticular hdfs. so want query based on catagories. use hive . feel can achieve through hive , it'l more convenient. hive provides warehousing capabilities on top of running hadoop cluster. create db particular product , store data related product tables of db. not this, hive provides sql interface data stored in warehouse enables query data of interest directly writing simple queries without having write complex mr jobs or lengthy programs. hth

php - Test if a cookie exist with it name in a variable -

i'd test if cookie exists, pretty basic, know, doesn't want work well. so, here pieces of code related: <?php $quesid = the_id()."gcquestion"; if(isset($_cookie[$quesid])){ ... } the test fails, when cookie's name match generated variable. weird part when try type variable name hand if(isset($_cookie["94gcquestion"])) , works. question : can use variable name $_cookie ? assuming you're using wordpress, the_id() : displays numeric id of current post. tag must within loop. the_id() template function , print id, doesn't return it. to return id, use get_the_id() instead. <?php $quesid = get_the_id()."gcquestion"; if(isset($_cookie[$quesid])){ ... }

c# - Add Private Key to X509Certificate -

i'm working on code uses openssl.net create public/private key pair certificate signing request. request equipped public key , sent ca returns signed certificate. created private key added certificate: mycert.privatekey = cryptokey.fromprivatekey(rsa.privatekeyaspem, null); the problem need .net x509certificate because rest of software uses sslstream , other .net classes tls. i able create certificate ca's response, did not find way add private key it. tried creating openssl certificate ca's response, exporting der or pem , creating .net certificate that, ignores private key. any ideas on how solve problem? i guess maybe missing conceptual ideas here? a certificate not supposed contain private key. private key private, certificate binds public key distinguished name. in other words certificate document signed authority confirms particular public key, share world, belongs , no 1 else. therefore never can contain private key, because share certificate w...

c# - Type 'MyClass' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type -

i error message when try serialize entity derives tableentity : type 'myclass' cannot inherit type not marked datacontractattribute or serializableattribute. consider marking base type 'microsoft.windowsazure.storage.table.tableentity' datacontractattribute or serializableattribute, or removing them derived type. the error message pretty clear what's going wrong. so question is, how can work around datacontractattribute not being decorated in tableentity class? code: [datacontract] public class myclass : myowntableentity { [datamember] public string name { get; set; } [datamember] public string email { get; set; } } i need serialize myclass byte[] , save table storage. public class myclassasbytearray : myowntableentity { public byte[] somebytearray { get; set; } } if has suggestion on how serialize byte[] , please let me know. [edit] i decided create own serializable tableentity : [datacontract] public class my...

html - Footer navbar components align center in Twitter Bootstrap? -

i'm wondering how can align components cenetered according body page? here code: <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>login &middot; leave system</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <link href="css/bootstrap.css" rel="stylesheet" media="screen"> <link href="css/custom.css" rel="stylesheet" media="screen"> <script src="js/jquery.js">...

window.open() is not working after hosted in server -

it through error in console : unable open window invalid url '%3144.76.2.51:3001/api/web/bizsteps/export/?content={%22bizsteps%22:[{%22bizstep%22:%22make%22,%22bizlocation%22:[{%22name%22:%22field%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22},{%22name%22:%22pre-cool%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22}]},{%22bizstep%22:%22store%22,%22bizlocation%22:[{%22name%22:%22location%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22}]},{%22bizstep%22:%22transport%22,%22bizlocation%22:[{%22name%22:%22journey%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22},{%22name%22:%22east%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22}]},{%22bizstep%22:%22sell%22,%22bizlocation%22:[{%22name%22:%22dc%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:%22%22},{%22name%22:%22retail%22,%22time%22:%22%22,%22temperature%22:%22%22,%22freshtimepoint%22:...

android - Spinner: get state or get notified when opens -

is possible know whether spinner open or closed? better if there sort of onopenlistener spinners. i've tried using onitemselectedlistener this: spinnertype.setonitemselectedlistener(new adapterview.onitemselectedlistener() { @override public void onitemselected(adapterview<?> parent, view view, int position, long id) { executesomething(); } @override public void onnothingselected(adapterview<?> parent) { log.d("nothing" , "selected"); } }); i can know window close if selected (in executesomething()). don't notified if click outside of dialog, closes spinner another option watch events extend spinner class , use 1 of methods( performclick() trigger dialog/popup) followed monitoring focus of window holding custom spinner . should provide wanted closed event possible finishing possibilities(for either dialog or dropdown mode). the custom spin...

amazon web services - Connect to EC2 Instance - Bitnami/Django -

Image
im super new amazon cloud, nevermind ec2, i'm following amazon documentation , states: in command line shell, change directories location of private key file created when launched instance. use chmod command make sure private key file isn't publicly viewable. example, if name of private key file my-key-pair.pem, use following command: chmod 400 my-key-pair.pem ssh -i my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com i'm using ssh -i myvaluepair.pem bitnami@<instancehere>.compute-1.amazonaws.com i fail on step #3 error of: ssh: connect host <instancehere>.compute-1.amazonaws.com port 22: operation timed out i've tried rebooting ami - thoughts? i'm trying connect bitnami on amazon ec2 instance. i have follow security policy: the problem with: it should have been: 22 (ssh) 0.0.0.0/0 80 (http) 0.0.0.0/0 and not sg-e925a882 i using link setup bitnami-djangostack-1.5.1. instance.

javascript - Create Hyperlink, add to body and then Add string beside Hyperlink -

i want create hyperlink using jquery name "dashboard" , add label beside hyperlink name " >> category". so, string " dashboard >> category " dashboard underlined. how can using jquery ? var link = $('<a>dashboard</a>') .appendto($('body')); $('<label>&nbsp;&gt;&gt; category</label>').insertafter(link); but david thomas points out, label not best tag use this. try <span> instead. var link = $('<a>dashboard</a>') .appendto($('body')); $('<span>&nbsp;&gt;&gt; category</span>').insertafter(link);

ruby on rails - Routing for model that has an association from another module -

i'm trying figure out problem i'm having generating paths, , need put in routes file. at moment have following: class car has_many :doors, class_name: 'cars::door' end module cars class door end end when attempting render simple form door, i.e simple_form [@car, @car.doors.build] i following error undefined method 'car_cars_doors_path' the above pseudo code, forgive typos. can tell me need put in routes.rb fix this? since car model scoped under module cars, don't have scope again car object in simple form simple_form_for @car.doors.build this generate path cars_doors_path . if need car_doors_path, have specify explicitly simple_for_for @car.doors.build, :url => car_doors_path

php - How to change the index name of array -

i have multidimensional array, i'm recursively changing values of array need. it working keys not array. but not keys array. how can change value of 1 test "one" => "test", $arr = array( 'one' => array( array('something' => 'value'), array('something2' => 'value2'), 'another' => 'anothervalue' ), 'two' => array( array('something' => 'value'), array('something2' => 'value2'), 'another' => 'anothervalue' ) ); function update_something(&$item, $key) { if($key == 'one') $item = 'test'; } array_walk_recursive($arr, 'update_something'); expected array structure is array( 'one' => 'test', 'two' => array( ...

jquery - I have an array of URLs that need to be passed into anchor tags -

using pass out array of rgb values , create anchor tags $.each(color, function(index, value){ $('body').append($('<a class="color">').css({ height: '30px', width: '30px', 'background-color': value }) ); }); and attempting use code pass array of url's anchor tags $.each(colorname, function(index, value){ $('.color').each(function(){ $(this).attr('href', value); }); }); sample arrays: var color = []; color[ 0 ] = 'rgb(233,232,217)'; color[ 1 ] = 'rgb(227,222,202)'; color[ 2 ] = 'rgb(218,210,186)'; color[ 3 ] = 'rgb(208,189,150)'; color[ 4 ] = 'rgb(213,208,194)'; var colorname = []; colorname[ 0 ] = '/url1/'; colorname[ 1 ] = '/url2/'; colorname[ 2 ] = '/url3/'; colorname[ 3 ] = '/url4/'; colorname[ 4 ] = '/url5/'; it seems of urls, appends last item in array colorname a...

c++ - What does void(*)() mean in code -

i saw code today in fb profile, , not able understand , how working:- (*(void(*)()) shellcode)() can please explain me, above code mean ? full code snippet below :- #include <stdio.h> #include <string.h> char *shellcode = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69" "\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80"; int main(void) { fprintf(stdout,"length: %d\n",strlen(shellcode)); (*(void(*)()) shellcode)(); return 0; } it cast function pointer (with no returned result , no arguments). prefer using typedef define signature of such functions: typedef void plainsig_t(void); then code (*(plainsig_t*)shellcode) (); for function pointers, don't need dereference them, shorter code: ((plainsig_t*) shellcode) (); which calls function machine code located inside shellcode memory zone. btw, not strictly portable c. in principle, there no guarantee can cast data pointer function pointer. (on weir...

View mysql data using PHP/Jquery with confirmation dialog box -

i have question jquery ui dialog box , showing dynamic content database. here have table generating blog post using php , mysql , in table, there column view contents belong each blog post. that link - $html .= " <td align='center'>\n"; $html .= " <a href='#' id='blog-$blog_id' class='view' >\n"; $html .= " <span class='icon-small ico-view-blog' title='view blog post'></span>\n"; $html .= " </a>\n"; $html .= " </td>\n"; clicking on above link need pop-up jquery dialog display blog content. eg: blog-title, author, image, blog etc. i tried jquery , using separate php script fetch blog contents this. not pop-up dialog expect. this jquery have used dialog: $( "#dialog-view-blog" ).dialog({ autoopen: false, height: 450, width: 650, modal: true, buttons: { cancel...

javascript - using requirejs within a firefox xul extension -

i use requirejs manage code within firefox xul plugin, , can't find modules. i know xul doesn't play nice data-main attribute, have main.js script second script: <script src="chrome://mypackage/content/require.js" type="application/x-javascript"></script> <script src="chrome://mypackage/content/main.js" type="application/x-javascript"></script> this calls script, , require function available within main.js, when run require(['lib1'], function(lib1){ alert(lib1.val1); }) the alert never gets popped (lib1 in same directory main.js). i have tried within , without setting baseurl as require.config({ baseurl: "chrome://mypackage/content/" }) and not work either way. does know how can require.js in right place modules? addendum ** i added error handling function , error code returned http://requirejs.org/docs/errors.html#timeout i have loaded test module normal we...

jquery - What is the best way to globally catch ajax errors in asp.net-mvc? -

i find myself putting (simplified) code in number of different javascript files: $(document).ajaxerror(function (e, xhr, settings, exception) { alert('error in: ' + settings.url + ' \\n' + 'error:\\n' + exception + ": " + xhr.responsetext ); }); is there downside can think of putting in site.master file once have consistent solution errors?. if that, there anyway override behavior on specific page? use $(document).ajaxerror in site.master file. to override in specific instance, include error callback on individual ajax calls, this: $.ajax({ url: '/yoururl', success: function(result) { alert('it worked!'); }, error: function(xmlhttprequest, textstatus, errorthrown) { alert('your custom error message here.'); } }); for not want override, them omit error callback.

ruby on rails - `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error) -

when tried run rails s on remote server got issue. mysql working fine "rails db" find socket file using mysqladmin variables | grep socket and add socket file database.yml configuration development: adapter: mysql2 host: localhost username: root password: xxxx database: xxxx socket: <socket location>