Posts

Showing posts from August, 2013

android - Permission denial causing app crash in Ionic -

i have been confused random crash in app since updated cordova 5 , started using crosswalk. this logcat : d/statusbar-networkcontroller( 1110): refreshsignalcluster - setnwboosterindicators(false) d/statusbar-networkcontroller( 1110): refreshsignalcluster: data=-1 bt=false d/statusbar-iconmerger( 1110): checkoverflow(1344), more:false, req:false child:5 w/activitymanager( 891): permission denial: getcurrentuser() pid=32252, uid=10037 requires android.permission.interact_across_users i/activitymanager( 891): process com.tesingguru.tesing_guru (pid 29852) (adj 0) has died. i/windowstate( 891): win death: window{42fb82c0 u0 com.tesingguru.tesing_guru/com.tesingguru.tesing_guru.mainactivity} i/surfaceflinger( 329): id=3847 removed nainactivit (16/29) i/surfaceflinger( 329): id=3847 removed nainactivit (-2/29) i/factorytest( 891): isrunningfactoryapp=false i/factorytest( 891): isrunningfactoryapp=false w/activitymanager( 891): force removing activityrecord{4303e860 u0 com.te...

Paypal return url is giving blank array -

<form id="dvrr" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <table border="0" cellpadding="5" cellspacing="5" align="center" width="100%"> <tr> <td></td> <td><input type="hidden" name="business" value="ceo@world-airport-city-transfer.com"> <!-- specify buy button. --> <input type="hidden" name="cmd" value="_xclick"> <!-- specify details item buyers purchase. --> <input type="hidden" name="item_name" value="cab booking"> <input type="hidden" name="item_number" value="<?php echo $orderid; ?>"> <input type="hidden" name="amount" value="<?php echo number_format((float)$data['price'], 2, '.', '...

swift - Xcode 7 command failed due to signal: illegal instruction 4 -

i used xcode 7's migration tool migrate project swift 1.2 2. after fixing errors missed , such, except error prevents me building: command failed due signal: illegal instruction 4. i have tried in these articles ( xcode 7 , swift 2.0 : command failed due signal: abort trap: 6 , , command failed due signal: abort trap: 6 ) not identical issues mine, nevertheless not able fix issue. i have cleaned build , removed derived data folder. have date cocoapods installation, xcode tools @ 7.0, , swift compile optimization @ none. there else i'm missing? thanks! so answer found of coworker. found offending file in build error, there no line provided. through process of elimination, found line declaring new constant result of getting json dictionary ([string : anyobject], typealiased jsondictionary), inside optional dictionary. here line: let objectsdictionary = maybejson?[key] as? jsondictionary changed 2 guard statements: guard let goodjson = maybejson as? jsondi...

user interface - Java GUI - NOT Swing -

i need new way create graphical user interface of application. don't want use swing. i'm looking looks little different. can recommend me other way of creating it, please? yes, javafx way you. can create views using fxml files instead of coding in java. learning curve not hard in view (and far being guru). the tool javafx scene builder here create views or controls in fxml , integrates nicely netbeans, , suppose eclipse. you can adapt of controls using css. i suggest start here see if fit need: http://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm

Django get users with userprofiles -

how can users userprofiles? i have own comments app model: apps = ( (1, 'game'), (2, 'article'), (3, 'cms'), (4, 'user profile'), ) comment_type = models.integerfield(choices=apps, default=1, verbose_name="comment type") object_id = models.integerfield(default=0) user = models.foreignkey(user, null = true, blank = false, related_name='user') view: context = { ... 'comments': comment.objects.filter(comment_type=1, object_id=game_id), ... } userprofile: class userprofile(models.model): user = models.onetoonefield(user) signature = models.textfield(blank=true) and view: {% comment in comments %} .... {{ comment.user.profile.signature }} {% endfor %} i django rookie. thank you. you can use .select_related() here, comment has foreign key user, , user has foreign key profile: comments = commen...

Android Studio: Android 5 lollipop can't install and launch App -

i have 2 real android devices , used them test android app (i new @ android programing) when clicked "run" button, dialog box showed me 2 of devices: table 4.2.2 , cellphone 5.0 after running, tablet launched app perfectly, phone (5.0) wouldn't launch, wouldn't install new app, tried many time, , run, @ later time, needed remove previous app run new app. please me resolve problem. well, have remove old version of app time? if yes, should use keystore file signing app (and same). device refused update app because didn't sign keystore file. (i have 1 device android 5.1.1 , 1 android 4.2.2, had same issue 5.1.1 1 until signed it)

php - How to count all rows from mysql but display only 2 results and count all results -

i trying display data database. more precisely images. problem when have extract more 2 images. want display first 2 images , print example added 49 images or how many images had extract mysql. script here: public function getimages($id, $username){ global $con; $stm = $con->prepare("select * image postid = :id , author = :username"); $stm->execute(array(":id" => $id, ":username" => $username)); $imagesnum = $stm->rowcount(); if($imagesnum == 1){ $image = $stm->fetch(pdo::fetch_obj); echo '<div class="frame"><div class="frameoneimage"><img src="../upload/img/'.$username.'/'.$image->path.'"></div></div>'; } else if($imagesnum == 2){ echo '<div class="frame">'; $row = $stm->fetchall(); foreach($row $image){ echo'<div class="frametwoimag...

GCC section attribute and preprocessing -

can tell me type of macro is? do? #define per_cpu_aligned_section "..shared_aligned" #define per_cpu_base_section ".data..percpu" #define __pcpu_attrs(sec) __percpu __attribute__((section(per_cpu_base_section sec))) per_cpu_attributes what dot operator in first 2 macros? can tell me more "section" attribute used in gcc? couldn't find info on web this. can give me link this? thanks.

Google Hangouts - controlling other participants video -

i'm thinking creating sort of helper application friend enjoy paper rpg through internet. thinking using hangouts api, have. is there way of temporarily exclude of participants running conversation? can see other data on app, should hear nor see other participants. there way of creating private conversation within group conversation? private participants disappear group, , after finishing automatically reconnected group conversation? i'm reviewing hangouts api, i'm not finding answers. or maybe should webrtc instead of hangouts? thanks what you're describing is... hangout or webrtc session ;). develop own hangout extension share specific info selected participants using extension. you have hangout session main conversation parties, while use join.me, zoom.us or webrtc screenshare privately friend.

python - re.split return None in function but normaly works OK -

def whois(k, i): k = str(k[i]) print (k) whois = subprocess.popen(['whois', k], stdout=subprocess.pipe, stderr=subprocess.pipe) ou, err = whois.communicate() = str(ou) print (who.find('netname:')) = re.split('netname:', who)[1] = re.split('nethandle', who)[0] = who.replace(r'\n', '') print (whois(k, 4)) output: 108.160.172.204 520 none why python return "none" not "dropbox"? if take code and: k = '108.160.172.204' print (k) whois = subprocess.popen(['whois', k], stdout=subprocess.pipe, stderr=subprocess.pipe) ou, err = whois.communicate() = str(ou) print (who.find('netname:')) = re.split('netname:', who)[1] = re.split('nethandle', who)[0] = who.replace(r'\n', '') print (who) output : 108.160.172.204 520 dropbox your function not return value returns none python functions don't spec...

ios - Why is my rectangle being drawn wrong? -

Image
i'm trying draw rectangle around screen. here's code: let viewrect = skshapenode(rect: self.view!.frame) viewrect.strokecolor = skcolor.whitecolor() viewrect.linewidth = 2.0 addchild(viewrect) i'm using self.view!.frame instead of self.frame because scene not same size screen (the scene stretched fill screen). i have expected code draw rectangle around screen, draws instead (the white rectangle drawn): anyone know why it's not being drawn around screen? scene size: 1024x768 view size: 414x736 scale mode: aspect fill you creating border node within scene setting coordinates according view presenting scene. skscene's coordinate system not same view presenting why shape different expect.

java - Oracle JDK installs two JREs? -

before downvoting or close-requesting question please see question jdk 7 not 6, has second question 'q2' not addressed duplicate thread , question four not two java.exe instances. thank you! i've installed oracle's java se jdk (64 bit) resulted in following directory layout, , somehow two jres: c:\program files\java\ \jdk1.7.0_40 \jre \jre7 i'm proud owner of four java.exe executables: c:\program files\java\jdk1.7.0_40\bin\java.exe c:\program files\java\jdk1.7.0_40\jre\bin\java.exe c:\program files\java\jre7\bin\java.exe c:\windows\system32\java.exe q1: 1 should put search path execute java-based applications? q2: need put unlimited jce policy files security sub-directory of corresponding jre in search path or others in order work correctly? while installing jdk have copy of jre installed automatically. need not install copy of jre separately. yet directory structure. the copy of jre in jdk folder is private copy...

html - How to put width 100% on facebook comment -

how put width 100% on code below? please i'm beginner on html , css <div> <fb:comments expr:href='data:post.url' expr:title='data:post.title' expr:xid='data:post.id' mobile='yes' numposts='2'/> </div> use this, facebook's own utility generate comment box code. have option modify width there. you can specify width in pixel if want, or can specify width 100% fluid width. data-width="100%" https://developers.facebook.com/docs/plugins/comments

java - searching for keys when values are selected -

i using google table store collection in format shown: import com.google.common.collect.hashbasedtable; import com.google.common.collect.lists; import com.google.common.collect.table; public class mapdemo { public static void main(string[] args) { final table<string, string, list<string>> values = hashbasedtable .create(); values.put("b1", "rtyname", lists.newarraylist("weepn", "weepfnb", "eedgeft", "xbteehy")); values.put("b2", "euopname", lists.newarraylist("aaa", "bbbb", "ccc", "dddd")); system.out.println(values.get("b1", "rtyname")); // prints list system.out.println(values.get("b2", "xxxname")); // prints list } } now, outputs: [weepn, weepfnb, eedgeft, xbteehy] [aaa, bbbb, ccc, dddd] i want customize ...

ios - Loading multiple saved images in app slows it down -

i developing app user can save 13 screenshots , display them on single view thumbnails or full screen image. let filename:string = self.stickerused + ".png" var arraypaths = nssearchpathfordirectoriesindomains(.documentdirectory, .userdomainmask, true)[0] nsstring var pngfilename = arraypaths.stringbyappendingpathcomponent(filename) uiimagepngrepresentation(screenshot).writetofile(pngfilename, atomically:true) nsuserdefaults.standarduserdefaults().setobject(filename, forkey: self.stickerused) nsuserdefaults.standarduserdefaults().synchronize() this above how save image , following how retrieve images. code first screenshot: var defaultname:string = "sticker1.png" let path = nssearchpathfordirectoriesindomains( .documentdirectory, .userdomainmask, true)[0] nsstring let filename = nsuserdefaults.standarduserdefaults() .stringforkey("sticker1") ?? defaultname let imagepath = path.stringbyappendingpathcomponent(filename) let image = uiimage(c...

qt - QML window resize/move flicker -

Image
i'm developing simple qml application right , noticed resizing , moving qml window generates ugly flicker compared qtwidgets window, instance. so created 2 test applications show difference: qwidgets: qml: as can see qml version of application flickers pretty ugly while qtwidgets 1 clean. gets pretty ugly when ui grows in complexity. do have knowledge this? bug? there fix/workaround issue? you can try this: int main(int argc, char* argv[]) { qcoreapplication::setattribute(qt::aa_useopengles); or qcoreapplication::setattribute(qt::aa_usesoftwareopengl); the first option uses opengl2direcx angle library (like google chrome) the second 1 uses opengl emulation software... small programs work , 100% compatible old os windows xp. note: can try qt 5.7 , new qtquick.controls 2.0 ...performs better... https://blog.qt.io/blog/2016/06/10/qt-quick-controls-2-0-a-new-beginning/

asp.net - check RadDateTimePicker value against current system date time value -

how can verify if selected datetime value raddatetimepicker greater current system datetime value in asp.net using server side validaton . <telerik:raddatetimepicker runat="server" id="orderdate" > <calendar id="calendar1" runat="server" enablekeyboardnavigation="true"> </calendar> </telerik:raddatetimepicker> to validate it, need use comparevalidator or customvalidator. please use following markup datetime picker: <telerik:raddatetimepicker runat="server" id="orderdate"> <calendar id="calendar1" runat="server" enablekeyboardnavigation="true"> </calendar> </telerik:raddatetimepicker> <asp:customvalidator id="cvorderdate" runat="server" controltovalidate="orderdate" validationgroup="vgsubmit" errormessage="please use correct date" onservervalidate=...

javascript - AngularJS: Model not updating in controller scope -

i have following controller: app.controller('myctrl', function($interval, $scope) { $scope.foo = 2; $interval(function() { console.log($scope.foo); }, 1000); }); and following code in view: <input type="text" ng-model="foo" /> when load page, input correctly populated value "2". however, if change value in input, console continues log "2" (without quotes). i've used $interval illustrate - $watch() callback fires once , never again. if use ng-change="" on input, $scope.foo in callback equal 2. what doing wrong? if use ng-model, have have dot in there . bind model creating object controller $scope.form={ foo:0 }; view <input type="text" ng-model="form.foo" />

android - Converting JSON object with Bitmaps -

i have object contains few string members , bitmap member. the object held in map string key , object value. i'm using following code convert map: string json = new gson().tojson(amap); and extract json map use (passing above json string): map<string, object> amap; gson gson = new gson(); amap = gson.fromjson(jsonstring, new typetoken<map<string, object>>() {}.gettype()); this partially works bitmap stored in object appears corrupted? i.e. when try apply bitmap image view exception. i'm thinking may need separately convert bitmap string json hoping theres simpler solution, ideas? thanks. this simple : private string getstringfrombitmap(bitmap bitmappicture) { /* * functions converts bitmap picture string can * jsonified. * */ final int compression_quality = 100; string encodedimage; bytearrayoutputstream bytearraybitmapstream = new bytearrayoutputstream(); bitmappicture.compress(bitmap.compressformat.png, compress...

android - Does anyone know how to get Edittext value in service? -

i want access edittext value in service don't no exact way of doing that. have done code. context context = getapplicationcontext; edittext et = (edittext)context.findviewbyid; but doesn't give me findviewbyid method. can give me hint how can access edittext value in service. following code may edittext in service context = getapplicationcontext(); activity a=(activity)context; edittext edittext = (edittext)a.findviewbyid(r.id.edittext1);

How to convert python byte string containing a mix of hex characters? -

specifically, receiving stream of bytes tcp socket looks this: inc_tcp_data = b'\x02hello\x1cthisisthedata' the stream using hex values denote different parts of incoming data. want use inc_data in following format: converted_data = '\x02hello\x1cthisisthedata' essentially want rid of b , literally spit out came in. i've tried various struct.unpack methods .decode("encoding). not former work @ all, , latter strip out hex values if there no visual way encode or convert character if could. ideas? update: i able desired result following code: inc_tcp_data = b'\x02hello\x3fthisisthedata'.decode("ascii") d = repr(inc_tcp_data) print(d) print(len(d)) print(len(inc_tcp_data)) the output is: '\x02hello?thisisthedata' 25 20 however, still doesn't me because need regular expression follows see \x02 hex value , not 4 byte string. what doing wrong? update i've solved issue not solving it. reason wanted he...

mailchimp - Does Mandrill try to resend the bounced emails? -

i'm wondering if mandrill tries resend bounced emails. it's part of business flow love hear feedback competent in domain. cheers first , check out why resaon , useless of time resend bounced email : https://mandrill.zendesk.com/hc/en-us/articles/205582937-what-happens-if-an-email-bounces- i want resend , follow these instructions : http://blog.mandrill.com/resending-messages-rules-actions.html

c++ - Unknown module(s) in QT: multimedia -

i have downloaded qt-everywhere-opensource-src-5.4.1 , build , installed static. next built qmultimedia , installed. i "unknown module(s) in qt: multimedia" .pro when including qt += multimedia. i have qtmultimedia,qtmultimediaquick_p , qtmultimediawidgets in /usr/local/qt-5.4.1/include. have mediaservice,playlistformats in /usr/local/qt-5.4.1/plugins have qtmobility,qtmultimediakit in /usr/include i running ubuntu 15.0 all related issues i've found did not help. please run: sudo apt-get install qtmultimedia5-dev afterwards can install other multimedia packages needed, enables multimedia in general.

split Tel and Fax numbers from this string using regex -

consider below given string po box number 1234, ca - 3265 tel: +1-200-200-2000 fax: +1-200-200-2001 po box number 1234, ca - 3265 service: +1-200-200-2002 \ +1-200-200-2022 f : +1-200-200-2003 po box number 1234, ca - 3265 care: +1-200-200-2004 f : +1-200-200-2005 po box number 1234, ca - 3265 fire: +1-200-200-2006 fax : +1-200-200-2007 po box number 1234, ca - 3265 help: +1-200-200-2008 fax - +1-200-200-2009 po box number 1234, ca - 3265 fax : (+123)-4567890 \ (+123)-4567891 the regular expression mentioned below 1 i'm using finding fax number in different representation (?:(f|f)((a|a)(x|x))?(?:\s?(\-|\:)?\s?))(?:\s?[0-9\+\.\(\)\/\\\-]\/?\\?\s?){7,30} ex: above regex match fax given string shown below fax: +1-200-200-2001 f : +1-200-200-2003 f : +1-200-200-2005 fax : +1-200-200-2007 fax - +1-200-200-2009 fax : (+123)-4567890 \ (+123)-4567891 note: considering phone numbers rest of numbers available in given text apart taking fax. ex: tel: +1-200-200-20...

scala - How to flatMap a function on GroupedDataSet in Apache Flink -

i want apply function via flatmap each group produced dataset.groupby . trying call flatmap compiler error: error: value flatmap not member of org.apache.flink.api.scala.groupeddataset my code: var mapped = env.fromcollection(array[(int, int)]()) var groups = mapped.groupby("mygroupfield") groups.flatmap( myfunction: (int, array[int]) => array[(int, array[(int, int)])] ) // error: groupeddataset has no member flatmap indeed, in documentation of flink-scala 0.9-snapshot no map or similar listed. there similar method work with? how achieve desired distributed mapping on each group individually on node? you can use reducegroup(groupreducefunction f) process elements group. groupreducefunction gives iterable on elements of group , collector emit arbitrary number of elements. flink's groupby() function not group multiple elements single element, i.e., not convert group of (int, int) elements (that share same _1 tuple field) 1 (int, array[i...

javascript - Dollar sign ("$") is not a function -

i'm unsure of why i'm getting error, reason jquery's $ not being recognised? jquery(window).load(function ($) { 'use strict'; /* preloader */ $(".status").fadeout(); $(".preloader").delay(1000).fadeout("slow"); }); /* end widnow load */ note: changing $ jquery fixes issue (so i'm sure jquery referenced correctly, using version 2.1.4), continue using $ semantics. you overriding $ variable inside function, because have argument same name. remove $ argument , $ again refer global scoped one, equal jquery . jquery(window).load(function () { 'use strict'; /* preloader */ $(".status").fadeout(); $(".preloader").delay(1000).fadeout("slow"); }); /* end widnow load */ you can use parameter handler function passed load . suggest same anik islam abhi's answer : use name argument. example e or eventargs . note (or others landing here)...

unit testing - How to generate Code Coverage report of Instrumentation test cases in Android Studio -

what working code coverage report of functional unit test cases. updated latest android studio (1.2.1) updated android plugin in android studio (1.2.3) updated gradle version (2.2.1) changed build variant unit test now able code coverage report (using default intellij idea code coverage tool) of unit tests wrote extending testcase class. when write class extending androidinstrumentatiotestcase2 or activitytestcase , gettting null when call getactivity() . , when switch build variants instrumentation, run code coverage button disabled. so, in simple words, want know how code coverage report in test cases both functional unit test cases instrumentation test cases. ps: other code coverage plugin (like jacoco) can used.

html - Table layout colspan rowspan -

Image
i'm trying table don't understand how white td . this have tried: <table style="width:100%"> <tr> <td rowspan="2"></td> <td rowspan="2">capacidad</td> <td colspan="3">precios por hora</td> <td>1er</td> <td>1 semana</td> <td>>1 semana</td> </tr> </table> this code results in last 3 td being right after precios por hora not below. any on this? i think mean? <table width='100%'> <tr> <td rowspan='2'>capacidad</td> <td colspan='3'>precios por hora</td> </tr> <tr> <td>1er</td> <td>1 semana</td> <td>1 semana</td> </tr> </table>

c++ - ERROR: slist was not declared in this scope -

this code isn't working me, getting below-mentioned compilation errors. please me point out mistake. in function 'int main()': 4:3: error: 'slist' not declared in scope 4:9: error: expected primary-expression before 'int' 5:3: error: 'l' not declared in scope 12:9: error: expected primary-expression before 'int' 13:3: error: 'back' not declared in scope code: int main() { slist<int> l; l.push_front(0); l.push_front(1); l.insert_after(l.begin(), 2); copy(l.begin(), l.end(), // output 1 2 0 ostream_iterator<int>(cout, " ")); cout << endl; slist<int>::iterator = l.previous(l.end()); = l.insert_after(back, 3); = l.insert_after(back, 4); = l.insert_after(back, 5); copy(l.begin(), l.end(), // output 1 2 0 3 4 5 ostream_iterator<int>(cout, " ")); cout << endl; } all problems boil down fact following declaration s...

PHP Javascript how to change value of user form, but value has multidata -

i want ask how change value of input in form, has multiple data inside value. my form : <form method="post" action="pax-flight.php#pax-flight" class="paxform"> <input type="hidden" value="{"data":{"user_agent":"sometravel","user_pass":"sometravel","additional":"99507","depart":"sub","destiny":"cgk","date":"20-06-2015","date2":null,"adult":"1","child":"0","infant":"0"},"0":{"airlines_code":"id 6401","airlines_name":"lion","airlines_class":"economy","airlines_seat":1,"airlines_price":"685000","airlines_nta":664450,"airlines_depart":"05:30","airlines_depart_fr":"sub","airline...

android - Alternative of 'unfortunately app has stopped' -

i want know there way know cause of error or make android device show error details instead of displaying message 'unfortunately app has stopped working' ? you can check logcat on ide. or using adb command, adb logcat . can filter message, if yout want see error log, can use adb logcat *:e . , choice output log file sdcard, using adb logcat -f /sdcard/log.txt .

php - Custom field value inside WP_Query -

i want wp_query, displays posts, have same custom field value display post. this code: function show_other_posts() { //get current custom field value if( get_field('desktop_cat') ){ $redirect_value = the_field('desktop_cat'); //echo current custom field value debugging echo $redirect_value; //query posts same value $redirect_args = array( 'posts_per_page' => -1, 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'desktop_cat', 'value' => $redirect_value, 'compare' => '=' ) ) ); //display post titles $the_query = new wp_query ( $redirect_arg...

c# - How to resolve HTTP Error 404.2 - Not Found error in my website -

when submitted contact form in website displaying error http error 404.2 - not found page requesting cannot served because of isapi , cgi restriction list settings on web server. please me how overcome issue. this issue iis settings. below link should - http://www.codeproject.com/tips/571514/the-page-you-are-requesting-cannot-be-served

ios - Wrong alignment of subviews in a UIScrollView -

i have following code, creates uiview , , of subviews, , adds them uiscrollview , in loop : var count:cgfloat=bookscrollview.frame.minx var i=0;i<10;i++ { var view=uiview(frame: cgrect(x: count + 20, y: bookscrollview.frame.miny + 30, width: 200, height: 300)) view.backgroundcolor=uicolor.whitecolor() view.layer.cornerradius = 5; view.layer.maskstobounds = true; var imageview=uiimageview(frame: cgrect(x: count, y: view.frame.miny - 30, width: 150, height: 220)) // imageview.image=uiimage(named: "sample_book")! view.addsubview(imageview) var titlelabel=uilabel(frame: cgrect(x: count + 10, y: imageview.frame.maxy + 30, width: 185, height: 60)) titlelabel.text="head first javascript" titlelabel.backgroundcolor=uicolor.clearcolor() titlelabel.font=uifont(name: "menlo-bold ", size: 15) titlelabel.textalignment = nstextalignment.center t...

css - i have developed website and the issue is that same version of firefox shows different design on different computers while other browsers were fine? -

i have developed website http://www.falestinona.com/nashra website tests on laptop correct , same design on ie, chrome, ff , opera problem have found same version of firefox shows design different on different computers. ff on laptop shows correct design while same version of ff on other laptop shows design problems , problem shows friends correct , others have design problems on ff. ff clean no addons shows same problem. attached 2 images: ff correct design ff wrong design same version , clean ff , latest version https://support.cdn.mozilla.net/media/uploads/images/2015-06-09-22-05-36-e5d7cf.png https://support.cdn.mozilla.net/media/uploads/images/2015-06-09-22-05-32-b35e5a.png in mozilla firefox font rendering , line height rendering of font differ between devices , automatically calculated differs between devices. solution set static constant line height html elements , forcing change. css stylesheet change: @import "amiri_font/amiri.css"; *{ font-fam...

objective c - Swift passing uninitialized object to block -

i have been trying figure out small thing quite easy objective c, not solve swift. var loginviewcontroller: ssloginviewcontroller let completion = { loginviewcontroller.presentviewcontroller(ssfeedviewcontroller(), animated: true, completion: nil) } loginviewcontroller = ssloginviewcontroller(completion: completion) the intention here pass ssloginviewcontroller completionblock present view controller. but, code above gives error. variable 'loginviewcontroller' captured closure before being initialized. delcaring uninitialized variable __block , objective c block take changed value within block. it in objective c, __block ssloginviewcontroller *loginviewcontroller; dispatch_block_t completion = ^ { [loginviewcontroller presentviewcontroller:[[ssfeedviewcontroller alloc] init] animated: yes completion:nil] }; loginviewcontroller = [[ssloginviewcontroller alloc] initwithcompletion:completion]; how can similar behavior achieved swift ? it shou...

javascript - adding new objects to array within a loop with a delay -

i have for loop needs make ajax call 1 second delay between iterations. should grab object , .push onto array. code below adds first object. doing wrong? var maxloops = 10; var counter = 0; (function processpages() { if(counter++ >= maxloops) return; settimeout(function() { //check page count , loop. push new objects allproducts (var i=1; <= totalpages; i++){ $.ajax({ url: '/process.php', data: {category: 'sportinggoods', page: i}, type: 'post', success: function(output) { allproducts.push(output); } }) } }), 1000; })(); if want few ajax calls , wait between them, can this: (function processpages(i) { if (i===totalpages) { // pages have been fetched, may // use allproducts array here return; } $.ajax({ url: '/process.php', data: {categ...

javascript - How would i display images in HTML using jquery -

i want show images stored in "appendreturnedimages(data)" function. gets error , cannot display images. format of images should follow html. html: <div class="col-md-5 single-top"> <ul id="etalage"> <li> <img class="etalage_thumb_image img-responsive" src="images/si1.jpg" alt="" > <img class="etalage_source_image img-responsive" src="images/s2.jpg" alt="" > </li> <li> <img class="etalage_thumb_image img-responsive" src="images/si2.jpg" alt="" > </li> <li> <img class="etalage_thumb_image img-responsive" src="images/si3.jpg" alt="" > </li> </ul> </div> javascript function appendreturnedimages(data) { var $html = $(); ...

git - Get the hash of the current HEAD of a repo using only HTTP -

i know if have git repo checked out, can use git cli current commit hash. there way on http, without cloning repo? for example, let's want current hash of https://github.com/jashkenas/coffeescript . manually, can go page, press y on keyboard, , see hash (at time of writing) 1f197fcc1bf1a15bc45a6b23fb3f706ffcb77025 . means if @ later point wanted download coffeescript source @ moment, download https://github.com/jashkenas/coffeescript/archive/1f197fcc1bf1a15bc45a6b23fb3f706ffcb77025.zip , give me source. is there way using http (e.g. curl)? can hit endpoint tell me current hash of default branch? generalizing bit, there endpoints tell me hash of the head of default branch, the head of given branch, or a particular tag? if wanted information on github specifically, retrieve using the github api , return large json structure exhaustive information on state of branch: https://api.github.com/repos/jashkenas/coffeescript/branches/master (or remove branch nam...

android - Unable to get file list from external storage directory in Droid -

Image
i trying access external storage in android. i want push images can use in application. the code using follows: file directory = new file(string.valueof(android.os.environment.getexternalstoragedirectory()) + file.separator + appconstant.photo_album); ps: photo_album defined "papu" it returns /storage/emulated/0/papu i cannot see path exists through ddms, file explorer condition true; if (directory.isdirectory()) { } anyways, assumed reading mnt/shell/emulated/0/papu when try files through file[] listfiles1 = directory.listfiles(); it not return files @ all. how can push files when don't folder in ddms explorer ? here how ddms looks like: and code is: file directory = new file(string.valueof(android.os.environment.getexternalstoragedirectory()) + file.separator + appconstant.photo_album); // check directory if (directory.isdirectory()) { file[] listfiles1 = directory.listfiles(); ...

ajax - Retrieving Array of Object from params on Grails -

i'm passing array on post request using ajax call, not simple one, rather array of object s: var param = { ..., branches: { 0: { address: "...", telephone: "...", fax: "...", ... }, ... nth: { address: "...", telephone: "...", fax: "...", ... } } } $.ajax({ type: "post", url: ".../savetransaction" data: param success: function(r) { ... } }); this controller def orderservice; function savetransaction() { def response = orderservice.save(params) render response json } and service : def save(params) { def branches = params.branches println "branches: $branches" def branches = params.list("branches") println "branches: $branches" branches = params.list(...

How to change the directory to program files using Powershell? -

i open c:\program files\r\r-3.2.0\bin\rscript.exe. trying change directory. figured error in opening program files. following code cd program files\r\r-3.2.0\bin error: positional parameter cannot found accepts argument files unlike command.com/cmd.exe, powershell follows more consistent rules , in failing case program , files\r..bin parsed 2 separate arguments, second invalid in context (as cd accepts single non-named argument). to fix use quotes , eg. cd "c:\program files" with quotes parsed string value supplied single argument (the string not include quotes, again unlike cmd.exe rules). fwiw, cd alias set-location . run get-help cd details on how can used - include optional (and named) parameters does support.

database - How to get a mysql query to use a specific index? -

select * orders (index(idx)); when fired above query got error mysql #1064 - have error in sql syntax i have created index below create index idx on orders(date,status); can tell me correct syntax? if index appropriate used without explicitly specifying it. given using select * not expect index used (even if index hint had correct syntax). choice down query optimiser's heuristics. the correct syntax is: select * orders use index(idx); ref: index hints also, please note : 99 times out of 100, specifying index hint should not done. let optimiser job.

plsql - How do you implement auto incremented sequence values in Oracle PL/SQL? -

Image
in oracle database table, how auto incremented sequence values done pl/sql such key value or id typed columns? included discussion on sizing table resources based on know projected growth of related tables in given schema. how many piano tuners there in city of chicago? less population of city altogether... :) , on. know data. how do that? read on. using database triggers auto increment column values one possible approach use database triggers . values ensured unique through implementation of sequence typed database objects . in example above, table fundraiser has associated sequence called fundraiser_seq primary key value. the parts list: need example. create table "fund_people" ( "person_id" number not null enable, "anonymous_ind" varchar2(1) not null enable, "alias_ind" varchar2(1) not null enable, "alias_name" varchar2(50), "first_name" varc...

ios - How do I make a border around my whole screen for all the devices in Swift Xcode? -

i have game thats in landscape , need border around whole screen heronode can't go out of screen on either of 4 sides. have code works iphone 5s , small other devices. how code resize , fit screen other devices? thanks! override func didmovetoview(view: skview) { let borderbody = skphysicsbody(edgeloopfromrect: cgrect(x: 20, y: -90, width: self.size.width-50, height: self.size.height)) borderbody.categorybitmask = borderbodycategory borderbody.collisionbitmask = herocategory borderbody.contacttestbitmask = herocategory borderbody.allowsrotation = false borderbody.affectedbygravity = false self.physicsbody = borderbody } you can use uiscreen 's property instead of fixed value. let width = uiscreen.mainscreen().bounds.size.width - 50 let height = uiscreen.mainscreen().bounds.size.height - 50 let borderbody = skphysicsbody(edgeloopfromrect: cgrect(x: 20, y: -90, width: width, height: height))

android - why is media player starts more than once and media player won't stop in button click which started at on create? -

i need add background music android application. have declared mediaplayer object class variable , create inside oncreate(). have start mediplayer object inside oncreate(). have stop media player in button click method starts new intent. requirement play music when starts layout , stop when starts next layout, starts more once , won't stop. here code. mediaplayer startmusic; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_cover); setrequestedorientation(activityinfo.screen_orientation_landscape); startmusic= mediaplayer.create(cover.this, r.raw.startgame); if(!(startmusic.isplaying())) { startmusic.start(); } } public void btnstartclick(view v) { startmusic.pause(); intent intent = new intent(this,scaleexercise.class); startactivity(intent); } can please tell me whats wrong...

winapi - Programmatically turn airplane mode on or off Windows -

i writing app need turn airplane mode on or off on windows. have seen this question , answers status, or cannot such thing metro apps. not making modern/metro app, don't need worry application sandboxing. is there api turn airplane mode on/off, , how should use it? edit: in use case, i know can control it, , user ok that . also, found this msdn question following excerpt: windows 8(build 8250), can turn on / off airplane mode in metro style network setting ui. how programmatically? microsoft defined hid usage code wireless radio button (usage: 0xc6). question: there virtual key code wireless radio button? if so, application can send keycode keybd_event. wlanapi.dll export api wlanstoreradiostateonenteringairplanemode , there no document api. question: can provide detail information? used control air plane mode, how call api? so apparently (to give summery of answer), 1 can check state of airplane mode using mobilebroadbandradios...

java - Preventing the user from entering identical elements(within a malfunctioning try catch) -

so following code simple game,where objective to guess correct numbers(which 1 5).anything else incorrect , user given warning message if enter similar numbers.the comments explain loops , variables declared. the problem have code inserted try catch take care of strings , doesn't seem work.if string entered,the while loop continues infinitely. also,i realize there loop pf looping , conditional statements present in code,but couldn't think of else.if have recommendations reduce number of loops , if statements,your appreciated. public class tries { public static void main(string[]args) { boolean datatype=false; int inp; scanner a=new scanner(system.in); //the arraylist,list, contains input user enters.only correct input entered(1 5). arraylist<integer> list=new arraylist<integer>(); //this determines how many times loop going execute.say user enters 4,and enters 4 correct inp...

html - div text moving slightly upward even when ul child display set to none -

Image
i'm bit new css forgive me shortcomings on side can't seem find solution problem anywhere else. i'm sure trivial haven't changed code before went wrong. so have made website's navbar has 8 different div on , equally spaced each other. want have drop down when mouse hovers on of them. anyway, before created list(or comment it) child of div about us seems in position meant be. vertically centered , aligned other div 's content. here's website before adding list child div: here's after it: as can see, about us has moved above little. here's jsfiddle: jsfiddle (i advise view jsfiddle page @ 50% zoom level perspective of every div.) please provide solution how can prevent happening , also, if you'd me additionally tell me how drop down on hover. add line-height: 28px match height of #navbar , text aligned. .nb_item { display:inline-block; width:auto; padding:0px 10px; color:#ffffff; margin:auto; text-align:ce...

c# - How can my Outlook VSTO Add-in modify the read email form? -

Image
depending on text in email being viewed, vsto outlook add-in use modified form display email. i able create custom panes, not show want them. can create outlook form regions "adjoining" , show @ bottom. have not been able modify either of 2 default forms outlook uses display email messages - inspector read form, , reading pane form used in main outlook window. (i apologize if i'm using wrong terms.) this i'd insert text labels , buttons , such right above email message: is possible? page @ msdn says should able customize standard form. thank for help. outlook (nor vsto) doesn't provide placing custom forms @ top of inspectors. outlook form regions doesn't provide such layouts. can use windows api functions subclassing outlook windows , placing custom forms need them. see adjacent windows in outlook article , creating adjacent windows in outlook sample project more information. you may consider using advanced outlook view , for...

ios - How do I create custom tab bar icons? -

Image
i know question has been asked many times before solutions haven't worked me. want create custom tab bar item icon. understanding create 1 version white outline (alpha set 1) transparent background , filled-in version (also transparent background). unselected image works when tap icon disappears in simulator. simulator unselected version: simulator selected version: i haven't been setting images programmatically, using attributes inspector. looked @ this related question , replaced image 1 suggested , same thing happened. here xcode settings if helps: thanks! update: i left selected image dropdown blank , icon doesn't disappear. problem isn't resolved because don't want solid blue version of image want blue outline.

forms - Select option :selected for edit in laravel 5 -

i building page edit record, having difficulty displaying select option saved/recorded entry :selected. the select displays year option, 1990 2015. this i've done far: <select name="term_a" class="form-control"> <option value="0">choose year</option> @for ($i = 1990; $i < 2015; $i++) <option value="{{ $i }}">{{ $i }}</option> @endfor </select> how can make stored data :selected? edit: i forgot mention did bind form model this: {!! form::model($userdetails) !!} and works ok, problem getting option select fetch old data :selected. this should it: <option value="{{ $i }}" {{ input::old('term_a') == $i ? 'selected' : '' }}>{{ $i }}</option>

csv - Table of Top Five with Pertinent Information in Python -

Image
i have large csv file want convert table pertinent information. select top 5 callers, include data underneath such last call description, , person received calls customer. it this: complaintnumber;companyname;callername;empname;callstatus;gen_code;detail code;otherdetail;calldesc;qualityissue;highpriority;received data , time; call type;count;unnamed: 14;unnamed: 15;unnamed: 16;unnamed: 17;unnamed: 18;unnamed: 19;unnamed: 20;unnamed: 21;unnamed: 22;unnamed: 23 5651;company 1;joe;rob;closed;maintenance;code 1;;sentence relatively long not long;no;1-no;6/11/2015 15:00;type 1;8;;;;;;;;;; 6642;company 1;joe;rob;closed;support;code 2;;another sentence relatively long not long;no;1-no;6/12/2015 15:00;type 2;8;;;;;;;;;; 6893;company 1;joe;rob;closed;support;code 2;;description , stuff;no;1-no;6/13/2015 15:00;type 3;8;;;;;;;;;; 4535;company 1;joe;gwen;closed;maintenance;code 4;;so , called , said such , such;no;1-no;6/14/2015 15:00;type 2;8;;;;;;;;;; 8655;company 1;joe;gwen...

c - Error while trying to update array element -

i working on embedded platform not have debugging features. hard error source. i have defined in header file: typedef struct cm_packet { cm_header header; //header of packet 3 bytes uint8_t *data; //packet data 64 bytes cm_footer footer; //footer of packet 3 bytes } cm_packet; typedef struct cm_inittypedef{ uint8_t deviceid; cm_packet packet; } cm_inittypedef; extern cm_inittypedef cmhandler; void cm_init(cm_inittypedef *handler); cm_appendresult cm_appenddata(cm_inittypedef *handler, uint8_t identifier , uint8_t *data, uint8_t length); and somewhere in implementation have: uint8_t bufferindex = 0; void cm_init(cm_inittypedef *cm_initer) { //init handler cmhandler.deviceid = cm_initer->deviceid; cm_packet cmpacket; cmpacket.header.deviceid = cm_initer->deviceid; cmpacket.header.packetstart = cm_start; cmpacket.footer.packetend = cm_end; //initialize data array uint8_t ...

java - Why does parallelStream not use the entire available parallelism? -

i have custom forkjoinpool created parallelism of 25. customforkjoinpool = new forkjoinpool(25); i have list of 700 file names , used code download files s3 in parallel , cast them java objects: customforkjoinpool.submit(() -> { return filenames .parallelstream() .map((filename) -> { logger log = logger.getlogger("forkjointest"); long starttime = system.currenttimemillis(); log.info("starting job @ thread:" + thread.currentthread().getname()); myobject obj = readobjectfroms3(filename); long endtime = system.currenttimemillis(); log.info("completed job latency:" + (endtime - starttime)); return obj; }) .collect(collectors.tolist); }); }); when @ logs, see 5 threads being used. parallelism of 25, expected use 25 threads. average latency download , convert file object around 200ms. missing? may better question how parallelstream figure how split original list...

ios - Get fields from NSArray with CoreData content -

i have table in core data fields, can count of records, can´t values each field, have code: var request:nsfetchrequest = nsfetchrequest(entityname: "radar") //my table in core data let appdelegate:appdelegate = (uiapplication.sharedapplication().delegate as! appdelegate) let context:nsmanagedobjectcontext = appdelegate.managedobjectcontext! request.returnsobjectsasfaults = false var results:nsarray = context.executefetchrequest(request, error: nil)! println(results.count) //this count can i need more, radar have fields: descr,latit,long need fields create annotation this: results.descr you need loop array of results , cast each result nsmanagedobject retrieved, in case radar if results.count > 0 { result in results { if let r = result as? radar{ //now can access properties of radar in r println(r.descr) } else{ println("could not cast fetch result radar") } } ...