Daily Archives

Articles indexed Saturday June 30 2012

Page 6/14 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Sharing files with Android devices (How do I mount an HP Touchpad, Cyanogen Mod 9?)

    - by C.Werthschulte
    I've recently installed Cyanogen Mod 9 on my HP Touchpad tablet, but I'm encountering problems when trying to access it from my Ubuntu laptop (Ubuntu 11.10, Gnome-Shell, Nautilus). I've first tried accessing it via PTP as suggested here. Ubuntu will recognize the Touchpad as a digicam and only grant me access to two directories: "DCIM" and "Pictures". I then tried accessing the tablet via MTP using this post on OMGUbuntu!. Ubuntu will connect to the tablet, but only grant me access to a folder named "Playlists". I'm a bit clueless as to what I'm doing wrong and would very much appreciate any help or hints. Many thanks!

    Read the article

  • How do I "alt-tab" between windows using Gnome 3?

    - by josmh
    All of the references I've found for Gnome 3 keyboard shortcuts list that alt+tab switches between applications and alt+` switches between windows (some actually say alt+~, but I think they're mistaken, and I've tried both anyway). Maybe that functionality works for Gnome 3 on Fedora or something, because no matter the key combo I try, nothing will switch between windows except for opening the alt+tab dialog and using arrow keys to navigate it (and at that point it's faster to just use a mouse..). How do I quickly switch between windows in Gnome 3?

    Read the article

  • What's a good way to organize samplers for HLSL?

    - by Rei Miyasaka
    According to MSDN, I can have 4096 samplers per context. That's a lot, considering there's only a handful of common sampler states. That tempts me to initialize an array containing a whole bunch of common sampler states, assign them to every device context I use, and then in the pixel shaders refer to them by index using : register(s[n]) where n is the index in the array. If I want more samplers for whatever reason, I can just add them on after the last slot. Does this work? If not, when should I set the samplers? Should it be done when by the mesh renderer? The texture renderer? Or alongside PSSetShader? Edit: That trick I wrote above doesn't work (at least not yet), as the compiler gives me this error message when I try to use the same register twice: error X4500: overlapping register semantics not yet implemented 's0' So how do people usually organize samplers, then?

    Read the article

  • How to get current controller for a URL in Rails?

    - by valk
    I'm using this code to highlight currently active menu tab with Twitter Bootstrap: def nav_link_to(link_text, link_path, options = nil) class_name = current_page?(link_path) ? 'active' : '' content_tag(:li, :class => class_name) do link_to link_text, link_path, options end end This of course makes the link active, only if the given link IS the current page. How can I change this function, such that it would return 'active' for any links below current controller? In other words, for all actions for Posts controller, the links would be active? Thanks.

    Read the article

  • Chrome Javascript

    - by Mike
    i have two spans on my page with class='hidden' and then some javascript to remove the class when a condition is met, its working fine in ie 9/10 and firefox but its not working in chrome when I run the function in the chrome JS console I get the message TypeError: Cannot read property 'attributes' of null Anybody know whats going on? <script type='text/javascript' > function showhidden() { var att =document.getElementById('hiddentextbox'); att.attributes[0].value=''; att =document.getElementById('hiddentextbox1'); att.attributes[0].value=''; }</script> Thanks

    Read the article

  • Is this good code? Linked List Stack Implementation

    - by Quik Tester
    I have used the following code for a stack implementation. The top keeps track of the topmost node of the stack. Now since top is a data member of the node function, each node created will have a top member, which ideally we wouldn't want. Firstly, is this good approach to coding? Secondly, will making top as static make it a better coding practice? Or should I have a global declaration of top? #include<iostream> using namespace std; class node { int data; node *top; node *link; public: node() { top=NULL; link=NULL; } void push(int x) { node *n=new node; n->data=x; n->link=top; top=n; cout<<"Pushed "<<n->data<<endl; } void pop() { node *n=new node; n=top; top=top->link; n->link=NULL; cout<<"Popped "<<n->data<<endl; delete n; } void print() { node *n=new node; n=top; while(n!=NULL) { cout<<n->data<<endl; n=n->link; } delete n; } }; int main() { node stack; stack.push(5); stack.push(7); stack.push(9); stack.pop(); stack.print(); } Any other suggestions welcome. I have also seen codes where there are two classes, where the second one has the top member. What about this? Thanks. :)

    Read the article

  • How can I override list methods to do vector addition and subtraction in python?

    - by Bobble
    I originally implemented this as a wrapper class around a list, but I was annoyed by the number of operator() methods I needed to provide, so I had a go at simply subclassing list. This is my test code: class CleverList(list): def __add__(self, other): copy = self[:] for i in range(len(self)): copy[i] += other[i] return copy def __sub__(self, other): copy = self[:] for i in range(len(self)): copy[i] -= other[i] return copy def __iadd__(self, other): for i in range(len(self)): self[i] += other[i] return self def __isub__(self, other): for i in range(len(self)): self[i] -= other[i] return self a = CleverList([0, 1]) b = CleverList([3, 4]) print('CleverList does vector arith: a, b, a+b, a-b = ', a, b, a+b, a-b) c = a[:] print('clone test: e = a[:]: a, e = ', a, c) c += a print('OOPS: augmented addition: c += a: a, c = ', a, c) c -= b print('OOPS: augmented subtraction: c -= b: b, c, a = ', b, c, a) Normal addition and subtraction work in the expected manner, but there are problems with the augmented addition and subtraction. Here is the output: >>> CleverList does vector arith: a, b, a+b, a-b = [0, 1] [3, 4] [3, 5] [-3, -3] clone test: e = a[:]: a, e = [0, 1] [0, 1] OOPS: augmented addition: c += a: a, c = [0, 1] [0, 1, 0, 1] Traceback (most recent call last): File "/home/bob/Documents/Python/listTest.py", line 35, in <module> c -= b TypeError: unsupported operand type(s) for -=: 'list' and 'CleverList' >>> Is there a neat and simple way to get augmented operators working in this example?

    Read the article

  • php curl http 405 error mind body online api

    - by K_G
    I am trying to connect to the Mind Body Online API (their forum is down currently, so I came here). Below is the code I am using. I am receiving this: SERVER ERROR 405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt to access. code: //Data, connection, auth $soapUrl = "http://clients.mindbodyonline.com/api/0_5"; // xml post structure $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://clients.mindbodyonline.com/api/0_5"> <soapenv:Header/> <soapenv:Body> <GetClasses> <Request> <SourceCredentials> <SourceName>username</SourceName> <Password>password</Password> <SiteIDs> <int>site id</int> </SiteIDs> </SourceCredentials> <UserCredentials> <Username>username</Username> <Password>password</Password> <SiteIDs> <int></int> </SiteIDs> </UserCredentials> <Fields> <string>Classes.Resource</string> </Fields> <XMLDetail>Basic</XMLDetail> <PageSize>10</PageSize> <CurrentPageIndex>0</CurrentPageIndex> </Request> </GetClasses> </soapenv:Body> </soapenv:Envelope>'; $headers = array( "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: http://clients.mindbodyonline.com/api/0_5", "Content-length: ".strlen($xml_post_string), ); //SOAPAction: your op URL $url = $soapUrl; // PHP cURL for https connection with auth $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // the SOAP request curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // converting $response = curl_exec($ch); curl_close($ch); var_dump($response); // converting //$response1 = str_replace("<soap:Body>","",$response); //$response2 = str_replace("</soap:Body>","",$response1); // convertingc to XML //$parser = simplexml_load_string($response2); // user $parser to get your data out of XML response and to display it. Any help would be great and if anyone has any experience working with their API, my first time ;) Here is the post on stack I am going off of: SOAP request in PHP

    Read the article

  • ontouch - Switching positions of two views(images) in Android

    - by idish
    I've been looking for that 2 days long and haven't found anything related to it. I'll give an example for my goal. Let's say I have 2 images positioned side by side horizontally. I want the user to be able to switch their positions onlongtouch listener. so let's say that the first image was on the left and the second was on the right side, after switching positions between them, the first image would be in the right and the second would be on the left side. Basically, it is just like in the launcher where you can switch apps positions. Please, if anything is not clear for you, I would like to know, and I'll try to explain it better, thank you.

    Read the article

  • Regex in MySql - replace between Tags including Tags

    - by user998163
    I have a text like: [lang_de]Content in German[/lang_de][lang_en]Content in English[/lang_en]. I want to replace all text between [lang_en] and [/lang_en] including the opening and closing language tag. This is my current regex: UPDATE wp_posts SET post_content = '" . addslashes(preg_replace("/[lang_en](.*)[\/lang_en]/", '', $row['post_content'])) . "' WHERE ID = " . $row['ID'] With this regex, I do not get a valid results. It also replaces in html tags and so on. What would be the correct regex?

    Read the article

  • Embedded Java Databases for Large Data Sets

    - by ExAmerican
    I would like to port a PHP/MySQL-based client/server application to be a standalone desktop application written in Java. The database has grown to be fairly large, with several tables with hundreds of thousands of rows. I expect these could grow to over a million entries for certain tables. What embedded database would best handle this? HSQLDB and Sqlite seem to be the obvious choices, though I'm guessing there are others out there as well. My main priorities are the ability to perform queries on large amounts of data efficiently (this thread seems to confirm Sqlite can handle this) and the ease with which I can import old data from MySQL (I remember HSQLDB being kind of a pain for that). Note: I am aware that similar questions comparing embedded databases have been posted before (for example here and here) but as my priorities differ somewhat from most applications considering the large data migration I thought it justified a new question.

    Read the article

  • Sort command not working as expected

    - by user964689
    If anybody can help me to write a loop to iterate over files in a folder it would save me a huge amount of time. I think it must be quite a simple solution ,but I currently don't know how to nest a loop within a loop. So far I have this script: cd /folderlocation/ for i in `</textfile_containing_lines_to_iterate_through` do #size=`echo $i | perl -nE '/:([\d-]+)/ && say abs(eval $1)'` #echo "$size" zcat dataset | head -n 18 > temp"$i".vcf tabix dataset $i >> temp"$i".vcf vcftools --window-pi 1000000 --vcf temp10individuals"$i".vcf >> run_summary.txt cat out.windowed.pi >> outputfile_2 #rm temp* done grep -v "PI" outputfile_2 > outputfile rm outputfile_2 I need to expand this so that the script will run multiple times, through all of the 'textfiles_containing_lines_to_iterate_through'. Currently I change the name of the textfile manually each time and re-run the script. So I'd need a loop that does this for file in folder, and also that uses the name of the file as part of the outputfile name so that I can match an output file to an inputfile. Any help would be really useful and greatly appreciated! Many thanks in advance.

    Read the article

  • Synchronizing access to an inner object's methods?

    - by user291701
    Suppose I have the following: public class Foo { private ReadingList mReadingList = new ReadingList(); public ReadingList getReadingList() { synchronized (mReadingList) { return mReadingList; } } } If I try modifying the ReadingList object in two threads, the synchronization above won't help me, right?: // Thread 1 foo1.getReadingList().setName("aaa"); // Thread 2 foo2.getReadingList().setName("bbb"); do I have to wrap each method I want synchronized like so: public class Foo { private ReadingList mReadingList = new ReadingList(); public synchronized void setReadingListName(String name) { mReadingList.setName(name); } public synchronized void setReadingListAuthor(String author) { mReadingList.setAuthor(author); } ... and so on for each method of ReadingList I want exposed and synched? I'd end up just writing wrapper methods for each method of ReadingList. Thanks

    Read the article

  • How to terminate a request in JSP (not the "return;")

    - by Genom
    I am programming a website with JSP. There are pages where user must be logged in to see it. If they are not logged in, they should see a login form. I have seen in a php code that you can make a .jsp page (single file), which checkes, whether the user is logged in or not. If not it will show the login form. If the user is logged in, nothing will be done. So in order to do that I use this structure in my JSPs: Headers, menus, etc. etc... normal stuff which would be shown such as body, footer to a logged in user. This structure is very easy to apply to all webpages. So I don't have to apply checking algorithm to each webpage! I can simply add this "" and the page is secure! So my problem is that if the user is not logged in, then only the log in form should be shown and the footer. So code should bypass the body. Therefore structured my checklogin.jsp so: If user is not logged in show the login form and footer and terminate request. The problem is that I don't know how to terminate the request... If I use "return;" then only the checklogin.jsp stops but server continues to process parent page! Therefore page has 2 footers! (1 from parent page and 1 from checklogin.jsp). How can I avoid this? (There is exit(); in php for this by the way!) Thanks for any suggestions!

    Read the article

  • The "correct" way of using multilingual support

    - by Felipe Athayde
    I just began working with ASP.NET and I'm trying to bring with me some coding standards I find healthy. Among such standards there is the multilingual support and the use of resources for easily handling future changes. Back when I used to code desktop applications, every text had to be translated, so it was a common practice to have the language files for every languages I would want to offer to the customers. In those files I would map every single text, from button labels to error messages. In ASP.NET, with the help of Visual Studio, I have the resort of using the IDE to generate such Resource Files (from Tools - Generate Local Resource), but then I would have to fill my webpages with labels - at least that is what I've learned from articles and tutorials. However, such approach looks a bit odd and I'm tempted to guess it doesn't smell that good as well. Now to the question: 1) Should I keep every single text in my website as labels and manage its contents in the resource files? It looks/feels odd specially when considering a text with several paragraphs. 2) Whenever I add/remove something, e.g.: a button, to an aspx file I would have to add it to the resource file as well, because generating the resource file again would simply override all my previous changes to it. That doesn't feel like a reusable code at all for me. Any comment suggestion on this one? Perhaps I got it all wrong from tutorials as it doesn't seem like a standardized matter - specially if it required recompiling the entire application whenever some change has to be done.

    Read the article

  • how to deploy to remote server with tomcat7-maven-plugin

    - by Msaleh
    i want to use tomcat7-maven-plugin to deploy war file from my local machine to remote server, here's the configuration i have so far: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0-beta-1</version> <configuration> <server>pb</server> <url>http://mydomain.com:8080/manager/html</url> </configuration> </plugin> do i need more configuration ? and what command do i use to deploy ?

    Read the article

  • Optimal way to store and pass a date to Javascript

    - by user1493115
    I need to store a date-time value in MySQL and subsequently display it on a webpage. Due to its flexibility I usually chose to store a Unix timestamp in the database and convert it with PHP's date() to the desired format. This time however I would like to use MySQL's datetime field (mostly due to 2038) and apply the browser's timezone (hence I cannot simply format it on the server and pass the string to the client). I thought of storing the date as UTC datetime in the database and send it as well-defined format to the client, where it will be further processed. Here I would like to avoid a Unix timestamp but everything else might add additional overhead in processing. Is there any best practice as far as date processing is concerned in a MySQL, PHP, JQuery environment? Thanks.

    Read the article

  • JQuery: How to apply css to a .wrap element?

    - by Eamonn
    My code thus far: $(".lorem img:not(.full-img)").each(function() { $(this).addClass("inline-img"); var imgWidth = $(this).prop('width'); var imgHeight = $(this).prop('height'); var imgFloat = $(this).prop('float'); $(this).wrap('<div class="inline-img-wrap" />'); if ($(this).prop("title")!='') { $('<p class="inline-img-caption">').text($(this).prop('title')).insertAfter($(this)); } }); I am searching for images within a body of text, appending their title values as captions underneath, and wrapping both img and p in a div.inline-img-wrap. That works fine. What I need help with is applying the styling of the img to the new wrapping div instead. You can see I have created vars for just this, but cannot get applying them to work. $this will always apply to the image, and <div class="inline-img-wrap" style="width:'+imgWidth+'"> doesn't work. All advice appreciated!

    Read the article

  • Removing certain characters in all rows that match a regex?

    - by user001
    I'd like to change {foo, {bar}, foobar} to {foo, bar, foobar} in all rows that match '{.*{'. I.e. remove all curly braces { and } except the outer most pair. So doing mysql -h $H -u $U -p$P $DB -B -e "SELECT id FROM t WHERE col REGEXP '{.*{'" > bad.txt selects all the rows that will need this substitution. How do I make this substitution very quickly? EDIT: Could I do it by update table set column = REPLACE(column,'{',''); Then restore the out most pair update table set column = REPLACE(column,'^','{'); update table set column = REPLACE(column,'$','}');

    Read the article

  • Perl need the right grep operator to match value of variable

    - by iaintunderstand
    I want to see if I have repeated items in my array, there are over 16.000 so will automate it There may be other ways but I started with this and, well, would like to finish it unless there is a straightforward command. What I am doing is shifting and pushing from one array into another and this way, check the destination array to see if it is "in array" (like there is such a command in PHP). So, I got this sub routine and it works with literals, but it doesn't with variables. It is because of the 'eq' or whatever I should need. The 'sourcefile' will contain one or more of the words of the destination array. my @destination = ('hi', 'bye'); sub in_array { my ($destination,$search_for) = @_; return grep {$search_for eq $_} @$destination; } for($i = 0; $i <=100; $i ++) { $elemento = shift @sourcefile; if(in_array(\@destination, $elemento)) { print "it is"; } else { print "it aint there"; } } Well, if instead of including the $elemento in there I put a 'hi' it does work and also I have printed the value of $elemento which is also 'hi', but when I put the variable, it does not work, and that is because of the 'eq', but I don't know what else to put. If I put == it complains that 'hi' is not a numeric value.

    Read the article

  • Hibernate + Spring + session + cache

    - by andromeda
    We are using Hibernate with Spring for our Java application. We find out that when a session update something in database other sessions can not see the update. For example user1 get the account balance from database then user2 increase the balance , if user1 get the object another time he see the account balance before updating (seems that session use the value from its cache) but we want to get the updated object with new account balance. User1 use one session during all activity that is different from user2 session. Is any configuration to force to get the updated object from database? or any other help?

    Read the article

  • Portrait vs Landscape Launch Images

    - by andrewx
    An iPad app can support inclusion of launch images in both orientations; presumably, if your app supports auto-rotation, then this would suggest to me that if the user launches an app while the device is in Landscape mode, then the Landscape launch image is used. But in all the apps I've built and released, this has never been the case. Never once has the Landscape launch image appeared, only the Portrait. After loading, the app will auto-rotate to whatever orientation the device is in, but at launch, it assumes you are in Portrait. Always. Why? I have seen many other apps in the store that behave this way, but then there are some seem to always automatically know immediately at first launch, from that first launch image, that you are in Landscape, if that's the case. How is this done?

    Read the article

  • saving date and time

    - by saeed talaee
    I want to save the time and date within my news but in the method below I save the time of the user and if his/her time is wrong, the wrong time will be save. How can I use the server's time instead. SqlConnection sqlconn = new SqlConnection(connStr); SqlCommand sqlcmd = new SqlCommand("insert into SubmitManuscript(username,title,authors,type,date,upload,reviewer1,email1,reviewer2,email2,reviewer3,email3)values(@username,@title,@authors,@type,@date,@upload,@reviewer1,@email1,@reviewer2,@email2,@reviewer3,@email3)", sqlconn); sqlcmd.Parameters.AddWithValue("@username", username); sqlcmd.Parameters.AddWithValue("@title", Text_Title.Text); sqlcmd.Parameters.AddWithValue("@authors", Text_Author.Text); sqlcmd.Parameters.AddWithValue("@type", dd_Type.SelectedItem.Text); sqlcmd.Parameters.AddWithValue("@date", DateTime.Now); //sqlcmd.Parameters.AddWithValue("@upload", "~/Suppelment/" +

    Read the article

  • Lightbox Plus Captions Spill Over

    - by Leah Shaune
    I am using Lightbox Plus for wordpress. My captions are spilling over and overlapping the picture when the image is in lightbox mode. The captions are covering the image and the close link, as well as being off-center. Here is my URL: http://dev.andreamarymarshall.com/archives/2012-2/ How do I make the space allowed for the captions bigger? So that in fits at least two lines of text without overlapping anything? Thanks!!

    Read the article

  • Getting field of type bytea in helper table when using GenerationType.IDENTITY

    - by dtrunk
    I'm creating my db scheme using Hibernate. There's a Table called "tbl_articles" and another one called "tbl_categories". To have a n-n relationship a helper table ("tbl_articles_categories") is needed. Here are all necessary Entities: @Entity @Table( name = "tbl_articles" ) public class Article implements Serializable { private static final long serialVersionUID = 1L; @Id @Column( nullable = false ) @GeneratedValue( strategy = GenerationType.IDENTITY ) private Integer id; // other fields... public Integer getId() { return id; } public void setId( Integer id ) { this.id = id; } // other fields... } @Entity @Table( name = "tbl_categories" ) public class Category implements Serializable { private static final long serialVersionUID = 1L; @Id @Column( nullable = false ) @GeneratedValue( strategy = GenerationType.IDENTITY ) private Integer id; // other fields public Integer getId() { return id; } public void setId( Integer id ) { this.id = id; } // other fields... } @Entity @Table( name = "tbl_articles_categories" ) @AssociationOverrides({ @AssociationOverride( name = "pk.article", joinColumns = @JoinColumn( name = "article_id" ) ), @AssociationOverride( name = "pk.category", joinColumns = @JoinColumn( name = "category_id" ) ) }) public class ArticleCategory { private ArticleCategoryPK pk = new ArticleCategoryPK(); public void setPk( ArticleCategoryPK pk ) { this.pk = pk; } @EmbeddedId public ArticleCategoryPK getPk() { return pk; } @Transient public Article getArticle() { return pk.getArticle(); } public void setArticle( Article article ) { pk.setArticle( article ); } @Transient public Category getCategory() { return pk.getCategory(); } public void setCategory( Category category ) { pk.setCategory( category ); } } @Embeddable public class ArticleCategoryPK implements Serializable { private static final long serialVersionUID = 1L; @ManyToOne @ForeignKey( name = "tbl_articles_categories_fkey_article_id" ) private Article article; @ManyToOne @ForeignKey( name = "tbl_articles_categories_fkey_category_id" ) private Category category; public ArticleCategoryPK( Article article, Category category ) { setArticle( article ); setCategory( category ); } public ArticleCategoryPK() { } public Article getArticle() { return article; } public void setArticle( Article article ) { this.article = article; } public Category getCategory() { return category; } public void setCategory( Category category ) { this.category = category; } } Now, I'm getting a serial type what I wanted in my articles table as well as in my categories table. But looking into my helper table, there aren't the expected fields article_id and category_id each of type integer - instead there are article and category of type bytea. What's wrong here? EDIT: Sorry, forgot to mention that I'm using PostgreSQL.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >