Posts

Showing posts from March, 2015

angularjs - Broken 2 Way Data Binding -

going through forms angular2 tutorial . , part code isn't doing tutorial explains should happen. before reach conclusion angular2 beta has bug maybe try out. it's problem around 2 way data binding of "powers dropdown" user input change isn't being reflected in model. 2 way binding occurs with: <select class="form-control" required [(ngmodel)]="model.power"> edit: see full code here when run code keep eye on "{"id":18,"name":"dr iq","power":"really smart","alterego":"chuck overstreet"} " output. notice changes edit 2 txt inputs changes dropdown not reflected in output.

ios - Swift/CoreData - Variable reference changes after initializing -

i'm getting feet wet coredata using swift , coming across doesn't make sense me. basically i'm building simple map app user can drop pin, select info button annotation view, , add location "favorites" list. want keep list between sessions. i have in appdelegate: func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. self.datacontroller = datacontroller() return true } datacontroller() code located deals with....you guessed it. data. have init() , 1 other function adds data. this code takes info , uses function in datacontroller class add data data set let defaultaction = uialertaction(title: "ok", style: .default, handler: { (action) -> void in let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate appdelegate.datacontroller.additemtodata(self.locat...

sql server - Passing variable into xp_cmdshell -

i have stored procedure in sql server checks today's backup files (files has date in filename). after checks, move on robocopy these files folder. the challenge: in folder, there files yesterday's or other dates. today's bak files required transfer. --@day allows me capture day of month declare @day char(2) set @day = right('00' + convert(nvarchar(2),datepart(day,getdate())),2) --print @day --in "myfolder", might containts files --project_backupfile_01_2006_02_28_001.bak --or project_backupfile_01_2006_02_27_001.bak --currently need hard code 28 represent 28th. how pass in @day? exec master..xp_cmdshell 'dir d:\myfolder\project*28*.bak/b' --similarly, pass in @day variable --project_backupfile*02_*@day.bak -- copy backup fules ftp local drive exec master..xp_cmdshell 'robocopy "d:\source" "e:\mssql\restore\" project_backupfile*_02_28*.bak /nfl /ndl /copy:dat /r:2 /w:1 /xo /e /z /mt:10' use variabl...

decision tree - Arguments length error when trying to test model using party package in R -

i have divided data set 2 groups: transactions.train (80% of data) transactions.test (20% of data) then built decision tree using ctree method party package follow: transactions.tree <- ctree(dt_formula, data=transactions.train) and can apply predict method on training set , use table function output result follow: table(predict(transactions.tree), transactions.train$satisfaction) but problem occurs when try output table based on testing set follow: testpred <- predict(transactions.tree, newdata=transactions.test) table(testpred, transactions.test$satisfaction) and error follow: error in table(predict(pred = svm.pred, transactions.tree), transactions.test$satisfaction) : arguments must have same length i have done research on similar cases suggested omitting na values did without changing error outcome. can me poniting out what's problem here?

Cannot post variable from android client to php server -

i develop android code transmit , received between android apps , php. received part based on json, working. have tested set variable manually in php code. however, when have posted variable android php, cannot receive it. can tell me problem ? @override protected string doinbackground(void... params) { arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("username", <your username here>)); try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(<your url php file>); httppost.setentity(new urlencodedformentity(namevaluepairs, "utf-8")); httpresponse response = httpclient.execute(httppost); // execute post url string st = entityutils.tostring(response.getentity()); // result php web log.d(tk_configuration.tag, "in try loop" + st); // still executing final...

sql - postgresql insert or create with temp table merge -

i have 3 tables: a b , c . b temp table created output of csv . goal copy necessary values b a but 1 of attributes has created or selected c . so far have with table_c_data ( insert table_c (id) select table_c_id table_b b not exists (select * table_c c b.table_c_id = c.id) returning * ) insert table_a (w,x,y,z) select table_c.id, x, y, z table_b inner join table_c_data table_c on table_b.table_c_id = table_c.id; but having trouble figuring out how have original table_c_data return if record does existing. (before added in where clause specifying existing query ran expected, trying handle uniquness constraints have check whether record exists first)

go - Golang unmarshal json map & array -

after reading json , go , understand basics of decoding json in go are. however, there problem input json can map & array of maps. consider following problem: package main import ( "encoding/json" "fmt" ) func main() { b := []byte(`[{"email":"example@test.com"}]`) c := []byte(`{"email":"example@test.com"}`) var m interface{} json.unmarshal(b, &m) switch v := m.(type) { case []interface{}: fmt.println("this b", v) default: fmt.println("no type found") } json.unmarshal(c, &m) switch v := m.(type) { case map[string]interface{}: fmt.println("this c", v) default: fmt.println("no type found") } } now, how value email : example@test.com in both cases( b & c ) question: if json array, want loop on each & print email. if json map, want print email directly pla...

How to access detailed Java EE application deployment status on JBoss AS 7? -

