Search Results

Search found 480 results on 20 pages for 'alexander gruber'.

Page 15/20 | < Previous Page | 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Compose synthetic English phrase that would contain 160 bits of recoverable information

    - by Alexander Gladysh
    I have 160 bits of random data. Just for fun, I want to generate pseudo-English phrase to "store" this information in. I want to be able to recover this information from the phrase. Note: This is not a security question, I don't care if someone else will be able to recover the information or even detect that it is there or not. Criteria for better phrases, from most important to the least: Short Unique Natural-looking The current approach, suggested here: Take three lists of 1024 nouns, verbs and adjectives each (picking most popular ones). Generate a phrase by the following pattern, reading 20 bits for each word: Noun verb adjective verb, Noun verb adjective verb, Noun verb adjective verb, Noun verb adjective verb. Now, this seems to be a good approach, but the phrase is a bit too long and a bit too dull. I have found a corpus of words here (Part of Speech Database). After some ad-hoc filtering, I calculated that this corpus contains, approximately 50690 usable adjectives 123585 nouns 15301 verbs This allows me to use up to 16 bits per adjective (actually 16.9, but I can't figure how to use fractional bits) 15 bits per noun 13 bits per verb For noun-verb-adjective-verb pattern this gives 57 bits per "sentence" in phrase. This means that, if I'll use all words I can get from this corpus, I can generate three sentences instead of four (160 / 57 ˜ 2.8). Noun verb adjective verb, Noun verb adjective verb, Noun verb adjective verb. Still a bit too long and dull. Any hints how can I improve it? What I see that I can try: Try to compress my data somehow before encoding. But since the data is completely random, only some phrases would be shorter (and, I guess, not by much). Improve phrase pattern, so it would look better. Use several patterns, using the first word in phrase to somehow indicate for future decoding which pattern was used. (For example, use the last letter or even the length of the word.) Pick pattern according to the first bytes of the data. ...I'm not that good with English to come up with better phrase patterns. Any suggestions? Use more linguistics in the pattern. Different tenses etc. ...I guess, I would need much better word corpus than I have now for that. Any hints where can I get a suitable one?

    Read the article

  • Phonegap / jquery mobile slide transition not workign properly on first call

    - by Alexander Casassovici
    I have an awkward visual glitch. I want nice transition when changing pages on the app. Unfortunately first time i change to another page, Instead of sliding current pagg out and new page in , current page is immediately replaces by the new page, then slides out... and when it's out of view it's the new page is shown... the second time around it works like a charm though !!! This is running on iphone with jquery mobile + phonegap I made a video to make the issue clear: http://www.youtube.com/watch?v=Ybvzh_wTnSE <body style="background-color: #000;"> <div id="container" style="display:none;"> <div id="side-menu" style="display:none;"> <div id="header_top"></div> <a href="#dives" onclick="showdives();"><div id="header_dives" class="selected"></div></a> <div id="header_spacer1"></div> <a href="#explore" onclick="showexplore();"><div id="header_explore"></div></a> <div id="header_spacer2"></div> <a href="#search" onclick="showsearch();"><div id="header_search"></div></a> <div id="header_spacer3"></div> <a href="#settings" onclick="showsettings();"><div id="header_settings"></div></a> <div id="header_bottom"></div> </div> <div id="slide_mask"> <!-- START of LOGIN page --> <div data-role="page" id="login"> <div id="home_frame"> <div id="home_logo"></div> <div id="home_fblogin" onclick="login()"></div> <div class="home_login"> <p>Email: <input type="text" name="user[email]" size="30"/></p> <p>Password: <input type="password" name="user[password]" size="30"/></p> <button onclick="show_page_home();">LOGIN</button> </div> </div> </div> <!-- END of LOGIN page --> <!-- START of LOGIN page --> <div data-role="page" id="dives" class="right_pane"> <p>My dives !</p> </div><!-- /content --> <div data-role="page" id="explore" class="hidden right_pane"> <p>My explore !</p> </div><!-- /content --> <div data-role="page" id="search" class="hidden right_pane"> <p>My search !</p> </div><!-- /content --> <div data-role="page" id="settings" class="hidden right_pane"> <p>My settings !</p> <button onclick="logout_db();">logout</button> </div><!-- /content --> <!-- END of LOGIN page --> </div> </div> <div id="log"></div> <div id="data"></div> </body> And the relevant CSS: body {margin: 0; font: 18px Helvetica; text-align: center; background-color: #000; background: url(../img/bg_big.png) repeat; -webkit-user-select: none; /* prevent copy paste for all elements */ } #container { width:320px; height:460px; overflow: hidden;} input{ -webkit-user-select: text; /* enable copy paste for elements with this class */} a {-webkit-user-select: none; /* prevent copy paste for all elements */} span {-webkit-user-select: none; /* prevent copy paste for all elements */} #side-menu {z-index: 1000 !important; position: fixed; height: 460px; width: 56.5px; background: url(../img/bg_big.png) no-repeat; display: inline-block; overflow: hidden; top: 0px; left: 0px; } #header_top {background: url(../img/header/header_top.png) no-repeat; background-size: 56.5px 48.96px; width: 56.5px; height: 48.96px; display: block;} #header_dives {background: url(../img/header/dives.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;} #header_dives.selected{background: url(../img/header/dives_selected.png) no-repeat;} #header_spacer1{background: url(../img/header/header_space1.png) no-repeat; background-size: 56.5px 13.9px; width: 56.5px; height: 13.9px; display: block;} #header_explore{background: url(../img/header/explore.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;} #header_explore.selected{background: url(../img/header/explore_selected.png) no-repeat;} #header_spacer2{background: url(../img/header/header_space2.png) no-repeat; background-size: 56.5px 15.33px; width: 56.5px; height: 15.33px; display: block;} #header_search{background: url(../img/header/search.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;} #header_search.selected{background: url(../img/header/search_selected.png) no-repeat;} #header_spacer3{background: url(../img/header/header_space3.png) no-repeat; background-size: 56.5px 17.73px; width: 56.5px; height: 17.73px; display: block;} #header_settings{background: url(../img/header/settings.png) no-repeat; background-size: 56.5px 51.75px; width: 56.5px; height: 51.75px; display: block;} #header_settings.selected{background: url(../img/header/settings_selected.png) no-repeat;} #header_bottom{background: url(../img/header/header_bottom.png) no-repeat; background-size: 56.5px 160px; width: 56.5px; height: 160px; display: block;} .hidden {display: none;} .right_pane{width: 263.5px !important; background: url(../img/right_bg.png) no-repeat; background-size:263.5px 460px; width: 263.5px; height: 460px; left: 56.5px !important;} #slide_mask{ display: inline-block; overflow: hidden; padding-left: 56.5px; width: 263.5px; height: 460px; top: 0;} and the bit of JS: /////////////////////////////////// //MENU MECHANICS /////////////////////////////////// function showdives(){ $("#side-menu .selected").removeClass("selected"); $("#header_dives").addClass("selected"); } function showexplore(){ $("#side-menu .selected").removeClass("selected"); $("#header_explore").addClass("selected"); } function showsearch(){ $("#side-menu .selected").removeClass("selected"); $("#header_search").addClass("selected"); } function showsettings(){ $("#side-menu .selected").removeClass("selected"); $("#header_settings").addClass("selected"); } the onclick only add/remove the "selected" class to the menu items so... any hint ? been trying eveything for hours and still can't get it neat .. :(

    Read the article

  • Nerd Dinner tutorial question (can't pull data off Model)

    - by Alexander
    I am just following the tutorial about NerdDinner and was stuck because when I am implementing the "Index" View Template I got no data from it. It seems that when I loop around in the code below: <asp:Content ID="Title" ContentPlaceHolderID="TitleContent" runat="server"> Upcoming Dinners </asp:Content> <asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server"> <h2>Upcoming Dinners</h2> <ul> <% foreach (var dinner in Model) { %> <li> <%=Html.ActionLink(dinner.Title, "Details", new { id=dinner.DinnerID }) %> on <%=Html.Encode(dinner.EventDate.ToShortDateString())%> @ <%=Html.Encode(dinner.EventDate.ToShortTimeString())%> </li> <% } %> </ul> </asp:Content> There seems to be nothing in the Model... why is this? I am pretty sure there's data in the database because the details view template worked. FYI I am following the tutorial up to this page

    Read the article

  • UITableView becomes invisible after changing data in it

    - by Alexander Shemshurenko
    Hi I have application with TabBar that control several views. In one view i control connection to different servers.Each server provides different set of items. I display these items in UITableView on other view. I create table view like this UITableView * aTableView = [[UITableView alloc] initWithFrame:CGRectMake(X,Y,Width,Height) style:UITableViewStyleGrouped]; [[self view] addSubview:aTableView]; aTableView.da taSource = self; The problem is that Table view displayed ok first time , but if i go back to view number one and change server(changing list of items that should be displayed in table view), table view becomes invisible for some reason. If i tap on the screen in place where it should be, its becomes visible again. Ive tried to call to reloadData and setNeedDisplay in viewWillAppear of the UIViewController that hosts this table view, but without success. Any advice? Thanks

    Read the article

  • basic unique ModelForm field for Google App Engine

    - by Alexander Vasiljev
    I do not care about concurrency issues. It is relatively easy to build unique form field: from django import forms class UniqueUserEmailField(forms.CharField): def clean(self, value): self.check_uniqueness(super(UniqueUserEmailField, self).clean(value)) def check_uniqueness(self, value): same_user = users.User.all().filter('email', value).get() if same_user: raise forms.ValidationError('%s already_registered' % value) so one could add users on-the-fly. Editing existing user is tricky. This field would not allow to save user having other user email. At the same time it would not allow to save a user with the same email. What code do you use to put a field with uniqueness check into ModelForm?

    Read the article

  • Is it possible to parse a URL into it's composite components?

    - by Paul Alexander
    I'd like to parse an incoming URL into it's component parts for some pre-processing before passing it into the standard MVC routing logic. For example given your standard route {controller}/{action}/{id} and the URL /user/show/10 Is there a way to have the Routing system return a dictionary containing controller, action and id keys with their corresponding values?

    Read the article

  • malloc and delete in C++, opinions

    - by Alexander
    In C++ using delete to free memory obtained with malloc() doesn't necessarily cause a program to blow up. Do you guys think a warning or perhaps even an assertion failure should be produced if delete is used to free memory obtained using malloc()?? Why do you think that Stroustrup did not had this feature on C++?

    Read the article

  • references in C++

    - by Alexander
    Once I read in a statement that The language feature that "sealed the deal" to include references is operator overloading. Why are references needed to effectively support operator overloading?? Any good explanation?

    Read the article

  • abstract class in C++

    - by Alexander
    I have a derived derived class from an abstract class. The code is below. I have a FishTank class which is derived from an Aquarium and Aquarium is derived from item. My question is that should I put the definition of virtual int minWidth() const = 0; in aquarium again or is the code below sufficient? class Item{ public: virtual int minWidth() const = 0; }; class Aquarium{ public: virtual int calWidth() = 0; // Pure virtual function. }; class FishTank : public Aquarium{ public: FishTank(int base1, int base2, int height); ~FishTank(); int calWidth(); int minWidth(); };

    Read the article

  • Disable system sleep during long builds

    - by Paul Alexander
    From time to time I need to run a full build of the entire tool chain for our software on my development machine. To save on power my I've got my dev machine set to go sleep after 20 minutes of inactivity. Building the full tool chain can take up to an hour and I'll often just go to lunch. However, if I forget to disable sleep I can return to a sleeping machine with the build only partially complete. What I'm looking for is a way to automatically disable sleep while MSBuild is running. Does anyone know of a simple way of doing this?

    Read the article

  • android error NoSuchElementException

    - by Alexander
    I have returned a cursor string but it contains a delimiter. The delimiter is . I have the string quest.setText(String.valueOf(c.getString(1)));I want to turn the into a new line. What is the best method to achieve this task in android. I understand there is a way to get the delimeter. I want this to achieved for each record. I can itterate through record like so. Cursor c = db.getContact(2); I tried using a string tokenizer but it doesnt seem to work. Here is the code for the tokenizer. I tested it in just plain java and it works without errors. String question = c.getString(1); // quest.setText(String.valueOf(c.getString(1))); //quest.setText(String.valueOf(question)); StringTokenizer st = new StringTokenizer(question,"<ENTER>"); //DisplayContact(c); // StringTokenizer st = new StringTokenizer(question, "=<ENTER>"); while(st.hasMoreTokens()) { String key = st.nextToken(); String val = st.nextToken(); System.out.println(key + "\n" + val); } I then tried running it in android. Here is the error log 06-06 22:31:55.251: E/AndroidRuntime(537): FATAL EXCEPTION: main 06-06 22:31:55.251: E/AndroidRuntime(537): java.util.NoSuchElementException 06-06 22:31:55.251: E/AndroidRuntime(537): at java.util.StringTokenizer.nextToken(StringTokenizer.java:208) 06-06 22:31:55.251: E/AndroidRuntime(537): at alex.android.test.database.quiz.TestdatabasequizActivity$1.onClick(TestdatabasequizActivity.java:95) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.view.View.performClick(View.java:3511) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.view.View$PerformClick.run(View.java:14105) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Handler.handleCallback(Handler.java:605) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Handler.dispatchMessage(Handler.java:92) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Looper.loop(Looper.java:137) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.app.ActivityThread.main(ActivityThread.java:4424) 06-06 22:31:55.251: E/AndroidRuntime(537): at java.lang.reflect.Method.invokeNative(Native Method) 06-06 22:31:55.251: E/AndroidRuntime(537): at java.lang.reflect.Method.invoke(Method.java:511) 06-06 22:31:55.251: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-06 22:31:55.251: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-06 22:31:55.251: E/AndroidRuntime(537): at dalvik.system.NativeStart.main(Native Method) This is the database query public Cursor getContact(long rowId) throws SQLException { Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] {KEY_ROWID, question, possibleAnsOne,possibleAnsTwo, possibleAnsThree,realQuestion,UR}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); }

    Read the article

  • Resources.resx in c# projects

    - by Alexander Braeumer
    I have a problem using a Resources.resx - Resources.de.resx - combination in a C#/WPF project. The whole solutions contains several projects and some projects contains resource files. When starting the main project I can switch the language successfully from english to german. But the GUI elements from the sub projects still show the english text. Thank you very much for every idea to solve the problem. Regards, Alex

    Read the article

  • Exception calling UpdateModel - Value cannot be null or empty

    - by James Alexander
    This is probably something silly I'm missing but I'm definitely lost. I'm using .NET 4 RC and VS 2010. This is also my first attempt to use UpdateModel in .NET 4, but every time I call it, I get an exception saying Value cannont be null or empty. I've got a simple ViewModel called LogOnModel: [MetadataType(typeof(LogOnModelMD))] public class LogOnModel { public string Username { get; set; } public string Password { get; set; } public class LogOnModelMD { [StringLength(3), Required] public object Username { get; set; } [StringLength(3), Required] public object Password { get; set; } } } My view uses the new strongly typed helpers in MVC2 to generate a textbox for username and one for the password. When I look at FormCollection in my controller method, I see values for both coming through. And last but not least, here's are post controller methods: // POST: /LogOn/ [HttpPost] public ActionResult Index(FormCollection form) { var lm = new LogOnModel(); UpdateModel(lm, form); var aservice = new AuthenticationService(); if (!aservice.AuthenticateLocal(lm.Username, lm.Password)) { ModelState.AddModelError("User", "The username or password submitted is invalid, please try again."); return View(lm); } return Redirect("~/Home"); } Can someone please lend some insight into why UpdateModel would be throwing this exception? Thanks!

    Read the article

  • static function in an abstract class

    - by Alexander
    How to implement a static function in an abstract class?? Where do I implement this? class Item{ public: // // Enable (or disable) debug descriptions. When enabled, the String produced // by descrip() includes the minimum width and maximum weight of the Item. // Initially, debugging is disabled. static enableDebug(bool); };

    Read the article

  • Many-to-many mapping with LINQ

    - by Alexander
    I would like to perform LINQ to SQL mapping in C#, in a many-to-many relationship, but where data is not mandatory. To be clear: I have a news site/blog, and there's a table called Posts. A blog can relate to many categories at once, so there is a table called CategoriesPosts that links with foreign keys with the Posts table and with Categories table. I've made each table with an identity primary key, an id field in each one, if it matters in this case. In C# I defined a class for each table, defined each field as explicitly as possible. The Post class, as well as Category class, have a EntitySet to link to CategoryPost objects, and CategoryPost class has 2 EntityRef members to link to 2 objects of each other type. The problem is that a Post may relate or not to any category, as well as a category may have posts in it or not. I didn't find a way to make an EntitySet<CategoryPost?> or something like that. So when I added the first post, all went well with not a single SQL statement. Also, this post was present in the output. When I tried to add the second post I got an exception, Object reference not set to an instance of an object, regarding to the CategoryPost member. Post: [Table(Name="tm_posts")] public class Post : IDataErrorInfo { public Post() { //Initialization of NOT NULL fields with their default values } [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } private EntitySet<CategoryPost> _categoryRef = new EntitySet<CategoryPost>(); [Association(Name = "tm_rel_categories_posts_fk2", IsForeignKey = true, Storage = "_categoryRef", ThisKey = "ID", OtherKey = "PostID")] public EntitySet<CategoryPost> CategoryRef { get { return _categoryRef; } set { _categoryRef.Assign(value); } } } CategoryPost [Table(Name = "tm_rel_categories_posts")] public class CategoryPost { [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } [Column(Name = "fk_post", DbType = "int", CanBeNull = false)] public int PostID { get; set; } [Column(Name = "fk_category", DbType = "int", CanBeNull = false)] public int CategoryID { get; set; } private EntityRef<Post> _post = new EntityRef<Post>(); [Association(Name = "tm_rel_categories_posts_fk2", IsForeignKey = true, Storage = "_post", ThisKey = "PostID", OtherKey = "ID")] public Post Post { get { return _post.Entity; } set { _post.Entity = value; } } private EntityRef<Category> _category = new EntityRef<Category>(); [Association(Name = "tm_rel_categories_posts_fk", IsForeignKey = true, Storage = "_category", ThisKey = "CategoryID", OtherKey = "ID")] public Category Category { get { return _category.Entity; } set { _category.Entity = value; } } } Category [Table(Name="tm_categories")] public class Category { [Column(Name = "id", DbType = "int", CanBeNull = false, IsDbGenerated = true, IsPrimaryKey = true)] public int ID { get; set; } [Column(Name = "fk_parent", DbType = "int", CanBeNull = true)] public int ParentID { get; set; } private EntityRef<Category> _parent = new EntityRef<Category>(); [Association(Name = "tm_posts_fk2", IsForeignKey = true, Storage = "_parent", ThisKey = "ParentID", OtherKey = "ID")] public Category Parent { get { return _parent.Entity; } set { _parent.Entity = value; } } [Column(Name = "name", DbType = "varchar(100)", CanBeNull = false)] public string Name { get; set; } } So what am I doing wrong? How to make it possible to insert a post that doesn't belong to any category? How to insert categories with no posts?

    Read the article

  • Can I move beaker.SessionMiddleware to handle method somehow?

    - by Alexander A.Sosnovskiy
    It's a bit ugly that many lines of code fall into "__main__". Can someone give me a tip of how to move SessionMiddleware into handle method? I should notice that I use session in CoreXmlParser. Thanks in advance ! def handle(environ, start_response): req = webob.Request(environ) c = CoreXmlParser(req) resp = webob.Response(body=c(), charset = 'utf-8', status='200 OK', \ request=req, content_type='text/xml') resp(environ, start_response) return resp.app_iter if __name__ == '__main__': #parse config file for session options app = SessionMiddleware(handle, some_session_opts_here) from flup.server.fcgi import WSGIServer WSGIServer(app).run()

    Read the article

  • #define vs enum in an embedded environment (How do they compile?)

    - by Alexander Kondratskiy
    This question has been done to death, and I would agree that enums are the way to go. However, I am curious as to how enums compile in the final code- #defines are just string replacements, but do enums add anything to the compiled binary? Or are they both equivalent at that stage. When writing firmware and memory is very limited, is there any advantage, no matter how small, to using #defines? Thanks! EDIT: As requested by the comment below, by embedded, I mean a digital camera. Thanks for the answers! I am all for enums!

    Read the article

  • jquery , selector, contains one of the text

    - by Alexander Corotchi
    Hi , I need a help for one thing : this is my jQuery idea: var text = "Some Text1, Some Text2, Some Text3"; $("h3:contains('"+even one of this string+"')").each(function() { $(this).append("<span>Some Text</span>"); }); This is My HTML <h3 class="test1">Some Text2</h3> <h3 class="test1">Some Text1</h3> <h3 class="test3">Another Text</h3> What I want in OUTPUT: <h3 class="test1"> Some Text2 <span>Some Text</span> </h3> <h3 class="test1"> Some Text1 <span>Some Text</span> </h3> <h3 class="test3">Another Text</h3> Thanks!

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20  | Next Page >