Posts

Showing posts from June, 2011

c++ - Confused between a copy constructor and a converting constructor -

since have doubts question (for c++03) posting here.i read conversion constructors , states "to converting constructor, constructor must have single argument , declared without keyword explicit." now question whether copy constructor can called conversion constructor provided not explicitly declared ? qualify 1 ? believe cant called conversion constructor because accepts same type parameter ths resulting in no conversion. instance foo a; foo b; = 100; //a conversion constructor called (i.e) foo(int a){...} = b ; //since both objects same type , have been initialized assignment operator called (if there overloaded version otherwise default called) is understanding correct ? quoting standard: [class.conv.ctor]/3 a non-explicit copy-constructor (12.8) converting constructor . implicitly-declared copy constructor not explicit constructor; may called implicit type conversions. so yes, copy-ctor converting ctor. also note [conv]/1 specifies ,

jsrender - Logic in JsViews css-tag -

i trying put logic in css-width in data-link in jsviews. 2 following approaches did not work: {{for items}} ... <td id="show-keys" data-link="css-width{~root.showkeys ? '200px' : '400px'}"> or {{for items}} ... <td id="show-keys" data-link="css-width{:~keyswidth()}"> ... <script type="text/javascript"> ... var app = { ... helpers: { showkeys: function () { //debugging shows never gets fired return app.showkeys ? '400px' : '100px'; } how appropiatly base css-value on property changes dynamically? here jsfiddle shows few variants: http://jsfiddle.net/borismoore/gzpvz/ your first expression missing : data-link="css-width{~root.showkeys ? '200px' : '400px'}" should data-link="css-width{:~root.showkeys ? '200px' : '400px

asp.net - FileUpload Validator error message always shown .net -

Image
i have problem code: <asp:fileupload id="fulbrowse" runat="server" /> <asp:button id="btnload" runat="server" text="load" onclick="btnload_click" /> <asp:regularexpressionvalidator id="fulbrowsevalidator" runat="server" errormessage="upload zip or dxf files only" validationexpression="^(([a-za-z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.zip|.zip|.dxf|.dxf)$" controltovalidate="fulbrowse"> </asp:regularexpressionvalidator> that is, if file uploaded zip or dxf, when function btnload_click ends, errormessage shown, . here result: ** does know why? thank you **upload succesful label set when btnload_click ends. i change validator ^.+[\.zip|\.zip|\.dxf|\.dxf]$ since file uploader validate filename (unless you

internet explorer - IE not supporting some CSS3 styling -

i having problem ie. using css3 style on current project. on other browsers have tested on firefox, chrome , safari , looks amazing. on ie looks room(doesn't good). i need advice please. know percentage of ie user days very low compare other browsers. question should rewrite css3 standard css ones doesn't support ie or should annoy , using php alert users contains might no looks right because of browser type , recommend them download, chrome or firefox? an example of 1 of issue navigation bar. <nav> <ul> <li> <a href="">home</a> </li> <li><a href="about.php">aboutus</a></li> <li><a href="contact.php">contact us</a></li> </ul> </nav> css nav{ text-align:center; } nav li{ text-align:center;list-style: none; float: left; } nav ul ul { display: none;

android - ImageView width incorrectly scaled on Nexus 4? -

i'm using technique described here . following line works on all devices, except nexus 4 : int imagewidth = horizontalscrollview.getchildat(0).getmeasuredwidth(); the layout simple: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <horizontalscrollview android:id="@+id/main_scroller" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/main_image" android:layout_width="wrap_content" android:layout_height="match_parent" android:adjustviewbounds="true" android:scaletype="centercrop" />

php - WordPress - How to get IDs for all pages in the current menu? -

i building 1 page scrolling wordpress theme, , want able create simple loop grab page id's in current menu, spit out content. i know how spit out content page, given id, don't know proper way ids current menu is. any suggestions? figured out: $menuitems = wp_get_nav_menu_items('main-menu'); foreach($menuitems $page) { $post = get_post($page->object_id); $content = apply_filters('the_content', $post->post_content); echo $content; }

ios - How to check if an id points to a CGRect? -

supposing have: id value = [self valueforkey:@"frame"]; bool valueiscgrect = ???; how can decide? should cast id something? the returned value of type nsvalue scalar types, provides method objctype , returns encoded type of wrapped scalar type. can use @encode() encoding arbitrary type, , compare objctype . if(strcmp([value objctype], @encode(cgrect)) == 0) { // it's cgrect }

java - Redirect using HTTPS connection Response -

created new https connection , executed method call on connection url. instead of sending 301 (30x) redirect received response xhtml page data inturn when handled in browser submitted automatically , sent redirected page, how handle same in java code? here response data <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <body onload="document.forms[0].submit()"> <noscript><p><strong>note:</strong> since browser not support javascript, must press continue button once proceed.</p></noscript> <form action="https://localhost:8083/login" method="post"> <div> <input type="hidden" name="relaystate" value

javascript - document.location to first child <a> tag not working in ie6 & ie7 -

i have html code : <ul id="mainlynav"> <li><a href="#">text1</a> <ul class="subnavul"> <li> <a href="a.php">link a</a> </li> <li> <a href="b.php">link b</a> </li> <li> <a href="b.php">link b</a> </li> </ul> </li> <li><a href="#">text2</a> <ul class="subnavul"> <li> <a href="d.php">link d</a> </li> <li> <a href="e.php">link e</a> </li> <li> <a href="f.php">link f</a> </li> </ul> </li></ul> i want when user clicks on 1 of top level links (text1 or text2) , page go fi

When will a string be garbage collected in java -

in java, when object has got no live reference, eligible garbage collection. in case of string, not case because string go string pool , jvm keep object alive resuse. means string once created 'never' garbage collected? now in case of string, not case because string go string pool , jvm keep object alive resuse. means string once created 'never' garbage collected? first, string literals automatically interned / added string pool. strings created application not interned ... unless application explicitly calls string.intern() . second, in fact rules garbage collecting objects in string pool same other strings / other objects. strings garbage collected if ever become unreachable. in fact string objects correspond string literals typically not candidates garbage collection. because there implicit reference string object in code of every method uses literal. means string reachable long method executed. however, not always case. if literal d

sass - Horizontal list with Susy grid -

Image
i want build android main navigation fits susy grid. looks this: the code goes here: html: <div class="container"> <nav> <ul class="horizontal-list"> <li> <a href="#">one</a> </li> <li> <a href="#">two</a> </li> <li> <a href="#">three</a> </li> <li> <a href="#">four</a> </li> </ul> </nav> </div> sass: header.main { height: $headerheight; background: url('images/headerbackground.gif'); .container { @include container; @include susy-grid-background; nav { @include span-columns(8); ul.horizontal-list { @include horizon

cakephp - Creating new record if the id is not in db -

i working on cakephp 2.x , want create new row or record if userid not present in db otherwise update record, problem is: not updating current record. creating record userid "0" dont know problem is. if not finding record should create record userid giving. public function activenostatus(){ $this->loadmodel('status'); $userid = $this->request->data('iduser'); $notify = $this->request->data('notify'); $data = array(); $data['activeno'] = $notify; $count = $this->status->finduserid($userid); if($count>0){ $this->status->id = $userid; $this->status->save($data); echo "update"; }else{ //create new row $datanew=array(); $this->status->id = $userid; $this->request->data['status']['activeno']=$notify; $this->status->save($this->request->data)

android - Using adb sendevent in python -

i running strange issue, running adb shell sendevent x x x commands commandline works fine, when use of following: subprocess.popen(['adb', 'shell', 'sendevent', 'x', 'x','x']) subprocess.popen('adb shell sendevent x x x', shell=true) subprocess.call(['adb', 'shell', 'sendevent', 'x', 'x','x']) they fail - simulated touch works in shell script not work when called through python. furthermore tried adb push shell script device, , using adb shell /system/sh /sdcard/script.sh able run successfully, when try run commandline through python, script fails. what's stranger, script runs, example, not seem execute command sleep 1 half way through script, echo commands work, sendevent commands don't seem work. doesn't seem possible, there is. how run set of adb shell sendevent x x x commands through python? sendevent takes 4 parameters args popen

c# - Graphics.Fillrectangle won't update -

i have event-function launches on click , in have graphics instruction private void picturebox1_click(object sender, eventargs e) { switch (modclick) { case 2: session.g.fillrectangle(brushes.tomato, mouseposition.x, mouseposition.y, 50, 100); break; } modclick = 1; } when launch program click nothing, if press key (some keys only), changes apply (i can see rectangle). why not updating ? ps : don't worry case instruction. storing graphics instances in global variables bad idea. make instead: using (var g = graphics.fromimage(picturebox1.image)) { g.fillrectangle(brushes.tomato, mouseposition.x, mouseposition.y, 50, 100); picturebox1.invalidate(); } the invalidate() call 1 looking for. picturebox can tell changed image property, can't tell changed image content .

Equivalent C code for templatized C++ -

here bubble sort function wrote: template <class iter> void bubble_sort(iter begin, iter end, int (*cmp)(void *, void *)) { bool didswap; { didswap = false; (iter temp = begin; (temp + 1) != end; ++temp) if ((*cmp)((temp+1), (temp))) { std::swap(*(temp+1), *temp); didswap = true; } --end; } while (didswap); } i wondering if possible such thing done in c. comparison function works fine long not used standard stl containers such deque, vector, list, etc. iter begin , iter end worried about. since cannot pointer arithmetic void, how can accomplish this? possible this? you way qsort function it, , pass size type , size of array, pointer start of array. void bubble_sort(void* begin, size_t num, size_t size, int (*cmp)(void*,void*));

testing - Is there a way to hover over webelement without using actions in Selenium? -

most of examples have seen using actions hover on webelement. actions mouseaction = new actions(driver); mouseaction.movetoelement(somewebelement); how do without using actions? right if go webelement.i methods click, submit etc nothing related mouse hover over.

automated tests - Can I define like a main in sikuri? a way to run a serie of sikuri file one by one automatically -

i try make automatic test on sikuli, have many tcs in sikuli files, need file on sikuli run 1 one without human actions, know can batch or sukili file run files, isn't way main in scrip in sikuli? 1) sikuli can use python modules syntax. used in practice. my old module started this: # import import sys sys.path.append("/program files/sikuli") sikuli.sikuli import * # sikuli functions further. then imported module python module in sikuli/python main routine , used it's functions. can put tc in modules , call them "main" module. 2) there works on integrating sikuli robot framework, general purpose testing framework. can google them out. unfortunately, worked sikuli versions before 1.0 , , don't know how going (there 1 developer on sikuli , things don't go smooth). in general, answer "yes, can" (other way or another), can't give clear full details now.

c++ - Private Class within Namespace -

i have class within namespace in header file. class requires template type, , want types used. below shows example. file a.hpp // a.hpp namespace a_ns { template<class t> class { // stuff }; typedef a<double> a_double; } // end of namespace // stuff file b.hpp // b.hpp #include <a.hpp> namespace b_ns { typedef a_ns::a_double b; } file main.cpp // main.cpp #include "b.hpp" int main() { b_ns::b my_b; // <<<--- this! a_ns::a<float> my_a_which_is_not_allowed; // <<<--- not though! d: } so can see rather longed out example, end objective not allow end user declare class a float typename, , able use pre-defined classes specific types, declared typedef a<double> a_double; . i thought example above allow this, wrong, can create a<float> above, because include b.hpp , in turn includes a.hpp ! see problem! (hopefully?) there simple solution, if @ possible. if want able use type a

jquery selector for all elements except attributes in an array -

i have page array: var idlist = ['id1', 'id2', 'id3']; this array references <div> s in html ids. each of these <div> s has class .tabpage . i'm trying write selector targets div.tabpage elements, except ones id in array. found .not() function in jquery documentation, how can multiple values? i'd suggest: $('div.tabpage').not('#' + idlist.join(', #')); js fiddle demo . if prefer more verbose approach, instead use filter (which either remove, or retain, elements selection): $('div.tabpage').filter(function(){ return idlist.indexof(this.id) === -1; }).addclass('jqueryfound'); js fiddle demo . references: array.join() . array.indexof() . filter() .

vb.net - How to check if string a exists in a specified column in database -

this sample access database: id--username--password--accounttype 1---- a123 --1234 --user 2-----b123 --1345 --admin i using vs2012. in vb.net project have username textbox, password textbox, , login button. i add database using wizard. can add, modify, delete, , query, how check if entered username in username text box exists in username column? i filled dataset using: me.userstableadapter.fill(me.wsdataset.users) and if want user type using: me.wsdataset.users.findbyusername(idtxt.text).acounttype but main problem if user not exists error below: an unhandled exception of type 'system.nullreferenceexception' occurred in user login.exe additional information: object reference not set instance of object. how can check if username exists or not? try doing this. dim user = me.wsdataset.users.findbyusername(idtxt.text) if not user nothing 'do want user object else 'message user not exist. end if you

php - Is my Bcrypt encryption safe enough? -

i working on project needs advanced security system when comes saving passwords etc. question is, way save passwords safe enough? this way programmed: when user registers, salt created out of following details: an unique user id (primary key in mysql) the users emailaddress the current (micro)timestamp some random key defined in configuration of website this salt being hashed sha512 key. after salt has been created, following string being hashed using bcrypt: password + sha512 salt (worklevel 10, ($2a$10...)). then skip first 5 characters of bcrypt output ($2a$10) , save remaining string database. when user tries log in, first check if username exists. if does, check if password correct using check() function. i use this bcrypt class encrypt , check. can guys tell me if way of encrypting , verifying enough big project? regards, jan willem there's absolutely no point in deriving salt particular input. in fact, can serve weaken it. salt derived

android - How to set a different java file as launcher -

i new android , have created class in android project other default mainactivity class , want start project file. here added manifest file: <activity android:name="com.example.surfaceview.surfaceviewexample" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.surfaceview" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> and class created: public class surfaceviewexample extends activity implements ontouchlistener { ourview v; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); v=new ourview(this); setcontentview(v); v.setontouchlistener(this); } @override protected void onpause() { // todo auto-generated method stub super.onpause(); v.pause(); } @override protected void onre

maven - SBT dependency on non-SBT library -

my play/sbt project needs depend on third-party java library distributed in source form , can built either ant or maven. root directory contains pom.xml , build.xml . i thinking of having library added git submodule , have sbt build subproject. tried adding externalpom(basedirectory(_ / "pathtolibrary" / "pom.xml")) to build settings, ended following compiler error: [info] compiling 32 scala sources , 5 java sources /home/thesamet/project] [error] (compile:compile) scala.reflect.internal.missingrequirementerror: object scala.runtime in compiler mirror not found. [error] total time: 1 s, completed aug 23, 2013 11:46:20 an external pom can used obtain library dependencies of maven project not compile it. you can add sbt build configuration external project or easier, can publish third-party module corporate maven or ivy repository or local mvn install , add ~/.m2 file resolver sbt project.

jquery - cant get jrumble to work -- causing other script to not function (conflicts) -

i'm trying jrumble work. here jsfiddle: http://jsfiddle.net/tkwum/ here html: <!doctype html> <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.jrumble.1.3.js"></script> <meta charset="utf-8"> <title></title> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <script>jquery.noconflict();</script> <script> $(document).ready(function(){ $('#mainnav').jrumble(); $('#mainnav').hover(function () { $(this).trigger('startrumble'); }, function () { $(this).trigger('stoprumble'); }); }); </script> <body> <!--start

windows - In a batch file, how would I compare a returned value to a value that I set and then return a true or false? -

i want compare first 3 sets or third set of numbers in %ip% home ip. for /f "delims=[] tokens=2" %%a in ('ping shaws104 -n 1 ^| findstr "["') (set ip=%%a) echo %ip% set home=192.168.100.xxx try this: for /f "tokens=1-3delims=." %%a in ("%ip%") set "ipn=%%a%%b%%c" /f "tokens=1-3delims=." %%a in ("%home%") set "homen=%%a%%b%%c" if "%ipn%"=="%homen%" (echo equal) else echo not equal

if statement - How can I repeat the Math.random process until the number is below 0.5? JavaScript -

var randomnum = math.random(); if(randomnum<0.5){ console.log("it me."); console.log(randomnum); } else if(randomnum>=0.5){ **//what do here repeat math.random process until number below 0.5?** } i new using javascript , can't seem figure out how this. want work when number above 0.5 picked, repeats math.random process without doing else until number below 0.5 picked. in end display "it me.", , number picked. possible? if so, can tell me how it? i'm not sure why want this, while loop seems best fit: var randomnum = math.random(); while(randomnum >= 0.5){ randomnum = math.random() } console.log("it me."); console.log(randomnum);

C++ Using RapidXml parsing XML File, Wrapper Class, parse_error expect > -

i'm trying use rapidxml parse xml file. , did following example here . instead of doing parsing in main function, wrote wrapper class called xmlparser parsing job. , gives me headache. the xmlparser.hpp: #include <iostream> #include <string> #include <stdio.h> #include <vector> #include "rapidxml/rapidxml.hpp" using namespace std; using namespace rapidxml; class xmlparser { public: xmlparser() {}; xmlparser(const std::string &xmlstring): xmlcharvector(xmlstring.begin(), xmlstring.end()) { //xmlcharvector.push_back('\0'); parsexml(); } xmlparser(const std::vector<char> &_xmlvector):xmlcharvector(_xmlvector) { /* xmlcharvector.push_back('\0'); */ // done in main.cpp if (xmlcharvector != _xmlvector) //and turns out they're same.... std::cout << "the 2 vectors not equal" << std::endl; else s

html5 - 3D flip with scg path and raphaeljs -

i using raphaeljs draw hexagon shapes using rapheal's .path() method. works pretty well. want rotate shape around y-axis crate 3d flip effect , show "back" of shape when user hovers on shape. far found out, rotatey not yet possible svg, correct? my question is: there way make effect? maybe using css transitions? (this not work in ie < 9) or fake effect using sort of 3x3 transformation matrix? also have found this , not sure if me , how use raphaeljs :( thanks help! nick you can flip object in y axis applying scale(1, -1) transform it. if want animate flip need animate transform gradually scale(1, 1) scale(1, -1) here's simple example of basic concept in raw svg. <svg xmlns="http://www.w3.org/2000/svg"> <g transform="translate(0, 100)"> <path transform="translate(0, -50)" fill="red" d="m 75,10 l 25,90 l 125,90 z"> <set attributename="fill" to="

Scrambled tooltips in visual studio - maybe Resharper -

Image
i using black theme vs, , of tooltips (and inputfields in popup windows) totally scrambled. anybody know can this? it's driving me nuts below:me hovering mouse on breakpoint i having same problem (and search bars additionally being distorted within vs2013), , jods suggested updated graphics drivers , disabled advanced settings graphics options on hardware driver page... didn't quite fix problem alone until did following: i able fix problem disabling "use hardware graphics acceleration if available" within visual studio itself. in visual studio go tools -> options -> environment -> general -> uncheck " automatically adjust visual experience based on client performance ," , uncheck " use hardware graphics acceleration if available " this fixed problem.

Creating a custom round button in android -

can me out here. trying create small round button represent lottery ball using simple self created xml class round_button.xml. keep getting error on , on when ive put code through w3schools validator " error parsing xml: junk after document element." cannot see issue here , maybe missing clear, dont know. please me out. here code: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" /> <solid android:color="#ff0000" </shape> you missing bit of concept of closing tags. have / on android:shape="oval" /> . closing tag @ end </shape> no need use /> . secondly haven't ended <solid tag /> . try like: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shap

python - converting negative float numbers to unsigned int -

im trying send unsigned int data c server python client. requirement send negative float value client. number -5.700 , have 2 problems. 1) dont have clue on how retain negativeness within uint32_t, im using msb flag bit around it. fine? has better suggestions? 2) tried typecasting float 5.700 uint32_t, i.e uint32_t fops = *(uint32_t*)(&float_var) //float_var 5.700 , fops assigned value 0x00..40b66666 being sent python client. how retrieve float value @ client? update: mats suggested python struct unpacks -ve floats there no need use flag bit. the simplest solutions best: make string, , transfer that, rather binary floating point representation. way, don't have worry differences in floating point representation or how make python "understand" binary floating point value. edit1: however, if transfer 32-bit integer python data object: expect floatdata = struct.unpack("f", data) should trick. edit2: documentation struct.unpack (a

Can't convert string to number javascript what is wrong with my code? -

var d_long; var d_lat; a = "37.333941,-121.879065"; var comma = a.search(","); d_lat = a.slice(0,comma); d_long = a.slice(comma+1,-1); math.floor(d_lat); math.floor(d_long); alert(d_lat + " " + d_long); var x = d_lat+d_long; alert(x); thanks guys understand doing wrong. try split instead of weird splice. think use d_lat = number(d_lat); this works: ... var x = number(d_lat)+number(d_long); ... see http://www.w3schools.com/jsref/jsref_number.asp

regex - Regular Expression to select everything before and up to a particular text -

i trying use regular expression find part of string , select string. example if string this/is/just.some/test.txt/some/other , want search .txt , when find select before , .txt . after executing below regex, answer in first capture. /^(.*?)\.txt/

java - How to use the execution time method with try and catch -

i trying measure execution time, not know method before try block or inside?? ublic static void main(string[] args) { long starttime = system.currenttimemillis(); try { searchdetailsdialog dialog = new searchdetailsdialog(null); dialog.setdefaultcloseoperation(jdialog.dispose_on_close); dialog.setvisible(true); } catch (exception e) { e.printstacktrace(); }long endtime = system.currenttimemillis(); long totaltime = ((endtime - starttime)/1000); system.out.println("the execution time is:"); system.out.println(totaltime); } neither. in case best is: long starttime= system.nanotime() ; try { searchdetailsdialog dialog = new searchdetailsdialog(null); dialog.setdefaultcloseoperation(jdialog.dispose_on_close); dialog.setvisible(true); } catch (exception e) { e.printstacktrace(); } { long endtime= system.nanotime() ; double totaltime= ((double)(endtime - starttime)/1000000000)

c# - ASP.NET data binding multiple format -

i have asp.net 4.5 web forms site using ef 5. one of object of data model 'medical file' datetime property (among others): public partial class medfile { public system.guid medfileid { get; set; } public string name { get; set; } public nullable<system.datetime> meddate { get; set; } ... } here snippet of web form editing: <asp:listview id="medfilesform" runat="server" itemtype="medfile" datakeynames="medfileid" selectmethod="getfiles" updatemethod="updatefile"> ... <edititemtemplate> <asp:label id="label1" runat="server" associatedcontrolid="textbox1">name</asp:label> <asp:textbox id="textbox1" runat="server" text='<%# bind("name") %>' /> <asp:label id="label2" runat="server" associatedcontrolid="textbox2&quo

needed: simple way to force json to decode to "normal" iterable python lists -

i've stackoverflow ton , never found need ask question before, , while there lot of threads on subject, can't seem find easy , makes sense. if have somehow missed something, please provide link. here goes: trying pass lists , forth between python client/server using json, condensing problem single block illustrate: import json testdata = ['word','is','bond', false, 6, 99] # prints normal iterable list print testdata myjson = json.dumps(testdata) #prints [u'word', u'is', u'bond', false, 6, 99], contains unicode strings print json.loads(myjson) # iterates on each character, since apparently, python recognize list in myjson: print this seems wrong. passed in iterable list, , got out can't used way. i've seen lot of answers suggest should "deal unicode" fine, if knew how. either need way force json load ascii or utf-8 or something, or way allow python iterate on list containing unicode strings

android - Intent is losing values in extras -

i have gcmintentservice setting details intent , when user clicks on notification. code snippet relevant below: notificationmanager notificationmanager = (notificationmanager) context.getsystemservice(context.notification_service); intent notificationintent = new intent(context, customtabactivity.class); if (noteid != null && value != null) { notificationintent.putextra("noteid", noteid); notificationintent.putextra("value", value); } pendingintent contentintent = pendingintent.getactivity(context, 0, notificationintent, pendingintent.flag_update_current); notification updatecomplete = new notificationcompat.builder(context) .setcontenttitle(title) .setcontenttext(msg) .setticker(title) .setwhen(system.currenttimemillis()) .setcontentintent(contentintent) .setdefaults(notification.default_sound) .setautocancel(true) .setsmallicon(r.drawable.icon) .build(); notificationma

curl - how to get google chrome web browser active tab's Url (vb6) -

i not url chrome version29.because url control can not found using spy++. option explicit private const wm_gettext = &hd private const wm_gettextlength = &he private declare function sendmessage lib "user32" alias "sendmessagea" (byval hwnd long, byval wmsg long, byval wparam long, lparam any) long private declare function getdesktopwindow lib "user32" () long private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname string, byval lpwindowname string) long private declare function findwindowex lib "user32" alias "findwindowexa" (byval hwnd1 long, byval hwnd2 long, byval lpsz1 string, byval lpsz2 string) long private sub command1_click() dim dhwnd long dim chwnd long dim web_caption string * 256 dim web_hwnd long dim url string * 256 dim url_hwnd long dhwnd = getdesktopwindow

Run all scripts in a directory with phantomjs -

using phantomjs, how run scripts within directory? ex: have 3 tests in c:\tests folder. \firsttest.js \secondtest.js \thirdtest.js i have tried below, didn't work phantomjs tests/ phantomjs tests/* can let me know how achieve this? thanks, phantomjs not test framework , neither testing library : provides scripted headless testing of web applications. there no options in phantomjs allow run set of scripts ; there popular projects built on top of phantomjs provide convenient high-level functionality testing purposes. example, casperjs . as said here , it recursively scan passed directory search *.js or *.coffee files , add them stack. a gist available here .

javascript - How to access the functions and objects requireJS module -

i'm working on scripts site uses requirejs , weird syntax i've never seen before. define("app/models/usermodel", ["backbone", "lang/lang"], function (e, t) { var n = e.model.extend({ defaults: { item: "", these: "", arent: "", important: "en", relationship: 0, _position: { c: 0, r: 0 } }, haspermission: function (e) { return this.get("permission") >= e }, gettotalpoints: function () { return this.get("somestuff") } }); i've used require(["app/models/usermodel"]) load module , require("app/models/usermodel").default try , load object , same method try , use functions comes saying don't exist. i've been able access functions in model same way of others does

html - CSS DIV wrapping line height -

Image
i'm setting grid of div's want displayed inline. divs contain , image + text of variable, , ideally divs should constrained fixed width. .playerbox { width: 100px; border: 1px solid; float: left; margin: 10px; } i'm finding on divs text wraps, grid not display inline expected - order of next row(s) affected. example here: http://jsfiddle.net/qc72a/ presume need set line height or similar, not sure of best way handle this. remove float .playerbox , set inline-block instead. can set vertical-align top, middle, or bottom depending on how want them align. http://jsfiddle.net/qc72a/9/

c++ - stl functor with more than 2 arguments -

i working stl don't have c++0x , can't use boost, wonder if there anyway bind 2 or more arguments functor when use std::generate? like #include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std; float f(int x, float y, float z) {return x*(y+z);} int main(void) { std:vector<int> v(100); float x=1.2, y=-3.3; generate(v.begin(), v.end(), bind3argu(f, _, x, y)); // this: '_' vector // suggested, try generate(v.begin(), v.end(), std::bind(f, x, y)); return 0; } i try use std::bind doesn't compile g++ 4.4.6. btw, std::bind being supported in c++0x and/or c++11 only? if intend use functors, try using std::transform . float foo(float z) { float x=1.2, y=-3.3; return x*(y+z); } std::transform(v.begin(), v.end(), v.begin(), foo); the real problem how pass vector value well. had if not case, std::bind useful. std::generate(v.begin(), v.end(), std::bind(f, x,

osx - How to install mcrypt on OS X's natively installed PHP? -

i trying install mcrypt php extension on os x mountain lion 10.8 operating system. os comes shipped apache , php installed. mcrypt extension not come shipped php. want install mcrypt version of php came shipped machine. i not want use homebrew, macports, or similar package manager, , not want install version of php in addition 1 have. want plug mcrypt php came bunded os. feel makes sense, instead of having multiple versions of same program installed, yet every tutorial come across seems use homebrew/macports, , few don't teach how install new php instead of using 1 have. i started following directions laid out on page: http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/ . i downloaded libmcrypt-2.5.8.tar.gz sourceforge. i extracted contents following command: tar -zxvf libmcrypt-2.5.8.tar.gz . i entered libmcrypt-2.5.8 directory created , issued following commands: ./configure , make , , sudo make install . now

java - Serious problems with Bukkit plugin [unexpected behavior] -

hello once again stackoverflow! having hardest time plugin reason. here issues. have game class method tick post it, dose not seem work right not send debug message player @ all! , noticed there concurrentmodificationexception on list holds class game. i'm not sure causing concurrentmodificationexception because glanced on code , not appear modifying list within iteration. didnt want show code feel need show bit of it. if on these segments , try shed light on grateful! if 1 point out causing concurrentmodificationexception awesome , if 1 explain me why p.sendmessage("test!"); dosent seem occur @ all. the concurrentmodificationexception fixed! segment class main: public class main extends javaplugin implements runnable { //holds active games public static arraylist<game> games = new arraylist<game>(); private commandhandler cmdhandler = new commandhandler(this); private thread thread = new thread(this); private boolean serveractive = true; public vo

Not able to send .csv file with email in android -

i going attach ".csv" in mail , send it. facing problem csv file not available @ receiver side. i have tried many mime types application/octet-stream, text/comma-separated-values, text/csv, application/csv, application/excel, application/vnd.ms-excel, application/vnd.msexcel but file not attached mail. below code have used send mail public boolean sendemail() { boolean success = false; intent intentsendmail = new intent(intent.action_send); file mydir = getapplicationcontext().getdir(global.foldername, context.mode_private); file filewithinmydir = new file(mydir, global.filename); if (!filewithinmydir.exists() || !filewithinmydir.canread()) { toast.maketext(this, "attachment error", toast.length_short).show(); success = false; } else { intentsendmail.settype("text/csv"); intentsendmail.putextra(intent.extra_stream, uri.fromfile(filewithinmydir)); intentsendmail.putextra(inte

javascript - ASP.NET MVC: jQuery UI and other scripts loaded unexpectedly -

i've got asp.net mvc project on run. on page load, easing function of easeoutquad used. however, when load page, says there no function called easeoutquad, no doubt, means jquery ui library has not been loaded properly. other times works well. i've checked loading order in output source code couple of times, , can assure order - jquery, jquery ui, inline script, shouldn't key problem. insight issue? ps: connection quality may associated phenomenon. given still don't know how avoid it. without single example of code it's tough say. however, guessing, given nature of issue, call easeoutquad not wrapped in jquery document-ready method. try this: jquery(document).ready(function($) { //your call easeoutquad }); if wrapped in call, or doing not affect issue, please post enough code replicate issue can of further help.

javascript - iframe contentDocument: Access is denied -

the following code runs part of bookmarklet. creates iframe , tries access iframe. for sites on ie (tried ie 10) fails access denied iframedoc = i.contentdocument || i.contentwindow.document; i've put call inside setinterval, seemed work sites. apparently needed bit of time. an example of site not work this site var i=document.createelement('iframe'); i.setattribute('id', 'my_id'); i.setattribute('name', 'my_name'); document.body.appendchild(i); var intervalid = setinterval( function(){ try{ var iframedoc = i.contentdocument || i.contentwindow.document; clearinterval(intervalid); alert("success!"); } catch(e){} }, 10 ); i need access in order attach form , script submits form. i've tried adding them iframe before adding iframe body, not work.

jquery - Source map request causes 404 error -

after updating chrome 29 have noticed browser try jquery.min.map app root. request before received assets (small reputation don't let me post screen image proofing). of course, can switch off source maps in browser settings @ question , maybe there's true way? , difference in case source map received assets. source maps loaded chrome when developer tools opened, shouldn't issue users.

lidar - C# using liblas.dll (unable to load DLL) -

i need read las file using c# project. i using liblas library project read las file , getting error: (unable load dll 'liblas1.dll': specified module not found. (exception hresult: 0x8007007e)). any help? you need add dll file location can found program. first thing, find file. next, add reference in visual studio , adjust properties copied if newer.

html - css: why texts will move up after remove position:absolute -

Image
html code: <!doctype html> <html> <head> <style> h2 { position:absolute;} </style> </head> <body> <h2>this heading absolute position</h2> </body> </html> question: if remove line: position:absolute; , texts in <h2>...</h2> move up, why? in default view, without css... when position: absolute; there, margins not collapsed. when remove position: absolute; , margins collapse, , gets mingled body's margin.

c++ - SFML Audio not Working -

i using sfml earlier , decided play around audio settings. made instance of sf::music , tried play sound. got error came saying "the program can't start because openal32.dll missing computer. try reinstalling program fix problem." making project ludum dare if common problem don't want have use this. first off, openal32.dll? common problem? , alternative can use in c++ playing audio? thanks! openal audio api sfml using internally. have make users install openal dll s, official site appears offline. can try googling working link download openal package.

set up javafx scene with multiple nodes -

Image
i trying set javafx scene, have failed miserable. trying per attached photo. i have tried set gridpane , position gridpane withing can set boxes , labels not working properly. i not want use fxml. can guys recommend how go set up. the javafx scenebuilder tool create layouts 1 want have. take @ official website . tool creates fxml file can load in applications start() method using: @override public void start(stage stage) throws exception { parent root = fxmlloader.load(getclass().getresource("application.fxml")); scene scene = new scene(root); stage.setscene(scene); stage.show(); } another resource can familiar scenebuilder #java , #oraclelearning channels on youtube .

ubuntu - Core dump with PyQt4 -

i starting pyqt4 , facing coredump when using qgraphicsscene/view in easiest of examples: #!/usr/bin/python import sys pyqt4.qtcore import * pyqt4.qtgui import * app = qapplication(sys.argv) grview = qgraphicsview() scene = qgraphicsscene() grview.setscene(scene) grview.show() sys.exit(app.exec_()) the program runs, when closing it gives tons of gtk errors (using ubuntu) , core dump (segmentation fault): (python:2732): gtk-critical **: ia__gtk_container_add: assertion `gtk_is_container (container)' failed (python:2732): gtk-critical **: ia__gtk_widget_realize: assertion `gtk_widget_anchored (widget) || gtk_is_invisible (widget)' failed (python:2732): gtk-critical **: ia__gtk_widget_realize: assertion `gtk_widget_anchored (widget) || gtk_is_invisible (widget)' failed (python:2732): gtk-critical **: ia__gtk_container_add: assertion `gtk_is_container (container)' failed (python:2732): gtk-critical **: ia__gtk_widget_realize: assertion `gtk_widget_anchore