im trying write small "watchdog" *.war monitors deployment state of (much larger) *.ear on jboss 7.1.3 how @ exact deployment state of *.ear? i know can (using jboss msc classes): servicecontainer sc = currentservicecontainer.getservicecontainer(); //jboss msc servicecontroller earcontroller = sc.getservice(services.deploymentunitname("my.ear")); return "my.ear - "+earcontroller.getmode()+"-"+earcontroller.getstate()+"-"+earcontroller.getsubstate(); but give me all-green if deployment failed. exmaple - have @startup @singleton, who's @postconstruct method (called part of boot) throws exception. @ point deployment has logically failed (initialization threw exception) yet jboss mark .ear deployed - both using marker files in deployment directory ( .isdeploying --> *.deployed) , using values controller above. jboss have containerstatemonitor class keeps list of services missing dependencies need - @singletons fails st...

android - /arm64/Image to zImage or boot.img -

hello have been trying figure out how make android kernel zimage or boot.img. i tried figure out no luck. told zimage isnt possible device because arm64 kernel thought ask again. if that’s case i'm trying boot.img compiled can fastboot it. this lg v10. thanks, zach there no way other hack naming convention inside kernel. 64 bit arm kernels compiled under name of "image" 32 bit arm kernels compiled under name of "zimage"

Upload Files to a particular Folder in Ruby On Rails 4 -

i using working on particular module in ruby on rails, want upload files particular folder. if it's possible, please share examples may me achieve functionality? as @dharam mentioned. can use paperclip. working example can find here demo if want specify folder path attachments should move. need write in model has_attached_file :attachment, :path => ":rails_root/attachments/:id/:style/:basename.:extension" after attachments seen in attachments folder in application root

Android recyclerview endless scroll listner onScrolled() getting called twice -

this how setting recyclerview. mrecyclerviewrides = (recyclerview) findviewbyid(r.id.recyclerviewrides); // use setting improve performance if know changes // in content not change layout size of recyclerview mrecyclerviewrides.sethasfixedsize(true); // use linear layout manager mlinearlayoutmanager = new linearlayoutmanager(getapplicationcontext()); mrecyclerviewrides.setlayoutmanager(mlinearlayoutmanager); mridelistadapter = new findridelistadapter(getapplicationcontext(), mrecyclerviewrides, mridedetailarraylist, mimageoptions, mimageloader, this); mrecyclerviewrides.setadapter(mridelistadapter); mrecyclerviewrides.addonscrolllistener(new endlessrecycleronscrolllistener(mlinearlayoutmanager) { @override public void onloadmore(int current_page) { log.e(tag,"scroll count ==> "+(++mintscrollcount)); if(!flagfirstload) { moffset = moffset + mlimit; getridelist(moffset, ...

mysql - How do I join these two SQL queries? -

i'm using mysql , mssql , i'm trying join these 2 queries together. query 1 (select rep.rep_num, rep.first_name, rep.last_name rep, customer) query 2 (select customer.rep_num, sum(customer.balance) rep_balance customer group customer.rep_num) i've seen can treat these 2 tables , join them i'm having trouble getting work. way trying join them i'd aggregate errors trying select rep first , last name while using balance sum. thanks in advance! select r.rep_num, r.first_name, r.last_name rep r inner join (select c.rep_num, sum(c.balance) rep_balance customer c group c.rep_num) t on r.rep_num = t.rep_num

ios - MBProgressHUD not updating progress -

i importing multiple photos photos library , want show progress using mbprogresshud . using qbimagepickercontroller import photos. photos imported successfully. progress bar in mbprogresshud not updating. following code -(void)qb_imagepickercontroller:(qbimagepickercontroller *)imagepickercontroller didselectassets:(nsarray *)assets { if (imagepickercontroller.filtertype == qbimagepickercontrollerfiltertypephotos) { mbprogresshud *hud = [mbprogresshud showhudaddedto:self.navigationcontroller.view animated:yes];] // set determinate mode show task progress. hud.mode = mbprogresshudmodedeterminatehorizontalbar; hud.delegate = self; hud.labeltext = nslocalizedstring(@"importing photos", nil); hud.dimbackground = yes; hud.detailslabelfont = [uifont systemfontofsize:12.0f]; hud.detailslabeltext = nslocalizedstring(@"please wait...", nil); hud.progress = 0.0f; [self importphotosforarray:assets]; } [self dismissim...

css - How can we keep the font scaling up and down but make it not so context sensitive? -

deep project having problems use of em's in our font-size. have several markup modules reusing in different contexts . constant head aches calculated font-size being different in different contexts. using em's important using responsive design. scalability of font-size must have. please see jsfiddle simple example. how can keep font scaling , down make not context sensitive? inheritance can quite annoying, espcially when working ems. know context class names should able overcome problem applying simple maths. let's take in .context1 ideal, css looks like: .context1 { font-size: 1em; } .context2 { font-size: 1.5em; } .my-font-size { font-size: 3em; } in case, first heading 3em , second 4.5em because parent defined being 1.5x bigger. around this, following: .context1 { font-size: 1em; //default font size .context1 } .context2 { font-size: 1.5em; //default font size .context2 } .my-font-size { font-size: 3em; //default fon...

java - How to find the number of runnables waiting to be executed -

is there way know @ given point in time how many runnables waiting executed executorservice . example, assuming loop invoking execute method faster runnable can complete , surplus accumulates, there anyway running count of accumulated runnables? executorservice es = executors.newfixedthreadpool(50); while (test) { es.execute(new myrunnable()); } is there way know @ given point in time how many runnables waiting executed executorservice. yes. instead of using executors... calls, should instantiate own threadpoolexecutor . below executors.newfixedthreadpool(50) returning: threadpoolexecutor threadpool = new threadpoolexecutor(50, 50, 0l, timeunit.milliseconds, new linkedblockingqueue<runnable>()); once have threadpoolexecutor , has number of getter methods give data on pool. number of outstanding jobs should be: threadpool.getqueue().getsize(); also available threadpoolexecutor are: getactivecount() getcompletedtaskcount() ge...

java - Function in a for loop not randomizing -

i have function run 10 times in loop, supposed randomize , give random ores, right script gives 10 copper ore public void mineore() { int ore = (int) math.random() * 10 + 1; if(ore ==1) { inventory.addinventory("copper ore"); } else if(ore ==2) { inventory.addinventory("iron ore"); } else if(ore ==3) { inventory.addinventory("steel ore"); }else if(ore ==4) { inventory.addinventory("gold ore"); }else if(ore ==5) { inventory.addinventory("iron ore"); } else if(ore > 6) { } } i have function running on this (int = 0; < 10; i++) { mineore(); } how can fix mineore randomizes? right feels math.random() runs once , uses...

python - ZeroDivisionError: 0.0 to a negative or complex power -

i wanted find integral ((sin x)^8, {x,0,2*pi}) , tried write simple program, without external modules "math", calculate taylor series , summarize interval (0,2*pi) errors traceback (most recent call last): file "e:\python\shad\sin.py", line 27, in <module> sum+=(ser(i*2*3.1415926/k))**8 file "e:\python\shad\sin.py", line 21, in ser sin_part+=((-1)**(j-1))*(a**(2j-1))/(fact(2*j-1)) zerodivisionerror: 0.0 negative or complex power suddenly occurs. , don't see divided 0 or have power of complex number, variables have real positive value. "k" value both terms of series quantity , interval (0,2*pi) division. sum=0 k=20 res=0 def fact(t): if t==0 or t==1: res=1 else: res=1 l in range(2,t+1): res=res*l return res def ser(a): sin_part=a j in range(2,k): print fact(2*j-1) sin_part+=((-1)**(j-1))*(a**(2j-1))/(fact(2*j-1)) print ...

Trouble passing struct pointers in C to create a sequential list -

i have struct defined here typedef struct { char name[10]; int idbadge; } employee; i want populate 1 instance of struct using function call: void employeecall (char *name, int badgenumber, employee *e){ e = (employee *)malloc(sizeof(employee)); strcpy(e->name,name); e->idbadge = badgenumber; } and then, want retrieve given piece of information using call this: int employeebadge (employee e){ return(e.idbadge); } i call these functions main bellow: int main(void){ employee a; int badgenumber; int badgenumbera = 1028; char *nameptra = "fred"; employeecall( nameptra, badgenumbera, &a ); badgenumber = employeebadge(a); printf("%d\n",badgenumber); return 0; } when call them, compiles correctly however, return on employeebadge incorrect. returns int if nothing placed struct; badgenumber = 32767 how possible create struct variable can passed both value , reference? need employee variable...

Android data receiving in back ground -

in application need data internet. need process method in ground splash screen , after splash screen disappear too. public class splash_screen extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_splash__screen); progressbar p_bar=(progressbar)findviewbyid(r.id.progressbar1); thread thread=new thread(new runnable() { @override public void run() { data_receiver receiver=data_receiver.getinstance(); receiver.access_parser(); } }); thread.start(); new handler().postdelayed(new runnable() { @override public void run() { intent main_window=new intent(com.burusoth1990.advertise.splash_screen.this,com.burusoth1990.advertise.mainactivity.class); startactivity(main_window); } ...

java - Eclipse Apache Axis codegen plugin - having trouble installing -

i'm trying desperately wsdl2java plugin apache installed in eclipse 4.3 installation, i'm not having luck. i've followed instructions @ http://axis.apache.org/axis2/java/core/tools/eclipse/plugin-installation.html , nothing doing. i've tried dropins, plugins, , still no luck. don't receive error messages, neither plugin appear in preferences or in use case (as described on apache site). i'm sure solution dead simple, appreciate help. thanks, brian

ms access - SQL Alternative to For Loop -

i'm working sql in access. i'm not of programmer, i'm familiar using vba sql basics. what i'm trying accomplish equivalent in sql of loop used in visual basic. know isn't "technically" possible in sql , may not best method i'm looking advice. know can accomplished i=1,2,3, etc. using unions , repeating query each value. inefficient , gets complex evaluated. basically need method query i=1 repeat , again output data i=2 , on. using group not option because there several subqueries involved well. thanks in advance! without lot of context, can't provide better answer, can accomplish of loop in sql. declare @ctr integer set @ctr = 1 while @ctr < 1000 begin --do logic select @ctr = @ctr + 1 end but isn't efficient use of sql. should able write need without iterating on it. think in sets , along better rdbms.

highcharts - Exported Image Does Not Match Current Display On Web Page -

we using highstock 1.3.1 , java+phantomjs export server (using same version of exporter highstock). create charts on page. allow user show/hide series or change type of series (bar/line/scatter). have menu lets user select kind of export make: <select size="4" name="ctl00$main_content$ctlmainresultsgraph$lstexportoptions" id="ctl00_main_content_ctlmainresultsgraph_lstexportoptions" class="chartmainmenu_body" onchange=" var chart = $('#chartmain').highcharts(); switch (this.value) { case 'jpeg': chart.exportchart({type: 'image/jpeg'}); break; case 'png': chart.exportchart({type: 'image/png'}); break; case 'svg': chart.exportchart({type: 'image/svg+xml'}); break; case 'pdf': chart.exportchart({type: 'application/pdf'}); break; }" style="text-align:left;font-...

mod proxy - apache2 proxypass for neo4j webadmin -

i'm trying neo4j admin running through mod_proxy , can add password. instructions on http://docs.neo4j.org/chunked/milestone/security-server.html seem clear, , followed them. the new webadmin seems working on http://[my-domain]/neo4jdb/webadmin/ . queries not executed. i've opened neo4j server other ip-adresses, , on http://[my-domain]:7474/webadmin/ , works fine, including querying. the lines in apache.conf proxypass /neo4jdb/webadmin/ http://localhost:7474/webadmin/ proxypassreverse /neo4jdb/webadmin/ http://localhost:7474/webadmin/ what missing here? there no errors in browser console, button doesn't anything.

javascript - What is for(;;) in Facebook long poling request? -

this question has answer here: empty loop - for(;;) 4 answers hi have question means for (;;); in facebook long polling request ? statement in every file long polled facebook server. thank you no way infinite loop executed; try in console. simple operation integer incrementing freeze screen: var = 1; (;;) { a++; } it may small trap tries eval script, or something.

loops - Assembler code in C for Raspberry -

i tried make loop detect high level on gpio17 of raspberry pi. did in c, turned out counts slow therefore tried make loop in asm not work properly. here asm part: asm volatile( "mov r0,#17;" "ldr r1,=0x20200000;" "mov r4,#1;" "loop: ldr r2,[r1,#34];" "lsr r2,r2,r0;" "and r3,r2,#1;" "cmp r4,r3;" "bne loop;" );

python - Appending to CommaSeperatedIntegerfield in django -

i created model has commaseparatedintegerfield models.py class forumposts(models.model): .... path = models.commaseparatedintegerfield(blank=true,max_length=50) ... i want use model , defined view below views.py def create_forum_post(request, ..): ... forumpost.path.append(forumpost_id) ... i encountered situation had append forumpost_id integer path defined commaseperatedintegerfield. while debugging got error 'unicode' object has no attribute 'append'. i think might due lack of comma tried lot of variations of same code unable add forumpost_id path. in advance commaseparatedintegerfield 's value not deserialized automatically, feature of field type validation (it must comma seperated integers). you need retrieve field value, deserialize it, append new integer, serialize , save back. edit 1: example: class forumposts(models.model): # ... def append_to_path(self, value): path_list = self.p...

jquery - javascript if something has css attribute of value -

i execute animation when page loads when css attribute has value of something. animation works fine without if statement. here code: $(document).ready(function() { if($("h1").css('font-size') == '36px'){ $("h1").animate({ "font-size" : "20px" }, 750); } }); from comments op, appear stray rule in stylesheet has caused font-size set other expected. the way determine can done browser's dom inspector. generally, can right click element, hit inspect (or it) , see value being set. here more specific how-to's using these: chrome - https://developers.google.com/chrome-developer-tools/docs/elements firefox - https://developer.mozilla.org/en-us/docs/dom_inspector/introduction_to_dom_inspector internet explorer - http://msdn.microsoft.com/library/gg589507(vs.85).aspx

ios - Can't open Xcode project in Xcode 4.5 after opening it in Xcode 5 -

Image
i'm working ios programmer on project. other programmer installed xcode 5 on computer , opened project. after sent me project, can't open in older xcode 4.5. first got following error: the document "mainstoryboard.storyboard" not opened. not read archive. please use newer version of xcode. consider changing document's development target preserve compatibility. then opened storyboard in source code , changed version 3.0 2.0 (and later 1.0). after that, tried open storyboard in interface builder , got following error: the document "mainstoryboard.storyboard" not opened. failed unarchive element named "tableviewcellcontentview". edit document newer version of xcode. do have idea or suggestion? this works me xcode 4.5.1: open storyboard file source code, change version 3.0 2.0 , replace occurrences of 'tableviewcellcontentview' 'view'

regex - Problems to convert a QString to QDateTime -

i have problem convert qstring qdatatime -object. the string looks like: "2008:09:23 14:18:03 , have length of 20. problem is, if remove first character output looks like: "008:09:23 14:18:03 . that's wrong it? can delete characters without numbers? the code: qdatetime date; qstring d=qstring::fromstdstring(result.val_string); date.fromstring(d,"yyyy:mm:dd hh:mm:ss"); qdebug()<<d; qdebug()<<d.length()<<date.tostring(); and output: "008:09:23 14:18:03 19 "" greetings the double quotes printed qdebug , not included in qstring itself. however, seems have non-printable character @ end of original string deletes closing " sign. try copy first 19 characters qstring : qstring d = qstring::fromstdstring(result.val_string.substr(0, 19)); date.fromstring(d,"yyyy:mm:dd hh:mm:ss"); qdebug()<<d; qdebug()<<d.length()<<da...

linux - __ANDROID__ not defined when building valgrind for android -

when try configure valgrind android get: platform variant: vanilla primary -dvgpv string: -dvgpv_arm_linux_vanilla=1 i figured out looking @ configure.in must case because of: ac_egrep_cpp([bionic_libc], [ #if defined(__android__) bionic_libc #endif ], glibc_version="bionic") the glibc_version not being set "bionic", __android__ must not defined. how can fix this? commands running are: export ndkroot='/home/matt/desktop/android-ndk-r6' export hwkind=emulator export ar=$ndkroot/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ar export ld=$ndkroot/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld export cc=$ndkroot/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc cd '/home/matt/desktop/valgrind-3.8.1' ./autogen.sh cppflags="--sysroot=$ndkroot/platforms/android-3/arch-arm -dandroid_hardware_$hwkind" cflags=...

Regex syntax to deal with carriage returns in php -

i've been working on coming regex syntax deal making string patterns clickable links form. carriage returns causing problems regex pattern , need understanding how omit them. example, if enter text text area; http://www.google.com http://www.google.com www.google.com google.com this output before regex pattern sees it; http://www.google.com\r\nhttp://www.google.com\r\nwww.google.com\r\ngoogle.com i need able remove \r\n characters hyperlinks. regex looks this; function make_links_clickable($message) { return preg_replace('!(((.*www\.)?(f|ht)tp(s)?://)?[-a-za-zа-яА-Я()0-9@:%_+.~#?&;//=]+)!i', '<a href="http://$0" target="_blank">$0</a>', $message); } can tell me how remove leading \r\n characters in regex? an easy way split on new lines, , run regex on each piece. observe: function make_links_clickable($message) { $result = array(); foreach(explode(php_eol,$message) $m) ...

javascript - Game's success conditions never executes -

i'm trying write countdown timer function checks see if game's success conditions have been met. if are, function executes success function, , if not continues counting down until 0. my problem if statement game variables ( nimbus_char_count , nimbus_line_count doesn't ever seem evaluate false. i'm not sure why. suggestions? thanks. var nimbus_char_count = 3; var nimbus_line_count = 4; var = 2; var j = 2; function set_char(increment) { //incrementally adds nimbus_drop class successive characters if (increment === 1 && nimbus_char_count < 3) { nimbus_char_count = nimbus_char_count + 1; $("#nimbus_character_count").html(nimbus_char_count); $("#nimbus_char" + (nimbus_char_count - 1)).addclass("nimbus_drop"); } else if (increment === -1 && nimbus_char_count > 0) { nimbus_char_count = nimbus_char_count - 1; $("#nimbus_character_count").html(nimbus_char...

ios - Objective-C Download PLIST and use within table -

Image
i'm new objective-c programming. i'm trying build app personal use view event info contained on web server. wish each event title string shown separate row within uitableview. i'm using cfpropertylist create plist mysql. here's plist looks like: i'm downloading plist so: nsstring *stringurl = @"http://www.example.com/events.plist"; nsurl *url = [nsurl urlwithstring:stringurl]; nsdata *urldata = [nsdata datawithcontentsofurl:url]; if ( urldata ) { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filepath = [nsstring stringwithformat:@"%@/%@", documentsdirectory,@"events.plist"]; [urldata writetofile:filepath atomically:yes]; } then how i'm trying load info arrays: events = [[nsdictionary alloc] initwithcon...

session - PHP $_SESSION's Not Working in Cloud9 IDE -

first timer on fronts here. i've done digging , i'm ready post it. can't seem session variables carry over. i've read, header(location:) can pretty wonky stuff , code may not done. session_start(); @ top of every page. heres page 1: <?php session_start(); include "/header.php"; $username = $_post["user"]; $db = new sqlite3("../../database/login.db"); $password = md5($_post["password"]); $userquery = $db->querysingle("select username accounts username='$username';"); $passquery = $db->querysingle("select password accounts username='$username';"); $loggedin = false; i call session variable here on same page (1): if ($loggedin == true) { $_session['user'] = $username; header('location: ../test.php'); } then on logged in page (2) header references have: <?php session_start();?> <?php include "header.php";?> <html> <hea...

html - Flickering issue when overlaying a div on hover of another div -

apologies if title confusing. i've got div which, on hover, activates second div display:block , displaying above underlying div. works except flickering experience when moving cursor on second div. another minor issue second div disappears fraction of second when it's clicked. check jsfiddle example: http://jsfiddle.net/ub82s/1/ ** view fiddle ** change html be: <div class="product-main"> <div id="img-container" class="img-container"> <div class="feature-product-img" id="feature-product-img" style="display: block;"> <a href="http://www.spinnakerextreme.com/2012-tt-isle-of-man-official-review-blu-ray-and-dvd.html" title="2012 tt isle of man official review blu ray , dvd"> <img class="product-img" src="http://www.spinnakerextreme.com/media/catalog/product/p/r/product_2_bg.png" alt="2012 tt isle of ma...

ios - Small gap between UINavigationBar and UISearchBar -

Image
i added uisearch programmatically app , uinavigation bar added in interface builder. when added search bar left tiny gap between search bar , nav bar. there way merge them together? thanks. self.searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0.0, 0.0, self.view.bounds.size.width, 44.0)]; self.searchbar.delegate = self; self.searchbar.autoresizingmask = uiviewautoresizingflexiblewidth; self.searchbar.showscancelbutton = no; [self.view addsubview:self.searchbar]; if making sure searchbar right under navigation bar, use autolayout so: self.searchbar = [[uisearchbar alloc] init]; self.searchbar.translatesautoresizingmaskintoconstraints = no; self.searchbar.delegate = self; self.searchbar.showscancelbutton = no; [self.view addsubview:self.searchbar]; id toplayoutguide = self.toplayoutguide; uisearchbar *searchbar = self.searchbar; //updated [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|[searchbar]|" options:0 metr...

javascript - Speed up the loading time for html, pdf and txt files within <object> tag -

i have embedded html e-book in object tag can view jq mobile app, been successful problem it's taking average of 40 seconds load, there way can make load faster? below code, further below scripts. i have tried: <div data-role="page" data-dom-cache="true"> no luck, appreciated. thank you. code below. <div data-role="page"> <div data-role"header"></div> <div data-role="content"> <div data-role="collapsible-set"> <div data-role="collapsible" data-icon="arrow-r"> <h3>agriculture <img src="images/icons/agriculture.png" alt="agripic" id="listicon"> </h3> <ul data-role="listview" data-filter="true"> <li> <object data="data/test.html...

css - Hiding column in print out from IE9 -

in our application have webgrid reference column never shown. column hidden via css, , works fine major browsers. when printing though, hiding column same way in our print.css in main.css, column hidden in chrome, firefox , ie through ie8, shows in ie9. even more annoying, using developer tools, if switch both browser mode , document mode ie8, print works, , switching both ie9, print out hides column correctly. correct behavior persists until close out of ie entirely. know has switched ie9 mode though because formatting changes between versions. reason, expected behavior shows after switching ie9 mode older mode. here's css i'm using hide column (it's 11th column in webgrid): #gridrequestmanagement table tr th + th + th + th + th + th + th + th + th + th + th { width:0 !important; display:none !important; } anybody have insights on what's going on here? thanks in advance! this never possible resolve in above manner, , seems others have fou...

MATLAB: New variables / variable name in loop -

this extremely remedial question, apologize in advance, i'm pretty new matlab , keep getting stumped @ simple problem. so, have arbitrary matrix (d) denotes directed network: d = [0,1,1,0,0,0,0; 0,0,0,1,1,0,0; 0,0,0,0,1,0,0; 0,0,0,0,0,1,0; 0,0,0,0,0,1,0; 0,0,0,0,0,0,1; 0,0,0,0,0,0,0] n = length(d); all want count out-degree of each node. can calculated using command: o = cumsum(d,2); o1 = (1,n); ... n in d... i trying write loop command script counts out-degree of each node in network , when doing creates new variable. wrote following loop command: o = cumsum(d,2); i=1:n o_i = o(i,n) end however, keep updating same variable 'o_i' opposed creating new variables, 'o_1,...,o_7' :( . is there way create new variable each loop?? many thanks, owen what want array, thankfully, matlab quite that, can use o(i) , it's better initialize first: o=zeros(size(d,2),1) . that been said, in case need sum func...

installer - NSIS - Require admin permission -

i want create dual installer application, install portable or normal version. for portable version, don't want require admin rights. normal version need them adding application startmenu , other things. is there way promt admin rights when starting actual installation? maybe plugin? "requestexecutionlevel admin" inside section. thanks! requestexecutionlevel highest force members of administrator group elevate while normal users can run no uac interaction. example not elevate because doing tricky, uac broken in scenarios , require more code correctly... requestexecutionlevel highest var instmode !include nsdialogs.nsh !include sections.nsh !include logiclib.nsh page custom installmodepageinit installmodepageleave page instfiles section "startmenu shortcuts" sec_sm ; createshortcut ... sectionend section "" sec_uninst ; writeuninstaller & registry sectionend function installmodepageinit nsdialogs::create 1018 pop $0 ${nsd_c...

c++ - Emit Signal Only When QCheckBox is Checked -

i creating set of qcheckbox dynamically based on user input so: qwidget *wid = new qwidget(); qvboxlayout *layout = new qvboxlayout(); for(int i=0; i<numbermodes; i++) { int k = amplitudes(i,0); int m = amplitudes(i,1); qstring ks = qstring::number(k); qstring ms = qstring::number(m); qstring position = qstring::number(i); qstring mode = "a"+ks+ms; qcheckbox *check = new qcheckbox(mode); connect(check, signal(toggled(bool)), &mapper, slot(map())); connect(check, signal(toggled(bool)), &selectmodes, slot(map())); mapper.setmapping(check,position); selectmodes.setmapping(check,mode); layout->addwidget(check); updategeometry(); } wid->setlayout(layout); ui->scrollarea->setwidget(wid); the qsignalmapper connected class performs calculations: connect(&selectmodes, signal(mapped(qstring)), this, signal(checkboxclicked2(qstring))); connect(this, signal(checkboxclicked2(qstring)), &supre...

ios7 - core bluetooth crash in iOS 7 -

i have developed bluetooth app, runs fine on ios 6, when run on ios 7 application crashes in -diddiscoverperipheral call back. crash info suggests release called on cbperipheral object. have used arc memory management, here declaration,initialisation of cbperipheral object , call code: @interface brlediscovery () <cbcentralmanagerdelegate, cbperipheraldelegate> { cbcentralmanager *centralmanager; cbperipheral *currentperipheral; bool pendinginit; } - (id) init { self = [super init]; if (self) { pendinginit = yes; centralmanager = [[cbcentralmanager alloc] initwithdelegate:self queue:dispatch_get_main_queue()]; currentperipheral=[[cbperipheral alloc]init]; founddevice=false; foundperipherals = [[nsmutablearray alloc] init]; connectedservices = [[nsmutablearray alloc] init]; } return self; } - (void)centralmanager:(cbcentralmanager *)central diddiscoverperipheral:(cbperipheral *)...

deployment - How to perform Delta-Build -

i creating ant script in essence make delta-build. instead of deleting initial directory , creating new directory, updating new contents, goal have script checks directory, , update materials not have, updating label. does see way of accomplishing this? i've researched hours , can't find can steer in direction. these should started. http://ant.apache.org/manual/tasks/uptodate.html http://www.catalysoft.com/articles/antuptodate.html ant - uptodate task : regenerate outdated files

json - Digital Signature, does it validate that a message has been sent by a host I trust via HTTP? -

i have following setup: a remote host generates key pair. sends me public key on secure channel. can 100% guarantee public key sent him. uses keypair sign data encoded in json format. procceeds post http request me 2 parameters: a)the json string b)the signature generated json string. on end, when receive data, use public key , signature provided in http post verify. does procedure guarantee message : 1)is sent host sender claims be. 2)is not altered man in middle attack ? does procedure guarantee message sent host sender claims be? technically, answer no. may not matter because answer next question: does procedure guarantee message not altered man in middle attack? is yes. an untrusted host send message signed trusted source. need obtain or capture message , signature. if you're not using ssl, connection trusted server not guaranteed. long verify message being sent signed private key corresponding public key have, message unaltered , ...

python - In Django, why do I need __unicode__? -

i'm starting learn django , i'm starting out django book. came across concept , have hard time understanding logic.. the book says "django uses unicode objects throughout framework. model objects retrieved unicode objects, views interact unicode data, , templates rendered unicode. generally, won’t have worry making sure encodings right; things should work." then why need "def unicode ()" print in unicode? shouldn't work plain vanilla print()? have tried printing model instance doesn't have __unicode__ method? don't useful. that's __unicode__ comes play. define how model instances displayed whenever try use them in unicode context. try experiment. create simple model. print out: class mymodel(models.model): name = models.charfield(max_length=20) >>> obj = mymodel("foo") >>> print obj see get. add __unicode__() method. class mymodel(models.model): name = models.charfield(max_leng...

asp.net mvc - Castle Windsor - How to register MVC controllers in web.config -

i use own dependency injection framework. extremely lightweight , job, looking aspect oriented programming , need better. testing castle windsor because of it's capability proxy-based runtime interception. i wrote simple mvc application using castle windsor installing web.config , works fine. problem had register each controller individually. in application lot of controllers, become tedious. web.config <castle> <components> <component id="loggerinterceptor" type="mvcapp.loggerinterceptor, mvcapp" lifestyle="singleton"/> <component name="accountcontroller" type="mvcapp.controllers.accountcontroller, mvcapp" lifestyle="transient"> <interceptors> <interceptor>${loggerinterceptor}</interceptor> </interceptors> </component> <component name="homecontroller" type="mvcapp.controllers.homecontroller, mvcapp...

xcode5 - XCTest did not finish in Xcode 5 -

Image
i have 1 test class , 1 test case. when run unit test, xcode tells me of tests passed, have warning tests didn't finish. do have special xctest let know i'm done particular test case? update: may timing issue/bug. put [nsthread sleepfortimeinterval:.1]; in teardown method , works every time. xcode finished tests fine periodically on own without sleep. update 2: looks odd xcode bug, added third test doing text formatting validation , warning shows again. i never got warning mention, after converting xcode 5 xctest (with refactoring menu , swapping framework myself) tests ran forever (for value of forever...) never began executing (setup , test methods not called @ all). i changed test target's, build settings > packaging > wrapper extension "octest" "xctest" , problem resolved. to answer question, test should finish execution finishes , teardown method completes. test no code pass successfully. try setting breakpoint or l...

javascript - Chrome Dev Tools: Modifying / Extending (beyond the API)? -

is way extend chrome dev tools via these apis? http://developer.chrome.com/extensions/devtools.html http://developer.chrome.com/extensions/experimental.html they seem pretty limited. want able things filter things have been logged / written console, search, pattern match, etc. even being able log warnings (and errors) simple addition do. i can add other examples believe, if i'm correct, have build chrome source? i run canary , regular chrome, wondering if run along these two? i've read , tried build chrome on mac didn't work guide followed, perhaps doing on ubuntu easier? goal not fix bugs in chrome, extend , keep date canary or stable build. thank you. ps: javascript used work on systems not afraid write c++/c if have to. however, think dev tools html/ js themselves?

ios - Prevent overlapping UIScrollView from scrolling -

i have uiscrollview 1 of elements, when touched, pops uiscrollview , of same size (full screen) underlying view. want top scrollview, when shown, element responding touches, is, if top scrollview runs out of content, underlying scrollview picks touches , scrolls content. how can force responder chain stop @ top uiscrollview without putting in separate uiviewcontroller ? try setting scrollenabled no on base scroll view when "top" scroll view shown, , re-enable when want control return.

Using 2D arrays to solve Sieve of Eratosthenes with C++ -

i'm not sure what's going wrong program here. compiles without error won't run first function correctly. have tried ask friends me out of no help. i hoping me @ least showing me error have made have not caught. header file (sieve.h): #include <iostream> #include <iomanip> #include <cstdlib> #include <vector> using namespace std; void findprimenumbers(int**, int); void printprimes(int**, int); void findprimenumbers(int **arr, int n) { (int x = 2; x < n; x++){ cout << " x " << x; if (arr[0][x] == 1){ int z = arr[1][x]; cout << " z = " << z; (int y = 2 * z; y < 40; y += z){ cout << " y " << y; arr[0][y] = 0; } } } } void printprimes(int **arr, int n) { (int x = 0; x < n; x++){ if (arr[0][x] == 1) cout << arr[1][x] << " prime num...

svg - Is it a good practice to enable file compression for all file types on a webserver? -

do think if practice make file compression on file types on webserver? i going enable file compression on svg files reduce wait time downloading of font files , other text base file types , thinking if practice enable file compression on types of files or not. does have bad effect on performance or something? please let me know experience is. after searching web hours, found these 2 resources: http://www.ibm.com/developerworks/library/wa-httpcomp/ and http://docs.oracle.com/cd/e24902_01/doc.91/e23435/enablecomp.htm form first resource: http compression, recommendation of http 1.1 protocol specification improved page download time and second resource: regular text , non-image content suited compression. text files can typically compressed 70% or more. compression can save significant bandwidth , enable faster browser response times. effect negligible in high speed lan environments, quite noticeable users on slow wan connections. ...

ruby on rails - Sort by specific ids in ActiveRecord -

i have inherited programmer's rails3 project, , i'm new rails overall. he's got query appears sort specific id's. can explain how resolves in actual sql? think code killing db , subsequently rails. i've tried output in logger can't seem actual sql output config set :debug. searching heavily here (on so) didn't turn clear explanation of how query looks. code looks like: options = { select: "sum(1) num_demos, product_id ", group: "product_id", order: "num_demos asc", } product_ids = demo.where("state = 'waitlisted'").find(:all, options).collect{|d| d.product_id} sort_product_ids = product_ids.collect{|product_id| "id = #{product_id}"} product.where(visible: true, id: product_ids).order(sort_product_ids.join(', ')) as far can see, final line create query against product table order "id = 1, id = 3, ...